@dudousxd/nestjs-durable-core 0.27.1 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.cjs +3978 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +2077 -0
  5. package/dist/index.d.ts +2077 -20
  6. package/dist/index.js +3912 -38
  7. package/dist/index.js.map +1 -1
  8. package/package.json +19 -5
  9. package/dist/backoff.d.ts +0 -5
  10. package/dist/backoff.d.ts.map +0 -1
  11. package/dist/backoff.js +0 -14
  12. package/dist/backoff.js.map +0 -1
  13. package/dist/checkpoints.d.ts +0 -17
  14. package/dist/checkpoints.d.ts.map +0 -1
  15. package/dist/checkpoints.js +0 -28
  16. package/dist/checkpoints.js.map +0 -1
  17. package/dist/codec-state-store.d.ts +0 -57
  18. package/dist/codec-state-store.d.ts.map +0 -1
  19. package/dist/codec-state-store.js +0 -111
  20. package/dist/codec-state-store.js.map +0 -1
  21. package/dist/completion.d.ts +0 -15
  22. package/dist/completion.d.ts.map +0 -1
  23. package/dist/completion.js +0 -13
  24. package/dist/completion.js.map +0 -1
  25. package/dist/duration.d.ts +0 -6
  26. package/dist/duration.d.ts.map +0 -1
  27. package/dist/duration.js +0 -42
  28. package/dist/duration.js.map +0 -1
  29. package/dist/engine.d.ts +0 -525
  30. package/dist/engine.d.ts.map +0 -1
  31. package/dist/engine.js +0 -1785
  32. package/dist/engine.js.map +0 -1
  33. package/dist/entities.d.ts +0 -44
  34. package/dist/entities.d.ts.map +0 -1
  35. package/dist/entities.js +0 -68
  36. package/dist/entities.js.map +0 -1
  37. package/dist/errors.d.ts +0 -56
  38. package/dist/errors.d.ts.map +0 -1
  39. package/dist/errors.js +0 -93
  40. package/dist/errors.js.map +0 -1
  41. package/dist/event-accumulators.d.ts +0 -39
  42. package/dist/event-accumulators.d.ts.map +0 -1
  43. package/dist/event-accumulators.js +0 -74
  44. package/dist/event-accumulators.js.map +0 -1
  45. package/dist/events.d.ts +0 -9
  46. package/dist/events.d.ts.map +0 -1
  47. package/dist/events.js +0 -41
  48. package/dist/events.js.map +0 -1
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/interfaces.d.ts +0 -830
  51. package/dist/interfaces.d.ts.map +0 -1
  52. package/dist/interfaces.js +0 -3
  53. package/dist/interfaces.js.map +0 -1
  54. package/dist/metrics.d.ts +0 -44
  55. package/dist/metrics.d.ts.map +0 -1
  56. package/dist/metrics.js +0 -76
  57. package/dist/metrics.js.map +0 -1
  58. package/dist/protocol.d.ts +0 -17
  59. package/dist/protocol.d.ts.map +0 -1
  60. package/dist/protocol.js +0 -53
  61. package/dist/protocol.js.map +0 -1
  62. package/dist/queue.d.ts +0 -48
  63. package/dist/queue.d.ts.map +0 -1
  64. package/dist/queue.js +0 -45
  65. package/dist/queue.js.map +0 -1
  66. package/dist/remote-step-factory.d.ts +0 -15
  67. package/dist/remote-step-factory.d.ts.map +0 -1
  68. package/dist/remote-step-factory.js +0 -15
  69. package/dist/remote-step-factory.js.map +0 -1
  70. package/dist/remote-workflow-executor.d.ts +0 -24
  71. package/dist/remote-workflow-executor.d.ts.map +0 -1
  72. package/dist/remote-workflow-executor.js +0 -73
  73. package/dist/remote-workflow-executor.js.map +0 -1
  74. package/dist/scheduler.d.ts +0 -42
  75. package/dist/scheduler.d.ts.map +0 -1
  76. package/dist/scheduler.js +0 -70
  77. package/dist/scheduler.js.map +0 -1
  78. package/dist/search-attributes.d.ts +0 -17
  79. package/dist/search-attributes.d.ts.map +0 -1
  80. package/dist/search-attributes.js +0 -47
  81. package/dist/search-attributes.js.map +0 -1
  82. package/dist/step-logger.d.ts +0 -9
  83. package/dist/step-logger.d.ts.map +0 -1
  84. package/dist/step-logger.js +0 -92
  85. package/dist/step-logger.js.map +0 -1
  86. package/dist/test-helpers.d.ts +0 -11
  87. package/dist/test-helpers.d.ts.map +0 -1
  88. package/dist/test-helpers.js +0 -15
  89. package/dist/test-helpers.js.map +0 -1
  90. package/dist/testing/in-memory-state-store.d.ts +0 -37
  91. package/dist/testing/in-memory-state-store.d.ts.map +0 -1
  92. package/dist/testing/in-memory-state-store.js +0 -134
  93. package/dist/testing/in-memory-state-store.js.map +0 -1
  94. package/dist/testing/in-memory-transport.d.ts +0 -25
  95. package/dist/testing/in-memory-transport.d.ts.map +0 -1
  96. package/dist/testing/in-memory-transport.js +0 -53
  97. package/dist/testing/in-memory-transport.js.map +0 -1
  98. package/dist/tokens.d.ts +0 -8
  99. package/dist/tokens.d.ts.map +0 -1
  100. package/dist/tokens.js +0 -11
  101. package/dist/tokens.js.map +0 -1
  102. package/dist/transport-pool.d.ts +0 -30
  103. package/dist/transport-pool.d.ts.map +0 -1
  104. package/dist/transport-pool.js +0 -86
  105. package/dist/transport-pool.js.map +0 -1
  106. package/dist/workflow-ctx.d.ts +0 -61
  107. package/dist/workflow-ctx.d.ts.map +0 -1
  108. package/dist/workflow-ctx.js +0 -451
  109. package/dist/workflow-ctx.js.map +0 -1
  110. package/dist/workflow-ref.d.ts +0 -34
  111. package/dist/workflow-ref.d.ts.map +0 -1
  112. package/dist/workflow-ref.js +0 -32
  113. package/dist/workflow-ref.js.map +0 -1
@@ -1,86 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransportPool = void 0;
4
- /**
5
- * An ordered pool of named transports. The engine dispatches on the first and fails over to the
6
- * next on a dispatch error; a step can pin one by id. Pure transport plumbing — no run lifecycle —
7
- * so it lives apart from the engine.
8
- */
9
- class TransportPool {
10
- transports;
11
- constructor(transports) {
12
- this.transports = transports;
13
- }
14
- get size() {
15
- return this.transports.length;
16
- }
17
- /** Register the engine's result/heartbeat/step-event handlers on EVERY transport — a result can come
18
- * back on whichever one delivered the task, so failover stays symmetric. `onStepEvent` is wired only
19
- * on transports that carry streamed workflow step lifecycle (BullMQ); others simply skip it. */
20
- bind(onResult, onHeartbeat, onStepEvent) {
21
- for (const { transport } of this.transports) {
22
- transport.onResult(onResult);
23
- transport.onHeartbeat(onHeartbeat);
24
- if (onStepEvent && transport.onStepEvent) {
25
- transport.onStepEvent(onStepEvent);
26
- }
27
- }
28
- }
29
- /**
30
- * Dispatch `task` over the pool: try the preferred (or first) transport, fail over to the next on
31
- * a dispatch error, and stamp the task with the id of the transport that accepted it (so a worker
32
- * replies on the matching one). Throws if every transport fails.
33
- */
34
- async dispatch(task, preferId) {
35
- let lastErr;
36
- for (const { id, transport } of this.ordered(preferId)) {
37
- try {
38
- await transport.dispatch({ ...task, transport: id });
39
- return;
40
- }
41
- catch (err) {
42
- lastErr = err;
43
- }
44
- }
45
- throw lastErr ?? new Error('no transport accepted the dispatch');
46
- }
47
- /** Worker-health for `group`, merged across every transport that can report it (a group's queue
48
- * and its workers may live on any pinned transport). Undefined when no transport implements
49
- * `groupHealth` (e.g. a pure in-process transport — nothing to introspect). */
50
- async groupHealth(group) {
51
- const reports = [];
52
- for (const { transport } of this.transports) {
53
- if (transport.groupHealth)
54
- reports.push(await transport.groupHealth(group));
55
- }
56
- if (reports.length === 0)
57
- return undefined;
58
- return {
59
- group,
60
- depth: reports.reduce((sum, r) => sum + r.depth, 0),
61
- liveWorkers: reports.flatMap((r) => r.liveWorkers),
62
- };
63
- }
64
- /** Distinct worker groups with a live heartbeat, merged across every transport that can report it. */
65
- async listWorkerGroups() {
66
- const groups = new Set();
67
- for (const { transport } of this.transports) {
68
- if (transport.listWorkerGroups) {
69
- for (const g of await transport.listWorkerGroups())
70
- groups.add(g);
71
- }
72
- }
73
- return [...groups];
74
- }
75
- /** Pinned `preferId` first, then the rest (failover order). */
76
- ordered(preferId) {
77
- if (!preferId)
78
- return this.transports;
79
- const pref = this.transports.filter((t) => t.id === preferId);
80
- if (pref.length === 0)
81
- throw new Error(`transport "${preferId}" is not registered`);
82
- return [...pref, ...this.transports.filter((t) => t.id !== preferId)];
83
- }
84
- }
85
- exports.TransportPool = TransportPool;
86
- //# sourceMappingURL=transport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,IAAI,KAAK,CAAC,cAAc,QAAQ,qBAAqB,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC;CACF;AA5ED,sCA4EC"}
@@ -1,61 +0,0 @@
1
- import type { RemoteStepDef, StateStore, StepCheckpoint, StepError, StepEvent, StepInvocation, StepKind, WorkflowCtx } from './interfaces';
2
- /** A saga undo registered by a completed step, kept with its step name for visibility on failure. */
3
- export interface Compensation {
4
- name: string;
5
- fn: () => Promise<void>;
6
- }
7
- /** A finished local step the host should checkpoint and announce (completed or failed). */
8
- export interface StepRecord {
9
- runId: string;
10
- seq: number;
11
- name: string;
12
- kind: StepKind;
13
- input?: unknown;
14
- events?: StepEvent[];
15
- attempts: number;
16
- enqueuedAt: Date;
17
- startedAt: Date;
18
- workerGroup?: string;
19
- }
20
- /**
21
- * The narrow surface {@link createWorkflowCtx} needs from the engine — the seam between the
22
- * authoring API (this module) and the orchestrator (the engine owns lifecycle: emitting events,
23
- * suspending/resuming runs, dispatching remote steps).
24
- */
25
- export interface CtxHost {
26
- readonly store: StateStore;
27
- /**
28
- * Per-execution checkpoint snapshot, loaded ONCE at execution start (the completed prefix this
29
- * replay walks). Lets each primitive read the prefix from memory instead of a per-call DB SELECT
30
- * (the O(N²) replay-reads fix). A seq ABSENT from the map is NOT cached — the primitive falls back
31
- * to the live store, so the checkpoint this resume is waking on (signal/timer/child, written after
32
- * the snapshot) is always read fresh. New checkpoints written during this execution are inserted
33
- * into the map so any later same-execution read sees them. Undefined ⇒ always hit the store.
34
- */
35
- readonly replay?: Map<number, StepCheckpoint>;
36
- clock(): number;
37
- webhookUrl?: (token: string) => string;
38
- /** Mark a local step's body as started — emits `step.started` and (optionally) a `running` checkpoint. */
39
- startStep(step: StepRecord): Promise<void>;
40
- completeStep(step: StepRecord & {
41
- output: unknown;
42
- }): Promise<void>;
43
- failStep(step: StepRecord & {
44
- error: StepError;
45
- }): Promise<void>;
46
- callRemote<TInput, TOutput>(runId: string, seq: number, step: RemoteStepDef<TInput, TOutput>, input: TInput, queue?: string, transport?: string): Promise<TOutput>;
47
- /** Start a child run once, deferred so it can't reentrantly resume a still-running parent. */
48
- startChild(workflow: string, input: unknown, id: string): void;
49
- /** Deliver an op to a durable entity (deferred), optionally with a `reply` token for the result. */
50
- signalEntity?(name: string, key: string, op: string, arg: unknown, reply?: string): void;
51
- /** Run a local step body through the registered step interceptors (identity if none). */
52
- interceptStep?<T>(invocation: StepInvocation, body: () => Promise<T>): Promise<T>;
53
- }
54
- /**
55
- * Build the {@link WorkflowCtx} handed to a workflow body. Every primitive is a closure over the
56
- * position counter (the per-run logical position) and the saga `compensations` stack, so `task`/
57
- * `child` compose `step`/`waitForSignal` directly. All durability goes through {@link CtxHost}, so
58
- * the workflow body stays deterministic.
59
- */
60
- export declare function createWorkflowCtx(host: CtxHost, runId: string, compensations: Compensation[], workflow?: string): WorkflowCtx;
61
- //# sourceMappingURL=workflow-ctx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-ctx.d.ts","sourceRoot":"","sources":["../src/workflow-ctx.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,aAAa,EACb,UAAU,EACV,cAAc,EACd,SAAS,EACT,SAAS,EACT,cAAc,EACd,QAAQ,EAGR,WAAW,EACZ,MAAM,cAAc,CAAC;AAKtB,qGAAqG;AACrG,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf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,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzF,yFAAyF;IACzF,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnF;AAcD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,YAAY,EAAE,EAC7B,QAAQ,SAAK,GACZ,WAAW,CAudb"}
@@ -1,451 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWorkflowCtx = createWorkflowCtx;
4
- const backoff_1 = require("./backoff");
5
- const checkpoints_1 = require("./checkpoints");
6
- const completion_1 = require("./completion");
7
- const duration_1 = require("./duration");
8
- const errors_1 = require("./errors");
9
- const events_1 = require("./events");
10
- const protocol_1 = require("./protocol");
11
- const step_logger_1 = require("./step-logger");
12
- const workflow_ref_1 = require("./workflow-ref");
13
- /** The per-run logical position counter. `rewind()` gives a position back (see `ctx.patched`). */
14
- class Position {
15
- seq = -1;
16
- next() {
17
- this.seq += 1;
18
- return this.seq;
19
- }
20
- rewind() {
21
- this.seq -= 1;
22
- }
23
- }
24
- /**
25
- * Build the {@link WorkflowCtx} handed to a workflow body. Every primitive is a closure over the
26
- * position counter (the per-run logical position) and the saga `compensations` stack, so `task`/
27
- * `child` compose `step`/`waitForSignal` directly. All durability goes through {@link CtxHost}, so
28
- * the workflow body stays deterministic.
29
- */
30
- function createWorkflowCtx(host, runId, compensations, workflow = '') {
31
- const { store, replay } = host;
32
- const pos = new Position();
33
- // Read the checkpoint at `seq`: from the per-execution snapshot when present (no DB round-trip),
34
- // otherwise from the live store. Absence in the snapshot means "written after the snapshot" (the
35
- // signal/timer/child this resume wakes on, or nothing yet) — those MUST hit the store. Identical
36
- // behaviour to a raw `store.getCheckpoint`, just memoized for the completed prefix.
37
- const readCheckpoint = (seq) => {
38
- const hit = replay?.get(seq);
39
- if (hit !== undefined)
40
- return hit;
41
- return store.getCheckpoint(runId, seq);
42
- };
43
- // Persist a checkpoint AND reflect it in the snapshot, so a later same-execution read of this seq
44
- // (e.g. a re-read within the same call) sees it instead of falling back to the store.
45
- const writeCheckpoint = async (cp) => {
46
- await store.saveCheckpoint(cp);
47
- replay?.set(cp.seq, cp);
48
- };
49
- const step = async (name, fn, options) => {
50
- const current = pos.next();
51
- const existing = await readCheckpoint(current);
52
- if (existing && existing.name !== name) {
53
- throw new errors_1.NonDeterminismError(runId, current, name, existing.name);
54
- }
55
- if (existing && existing.status === 'completed') {
56
- // Register the compensation on replay too, so a saga undoes ALL completed steps — even
57
- // those done in an earlier (since-suspended) pass — not just the ones run this pass.
58
- if (options?.compensate)
59
- compensations.push({ name, fn: options.compensate });
60
- return existing.output;
61
- }
62
- const maxAttempts = Math.max(1, options?.retries ?? 1);
63
- const startedAt = new Date();
64
- // Announce the body has begun (and, when enabled, checkpoint it `running`) so the step is
65
- // visible in flight — not only once it settles. Skipped on replay: a completed step returns
66
- // above before reaching here, so this fires once, when the body actually first runs.
67
- await host.startStep({
68
- runId,
69
- seq: current,
70
- name,
71
- kind: 'local',
72
- attempts: 1,
73
- enqueuedAt: startedAt,
74
- startedAt,
75
- });
76
- for (let attempt = 1;; attempt += 1) {
77
- // Events are scoped per attempt — a retry starts a clean log, so the checkpoint reflects
78
- // only the attempt that actually completed (or the final failing one).
79
- const events = [];
80
- try {
81
- const invocation = {
82
- runId,
83
- workflow,
84
- stepName: name,
85
- seq: current,
86
- attempt,
87
- };
88
- const body = () => fn((0, step_logger_1.createStepLogger)(events, host.clock));
89
- const output = host.interceptStep
90
- ? await host.interceptStep(invocation, body)
91
- : await body();
92
- await host.completeStep({
93
- runId,
94
- seq: current,
95
- name,
96
- kind: 'local',
97
- output,
98
- events,
99
- attempts: attempt,
100
- enqueuedAt: startedAt,
101
- startedAt,
102
- });
103
- if (options?.compensate)
104
- compensations.push({ name, fn: options.compensate });
105
- return output;
106
- }
107
- catch (err) {
108
- if (err instanceof errors_1.FatalError || attempt >= maxAttempts) {
109
- await host.failStep({
110
- runId,
111
- seq: current,
112
- name,
113
- kind: 'local',
114
- error: {
115
- message: err instanceof Error ? err.message : String(err),
116
- stack: err instanceof Error ? err.stack : undefined,
117
- },
118
- events,
119
- attempts: attempt,
120
- enqueuedAt: startedAt,
121
- startedAt,
122
- });
123
- throw err;
124
- }
125
- // Wait out the backoff before the next attempt (no-op when backoffMs is unset).
126
- const wait = (0, backoff_1.backoffDelay)(attempt, options);
127
- if (wait > 0)
128
- await new Promise((resolve) => setTimeout(resolve, wait));
129
- }
130
- }
131
- };
132
- // Exactly-once DB step: run the body and write the step checkpoint in ONE store transaction, so the
133
- // business write commits atomically with the "done" marker (a plain step checkpoints AFTER the body,
134
- // so a crash in between re-runs it). Replay returns the recorded output without re-running.
135
- const transaction = async (name, fn) => {
136
- if (!store.transaction) {
137
- throw new Error('ctx.transaction needs a store that supports transactions (the SQL adapters do). Use ctx.step for non-transactional work.');
138
- }
139
- const current = pos.next();
140
- const existing = await readCheckpoint(current);
141
- if (existing && existing.name !== name) {
142
- throw new errors_1.NonDeterminismError(runId, current, name, existing.name);
143
- }
144
- if (existing && existing.status === 'completed')
145
- return existing.output;
146
- return store.transaction(async (tx) => {
147
- const output = await fn(tx.raw);
148
- const cp = (0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name, kind: 'local', output });
149
- await tx.saveCheckpoint(cp);
150
- // Reflect the committed checkpoint in the snapshot, keeping the writeback invariant uniform.
151
- replay?.set(current, cp);
152
- return output;
153
- });
154
- };
155
- // Shared by sleep / sleepUntil: record a durable timer at this position and suspend until `wakeAt`
156
- // (epoch ms). The wakeAt is computed by the caller — but only used on the first run; on replay the
157
- // recorded checkpoint's wakeAt wins, so a clock change can't shift an already-scheduled timer.
158
- const suspendUntil = async (wakeAt) => {
159
- const current = pos.next();
160
- const now = host.clock();
161
- const existing = await readCheckpoint(current);
162
- if (existing) {
163
- // Timer already recorded: resume if due, otherwise re-suspend cheaply.
164
- if (now >= (existing.wakeAt ?? 0))
165
- return;
166
- throw new errors_1.WorkflowSuspended(existing.wakeAt ?? now);
167
- }
168
- const at = wakeAt();
169
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name: 'sleep', kind: 'sleep', wakeAt: at }));
170
- throw new errors_1.WorkflowSuspended(at);
171
- };
172
- const sleep = (duration) => suspendUntil(() => host.clock() + (0, duration_1.parseDuration)(duration));
173
- const sleepUntil = (when) => suspendUntil(() => (typeof when === 'number' ? when : when.getTime()));
174
- // End this run and hand off to a fresh execution (clean history) with the new input. Terminal —
175
- // it always throws, so any code after it in the workflow is unreachable.
176
- const continueAsNew = (input) => {
177
- throw new errors_1.ContinueAsNew(input);
178
- };
179
- // NOTE (determinism): a bounded wait consumes TWO logical positions (deadline + wait), an
180
- // unbounded one consumes ONE. So adding or removing `{ timeoutMs }` on an existing `waitForSignal`
181
- // shifts the seq of every later step — treat it as a workflow-version change for in-flight runs.
182
- // Consume a buffered signal (one delivered before this run was waiting), recording it as the
183
- // signal checkpoint at `seq` so it resumes immediately instead of suspending. Replay-safe: the
184
- // checkpoint makes the consumption deterministic.
185
- const consumeBuffered = async (token, seq) => {
186
- const buffered = await store.takeBufferedSignal(token);
187
- if (!buffered)
188
- return null;
189
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({
190
- runId,
191
- seq,
192
- name: `signal:${token}`,
193
- kind: 'signal',
194
- output: buffered.payload,
195
- }));
196
- return { value: buffered.payload };
197
- };
198
- const waitForSignal = async (token, opts) => {
199
- if (opts?.timeoutMs == null) {
200
- const current = pos.next();
201
- const existing = await readCheckpoint(current);
202
- if (existing && existing.status === 'completed')
203
- return existing.output;
204
- const buffered = await consumeBuffered(token, current);
205
- if (buffered)
206
- return buffered.value;
207
- await store.putSignalWaiter({ token, runId, seq: current });
208
- throw new errors_1.WorkflowSuspended();
209
- }
210
- const timeoutMs = opts.timeoutMs;
211
- const deadlineSeq = pos.next();
212
- const waitSeq = pos.next();
213
- // The deadline is recorded durably as a timer checkpoint so replay knows it; the run also gets a
214
- // run-level wakeAt (via WorkflowSuspended) so the timer poller resumes it at the deadline.
215
- const recorded = await readCheckpoint(deadlineSeq);
216
- const deadline = recorded?.wakeAt ?? host.clock() + timeoutMs;
217
- if (!recorded) {
218
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({
219
- runId,
220
- seq: deadlineSeq,
221
- name: `timeout:${token}`,
222
- kind: 'sleep',
223
- wakeAt: deadline,
224
- }));
225
- }
226
- const waited = await readCheckpoint(waitSeq);
227
- if (waited && waited.status === 'completed')
228
- return waited.output;
229
- const buffered = await consumeBuffered(token, waitSeq);
230
- if (buffered)
231
- return buffered.value;
232
- if (host.clock() >= deadline) {
233
- await store.takeSignalWaiter(token).catch(() => undefined);
234
- throw new errors_1.SignalTimeoutError(token, timeoutMs);
235
- }
236
- await store.putSignalWaiter({ token, runId, seq: waitSeq });
237
- throw new errors_1.WorkflowSuspended(deadline);
238
- };
239
- // Wait for a named event delivered by engine.publishEvent(name, payload). Like waitForSignal, but
240
- // name-based pub/sub with optional `match` filtering — the token embeds name + match (see events.ts),
241
- // so a publish fans out to the runs whose match the payload satisfies.
242
- const waitForEvent = async (name, opts) => {
243
- if (opts?.timeoutMs == null) {
244
- const current = pos.next();
245
- const token = (0, events_1.eventToken)(name, opts?.match, runId, current);
246
- const existing = await readCheckpoint(current);
247
- if (existing && existing.status === 'completed')
248
- return existing.output;
249
- await store.putSignalWaiter({ token, runId, seq: current });
250
- throw new errors_1.WorkflowSuspended();
251
- }
252
- const timeoutMs = opts.timeoutMs;
253
- const deadlineSeq = pos.next();
254
- const waitSeq = pos.next();
255
- const token = (0, events_1.eventToken)(name, opts.match, runId, waitSeq);
256
- const recorded = await readCheckpoint(deadlineSeq);
257
- const deadline = recorded?.wakeAt ?? host.clock() + timeoutMs;
258
- if (!recorded) {
259
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({
260
- runId,
261
- seq: deadlineSeq,
262
- name: `timeout:event:${name}`,
263
- kind: 'sleep',
264
- wakeAt: deadline,
265
- }));
266
- }
267
- const waited = await readCheckpoint(waitSeq);
268
- if (waited && waited.status === 'completed')
269
- return waited.output;
270
- if (host.clock() >= deadline) {
271
- await store.takeSignalWaiter(token).catch(() => undefined);
272
- throw new errors_1.SignalTimeoutError(`event:${name}`, timeoutMs);
273
- }
274
- await store.putSignalWaiter({ token, runId, seq: waitSeq });
275
- throw new errors_1.WorkflowSuspended(deadline);
276
- };
277
- // An external task = a checkpointed dispatch + a wait for its async-completion `Completion`
278
- // (delivered by engine.completeTask/failTask). The whole "fire at a foreign system, suspend,
279
- // resume when it reports back" pattern as one call.
280
- const task = async (name, dispatch, options) => {
281
- await step(`task:dispatch:${name}`, dispatch, options);
282
- return (0, completion_1.unwrapCompletion)(await waitForSignal(`task:${runId}:${name}`), `task "${name}"`);
283
- };
284
- // Child workflow (await result): start it once, then suspend on a `child:<id>` waiter the child
285
- // signals on its terminal state (see engine.notifyParent).
286
- const child = async (workflow, input, childId) => {
287
- const current = pos.next();
288
- const id = childId ?? `${runId}.child.${current}`;
289
- const existing = await readCheckpoint(current);
290
- if (existing && existing.status === 'completed') {
291
- return (0, completion_1.unwrapCompletion)(existing.output, `child "${id}"`);
292
- }
293
- await store.putSignalWaiter({ token: `child:${id}`, runId, seq: current });
294
- if (!(await store.getRun(id)))
295
- host.startChild((0, workflow_ref_1.workflowName)(workflow), input, id);
296
- // Make the awaited child visible in the parent's timeline WHILE it runs: a `running` placeholder
297
- // at this seq with the same `signal:child:<id>` name the signal resolution later overwrites as
298
- // `completed`. So the dashboard shows the child node (and can inline-expand it) live, instead of
299
- // it appearing only when it finishes. Written once (skipped on replay, where `existing` is set);
300
- // `running` is ignored by replay history, so it never short-circuits determinism.
301
- if (!existing) {
302
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({
303
- runId,
304
- seq: current,
305
- name: `signal:child:${id}`,
306
- kind: 'signal',
307
- status: 'running',
308
- }));
309
- }
310
- throw new errors_1.WorkflowSuspended();
311
- };
312
- // Child workflow (fire-and-forget): dispatch it once and return its id WITHOUT suspending. The
313
- // start is checkpointed at this position so replay returns the same id without re-dispatching, and
314
- // is idempotent by id, so `child(..., sameId)` later joins the same run rather than starting a new
315
- // one (start + join scatter-gather).
316
- const startChild = async (workflow, input, childId) => {
317
- const current = pos.next();
318
- const id = childId ?? `${runId}.child.${current}`;
319
- const existing = await readCheckpoint(current);
320
- if (existing && existing.status === 'completed')
321
- return existing.output;
322
- if (!(await store.getRun(id)))
323
- host.startChild((0, workflow_ref_1.workflowName)(workflow), input, id);
324
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name: `spawn:${id}`, kind: 'local', output: id }));
325
- return id;
326
- };
327
- // Call a durable entity op and await its result: register a reply waiter at this position, dispatch
328
- // the op with the reply token, and suspend until the entity signals the result back (checkpointed,
329
- // so replay returns it without re-dispatching).
330
- const callEntity = async (name, key, op, arg) => {
331
- const current = pos.next();
332
- const existing = await readCheckpoint(current);
333
- if (existing && existing.status === 'completed')
334
- return existing.output;
335
- const reply = `entityreply:${runId}:${current}`;
336
- await store.putSignalWaiter({ token: reply, runId, seq: current });
337
- host.signalEntity?.(name, key, op, arg, reply);
338
- throw new errors_1.WorkflowSuspended();
339
- };
340
- // Send a durable entity op without awaiting a result — dispatched once (checkpointed, replay-safe).
341
- const signalEntity = async (name, key, op, arg) => {
342
- const current = pos.next();
343
- const existing = await readCheckpoint(current);
344
- if (existing && existing.status === 'completed')
345
- return;
346
- host.signalEntity?.(name, key, op, arg);
347
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name: `entitysig:${name}:${key}`, kind: 'local' }));
348
- };
349
- // A breakpoint = a visible `pending` checkpoint + a signal waiter the dashboard resumes via
350
- // `engine.continue`. Reuses the signal machinery, so resume overwrites the pending checkpoint
351
- // with a completed one and the run replays past it.
352
- const breakpoint = async (label) => {
353
- const current = pos.next();
354
- const existing = await readCheckpoint(current);
355
- if (existing && existing.status === 'completed')
356
- return;
357
- if (!existing) {
358
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({
359
- runId,
360
- seq: current,
361
- name: label ? `breakpoint:${label}` : 'breakpoint',
362
- kind: 'signal',
363
- status: 'pending',
364
- }));
365
- await store.putSignalWaiter({ token: (0, protocol_1.breakpointToken)(runId, current), runId, seq: current });
366
- }
367
- throw new errors_1.WorkflowSuspended();
368
- };
369
- // Guard an in-place change: a fresh run records a `patch:<id>` marker here and takes the new
370
- // branch; a run recorded under the OLD code finds a real step at this position instead, so we
371
- // rewind the logical position (the marker is transparent to it) and return false — its replay
372
- // reads that old step next and follows the old branch. No position shift → no corruption.
373
- const patched = async (id) => {
374
- const marker = `patch:${id}`;
375
- const current = pos.next();
376
- const existing = await readCheckpoint(current);
377
- if (existing) {
378
- if (existing.name === marker)
379
- return true;
380
- if (existing.name.startsWith('patch:')) {
381
- throw new errors_1.NonDeterminismError(runId, current, marker, existing.name);
382
- }
383
- pos.rewind(); // not a marker: an old run's step lives here — give the position back to it
384
- return false;
385
- }
386
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name: marker, kind: 'local', output: true }));
387
- return true;
388
- };
389
- // An update point: suspend on a run-scoped `update:<runId>:<name>` token that engine.update
390
- // delivers to (after its validator passes). Reuses the signal machinery; run-scoped like task/child.
391
- const onUpdate = (name, opts) => waitForSignal(`update:${runId}:${name}`, opts);
392
- // A queryable named value: a checkpoint whose `name` is `event:<key>`, so the latest value for a
393
- // key is just the highest-seq such checkpoint (read by engine.getEvent). Replay-idempotent.
394
- const setEvent = async (key, value) => {
395
- const current = pos.next();
396
- const name = `event:${key}`;
397
- const existing = await readCheckpoint(current);
398
- if (existing && existing.name !== name) {
399
- throw new errors_1.NonDeterminismError(runId, current, name, existing.name);
400
- }
401
- if (existing && existing.status === 'completed')
402
- return; // replay: already published
403
- await writeCheckpoint((0, checkpoints_1.instantCheckpoint)({ runId, seq: current, name, kind: 'local', output: value }));
404
- };
405
- // A durable webhook reserves a logical position NOW to mint a stable token, so the url can be
406
- // handed to a third party before `wait()` suspends. `wait()` then parks on that same position
407
- // until the callback lands as engine.signal(token, body) — single position, replay-safe.
408
- const webhook = () => {
409
- const current = pos.next();
410
- const token = `wh:${runId}:${current}`;
411
- const wait = async () => {
412
- const existing = await readCheckpoint(current);
413
- if (existing && existing.status === 'completed')
414
- return existing.output;
415
- await store.putSignalWaiter({ token, runId, seq: current });
416
- throw new errors_1.WorkflowSuspended();
417
- };
418
- return { token, url: host.webhookUrl?.(token), wait };
419
- };
420
- // Deterministic non-deterministic sources: each is a checkpointed local step, so the value is
421
- // captured on the first run and replayed verbatim (a raw Date.now()/Math.random() inside a
422
- // workflow would differ across replays and corrupt the run).
423
- const now = () => step('now', async () => host.clock());
424
- const random = () => step('random', async () => Math.random());
425
- const uuid = () => step('uuid', async () => globalThis.crypto.randomUUID());
426
- return {
427
- runId,
428
- step,
429
- transaction,
430
- callEntity,
431
- signalEntity,
432
- sleep,
433
- sleepUntil,
434
- continueAsNew,
435
- waitForSignal,
436
- waitForEvent,
437
- task,
438
- child,
439
- startChild,
440
- breakpoint,
441
- webhook,
442
- setEvent,
443
- onUpdate,
444
- patched,
445
- now,
446
- random,
447
- uuid,
448
- call: (remote, input, opts) => host.callRemote(runId, pos.next(), remote, input, opts?.queue, opts?.transport),
449
- };
450
- }
451
- //# sourceMappingURL=workflow-ctx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workflow-ctx.js","sourceRoot":"","sources":["../src/workflow-ctx.ts"],"names":[],"mappings":";;AAyGA,8CA4dC;AArkBD,uCAAyC;AACzC,+CAAkD;AAClD,6CAAgD;AAChD,yCAA2C;AAC3C,qCAMkB;AAClB,qCAAsC;A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