@venturialstd/workflow 0.1.176 → 0.1.178

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 (62) hide show
  1. package/README.md +94 -54
  2. package/dist/constants/submodules-catalog.constant.d.ts +31 -0
  3. package/dist/constants/submodules-catalog.constant.d.ts.map +1 -0
  4. package/dist/constants/submodules-catalog.constant.js +81 -0
  5. package/dist/constants/submodules-catalog.constant.js.map +1 -0
  6. package/dist/index.d.ts +1 -7
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/modules/index.d.ts +0 -22
  11. package/dist/modules/index.d.ts.map +1 -1
  12. package/dist/modules/index.js +0 -172
  13. package/dist/modules/index.js.map +1 -1
  14. package/dist/modules/types.d.ts +1 -0
  15. package/dist/modules/types.d.ts.map +1 -1
  16. package/dist/modules/types.js +3 -0
  17. package/dist/modules/types.js.map +1 -1
  18. package/dist/modules/webhook/services/index.d.ts +0 -1
  19. package/dist/modules/webhook/services/index.d.ts.map +1 -1
  20. package/dist/modules/webhook/services/index.js +0 -1
  21. package/dist/modules/webhook/services/index.js.map +1 -1
  22. package/dist/modules/webhook/triggers/index.d.ts +0 -1
  23. package/dist/modules/webhook/triggers/index.d.ts.map +1 -1
  24. package/dist/modules/webhook/triggers/index.js +0 -1
  25. package/dist/modules/webhook/triggers/index.js.map +1 -1
  26. package/dist/modules/webhook/webhook-nest.module.js +2 -2
  27. package/dist/modules/webhook/webhook-nest.module.js.map +1 -1
  28. package/dist/modules/webhook/webhook.module.js +1 -1
  29. package/dist/modules/webhook/webhook.module.js.map +1 -1
  30. package/dist/services/workflow-execution.service.d.ts +2 -2
  31. package/dist/services/workflow-execution.service.d.ts.map +1 -1
  32. package/dist/services/workflow-execution.service.js +153 -104
  33. package/dist/services/workflow-execution.service.js.map +1 -1
  34. package/dist/services/workflow-module.service.d.ts +0 -1
  35. package/dist/services/workflow-module.service.d.ts.map +1 -1
  36. package/dist/services/workflow-module.service.js +14 -10
  37. package/dist/services/workflow-module.service.js.map +1 -1
  38. package/dist/utils/workflow-error-serializer.util.d.ts +24 -0
  39. package/dist/utils/workflow-error-serializer.util.d.ts.map +1 -0
  40. package/dist/utils/workflow-error-serializer.util.js +116 -0
  41. package/dist/utils/workflow-error-serializer.util.js.map +1 -0
  42. package/dist/workflow-submodule-loaders.d.ts +8 -0
  43. package/dist/workflow-submodule-loaders.d.ts.map +1 -0
  44. package/dist/workflow-submodule-loaders.js +89 -0
  45. package/dist/workflow-submodule-loaders.js.map +1 -0
  46. package/dist/workflow-submodules.catalog.d.ts +10 -0
  47. package/dist/workflow-submodules.catalog.d.ts.map +1 -0
  48. package/dist/workflow-submodules.catalog.js +60 -0
  49. package/dist/workflow-submodules.catalog.js.map +1 -0
  50. package/dist/workflow.module.d.ts +9 -1
  51. package/dist/workflow.module.d.ts.map +1 -1
  52. package/dist/workflow.module.js +18 -78
  53. package/dist/workflow.module.js.map +1 -1
  54. package/package.json +45 -1
  55. package/dist/modules/webhook/services/error-webhook-received.service.d.ts +0 -7
  56. package/dist/modules/webhook/services/error-webhook-received.service.d.ts.map +0 -1
  57. package/dist/modules/webhook/services/error-webhook-received.service.js +0 -43
  58. package/dist/modules/webhook/services/error-webhook-received.service.js.map +0 -1
  59. package/dist/modules/webhook/triggers/error-webhook-received.trigger.d.ts +0 -3
  60. package/dist/modules/webhook/triggers/error-webhook-received.trigger.d.ts.map +0 -1
  61. package/dist/modules/webhook/triggers/error-webhook-received.trigger.js +0 -29
  62. package/dist/modules/webhook/triggers/error-webhook-received.trigger.js.map +0 -1
@@ -24,6 +24,9 @@ class WorkflowModuleRegistry {
24
24
  register(module) {
25
25
  this.modules.set(module.key, module);
26
26
  }
27
+ clear() {
28
+ this.modules.clear();
29
+ }
27
30
  get(moduleKey) {
28
31
  return this.modules.get(moduleKey);
29
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../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CAAC;IAC3C,CAAC;IAKD,UAAU,CAAC,SAAiB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IAC/B,CAAC;IAKD,WAAW,CAAC,SAAiB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC;IAChC,CAAC;IAKD,kBAAkB,CAChB,SAAiB,EACjB,gBAAwB;QAExB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QAE9B,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,gBAAgB,CAAC,CAAC;IAC/F,CAAC;CACF;AA3DD,wDA2DC;AAGY,QAAA,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './error-webhook-received.service';
2
1
  export * from './webhook-received.service';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/webhook/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/webhook/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./error-webhook-received.service"), exports);
18
17
  __exportStar(require("./webhook-received.service"), exports);
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/webhook/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/webhook/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
@@ -1,3 +1,2 @@
1
- export * from './error-webhook-received.trigger';
2
1
  export * from './webhook-received.trigger';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/webhook/triggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/webhook/triggers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./error-webhook-received.trigger"), exports);
18
17
  __exportStar(require("./webhook-received.trigger"), exports);
19
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/webhook/triggers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/webhook/triggers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
@@ -31,8 +31,8 @@ exports.WebhookNestModule = WebhookNestModule = __decorate([
31
31
  ]),
32
32
  ],
33
33
  controllers: [controllers_1.WebhookReceiverController],
34
- providers: [services_1.WebhookReceivedService, services_1.ErrorWebhookReceivedService],
35
- exports: [services_1.WebhookReceivedService, services_1.ErrorWebhookReceivedService],
34
+ providers: [services_1.WebhookReceivedService],
35
+ exports: [services_1.WebhookReceivedService],
36
36
  })
37
37
  ], WebhookNestModule);
38
38
  //# sourceMappingURL=webhook-nest.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook-nest.module.js","sourceRoot":"","sources":["../../../src/modules/webhook/webhook-nest.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAEhD,wFAA6E;AAC7E,8EAAmE;AACnE,kGAAsF;AACtF,oFAAyE;AACzE,qEAAgE;AAChE,+CAA0D;AAC1D,yCAAiF;AAgB1E,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAd7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yCAAkB;YAClB,uBAAa,CAAC,UAAU,CAAC;gBACvB,yCAAe;gBACf,mCAAY;gBACZ,6CAAiB;gBACjB,sDAAqB;aACtB,CAAC;SACH;QACD,WAAW,EAAE,CAAC,uCAAyB,CAAC;QACxC,SAAS,EAAE,CAAC,iCAAsB,EAAE,sCAA2B,CAAC;QAChE,OAAO,EAAE,CAAC,iCAAsB,EAAE,sCAA2B,CAAC;KAC/D,CAAC;GACW,iBAAiB,CAAG"}
1
+ {"version":3,"file":"webhook-nest.module.js","sourceRoot":"","sources":["../../../src/modules/webhook/webhook-nest.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAEhD,wFAA6E;AAC7E,8EAAmE;AACnE,kGAAsF;AACtF,oFAAyE;AACzE,qEAAgE;AAChE,+CAA0D;AAC1D,yCAAoD;AAgB7C,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAd7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yCAAkB;YAClB,uBAAa,CAAC,UAAU,CAAC;gBACvB,yCAAe;gBACf,mCAAY;gBACZ,6CAAiB;gBACjB,sDAAqB;aACtB,CAAC;SACH;QACD,WAAW,EAAE,CAAC,uCAAyB,CAAC;QACxC,SAAS,EAAE,CAAC,iCAAsB,CAAC;QACnC,OAAO,EAAE,CAAC,iCAAsB,CAAC;KAClC,CAAC;GACW,iBAAiB,CAAG"}
@@ -11,6 +11,6 @@ exports.webhookModule = {
11
11
  version: '1.0.0',
12
12
  credentialFields: credentials_1.webhookCredentials,
13
13
  actions: [],
14
- triggers: [triggers_1.webhookReceivedTrigger, triggers_1.errorWebhookReceivedTrigger],
14
+ triggers: [triggers_1.webhookReceivedTrigger],
15
15
  };
16
16
  //# sourceMappingURL=webhook.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.module.js","sourceRoot":"","sources":["../../../src/modules/webhook/webhook.module.ts"],"names":[],"mappings":";;;AACA,+CAAmD;AACnD,yCAAiF;AAEpE,QAAA,aAAa,GAA6B;IACrD,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,+DAA+D;IAC5E,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,gBAAgB,EAAE,gCAAkB;IACpC,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,CAAC,iCAAsB,EAAE,sCAA2B,CAAC;CAChE,CAAC"}
1
+ {"version":3,"file":"webhook.module.js","sourceRoot":"","sources":["../../../src/modules/webhook/webhook.module.ts"],"names":[],"mappings":";;;AACA,+CAAmD;AACnD,yCAAoD;AAEvC,QAAA,aAAa,GAA6B;IACrD,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,+DAA+D;IAC5E,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,gBAAgB,EAAE,gCAAkB;IACpC,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,CAAC,iCAAsB,CAAC;CACnC,CAAC"}
@@ -26,8 +26,8 @@ export declare class WorkflowExecutionService extends TypeOrmCrudService<Workflo
26
26
  startExecution(executionId: string): Promise<WorkflowExecution>;
27
27
  completeExecution(executionId: string, outputData?: Record<string, unknown>): Promise<WorkflowExecution>;
28
28
  failExecution(executionId: string, errorMessage: string, errorData?: Record<string, unknown>): Promise<WorkflowExecution>;
29
- private getFailureTriggerWorkflowId;
30
- private triggerErrorHandlerWorkflow;
29
+ private getFailureTriggerNodeId;
30
+ private executeFailureTrigger;
31
31
  updateCurrentNode(executionId: string, currentNodeId: string): Promise<WorkflowExecution>;
32
32
  private getNextExecutionOrder;
33
33
  private startNodeExecution;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-execution.service.d.ts","sourceRoot":"","sources":["../../src/services/workflow-execution.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAQnF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAA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EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAcjF,qBAAqB;YAarB,kBAAkB;YA0ElB,qBAAqB;YAqCrB,iBAAiB;YA6CjB,eAAe;IA0E7B,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,wBAAwB;YAiDlB,kBAAkB;IA2B1B,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,aAAa,GAAE,MAAa,GAC3B,OAAO,CAAC,iBAAiB,CAAC;CAokC9B"}
@@ -24,6 +24,7 @@ const workflow_constant_1 = require("../constants/workflow.constant");
24
24
  const workflow_execution_entity_1 = require("../entities/workflow-execution.entity");
25
25
  const workflow_node_execution_entity_1 = require("../entities/workflow-node-execution.entity");
26
26
  const types_1 = require("../modules/types");
27
+ const workflow_error_serializer_util_1 = require("../utils/workflow-error-serializer.util");
27
28
  const variable_resolver_util_1 = require("../utils/variable-resolver.util");
28
29
  const workflow_service_1 = require("./workflow.service");
29
30
  const workflow_edge_service_1 = require("./workflow-edge.service");
@@ -117,22 +118,19 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
117
118
  this.logger.error(`Execution with id "${executionId}" not found`);
118
119
  return {};
119
120
  }
120
- const triggeredByFailureHandler = execution.inputData?.triggerSource === 'failure-handler';
121
- if (triggeredByFailureHandler) {
122
- this.logger.debug('Skipping error handler - execution was triggered by failure handler', {
121
+ const failureTriggerNodeId = await this.getFailureTriggerNodeId(execution.workflowId);
122
+ if (failureTriggerNodeId) {
123
+ this.logger.log(`Executing failure trigger: nodeId=${failureTriggerNodeId}`, {
123
124
  executionId,
124
125
  workflowId: execution.workflowId,
125
126
  });
126
127
  }
127
- else {
128
- const failureTriggerWorkflowId = await this.getFailureTriggerWorkflowId(execution.workflowId);
129
- if (failureTriggerWorkflowId) {
130
- try {
131
- await this.triggerErrorHandlerWorkflow(execution, errorMessage, errorData, failureTriggerWorkflowId);
132
- }
133
- catch (triggerError) {
134
- this.logger.warn(`Error handler workflow trigger failed: ${triggerError instanceof Error ? triggerError.message : 'Unknown error'}`, { executionId, failureTriggerWorkflowId });
135
- }
128
+ if (failureTriggerNodeId) {
129
+ try {
130
+ await this.executeFailureTrigger(execution, errorMessage, errorData, failureTriggerNodeId);
131
+ }
132
+ catch (triggerError) {
133
+ this.logger.warn(`Failure trigger execution failed: ${triggerError instanceof Error ? triggerError.message : 'Unknown error'}`, { executionId, failureTriggerNodeId });
136
134
  }
137
135
  }
138
136
  execution.status = workflow_constant_1.EXECUTION_STATUS.FAILED;
@@ -146,7 +144,7 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
146
144
  this.sseService.emitWorkflowFailed(execution.workflowId, executionId, errorMessage, errorData);
147
145
  return result;
148
146
  }
149
- async getFailureTriggerWorkflowId(workflowId) {
147
+ async getFailureTriggerNodeId(workflowId) {
150
148
  const workflow = await this.workflowService.repo.findOne({ where: { id: workflowId } });
151
149
  if (!workflow) {
152
150
  this.logger.warn(`Workflow "${workflowId}" not found when resolving failure trigger`);
@@ -156,50 +154,116 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
156
154
  this.logger.debug(`Workflow "${workflowId}" has no metadata`);
157
155
  return null;
158
156
  }
159
- const metadata = workflow.metadata;
160
- const failureTriggerWorkflowId = metadata.failureTriggerWorkflowId;
161
- return typeof failureTriggerWorkflowId === 'string' && failureTriggerWorkflowId.trim()
162
- ? failureTriggerWorkflowId.trim()
157
+ const failureTriggerNodeId = workflow.metadata
158
+ .failureTriggerNodeId;
159
+ return typeof failureTriggerNodeId === 'string' && failureTriggerNodeId.trim()
160
+ ? failureTriggerNodeId.trim()
163
161
  : null;
164
162
  }
165
- async triggerErrorHandlerWorkflow(failedExecution, errorMessage, errorData, failureTriggerWorkflowId) {
166
- if (!failureTriggerWorkflowId)
163
+ async executeFailureTrigger(execution, errorMessage, errorData, failureTriggerNodeId) {
164
+ if (!failureTriggerNodeId)
167
165
  return;
168
- const errorHandlerWorkflow = await this.workflowService.repo.findOne({
169
- where: { id: failureTriggerWorkflowId },
170
- relations: ['nodes'],
166
+ const failureNode = await this.workflowNodeService.repo.findOne({
167
+ where: { workflowId: execution.workflowId, nodeId: failureTriggerNodeId },
171
168
  });
172
- if (!errorHandlerWorkflow?.nodes?.length) {
173
- this.logger.warn(`Error handler workflow "${failureTriggerWorkflowId}" not found or has no nodes`);
169
+ if (!failureNode) {
170
+ this.logger.warn(`Failure trigger node "${failureTriggerNodeId}" not found in workflow`);
174
171
  return;
175
172
  }
176
- const errorWebhookNode = errorHandlerWorkflow.nodes.find((n) => n.moduleKey === 'webhook' && n.actionType === 'error-webhook-received');
177
- if (!errorWebhookNode) {
178
- this.logger.warn(`Error handler workflow "${failureTriggerWorkflowId}" has no error-webhook-received trigger`);
173
+ const moduleDefinition = types_1.workflowModuleRegistry.get(failureNode.moduleKey);
174
+ if (!moduleDefinition) {
175
+ this.logger.warn(`Module "${failureNode.moduleKey}" not found for failure trigger`);
176
+ return;
177
+ }
178
+ const actionOrTrigger = [...moduleDefinition.actions, ...moduleDefinition.triggers].find((t) => t.key === failureNode.actionType);
179
+ if (!actionOrTrigger?.serviceClass) {
180
+ this.logger.warn(`Action/trigger "${failureNode.actionType}" has no service for failure trigger`);
179
181
  return;
180
182
  }
181
183
  const failureContext = {
182
184
  errorMessage,
183
- workflowId: failedExecution.workflowId,
184
- executionId: failedExecution.id,
185
+ workflowId: execution.workflowId,
186
+ executionId: execution.id,
185
187
  timestamp: new Date().toISOString(),
186
188
  ...errorData,
187
189
  };
188
- const newExecution = this.repo.create({
189
- workflowId: failureTriggerWorkflowId,
190
- status: workflow_constant_1.EXECUTION_STATUS.PENDING,
191
- inputData: {
190
+ const variableResolutionData = {
191
+ ...(execution.inputData || {}),
192
+ ...(execution.outputData || {}),
193
+ failure: failureContext,
194
+ };
195
+ const rawInputs = {};
196
+ if (actionOrTrigger.inputs) {
197
+ for (const input of actionOrTrigger.inputs) {
198
+ const value = failureNode.properties?.[input.id];
199
+ if (value !== undefined) {
200
+ rawInputs[input.id] = value;
201
+ }
202
+ else if (input.defaultValue !== undefined) {
203
+ rawInputs[input.id] = input.defaultValue;
204
+ }
205
+ }
206
+ }
207
+ const inputs = (0, variable_resolver_util_1.resolveVariables)(rawInputs, variableResolutionData);
208
+ let credentials;
209
+ const credentialId = failureNode.properties?.credentialId;
210
+ if (credentialId) {
211
+ const credential = await this.workflowModuleCredentialService.findOne({
212
+ where: { id: credentialId },
213
+ });
214
+ if (credential)
215
+ credentials = credential.credentials;
216
+ }
217
+ const context = {
218
+ workflowId: execution.workflowId,
219
+ executionId: execution.id,
220
+ credentials,
221
+ context: { failure: failureContext },
222
+ previousOutputs: {
223
+ ...(execution.outputData || {}),
192
224
  failure: failureContext,
193
- triggerSource: 'failure-handler',
194
- triggerNodeId: errorWebhookNode.nodeId,
195
225
  },
226
+ };
227
+ const executionOrder = await this.getNextExecutionOrder(execution.id);
228
+ const nodeExecution = this.nodeExecutionRepo.create({
229
+ workflowExecutionId: execution.id,
230
+ workflowNodeId: failureNode.id,
231
+ nodeId: failureNode.nodeId,
232
+ status: workflow_constant_1.EXECUTION_STATUS.RUNNING,
233
+ executionOrder,
234
+ inputData: { failure: failureContext, ...inputs },
235
+ startedAt: new Date(),
196
236
  });
197
- const savedExecution = await this.repo.save(newExecution);
198
- this.logger.log(`Triggered error handler workflow: ${failureTriggerWorkflowId}`, {
199
- failedExecutionId: failedExecution.id,
200
- errorHandlerExecutionId: savedExecution.id,
201
- });
202
- this.startExecution(savedExecution.id);
237
+ await this.nodeExecutionRepo.save(nodeExecution);
238
+ this.sseService.emitNodeStarted(execution.workflowId, execution.id, failureNode.nodeId, `${failureNode.label} (failure trigger)`);
239
+ let service;
240
+ try {
241
+ service = this.moduleRef.get(actionOrTrigger.serviceClass, { strict: false });
242
+ }
243
+ catch {
244
+ service = new actionOrTrigger.serviceClass();
245
+ }
246
+ try {
247
+ const outputData = await service.perform(inputs, context);
248
+ const output = outputData && typeof outputData === 'object' ? outputData : {};
249
+ nodeExecution.status = workflow_constant_1.EXECUTION_STATUS.COMPLETED;
250
+ nodeExecution.outputData = output;
251
+ nodeExecution.completedAt = new Date();
252
+ await this.nodeExecutionRepo.save(nodeExecution);
253
+ this.sseService.emitNodeCompleted(execution.workflowId, execution.id, failureNode.nodeId, `${failureNode.label} (failure trigger)`, output);
254
+ this.logger.log(`Failure trigger "${failureTriggerNodeId}" executed successfully`, {
255
+ executionId: execution.id,
256
+ });
257
+ }
258
+ catch (performError) {
259
+ nodeExecution.status = workflow_constant_1.EXECUTION_STATUS.FAILED;
260
+ nodeExecution.errorMessage =
261
+ performError instanceof Error ? performError.message : 'Unknown error';
262
+ nodeExecution.completedAt = new Date();
263
+ await this.nodeExecutionRepo.save(nodeExecution);
264
+ this.sseService.emitNodeFailed(execution.workflowId, execution.id, failureNode.nodeId, `${failureNode.label} (failure trigger)`, nodeExecution.errorMessage);
265
+ throw performError;
266
+ }
203
267
  }
204
268
  async updateCurrentNode(executionId, currentNodeId) {
205
269
  const execution = await this.repo.findOne({ where: { id: executionId } });
@@ -589,13 +653,13 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
589
653
  }
590
654
  }
591
655
  catch (error) {
656
+ const { errorMessage, errorData } = (0, workflow_error_serializer_util_1.buildWorkflowNodeFailurePayload)(error, {
657
+ nodeId: currentNode.nodeId,
658
+ nodeType: currentNode.moduleKey,
659
+ actionType: currentNode.actionType ?? '',
660
+ });
592
661
  if (nodeExecution) {
593
- await this.failNodeExecution(nodeExecution.id, error instanceof Error ? error.message : 'Unknown error occurred', {
594
- nodeId: currentNode.nodeId,
595
- nodeType: currentNode.moduleKey,
596
- actionType: currentNode.actionType,
597
- error: error instanceof Error ? error.stack : undefined,
598
- });
662
+ await this.failNodeExecution(nodeExecution.id, errorMessage, errorData);
599
663
  }
600
664
  const continueOnErrorValue = currentNode.properties?.continueOnError;
601
665
  const shouldContinueOnError = continueOnErrorValue === true || continueOnErrorValue === 'true';
@@ -611,29 +675,20 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
611
675
  nodeId: currentNode.nodeId,
612
676
  nodeType: currentNode.moduleKey,
613
677
  actionType: currentNode.actionType,
614
- error: error instanceof Error ? error.message : 'Unknown error occurred',
678
+ error: errorMessage,
615
679
  });
616
680
  execution.outputData = {
617
681
  ...(execution.outputData || {}),
618
682
  [currentNode.nodeId]: {
619
683
  error: true,
620
- errorMessage: error instanceof Error ? error.message : 'Unknown error occurred',
621
- errorData: {
622
- nodeId: currentNode.nodeId,
623
- nodeType: currentNode.moduleKey,
624
- actionType: currentNode.actionType,
625
- },
684
+ errorMessage,
685
+ errorData,
626
686
  },
627
687
  };
628
688
  await this.repo.save(execution);
629
689
  }
630
690
  else {
631
- return this.failExecution(executionId, error instanceof Error ? error.message : 'Unknown error occurred', {
632
- nodeId: currentNode.nodeId,
633
- nodeType: currentNode.moduleKey,
634
- actionType: currentNode.actionType,
635
- error: error instanceof Error ? error.stack : undefined,
636
- });
691
+ return this.failExecution(executionId, errorMessage, errorData);
637
692
  }
638
693
  }
639
694
  }
@@ -739,13 +794,13 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
739
794
  }
740
795
  }
741
796
  catch (error) {
797
+ const { errorMessage, errorData } = (0, workflow_error_serializer_util_1.buildWorkflowNodeFailurePayload)(error, {
798
+ nodeId: currentNode.nodeId,
799
+ nodeType: currentNode.moduleKey,
800
+ actionType: currentNode.actionType ?? '',
801
+ });
742
802
  if (nodeExecution) {
743
- await this.failNodeExecution(nodeExecution.id, error instanceof Error ? error.message : 'Unknown error occurred', {
744
- nodeId: currentNode.nodeId,
745
- nodeType: currentNode.moduleKey,
746
- actionType: currentNode.actionType,
747
- error: error instanceof Error ? error.stack : undefined,
748
- });
803
+ await this.failNodeExecution(nodeExecution.id, errorMessage, errorData);
749
804
  }
750
805
  const continueOnErrorValue = currentNode.properties?.continueOnError;
751
806
  const shouldContinueOnError = continueOnErrorValue === true || continueOnErrorValue === 'true';
@@ -761,18 +816,14 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
761
816
  nodeId: currentNode.nodeId,
762
817
  nodeType: currentNode.moduleKey,
763
818
  actionType: currentNode.actionType,
764
- error: error instanceof Error ? error.message : 'Unknown error occurred',
819
+ error: errorMessage,
765
820
  });
766
821
  execution.outputData = {
767
822
  ...execution.outputData,
768
823
  [currentNode.nodeId]: {
769
824
  error: true,
770
- errorMessage: error instanceof Error ? error.message : 'Unknown error occurred',
771
- errorData: {
772
- nodeId: currentNode.nodeId,
773
- nodeType: currentNode.moduleKey,
774
- actionType: currentNode.actionType,
775
- },
825
+ errorMessage,
826
+ errorData,
776
827
  },
777
828
  };
778
829
  await this.repo.save(execution);
@@ -782,12 +833,7 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
782
833
  };
783
834
  }
784
835
  else {
785
- return this.failExecution(executionId, error instanceof Error ? error.message : 'Unknown error occurred', {
786
- nodeId: currentNode.nodeId,
787
- nodeType: currentNode.moduleKey,
788
- actionType: currentNode.actionType,
789
- error: error instanceof Error ? error.stack : undefined,
790
- });
836
+ return this.failExecution(executionId, errorMessage, errorData);
791
837
  }
792
838
  }
793
839
  }
@@ -964,12 +1010,12 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
964
1010
  }
965
1011
  }
966
1012
  catch (error) {
967
- await this.failNodeExecution(nodeExecution.id, error instanceof Error ? error.message : 'Unknown error occurred', {
1013
+ const { errorMessage, errorData } = (0, workflow_error_serializer_util_1.buildWorkflowNodeFailurePayload)(error, {
968
1014
  nodeId: nextNode.nodeId,
969
1015
  nodeType: nextNode.moduleKey,
970
- actionType: nextNode.actionType,
971
- error: error instanceof Error ? error.stack : undefined,
1016
+ actionType: nextNode.actionType ?? '',
972
1017
  });
1018
+ await this.failNodeExecution(nodeExecution.id, errorMessage, errorData);
973
1019
  const continueOnErrorValue = nextNode.properties?.continueOnError;
974
1020
  const shouldContinueOnError = continueOnErrorValue === true || continueOnErrorValue === 'true';
975
1021
  this.logger.debug(`Checking continueOnError for node "${nextNode.nodeId}"`, {
@@ -984,18 +1030,14 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
984
1030
  nodeId: nextNode.nodeId,
985
1031
  nodeType: nextNode.moduleKey,
986
1032
  actionType: nextNode.actionType,
987
- error: error instanceof Error ? error.message : 'Unknown error occurred',
1033
+ error: errorMessage,
988
1034
  });
989
1035
  execution.outputData = {
990
1036
  ...execution.outputData,
991
1037
  [nextNode.nodeId]: {
992
1038
  error: true,
993
- errorMessage: error instanceof Error ? error.message : 'Unknown error occurred',
994
- errorData: {
995
- nodeId: nextNode.nodeId,
996
- nodeType: nextNode.moduleKey,
997
- actionType: nextNode.actionType,
998
- },
1039
+ errorMessage,
1040
+ errorData,
999
1041
  },
1000
1042
  };
1001
1043
  await this.repo.save(execution);
@@ -1028,10 +1070,12 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
1028
1070
  nodeId: nextNode.nodeId,
1029
1071
  nodeType: nextNode.moduleKey,
1030
1072
  actionType: nextNode.actionType,
1031
- error: error instanceof Error ? error.message : 'Unknown error occurred',
1073
+ error: errorMessage,
1032
1074
  });
1033
1075
  branchErrors.push({
1034
1076
  nodeId: nextNode.nodeId,
1077
+ nodeType: nextNode.moduleKey,
1078
+ actionType: nextNode.actionType ?? '',
1035
1079
  error,
1036
1080
  });
1037
1081
  if (isMainEdge) {
@@ -1040,7 +1084,7 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
1040
1084
  this.logger.debug('Main branch failed without continueOnError', {
1041
1085
  executionId,
1042
1086
  mainBranchNodeId,
1043
- errorMessage: error instanceof Error ? error.message : 'Unknown error',
1087
+ errorMessage,
1044
1088
  });
1045
1089
  }
1046
1090
  if (!firstExecutedNodeId) {
@@ -1049,12 +1093,7 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
1049
1093
  continue;
1050
1094
  }
1051
1095
  else {
1052
- return this.failExecution(executionId, error instanceof Error ? error.message : 'Unknown error occurred', {
1053
- nodeId: nextNode.nodeId,
1054
- nodeType: nextNode.moduleKey,
1055
- actionType: nextNode.actionType,
1056
- error: error instanceof Error ? error.stack : undefined,
1057
- });
1096
+ return this.failExecution(executionId, errorMessage, errorData);
1058
1097
  }
1059
1098
  }
1060
1099
  }
@@ -1062,14 +1101,24 @@ let WorkflowExecutionService = WorkflowExecutionService_1 = class WorkflowExecut
1062
1101
  if (isParallelExecution && branchErrors.length > 0) {
1063
1102
  if (!hasExecutedAction && branchErrors.length === edges.length) {
1064
1103
  const firstError = branchErrors[0];
1065
- return this.failExecution(executionId, firstError.error instanceof Error
1066
- ? firstError.error.message
1067
- : 'All parallel branches failed', {
1104
+ const { errorMessage, errorData } = (0, workflow_error_serializer_util_1.buildWorkflowNodeFailurePayload)(firstError.error, {
1068
1105
  nodeId: firstError.nodeId,
1069
- branchErrors: branchErrors.map((be) => ({
1070
- nodeId: be.nodeId,
1071
- error: be.error instanceof Error ? be.error.message : 'Unknown error',
1072
- })),
1106
+ nodeType: firstError.nodeType,
1107
+ actionType: firstError.actionType,
1108
+ });
1109
+ return this.failExecution(executionId, errorMessage, {
1110
+ ...errorData,
1111
+ branchErrors: branchErrors.map((be) => {
1112
+ const s = (0, workflow_error_serializer_util_1.serializeWorkflowError)(be.error);
1113
+ return {
1114
+ nodeId: be.nodeId,
1115
+ nodeType: be.nodeType,
1116
+ actionType: be.actionType,
1117
+ error: s.message,
1118
+ http: s.http,
1119
+ code: s.code,
1120
+ };
1121
+ }),
1073
1122
  });
1074
1123
  }
1075
1124
  this.logger.log(`Parallel execution: ${branchErrors.length} branch(es) failed but workflow continues`, {