@voyant-travel/core 0.109.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/LICENSE +201 -0
- package/README.md +48 -0
- package/dist/config.d.ts +204 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +251 -0
- package/dist/config.js.map +1 -0
- package/dist/container.d.ts +20 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/container.js +21 -0
- package/dist/container.js.map +1 -0
- package/dist/env.d.ts +29 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +2 -0
- package/dist/env.js.map +1 -0
- package/dist/events.d.ts +177 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +169 -0
- package/dist/events.js.map +1 -0
- package/dist/hooks.d.ts +19 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +33 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/links.d.ts +201 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +159 -0
- package/dist/links.js.map +1 -0
- package/dist/locking.d.ts +12 -0
- package/dist/locking.d.ts.map +1 -0
- package/dist/locking.js +21 -0
- package/dist/locking.js.map +1 -0
- package/dist/module.d.ts +147 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/orchestration.d.ts +30 -0
- package/dist/orchestration.d.ts.map +1 -0
- package/dist/orchestration.js +2 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/plugin.d.ts +118 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +65 -0
- package/dist/plugin.js.map +1 -0
- package/dist/query.d.ts +111 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +126 -0
- package/dist/query.js.map +1 -0
- package/dist/registry.d.ts +17 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +31 -0
- package/dist/registry.js.map +1 -0
- package/dist/workflows.d.ts +140 -0
- package/dist/workflows.d.ts.map +1 -0
- package/dist/workflows.js +142 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +103 -0
package/dist/query.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query Graph — cross-module reads that traverse {@link LinkDefinition}s.
|
|
3
|
+
*
|
|
4
|
+
* Modules expose {@link EntityFetcher}s for their entities. The graph
|
|
5
|
+
* planner fetches base records, walks link definitions for any dotted
|
|
6
|
+
* fields in the selection, issues parallel fetches for the linked
|
|
7
|
+
* entities, and stitches the results in-memory.
|
|
8
|
+
*
|
|
9
|
+
* This is an application-layer join, not a SQL join: modules never
|
|
10
|
+
* import one another's tables, and there are no database foreign keys
|
|
11
|
+
* between module schemas.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Build a {@link QueryGraphContext} from plain records.
|
|
15
|
+
*/
|
|
16
|
+
export function createQueryContext(fetchers, links, linkService) {
|
|
17
|
+
return { fetchers: new Map(Object.entries(fetchers)), links, linkService };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a fixed {@link QueryGraphContext} in a callable runtime.
|
|
21
|
+
*/
|
|
22
|
+
export function createQueryRunner(ctx) {
|
|
23
|
+
return (config) => queryGraph(ctx, config);
|
|
24
|
+
}
|
|
25
|
+
function parseRelations(fields) {
|
|
26
|
+
const map = new Map();
|
|
27
|
+
for (const field of fields) {
|
|
28
|
+
const dotIdx = field.indexOf(".");
|
|
29
|
+
if (dotIdx === -1)
|
|
30
|
+
continue;
|
|
31
|
+
const relation = field.slice(0, dotIdx);
|
|
32
|
+
const subfield = field.slice(dotIdx + 1);
|
|
33
|
+
const existing = map.get(relation) ?? [];
|
|
34
|
+
existing.push(subfield);
|
|
35
|
+
map.set(relation, existing);
|
|
36
|
+
}
|
|
37
|
+
return Array.from(map.entries(), ([relation, subfields]) => ({ relation, subfields }));
|
|
38
|
+
}
|
|
39
|
+
function findLinkForRelation(links, entity, relation) {
|
|
40
|
+
for (const def of links) {
|
|
41
|
+
const leftEntity = def.left.linkable.entity;
|
|
42
|
+
const rightEntity = def.right.linkable.entity;
|
|
43
|
+
if (leftEntity === entity && rightEntity === relation) {
|
|
44
|
+
return { def, ourSideIsLeft: true };
|
|
45
|
+
}
|
|
46
|
+
if (rightEntity === entity && leftEntity === relation) {
|
|
47
|
+
return { def, ourSideIsLeft: false };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function unique(xs) {
|
|
53
|
+
return Array.from(new Set(xs));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Execute a cross-module read.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const { data } = await queryGraph(ctx, {
|
|
61
|
+
* entity: "person",
|
|
62
|
+
* fields: ["id", "name", "product.*", "organization.name"],
|
|
63
|
+
* filters: { country: "FR" },
|
|
64
|
+
* pagination: { take: 50 },
|
|
65
|
+
* })
|
|
66
|
+
* // data[0].product === [{ id: "prod_...", ... }, ...]
|
|
67
|
+
* // data[0].organization === { id: "org_...", name: "..." } | null
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export async function queryGraph(ctx, config) {
|
|
71
|
+
const { fetchers, links, linkService } = ctx;
|
|
72
|
+
const { entity, fields, filters, pagination, context } = config;
|
|
73
|
+
const baseFetcher = fetchers.get(entity);
|
|
74
|
+
if (!baseFetcher) {
|
|
75
|
+
throw new Error(`queryGraph: no fetcher registered for entity "${entity}"`);
|
|
76
|
+
}
|
|
77
|
+
const plans = parseRelations(fields);
|
|
78
|
+
const baseRecords = await baseFetcher.list({ filters, pagination, context });
|
|
79
|
+
if (baseRecords.length === 0)
|
|
80
|
+
return { data: [] };
|
|
81
|
+
for (const { relation } of plans) {
|
|
82
|
+
const match = findLinkForRelation(links, entity, relation);
|
|
83
|
+
if (!match) {
|
|
84
|
+
throw new Error(`queryGraph: no link definition found for "${entity}.${relation}"`);
|
|
85
|
+
}
|
|
86
|
+
const { def, ourSideIsLeft } = match;
|
|
87
|
+
const targetSide = ourSideIsLeft ? def.right : def.left;
|
|
88
|
+
const targetEntity = targetSide.linkable.entity;
|
|
89
|
+
const targetIsList = targetSide.isList ?? false;
|
|
90
|
+
const targetFetcher = fetchers.get(targetEntity);
|
|
91
|
+
if (!targetFetcher) {
|
|
92
|
+
throw new Error(`queryGraph: no fetcher registered for target entity "${targetEntity}"`);
|
|
93
|
+
}
|
|
94
|
+
// ONE batched link lookup for all base records — per-base fan-out costs
|
|
95
|
+
// a query (and on Workers a subrequest) per record.
|
|
96
|
+
const baseIds = unique(baseRecords.map((r) => r.id));
|
|
97
|
+
const linkRows = await linkService.list(def.tableName, ourSideIsLeft ? { leftIds: baseIds } : { rightIds: baseIds });
|
|
98
|
+
// baseId → targetIds for stitching. Rows arrive in the link service's
|
|
99
|
+
// list order (created_at ASC), so per-base target order is preserved.
|
|
100
|
+
const idMap = new Map();
|
|
101
|
+
for (const baseId of baseIds)
|
|
102
|
+
idMap.set(baseId, []);
|
|
103
|
+
for (const row of linkRows) {
|
|
104
|
+
const baseId = ourSideIsLeft ? row.leftId : row.rightId;
|
|
105
|
+
const targetId = ourSideIsLeft ? row.rightId : row.leftId;
|
|
106
|
+
idMap.get(baseId)?.push(targetId);
|
|
107
|
+
}
|
|
108
|
+
// Hydrate all target records in one call.
|
|
109
|
+
const allTargetIds = unique(Array.from(idMap.values()).flat());
|
|
110
|
+
const targetRecords = allTargetIds.length > 0 ? await targetFetcher.list({ ids: allTargetIds, context }) : [];
|
|
111
|
+
const byTargetId = new Map(targetRecords.map((r) => [r.id, r]));
|
|
112
|
+
// Attach to each base record.
|
|
113
|
+
for (const record of baseRecords) {
|
|
114
|
+
const targetIds = idMap.get(record.id) ?? [];
|
|
115
|
+
const resolved = [];
|
|
116
|
+
for (const targetId of targetIds) {
|
|
117
|
+
const t = byTargetId.get(targetId);
|
|
118
|
+
if (t)
|
|
119
|
+
resolved.push(t);
|
|
120
|
+
}
|
|
121
|
+
record[relation] = targetIsList ? resolved : (resolved[0] ?? null);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { data: baseRecords };
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoFH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAuC,EACvC,KAAuB,EACvB,WAAwB;IAExB,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;AAC5E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAsB;IACtD,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AAOD,SAAS,cAAc,CAAC,MAAgB;IACtC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAA;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACjC,IAAI,MAAM,KAAK,CAAC,CAAC;YAAE,SAAQ;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;QACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;QACxC,QAAQ,CA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AC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QAE/D,8BAA8B;QAC9B,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;YAC5C,MAAM,QAAQ,GAAmB,EAAE,CAAA;YACnC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;gBAClC,IAAI,CAAC;oBAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACzB,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;QACpE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Extension, Module } from "./module.js";
|
|
2
|
+
export interface RegistryOptions {
|
|
3
|
+
modules?: Module[];
|
|
4
|
+
extensions?: Extension[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Register module and extension hooks without binding to any specific
|
|
8
|
+
* transport framework.
|
|
9
|
+
*
|
|
10
|
+
* Transport adapters are expected to consume the returned modules and
|
|
11
|
+
* extensions separately.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createRegistry(options?: RegistryOptions): {
|
|
14
|
+
modules: Module[];
|
|
15
|
+
extensions: Extension[];
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB;;;EAwB3D"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { hooks } from "./hooks.js";
|
|
2
|
+
/**
|
|
3
|
+
* Register module and extension hooks without binding to any specific
|
|
4
|
+
* transport framework.
|
|
5
|
+
*
|
|
6
|
+
* Transport adapters are expected to consume the returned modules and
|
|
7
|
+
* extensions separately.
|
|
8
|
+
*/
|
|
9
|
+
export function createRegistry(options = {}) {
|
|
10
|
+
const modules = options.modules ?? [];
|
|
11
|
+
const extensions = options.extensions ?? [];
|
|
12
|
+
for (const mod of modules) {
|
|
13
|
+
if (mod.hooks) {
|
|
14
|
+
for (const [event, handler] of Object.entries(mod.hooks)) {
|
|
15
|
+
hooks.on(event, handler);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (const ext of extensions) {
|
|
20
|
+
if (ext.hooks) {
|
|
21
|
+
for (const [event, handler] of Object.entries(ext.hooks)) {
|
|
22
|
+
hooks.on(event, handler);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
modules,
|
|
28
|
+
extensions,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAQlC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,UAA2B,EAAE;IAC1D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAA;IACrC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAA;IAE3C,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzD,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACd,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzD,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { JobOptions, JobRunner } from "./orchestration.js";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime context passed to each step's run and compensate functions.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkflowContext {
|
|
6
|
+
/** Name of the workflow currently executing. */
|
|
7
|
+
workflowName: string;
|
|
8
|
+
/** JobRunner adapter — required when the workflow contains async steps. */
|
|
9
|
+
jobRunner?: JobRunner;
|
|
10
|
+
/**
|
|
11
|
+
* Accumulated results from prior steps, keyed by step name.
|
|
12
|
+
* Later steps may read outputs produced by earlier steps.
|
|
13
|
+
*/
|
|
14
|
+
results: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Run function for a step. Receives the workflow input and context;
|
|
18
|
+
* returns the step's output (which is stored in `ctx.results`).
|
|
19
|
+
*/
|
|
20
|
+
export type StepRunFn<TInput = unknown, TOutput = unknown> = (input: TInput, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
|
|
21
|
+
/**
|
|
22
|
+
* Compensation function for a step. Invoked in reverse order on
|
|
23
|
+
* workflow failure. Receives the step's own output (what `run` returned).
|
|
24
|
+
*/
|
|
25
|
+
export type StepCompensateFn<TOutput = unknown> = (output: TOutput, ctx: WorkflowContext) => void | Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Internal step definition accumulated by the {@link step} builder.
|
|
28
|
+
*/
|
|
29
|
+
export interface StepDefinition {
|
|
30
|
+
name: string;
|
|
31
|
+
runFn?: StepRunFn;
|
|
32
|
+
compensateFn?: StepCompensateFn;
|
|
33
|
+
isAsync: boolean;
|
|
34
|
+
jobOptions?: JobOptions;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fluent builder for a workflow step. Chain `.run()`, optionally
|
|
38
|
+
* `.compensate()` and `.async()`.
|
|
39
|
+
*/
|
|
40
|
+
export interface StepBuilder<TInput = unknown, TOutput = unknown> {
|
|
41
|
+
/** Sets the step's run function. */
|
|
42
|
+
run(fn: StepRunFn<TInput, TOutput>): StepBuilder<TInput, TOutput>;
|
|
43
|
+
/** Sets the step's compensation (rollback) function. */
|
|
44
|
+
compensate(fn: StepCompensateFn<TOutput>): StepBuilder<TInput, TOutput>;
|
|
45
|
+
/**
|
|
46
|
+
* Marks the step as async: when reached, the workflow enqueues a job via
|
|
47
|
+
* the injected {@link JobRunner} and continues without blocking. The step
|
|
48
|
+
* name becomes the job name and the workflow input is the payload.
|
|
49
|
+
* Async steps do not participate in compensation.
|
|
50
|
+
*/
|
|
51
|
+
async(options?: JobOptions): StepBuilder<TInput, TOutput>;
|
|
52
|
+
/** Internal definition. Do not mutate. */
|
|
53
|
+
readonly definition: StepDefinition;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a step builder. Name must be unique within a workflow.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* step<MyInput, MyOutput>("reserve-inventory")
|
|
60
|
+
* .run(async (input, ctx) => { ... })
|
|
61
|
+
* .compensate(async (output, ctx) => { ... })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function step<TInput = unknown, TOutput = unknown>(name: string): StepBuilder<TInput, TOutput>;
|
|
65
|
+
/**
|
|
66
|
+
* Options passed to {@link WorkflowDefinition.run}.
|
|
67
|
+
*/
|
|
68
|
+
export interface WorkflowRunOptions {
|
|
69
|
+
/** Initial input passed to every step's run function. */
|
|
70
|
+
input?: unknown;
|
|
71
|
+
/** JobRunner — required when the workflow contains async steps. */
|
|
72
|
+
jobRunner?: JobRunner;
|
|
73
|
+
/**
|
|
74
|
+
* Pre-seeded `ctx.results` entries — used by resume runs to expose
|
|
75
|
+
* prior step outputs (from a parent run) without re-executing the
|
|
76
|
+
* step. Steps whose name appears in `seedResults` are skipped at
|
|
77
|
+
* the executor level: their entry is copied into ctx.results and
|
|
78
|
+
* `runFn` is not invoked. Compensation for skipped steps is also
|
|
79
|
+
* suppressed (the parent run's output remains canonical).
|
|
80
|
+
*
|
|
81
|
+
* Pairs with {@link skipUntil} — typically you set both to the
|
|
82
|
+
* same set so callers don't need to coordinate. When `skipUntil`
|
|
83
|
+
* is set, every step before that name MUST appear in `seedResults`
|
|
84
|
+
* so dependent steps see the values they expect.
|
|
85
|
+
*/
|
|
86
|
+
seedResults?: Record<string, unknown>;
|
|
87
|
+
/**
|
|
88
|
+
* Resume sentinel — when set, the executor skips steps until it
|
|
89
|
+
* reaches this name (then runs normally from there onward). Steps
|
|
90
|
+
* before the sentinel are still added to ctx.results from
|
|
91
|
+
* {@link seedResults}. Throws if the named step doesn't exist in
|
|
92
|
+
* the workflow.
|
|
93
|
+
*/
|
|
94
|
+
skipUntil?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Result of a successful workflow execution.
|
|
98
|
+
*/
|
|
99
|
+
export interface WorkflowResult {
|
|
100
|
+
/** Step outputs keyed by step name. Async steps produce `{ jobId }`. */
|
|
101
|
+
results: Record<string, unknown>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Workflow handle returned by {@link createWorkflow}.
|
|
105
|
+
*/
|
|
106
|
+
export interface WorkflowDefinition {
|
|
107
|
+
/** Workflow name. */
|
|
108
|
+
readonly name: string;
|
|
109
|
+
/** Ordered list of step builders. */
|
|
110
|
+
readonly steps: ReadonlyArray<StepBuilder>;
|
|
111
|
+
/** Execute the workflow. Throws on failure (after running compensations). */
|
|
112
|
+
run(options?: WorkflowRunOptions): Promise<WorkflowResult>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Thrown when a workflow is misconfigured (e.g. missing run function,
|
|
116
|
+
* async step without a JobRunner, duplicate step names).
|
|
117
|
+
*/
|
|
118
|
+
export declare class WorkflowError extends Error {
|
|
119
|
+
constructor(message: string);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create an in-process workflow from a sequence of steps.
|
|
123
|
+
*
|
|
124
|
+
* Semantics:
|
|
125
|
+
* - Steps run sequentially in array order.
|
|
126
|
+
* - Each step's output is stored in `ctx.results[stepName]`.
|
|
127
|
+
* - If any step's run function throws, previously-completed steps'
|
|
128
|
+
* compensation functions run in reverse order, then the error re-throws.
|
|
129
|
+
* - Compensation errors are caught and logged; they do not mask the
|
|
130
|
+
* original failure.
|
|
131
|
+
* - Async steps (`.async()`) enqueue via the injected `JobRunner` using
|
|
132
|
+
* the step name as the job name and the workflow input as the payload.
|
|
133
|
+
* They do not block and do not participate in compensation.
|
|
134
|
+
*
|
|
135
|
+
* This is NOT a durable workflow engine — execution lives entirely within
|
|
136
|
+
* a single process. Durability for async work is delegated to the
|
|
137
|
+
* template's `JobRunner` implementation.
|
|
138
|
+
*/
|
|
139
|
+
export declare function createWorkflow(name: string, steps: ReadonlyArray<StepBuilder>): WorkflowDefinition;
|
|
140
|
+
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE/D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,CAC3D,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,eAAe,KACjB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAE/B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,OAAO,GAAG,OAAO,IAAI,CAChD,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,eAAe,KACjB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAEzB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAC9D,oCAAoC;IACpC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,GA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,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,GAChC,kBAAkB,CAuFpB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a step builder. Name must be unique within a workflow.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* step<MyInput, MyOutput>("reserve-inventory")
|
|
6
|
+
* .run(async (input, ctx) => { ... })
|
|
7
|
+
* .compensate(async (output, ctx) => { ... })
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export function step(name) {
|
|
11
|
+
const def = {
|
|
12
|
+
name,
|
|
13
|
+
isAsync: false,
|
|
14
|
+
};
|
|
15
|
+
const builder = {
|
|
16
|
+
run(fn) {
|
|
17
|
+
def.runFn = fn;
|
|
18
|
+
return builder;
|
|
19
|
+
},
|
|
20
|
+
compensate(fn) {
|
|
21
|
+
def.compensateFn = fn;
|
|
22
|
+
return builder;
|
|
23
|
+
},
|
|
24
|
+
async(options) {
|
|
25
|
+
def.isAsync = true;
|
|
26
|
+
if (options !== undefined)
|
|
27
|
+
def.jobOptions = options;
|
|
28
|
+
return builder;
|
|
29
|
+
},
|
|
30
|
+
definition: def,
|
|
31
|
+
};
|
|
32
|
+
return builder;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Thrown when a workflow is misconfigured (e.g. missing run function,
|
|
36
|
+
* async step without a JobRunner, duplicate step names).
|
|
37
|
+
*/
|
|
38
|
+
export class WorkflowError extends Error {
|
|
39
|
+
constructor(message) {
|
|
40
|
+
super(message);
|
|
41
|
+
this.name = "WorkflowError";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create an in-process workflow from a sequence of steps.
|
|
46
|
+
*
|
|
47
|
+
* Semantics:
|
|
48
|
+
* - Steps run sequentially in array order.
|
|
49
|
+
* - Each step's output is stored in `ctx.results[stepName]`.
|
|
50
|
+
* - If any step's run function throws, previously-completed steps'
|
|
51
|
+
* compensation functions run in reverse order, then the error re-throws.
|
|
52
|
+
* - Compensation errors are caught and logged; they do not mask the
|
|
53
|
+
* original failure.
|
|
54
|
+
* - Async steps (`.async()`) enqueue via the injected `JobRunner` using
|
|
55
|
+
* the step name as the job name and the workflow input as the payload.
|
|
56
|
+
* They do not block and do not participate in compensation.
|
|
57
|
+
*
|
|
58
|
+
* This is NOT a durable workflow engine — execution lives entirely within
|
|
59
|
+
* a single process. Durability for async work is delegated to the
|
|
60
|
+
* template's `JobRunner` implementation.
|
|
61
|
+
*/
|
|
62
|
+
export function createWorkflow(name, steps) {
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
for (const builder of steps) {
|
|
65
|
+
const stepName = builder.definition.name;
|
|
66
|
+
if (seen.has(stepName)) {
|
|
67
|
+
throw new WorkflowError(`Workflow "${name}" has duplicate step name "${stepName}"`);
|
|
68
|
+
}
|
|
69
|
+
seen.add(stepName);
|
|
70
|
+
}
|
|
71
|
+
async function run(options = {}) {
|
|
72
|
+
const ctx = {
|
|
73
|
+
workflowName: name,
|
|
74
|
+
jobRunner: options.jobRunner,
|
|
75
|
+
results: { ...(options.seedResults ?? {}) },
|
|
76
|
+
};
|
|
77
|
+
const input = options.input;
|
|
78
|
+
const completed = [];
|
|
79
|
+
// Validate skipUntil up-front so callers get a clear error
|
|
80
|
+
// before any steps run (vs a silent no-op if the name is wrong).
|
|
81
|
+
if (options.skipUntil !== undefined) {
|
|
82
|
+
const found = steps.some((b) => b.definition.name === options.skipUntil);
|
|
83
|
+
if (!found) {
|
|
84
|
+
throw new WorkflowError(`Workflow "${name}" cannot resume: step "${options.skipUntil}" not found`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
let skipping = options.skipUntil !== undefined;
|
|
88
|
+
try {
|
|
89
|
+
for (const builder of steps) {
|
|
90
|
+
const def = builder.definition;
|
|
91
|
+
if (skipping) {
|
|
92
|
+
if (def.name === options.skipUntil) {
|
|
93
|
+
skipping = false;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Step is skipped: keep its seeded result in ctx.results
|
|
97
|
+
// (or null if none was seeded) and move on. Compensation
|
|
98
|
+
// is suppressed for skipped steps — the parent run's
|
|
99
|
+
// output is canonical, we shouldn't roll it back.
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (def.isAsync) {
|
|
104
|
+
if (!ctx.jobRunner) {
|
|
105
|
+
throw new WorkflowError(`Workflow "${name}" step "${def.name}" is async but no jobRunner was provided`);
|
|
106
|
+
}
|
|
107
|
+
const jobId = await ctx.jobRunner.enqueue(def.name, input, def.jobOptions);
|
|
108
|
+
const output = { jobId };
|
|
109
|
+
ctx.results[def.name] = output;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!def.runFn) {
|
|
113
|
+
throw new WorkflowError(`Workflow "${name}" step "${def.name}" has no run function`);
|
|
114
|
+
}
|
|
115
|
+
const output = await def.runFn(input, ctx);
|
|
116
|
+
ctx.results[def.name] = output;
|
|
117
|
+
completed.push({ def, output });
|
|
118
|
+
}
|
|
119
|
+
return { results: ctx.results };
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
for (let i = completed.length - 1; i >= 0; i--) {
|
|
123
|
+
const entry = completed[i];
|
|
124
|
+
if (!entry?.def.compensateFn)
|
|
125
|
+
continue;
|
|
126
|
+
try {
|
|
127
|
+
await entry.def.compensateFn(entry.output, ctx);
|
|
128
|
+
}
|
|
129
|
+
catch (compensationErr) {
|
|
130
|
+
console.error(`[workflow:${name}] compensation for step "${entry.def.name}" threw:`, compensationErr);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
throw err;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
name,
|
|
138
|
+
steps,
|
|
139
|
+
run,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=workflows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":"AAkEA;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAClB,IAAY;IAEZ,MAAM,GAAG,GAAmB;QAC1B,IAAI;QACJ,OAAO,EAAE,KAAK;KACf,CAAA;IACD,MAAM,OAAO,GAAiC;QAC5C,GAAG,CAAC,EAAE;YACJ,GAAG,CAAC,KAAK,GAAG,EAAe,CAAA;YAC3B,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,UAAU,CAAC,EAAE;YACX,GAAG,CAAC,YAAY,GAAG,EAAsB,CAAA;YACzC,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,KAAK,CAAC,OAAO;YACX,GAAG,CAAC,OAAO,GAAG,IAAI,CAAA;YAClB,IAAI,OAAO,KAAK,SAAS;gBAAE,GAAG,CAAC,UAAU,GAAG,OAAO,CAAA;YACnD,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,UAAU,EAAE,GAAG;KAChB,CAAA;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAsDD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,KAAiC;IAEjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,KAAK,MAAM,OAAO,IAAI,KAAK,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA;QACxC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACv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;gBACtC,IAAI,CAAC;oBACH,MAAM,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;gBACjD,CAAC;gBAAC,OAAO,eAAe,EAAE,CAAC;oBACzB,OAAO,CAAC,KAAK,CACX,aAAa,IAAI,4BAA4B,KAAK,CAAC,GAAG,CAAC,IAAI,UAAU,EACrE,eAAe,CAChB,CAAA;gBACH,CAAC;YACH,CAAC;YACD,MAAM,GAAG,CAAA;QACX,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI;QACJ,KAAK;QACL,GAAG;KACJ,CAAA;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@voyant-travel/core",
|
|
3
|
+
"version": "0.109.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./env": {
|
|
13
|
+
"types": "./dist/env.d.ts",
|
|
14
|
+
"import": "./dist/env.js",
|
|
15
|
+
"default": "./dist/env.js"
|
|
16
|
+
},
|
|
17
|
+
"./module": {
|
|
18
|
+
"types": "./dist/module.d.ts",
|
|
19
|
+
"import": "./dist/module.js",
|
|
20
|
+
"default": "./dist/module.js"
|
|
21
|
+
},
|
|
22
|
+
"./hooks": {
|
|
23
|
+
"types": "./dist/hooks.d.ts",
|
|
24
|
+
"import": "./dist/hooks.js",
|
|
25
|
+
"default": "./dist/hooks.js"
|
|
26
|
+
},
|
|
27
|
+
"./locking": {
|
|
28
|
+
"types": "./dist/locking.d.ts",
|
|
29
|
+
"import": "./dist/locking.js",
|
|
30
|
+
"default": "./dist/locking.js"
|
|
31
|
+
},
|
|
32
|
+
"./registry": {
|
|
33
|
+
"types": "./dist/registry.d.ts",
|
|
34
|
+
"import": "./dist/registry.js",
|
|
35
|
+
"default": "./dist/registry.js"
|
|
36
|
+
},
|
|
37
|
+
"./container": {
|
|
38
|
+
"types": "./dist/container.d.ts",
|
|
39
|
+
"import": "./dist/container.js",
|
|
40
|
+
"default": "./dist/container.js"
|
|
41
|
+
},
|
|
42
|
+
"./events": {
|
|
43
|
+
"types": "./dist/events.d.ts",
|
|
44
|
+
"import": "./dist/events.js",
|
|
45
|
+
"default": "./dist/events.js"
|
|
46
|
+
},
|
|
47
|
+
"./orchestration": {
|
|
48
|
+
"types": "./dist/orchestration.d.ts",
|
|
49
|
+
"import": "./dist/orchestration.js",
|
|
50
|
+
"default": "./dist/orchestration.js"
|
|
51
|
+
},
|
|
52
|
+
"./links": {
|
|
53
|
+
"types": "./dist/links.d.ts",
|
|
54
|
+
"import": "./dist/links.js",
|
|
55
|
+
"default": "./dist/links.js"
|
|
56
|
+
},
|
|
57
|
+
"./query": {
|
|
58
|
+
"types": "./dist/query.d.ts",
|
|
59
|
+
"import": "./dist/query.js",
|
|
60
|
+
"default": "./dist/query.js"
|
|
61
|
+
},
|
|
62
|
+
"./workflows": {
|
|
63
|
+
"types": "./dist/workflows.d.ts",
|
|
64
|
+
"import": "./dist/workflows.js",
|
|
65
|
+
"default": "./dist/workflows.js"
|
|
66
|
+
},
|
|
67
|
+
"./plugin": {
|
|
68
|
+
"types": "./dist/plugin.d.ts",
|
|
69
|
+
"import": "./dist/plugin.js",
|
|
70
|
+
"default": "./dist/plugin.js"
|
|
71
|
+
},
|
|
72
|
+
"./config": {
|
|
73
|
+
"types": "./dist/config.d.ts",
|
|
74
|
+
"import": "./dist/config.js",
|
|
75
|
+
"default": "./dist/config.js"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"typescript": "^6.0.2",
|
|
81
|
+
"@voyant-travel/voyant-typescript-config": "^0.1.0"
|
|
82
|
+
},
|
|
83
|
+
"files": [
|
|
84
|
+
"dist"
|
|
85
|
+
],
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
},
|
|
89
|
+
"repository": {
|
|
90
|
+
"type": "git",
|
|
91
|
+
"url": "https://github.com/voyant-travel/voyant.git",
|
|
92
|
+
"directory": "packages/core"
|
|
93
|
+
},
|
|
94
|
+
"scripts": {
|
|
95
|
+
"build": "tsc -p tsconfig.build.json",
|
|
96
|
+
"typecheck": "tsc --noEmit",
|
|
97
|
+
"lint": "biome check src/",
|
|
98
|
+
"test": "vitest run",
|
|
99
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
100
|
+
},
|
|
101
|
+
"main": "./dist/index.js",
|
|
102
|
+
"types": "./dist/index.d.ts"
|
|
103
|
+
}
|