@n8n/engine 0.16.1 → 0.17.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/auth/authenticate.d.ts +3 -0
- package/dist/auth/authenticate.js +29 -0
- package/dist/auth/authenticate.js.map +1 -0
- package/dist/auth/identity-token.d.ts +14 -0
- package/dist/auth/identity-token.js +66 -0
- package/dist/auth/identity-token.js.map +1 -0
- package/dist/auth/identity.types.d.ts +7 -0
- package/dist/auth/identity.types.js +3 -0
- package/dist/auth/identity.types.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +15 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/build.tsbuildinfo +1 -1
- package/dist/database/create-stores.d.ts +3 -2
- package/dist/database/create-stores.js.map +1 -1
- package/dist/database/entities/workflow-execution.entity.d.ts +2 -3
- package/dist/database/entities/workflow-execution.entity.js +3 -3
- package/dist/database/entities/workflow-execution.entity.js.map +1 -1
- package/dist/database/entities/workflow-step-execution.entity.d.ts +1 -0
- package/dist/database/entities/workflow-step-execution.entity.js +7 -3
- package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
- package/dist/database/index.d.ts +1 -0
- package/dist/database/index.js.map +1 -1
- package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +1 -1
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +13 -2
- package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -1
- package/dist/database/typeorm-execution-store.js +1 -1
- package/dist/database/typeorm-execution-store.js.map +1 -1
- package/dist/database/typeorm-step-store.d.ts +5 -5
- package/dist/database/typeorm-step-store.js +57 -13
- package/dist/database/typeorm-step-store.js.map +1 -1
- package/dist/execution/completion.d.ts +2 -0
- package/dist/execution/completion.js +21 -0
- package/dist/execution/completion.js.map +1 -0
- package/dist/execution/execution-start-handler.js +3 -1
- package/dist/execution/execution-start-handler.js.map +1 -1
- package/dist/execution/execution-store.d.ts +3 -4
- package/dist/execution/execution-store.js.map +1 -1
- package/dist/execution/execution.types.d.ts +8 -0
- package/dist/execution/execution.types.js +6 -1
- package/dist/execution/execution.types.js.map +1 -1
- package/dist/execution/index.d.ts +3 -2
- package/dist/execution/index.js +3 -1
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/iteration-mapping.d.ts +14 -0
- package/dist/execution/iteration-mapping.js +48 -0
- package/dist/execution/iteration-mapping.js.map +1 -0
- package/dist/execution/loop-ledger.d.ts +7 -0
- package/dist/execution/loop-ledger.js +38 -0
- package/dist/execution/loop-ledger.js.map +1 -0
- package/dist/execution/settlement.d.ts +6 -4
- package/dist/execution/settlement.js +73 -17
- package/dist/execution/settlement.js.map +1 -1
- package/dist/execution/start-execution.service.d.ts +2 -3
- package/dist/execution/start-execution.service.js +1 -1
- package/dist/execution/start-execution.service.js.map +1 -1
- package/dist/execution/step-ready-handler.d.ts +7 -1
- package/dist/execution/step-ready-handler.js +29 -10
- package/dist/execution/step-ready-handler.js.map +1 -1
- package/dist/execution/step-settled-handler.d.ts +1 -2
- package/dist/execution/step-settled-handler.js +27 -23
- package/dist/execution/step-settled-handler.js.map +1 -1
- package/dist/execution/step-store.d.ts +8 -5
- package/dist/execution/step-store.js.map +1 -1
- package/dist/graph/graph-validation.error.d.ts +3 -0
- package/dist/graph/graph-validation.error.js +11 -0
- package/dist/graph/graph-validation.error.js.map +1 -0
- package/dist/graph/index.d.ts +4 -1
- package/dist/graph/index.js +7 -2
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/loops.d.ts +10 -0
- package/dist/graph/loops.js +161 -0
- package/dist/graph/loops.js.map +1 -0
- package/dist/graph/validate-executable-graph.d.ts +1 -3
- package/dist/graph/validate-executable-graph.js +9 -15
- package/dist/graph/validate-executable-graph.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime/create-engine-runtime.d.ts +18 -0
- package/dist/runtime/create-engine-runtime.js +26 -0
- package/dist/runtime/create-engine-runtime.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/serve.js +18 -30
- package/dist/serve.js.map +1 -1
- package/dist/server/create-engine-server.d.ts +3 -9
- package/dist/server/create-engine-server.js +5 -9
- package/dist/server/create-engine-server.js.map +1 -1
- package/dist/server/error-response.d.ts +7 -0
- package/dist/server/error-response.js +12 -0
- package/dist/server/error-response.js.map +1 -0
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +3 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/workflow-executions.js +7 -9
- package/dist/server/routes/workflow-executions.js.map +1 -1
- package/dist/testing/start-engine-server.d.ts +3 -2
- package/dist/testing/start-engine-server.js +2 -2
- package/dist/testing/start-engine-server.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowGraph, WorkflowLoop } from '../graph';
|
|
2
|
+
import { type StepStatus } from './execution.types';
|
|
3
|
+
import type { StepStore, StepSummary } from './step-store';
|
|
4
|
+
export declare function endsLoop(status: StepStatus, loopSlotFilled: boolean): boolean;
|
|
5
|
+
export declare function isTerminalStep(step: StepSummary): boolean;
|
|
6
|
+
export declare function exitSourcesInto(graph: WorkflowGraph, loops: WorkflowLoop[], targetNodeIds: string[]): string[];
|
|
7
|
+
export declare function loadTerminalIterations(stepStore: StepStore, executionId: string, batchNodeIds: string[]): Promise<Map<string, number>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.endsLoop = endsLoop;
|
|
4
|
+
exports.isTerminalStep = isTerminalStep;
|
|
5
|
+
exports.exitSourcesInto = exitSourcesInto;
|
|
6
|
+
exports.loadTerminalIterations = loadTerminalIterations;
|
|
7
|
+
const execution_types_1 = require("./execution.types");
|
|
8
|
+
const iteration_mapping_1 = require("./iteration-mapping");
|
|
9
|
+
const LOOP_SLOT = 1;
|
|
10
|
+
function endsLoop(status, loopSlotFilled) {
|
|
11
|
+
return (0, execution_types_1.isSettledStatus)(status) && !loopSlotFilled;
|
|
12
|
+
}
|
|
13
|
+
function isTerminalStep(step) {
|
|
14
|
+
return endsLoop(step.status, Boolean(step.filledOutputSlots[LOOP_SLOT]));
|
|
15
|
+
}
|
|
16
|
+
function exitSourcesInto(graph, loops, targetNodeIds) {
|
|
17
|
+
if (loops.length === 0)
|
|
18
|
+
return [];
|
|
19
|
+
const targets = new Set(targetNodeIds);
|
|
20
|
+
const sources = new Set();
|
|
21
|
+
for (const edge of graph.edges) {
|
|
22
|
+
if (targets.has(edge.to) && (0, iteration_mapping_1.classifyEdge)(edge, loops) === 'exit')
|
|
23
|
+
sources.add(edge.from);
|
|
24
|
+
}
|
|
25
|
+
return [...sources];
|
|
26
|
+
}
|
|
27
|
+
async function loadTerminalIterations(stepStore, executionId, batchNodeIds) {
|
|
28
|
+
if (batchNodeIds.length === 0)
|
|
29
|
+
return new Map();
|
|
30
|
+
const latest = await stepStore.loadLatestStepSummaries(executionId, batchNodeIds);
|
|
31
|
+
const terminalIterations = new Map();
|
|
32
|
+
for (const [batchNodeId, step] of Object.entries(latest)) {
|
|
33
|
+
if (isTerminalStep(step))
|
|
34
|
+
terminalIterations.set(batchNodeId, step.iteration);
|
|
35
|
+
}
|
|
36
|
+
return terminalIterations;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=loop-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-ledger.js","sourceRoot":"","sources":["../../src/execution/loop-ledger.ts"],"names":[],"mappings":";;;;;;AACA,uDAAqE;AACrE,2DAAmD;AAInD,MAAM,SAAS,GAAG,CAAC,CAAC;AAYpB,kBAAyB,MAAkB,EAAE,cAAuB;IACnE,OAAO,IAAA,iCAAe,EAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;AACnD,C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@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WorkflowGraph, WorkflowLoop } from '../graph';
|
|
2
|
+
import { type StepKey, type StepKeyId } from './execution.types';
|
|
2
3
|
import type { StepSummary } from './step-store';
|
|
3
4
|
export interface SuccessorDecisions {
|
|
4
|
-
toQueue:
|
|
5
|
-
toSkip:
|
|
5
|
+
toQueue: StepKey[];
|
|
6
|
+
toSkip: StepKey[];
|
|
6
7
|
}
|
|
7
|
-
export declare function decideSuccessors(graph: WorkflowGraph,
|
|
8
|
+
export declare function decideSuccessors(graph: WorkflowGraph, loops: WorkflowLoop[], settled: StepKey, steps: Record<StepKeyId, StepSummary>, terminalIterations: Map<string, number>): SuccessorDecisions;
|
|
9
|
+
export declare function decisionKeys(graph: WorkflowGraph, loops: WorkflowLoop[], settled: StepKey, terminalIterations: Map<string, number>): StepKey[];
|
|
@@ -1,31 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decideSuccessors = decideSuccessors;
|
|
4
|
-
|
|
4
|
+
exports.decisionKeys = decisionKeys;
|
|
5
5
|
const execution_types_1 = require("./execution.types");
|
|
6
|
-
|
|
6
|
+
const iteration_mapping_1 = require("./iteration-mapping");
|
|
7
|
+
const loop_ledger_1 = require("./loop-ledger");
|
|
8
|
+
function decideSuccessors(graph, loops, settled, steps, terminalIterations) {
|
|
7
9
|
const decisions = { toQueue: [], toSkip: [] };
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const batchStep = loops.some((loop) => loop.batchNodeId === settled.nodeId)
|
|
11
|
+
? steps[(0, execution_types_1.stepKeyId)(settled)]
|
|
12
|
+
: undefined;
|
|
13
|
+
const decided = new Set();
|
|
14
|
+
const outgoingEdges = graph.edges.filter((edge) => edge.from === settled.nodeId);
|
|
15
|
+
for (const edge of outgoingEdges) {
|
|
16
|
+
const edgeClass = (0, iteration_mapping_1.classifyEdge)(edge, loops);
|
|
17
|
+
if (batchStep && !batchStepDecides(edgeClass, batchStep))
|
|
10
18
|
continue;
|
|
11
|
-
const
|
|
19
|
+
const target = (0, iteration_mapping_1.targetKey)(edge, edgeClass, settled);
|
|
20
|
+
const targetId = (0, execution_types_1.stepKeyId)(target);
|
|
21
|
+
if (steps[targetId] || decided.has(targetId))
|
|
22
|
+
continue;
|
|
23
|
+
decided.add(targetId);
|
|
24
|
+
const fate = decideNodeFate(graph, loops, target, steps, terminalIterations);
|
|
12
25
|
if (fate === 'queued')
|
|
13
|
-
decisions.toQueue.push(
|
|
26
|
+
decisions.toQueue.push(target);
|
|
14
27
|
else if (fate === 'skipped')
|
|
15
|
-
decisions.toSkip.push(
|
|
28
|
+
decisions.toSkip.push(target);
|
|
16
29
|
}
|
|
17
30
|
return decisions;
|
|
18
31
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
return '
|
|
25
|
-
|
|
32
|
+
function batchStepDecides(edgeClass, batchStep) {
|
|
33
|
+
return (0, loop_ledger_1.isTerminalStep)(batchStep) ? edgeClass === 'exit' : edgeClass !== 'exit';
|
|
34
|
+
}
|
|
35
|
+
function decideNodeFate(graph, loops, candidate, steps, terminalIterations) {
|
|
36
|
+
if (isPastLoopEnd(loops, candidate, steps))
|
|
37
|
+
return 'outside';
|
|
38
|
+
let applicable = 0;
|
|
39
|
+
let live = false;
|
|
40
|
+
const incomingEdges = graph.edges.filter((edge) => edge.to === candidate.nodeId);
|
|
41
|
+
for (const edge of incomingEdges) {
|
|
42
|
+
const source = (0, iteration_mapping_1.sourceRow)(edge, (0, iteration_mapping_1.classifyEdge)(edge, loops), candidate, terminalIterations.get(edge.from));
|
|
43
|
+
if (source.kind === 'none')
|
|
44
|
+
continue;
|
|
45
|
+
if (source.kind === 'pending')
|
|
46
|
+
return 'undecidable';
|
|
47
|
+
applicable += 1;
|
|
48
|
+
const sourceStep = steps[(0, execution_types_1.stepKeyId)(source.key)];
|
|
49
|
+
if (!sourceStep || !(0, execution_types_1.isSettledStatus)(sourceStep.status))
|
|
50
|
+
return 'undecidable';
|
|
51
|
+
if (isLive(sourceStep, edge))
|
|
52
|
+
live = true;
|
|
53
|
+
}
|
|
54
|
+
if (applicable === 0)
|
|
55
|
+
return 'outside';
|
|
56
|
+
return live ? 'queued' : 'skipped';
|
|
26
57
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
|
|
58
|
+
function isPastLoopEnd(loops, candidate, steps) {
|
|
59
|
+
const loop = loops.find((l) => l.memberIds.has(candidate.nodeId));
|
|
60
|
+
if (!loop || candidate.nodeId === loop.batchNodeId)
|
|
61
|
+
return false;
|
|
62
|
+
const batchStep = steps[(0, execution_types_1.stepKeyId)({ nodeId: loop.batchNodeId, iteration: candidate.iteration })];
|
|
63
|
+
return batchStep !== undefined && (0, loop_ledger_1.isTerminalStep)(batchStep);
|
|
64
|
+
}
|
|
65
|
+
function isLive(source, edge) {
|
|
66
|
+
return source.status === 'completed' && Boolean(source.filledOutputSlots[edge.outputIndex]);
|
|
67
|
+
}
|
|
68
|
+
function decisionKeys(graph, loops, settled, terminalIterations) {
|
|
69
|
+
const keys = new Map([[(0, execution_types_1.stepKeyId)(settled), settled]]);
|
|
70
|
+
const add = (key) => keys.set((0, execution_types_1.stepKeyId)(key), key);
|
|
71
|
+
const outgoingEdges = graph.edges.filter((edge) => edge.from === settled.nodeId);
|
|
72
|
+
for (const edge of outgoingEdges) {
|
|
73
|
+
const target = (0, iteration_mapping_1.targetKey)(edge, (0, iteration_mapping_1.classifyEdge)(edge, loops), settled);
|
|
74
|
+
add(target);
|
|
75
|
+
const incomingEdges = graph.edges.filter((inEdge) => inEdge.to === target.nodeId);
|
|
76
|
+
for (const inEdge of incomingEdges) {
|
|
77
|
+
const source = (0, iteration_mapping_1.sourceRow)(inEdge, (0, iteration_mapping_1.classifyEdge)(inEdge, loops), target, terminalIterations.get(inEdge.from));
|
|
78
|
+
if (source.kind === 'row')
|
|
79
|
+
add(source.key);
|
|
80
|
+
}
|
|
81
|
+
const loop = loops.find((l) => l.memberIds.has(target.nodeId));
|
|
82
|
+
if (loop)
|
|
83
|
+
add({ nodeId: loop.batchNodeId, iteration: target.iteration });
|
|
84
|
+
}
|
|
85
|
+
return [...keys.values()];
|
|
30
86
|
}
|
|
31
87
|
//# sourceMappingURL=settlement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.js","sourceRoot":"","sources":["../../src/execution/settlement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settlement.js","sourceRoot":"","sources":["../../src/execution/settlement.ts"],"names":[],"mappings":";;;;AACA,uDAA6F;AAC7F,2DAAyF;AACzF,+CAA+C;AA+D/C,0BACC,KAAoB,EACpB,KAAqB,EACrB,OAAgB,EAChB,KAAqC,EACrC,kBAAuC;IAEvC,MAAM,SAAS,GAAuB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAClE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC;QAC1E,CAAC,CAAC,KAAK,CAAC,IAAA,2BAAS,EAAC,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAC,SAAS,CAAC;IACb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAa,CAAC;IACrC,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjF,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,IAAA,gCAAY,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,SAAS,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,SA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AAE,KAAK,CAAC,EAC3B,MAAM,EACN,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CACnC,CAAC;YACF,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK;gBAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/D,IAAI,IAAI;YAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { type AdmittanceService } from '../admittance';
|
|
2
|
-
import type { JsonObject } from '../common';
|
|
3
2
|
import { type WorkflowGraph } from '../graph';
|
|
4
3
|
import type { OrchestrationMessage, WorkQueue } from '../queue';
|
|
5
4
|
import type { ExecutionStore } from './execution-store';
|
|
6
|
-
import type { ExecutionMode } from './execution.types';
|
|
5
|
+
import type { ExecutionMode, TriggerOutputs } from './execution.types';
|
|
7
6
|
export interface StartExecutionRequest {
|
|
8
7
|
workflowId: string;
|
|
9
8
|
graph: WorkflowGraph;
|
|
10
|
-
|
|
9
|
+
triggerOutputs?: TriggerOutputs | null;
|
|
11
10
|
mode?: ExecutionMode;
|
|
12
11
|
}
|
|
13
12
|
export interface StartExecutionResult {
|
|
@@ -25,7 +25,7 @@ class StartExecutionService {
|
|
|
25
25
|
status: 'queued',
|
|
26
26
|
mode: request.mode ?? 'production',
|
|
27
27
|
graph: request.graph,
|
|
28
|
-
|
|
28
|
+
triggerOutputs: request.triggerOutputs ?? null,
|
|
29
29
|
});
|
|
30
30
|
await this.workQueue.publish({
|
|
31
31
|
type: 'execution:enqueued',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-execution.service.js","sourceRoot":"","sources":["../../src/execution/start-execution.service.ts"],"names":[],"mappings":";;;AAAA,8CAAgF;
|
|
1
|
+
{"version":3,"file":"start-execution.service.js","sourceRoot":"","sources":["../../src/execution/start-execution.service.ts"],"names":[],"mappings":";;;AAAA,8CAAgF;AAChF,oCAAuE;AAiBvE;IAEmB,UAAU;IACV,cAAc;IACd,SAAS;IACT,aAAa;IAJ/B,YACkB,UAA6B,EAC7B,cAA8B,EAC9B,SAA0C,EAC1C,aAAa,GAAmC,+BAAuB;0BAHvE,UAAU;8BACV,cAAc;yBACd,SAAS;6BACT,aAAa;IAC5B,CAAC;IAEJ,KAAK,CAAC,KAAK,CAAC,OAA8B;QAGzC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAElC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACtB,MAAM,IAAI,oCAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC;YACxD,UAAU,EAAE,OAAO,CAAC,UAAU;YAE9B,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,YAAY;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,IAAI;SAC9C,CAAC,CAAC;QAKH,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC5B,IAAI,EAAE,oBAAoB;YAC1B,WAAW,EAAE,EAAE;SACf,CAAC,CAAC;QAEH,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC5B,CAAC;CACD"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ExternalDependencies } from '../dependencies';
|
|
2
|
+
import { type GraphEdge, type WorkflowLoop } from '../graph';
|
|
2
3
|
import type { OrchestrationMessage, StepReadyEvent, WorkQueue } from '../queue';
|
|
3
4
|
import type { ExecutionStore } from './execution-store';
|
|
4
|
-
import type
|
|
5
|
+
import { type StepKey } from './execution.types';
|
|
6
|
+
import type { StepRecord, StepStore } from './step-store';
|
|
5
7
|
export declare class StepReadyHandler {
|
|
6
8
|
private readonly executionStore;
|
|
7
9
|
private readonly stepStore;
|
|
@@ -13,3 +15,7 @@ export declare class StepReadyHandler {
|
|
|
13
15
|
private gatherInputs;
|
|
14
16
|
private executorFor;
|
|
15
17
|
}
|
|
18
|
+
export declare function resolveInputReads(incomingEdges: GraphEdge[], loops: WorkflowLoop[], step: Pick<StepRecord, 'id' | 'nodeId' | 'iteration'>, terminalIterations: Map<string, number>): Array<{
|
|
19
|
+
edge: GraphEdge;
|
|
20
|
+
key: StepKey;
|
|
21
|
+
}>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StepReadyHandler = void 0;
|
|
4
|
+
exports.resolveInputReads = resolveInputReads;
|
|
4
5
|
const common_1 = require("../common");
|
|
6
|
+
const graph_1 = require("../graph");
|
|
5
7
|
const execution_types_1 = require("./execution.types");
|
|
8
|
+
const iteration_mapping_1 = require("./iteration-mapping");
|
|
9
|
+
const loop_ledger_1 = require("./loop-ledger");
|
|
6
10
|
const validate_step_context_1 = require("./validate-step-context");
|
|
7
11
|
class StepReadyHandler {
|
|
8
12
|
executionStore;
|
|
@@ -65,12 +69,15 @@ class StepReadyHandler {
|
|
|
65
69
|
if (incomingEdges.length === 0) {
|
|
66
70
|
throw new common_1.UnexpectedError(`step ${step.id} runs node ${step.nodeId}, which has no predecessor in the execution graph`);
|
|
67
71
|
}
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
const loops = (0, graph_1.deriveLoops)(execution.graph);
|
|
73
|
+
const terminalIterations = await (0, loop_ledger_1.loadTerminalIterations)(this.stepStore, execution.id, (0, loop_ledger_1.exitSourcesInto)(execution.graph, loops, [step.nodeId]));
|
|
74
|
+
const reads = resolveInputReads(incomingEdges, loops, step, terminalIterations);
|
|
75
|
+
const rows = await this.stepStore.loadStepsByKeys(execution.id, [
|
|
76
|
+
...new Map(reads.map(({ key }) => [(0, execution_types_1.stepKeyId)(key), key])).values(),
|
|
77
|
+
]);
|
|
78
|
+
const inputs = Array.from({ length: Math.max(...reads.map(({ edge }) => edge.inputIndex)) + 1 }, () => null);
|
|
79
|
+
for (const { edge, key } of reads) {
|
|
80
|
+
inputs[edge.inputIndex] = readEdgeValue(edge, key, step, rows);
|
|
74
81
|
}
|
|
75
82
|
return inputs;
|
|
76
83
|
}
|
|
@@ -86,17 +93,29 @@ class StepReadyHandler {
|
|
|
86
93
|
}
|
|
87
94
|
}
|
|
88
95
|
exports.StepReadyHandler = StepReadyHandler;
|
|
89
|
-
function
|
|
96
|
+
function resolveInputReads(incomingEdges, loops, step, terminalIterations) {
|
|
97
|
+
const reads = incomingEdges.flatMap((edge) => {
|
|
98
|
+
const source = (0, iteration_mapping_1.sourceRow)(edge, (0, iteration_mapping_1.classifyEdge)(edge, loops), step, terminalIterations.get(edge.from));
|
|
99
|
+
if (source.kind === 'row')
|
|
100
|
+
return [{ edge, key: source.key }];
|
|
101
|
+
if (source.kind === 'none')
|
|
102
|
+
return [];
|
|
103
|
+
throw new common_1.UnexpectedError(`step ${step.id} reads node ${edge.from} across a loop that has not ended`);
|
|
104
|
+
});
|
|
105
|
+
if (reads.length === 0) {
|
|
106
|
+
throw new common_1.UnexpectedError(`step ${step.id} runs node ${step.nodeId}, which no edge reaches at iteration ${step.iteration}`);
|
|
107
|
+
}
|
|
90
108
|
const filledSlots = new Set();
|
|
91
|
-
for (const edge of
|
|
109
|
+
for (const { edge } of reads) {
|
|
92
110
|
if (filledSlots.has(edge.inputIndex)) {
|
|
93
111
|
throw new common_1.UnexpectedError(`step ${step.id} runs node ${step.nodeId}, which has more than one edge into input slot ${edge.inputIndex}; validated graphs have at most one edge per input slot`);
|
|
94
112
|
}
|
|
95
113
|
filledSlots.add(edge.inputIndex);
|
|
96
114
|
}
|
|
115
|
+
return reads;
|
|
97
116
|
}
|
|
98
|
-
function readEdgeValue(edge,
|
|
99
|
-
const row =
|
|
117
|
+
function readEdgeValue(edge, source, step, rows) {
|
|
118
|
+
const row = rows[(0, execution_types_1.stepKeyId)(source)];
|
|
100
119
|
if (!row || !(0, execution_types_1.isSettledStatus)(row.status)) {
|
|
101
120
|
throw new common_1.UnexpectedError(`step ${step.id} reads node ${edge.from}, whose step has not settled`);
|
|
102
121
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-ready-handler.js","sourceRoot":"","sources":["../../src/execution/step-ready-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step-ready-handler.js","sourceRoot":"","sources":["../../src/execution/step-ready-handler.ts"],"names":[],"mappings":";;;;AAAA,sCAAgF;AAEhF,oCAA0F;AAG1F,uDAM2B;AAC3B,2DAA8D;AAC9D,+CAAwE;AAExE,mEAA8D;AAW9D;IAEmB,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,YAAY;IAJ9B,YACkB,cAA8B,EAC9B,SAAoB,EACpB,kBAAmD,EACnD,YAAkC;8BAHlC,cAAc;yBACd,SAAS;kCACT,kBAAkB;4BAClB,YAAY;IAC3B,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,KAAqB;QAEjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,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AS,aAAa,CACrB,IAAe,EACf,MAAe,EACf,IAAgB,EAChB,IAAmC;IAEnC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAA,2BAAS,EAAC,MAAM,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAA,iCAAe,EAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAG1C,MAAM,IAAI,wBAAe,CACxB,QAAQ,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,IAAI,8BAA8B,CACrE,CAAC;IACH,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC5C,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -10,8 +10,7 @@ export declare class StepSettledHandler {
|
|
|
10
10
|
handle(event: StepSettledEvent): Promise<void>;
|
|
11
11
|
private failExecution;
|
|
12
12
|
private planSuccessors;
|
|
13
|
-
private loadDecisionSteps;
|
|
14
13
|
private announceCreatedSteps;
|
|
15
14
|
private finishExecutionIfDone;
|
|
16
|
-
private
|
|
15
|
+
private reachableNodeIds;
|
|
17
16
|
}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StepSettledHandler = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const graph_1 = require("../graph");
|
|
6
|
+
const completion_1 = require("./completion");
|
|
7
|
+
const execution_types_1 = require("./execution.types");
|
|
8
|
+
const loop_ledger_1 = require("./loop-ledger");
|
|
6
9
|
const settlement_1 = require("./settlement");
|
|
7
10
|
const validate_step_context_1 = require("./validate-step-context");
|
|
8
11
|
class StepSettledHandler {
|
|
@@ -34,8 +37,7 @@ class StepSettledHandler {
|
|
|
34
37
|
await this.failExecution(execution.id);
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
queued = await this.planSuccessors(execution, step.nodeId, steps);
|
|
40
|
+
queued = await this.planSuccessors(execution, step);
|
|
39
41
|
}
|
|
40
42
|
if (queued > 0)
|
|
41
43
|
return;
|
|
@@ -45,30 +47,24 @@ class StepSettledHandler {
|
|
|
45
47
|
await this.executionStore.finishExecution(executionId, 'failed');
|
|
46
48
|
await this.stepStore.cancelQueuedSteps(executionId);
|
|
47
49
|
}
|
|
48
|
-
async planSuccessors(execution,
|
|
49
|
-
const
|
|
50
|
+
async planSuccessors(execution, step) {
|
|
51
|
+
const loops = (0, graph_1.deriveLoops)(execution.graph);
|
|
52
|
+
const candidates = (0, graph_1.getSuccessorNodeIds)(execution.graph, step.nodeId);
|
|
53
|
+
const terminalIterations = await (0, loop_ledger_1.loadTerminalIterations)(this.stepStore, execution.id, (0, loop_ledger_1.exitSourcesInto)(execution.graph, loops, candidates));
|
|
54
|
+
const steps = await this.stepStore.loadStepSummariesByKeys(execution.id, (0, settlement_1.decisionKeys)(execution.graph, loops, step, terminalIterations));
|
|
55
|
+
const { toQueue, toSkip } = (0, settlement_1.decideSuccessors)(execution.graph, loops, step, steps, terminalIterations);
|
|
50
56
|
if (toQueue.length === 0 && toSkip.length === 0)
|
|
51
57
|
return 0;
|
|
52
58
|
const created = await this.stepStore.createSteps(execution.id, [
|
|
53
|
-
...toQueue.map((
|
|
54
|
-
...toSkip.map((
|
|
59
|
+
...toQueue.map((key) => ({ ...key, status: 'queued' })),
|
|
60
|
+
...toSkip.map((key) => ({ ...key, status: 'skipped' })),
|
|
55
61
|
]);
|
|
56
|
-
return await this.announceCreatedSteps(execution.id, created, new Set(toQueue));
|
|
62
|
+
return await this.announceCreatedSteps(execution.id, created, new Set(toQueue.map(execution_types_1.stepKeyId)));
|
|
57
63
|
}
|
|
58
|
-
async
|
|
59
|
-
const successors = (0, graph_1.getSuccessorNodeIds)(execution.graph, nodeId);
|
|
60
|
-
const nodeIds = [
|
|
61
|
-
...new Set([
|
|
62
|
-
...successors,
|
|
63
|
-
...successors.flatMap((id) => (0, graph_1.getPredecessorNodeIds)(execution.graph, id)),
|
|
64
|
-
]),
|
|
65
|
-
];
|
|
66
|
-
return await this.stepStore.loadStepSummaries(execution.id, nodeIds);
|
|
67
|
-
}
|
|
68
|
-
async announceCreatedSteps(executionId, created, queuedNodeIds) {
|
|
64
|
+
async announceCreatedSteps(executionId, created, queuedKeys) {
|
|
69
65
|
let queued = 0;
|
|
70
|
-
for (const { id: stepId,
|
|
71
|
-
if (
|
|
66
|
+
for (const { id: stepId, ...key } of created) {
|
|
67
|
+
if (queuedKeys.has((0, execution_types_1.stepKeyId)(key))) {
|
|
72
68
|
queued += 1;
|
|
73
69
|
await this.stepQueue.publish({ type: 'step:ready', executionId, stepId });
|
|
74
70
|
}
|
|
@@ -79,18 +75,26 @@ class StepSettledHandler {
|
|
|
79
75
|
return queued;
|
|
80
76
|
}
|
|
81
77
|
async finishExecutionIfDone(execution) {
|
|
78
|
+
const reachable = this.reachableNodeIds(execution);
|
|
79
|
+
const loops = (0, graph_1.deriveLoops)(execution.graph);
|
|
80
|
+
const terminalIterations = await (0, loop_ledger_1.loadTerminalIterations)(this.stepStore, execution.id, loops
|
|
81
|
+
.filter((loop) => reachable.has(loop.batchNodeId))
|
|
82
|
+
.map((loop) => loop.batchNodeId));
|
|
83
|
+
const expected = (0, completion_1.countExpectedSettledSteps)(loops, reachable, terminalIterations);
|
|
84
|
+
if (expected === undefined)
|
|
85
|
+
return;
|
|
82
86
|
const settled = await this.stepStore.countSettledSteps(execution.id);
|
|
83
|
-
if (settled <
|
|
87
|
+
if (settled < expected)
|
|
84
88
|
return;
|
|
85
89
|
const failed = await this.stepStore.hasFailedSteps(execution.id);
|
|
86
90
|
await this.executionStore.finishExecution(execution.id, failed ? 'failed' : 'completed');
|
|
87
91
|
}
|
|
88
|
-
|
|
92
|
+
reachableNodeIds(execution) {
|
|
89
93
|
const trigger = (0, graph_1.findTriggerNode)(execution.graph);
|
|
90
94
|
if (!trigger) {
|
|
91
95
|
throw new common_1.UnexpectedError(`Execution ${execution.id} has no trigger node in its graph`);
|
|
92
96
|
}
|
|
93
|
-
return
|
|
97
|
+
return new Set([trigger.id, ...(0, graph_1.getDescendantNodeIds)(execution.graph, trigger.id)]);
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
exports.StepSettledHandler = StepSettledHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-settled-handler.js","sourceRoot":"","sources":["../../src/execution/step-settled-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"step-settled-handler.js","sourceRoot":"","sources":["../../src/execution/step-settled-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,oCAAmG;AAEnG,6CAAyD;AAEzD,uDAA4E;AAC5E,+CAAwE;AACxE,6CAA8D;AAE9D,mEAA8D;AAc9D;IAEmB,cAAc;IACd,SAAS;IACT,SAAS;IACT,kBAAkB;IAJpC,YACkB,cAA8B,EAC9B,SAAoB,EACpB,SAAiC,EACjC,kBAAmD;8BAHnD,cAAc;yBACd,SAAS;yBACT,SAAS;kCACT,kBAAkB;IACjC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,KAAuB;QACnC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC3C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAA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,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACrE,IAAI,OAAO,GAAG,QAAQ;YAAE,OAAO;QAE/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACjE,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC;IAEO,gBAAgB,CAAC,SAA0B;QAClD,MAAM,OAAO,GAAG,IAAA,uBAAe,EAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,EAAE,CAAC;YAGd,MAAM,IAAI,wBAAe,CAAC,aAAa,SAAS,CAAC,EAAE,mCAAmC,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,IAAA,4BAAoB,EAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;CACD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { JsonValue } from '../common';
|
|
2
|
-
import type { StepSlots, StepStatus } from './execution.types';
|
|
2
|
+
import type { StepKey, StepKeyId, StepSlots, StepStatus } from './execution.types';
|
|
3
3
|
export type NewStepRecord = {
|
|
4
4
|
nodeId: string;
|
|
5
|
+
iteration: number;
|
|
5
6
|
} & ({
|
|
6
7
|
status: Extract<StepStatus, 'queued' | 'skipped'>;
|
|
7
8
|
outputs?: never;
|
|
@@ -19,6 +20,7 @@ export interface StepRecord {
|
|
|
19
20
|
id: string;
|
|
20
21
|
executionId: string;
|
|
21
22
|
nodeId: string;
|
|
23
|
+
iteration: number;
|
|
22
24
|
status: StepStatus;
|
|
23
25
|
outputs: StepSlots | null;
|
|
24
26
|
error: StepError | null;
|
|
@@ -26,6 +28,7 @@ export interface StepRecord {
|
|
|
26
28
|
export interface StepSummary {
|
|
27
29
|
id: string;
|
|
28
30
|
nodeId: string;
|
|
31
|
+
iteration: number;
|
|
29
32
|
status: StepStatus;
|
|
30
33
|
filledOutputSlots: boolean[];
|
|
31
34
|
}
|
|
@@ -36,15 +39,15 @@ export declare class StepNotFoundError extends Error {
|
|
|
36
39
|
export interface StepStore {
|
|
37
40
|
createSteps(executionId: string, records: NewStepRecord[]): Promise<Array<{
|
|
38
41
|
id: string;
|
|
39
|
-
|
|
40
|
-
}>>;
|
|
42
|
+
} & StepKey>>;
|
|
41
43
|
loadStep(id: string): Promise<StepRecord>;
|
|
42
44
|
claimStep(id: string): Promise<StepRecord | null>;
|
|
43
45
|
completeStep(id: string, outputs: StepSlots): Promise<boolean>;
|
|
44
46
|
failStep(id: string, error: StepError): Promise<boolean>;
|
|
45
47
|
cancelQueuedSteps(executionId: string): Promise<void>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
loadStepsByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepRecord>>;
|
|
49
|
+
loadStepSummariesByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepSummary>>;
|
|
50
|
+
loadLatestStepSummaries(executionId: string, nodeIds: string[]): Promise<Record<string, StepSummary>>;
|
|
48
51
|
countSettledSteps(executionId: string): Promise<number>;
|
|
49
52
|
hasFailedSteps(executionId: string): Promise<boolean>;
|
|
50
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-store.js","sourceRoot":"","sources":["../../src/execution/step-store.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"step-store.js","sourceRoot":"","sources":["../../src/execution/step-store.ts"],"names":[],"mappings":";;;AA4DA,uBAA+B,SAAQ,KAAK;IACtB,MAAM;IAA3B,YAAqB,MAAc;QAClC,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;sBADf,MAAM;QAE1B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IACjC,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphValidationError = void 0;
|
|
4
|
+
class GraphValidationError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'GraphValidationError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.GraphValidationError = GraphValidationError;
|
|
11
|
+
//# sourceMappingURL=graph-validation.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-validation.error.js","sourceRoot":"","sources":["../../src/graph/graph-validation.error.ts"],"names":[],"mappings":";;;AACA,0BAAkC,SAAQ,KAAK;IAC9C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACpC,CAAC;CACD"}
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export type { GraphEdge, GraphNode, StepConfig, StepType, WorkflowGraph, } from './workflow-graph';
|
|
2
2
|
export { findTriggerNode, getDescendantNodeIds, getPredecessorNodeIds, getSuccessorNodeIds, } from './workflow-graph-queries';
|
|
3
|
-
export { GraphValidationError
|
|
3
|
+
export { GraphValidationError } from './graph-validation.error';
|
|
4
|
+
export { MAX_SLOT_INDEX, validateExecutableGraph } from './validate-executable-graph';
|
|
5
|
+
export { deriveLoops, validateLoops } from './loops';
|
|
6
|
+
export type { WorkflowLoop } from './loops';
|
package/dist/graph/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateExecutableGraph = exports.GraphValidationError = exports.getSuccessorNodeIds = exports.getPredecessorNodeIds = exports.getDescendantNodeIds = exports.findTriggerNode = void 0;
|
|
3
|
+
exports.validateLoops = exports.deriveLoops = exports.validateExecutableGraph = exports.MAX_SLOT_INDEX = exports.GraphValidationError = exports.getSuccessorNodeIds = exports.getPredecessorNodeIds = exports.getDescendantNodeIds = exports.findTriggerNode = void 0;
|
|
4
4
|
var workflow_graph_queries_1 = require("./workflow-graph-queries");
|
|
5
5
|
Object.defineProperty(exports, "findTriggerNode", { enumerable: true, get: function () { return workflow_graph_queries_1.findTriggerNode; } });
|
|
6
6
|
Object.defineProperty(exports, "getDescendantNodeIds", { enumerable: true, get: function () { return workflow_graph_queries_1.getDescendantNodeIds; } });
|
|
7
7
|
Object.defineProperty(exports, "getPredecessorNodeIds", { enumerable: true, get: function () { return workflow_graph_queries_1.getPredecessorNodeIds; } });
|
|
8
8
|
Object.defineProperty(exports, "getSuccessorNodeIds", { enumerable: true, get: function () { return workflow_graph_queries_1.getSuccessorNodeIds; } });
|
|
9
|
+
var graph_validation_error_1 = require("./graph-validation.error");
|
|
10
|
+
Object.defineProperty(exports, "GraphValidationError", { enumerable: true, get: function () { return graph_validation_error_1.GraphValidationError; } });
|
|
9
11
|
var validate_executable_graph_1 = require("./validate-executable-graph");
|
|
10
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "MAX_SLOT_INDEX", { enumerable: true, get: function () { return validate_executable_graph_1.MAX_SLOT_INDEX; } });
|
|
11
13
|
Object.defineProperty(exports, "validateExecutableGraph", { enumerable: true, get: function () { return validate_executable_graph_1.validateExecutableGraph; } });
|
|
14
|
+
var loops_1 = require("./loops");
|
|
15
|
+
Object.defineProperty(exports, "deriveLoops", { enumerable: true, get: function () { return loops_1.deriveLoops; } });
|
|
16
|
+
Object.defineProperty(exports, "validateLoops", { enumerable: true, get: function () { return loops_1.validateLoops; } });
|
|
12
17
|
//# sourceMappingURL=index.js.map
|
package/dist/graph/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":";;;AAOA,mEAKkC;AAJjC,yHAAA,eAAe,OAAA;AACf,8HAAA,oBAAoB,OAAA;AACpB,+HAAA,qBAAqB,OAAA;AACrB,6HAAA,mBAAmB,OAAA;AAEpB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":";;;AAOA,mEAKkC;AAJjC,yHAAA,eAAe,OAAA;AACf,8HAAA,oBAAoB,OAAA;AACpB,+HAAA,qBAAqB,OAAA;AACrB,6HAAA,mBAAmB,OAAA;AAEpB,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAC7B,yEAAsF;AAA7E,2HAAA,cAAc,OAAA;AAAE,oIAAA,uBAAuB,OAAA;AAChD,iCAAqD;AAA5C,oGAAA,WAAW,OAAA;AAAE,sGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GraphEdge, WorkflowGraph } from './workflow-graph';
|
|
2
|
+
export interface WorkflowLoop {
|
|
3
|
+
batchNodeId: string;
|
|
4
|
+
memberIds: Set<string>;
|
|
5
|
+
backEdges: GraphEdge[];
|
|
6
|
+
entryEdges: GraphEdge[];
|
|
7
|
+
exitEdges: GraphEdge[];
|
|
8
|
+
}
|
|
9
|
+
export declare function deriveLoops(graph: WorkflowGraph): WorkflowLoop[];
|
|
10
|
+
export declare function validateLoops(graph: WorkflowGraph): void;
|