@n8n/engine 0.16.2 → 0.18.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.
Files changed (170) hide show
  1. package/dist/auth/action-token.d.ts +7 -0
  2. package/dist/auth/action-token.js +30 -0
  3. package/dist/auth/action-token.js.map +1 -0
  4. package/dist/auth/authenticate.d.ts +4 -0
  5. package/dist/auth/authenticate.js +30 -0
  6. package/dist/auth/authenticate.js.map +1 -0
  7. package/dist/auth/identity-token.d.ts +12 -0
  8. package/dist/auth/identity-token.js +45 -0
  9. package/dist/auth/identity-token.js.map +1 -0
  10. package/dist/auth/identity.types.d.ts +7 -0
  11. package/dist/auth/identity.types.js +3 -0
  12. package/dist/auth/identity.types.js.map +1 -0
  13. package/dist/auth/index.d.ts +5 -0
  14. package/dist/auth/index.js +17 -0
  15. package/dist/auth/index.js.map +1 -0
  16. package/dist/auth/shared-secret-token.d.ts +12 -0
  17. package/dist/auth/shared-secret-token.js +44 -0
  18. package/dist/auth/shared-secret-token.js.map +1 -0
  19. package/dist/build.tsbuildinfo +1 -1
  20. package/dist/common/index.d.ts +1 -0
  21. package/dist/common/index.js +3 -1
  22. package/dist/common/index.js.map +1 -1
  23. package/dist/common/json.schema.d.ts +3 -0
  24. package/dist/common/json.schema.js +13 -0
  25. package/dist/common/json.schema.js.map +1 -0
  26. package/dist/database/create-stores.d.ts +5 -2
  27. package/dist/database/create-stores.js +6 -2
  28. package/dist/database/create-stores.js.map +1 -1
  29. package/dist/database/entities/workflow-execution.entity.d.ts +2 -4
  30. package/dist/database/entities/workflow-execution.entity.js +3 -14
  31. package/dist/database/entities/workflow-execution.entity.js.map +1 -1
  32. package/dist/database/entities/workflow-step-execution.entity.d.ts +2 -2
  33. package/dist/database/entities/workflow-step-execution.entity.js +7 -3
  34. package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
  35. package/dist/database/index.d.ts +2 -0
  36. package/dist/database/index.js +3 -1
  37. package/dist/database/index.js.map +1 -1
  38. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +1 -1
  39. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +13 -2
  40. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -1
  41. package/dist/database/typeorm-execution-store.d.ts +1 -3
  42. package/dist/database/typeorm-execution-store.js +1 -2
  43. package/dist/database/typeorm-execution-store.js.map +1 -1
  44. package/dist/database/typeorm-execution-view-store.d.ts +10 -0
  45. package/dist/database/typeorm-execution-view-store.js +49 -0
  46. package/dist/database/typeorm-execution-view-store.js.map +1 -0
  47. package/dist/database/typeorm-step-store.d.ts +7 -6
  48. package/dist/database/typeorm-step-store.js +63 -14
  49. package/dist/database/typeorm-step-store.js.map +1 -1
  50. package/dist/dependencies/external-dependencies.d.ts +3 -0
  51. package/dist/execution/batch-step.d.ts +8 -0
  52. package/dist/execution/batch-step.js +28 -0
  53. package/dist/execution/batch-step.js.map +1 -0
  54. package/dist/execution/completion.d.ts +2 -0
  55. package/dist/execution/completion.js +21 -0
  56. package/dist/execution/completion.js.map +1 -0
  57. package/dist/execution/execution-query.service.d.ts +7 -0
  58. package/dist/execution/execution-query.service.js +17 -0
  59. package/dist/execution/execution-query.service.js.map +1 -0
  60. package/dist/execution/execution-start-handler.d.ts +3 -1
  61. package/dist/execution/execution-start-handler.js +13 -2
  62. package/dist/execution/execution-start-handler.js.map +1 -1
  63. package/dist/execution/execution-store.d.ts +5 -7
  64. package/dist/execution/execution-store.js.map +1 -1
  65. package/dist/execution/execution-view-store.d.ts +26 -0
  66. package/dist/execution/execution-view-store.js +3 -0
  67. package/dist/execution/execution-view-store.js.map +1 -0
  68. package/dist/execution/execution.types.d.ts +14 -0
  69. package/dist/execution/execution.types.js +6 -1
  70. package/dist/execution/execution.types.js.map +1 -1
  71. package/dist/execution/index.d.ts +5 -2
  72. package/dist/execution/index.js +5 -1
  73. package/dist/execution/index.js.map +1 -1
  74. package/dist/execution/iteration-mapping.d.ts +14 -0
  75. package/dist/execution/iteration-mapping.js +48 -0
  76. package/dist/execution/iteration-mapping.js.map +1 -0
  77. package/dist/execution/loop-ledger.d.ts +7 -0
  78. package/dist/execution/loop-ledger.js +39 -0
  79. package/dist/execution/loop-ledger.js.map +1 -0
  80. package/dist/execution/settlement.d.ts +6 -4
  81. package/dist/execution/settlement.js +73 -17
  82. package/dist/execution/settlement.js.map +1 -1
  83. package/dist/execution/start-execution.service.d.ts +3 -3
  84. package/dist/execution/start-execution.service.js +6 -4
  85. package/dist/execution/start-execution.service.js.map +1 -1
  86. package/dist/execution/step-ready-handler.d.ts +11 -2
  87. package/dist/execution/step-ready-handler.js +66 -13
  88. package/dist/execution/step-ready-handler.js.map +1 -1
  89. package/dist/execution/step-settled-handler.d.ts +4 -3
  90. package/dist/execution/step-settled-handler.js +52 -30
  91. package/dist/execution/step-settled-handler.js.map +1 -1
  92. package/dist/execution/step-store.d.ts +9 -13
  93. package/dist/execution/step-store.js.map +1 -1
  94. package/dist/execution/store-loop-reader.d.ts +4 -0
  95. package/dist/execution/store-loop-reader.js +48 -0
  96. package/dist/execution/store-loop-reader.js.map +1 -0
  97. package/dist/graph/graph-validation.error.d.ts +3 -0
  98. package/dist/graph/graph-validation.error.js +11 -0
  99. package/dist/graph/graph-validation.error.js.map +1 -0
  100. package/dist/graph/index.d.ts +6 -2
  101. package/dist/graph/index.js +9 -2
  102. package/dist/graph/index.js.map +1 -1
  103. package/dist/graph/loops.d.ts +10 -0
  104. package/dist/graph/loops.js +172 -0
  105. package/dist/graph/loops.js.map +1 -0
  106. package/dist/graph/validate-executable-graph.d.ts +1 -3
  107. package/dist/graph/validate-executable-graph.js +13 -18
  108. package/dist/graph/validate-executable-graph.js.map +1 -1
  109. package/dist/graph/workflow-graph.d.ts +4 -0
  110. package/dist/graph/workflow-graph.js +7 -0
  111. package/dist/graph/workflow-graph.js.map +1 -1
  112. package/dist/index.d.ts +14 -7
  113. package/dist/index.js +19 -12
  114. package/dist/index.js.map +1 -1
  115. package/dist/lifecycle-events/batching-lifecycle-event-publisher.d.ts +26 -0
  116. package/dist/lifecycle-events/batching-lifecycle-event-publisher.js +121 -0
  117. package/dist/lifecycle-events/batching-lifecycle-event-publisher.js.map +1 -0
  118. package/dist/lifecycle-events/index.d.ts +6 -0
  119. package/dist/lifecycle-events/index.js +15 -0
  120. package/dist/lifecycle-events/index.js.map +1 -0
  121. package/dist/lifecycle-events/lifecycle-event-publisher.d.ts +6 -0
  122. package/dist/lifecycle-events/lifecycle-event-publisher.js +8 -0
  123. package/dist/lifecycle-events/lifecycle-event-publisher.js.map +1 -0
  124. package/dist/lifecycle-events/lifecycle-event.schema.d.ts +339 -0
  125. package/dist/lifecycle-events/lifecycle-event.schema.js +39 -0
  126. package/dist/lifecycle-events/lifecycle-event.schema.js.map +1 -0
  127. package/dist/lifecycle-events/lifecycle-event.types.d.ts +4 -0
  128. package/dist/lifecycle-events/lifecycle-event.types.js +3 -0
  129. package/dist/lifecycle-events/lifecycle-event.types.js.map +1 -0
  130. package/dist/logging/console-logger.d.ts +2 -0
  131. package/dist/logging/console-logger.js +18 -0
  132. package/dist/logging/console-logger.js.map +1 -0
  133. package/dist/logging/index.d.ts +2 -0
  134. package/dist/logging/index.js +6 -0
  135. package/dist/logging/index.js.map +1 -0
  136. package/dist/logging/logger.types.d.ts +6 -0
  137. package/dist/logging/logger.types.js +3 -0
  138. package/dist/logging/logger.types.js.map +1 -0
  139. package/dist/queue/in-memory-work-queue.d.ts +3 -0
  140. package/dist/queue/in-memory-work-queue.js +7 -2
  141. package/dist/queue/in-memory-work-queue.js.map +1 -1
  142. package/dist/runtime/create-engine-runtime.d.ts +20 -0
  143. package/dist/runtime/create-engine-runtime.js +38 -0
  144. package/dist/runtime/create-engine-runtime.js.map +1 -0
  145. package/dist/runtime/index.d.ts +2 -0
  146. package/dist/runtime/index.js +6 -0
  147. package/dist/runtime/index.js.map +1 -0
  148. package/dist/serve.js +25 -34
  149. package/dist/serve.js.map +1 -1
  150. package/dist/server/api.types.d.ts +25 -0
  151. package/dist/server/api.types.js +3 -0
  152. package/dist/server/api.types.js.map +1 -0
  153. package/dist/server/create-engine-server.d.ts +9 -7
  154. package/dist/server/create-engine-server.js +4 -8
  155. package/dist/server/create-engine-server.js.map +1 -1
  156. package/dist/server/error-response.d.ts +7 -0
  157. package/dist/server/error-response.js +12 -0
  158. package/dist/server/error-response.js.map +1 -0
  159. package/dist/server/index.d.ts +3 -0
  160. package/dist/server/index.js +3 -1
  161. package/dist/server/index.js.map +1 -1
  162. package/dist/server/routes/workflow-executions.d.ts +2 -2
  163. package/dist/server/routes/workflow-executions.handlers.d.ts +4 -0
  164. package/dist/server/routes/workflow-executions.handlers.js +68 -0
  165. package/dist/server/routes/workflow-executions.handlers.js.map +1 -0
  166. package/dist/server/routes/workflow-executions.js +16 -21
  167. package/dist/server/routes/workflow-executions.js.map +1 -1
  168. package/dist/testing/start-engine-server.d.ts +1 -1
  169. package/dist/testing/start-engine-server.js.map +1 -1
  170. package/package.json +10 -7
@@ -0,0 +1,8 @@
1
+ import { type JsonValue } from '../common';
2
+ import type { BatchStepConfig } from '../graph';
3
+ import type { StepSlots } from './execution.types';
4
+ export interface LoopReader {
5
+ readOriginalItems(): Promise<JsonValue>;
6
+ readArrivals(iteration: number): Promise<JsonValue[]>;
7
+ }
8
+ export declare function runBatchStep(config: BatchStepConfig, iteration: number, reader: LoopReader): Promise<StepSlots>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBatchStep = runBatchStep;
4
+ const common_1 = require("../common");
5
+ const loop_ledger_1 = require("./loop-ledger");
6
+ async function runBatchStep(config, iteration, reader) {
7
+ const originalItems = asList(await reader.readOriginalItems(), 'the batch node input');
8
+ const start = iteration * config.batchSize;
9
+ const slice = originalItems.slice(start, start + config.batchSize);
10
+ if (slice.length > 0)
11
+ return slot(loop_ledger_1.LOOP_SLOT, slice);
12
+ const arrivals = await reader.readArrivals(iteration);
13
+ const accumulated = arrivals.flatMap((arrival, index) => asList(arrival, `arrival ${index} of the batch node`));
14
+ if (accumulated.length === 0)
15
+ return [null, null];
16
+ return slot(loop_ledger_1.DONE_SLOT, accumulated);
17
+ }
18
+ function slot(filled, value) {
19
+ return filled === loop_ledger_1.DONE_SLOT ? [value, null] : [null, value];
20
+ }
21
+ function asList(value, displayName) {
22
+ if (value === null || value === undefined)
23
+ return [];
24
+ if (Array.isArray(value))
25
+ return value;
26
+ throw new common_1.UnexpectedError(`${displayName} holds ${typeof value}, and a batch node slices a list`);
27
+ }
28
+ //# sourceMappingURL=batch-step.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-step.js","sourceRoot":"","sources":["../../src/execution/batch-step.ts"],"names":[],"mappings":";;;AAAA,sCAA4D;AAG5D,+CAAqD;AAqB9C,KAAK,uBACX,MAAuB,EACvB,SAAiB,EACjB,MAAkB;IAElB,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,MAAM,CAAC,iBAAiB,EAAE,EAAE,sBAAsB,CAAC,CAAC;IACvF,MAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAC3C,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAEnE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC,uBAAS,EAAE,KAAK,CAAC,CAAC;IAEpD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CACvD,MAAM,CAAC,OAAO,EAAE,WAAW,KAAK,oBAAoB,CAAC,CACrD,CAAC;IAEF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAElD,OAAO,IAAI,CAAC,uBAAS,EAAE,WAAW,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,IAAI,CAAC,MAAc,EAAE,KAAkB;IAC/C,OAAO,MAAM,KAAK,uBAAS,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,MAAM,CAAC,KAAgB,EAAE,WAAmB;IACpD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,MAAM,IAAI,wBAAe,CAAC,GAAG,WAAW,UAAU,OAAO,KAAK,kCAAkC,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { WorkflowLoop } from '../graph';
2
+ export declare function countExpectedSettledSteps(loops: WorkflowLoop[], reachable: Set<string>, terminalIterations: Map<string, number>): number | undefined;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countExpectedSettledSteps = countExpectedSettledSteps;
4
+ function countExpectedSettledSteps(loops, reachable, terminalIterations) {
5
+ let expected = 0;
6
+ const members = new Set();
7
+ for (const loop of loops.filter((l) => reachable.has(l.batchNodeId))) {
8
+ const terminal = terminalIterations.get(loop.batchNodeId);
9
+ if (terminal === undefined)
10
+ return undefined;
11
+ expected += terminal + 1 + terminal * (loop.memberIds.size - 1);
12
+ for (const memberId of loop.memberIds)
13
+ members.add(memberId);
14
+ }
15
+ for (const nodeId of reachable) {
16
+ if (!members.has(nodeId))
17
+ expected += 1;
18
+ }
19
+ return expected;
20
+ }
21
+ //# sourceMappingURL=completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/execution/completion.ts"],"names":[],"mappings":";;;AAaA,mCACC,KAAqB,EACrB,SAAsB,EACtB,kBAAuC;IAEvC,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACtE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAI7C,QAAQ,IAAI,QAAQ,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAChE,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,MAAM,MAAM,IAAI,SAAS,EAAE,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,QAAQ,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ExecutionViewStore, ExecutionView, StepView } from './execution-view-store';
2
+ export declare class ExecutionQueryService {
3
+ private readonly viewStore;
4
+ constructor(viewStore: ExecutionViewStore);
5
+ getExecution(id: string): Promise<ExecutionView>;
6
+ getSteps(id: string): Promise<StepView[]>;
7
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecutionQueryService = void 0;
4
+ class ExecutionQueryService {
5
+ viewStore;
6
+ constructor(viewStore) {
7
+ this.viewStore = viewStore;
8
+ }
9
+ async getExecution(id) {
10
+ return await this.viewStore.loadExecutionView(id);
11
+ }
12
+ async getSteps(id) {
13
+ return await this.viewStore.loadStepViews(id);
14
+ }
15
+ }
16
+ exports.ExecutionQueryService = ExecutionQueryService;
17
+ //# sourceMappingURL=execution-query.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-query.service.js","sourceRoot":"","sources":["../../src/execution/execution-query.service.ts"],"names":[],"mappings":";;;AAOA;IAC8B,SAAS;IAAtC,YAA6B,SAA6B;yBAA7B,SAAS;IAAuB,CAAC;IAG9D,KAAK,CAAC,YAAY,CAAC,EAAU;QAC5B,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC;IAGD,KAAK,CAAC,QAAQ,CAAC,EAAU;QACxB,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;CACD"}
@@ -1,3 +1,4 @@
1
+ import type { LifecycleEventPublisher } from '../lifecycle-events';
1
2
  import type { ExecutionEnqueuedEvent, OrchestrationMessage, WorkQueue } from '../queue';
2
3
  import type { ExecutionStore } from './execution-store';
3
4
  import type { StepStore } from './step-store';
@@ -5,6 +6,7 @@ export declare class ExecutionStartHandler {
5
6
  private readonly executionStore;
6
7
  private readonly stepStore;
7
8
  private readonly orchestrationQueue;
8
- constructor(executionStore: ExecutionStore, stepStore: StepStore, orchestrationQueue: WorkQueue<OrchestrationMessage>);
9
+ private readonly lifecycleEventPublisher;
10
+ constructor(executionStore: ExecutionStore, stepStore: StepStore, orchestrationQueue: WorkQueue<OrchestrationMessage>, lifecycleEventPublisher: LifecycleEventPublisher);
9
11
  handle(event: ExecutionEnqueuedEvent): Promise<void>;
10
12
  }
@@ -3,20 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExecutionStartHandler = void 0;
4
4
  const common_1 = require("../common");
5
5
  const graph_1 = require("../graph");
6
+ const execution_types_1 = require("./execution.types");
6
7
  class ExecutionStartHandler {
7
8
  executionStore;
8
9
  stepStore;
9
10
  orchestrationQueue;
10
- constructor(executionStore, stepStore, orchestrationQueue) {
11
+ lifecycleEventPublisher;
12
+ constructor(executionStore, stepStore, orchestrationQueue, lifecycleEventPublisher) {
11
13
  this.executionStore = executionStore;
12
14
  this.stepStore = stepStore;
13
15
  this.orchestrationQueue = orchestrationQueue;
16
+ this.lifecycleEventPublisher = lifecycleEventPublisher;
14
17
  }
15
18
  async handle(event) {
16
19
  const claimed = await this.executionStore.transitionStatus(event.executionId, 'queued', 'running');
17
20
  if (!claimed)
18
21
  return;
19
22
  const execution = await this.executionStore.loadExecution(event.executionId);
23
+ this.lifecycleEventPublisher.publish({
24
+ type: 'execution:started',
25
+ executionId: execution.id,
26
+ workflowId: execution.workflowId,
27
+ mode: execution.mode,
28
+ at: new Date().toISOString(),
29
+ });
20
30
  const trigger = (0, graph_1.findTriggerNode)(execution.graph);
21
31
  if (!trigger) {
22
32
  throw new common_1.UnexpectedError(`Execution ${event.executionId} has no trigger node in its graph`);
@@ -24,8 +34,9 @@ class ExecutionStartHandler {
24
34
  const [triggerStep] = await this.stepStore.createSteps(event.executionId, [
25
35
  {
26
36
  nodeId: trigger.id,
37
+ iteration: 0,
27
38
  status: 'completed',
28
- outputs: [execution.triggerPayload ?? {}],
39
+ outputs: execution.triggerOutputs ?? execution_types_1.DEFAULT_TRIGGER_OUTPUTS,
29
40
  },
30
41
  ]);
31
42
  if (!triggerStep) {
@@ -1 +1 @@
1
- {"version":3,"file":"execution-start-handler.js","sourceRoot":"","sources":["../../src/execution/execution-start-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,oCAA2C;AAa3C;IAEmB,cAAc;IACd,SAAS;IACT,kBAAkB;IAHpC,YACkB,cAA8B,EAC9B,SAAoB,EACpB,kBAAmD;8BAFnD,cAAc;yBACd,SAAS;kCACT,kBAAkB;IACjC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,KAA6B;QAEzC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,gBAAgB,CACzD,KAAK,CAAC,WAAW,EACjB,QAAQ,EACR,SAAS,CACT,CAAC;QACF,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE7E,MAAM,OAAO,GAAG,IAAA,uBAAe,EAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,EAAE,CAAC;YAGd,MAAM,IAAI,wBAAe,CAAC,aAAa,KAAK,CAAC,WAAW,mCAAmC,CAAC,CAAC;QAC9F,CAAC;QAQD,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE;YACzE;gBACC,MAAM,EAAE,OAAO,CAAC,EAAE;gBAClB,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,CAAC,SAAS,CAAC,cAAc,IAAI,EAAE,CAAC;aACzC;SACD,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;YAClB,MAAM,IAAI,wBAAe,CACxB,8BAA8B,KAAK,CAAC,WAAW,oCAAoC,CACnF,CAAC;QACH,CAAC;QAGD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YACrC,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,WAAW,CAAC,EAAE;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
1
+ {"version":3,"file":"execution-start-handler.js","sourceRoot":"","sources":["../../src/execution/execution-start-handler.ts"],"names":[],"mappings":";;;AAAA,sCAA4C;AAC5C,oCAA2C;AAI3C,uDAA4D;AAW5D;IAEmB,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,uBAAuB;IAJzC,YACkB,cAA8B,EAC9B,SAAo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,CAAC;QAGD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;YACrC,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM,EAAE,WAAW,CAAC,EAAE;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
@@ -1,12 +1,12 @@
1
- import type { JsonObject } from '../common';
2
1
  import type { WorkflowGraph } from '../graph';
3
- import type { ExecutionMode, ExecutionStatus } from './execution.types';
2
+ import type { ExecutionMode, ExecutionStatus, TriggerOutputs } from './execution.types';
4
3
  export interface NewExecutionRecord {
4
+ id: string;
5
5
  workflowId: string;
6
6
  status: ExecutionStatus;
7
7
  mode: ExecutionMode;
8
8
  graph: WorkflowGraph;
9
- triggerPayload: JsonObject | null;
9
+ triggerOutputs: TriggerOutputs | null;
10
10
  }
11
11
  export interface ExecutionRecord {
12
12
  id: string;
@@ -14,16 +14,14 @@ export interface ExecutionRecord {
14
14
  status: ExecutionStatus;
15
15
  mode: ExecutionMode;
16
16
  graph: WorkflowGraph;
17
- triggerPayload: JsonObject | null;
17
+ triggerOutputs: TriggerOutputs | null;
18
18
  }
19
19
  export declare class ExecutionNotFoundError extends Error {
20
20
  readonly executionId: string;
21
21
  constructor(executionId: string);
22
22
  }
23
23
  export interface ExecutionStore {
24
- createExecution(record: NewExecutionRecord): Promise<{
25
- id: string;
26
- }>;
24
+ createExecution(record: NewExecutionRecord): Promise<void>;
27
25
  loadExecution(id: string): Promise<ExecutionRecord>;
28
26
  transitionStatus(id: string, from: ExecutionStatus, to: ExecutionStatus): Promise<boolean>;
29
27
  finishExecution(id: string, status: 'completed' | 'failed'): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"execution-store.js","sourceRoot":"","sources":["../../src/execution/execution-store.ts"],"names":[],"mappings":";;;AAwBA,4BAAoC,SAAQ,KAAK;IAC3B,WAAW;IAAhC,YAAqB,WAAmB;QACvC,KAAK,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;2BADzB,WAAW;QAE/B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACtC,CAAC;CACD"}
1
+ {"version":3,"file":"execution-store.js","sourceRoot":"","sources":["../../src/execution/execution-store.ts"],"names":[],"mappings":";;;AA6BA,4BAAoC,SAAQ,KAAK;IAC3B,WAAW;IAAhC,YAAqB,WAAmB;QACvC,KAAK,CAAC,wBAAwB,WAAW,EAAE,CAAC,CAAC;2BADzB,WAAW;QAE/B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACtC,CAAC;CACD"}
@@ -0,0 +1,26 @@
1
+ import type { WorkflowGraph } from '../graph';
2
+ import type { ExecutionMode, ExecutionStatus, StepError, StepSlots, StepStatus } from './execution.types';
3
+ export interface ExecutionView {
4
+ id: string;
5
+ workflowId: string;
6
+ status: ExecutionStatus;
7
+ mode: ExecutionMode;
8
+ graph: WorkflowGraph;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ finishedAt: Date | null;
12
+ }
13
+ export interface StepView {
14
+ id: string;
15
+ nodeId: string;
16
+ iteration: number;
17
+ status: StepStatus;
18
+ outputs: StepSlots | null;
19
+ error: StepError | null;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ }
23
+ export interface ExecutionViewStore {
24
+ loadExecutionView(id: string): Promise<ExecutionView>;
25
+ loadStepViews(executionId: string): Promise<StepView[]>;
26
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=execution-view-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-view-store.js","sourceRoot":"","sources":["../../src/execution/execution-view-store.ts"],"names":[],"mappings":""}
@@ -5,3 +5,17 @@ export type StepStatus = 'queued' | 'running' | 'completed' | 'failed' | 'skippe
5
5
  export declare const SETTLED_STEP_STATUSES: readonly StepStatus[];
6
6
  export declare function isSettledStatus(status: StepStatus): boolean;
7
7
  export type StepSlots = JsonValue[];
8
+ export type TriggerOutputs = StepSlots;
9
+ export declare const DEFAULT_TRIGGER_OUTPUTS: TriggerOutputs;
10
+ export interface StepError {
11
+ name: string;
12
+ message: string;
13
+ stack?: string;
14
+ details?: JsonValue;
15
+ }
16
+ export interface StepKey {
17
+ nodeId: string;
18
+ iteration: number;
19
+ }
20
+ export type StepKeyId = string;
21
+ export declare function stepKeyId({ nodeId, iteration }: StepKey): StepKeyId;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SETTLED_STEP_STATUSES = void 0;
3
+ exports.DEFAULT_TRIGGER_OUTPUTS = exports.SETTLED_STEP_STATUSES = void 0;
4
4
  exports.isSettledStatus = isSettledStatus;
5
+ exports.stepKeyId = stepKeyId;
5
6
  exports.SETTLED_STEP_STATUSES = [
6
7
  'completed',
7
8
  'failed',
@@ -11,4 +12,8 @@ exports.SETTLED_STEP_STATUSES = [
11
12
  function isSettledStatus(status) {
12
13
  return exports.SETTLED_STEP_STATUSES.includes(status);
13
14
  }
15
+ exports.DEFAULT_TRIGGER_OUTPUTS = [];
16
+ function stepKeyId({ nodeId, iteration }) {
17
+ return `${nodeId}@${iteration}`;
18
+ }
14
19
  //# sourceMappingURL=execution.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution.types.js","sourceRoot":"","sources":["../../src/execution/execution.types.ts"],"names":[],"mappings":";;;;AAoBa,QAAA,qBAAqB,GAA0B;IAC3D,WAAW;IACX,QAAQ;IACR,SAAS;IACT,WAAW;CACX,CAAC;AAEF,yBAAgC,MAAkB;IACjD,OAAO,QAAA,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"file":"execution.types.js","sourceRoot":"","sources":["../../src/execution/execution.types.ts"],"names":[],"mappings":";;;;;AAoBa,QAAA,qBAAqB,GAA0B;IAC3D,WAAW;IACX,QAAQ;IACR,SAAS;IACT,WAAW;CACX,CAAC;AAEF,yBAAgC,MAAkB;IACjD,OAAO,QAAA,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC;AAuBY,QAAA,uBAAuB,GAAmB,EAAE,CAAC;AA0B1D,mBAA0B,EAAE,MAAM,EAAE,SAAS,EAAW;IACvD,OAAO,GAAG,MAAM,IAAI,SAAS,EAAE,CAAC;AACjC,CAAC"}
@@ -1,11 +1,14 @@
1
1
  export { StartExecutionService } from './start-execution.service';
2
2
  export type { StartExecutionRequest, StartExecutionResult, } from './start-execution.service';
3
- export type { ExecutionMode, ExecutionStatus, StepSlots, StepStatus } from './execution.types';
3
+ export { stepKeyId } from './execution.types';
4
+ export type { ExecutionMode, ExecutionStatus, StepError, StepKey, StepKeyId, StepSlots, StepStatus, TriggerOutputs, } from './execution.types';
4
5
  export { ExecutionNotFoundError } from './execution-store';
5
6
  export type { ExecutionRecord, ExecutionStore, NewExecutionRecord } from './execution-store';
7
+ export type { ExecutionViewStore, ExecutionView, StepView } from './execution-view-store';
6
8
  export { StepNotFoundError } from './step-store';
7
- export type { NewStepRecord, StepError, StepRecord, StepStore } from './step-store';
9
+ export type { NewStepRecord, StepRecord, StepStore, StepSummary } from './step-store';
8
10
  export { ExecutionStartHandler } from './execution-start-handler';
11
+ export { ExecutionQueryService } from './execution-query.service';
9
12
  export { OrchestrationWorker } from './orchestration-worker';
10
13
  export { StepSettledHandler } from './step-settled-handler';
11
14
  export { StepReadyHandler } from './step-ready-handler';
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StepWorker = exports.StepReadyHandler = exports.StepSettledHandler = exports.OrchestrationWorker = exports.ExecutionStartHandler = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.StartExecutionService = void 0;
3
+ exports.StepWorker = exports.StepReadyHandler = exports.StepSettledHandler = exports.OrchestrationWorker = exports.ExecutionQueryService = exports.ExecutionStartHandler = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.stepKeyId = exports.StartExecutionService = void 0;
4
4
  var start_execution_service_1 = require("./start-execution.service");
5
5
  Object.defineProperty(exports, "StartExecutionService", { enumerable: true, get: function () { return start_execution_service_1.StartExecutionService; } });
6
+ var execution_types_1 = require("./execution.types");
7
+ Object.defineProperty(exports, "stepKeyId", { enumerable: true, get: function () { return execution_types_1.stepKeyId; } });
6
8
  var execution_store_1 = require("./execution-store");
7
9
  Object.defineProperty(exports, "ExecutionNotFoundError", { enumerable: true, get: function () { return execution_store_1.ExecutionNotFoundError; } });
8
10
  var step_store_1 = require("./step-store");
9
11
  Object.defineProperty(exports, "StepNotFoundError", { enumerable: true, get: function () { return step_store_1.StepNotFoundError; } });
10
12
  var execution_start_handler_1 = require("./execution-start-handler");
11
13
  Object.defineProperty(exports, "ExecutionStartHandler", { enumerable: true, get: function () { return execution_start_handler_1.ExecutionStartHandler; } });
14
+ var execution_query_service_1 = require("./execution-query.service");
15
+ Object.defineProperty(exports, "ExecutionQueryService", { enumerable: true, get: function () { return execution_query_service_1.ExecutionQueryService; } });
12
16
  var orchestration_worker_1 = require("./orchestration-worker");
13
17
  Object.defineProperty(exports, "OrchestrationWorker", { enumerable: true, get: function () { return orchestration_worker_1.OrchestrationWorker; } });
14
18
  var step_settled_handler_1 = require("./step-settled-handler");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAM9B,qDAA2D;AAAlD,yHAAA,sBAAsB,OAAA;AAE/B,2CAAiD;AAAxC,+GAAA,iBAAiB,OAAA;AAE1B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/execution/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAK9B,qDAA8C;AAArC,4GAAA,SAAS,OAAA;AAWlB,qDAA2D;AAAlD,yHAAA,sBAAsB,OAAA;AAG/B,2CAAiD;AAAxC,+GAAA,iBAAiB,OAAA;AAE1B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,14 @@
1
+ import type { GraphEdge, WorkflowLoop } from '../graph';
2
+ import type { StepKey } from './execution.types';
3
+ export type EdgeClass = 'plain' | 'entry' | 'intra' | 'back' | 'exit';
4
+ export type SourceRow = {
5
+ kind: 'row';
6
+ key: StepKey;
7
+ } | {
8
+ kind: 'none';
9
+ } | {
10
+ kind: 'pending';
11
+ };
12
+ export declare function classifyEdge(edge: GraphEdge, loops: WorkflowLoop[]): EdgeClass;
13
+ export declare function targetKey(edge: GraphEdge, edgeClass: EdgeClass, source: StepKey): StepKey;
14
+ export declare function sourceRow(edge: GraphEdge, edgeClass: EdgeClass, target: StepKey, terminalIteration?: number): SourceRow;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.classifyEdge = classifyEdge;
4
+ exports.targetKey = targetKey;
5
+ exports.sourceRow = sourceRow;
6
+ function classifyEdge(edge, loops) {
7
+ if (edge.isBackEdge)
8
+ return 'back';
9
+ const sourceLoop = loops.find((loop) => loop.memberIds.has(edge.from));
10
+ const targetLoop = loops.find((loop) => loop.memberIds.has(edge.to));
11
+ if (sourceLoop && sourceLoop === targetLoop)
12
+ return 'intra';
13
+ if (sourceLoop)
14
+ return 'exit';
15
+ if (targetLoop)
16
+ return 'entry';
17
+ return 'plain';
18
+ }
19
+ function targetKey(edge, edgeClass, source) {
20
+ switch (edgeClass) {
21
+ case 'back':
22
+ return { nodeId: edge.to, iteration: source.iteration + 1 };
23
+ case 'exit':
24
+ case 'entry':
25
+ return { nodeId: edge.to, iteration: 0 };
26
+ default:
27
+ return { nodeId: edge.to, iteration: source.iteration };
28
+ }
29
+ }
30
+ function sourceRow(edge, edgeClass, target, terminalIteration) {
31
+ const row = (iteration) => ({
32
+ kind: 'row',
33
+ key: { nodeId: edge.from, iteration },
34
+ });
35
+ switch (edgeClass) {
36
+ case 'back':
37
+ return target.iteration === 0 ? { kind: 'none' } : row(target.iteration - 1);
38
+ case 'entry':
39
+ return target.iteration > 0 ? { kind: 'none' } : row(0);
40
+ case 'exit':
41
+ if (target.iteration > 0)
42
+ return { kind: 'none' };
43
+ return terminalIteration === undefined ? { kind: 'pending' } : row(terminalIteration);
44
+ default:
45
+ return row(target.iteration);
46
+ }
47
+ }
48
+ //# sourceMappingURL=iteration-mapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iteration-mapping.js","sourceRoot":"","sources":["../../src/execution/iteration-mapping.ts"],"names":[],"mappings":";;;;;AAkCA,sBAA6B,IAAe,EAAE,KAAqB;IAClE,IAAI,IAAI,CAAC,UAAU;QAAE,OAAO,MAAM,CAAC;IAEnC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAErE,IAAI,UAAU,IAAI,UAAU,KAA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V,IAAI,MAAM,CAAC,SAAS,GAAG,CAAC;gBAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAClD,OAAO,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACvF;YACC,OAAO,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { WorkflowGraph, WorkflowLoop } from '../graph';
2
+ import type { StepStore, StepSummary } from './step-store';
3
+ export declare const DONE_SLOT = 0;
4
+ export declare const LOOP_SLOT = 1;
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,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOOP_SLOT = exports.DONE_SLOT = void 0;
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
+ exports.DONE_SLOT = 0;
10
+ exports.LOOP_SLOT = 1;
11
+ function endsLoop(status, loopSlotFilled) {
12
+ return (0, execution_types_1.isSettledStatus)(status) && !loopSlotFilled;
13
+ }
14
+ function isTerminalStep(step) {
15
+ return endsLoop(step.status, Boolean(step.filledOutputSlots[exports.LOOP_SLOT]));
16
+ }
17
+ function exitSourcesInto(graph, loops, targetNodeIds) {
18
+ if (loops.length === 0)
19
+ return [];
20
+ const targets = new Set(targetNodeIds);
21
+ const sources = new Set();
22
+ for (const edge of graph.edges) {
23
+ if (targets.has(edge.to) && (0, iteration_mapping_1.classifyEdge)(edge, loops) === 'exit')
24
+ sources.add(edge.from);
25
+ }
26
+ return [...sources];
27
+ }
28
+ async function loadTerminalIterations(stepStore, executionId, batchNodeIds) {
29
+ if (batchNodeIds.length === 0)
30
+ return new Map();
31
+ const latest = await stepStore.loadLatestStepSummaries(executionId, batchNodeIds);
32
+ const terminalIterations = new Map();
33
+ for (const [batchNodeId, step] of Object.entries(latest)) {
34
+ if (isTerminalStep(step))
35
+ terminalIterations.set(batchNodeId, step.iteration);
36
+ }
37
+ return terminalIterations;
38
+ }
39
+ //# 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;AAItC,QAAA,SAAS,GAAG,CAAC,CAAC;AACd,QAAA,SAAS,GAAG,CAAC,CAAC;AAU3B,SAAS,QAAQ,CAAC,MAAkB,EAAE,cAAuB;IAC5D,OAAO,IAAA,iCAAe,EAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC;AACnD,CAAC;AAED,wBAA+B,IAAiB;IAC/C,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAA,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAQD,yBACC,KAAoB,EACpB,KAAqB,EACrB,aAAuB;IAEvB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAA,gCAAY,EAAC,IAAI,EAAE,KAAK,CAAC,KAAK,MAAM;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACrB,CAAC;AAUM,KAAK,iCACX,SAAoB,EACpB,WAAmB,EACnB,YAAsB;IAEtB,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,GAAG,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAElF,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrD,KAAK,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,IAAI,cAAc,CAAC,IAAI,CAAC;YAAE,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
@@ -1,7 +1,9 @@
1
- import { type WorkflowGraph } from '../graph';
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: string[];
5
- toSkip: string[];
5
+ toQueue: StepKey[];
6
+ toSkip: StepKey[];
6
7
  }
7
- export declare function decideSuccessors(graph: WorkflowGraph, settledNodeId: string, steps: Record<string, StepSummary>): SuccessorDecisions;
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
- const graph_1 = require("../graph");
4
+ exports.decisionKeys = decisionKeys;
5
5
  const execution_types_1 = require("./execution.types");
6
- function decideSuccessors(graph, settledNodeId, steps) {
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
- for (const successor of (0, graph_1.getSuccessorNodeIds)(graph, settledNodeId)) {
9
- if (steps[successor])
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 fate = decideNodeFate(graph, successor, steps);
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(successor);
26
+ decisions.toQueue.push(target);
14
27
  else if (fate === 'skipped')
15
- decisions.toSkip.push(successor);
28
+ decisions.toSkip.push(target);
16
29
  }
17
30
  return decisions;
18
31
  }
19
- function decideNodeFate(graph, nodeId, steps) {
20
- const incoming = graph.edges.filter((edge) => edge.to === nodeId && !edge.isBackEdge);
21
- const predecessors = [...new Set(incoming.map((edge) => edge.from))];
22
- const settled = predecessors.every((id) => steps[id] !== undefined && (0, execution_types_1.isSettledStatus)(steps[id].status));
23
- if (!settled)
24
- return 'undecidable';
25
- return incoming.some((edge) => isLiveEdge(edge, steps)) ? 'queued' : 'skipped';
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 isLiveEdge(edge, steps) {
28
- const source = steps[edge.from];
29
- return source?.status === 'completed' && Boolean(source.filledOutputSlots[edge.outputIndex]);
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":";;;AAAA,oCAAmF;AACnF,uDAAoD;AAwCpD,0BACC,KAAoB,EACpB,aAAqB,EACrB,KAAkC;IAElC,MAAM,SAAS,GAAuB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAClE,KAAK,MAAM,SAAS,IAAI,IAAA,2BAAmB,EAAC,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC;QAEnE,IAAI,KAAK,CAAC,SAAS,CAAC;YAAE,SAAS;QAC/B,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,IAAI,KAAK,QAAQ;YAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACpD,IAAI,IAAI,KAAK,SAAS;YAAE,SAAS,CAAC,MAAM,CAAC,IAAI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