@cfxlabsinc/b2b-services
    Preparing search index...
    Index
    • Every field is required but nullable rather than optional: the caller has to state each one, and null is the deliberate "not set here" answer. An optional key lets a composition root forget it silently, which is how this service came to read MAINTENANCE_SERVICE_ID off process.env and warn at runtime instead of being handed it.

      Parameters

      • args: {
            kind: ServiceKind | null;
            region: string | null;
            serviceId: string | null;
            valkeyClient: ValkeyClient | null;
        }
        • kind: ServiceKind | null

          null falls back to "api".

        • region: string | null

          null falls back to "unknown", which is what the panel displays.

        • serviceId: string | null

          null only for a process deliberately not individually toggleable: it stays gated by the global flag but never appears in the admin panel.

        • valkeyClient: ValkeyClient | null

      Returns MaintenanceService

    instance: (...args: [args: { kind: ServiceKind }]) => MaintenanceService = ...

    The process gate for kind, from the process keys MAINTENANCE_SERVICE_ID and AWS_REGION, which describe the process and so are never namespaced.

    • Effective gate state: the global flag OR this service's own flag.

      The global read happens even when serviceId is unset. A process with no MAINTENANCE_SERVICE_ID has no per-service flag to check and no registry entry for an operator to toggle — it is exactly the process the global switch exists for, so it must not short-circuit to false.

      Both reads share one 5s cache window and one round trip.

      A stale cache races the refresh against GATE_MAX_BLOCK_MS rather than awaiting it outright — see that constant for why a gate on the onRequest path must not be allowed to block without a ceiling.

      Returns Promise<boolean>

    • written is false when no client or an open breaker skipped the write.

      Parameters

      • on: boolean

      Returns Promise<
          | { ok: true; value: { written: boolean } }
          | { error: ReadOnlyError; ok: false },
      >

    • written is false when no client or an open breaker skipped the write.

      Parameters

      • serviceId: string
      • on: boolean

      Returns Promise<
          | { error: ReadOnlyError; ok: false }
          | { ok: true; value: { written: boolean } },
      >