@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 unreachable, gRPC error) still throw.

    Index
    • Bootstrap a schedule that does not exist yet. The worker no longer creates these, so a fresh environment relies on this. The workflow type is passed as a string (the registered workflow name); the action's task queue defaults to the service's configured queue.

      Parameters

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

    • 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 unreachable, gRPC error) 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;
          }[],
      >

    • Pause a schedule with an audit note (carries the actor id).

      Parameters

      • args: { note: string; scheduleId: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { scheduleId: 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 },
      >

    • Resume a paused schedule with an audit note (carries the actor id).

      Parameters

      • args: { note: string; scheduleId: string }

      Returns Promise<
          | { error: ServiceError; ok: false }
          | { ok: true; value: { 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.

      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 } },
      >