@voyant-travel/workflows 0.113.0 → 0.114.0
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/handler/index.d.ts +15 -0
- package/dist/handler/index.d.ts.map +1 -1
- package/dist/handler/index.js +3 -1
- package/package.json +1 -1
- package/src/handler/index.ts +19 -2
package/dist/handler/index.d.ts
CHANGED
|
@@ -6,7 +6,22 @@ import { type ProtocolVersion, type WorkflowActivationMetadata } from "../protoc
|
|
|
6
6
|
import type { RateLimiter } from "../rate-limit/index.js";
|
|
7
7
|
import type { JournalSlice } from "../runtime/journal.js";
|
|
8
8
|
import type { RunTrigger } from "../types.js";
|
|
9
|
+
import { type WorkflowDefinition } from "../workflow.js";
|
|
10
|
+
/** Resolves executable workflow definitions at the step execution boundary. */
|
|
11
|
+
export interface WorkflowResolver {
|
|
12
|
+
resolve(workflowId: string): WorkflowDefinition | undefined;
|
|
13
|
+
}
|
|
9
14
|
export interface StepHandlerDeps {
|
|
15
|
+
/**
|
|
16
|
+
* Explicit workflow lookup for this runtime. Runtime composition should
|
|
17
|
+
* always provide this dependency so execution is isolated from the
|
|
18
|
+
* process-global authoring registry.
|
|
19
|
+
*
|
|
20
|
+
* Omitting this dependency is deprecated. The handler falls back to the
|
|
21
|
+
* legacy process-global registry only for backward compatibility with
|
|
22
|
+
* direct external SDK callers.
|
|
23
|
+
*/
|
|
24
|
+
workflowResolver?: WorkflowResolver;
|
|
10
25
|
/**
|
|
11
26
|
* Optional. Called before parsing the body. Should throw / reject
|
|
12
27
|
* if the request is not from a trusted orchestrator. In production
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handler/index.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,mBAAmB,EACnB,KAAK,UAAU,EAChB,MAAM,wBAAwB,CAAA;AAE/B,YAAY,EAAE,gBAA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AED,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAE9D,qDAAqD;AACrD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAEpB,yCAAyC;AACzC,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,eAAoB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAyBjG;AAED,qFAAqF;AACrF,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,wBAAwB,EAAE,WAAW,KAAK,IAAI,CAAA;CAC9E;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,IAAI,GAAE,eAAoB,EAC1B,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CACR;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAC5F,CAEA"}
|
package/dist/handler/index.js
CHANGED
|
@@ -71,7 +71,9 @@ async function runStepInner(raw, deps, opts = {}) {
|
|
|
71
71
|
body: errorBody("protocol_version_mismatch", `tenant supports protocol ${PROTOCOL_VERSION}, got ${String(reqBody.protocolVersion)}`),
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
const def =
|
|
74
|
+
const def = deps.workflowResolver
|
|
75
|
+
? deps.workflowResolver.resolve(reqBody.workflowId)
|
|
76
|
+
: getWorkflow(reqBody.workflowId);
|
|
75
77
|
if (!def) {
|
|
76
78
|
return {
|
|
77
79
|
status: 404,
|
package/package.json
CHANGED
package/src/handler/index.ts
CHANGED
|
@@ -37,9 +37,24 @@ import type { RateLimiter } from "../rate-limit/index.js"
|
|
|
37
37
|
import type { RuntimeEnvironment } from "../runtime/ctx.js"
|
|
38
38
|
import type { JournalSlice, StepJournalEntry } from "../runtime/journal.js"
|
|
39
39
|
import type { RunTrigger } from "../types.js"
|
|
40
|
-
import { getWorkflow } from "../workflow.js"
|
|
40
|
+
import { getWorkflow, type WorkflowDefinition } from "../workflow.js"
|
|
41
|
+
|
|
42
|
+
/** Resolves executable workflow definitions at the step execution boundary. */
|
|
43
|
+
export interface WorkflowResolver {
|
|
44
|
+
resolve(workflowId: string): WorkflowDefinition | undefined
|
|
45
|
+
}
|
|
41
46
|
|
|
42
47
|
export interface StepHandlerDeps {
|
|
48
|
+
/**
|
|
49
|
+
* Explicit workflow lookup for this runtime. Runtime composition should
|
|
50
|
+
* always provide this dependency so execution is isolated from the
|
|
51
|
+
* process-global authoring registry.
|
|
52
|
+
*
|
|
53
|
+
* Omitting this dependency is deprecated. The handler falls back to the
|
|
54
|
+
* legacy process-global registry only for backward compatibility with
|
|
55
|
+
* direct external SDK callers.
|
|
56
|
+
*/
|
|
57
|
+
workflowResolver?: WorkflowResolver
|
|
43
58
|
/**
|
|
44
59
|
* Optional. Called before parsing the body. Should throw / reject
|
|
45
60
|
* if the request is not from a trusted orchestrator. In production
|
|
@@ -190,7 +205,9 @@ async function runStepInner(
|
|
|
190
205
|
}
|
|
191
206
|
}
|
|
192
207
|
|
|
193
|
-
const def =
|
|
208
|
+
const def = deps.workflowResolver
|
|
209
|
+
? deps.workflowResolver.resolve(reqBody.workflowId)
|
|
210
|
+
: getWorkflow(reqBody.workflowId)
|
|
194
211
|
if (!def) {
|
|
195
212
|
return {
|
|
196
213
|
status: 404,
|