@cfxlabsinc/b2b-services
    Preparing search index...

    Operator-facing control plane for Temporal schedules, backing every admin-dashboard surface that masters one: Reports, Victor transaction sync, and the System › Schedules surface (ACH file generation, card clearing, Solana nonce pool). The dashboard is the sole master of these schedules — the temporal-worker no longer upserts them, so create / edit / pause / trigger here are authoritative and survive worker deploys.

    Modeled on CacheBusterService: it wraps an infra client (Temporal, not Valkey), and a missing schedule is returned as data (status: "not_scheduled") rather than thrown, because "this thing has no schedule yet" is a state the page must render, not a crash. Genuine non-functional faults (temporal-api or Temporal unreachable) still throw.

    Index
    • internalEventPublisher is null for a deploy's schedule sync, which has no topic and whose changes are not an operator's activity.

      Parameters

      • args: {
            background: boolean;
            internalEventPublisher: InternalEventPublisher | null;
            temporalClient: TemporalWorkflowClient;
            temporalScheduleClient: TemporalScheduleClient;
        }
        • background: boolean

          Schedules start on background-worker's queue rather than the platform worker's.

        • internalEventPublisher: InternalEventPublisher | null
        • temporalClient: TemporalWorkflowClient
        • temporalScheduleClient: TemporalScheduleClient

      Returns TemporalScheduleAdminService

    instance: (
        ...args: [args?: { namespace: "background" }],
    ) => TemporalScheduleAdminService = ...

    The process control plane of platform-, on the queue the temporal namespace names; { namespace: "background" } is background-'s, where every schedule lives, on background-worker's queue.

    • Remove a schedule. Runs it already started are left to finish. Only the worker's registry calls this, for an id a registry entry replaces.

      Parameters

      • args: { scheduleId: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { scheduleId: string } },
      >

    • List recent executions of a workflow type via Temporal visibility, optionally narrowed to a workflowId prefix (client-side filter — prefix operators aren't portable across visibility stores). Newest-first.

      Surfaces runs the schedule doesn't track (e.g. manually started backfills). Like describe, this is a read: infra faults (temporal-api or Temporal unreachable) throw.

      Parameters

      • args: {
            excludeWorkflowIdInfix?: string;
            limit?: number;
            workflowIdPrefix?: string;
            workflowType: string;
        }
        • OptionalexcludeWorkflowIdInfix?: string

          Skip ids containing this substring. Both filters run inside the paging loop, before limit is counted — a caller excluding fan-out children (whose ids extend their parent's, so they share its prefix and can outnumber it 80:1) would otherwise get a page of nothing but children.

        • Optionallimit?: number
        • OptionalworkflowIdPrefix?: string
        • workflowType: string

      Returns Promise<
          {
              outcome: | "started"
              | "running"
              | "completed"
              | "failed"
              | "timed_out"
              | "canceled"
              | "terminated"
              | "continued_as_new";
              runId: string;
              startedAt: Date;
              workflowId: string;
          }[],
      >

    • Trigger a single immediate run, overriding the overlap policy for this one action so a manual run is never silently dropped by a SKIP policy. Returns SCHEDULE_NOT_FOUND (not a throw) when the schedule is missing, so the UI can steer the operator to create it first.

      Parameters

      • scheduleId: string

      Returns Promise<
          | { ok: true; value: { scheduleId: string } }
          | { error: ServiceError; ok: false },
      >

    • Undo pause-on-failure on one schedule in a single update: turn the policy off, and resume the schedule if Temporal itself paused it after a failed run. An operator's pause stays, as does everything else on the schedule. Skips the write when neither applies, which is every boot after the first.

      Parameters

      • args: { scheduleId: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | {
              ok: true;
              value: { policyTurnedOff: boolean; resumed: boolean; scheduleId: string };
          },
      >

    • Edit a schedule's cadence and policies in place. The workflow action (type / task queue) is preserved from the existing schedule; only the spec, policies, and (when given) workflow args the operator controls are replaced. workflowArgs replaces the action's args wholesale — pass the complete argument list, not a patch. Pause-on-failure is always written off, whatever the schedule carried.

      note stamps the schedule's state note the same way pause / unpause do, so a cadence edit leaves the same audit trail as a pause. Temporal has no dedicated note argument on update, so it is written through state.note; omitting it preserves whatever note is already there rather than clearing another actor's stamp.

      Parameters

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { scheduleId: string } },
      >