@voyant-travel/workflows 0.111.10 → 0.111.12
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.
- package/dist/events/compile.d.ts +0 -6
- package/dist/events/compile.d.ts.map +1 -1
- package/dist/events/compile.js +1 -73
- package/dist/runtime/ctx.d.ts +1 -2
- package/dist/runtime/ctx.d.ts.map +1 -1
- package/dist/runtime/executor.d.ts +1 -4
- package/dist/runtime/executor.d.ts.map +1 -1
- package/dist/runtime/executor.js +1 -2
- package/dist/runtime/journal.d.ts +0 -7
- package/dist/runtime/journal.d.ts.map +1 -1
- package/dist/runtime/journal.js +0 -15
- package/package.json +5 -5
- package/src/events/compile.ts +1 -100
- package/src/runtime/ctx.ts +0 -4
- package/src/runtime/executor.ts +2 -11
- package/src/runtime/journal.ts +0 -16
package/dist/events/compile.d.ts
CHANGED
|
@@ -4,12 +4,6 @@ export declare class EventFilterCompileError extends Error {
|
|
|
4
4
|
readonly errors: string[];
|
|
5
5
|
constructor(message: string, errors?: string[]);
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Compile an authored declaration into a runtime entry. Throws
|
|
9
|
-
* `EventFilterCompileError` on shape errors so authoring problems fail
|
|
10
|
-
* at module-load time.
|
|
11
|
-
*/
|
|
12
|
-
export declare function compileEventFilter<T>(eventType: string, declaration: EventFilterDeclaration<T>): Promise<EventFilterRuntimeEntry>;
|
|
13
7
|
/**
|
|
14
8
|
* Compile + register in one step. The synchronous wrapper for `trigger.on()`
|
|
15
9
|
* that user code calls — validates the declaration, computes the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/events/compile.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAI3D,OAAO,EAAE,KAAK,uBAAuB,EAA0B,MAAM,eAAe,CAAA;AAEpF,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;gBAEb,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,EAAO;CAKnD;AAED
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/events/compile.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAI3D,OAAO,EAAE,KAAK,uBAAuB,EAA0B,MAAM,eAAe,CAAA;AAEpF,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAA;gBAEb,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,EAAO;CAKnD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACrC,uBAAuB,CAOzB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACrC,uBAAuB,CAqFzB"}
|
package/dist/events/compile.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Called from `trigger.on(...)` in `../trigger.js`.
|
|
7
7
|
import { validateInputMapper } from "./input-mapper.js";
|
|
8
|
-
import { canonicalJson
|
|
8
|
+
import { canonicalJson } from "./payload-hash.js";
|
|
9
9
|
import { validatePredicate } from "./predicate.js";
|
|
10
10
|
import { getEventFilterRegistry } from "./registry.js";
|
|
11
11
|
export class EventFilterCompileError extends Error {
|
|
@@ -16,78 +16,6 @@ export class EventFilterCompileError extends Error {
|
|
|
16
16
|
this.errors = errors;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Compile an authored declaration into a runtime entry. Throws
|
|
21
|
-
* `EventFilterCompileError` on shape errors so authoring problems fail
|
|
22
|
-
* at module-load time.
|
|
23
|
-
*/
|
|
24
|
-
export async function compileEventFilter(eventType, declaration) {
|
|
25
|
-
if (typeof eventType !== "string" || eventType.length === 0) {
|
|
26
|
-
throw new EventFilterCompileError(`trigger.on(eventType, ...): eventType must be a non-empty string`);
|
|
27
|
-
}
|
|
28
|
-
if (typeof declaration !== "object" || declaration === null) {
|
|
29
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}", ...): declaration must be an object`);
|
|
30
|
-
}
|
|
31
|
-
if (!declaration.target || typeof declaration.target !== "object") {
|
|
32
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}", ...): "target" must be a workflow definition (got ${typeof declaration.target})`);
|
|
33
|
-
}
|
|
34
|
-
const targetWorkflowId = typeof declaration.target.id === "string"
|
|
35
|
-
? declaration.target.id
|
|
36
|
-
: "";
|
|
37
|
-
if (targetWorkflowId.length === 0) {
|
|
38
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}", ...): "target.id" must be a non-empty string`);
|
|
39
|
-
}
|
|
40
|
-
// Validate `where` if supplied.
|
|
41
|
-
const where = declaration.where;
|
|
42
|
-
if (where !== undefined) {
|
|
43
|
-
const result = validatePredicate(where);
|
|
44
|
-
if (!result.ok) {
|
|
45
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}", target=${targetWorkflowId}): invalid where clause`, result.errors);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Validate `input` if supplied.
|
|
49
|
-
const input = declaration.input;
|
|
50
|
-
if (input !== undefined) {
|
|
51
|
-
const result = validateInputMapper(input);
|
|
52
|
-
if (!result.ok) {
|
|
53
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}", target=${targetWorkflowId}): invalid input mapper`, result.errors);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Reject the legacy `match` callback explicitly so authoring errors are obvious.
|
|
57
|
-
if (typeof declaration.match === "function") {
|
|
58
|
-
throw new EventFilterCompileError(`trigger.on("${eventType}"): the "match" callback is no longer supported. ` +
|
|
59
|
-
`Use the structured "where" predicate instead. See architecture doc §12.`);
|
|
60
|
-
}
|
|
61
|
-
// Canonical content-derived id. Stable across re-deploys because the
|
|
62
|
-
// canonicalized JSON of the declaration is identical for byte-equivalent
|
|
63
|
-
// sources.
|
|
64
|
-
const canonicalDeclaration = {
|
|
65
|
-
eventType,
|
|
66
|
-
where: where ?? null,
|
|
67
|
-
input: input ?? null,
|
|
68
|
-
targetWorkflowId,
|
|
69
|
-
};
|
|
70
|
-
const fullHash = await sha256(canonicalDeclaration);
|
|
71
|
-
const payloadHash = fullHash;
|
|
72
|
-
// Filter id seeds from the same hash but stays human-friendly in logs.
|
|
73
|
-
const id = `ef_${fullHash.slice(0, 16)}`;
|
|
74
|
-
const manifest = {
|
|
75
|
-
id,
|
|
76
|
-
eventType,
|
|
77
|
-
payloadHash,
|
|
78
|
-
targetWorkflowId,
|
|
79
|
-
...(where !== undefined ? { where } : {}),
|
|
80
|
-
...(input !== undefined ? { input } : {}),
|
|
81
|
-
};
|
|
82
|
-
const entry = {
|
|
83
|
-
id,
|
|
84
|
-
eventType,
|
|
85
|
-
manifest,
|
|
86
|
-
declaration: declaration,
|
|
87
|
-
targetWorkflowId,
|
|
88
|
-
};
|
|
89
|
-
return entry;
|
|
90
|
-
}
|
|
91
19
|
/**
|
|
92
20
|
* Compile + register in one step. The synchronous wrapper for `trigger.on()`
|
|
93
21
|
* that user code calls — validates the declaration, computes the
|
package/dist/runtime/ctx.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ServiceResolver } from "../driver.js";
|
|
2
2
|
import type { RetryPolicy, WaitpointKind } from "../types.js";
|
|
3
|
-
import type { EnvironmentContext,
|
|
3
|
+
import type { EnvironmentContext, RunContext, StepContext, StepFn, StepOptions, WorkflowContext } from "../workflow.js";
|
|
4
4
|
import { type ClockState } from "./determinism.js";
|
|
5
5
|
import type { JournalSlice, StepJournalEntry } from "./journal.js";
|
|
6
6
|
/**
|
|
@@ -107,5 +107,4 @@ export interface CtxBuildArgs {
|
|
|
107
107
|
services?: ServiceResolver;
|
|
108
108
|
}
|
|
109
109
|
export declare function buildCtx(args: CtxBuildArgs): WorkflowContext<unknown>;
|
|
110
|
-
export type { MetadataValue };
|
|
111
110
|
//# sourceMappingURL=ctx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../../src/runtime/ctx.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAY,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EACV,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../../src/runtime/ctx.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAY,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvE,OAAO,KAAK,EACV,kBAAkB,EAOlB,UAAU,EAEV,WAAW,EACX,MAAM,EACN,WAAW,EAOX,eAAe,EAEhB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAkB,KAAK,UAAU,EAAyB,MAAM,kBAAkB,CAAA;AASzF,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAA4B,MAAM,cAAc,CAAA;AAE5F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+FAA+F;IAC/F,OAAO,CAAC,IAAI,EAAE;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,OAAO,CAAA;QACd,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;QAC7B,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QACnB,OAAO,EAAE,WAAW,CA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,MAAM,CAAA;KACpC,GAAG,IAAI,CAAA;IAER,yEAAyE;IACzE,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAEhC,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAClC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAClD,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAA;IACxC,QAAQ,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,QAAQ,CAAC,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CACpD;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,kBAAkB,CAAA;IACvB,OAAO,EAAE,YAAY,CAAA;IACrB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,KAAK,EAAE,UAAU,CAAA;IACjB,MAAM,EAAE,MAAM,MAAM,CAAA;IACpB,oEAAoE;IACpE,aAAa,EAAE;QAAE,OAAO,EAAE,WAAW,GAAG,SAAS,CAAA;KAAE,CAAA;IACnD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B;AAoBD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,eAAe,CAAC,OAAO,CAAC,CAikBrE"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { SerializedError } from "../protocol/index.js";
|
|
2
2
|
import { type RateLimiter } from "../rate-limit/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RunTrigger, WaitpointKind } from "../types.js";
|
|
4
4
|
import type { WorkflowDefinition } from "../workflow.js";
|
|
5
5
|
import { type RuntimeEnvironment } from "./ctx.js";
|
|
6
|
-
import { RunCancelledSignal, WaitpointPendingSignal } from "./errors.js";
|
|
7
6
|
import type { JournalSlice, StepJournalEntry } from "./journal.js";
|
|
8
7
|
export type StepRunner = (
|
|
9
8
|
/**
|
|
@@ -149,6 +148,4 @@ export type ExecuteWorkflowStepResponse = {
|
|
|
149
148
|
streamChunks: StreamChunk[];
|
|
150
149
|
};
|
|
151
150
|
export declare function executeWorkflowStep(def: WorkflowDefinition, req: ExecuteWorkflowStepRequest): Promise<ExecuteWorkflowStepResponse>;
|
|
152
|
-
export type { RunStatus };
|
|
153
|
-
export { RunCancelledSignal, WaitpointPendingSignal };
|
|
154
151
|
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/runtime/executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/runtime/executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,EAAmC,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAGnF,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAElE,MAAM,MAAM,UAAU,GAAG;AACvB;;;;;;;GAOG;AACH,IAAI,EAAE;IACJ,MAAM,EAAE,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AAM,EAAE,WAAW,CAAA;IACnB,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,GACD;IACE,MAAM,EAAE,SAAS,CAAA;IACjB,UAAU,EAAE,qBAAqB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,GACD;IACE,MAAM,EAAE,aAAa,CAAA;IACrB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,GACD;IACE,MAAM,EAAE,qBAAqB,CAAA;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;IACnC,eAAe,EAAE,gBAAgB,EAAE,CAAA;IACnC,OAAO,EAAE,YAAY,CAAA;IACrB,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B,CAAA;AAQL,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,kBAAkB,EACvB,GAAG,EAAE,0BAA0B,GAC9B,OAAO,CAAC,2BAA2B,CAAC,CAoKtC"}
|
package/dist/runtime/executor.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { durationToMs } from "../rate-limit/index.js";
|
|
7
7
|
import { buildCtx } from "./ctx.js";
|
|
8
8
|
import { createClock, createRandom } from "./determinism.js";
|
|
9
|
-
import { isCompensateRequested, isRunCancelled, isWaitpointPending
|
|
9
|
+
import { isCompensateRequested, isRunCancelled, isWaitpointPending } from "./errors.js";
|
|
10
10
|
export async function executeWorkflowStep(def, req) {
|
|
11
11
|
const abortSignal = req.abortSignal ?? new AbortController().signal;
|
|
12
12
|
const now = req.now ?? (() => Date.now());
|
|
@@ -220,4 +220,3 @@ async function acquireRateLimit(args) {
|
|
|
220
220
|
}
|
|
221
221
|
await args.limiter.acquire({ key, limit, units, windowMs, onLimit, signal: args.signal });
|
|
222
222
|
}
|
|
223
|
-
export { RunCancelledSignal, WaitpointPendingSignal };
|
|
@@ -44,11 +44,4 @@ export interface JournalSlice {
|
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
46
|
export declare function emptyJournal(): JournalSlice;
|
|
47
|
-
/**
|
|
48
|
-
* Clone the journal into a slice that the body sees. Each step /
|
|
49
|
-
* waitpoint the body replays is *consumed* from the slice so we can
|
|
50
|
-
* detect leftover journal entries that the code no longer produces
|
|
51
|
-
* (which is a versioning hazard — see §6.7 of design.md).
|
|
52
|
-
*/
|
|
53
|
-
export declare function forkJournal(j: JournalSlice): JournalSlice;
|
|
54
47
|
//# sourceMappingURL=journal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../src/runtime/journal.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,IAAI,GAAG,KAAK,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,aAAa,CAAA;IACnB,UAAU,EAAE,MAAM,CAA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CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,aAAa,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC,gFAAgF;IAChF,KAAK,CAAC,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,IAAI,GAAG,KAAK,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,eAAe,CAAA;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAC7C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAC5D,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAC1D,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACzD;AAED,wBAAgB,YAAY,IAAI,YAAY,CAQ3C"}
|
package/dist/runtime/journal.js
CHANGED
|
@@ -11,18 +11,3 @@ export function emptyJournal() {
|
|
|
11
11
|
streamsCompleted: {},
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Clone the journal into a slice that the body sees. Each step /
|
|
16
|
-
* waitpoint the body replays is *consumed* from the slice so we can
|
|
17
|
-
* detect leftover journal entries that the code no longer produces
|
|
18
|
-
* (which is a versioning hazard — see §6.7 of design.md).
|
|
19
|
-
*/
|
|
20
|
-
export function forkJournal(j) {
|
|
21
|
-
return {
|
|
22
|
-
stepResults: { ...j.stepResults },
|
|
23
|
-
waitpointsResolved: { ...j.waitpointsResolved },
|
|
24
|
-
compensationsRun: { ...j.compensationsRun },
|
|
25
|
-
metadataState: { ...j.metadataState },
|
|
26
|
-
streamsCompleted: { ...j.streamsCompleted },
|
|
27
|
-
};
|
|
28
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/workflows",
|
|
3
|
-
"version": "0.111.
|
|
3
|
+
"version": "0.111.12",
|
|
4
4
|
"description": "Authoring SDK for Voyant Workflows — durable, step-based orchestrations for Voyant Cloud.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -87,13 +87,13 @@
|
|
|
87
87
|
"NOTICE"
|
|
88
88
|
],
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"zod": "^
|
|
90
|
+
"zod": "^4.4.3"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@types/node": "^
|
|
93
|
+
"@types/node": "^25.5.2",
|
|
94
94
|
"esbuild": "0.28.1",
|
|
95
|
-
"typescript": "^
|
|
96
|
-
"vitest": "^
|
|
95
|
+
"typescript": "^6.0.3",
|
|
96
|
+
"vitest": "^4.1.9",
|
|
97
97
|
"@voyant-travel/voyant-typescript-config": "^0.1.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
package/src/events/compile.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { EventFilterManifestEntry } from "../protocol/index.js"
|
|
9
9
|
import type { EventFilterDeclaration } from "../trigger.js"
|
|
10
10
|
import { type InputMapper, validateInputMapper } from "./input-mapper.js"
|
|
11
|
-
import { canonicalJson
|
|
11
|
+
import { canonicalJson } from "./payload-hash.js"
|
|
12
12
|
import { type PredicateExpr, validatePredicate } from "./predicate.js"
|
|
13
13
|
import { type EventFilterRuntimeEntry, getEventFilterRegistry } from "./registry.js"
|
|
14
14
|
|
|
@@ -22,105 +22,6 @@ export class EventFilterCompileError extends Error {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/**
|
|
26
|
-
* Compile an authored declaration into a runtime entry. Throws
|
|
27
|
-
* `EventFilterCompileError` on shape errors so authoring problems fail
|
|
28
|
-
* at module-load time.
|
|
29
|
-
*/
|
|
30
|
-
export async function compileEventFilter<T>(
|
|
31
|
-
eventType: string,
|
|
32
|
-
declaration: EventFilterDeclaration<T>,
|
|
33
|
-
): Promise<EventFilterRuntimeEntry> {
|
|
34
|
-
if (typeof eventType !== "string" || eventType.length === 0) {
|
|
35
|
-
throw new EventFilterCompileError(
|
|
36
|
-
`trigger.on(eventType, ...): eventType must be a non-empty string`,
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
if (typeof declaration !== "object" || declaration === null) {
|
|
40
|
-
throw new EventFilterCompileError(
|
|
41
|
-
`trigger.on("${eventType}", ...): declaration must be an object`,
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
if (!declaration.target || typeof declaration.target !== "object") {
|
|
45
|
-
throw new EventFilterCompileError(
|
|
46
|
-
`trigger.on("${eventType}", ...): "target" must be a workflow definition (got ${typeof declaration.target})`,
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
const targetWorkflowId =
|
|
50
|
-
typeof (declaration.target as { id?: unknown }).id === "string"
|
|
51
|
-
? (declaration.target as { id: string }).id
|
|
52
|
-
: ""
|
|
53
|
-
if (targetWorkflowId.length === 0) {
|
|
54
|
-
throw new EventFilterCompileError(
|
|
55
|
-
`trigger.on("${eventType}", ...): "target.id" must be a non-empty string`,
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Validate `where` if supplied.
|
|
60
|
-
const where = (declaration as { where?: PredicateExpr }).where
|
|
61
|
-
if (where !== undefined) {
|
|
62
|
-
const result = validatePredicate(where)
|
|
63
|
-
if (!result.ok) {
|
|
64
|
-
throw new EventFilterCompileError(
|
|
65
|
-
`trigger.on("${eventType}", target=${targetWorkflowId}): invalid where clause`,
|
|
66
|
-
result.errors,
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Validate `input` if supplied.
|
|
72
|
-
const input = (declaration as { input?: InputMapper }).input
|
|
73
|
-
if (input !== undefined) {
|
|
74
|
-
const result = validateInputMapper(input)
|
|
75
|
-
if (!result.ok) {
|
|
76
|
-
throw new EventFilterCompileError(
|
|
77
|
-
`trigger.on("${eventType}", target=${targetWorkflowId}): invalid input mapper`,
|
|
78
|
-
result.errors,
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Reject the legacy `match` callback explicitly so authoring errors are obvious.
|
|
84
|
-
if (typeof (declaration as { match?: unknown }).match === "function") {
|
|
85
|
-
throw new EventFilterCompileError(
|
|
86
|
-
`trigger.on("${eventType}"): the "match" callback is no longer supported. ` +
|
|
87
|
-
`Use the structured "where" predicate instead. See architecture doc §12.`,
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Canonical content-derived id. Stable across re-deploys because the
|
|
92
|
-
// canonicalized JSON of the declaration is identical for byte-equivalent
|
|
93
|
-
// sources.
|
|
94
|
-
const canonicalDeclaration = {
|
|
95
|
-
eventType,
|
|
96
|
-
where: where ?? null,
|
|
97
|
-
input: input ?? null,
|
|
98
|
-
targetWorkflowId,
|
|
99
|
-
}
|
|
100
|
-
const fullHash = await sha256(canonicalDeclaration)
|
|
101
|
-
const payloadHash = fullHash
|
|
102
|
-
// Filter id seeds from the same hash but stays human-friendly in logs.
|
|
103
|
-
const id = `ef_${fullHash.slice(0, 16)}`
|
|
104
|
-
|
|
105
|
-
const manifest: EventFilterManifestEntry = {
|
|
106
|
-
id,
|
|
107
|
-
eventType,
|
|
108
|
-
payloadHash,
|
|
109
|
-
targetWorkflowId,
|
|
110
|
-
...(where !== undefined ? { where } : {}),
|
|
111
|
-
...(input !== undefined ? { input } : {}),
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const entry: EventFilterRuntimeEntry = {
|
|
115
|
-
id,
|
|
116
|
-
eventType,
|
|
117
|
-
manifest,
|
|
118
|
-
declaration: declaration as EventFilterDeclaration<unknown>,
|
|
119
|
-
targetWorkflowId,
|
|
120
|
-
}
|
|
121
|
-
return entry
|
|
122
|
-
}
|
|
123
|
-
|
|
124
25
|
/**
|
|
125
26
|
* Compile + register in one step. The synchronous wrapper for `trigger.on()`
|
|
126
27
|
* that user code calls — validates the declaration, computes the
|
package/src/runtime/ctx.ts
CHANGED
|
@@ -14,7 +14,6 @@ import type {
|
|
|
14
14
|
InvokeApi,
|
|
15
15
|
InvokeOptions,
|
|
16
16
|
MetadataApi,
|
|
17
|
-
MetadataValue,
|
|
18
17
|
ParallelApi,
|
|
19
18
|
RunContext,
|
|
20
19
|
StepApi,
|
|
@@ -871,6 +870,3 @@ function toMs(d: Duration): number {
|
|
|
871
870
|
throw new Error(`invalid duration unit: ${m[2]}`)
|
|
872
871
|
}
|
|
873
872
|
}
|
|
874
|
-
|
|
875
|
-
// Re-exports used by the executor for metadata type checking.
|
|
876
|
-
export type { MetadataValue }
|
package/src/runtime/executor.ts
CHANGED
|
@@ -6,17 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
import type { SerializedError } from "../protocol/index.js"
|
|
8
8
|
import { durationToMs, type RateLimiter } from "../rate-limit/index.js"
|
|
9
|
-
import type {
|
|
9
|
+
import type { RunTrigger, WaitpointKind } from "../types.js"
|
|
10
10
|
import type { StepOptions, WorkflowDefinition } from "../workflow.js"
|
|
11
11
|
import { buildCtx, type RuntimeCallbacks, type RuntimeEnvironment } from "./ctx.js"
|
|
12
12
|
import { createClock, createRandom } from "./determinism.js"
|
|
13
|
-
import {
|
|
14
|
-
isCompensateRequested,
|
|
15
|
-
isRunCancelled,
|
|
16
|
-
isWaitpointPending,
|
|
17
|
-
RunCancelledSignal,
|
|
18
|
-
WaitpointPendingSignal,
|
|
19
|
-
} from "./errors.js"
|
|
13
|
+
import { isCompensateRequested, isRunCancelled, isWaitpointPending } from "./errors.js"
|
|
20
14
|
import type { JournalSlice, StepJournalEntry } from "./journal.js"
|
|
21
15
|
|
|
22
16
|
export type StepRunner = (
|
|
@@ -424,6 +418,3 @@ async function acquireRateLimit(args: {
|
|
|
424
418
|
}
|
|
425
419
|
await args.limiter.acquire({ key, limit, units, windowMs, onLimit, signal: args.signal })
|
|
426
420
|
}
|
|
427
|
-
|
|
428
|
-
export type { RunStatus }
|
|
429
|
-
export { RunCancelledSignal, WaitpointPendingSignal }
|
package/src/runtime/journal.ts
CHANGED
|
@@ -60,19 +60,3 @@ export function emptyJournal(): JournalSlice {
|
|
|
60
60
|
streamsCompleted: {},
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Clone the journal into a slice that the body sees. Each step /
|
|
66
|
-
* waitpoint the body replays is *consumed* from the slice so we can
|
|
67
|
-
* detect leftover journal entries that the code no longer produces
|
|
68
|
-
* (which is a versioning hazard — see §6.7 of design.md).
|
|
69
|
-
*/
|
|
70
|
-
export function forkJournal(j: JournalSlice): JournalSlice {
|
|
71
|
-
return {
|
|
72
|
-
stepResults: { ...j.stepResults },
|
|
73
|
-
waitpointsResolved: { ...j.waitpointsResolved },
|
|
74
|
-
compensationsRun: { ...j.compensationsRun },
|
|
75
|
-
metadataState: { ...j.metadataState },
|
|
76
|
-
streamsCompleted: { ...j.streamsCompleted },
|
|
77
|
-
}
|
|
78
|
-
}
|