@n8n/engine 0.21.2 → 0.23.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 (98) hide show
  1. package/README.md +1 -1
  2. package/dist/build.tsbuildinfo +1 -1
  3. package/dist/database/entities/workflow-execution.entity.d.ts +2 -0
  4. package/dist/database/entities/workflow-execution.entity.js +6 -1
  5. package/dist/database/entities/workflow-execution.entity.js.map +1 -1
  6. package/dist/database/entities/workflow-step-execution.entity.d.ts +4 -1
  7. package/dist/database/entities/workflow-step-execution.entity.js +20 -1
  8. package/dist/database/entities/workflow-step-execution.entity.js.map +1 -1
  9. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js +6 -2
  10. package/dist/database/migrations/1778529600000-CreateWorkflowExecution.js.map +1 -1
  11. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js +30 -1
  12. package/dist/database/migrations/1784890100000-CreateWorkflowStepExecution.js.map +1 -1
  13. package/dist/database/typeorm-execution-store.d.ts +9 -3
  14. package/dist/database/typeorm-execution-store.js +36 -2
  15. package/dist/database/typeorm-execution-store.js.map +1 -1
  16. package/dist/database/typeorm-execution-view-store.js +6 -2
  17. package/dist/database/typeorm-execution-view-store.js.map +1 -1
  18. package/dist/database/typeorm-step-store.d.ts +8 -3
  19. package/dist/database/typeorm-step-store.js +45 -3
  20. package/dist/database/typeorm-step-store.js.map +1 -1
  21. package/dist/dependencies/external-dependencies.d.ts +16 -3
  22. package/dist/dependencies/index.d.ts +1 -1
  23. package/dist/execution/cancel-execution.service.d.ts +17 -0
  24. package/dist/execution/cancel-execution.service.js +40 -0
  25. package/dist/execution/cancel-execution.service.js.map +1 -0
  26. package/dist/execution/execution-file-cleanup.d.ts +8 -0
  27. package/dist/execution/execution-file-cleanup.js +30 -0
  28. package/dist/execution/execution-file-cleanup.js.map +1 -0
  29. package/dist/execution/execution-start-handler.js +1 -0
  30. package/dist/execution/execution-start-handler.js.map +1 -1
  31. package/dist/execution/execution-store.d.ts +12 -2
  32. package/dist/execution/execution-store.js.map +1 -1
  33. package/dist/execution/execution-view-store.d.ts +3 -1
  34. package/dist/execution/execution.types.d.ts +21 -3
  35. package/dist/execution/execution.types.js +11 -1
  36. package/dist/execution/execution.types.js.map +1 -1
  37. package/dist/execution/index.d.ts +6 -2
  38. package/dist/execution/index.js +9 -1
  39. package/dist/execution/index.js.map +1 -1
  40. package/dist/execution/start-execution.service.d.ts +2 -0
  41. package/dist/execution/start-execution.service.js +1 -0
  42. package/dist/execution/start-execution.service.js.map +1 -1
  43. package/dist/execution/step-ready-handler.d.ts +4 -1
  44. package/dist/execution/step-ready-handler.js +68 -17
  45. package/dist/execution/step-ready-handler.js.map +1 -1
  46. package/dist/execution/step-settled-handler.d.ts +3 -3
  47. package/dist/execution/step-settled-handler.js +15 -12
  48. package/dist/execution/step-settled-handler.js.map +1 -1
  49. package/dist/execution/step-store.d.ts +13 -2
  50. package/dist/execution/step-store.js.map +1 -1
  51. package/dist/execution/wait-sweeper.d.ts +23 -0
  52. package/dist/execution/wait-sweeper.js +91 -0
  53. package/dist/execution/wait-sweeper.js.map +1 -0
  54. package/dist/index.d.ts +5 -5
  55. package/dist/index.js +6 -4
  56. package/dist/index.js.map +1 -1
  57. package/dist/lifecycle-events/lifecycle-event.schema.d.ts +48 -0
  58. package/dist/lifecycle-events/lifecycle-event.schema.js +2 -0
  59. package/dist/lifecycle-events/lifecycle-event.schema.js.map +1 -1
  60. package/dist/response-channel/create-response-emitter.d.ts +6 -0
  61. package/dist/response-channel/create-response-emitter.js +22 -0
  62. package/dist/response-channel/create-response-emitter.js.map +1 -0
  63. package/dist/response-channel/execution-response-sender.d.ts +7 -0
  64. package/dist/response-channel/execution-response-sender.js +9 -0
  65. package/dist/response-channel/execution-response-sender.js.map +1 -0
  66. package/dist/response-channel/execution-response.schema.d.ts +127 -8
  67. package/dist/response-channel/execution-response.schema.js +44 -6
  68. package/dist/response-channel/execution-response.schema.js.map +1 -1
  69. package/dist/response-channel/execution-response.types.d.ts +19 -1
  70. package/dist/response-channel/execution-response.types.js +6 -0
  71. package/dist/response-channel/execution-response.types.js.map +1 -1
  72. package/dist/response-channel/index.d.ts +6 -6
  73. package/dist/response-channel/index.js +9 -7
  74. package/dist/response-channel/index.js.map +1 -1
  75. package/dist/runtime/create-engine-runtime.d.ts +4 -3
  76. package/dist/runtime/create-engine-runtime.js +7 -3
  77. package/dist/runtime/create-engine-runtime.js.map +1 -1
  78. package/dist/serve.js +1 -1
  79. package/dist/serve.js.map +1 -1
  80. package/dist/server/api.types.d.ts +6 -0
  81. package/dist/server/create-engine-server.d.ts +2 -1
  82. package/dist/server/create-engine-server.js.map +1 -1
  83. package/dist/server/index.d.ts +1 -1
  84. package/dist/server/routes/workflow-executions.handlers.d.ts +2 -1
  85. package/dist/server/routes/workflow-executions.handlers.js +43 -2
  86. package/dist/server/routes/workflow-executions.handlers.js.map +1 -1
  87. package/dist/server/routes/workflow-executions.js +4 -1
  88. package/dist/server/routes/workflow-executions.js.map +1 -1
  89. package/package.json +13 -8
  90. package/dist/response-channel/execution-response-channel.d.ts +0 -12
  91. package/dist/response-channel/execution-response-channel.js +0 -53
  92. package/dist/response-channel/execution-response-channel.js.map +0 -1
  93. package/dist/response-channel/in-memory-transport.d.ts +0 -7
  94. package/dist/response-channel/in-memory-transport.js +0 -19
  95. package/dist/response-channel/in-memory-transport.js.map +0 -1
  96. package/dist/response-channel/response-transport.d.ts +0 -7
  97. package/dist/response-channel/response-transport.js +0 -9
  98. package/dist/response-channel/response-transport.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { StepError, StepKey, StepKeyId, StepSlots, StepStatus } from './execution.types';
1
+ import type { StepError, StepKey, StepKeyId, ResumeCause, StepSlots, StepStatus, WaitDeclaration } from './execution.types';
2
2
  export type NewStepRecord = {
3
3
  nodeId: string;
4
4
  iteration: number;
@@ -16,6 +16,8 @@ export interface StepRecord {
16
16
  iteration: number;
17
17
  status: StepStatus;
18
18
  outputs: StepSlots | null;
19
+ waitDeclaration: WaitDeclaration | null;
20
+ resumeCause: ResumeCause | null;
19
21
  error?: StepError | null;
20
22
  }
21
23
  export interface StepSummary {
@@ -29,6 +31,10 @@ export declare class StepNotFoundError extends Error {
29
31
  readonly stepId: string;
30
32
  constructor(stepId: string);
31
33
  }
34
+ export interface DueStep {
35
+ id: string;
36
+ executionId: string;
37
+ }
32
38
  export interface StepStore {
33
39
  createSteps(executionId: string, records: NewStepRecord[]): Promise<Array<{
34
40
  id: string;
@@ -36,8 +42,13 @@ export interface StepStore {
36
42
  loadStep(id: string): Promise<StepRecord>;
37
43
  claimStep(id: string): Promise<StepRecord | null>;
38
44
  completeStep(id: string, outputs: StepSlots): Promise<boolean>;
45
+ suspendStep(id: string, waitDeclaration: WaitDeclaration): Promise<boolean>;
46
+ resumeStep(id: string, resumeCause: ResumeCause): Promise<boolean>;
47
+ resumeDueSteps(due: Date, limit: number): Promise<DueStep[]>;
48
+ nextWaitDeadline(): Promise<Date | null>;
39
49
  failStep(id: string, error: StepError): Promise<boolean>;
40
- cancelQueuedSteps(executionId: string): Promise<void>;
50
+ cancelStep(id: string): Promise<boolean>;
51
+ cancelPendingSteps(executionId: string): Promise<void>;
41
52
  loadStepsByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepRecord>>;
42
53
  loadStepSummariesByKeys(executionId: string, keys: StepKey[]): Promise<Record<StepKeyId, StepSummary>>;
43
54
  loadLatestStepSummaries(executionId: string, nodeIds: string[]): Promise<Record<string, StepSummary>>;
@@ -1 +1 @@
1
- {"version":3,"file":"step-store.js","sourceRoot":"","sources":["../../src/execution/step-store.ts"],"names":[],"mappings":";;;AAgDA,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"}
1
+ {"version":3,"file":"step-store.js","sourceRoot":"","sources":["../../src/execution/step-store.ts"],"names":[],"mappings":";;;AA6DA,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,23 @@
1
+ import type { EngineLogger } from '../logging';
2
+ import type { StepMessage, WorkQueue } from '../queue';
3
+ import type { StepStore } from './step-store';
4
+ export declare const DEFAULT_WAIT_SWEEP_INTERVAL_MS = 60000;
5
+ export declare const DEFAULT_WAIT_SWEEP_BATCH_SIZE = 500;
6
+ export declare class WaitSweeper {
7
+ private readonly stepStore;
8
+ private readonly stepQueue;
9
+ private readonly logger;
10
+ private readonly intervalMs;
11
+ private readonly batchSize;
12
+ private timer;
13
+ private stopped;
14
+ private sweeping;
15
+ private arming;
16
+ constructor(stepStore: StepStore, stepQueue: WorkQueue<StepMessage>, logger?: EngineLogger, intervalMs?: number, batchSize?: number);
17
+ start(): void;
18
+ stop(): Promise<void>;
19
+ noteSuspended(): void;
20
+ private rearm;
21
+ private arm;
22
+ private sweep;
23
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WaitSweeper = exports.DEFAULT_WAIT_SWEEP_BATCH_SIZE = exports.DEFAULT_WAIT_SWEEP_INTERVAL_MS = void 0;
4
+ const logging_1 = require("../logging");
5
+ exports.DEFAULT_WAIT_SWEEP_INTERVAL_MS = 60_000;
6
+ exports.DEFAULT_WAIT_SWEEP_BATCH_SIZE = 500;
7
+ class WaitSweeper {
8
+ stepStore;
9
+ stepQueue;
10
+ logger;
11
+ intervalMs;
12
+ batchSize;
13
+ timer;
14
+ stopped = false;
15
+ sweeping;
16
+ arming;
17
+ constructor(stepStore, stepQueue, logger = (0, logging_1.createConsoleLogger)(), intervalMs = exports.DEFAULT_WAIT_SWEEP_INTERVAL_MS, batchSize = exports.DEFAULT_WAIT_SWEEP_BATCH_SIZE) {
18
+ this.stepStore = stepStore;
19
+ this.stepQueue = stepQueue;
20
+ this.logger = logger;
21
+ this.intervalMs = intervalMs;
22
+ this.batchSize = batchSize;
23
+ }
24
+ start() {
25
+ this.rearm();
26
+ }
27
+ async stop() {
28
+ this.stopped = true;
29
+ clearTimeout(this.timer);
30
+ this.timer = undefined;
31
+ await this.arming;
32
+ await this.sweeping;
33
+ }
34
+ noteSuspended() {
35
+ if (this.stopped)
36
+ return;
37
+ clearTimeout(this.timer);
38
+ this.timer = undefined;
39
+ this.rearm();
40
+ }
41
+ rearm() {
42
+ this.arming = (this.arming ?? Promise.resolve()).then(async () => await this.arm());
43
+ }
44
+ async arm() {
45
+ if (this.stopped)
46
+ return;
47
+ let delayMs = this.intervalMs;
48
+ try {
49
+ const next = await this.stepStore.nextWaitDeadline();
50
+ if (next !== null)
51
+ delayMs = Math.min(delayMs, next.getTime() - Date.now());
52
+ }
53
+ catch (error) {
54
+ this.logger.error('engine: wait sweep failed to read the next deadline', { error });
55
+ }
56
+ if (this.stopped)
57
+ return;
58
+ clearTimeout(this.timer);
59
+ this.timer = setTimeout(() => {
60
+ this.sweeping = this.sweep().finally(() => {
61
+ this.sweeping = undefined;
62
+ this.rearm();
63
+ });
64
+ }, Math.max(delayMs, 0));
65
+ this.timer.unref();
66
+ }
67
+ async sweep() {
68
+ let due;
69
+ try {
70
+ due = await this.stepStore.resumeDueSteps(new Date(), this.batchSize);
71
+ }
72
+ catch (error) {
73
+ this.logger.error('engine: wait sweep failed to resume due waits', { error });
74
+ return;
75
+ }
76
+ for (const { id: stepId, executionId } of due) {
77
+ try {
78
+ await this.stepQueue.publish({ type: 'step:ready', executionId, stepId });
79
+ }
80
+ catch (error) {
81
+ this.logger.error('engine: wait sweep failed to announce a resumed step', {
82
+ error,
83
+ executionId,
84
+ stepId,
85
+ });
86
+ }
87
+ }
88
+ }
89
+ }
90
+ exports.WaitSweeper = WaitSweeper;
91
+ //# sourceMappingURL=wait-sweeper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-sweeper.js","sourceRoot":"","sources":["../../src/execution/wait-sweeper.ts"],"names":[],"mappings":";;;AACA,wCAAiD;AAKpC,QAAA,8BAA8B,GAAG,MAAM,CAAC;AAGxC,QAAA,6BAA6B,GAAG,GAAG,CAAC;AAajD;IAUmB,SAAS;IACT,SAAS;IACT,MAAM;IACN,UAAU;IACV,SAAS;IAbnB,KAAK,CAA6B;IAClC,OAAO,GAAG,KAAK,CAAC;IAEhB,QAAQ,CAA4B;IAGpC,MAAM,CAA4B;IAE1C,YACkB,SAAoB,EACpB,SAAiC,EACjC,MAAM,GAAiB,IAAA,6BAAmB,GAAE,EAC5C,UAAU,GAAW,QAAA,8BAA8B,EACnD,SAAS,GAAW,QAAA,6BAA6B;yBAJjD,SAAS;yBACT,SAAS;sBACT,MAAM;0BACN,UAAU;yBACV,SAAS;IACxB,CAAC;IAEJ,KAAK;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAED,KAAK,CAAC,IAAI;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QAIvB,MAAM,IAAI,CAAC,MAAM,CAAC;QAClB,MAAM,IAAI,CAAC,QAAQ,CAAC;IACrB,CAAC;IAQD,aAAa;QACZ,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAGO,KAAK;QACZ,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI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AAC,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+CAA+C,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YAC9E,OAAO;QACR,CAAC;QAED,KAAK,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,CAAC;YAC/C,IAAI,CAAC;gBACJ,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAGhB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,EAAE;oBACzE,KAAK;oBACL,WAAW;oBACX,MAAM;iBACN,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;IACF,CAAC;CACD"}
package/dist/index.d.ts CHANGED
@@ -3,21 +3,21 @@ export type { EngineRuntime, EngineRuntimeOptions } from './runtime';
3
3
  export type { EngineLogger } from './logging';
4
4
  export { ACTION_TOKEN, IDENTITY_TOKEN, InvalidActionTokenError, InvalidIdentityTokenError, mintActionToken, mintIdentityToken, SharedSecretIdentityVerifier, verifyActionToken, } from './auth';
5
5
  export type { AuthenticatedCaller, ActionScope, IdentityVerifier } from './auth';
6
- export type { EngineErrorResponse, ExecutionSnapshot, StepDetail } from './server';
6
+ export type { CancelExecutionResponse, EngineErrorResponse, ExecutionSnapshot, StepDetail, } from './server';
7
7
  export type { SearchExecutionsRequest, SearchExecutionsResponse, ExecutionListItem, } from './server';
8
8
  export { MAX_LIFECYCLE_EVENTS_PER_BATCH, lifecycleEventBatchSchema, lifecycleEventSchema, } from './lifecycle-events';
9
9
  export type { LifecycleEventCallback, LifecycleEvent, LifecycleEventBatch, } from './lifecycle-events';
10
- export { ExecutionResponseChannel, executionResponseSchema, InMemoryResponseTransport, noopResponseTransport, } from './response-channel';
11
- export type { EndedMessage, ExecutionResponse, ResponseTransport, Unsubscribe, } from './response-channel';
10
+ export { createResponseEmitter, executionResponseSchema, noopExecutionResponseSender, noopResponseEmitter, RESPONSE_EXPECTATION_KINDS, responseExpectationSchema, } from './response-channel';
11
+ export type { ChunkMessage, EndedMessage, ExecutionResponse, ExecutionResponseSender, ResponseEmitter, ResponseExpectation, ResponseExpectationKind, ResponseMessage, UndeliverableMessage, } from './response-channel';
12
12
  export { UnimplementedError } from './common';
13
13
  export type { JsonObject, JsonValue } from './common';
14
14
  export { deriveLoops, isBatchStepConfig } from './graph';
15
15
  export type { BatchStepConfig, GraphEdge, GraphNode, StepConfig, StepType, WorkflowGraph, WorkflowLoop, } from './graph';
16
- export type { ExternalDependencies, IStepExecutor, StepExecutionContext, StepExecutionRequest, StepExecutionResult, } from './dependencies';
16
+ export type { ExecutionFilesDeleter, ExecutionLocation, ExternalDependencies, IStepExecutor, StepExecutionContext, StepExecutionRequest, StepExecutionResult, } from './dependencies';
17
17
  export { AllowAllAdmittance, AdmittanceRejectedError } from './admittance';
18
18
  export type { AdmittanceDecision, AdmittanceRequest, AdmittanceService, } from './admittance';
19
19
  export type { ExecutionEnqueuedEvent, OrchestrationMessage, StepSettledEvent, StepMessage, StepReadyEvent, WorkQueue, } from './queue';
20
20
  export { ExecutionNotFoundError, StepNotFoundError } from './execution';
21
- export type { CallerContext, ExecutionMode, ExecutionViewStore, ExecutionRecord, ExecutionStatus, ExecutionStore, ExecutionView, NewExecutionRecord, NewStepRecord, StartExecutionRequest, StartExecutionResult, StepError, StepKey, StepKeyId, StepRecord, StepSlots, StepStatus, StepStore, StepView, TriggerOutputs, WorkflowDocument, } from './execution';
21
+ export type { CallerContext, ExecutionMode, ExecutionViewStore, ExecutionRecord, ExecutionStatus, DueStep, ExecutionStore, ExecutionView, NewExecutionRecord, NewStepRecord, StartExecutionRequest, StartExecutionResult, StepError, StepKey, StepKeyId, StepRecord, ResumeCause, StepSlots, StepStatus, StepStore, StepView, TriggerOutputs, WaitDeclaration, WorkflowDocument, } from './execution';
22
22
  export { createDataSource, WorkflowExecution, WorkflowStepExecution } from './database';
23
23
  export type { EngineStores } from './database';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkflowStepExecution = exports.WorkflowExecution = exports.createDataSource = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.AdmittanceRejectedError = exports.AllowAllAdmittance = exports.isBatchStepConfig = exports.deriveLoops = exports.UnimplementedError = exports.noopResponseTransport = exports.InMemoryResponseTransport = exports.executionResponseSchema = exports.ExecutionResponseChannel = exports.lifecycleEventSchema = exports.lifecycleEventBatchSchema = exports.MAX_LIFECYCLE_EVENTS_PER_BATCH = exports.verifyActionToken = exports.SharedSecretIdentityVerifier = exports.mintIdentityToken = exports.mintActionToken = exports.InvalidIdentityTokenError = exports.InvalidActionTokenError = exports.IDENTITY_TOKEN = exports.ACTION_TOKEN = exports.createEngineRuntime = void 0;
3
+ exports.WorkflowStepExecution = exports.WorkflowExecution = exports.createDataSource = exports.StepNotFoundError = exports.ExecutionNotFoundError = exports.AdmittanceRejectedError = exports.AllowAllAdmittance = exports.isBatchStepConfig = exports.deriveLoops = exports.UnimplementedError = exports.responseExpectationSchema = exports.RESPONSE_EXPECTATION_KINDS = exports.noopResponseEmitter = exports.noopExecutionResponseSender = exports.executionResponseSchema = exports.createResponseEmitter = exports.lifecycleEventSchema = exports.lifecycleEventBatchSchema = exports.MAX_LIFECYCLE_EVENTS_PER_BATCH = exports.verifyActionToken = exports.SharedSecretIdentityVerifier = exports.mintIdentityToken = exports.mintActionToken = exports.InvalidIdentityTokenError = exports.InvalidActionTokenError = exports.IDENTITY_TOKEN = exports.ACTION_TOKEN = exports.createEngineRuntime = void 0;
4
4
  var runtime_1 = require("./runtime");
5
5
  Object.defineProperty(exports, "createEngineRuntime", { enumerable: true, get: function () { return runtime_1.createEngineRuntime; } });
6
6
  var auth_1 = require("./auth");
@@ -17,10 +17,12 @@ Object.defineProperty(exports, "MAX_LIFECYCLE_EVENTS_PER_BATCH", { enumerable: t
17
17
  Object.defineProperty(exports, "lifecycleEventBatchSchema", { enumerable: true, get: function () { return lifecycle_events_1.lifecycleEventBatchSchema; } });
18
18
  Object.defineProperty(exports, "lifecycleEventSchema", { enumerable: true, get: function () { return lifecycle_events_1.lifecycleEventSchema; } });
19
19
  var response_channel_1 = require("./response-channel");
20
- Object.defineProperty(exports, "ExecutionResponseChannel", { enumerable: true, get: function () { return response_channel_1.ExecutionResponseChannel; } });
20
+ Object.defineProperty(exports, "createResponseEmitter", { enumerable: true, get: function () { return response_channel_1.createResponseEmitter; } });
21
21
  Object.defineProperty(exports, "executionResponseSchema", { enumerable: true, get: function () { return response_channel_1.executionResponseSchema; } });
22
- Object.defineProperty(exports, "InMemoryResponseTransport", { enumerable: true, get: function () { return response_channel_1.InMemoryResponseTransport; } });
23
- Object.defineProperty(exports, "noopResponseTransport", { enumerable: true, get: function () { return response_channel_1.noopResponseTransport; } });
22
+ Object.defineProperty(exports, "noopExecutionResponseSender", { enumerable: true, get: function () { return response_channel_1.noopExecutionResponseSender; } });
23
+ Object.defineProperty(exports, "noopResponseEmitter", { enumerable: true, get: function () { return response_channel_1.noopResponseEmitter; } });
24
+ Object.defineProperty(exports, "RESPONSE_EXPECTATION_KINDS", { enumerable: true, get: function () { return response_channel_1.RESPONSE_EXPECTATION_KINDS; } });
25
+ Object.defineProperty(exports, "responseExpectationSchema", { enumerable: true, get: function () { return response_channel_1.responseExpectationSchema; } });
24
26
  var common_1 = require("./common");
25
27
  Object.defineProperty(exports, "UnimplementedError", { enumerable: true, get: function () { return common_1.UnimplementedError; } });
26
28
  var graph_1 = require("./graph");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA;AAK5B,+B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AAoB,OAAA;AAQrB,uDAO4B;AAN3B,yHAAA,qBAAqB,OAAA;AACrB,2HAAA,uBAAuB,OAAA;AACvB,+HAAA,2BAA2B,OAAA;AAC3B,uHAAA,mBAAmB,OAAA;AACnB,8HAAA,0BAA0B,OAAA;AAC1B,6HAAA,yBAAyB,OAAA;AAc1B,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAG3B,iCAAyD;AAAhD,oGAAA,WAAW,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAqBvC,2CAA2E;AAAlE,gHAAA,kBAAkB,OAAA;AAAE,qHAAA,uBAAuB,OAAA;AAgBpD,yCAAwE;AAA/D,mHAAA,sBAAsB,OAAA;AAAE,8GAAA,iBAAiB,OAAA;AA4BlD,uCAAwF;AAA/E,4GAAA,gBAAgB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,iHAAA,qBAAqB,OAAA"}
@@ -6,18 +6,21 @@ export declare const lifecycleEventSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
6
6
  at: z.ZodString;
7
7
  type: z.ZodLiteral<"execution:started">;
8
8
  mode: z.ZodEnum<["production", "manual"]>;
9
+ hostMode: z.ZodString;
9
10
  }, "strip", z.ZodTypeAny, {
10
11
  executionId: string;
11
12
  workflowId: string;
12
13
  at: string;
13
14
  type: "execution:started";
14
15
  mode: "manual" | "production";
16
+ hostMode: string;
15
17
  }, {
16
18
  executionId: string;
17
19
  workflowId: string;
18
20
  at: string;
19
21
  type: "execution:started";
20
22
  mode: "manual" | "production";
23
+ hostMode: string;
21
24
  }>, z.ZodObject<{
22
25
  executionId: z.ZodString;
23
26
  workflowId: z.ZodString;
@@ -48,6 +51,21 @@ export declare const lifecycleEventSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
48
51
  workflowId: string;
49
52
  at: string;
50
53
  type: "execution:failed";
54
+ }>, z.ZodObject<{
55
+ executionId: z.ZodString;
56
+ workflowId: z.ZodString;
57
+ at: z.ZodString;
58
+ type: z.ZodLiteral<"execution:cancelled">;
59
+ }, "strip", z.ZodTypeAny, {
60
+ executionId: string;
61
+ workflowId: string;
62
+ at: string;
63
+ type: "execution:cancelled";
64
+ }, {
65
+ executionId: string;
66
+ workflowId: string;
67
+ at: string;
68
+ type: "execution:cancelled";
51
69
  }>, z.ZodObject<{
52
70
  executionId: z.ZodString;
53
71
  stepId: z.ZodString;
@@ -131,18 +149,21 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
131
149
  at: z.ZodString;
132
150
  type: z.ZodLiteral<"execution:started">;
133
151
  mode: z.ZodEnum<["production", "manual"]>;
152
+ hostMode: z.ZodString;
134
153
  }, "strip", z.ZodTypeAny, {
135
154
  executionId: string;
136
155
  workflowId: string;
137
156
  at: string;
138
157
  type: "execution:started";
139
158
  mode: "manual" | "production";
159
+ hostMode: string;
140
160
  }, {
141
161
  executionId: string;
142
162
  workflowId: string;
143
163
  at: string;
144
164
  type: "execution:started";
145
165
  mode: "manual" | "production";
166
+ hostMode: string;
146
167
  }>, z.ZodObject<{
147
168
  executionId: z.ZodString;
148
169
  workflowId: z.ZodString;
@@ -173,6 +194,21 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
173
194
  workflowId: string;
174
195
  at: string;
175
196
  type: "execution:failed";
197
+ }>, z.ZodObject<{
198
+ executionId: z.ZodString;
199
+ workflowId: z.ZodString;
200
+ at: z.ZodString;
201
+ type: z.ZodLiteral<"execution:cancelled">;
202
+ }, "strip", z.ZodTypeAny, {
203
+ executionId: string;
204
+ workflowId: string;
205
+ at: string;
206
+ type: "execution:cancelled";
207
+ }, {
208
+ executionId: string;
209
+ workflowId: string;
210
+ at: string;
211
+ type: "execution:cancelled";
176
212
  }>, z.ZodObject<{
177
213
  executionId: z.ZodString;
178
214
  stepId: z.ZodString;
@@ -256,6 +292,7 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
256
292
  at: string;
257
293
  type: "execution:started";
258
294
  mode: "manual" | "production";
295
+ hostMode: string;
259
296
  } | {
260
297
  executionId: string;
261
298
  workflowId: string;
@@ -266,6 +303,11 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
266
303
  workflowId: string;
267
304
  at: string;
268
305
  type: "execution:failed";
306
+ } | {
307
+ executionId: string;
308
+ workflowId: string;
309
+ at: string;
310
+ type: "execution:cancelled";
269
311
  } | {
270
312
  executionId: string;
271
313
  stepId: string;
@@ -299,6 +341,7 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
299
341
  at: string;
300
342
  type: "execution:started";
301
343
  mode: "manual" | "production";
344
+ hostMode: string;
302
345
  } | {
303
346
  executionId: string;
304
347
  workflowId: string;
@@ -309,6 +352,11 @@ export declare const lifecycleEventBatchSchema: z.ZodObject<{
309
352
  workflowId: string;
310
353
  at: string;
311
354
  type: "execution:failed";
355
+ } | {
356
+ executionId: string;
357
+ workflowId: string;
358
+ at: string;
359
+ type: "execution:cancelled";
312
360
  } | {
313
361
  executionId: string;
314
362
  stepId: string;
@@ -22,9 +22,11 @@ exports.lifecycleEventSchema = zod_1.z.discriminatedUnion('type', [
22
22
  type: zod_1.z.literal('execution:started'),
23
23
  ...executionFields,
24
24
  mode: zod_1.z.enum(['production', 'manual']),
25
+ hostMode: zod_1.z.string().min(1),
25
26
  }),
26
27
  zod_1.z.object({ type: zod_1.z.literal('execution:completed'), ...executionFields }),
27
28
  zod_1.z.object({ type: zod_1.z.literal('execution:failed'), ...executionFields }),
29
+ zod_1.z.object({ type: zod_1.z.literal('execution:cancelled'), ...executionFields }),
28
30
  zod_1.z.object({ type: zod_1.z.literal('step:started'), ...stepFields }),
29
31
  zod_1.z.object({
30
32
  type: zod_1.z.literal('step:completed'),
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle-event.schema.js","sourceRoot":"","sources":["../../src/lifecycle-events/lifecycle-event.schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,sCAA4C;AAG/B,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAElD,MAAM,eAAe,GAAG;IACvB,W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,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;CAC3D,CAAC,CAAC;AAGU,QAAA,yBAAyB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,QAAA,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAA,8BAA8B,CAAC;CAChF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ExecutionResponseSender } from './execution-response-sender';
2
+ import { type ResponseEmitter, type ResponseExpectation } from './execution-response.types';
3
+ export declare function createResponseEmitter(sender: ExecutionResponseSender, execution: {
4
+ id: string;
5
+ responseExpectation: ResponseExpectation;
6
+ }): ResponseEmitter;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createResponseEmitter = createResponseEmitter;
4
+ const execution_response_types_1 = require("./execution-response.types");
5
+ function createResponseEmitter(sender, execution) {
6
+ const executionId = execution.id;
7
+ switch (execution.responseExpectation.kind) {
8
+ case 'stepResponse':
9
+ return {
10
+ send: (build) => sender.send({ type: 'response', executionId, payload: build() }),
11
+ chunk: execution_response_types_1.noopResponseEmitter.chunk,
12
+ };
13
+ case 'stream':
14
+ return {
15
+ send: execution_response_types_1.noopResponseEmitter.send,
16
+ chunk: (build) => sender.send({ type: 'chunk', executionId, payload: build() }),
17
+ };
18
+ default:
19
+ return execution_response_types_1.noopResponseEmitter;
20
+ }
21
+ }
22
+ //# sourceMappingURL=create-response-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-response-emitter.js","sourceRoot":"","sources":["../../src/response-channel/create-response-emitter.ts"],"names":[],"mappings":";;;AACA,yEAIoC;AAUpC,+BACC,MAA+B,EAC/B,SAAmE;IAEnE,MAAM,WAAW,GAAG,SAAS,CAAC,EAAE,CAAC;IAEjC,QAAQ,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;QAC5C,KAAK,cAAc;YAClB,OAAO;gBACN,IAAI,EAAE,CAAC,KAAsB,EAAE,EAAE,CAChC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;gBACjE,KAAK,EAAE,8CAAmB,CAAC,KAAK;aAChC,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO;gBACN,IAAI,EAAE,8CAAmB,CAAC,IAAI;gBAC9B,KAAK,EAAE,CAAC,KAAsB,EAAE,EAAE,CACjC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;aAC9D,CAAC;QACH;YACC,OAAO,8CAAmB,CAAC;IAC7B,CAAC;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Result } from '@n8n/utils/result';
2
+ import type { ExecutionResponse } from './execution-response.types';
3
+ export interface ExecutionResponseSender {
4
+ send(response: ExecutionResponse): Result<void, Error>;
5
+ stop(): Promise<void>;
6
+ }
7
+ export declare const noopExecutionResponseSender: ExecutionResponseSender;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noopExecutionResponseSender = void 0;
4
+ const result_1 = require("@n8n/utils/result");
5
+ exports.noopExecutionResponseSender = Object.freeze({
6
+ send: () => (0, result_1.createResultOk)(undefined),
7
+ stop: async () => { },
8
+ });
9
+ //# sourceMappingURL=execution-response-sender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-response-sender.js","sourceRoot":"","sources":["../../src/response-channel/execution-response-sender.ts"],"names":[],"mappings":";;;AAAA,8CAAgE;AAWnD,QAAA,2BAA2B,GAA4B,MAAM,CAAC,MAAM,CAAC;IACjF,IAAI,EAAE,GAAG,EAAE,CAAC,IAAA,uBAAc,EAAC,SAAS,CAAC;IACrC,IAAI,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;CACpB,CAAC,CAAC"}
@@ -1,10 +1,69 @@
1
1
  import { z } from 'zod';
2
- export declare const executionResponseSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2
+ export declare const RESPONSE_EXPECTATION_KINDS: readonly ['none', 'runEnd', 'stepResponse', 'stream'];
3
+ export declare const responseExpectationSchema: z.ZodObject<{
4
+ kind: z.ZodEnum<["none", "runEnd", "stepResponse", "stream"]>;
5
+ }, "strict", z.ZodTypeAny, {
6
+ kind: "none" | "runEnd" | "stepResponse" | "stream";
7
+ }, {
8
+ kind: "none" | "runEnd" | "stepResponse" | "stream";
9
+ }>;
10
+ export declare const executionResponseSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
11
+ type: z.ZodLiteral<"undeliverable">;
12
+ executionId: z.ZodString;
13
+ error: z.ZodObject<{
14
+ code: z.ZodString;
15
+ message: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ code: string;
18
+ message: string;
19
+ }, {
20
+ code: string;
21
+ message: string;
22
+ }>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ type: "undeliverable";
25
+ executionId: string;
26
+ error: {
27
+ code: string;
28
+ message: string;
29
+ };
30
+ }, {
31
+ type: "undeliverable";
32
+ executionId: string;
33
+ error: {
34
+ code: string;
35
+ message: string;
36
+ };
37
+ }>, z.ZodObject<{
38
+ type: z.ZodLiteral<"response">;
39
+ executionId: z.ZodString;
40
+ payload: z.ZodOptional<z.ZodType<import("../common").JsonValue, z.ZodTypeDef, import("../common").JsonValue>>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ type: "response";
43
+ executionId: string;
44
+ payload?: import("../common").JsonValue | undefined;
45
+ }, {
46
+ type: "response";
47
+ executionId: string;
48
+ payload?: import("../common").JsonValue | undefined;
49
+ }>, z.ZodObject<{
50
+ type: z.ZodLiteral<"chunk">;
51
+ executionId: z.ZodString;
52
+ payload: z.ZodType<import("../common").JsonValue, z.ZodTypeDef, import("../common").JsonValue>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ type: "chunk";
55
+ executionId: string;
56
+ payload: import("../common").JsonValue;
57
+ }, {
58
+ type: "chunk";
59
+ executionId: string;
60
+ payload: import("../common").JsonValue;
61
+ }>, z.ZodObject<{
3
62
  type: z.ZodLiteral<"ended">;
4
63
  executionId: z.ZodString;
5
64
  workflowId: z.ZodString;
6
- status: z.ZodEnum<["completed", "failed"]>;
7
- lastStep: z.ZodObject<{
65
+ status: z.ZodEnum<["completed", "failed", "cancelled"]>;
66
+ lastStep: z.ZodNullable<z.ZodObject<{
8
67
  nodeId: z.ZodString;
9
68
  nodeName: z.ZodString;
10
69
  status: z.ZodEnum<["completed", "failed", "skipped", "cancelled"]>;
@@ -37,12 +96,12 @@ export declare const executionResponseSchema: z.ZodDiscriminatedUnion<"type", [z
37
96
  name: string;
38
97
  message: string;
39
98
  } | undefined;
40
- }>;
99
+ }>>;
41
100
  }, "strip", z.ZodTypeAny, {
42
101
  type: "ended";
43
102
  executionId: string;
44
103
  workflowId: string;
45
- status: "completed" | "failed";
104
+ status: "cancelled" | "completed" | "failed";
46
105
  lastStep: {
47
106
  nodeId: string;
48
107
  nodeName: string;
@@ -52,12 +111,12 @@ export declare const executionResponseSchema: z.ZodDiscriminatedUnion<"type", [z
52
111
  name: string;
53
112
  message: string;
54
113
  } | undefined;
55
- };
114
+ } | null;
56
115
  }, {
57
116
  type: "ended";
58
117
  executionId: string;
59
118
  workflowId: string;
60
- status: "completed" | "failed";
119
+ status: "cancelled" | "completed" | "failed";
61
120
  lastStep: {
62
121
  nodeId: string;
63
122
  nodeName: string;
@@ -67,5 +126,65 @@ export declare const executionResponseSchema: z.ZodDiscriminatedUnion<"type", [z
67
126
  name: string;
68
127
  message: string;
69
128
  } | undefined;
129
+ } | null;
130
+ }>]>, {
131
+ type: "undeliverable";
132
+ executionId: string;
133
+ error: {
134
+ code: string;
135
+ message: string;
70
136
  };
71
- }>]>;
137
+ } | {
138
+ type: "response";
139
+ executionId: string;
140
+ payload?: import("../common").JsonValue | undefined;
141
+ } | {
142
+ type: "chunk";
143
+ executionId: string;
144
+ payload: import("../common").JsonValue;
145
+ } | {
146
+ type: "ended";
147
+ executionId: string;
148
+ workflowId: string;
149
+ status: "cancelled" | "completed" | "failed";
150
+ lastStep: {
151
+ nodeId: string;
152
+ nodeName: string;
153
+ status: "cancelled" | "completed" | "failed" | "skipped";
154
+ outputs: import("../common").JsonValue[] | null;
155
+ error?: {
156
+ name: string;
157
+ message: string;
158
+ } | undefined;
159
+ } | null;
160
+ }, {
161
+ type: "undeliverable";
162
+ executionId: string;
163
+ error: {
164
+ code: string;
165
+ message: string;
166
+ };
167
+ } | {
168
+ type: "response";
169
+ executionId: string;
170
+ payload?: import("../common").JsonValue | undefined;
171
+ } | {
172
+ type: "chunk";
173
+ executionId: string;
174
+ payload: import("../common").JsonValue;
175
+ } | {
176
+ type: "ended";
177
+ executionId: string;
178
+ workflowId: string;
179
+ status: "cancelled" | "completed" | "failed";
180
+ lastStep: {
181
+ nodeId: string;
182
+ nodeName: string;
183
+ status: "cancelled" | "completed" | "failed" | "skipped";
184
+ outputs: import("../common").JsonValue[] | null;
185
+ error?: {
186
+ name: string;
187
+ message: string;
188
+ } | undefined;
189
+ } | null;
190
+ }>;