@loopstack/core 0.19.0 → 0.20.1

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 (102) hide show
  1. package/dist/common/common.module.d.ts.map +1 -1
  2. package/dist/common/common.module.js +1 -0
  3. package/dist/common/common.module.js.map +1 -1
  4. package/dist/common/errors/jexl-expression.error.d.ts +5 -0
  5. package/dist/common/errors/jexl-expression.error.d.ts.map +1 -0
  6. package/dist/common/errors/jexl-expression.error.js +13 -0
  7. package/dist/common/errors/jexl-expression.error.js.map +1 -0
  8. package/dist/common/interfaces/processor.interface.d.ts +2 -2
  9. package/dist/common/interfaces/processor.interface.d.ts.map +1 -1
  10. package/dist/common/services/expression-handler/jexl-expression.handler.d.ts +16 -0
  11. package/dist/common/services/expression-handler/jexl-expression.handler.d.ts.map +1 -0
  12. package/dist/common/services/expression-handler/jexl-expression.handler.js +80 -0
  13. package/dist/common/services/expression-handler/jexl-expression.handler.js.map +1 -0
  14. package/dist/common/services/index.d.ts +1 -0
  15. package/dist/common/services/index.d.ts.map +1 -1
  16. package/dist/common/services/index.js +1 -0
  17. package/dist/common/services/index.js.map +1 -1
  18. package/dist/common/services/template.service.d.ts +3 -3
  19. package/dist/common/services/template.service.d.ts.map +1 -1
  20. package/dist/common/services/template.service.js +6 -6
  21. package/dist/common/services/template.service.js.map +1 -1
  22. package/dist/persistence/services/document.service.d.ts +2 -2
  23. package/dist/persistence/services/document.service.d.ts.map +1 -1
  24. package/dist/persistence/services/document.service.js +9 -12
  25. package/dist/persistence/services/document.service.js.map +1 -1
  26. package/dist/persistence/services/event-subscriber.service.d.ts +1 -1
  27. package/dist/persistence/services/event-subscriber.service.d.ts.map +1 -1
  28. package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.d.ts +1 -3
  29. package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.d.ts.map +1 -1
  30. package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.js +3 -17
  31. package/dist/scheduler/services/task-processor/run-pipeline-task-processor.service.js.map +1 -1
  32. package/dist/tools/execute-workflow-async.tool.d.ts +3 -2
  33. package/dist/tools/execute-workflow-async.tool.d.ts.map +1 -1
  34. package/dist/tools/execute-workflow-async.tool.js +12 -6
  35. package/dist/tools/execute-workflow-async.tool.js.map +1 -1
  36. package/dist/workflow-processor/services/block-processor.service.d.ts +2 -2
  37. package/dist/workflow-processor/services/block-processor.service.d.ts.map +1 -1
  38. package/dist/workflow-processor/services/block-processor.service.js.map +1 -1
  39. package/dist/workflow-processor/services/namespace-processor.service.d.ts +3 -4
  40. package/dist/workflow-processor/services/namespace-processor.service.d.ts.map +1 -1
  41. package/dist/workflow-processor/services/namespace-processor.service.js +2 -12
  42. package/dist/workflow-processor/services/namespace-processor.service.js.map +1 -1
  43. package/dist/workflow-processor/services/processors/factory-processor.service.d.ts +2 -4
  44. package/dist/workflow-processor/services/processors/factory-processor.service.d.ts.map +1 -1
  45. package/dist/workflow-processor/services/processors/factory-processor.service.js +0 -15
  46. package/dist/workflow-processor/services/processors/factory-processor.service.js.map +1 -1
  47. package/dist/workflow-processor/services/processors/sequence-processor.service.d.ts +2 -2
  48. package/dist/workflow-processor/services/processors/sequence-processor.service.d.ts.map +1 -1
  49. package/dist/workflow-processor/services/processors/sequence-processor.service.js.map +1 -1
  50. package/dist/workflow-processor/services/processors/workflow-processor.service.d.ts +4 -3
  51. package/dist/workflow-processor/services/processors/workflow-processor.service.d.ts.map +1 -1
  52. package/dist/workflow-processor/services/processors/workflow-processor.service.js +57 -32
  53. package/dist/workflow-processor/services/processors/workflow-processor.service.js.map +1 -1
  54. package/dist/workflow-processor/services/root-processor.service.d.ts +5 -3
  55. package/dist/workflow-processor/services/root-processor.service.d.ts.map +1 -1
  56. package/dist/workflow-processor/services/root-processor.service.js +21 -12
  57. package/dist/workflow-processor/services/root-processor.service.js.map +1 -1
  58. package/dist/workflow-processor/services/state-machine-processor.service.d.ts +7 -6
  59. package/dist/workflow-processor/services/state-machine-processor.service.d.ts.map +1 -1
  60. package/dist/workflow-processor/services/state-machine-processor.service.js +55 -72
  61. package/dist/workflow-processor/services/state-machine-processor.service.js.map +1 -1
  62. package/dist/workflow-processor/services/state-machine-tool-call-processor.service.d.ts +7 -6
  63. package/dist/workflow-processor/services/state-machine-tool-call-processor.service.d.ts.map +1 -1
  64. package/dist/workflow-processor/services/state-machine-tool-call-processor.service.js +55 -66
  65. package/dist/workflow-processor/services/state-machine-tool-call-processor.service.js.map +1 -1
  66. package/dist/workflow-processor/services/state-machine-validator.service.d.ts +2 -1
  67. package/dist/workflow-processor/services/state-machine-validator.service.d.ts.map +1 -1
  68. package/dist/workflow-processor/services/state-machine-validator.service.js +2 -2
  69. package/dist/workflow-processor/services/state-machine-validator.service.js.map +1 -1
  70. package/dist/workflow-processor/services/workflow-state.service.d.ts +4 -3
  71. package/dist/workflow-processor/services/workflow-state.service.d.ts.map +1 -1
  72. package/dist/workflow-processor/services/workflow-state.service.js +10 -7
  73. package/dist/workflow-processor/services/workflow-state.service.js.map +1 -1
  74. package/dist/workflow-processor/utils/execution-context-manager.d.ts +26 -0
  75. package/dist/workflow-processor/utils/execution-context-manager.d.ts.map +1 -0
  76. package/dist/workflow-processor/utils/execution-context-manager.js +57 -0
  77. package/dist/workflow-processor/utils/execution-context-manager.js.map +1 -0
  78. package/dist/workflow-processor/utils/state/state-caretaker.d.ts +11 -0
  79. package/dist/workflow-processor/utils/state/state-caretaker.d.ts.map +1 -0
  80. package/dist/workflow-processor/utils/state/state-caretaker.js +37 -0
  81. package/dist/workflow-processor/utils/state/state-caretaker.js.map +1 -0
  82. package/dist/workflow-processor/utils/state/state-manager.d.ts +24 -0
  83. package/dist/workflow-processor/utils/state/state-manager.d.ts.map +1 -0
  84. package/dist/workflow-processor/utils/state/state-manager.js +83 -0
  85. package/dist/workflow-processor/utils/state/state-manager.js.map +1 -0
  86. package/dist/workflow-processor/utils/template-helper.d.ts +2 -6
  87. package/dist/workflow-processor/utils/template-helper.d.ts.map +1 -1
  88. package/dist/workflow-processor/utils/template-helper.js +21 -6
  89. package/dist/workflow-processor/utils/template-helper.js.map +1 -1
  90. package/dist/workflow-processor/utils/wrap-block-proxy.d.ts +4 -0
  91. package/dist/workflow-processor/utils/wrap-block-proxy.d.ts.map +1 -0
  92. package/dist/workflow-processor/utils/wrap-block-proxy.js +38 -0
  93. package/dist/workflow-processor/utils/wrap-block-proxy.js.map +1 -0
  94. package/package.json +4 -2
  95. package/dist/workflow-processor/services/state/workflow-state-caretaker.d.ts +0 -11
  96. package/dist/workflow-processor/services/state/workflow-state-caretaker.d.ts.map +0 -1
  97. package/dist/workflow-processor/services/state/workflow-state-caretaker.js +0 -35
  98. package/dist/workflow-processor/services/state/workflow-state-caretaker.js.map +0 -1
  99. package/dist/workflow-processor/services/state/workflow.state.d.ts +0 -24
  100. package/dist/workflow-processor/services/state/workflow.state.d.ts.map +0 -1
  101. package/dist/workflow-processor/services/state/workflow.state.js +0 -70
  102. package/dist/workflow-processor/services/state/workflow.state.js.map +0 -1
@@ -15,7 +15,6 @@ const common_1 = require("@nestjs/common");
15
15
  const lodash_1 = require("lodash");
16
16
  const zod_1 = require("zod");
17
17
  const common_2 = require("@loopstack/common");
18
- const enums_1 = require("@loopstack/contracts/enums");
19
18
  const schemas_1 = require("@loopstack/contracts/schemas");
20
19
  const common_3 = require("../../common");
21
20
  const template_helper_1 = require("../utils/template-helper");
@@ -31,21 +30,21 @@ let StateMachineProcessorService = StateMachineProcessorService_1 = class StateM
31
30
  this.templateExpressionEvaluatorService = templateExpressionEvaluatorService;
32
31
  this.stateMachineToolCallProcessorService = stateMachineToolCallProcessorService;
33
32
  }
34
- getAvailableTransitions(block, args, ctx) {
35
- this.logger.debug(`Updating Available Transitions for Place "${ctx.state.getMetadata('place')}"`);
36
- const config = (0, common_2.getBlockConfig)(block);
33
+ getAvailableTransitions(ctx) {
34
+ this.logger.debug(`Updating Available Transitions for Place "${ctx.getManager().getData('place')}"`);
35
+ const config = (0, common_2.getBlockConfig)(ctx.getInstance());
37
36
  if (!config) {
38
- throw new Error(`Block ${block.constructor.name} is missing @BlockConfig decorator`);
37
+ throw new Error(`Block ${ctx.getInstance().constructor.name} is missing @Workflow decorator`);
39
38
  }
40
39
  const transitionsWithoutCallProperty = config.transitions.map((transition) => (0, lodash_1.omit)(transition, ['call']));
41
- const evaluatedTransitions = this.templateExpressionEvaluatorService.evaluateTemplate(transitionsWithoutCallProperty, (0, template_helper_1.getTemplateVars)(args, ctx), {
42
- cacheKey: block.constructor.name,
43
- helpers: (0, common_2.getBlockTemplateHelpers)(block),
40
+ const evaluatedTransitions = this.templateExpressionEvaluatorService.evaluateTemplate(transitionsWithoutCallProperty, (0, template_helper_1.getTemplateVars)(ctx), {
41
+ cacheKey: ctx.getInstance().constructor.name,
42
+ helpers: (0, common_2.getBlockTemplateHelpers)(ctx.getInstance()),
44
43
  schema: zod_1.z.array(schemas_1.WorkflowTransitionSchema),
45
44
  });
46
45
  const validPlaces = (0, lodash_1.uniq)(['start', 'end', ...(config.transitions?.map((t) => t.from).flat() ?? [])]);
47
- const isValidFromPlace = (from) => (typeof from === 'string' && (from === '*' || from === ctx.state.getMetadata('place'))) ||
48
- (Array.isArray(from) && (from.includes('*') || from.includes(ctx.state.getMetadata('place'))));
46
+ const isValidFromPlace = (from) => (typeof from === 'string' && (from === '*' || from === ctx.getManager().getData('place'))) ||
47
+ (Array.isArray(from) && (from.includes('*') || from.includes(ctx.getManager().getData('place'))));
49
48
  const isValidToPlace = (to) => validPlaces.includes(to);
50
49
  const isEnabledPlace = (value) => value === undefined || !!value;
51
50
  return evaluatedTransitions.filter((item) => isValidFromPlace(item.from) && isValidToPlace(item.to) && isEnabledPlace(item.if));
@@ -56,92 +55,76 @@ let StateMachineProcessorService = StateMachineProcessorService_1 = class StateM
56
55
  }
57
56
  }
58
57
  getNextTransition(ctx, pendingTransition) {
59
- if (!ctx.runtime.availableTransitions.length) {
58
+ const availableTransitions = ctx.getManager().getData('availableTransitions');
59
+ if (!availableTransitions.length) {
60
60
  this.logger.debug(`No transitions available.`);
61
61
  return undefined;
62
62
  }
63
63
  let nextTransition;
64
- this.logger.debug(`Available Transitions: ${ctx.runtime.availableTransitions.map((t) => t.id).join(', ')}`);
64
+ this.logger.debug(`Available Transitions: ${availableTransitions.map((t) => t.id).join(', ')}`);
65
65
  if (pendingTransition) {
66
- nextTransition = ctx.runtime.availableTransitions.find((item) => item.id === pendingTransition.id);
66
+ nextTransition = availableTransitions.find((item) => item.id === pendingTransition.id);
67
67
  }
68
68
  if (!nextTransition) {
69
- nextTransition = ctx.runtime.availableTransitions.find((item) => (undefined === item.trigger || item.trigger === 'onEntry') && (undefined === item.if || item.if === 'true'));
69
+ nextTransition = availableTransitions.find((item) => (undefined === item.trigger || item.trigger === 'onEntry') && (undefined === item.if || item.if === true));
70
70
  }
71
71
  if (!nextTransition || !nextTransition.to) {
72
72
  return undefined;
73
73
  }
74
- return new common_2.WorkflowTransitionDto({
74
+ return {
75
75
  id: nextTransition.id,
76
- from: ctx.state.getMetadata('place'),
76
+ from: ctx.getManager().getData('place'),
77
77
  to: nextTransition.to,
78
78
  onError: nextTransition.onError,
79
79
  payload: nextTransition.id === pendingTransition?.id ? pendingTransition?.payload : null,
80
- });
81
- }
82
- commitWorkflowTransition(ctx, nextTransition) {
83
- const place = ctx.runtime.nextPlace ?? nextTransition.to;
84
- const historyItem = {
85
- transition: nextTransition.id,
86
- from: nextTransition.from,
87
- to: place,
88
80
  };
89
- this.validateTransition(nextTransition, historyItem);
90
- ctx.state.setMetadata('place', historyItem.to);
91
- ctx.state.setMetadata('transition', historyItem);
92
- ctx.state.checkpoint();
93
81
  }
94
- async processStateMachine(block, args, ctx, pendingTransitions) {
95
- const config = (0, common_2.getBlockConfig)(block);
82
+ commitWorkflowTransition(ctx, nextPlace) {
83
+ const currentTransition = ctx.getManager().getData('transition');
84
+ if (nextPlace) {
85
+ if (nextPlace !== currentTransition.to && nextPlace !== currentTransition.onError) {
86
+ throw new Error(`Transition to place ${nextPlace} not allowed.`);
87
+ }
88
+ currentTransition.to = nextPlace;
89
+ ctx.getManager().setData('transition', currentTransition);
90
+ }
91
+ ctx.getManager().setData('place', currentTransition.to);
92
+ ctx.getManager().checkpoint();
93
+ }
94
+ async processStateMachine(workflowEntity, ctx, pendingTransitions) {
95
+ const config = (0, common_2.getBlockConfig)(ctx.getInstance());
96
96
  if (!config) {
97
- throw new Error(`Block ${block.constructor.name} is missing @BlockConfig decorator`);
97
+ throw new Error(`Block ${ctx.getInstance().constructor.name} is missing @BlockConfig decorator`);
98
98
  }
99
99
  if (!config.transitions) {
100
- throw new Error(`Workflow ${block.constructor.name} does not have any transitions.`);
100
+ throw new Error(`Workflow ${ctx.getInstance().constructor.name} does not have any transitions.`);
101
101
  }
102
- try {
103
- while (true) {
104
- this.logger.debug('------------ NEXT TRANSITION');
105
- const nextPendingTransition = pendingTransitions.shift();
106
- this.logger.debug(`next pending transition: ${nextPendingTransition?.id ?? 'none'}`);
107
- ctx.runtime.nextPlace = undefined;
108
- ctx.runtime.availableTransitions = this.getAvailableTransitions(block, args, ctx);
109
- ctx.runtime.transition = this.getNextTransition(ctx, nextPendingTransition);
110
- await this.workflowStateService.saveExecutionState(ctx);
111
- if (!ctx.runtime.transition) {
112
- this.logger.debug('stop');
113
- break;
114
- }
115
- this.logger.debug(`Applying next transition: ${ctx.runtime.transition.id}`);
116
- const toolCalls = config.transitions.find((transition) => transition.id === ctx.runtime.transition.id)?.call;
117
- ctx = await this.stateMachineToolCallProcessorService.processToolCalls(block, toolCalls, args, ctx);
118
- this.commitWorkflowTransition(ctx, ctx.runtime.transition);
102
+ while (true) {
103
+ this.logger.debug('------------ NEXT TRANSITION');
104
+ const nextPendingTransition = pendingTransitions.shift();
105
+ this.logger.debug(`next pending transition: ${nextPendingTransition?.id ?? 'none'}`);
106
+ ctx.getManager().setData('nextPlace', undefined);
107
+ ctx.getManager().setData('availableTransitions', this.getAvailableTransitions(ctx));
108
+ ctx.getManager().setData('transition', this.getNextTransition(ctx, nextPendingTransition));
109
+ await this.workflowStateService.saveExecutionState(workflowEntity, ctx);
110
+ const currentTransition = ctx.getManager().getData('transition');
111
+ if (!currentTransition) {
112
+ this.logger.debug('stop');
113
+ break;
119
114
  }
120
- }
121
- catch (e) {
122
- const error = e instanceof Error ? e : new Error(String(e));
123
- this.logger.error(new common_3.ConfigTraceError(error, block));
124
- ctx.entity.errorMessage = error.message;
125
- ctx.entity.hasError = true;
126
- }
127
- if (ctx.entity.hasError) {
128
- ctx.entity.status = enums_1.WorkflowState.Failed;
129
- ctx.runtime.error = true;
130
- ctx.runtime.stop = true;
131
- }
132
- else if (ctx.state.getMetadata('place') === 'end') {
133
- ctx.entity.status = enums_1.WorkflowState.Completed;
134
- const schema = (0, common_2.getBlockResultSchema)(block);
135
- if (schema && block.getResult) {
136
- const result = block.getResult(ctx, args);
137
- ctx.entity.result = schema.parse(result);
115
+ this.logger.debug(`Applying next transition: ${currentTransition.id}`);
116
+ const toolCalls = config.transitions.find((transition) => transition.id === currentTransition.id)?.call;
117
+ try {
118
+ ctx = await this.stateMachineToolCallProcessorService.processToolCalls(ctx, toolCalls);
119
+ this.commitWorkflowTransition(ctx);
120
+ }
121
+ catch (e) {
122
+ if (currentTransition.onError) {
123
+ this.commitWorkflowTransition(ctx, currentTransition.onError);
124
+ }
125
+ throw e;
138
126
  }
139
127
  }
140
- else {
141
- ctx.entity.status = enums_1.WorkflowState.Waiting;
142
- ctx.runtime.stop = true;
143
- }
144
- await this.workflowStateService.saveExecutionState(ctx);
145
128
  return ctx;
146
129
  }
147
130
  };
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAoC;AACpC,6BAAwB;AACxB,8CAO2B;AAC3B,sDAA2D;AAC3D,0DAAwE;AASxE,yCAAoF;AACpF,8DAA2D;AAC3D,2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AG,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QAC1B,CAAC;QAED,MAAM,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAlLY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;qCAK8B,6CAAoB;QACN,2CAAkC;QAChC,gFAAoC;GANlF,4BAA4B,CAkLxC"}
1
+ {"version":3,"file":"state-machine-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAoC;AACpC,6BAAwB;AACxB,8CAA4F;AAC5F,0DAAwE;AAQxE,yCAAkE;AAElE,8DAA2D;AAC3D,2GAAmG;AACnG,qEAAgE;AAGzD,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAIpB;IACA;IACA;IALF,MAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC,IAAI,CAAC,CAAC;IAExE,YACmB,oBAA0C,EAC1C,kCAAsE,EACtE,oCAA0E;QAF1E,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,uCAAkC,GAAlC,kCAAkC,CAAoC;QACtE,yCAAoC,GAApC,oCAAoC,CAAsC;IAC1F,CAAC;IAEJ,uBAAuB,CAAC,GAAoC;QAC1D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6CAA6C,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAErG,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAe,GAAG,CAAC,WAAW,EAAE,CAAiB,CAAC;QAC/E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,SAAS,GAAG,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,IAAI,iCAAiC,CAAC,CAAC;QAChG,CA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AI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;YAGxE,MAAM,iBAAiB,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACjE,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC1B,MAAM;YACR,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC;YAGvE,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,iBAAiB,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;YAExG,IAAI,CAAC;gBACH,GAAG,GAAG,MAAM,IAAI,CAAC,oCAAoC,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBACvF,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;YACrC,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;oBAC9B,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;gBAChE,CAAC;gBAED,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAjKY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;qCAK8B,6CAAoB;QACN,2CAAkC;QAChC,gFAAoC;GANlF,4BAA4B,CAiKxC"}
@@ -1,14 +1,15 @@
1
- import { DocumentEntity, ToolResult, WorkflowExecution, WorkflowInterface } from '@loopstack/common';
1
+ import { DocumentEntity, ToolResult } from '@loopstack/common';
2
2
  import { AssignmentConfigType, ToolCallType } from '@loopstack/contracts/types';
3
3
  import { TemplateExpressionEvaluatorService } from '../../common';
4
+ import { ExecutionContextManager, WorkflowExecutionContextManager } from '../utils/execution-context-manager';
4
5
  export declare class StateMachineToolCallProcessorService {
5
6
  private readonly templateExpressionEvaluatorService;
6
7
  private readonly logger;
7
8
  constructor(templateExpressionEvaluatorService: TemplateExpressionEvaluatorService);
8
- processToolCalls(block: WorkflowInterface, toolCalls: ToolCallType[] | undefined, args: any, ctx: WorkflowExecution): Promise<WorkflowExecution>;
9
- addDocuments(ctx: WorkflowExecution, documents: DocumentEntity[]): void;
10
- updateDocument(ctx: WorkflowExecution, index: number, document: DocumentEntity): void;
11
- addDocument(ctx: WorkflowExecution, document: DocumentEntity): void;
12
- assignToTargetBlock(block: WorkflowInterface, assign: AssignmentConfigType | undefined, ctx: WorkflowExecution, result: ToolResult): void;
9
+ processToolCalls(ctx: WorkflowExecutionContextManager, toolCalls: ToolCallType[] | undefined): Promise<WorkflowExecutionContextManager>;
10
+ addDocuments(ctx: WorkflowExecutionContextManager, documents: DocumentEntity[]): void;
11
+ updateDocument(ctx: WorkflowExecutionContextManager, index: number, document: DocumentEntity): void;
12
+ addDocument(ctx: WorkflowExecutionContextManager, document: DocumentEntity): void;
13
+ assignToTargetBlock(ctx: ExecutionContextManager, assign: AssignmentConfigType | undefined, result: ToolResult): void;
13
14
  }
14
15
  //# sourceMappingURL=state-machine-tool-call-processor.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine-tool-call-processor.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAEd,UAAU,EAEV,iBAAiB,EACjB,iBAAiB,EAIlB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,cAAc,CAAC;AAGlE,qBACa,oCAAoC;IAGnC,OAAO,CAAC,QAAQ,CAAC,kCAAkC;IAF/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyD;gBAEnD,kCAAkC,EAAE,kCAAkC;IAE7F,gBAAgB,CACpB,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,YAAY,EAAE,GAAG,SAAS,EACrC,IAAI,EAAE,GAAG,EACT,GAAG,EAAE,iBAAiB,GACrB,OAAO,CAAC,iBAAiB,CAAC;IA0G7B,YAAY,CAAC,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE;IAchE,cAAc,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc;IAW9E,WAAW,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc;IAc5D,mBAAmB,CACjB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACxC,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,UAAU;CAmBrB"}
1
+ {"version":3,"file":"state-machine-tool-call-processor.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAEd,UAAU,EAKX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAG9G,qBACa,oCAAoC;IAGnC,OAAO,CAAC,QAAQ,CAAC,kCAAkC;IAF/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyD;gBAEnD,kCAAkC,EAAE,kCAAkC;IAE7F,gBAAgB,CACpB,GAAG,EAAE,+BAA+B,EACpC,SAAS,EAAE,YAAY,EAAE,GAAG,SAAS,GACpC,OAAO,CAAC,+BAA+B,CAAC;IA4E3C,YAAY,CAAC,GAAG,EAAE,+BAA+B,EAAE,SAAS,EAAE,cAAc,EAAE;IAiB9E,cAAc,CAAC,GAAG,EAAE,+BAA+B,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc;IAgB5F,WAAW,CAAC,GAAG,EAAE,+BAA+B,EAAE,QAAQ,EAAE,cAAc;IAgB1E,mBAAmB,CAAC,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,oBAAoB,GAAG,SAAS,EAAE,MAAM,EAAE,UAAU;CAkB/G"}
@@ -23,78 +23,62 @@ let StateMachineToolCallProcessorService = StateMachineToolCallProcessorService_
23
23
  constructor(templateExpressionEvaluatorService) {
24
24
  this.templateExpressionEvaluatorService = templateExpressionEvaluatorService;
25
25
  }
26
- async processToolCalls(block, toolCalls, args, ctx) {
27
- const transition = ctx.runtime.transition;
26
+ async processToolCalls(ctx, toolCalls) {
27
+ const transition = ctx.getManager().getData('transition');
28
28
  const effects = [];
29
29
  const toolResults = {};
30
30
  if (!toolCalls) {
31
31
  return ctx;
32
32
  }
33
- try {
34
- if (toolCalls) {
35
- let i = 0;
36
- for (const toolCall of toolCalls) {
37
- this.logger.debug(`Call tool ${i} (${toolCall.tool}) on transition ${transition.id}`);
38
- const tool = (0, common_2.getBlockTool)(block, toolCall.tool);
39
- if (!tool) {
40
- throw new Error(`Tool with name ${toolCall.tool} not found.`);
41
- }
42
- const evaluatedArgs = this.templateExpressionEvaluatorService.evaluateTemplate(toolCall.args, (0, template_helper_1.getTemplateVars)(args, ctx), {
43
- cacheKey: block.constructor.name,
44
- helpers: (0, common_2.getBlockTemplateHelpers)(block),
45
- });
46
- let parsedArgs = undefined;
47
- if (tool.validate) {
48
- parsedArgs = tool.validate(evaluatedArgs);
49
- }
50
- else {
51
- const schema = (0, common_2.getBlockArgsSchema)(tool);
52
- parsedArgs = schema ? schema.parse(evaluatedArgs) : evaluatedArgs;
53
- }
54
- const toolCallResult = await tool.execute(parsedArgs, ctx, block);
55
- this.assignToTargetBlock(block, toolCall.assign, ctx, toolCallResult);
56
- if (toolCall.id) {
57
- toolResults[toolCall.id] = toolCallResult;
58
- }
59
- toolResults[i.toString()] = toolCallResult;
60
- ctx.state.updateMetadata({
61
- tools: {
62
- [transition.id]: toolResults,
63
- },
64
- });
65
- if (toolCallResult.effects) {
66
- effects.push(toolCallResult.effects);
67
- }
68
- i++;
33
+ if (toolCalls) {
34
+ let i = 0;
35
+ for (const toolCall of toolCalls) {
36
+ this.logger.debug(`Call tool ${i} (${toolCall.tool}) on transition ${transition.id}`);
37
+ const tool = (0, common_2.getBlockTool)(ctx.getInstance(), toolCall.tool);
38
+ if (!tool) {
39
+ throw new Error(`Tool with name ${toolCall.tool} not found.`);
69
40
  }
70
- const transitionEffects = effects.reduce((acc, effect) => {
71
- acc.setTransitionPlace = effect.setTransitionPlace;
72
- return acc;
73
- }, { setTransitionPlace: undefined });
74
- if (transitionEffects.setTransitionPlace) {
75
- ctx.runtime.nextPlace = transitionEffects.setTransitionPlace;
41
+ const evaluatedArgs = this.templateExpressionEvaluatorService.evaluateTemplate(toolCall.args, (0, template_helper_1.getTemplateVars)(ctx), {
42
+ cacheKey: ctx.getInstance().constructor.name,
43
+ helpers: (0, common_2.getBlockTemplateHelpers)(ctx.getInstance()),
44
+ });
45
+ let parsedArgs = undefined;
46
+ if (tool.validate) {
47
+ parsedArgs = tool.validate(evaluatedArgs);
48
+ }
49
+ else {
50
+ const schema = (0, common_2.getBlockArgsSchema)(tool);
51
+ parsedArgs = schema ? schema.parse(evaluatedArgs) : evaluatedArgs;
52
+ }
53
+ const toolCallResult = await tool.execute(parsedArgs, ctx.getContext(), ctx.getInstance(), ctx.getData());
54
+ this.assignToTargetBlock(ctx, toolCall.assign, toolCallResult);
55
+ if (toolCall.id) {
56
+ toolResults[toolCall.id] = toolCallResult;
76
57
  }
77
- for (const effect of effects) {
78
- if (effect.addWorkflowDocuments?.length) {
79
- this.addDocuments(ctx, effect.addWorkflowDocuments);
80
- }
58
+ toolResults[i.toString()] = toolCallResult;
59
+ const transitionResults = ctx.getManager().getData('tools');
60
+ transitionResults[transition.id] = toolResults;
61
+ ctx.getManager().setData('tools', transitionResults);
62
+ if (toolCallResult.effects) {
63
+ effects.push(toolCallResult.effects);
81
64
  }
65
+ i++;
82
66
  }
83
- }
84
- catch (e) {
85
- if (!transition.onError) {
86
- throw e;
67
+ for (const effect of effects) {
68
+ if (effect.addWorkflowDocuments?.length) {
69
+ this.addDocuments(ctx, effect.addWorkflowDocuments);
70
+ }
87
71
  }
88
- effects.push({
89
- setTransitionPlace: transition.onError,
90
- });
91
72
  }
92
73
  return ctx;
93
74
  }
94
75
  addDocuments(ctx, documents) {
95
76
  for (const document of documents) {
96
77
  const existingIndex = document.id
97
- ? ctx.state.getMetadata('documents').findIndex((d) => d.id === document.id)
78
+ ? ctx
79
+ .getManager()
80
+ .getData('documents')
81
+ .findIndex((d) => d.id === document.id)
98
82
  : -1;
99
83
  if (existingIndex != -1) {
100
84
  this.updateDocument(ctx, existingIndex, document);
@@ -105,35 +89,40 @@ let StateMachineToolCallProcessorService = StateMachineToolCallProcessorService_
105
89
  }
106
90
  }
107
91
  updateDocument(ctx, index, document) {
108
- const documents = ctx.state.getMetadata('documents');
92
+ const documents = ctx.getManager().getData('documents');
93
+ document.index = documents.length ?? 0;
109
94
  if (index != -1) {
110
95
  documents[index] = document;
111
96
  }
112
- ctx.state.setMetadata('documents', documents);
113
- ctx.runtime.persistenceState.documentsUpdated = true;
97
+ ctx.getManager().setData('documents', documents);
98
+ ctx.getManager().setData('persistenceState', {
99
+ documentsUpdated: true,
100
+ });
114
101
  }
115
102
  addDocument(ctx, document) {
116
- const documents = ctx.state.getMetadata('documents');
103
+ const documents = ctx.getManager().getData('documents');
117
104
  for (const doc of documents) {
118
105
  if (doc.messageId === document.messageId && doc.meta?.invalidate !== false) {
119
106
  doc.isInvalidated = true;
120
107
  }
121
108
  }
122
109
  documents.push(document);
123
- ctx.state.setMetadata('documents', documents);
124
- ctx.runtime.persistenceState.documentsUpdated = true;
110
+ ctx.getManager().setData('documents', documents);
111
+ ctx.getManager().setData('persistenceState', {
112
+ documentsUpdated: true,
113
+ });
125
114
  }
126
- assignToTargetBlock(block, assign, ctx, result) {
115
+ assignToTargetBlock(ctx, assign, result) {
127
116
  if (assign) {
128
117
  const update = {};
129
118
  for (const [key, value] of Object.entries(assign)) {
130
119
  update[key] = this.templateExpressionEvaluatorService.evaluateTemplateRaw(value, { result }, {
131
- cacheKey: block.constructor.name,
132
- helpers: (0, common_2.getBlockTemplateHelpers)(block),
120
+ cacheKey: ctx.getInstance().constructor.name,
121
+ helpers: (0, common_2.getBlockTemplateHelpers)(ctx.getInstance()),
133
122
  schema: zod_1.z.array(schemas_1.WorkflowTransitionSchema),
134
123
  });
135
124
  }
136
- ctx.state.update(update);
125
+ ctx.getManager().update(update);
137
126
  }
138
127
  }
139
128
  };
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine-tool-call-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAU2B;AAC3B,0DAAwE;AAExE,yCAAkE;AAClE,8DAA2D;AAGpD,IAAM,oCAAoC,4CAA1C,MAAM,oCAAoC;IAGlB;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,sCAAoC,CAAC,IAAI,CAAC,CAAC;IAEhF,YAA6B,kCAAsE;QAAtE,uCAAkC,GAAlC,kCAAkC,CAAoC;IAAG,CAAC;IAEvG,KAAK,CAAC,gBAAgB,CACpB,KAAwB,EACxB,SAAqC,EACrC,IAAS,EACT,GAAsB;QAEtB,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,UAAW,CAAC;QAE3C,MAAM,OAAO,GAAsB,EAAE,CAAC;QACtC,MAAM,WAAW,GAAwB,EAAE,CAA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kC;GAHxF,oCAAoC,CAkLhD"}
1
+ {"version":3,"file":"state-machine-tool-call-processor.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-tool-call-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAQ2B;AAC3B,0DAAwE;AAExE,yCAAkE;AAElE,8DAA2D;AAGpD,IAAM,oCAAoC,4CAA1C,MAAM,oCAAoC;IAGlB;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,sCAAoC,CAAC,IAAI,CAAC,CAAC;IAEhF,YAA6B,kCAAsE;QAAtE,uCAAkC,GAAlC,kCAAkC,CAAoC;IAAG,CAAC;IAEvG,KAAK,CAAC,gBAAgB,CACpB,GAAoC,EACpC,SAAqC;QAErC,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,YAAY,CAAE,CAAC;QAE3D,MAAM,OAAO,GAAsB,EAAE,CAAC;QACtC,MAAM,WAAW,GAAwB,EAAE,CAAC;QAE5C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,CAAC,CAAC;YAEV,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC,IAAI,mBAAmB,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;gBAEtF,MAAM,IAAI,GAAG,IAAA,qBAAY,EAAgB,GAAG,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC3E,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,IAAI,aAAa,CAAC,CAAC;gBAChE,CAAC;gBAED,MAAM,aAAa,GAAG,IAAI,CAAC,kC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,EACL,EAAE,MAAM,EAAE,EACV;oBACE,QAAQ,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,IAAI;oBAC5C,OAAO,EAAE,IAAA,gCAAuB,EAAC,GAAG,CAAC,WAAW,EAAE,CAAC;oBACnD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,kCAAwB,CAAC;iBAC1C,CACF,CAAC;YACJ,CAAC;YAED,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAA;AAvJY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,mBAAU,GAAE;qCAIsD,2CAAkC;GAHxF,oCAAoC,CAuJhD"}
@@ -1,9 +1,10 @@
1
1
  import { StateMachineValidatorResultInterface, WorkflowEntity } from '@loopstack/common';
2
+ import { WorkflowExecutionContextManager } from '../utils/execution-context-manager';
2
3
  import { StateMachineValidatorRegistry } from './state-machine-validator.registry';
3
4
  export declare class StateMachineValidatorService {
4
5
  private readonly stateMachineValidatorRegistry;
5
6
  private readonly logger;
6
7
  constructor(stateMachineValidatorRegistry: StateMachineValidatorRegistry);
7
- validate(workflow: WorkflowEntity, args: Record<string, any> | undefined): StateMachineValidatorResultInterface;
8
+ validate(workflowEntity: WorkflowEntity, ctx: WorkflowExecutionContextManager): StateMachineValidatorResultInterface;
8
9
  }
9
10
  //# sourceMappingURL=state-machine-validator.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine-validator.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-validator.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,qBACa,4BAA4B;IAG3B,OAAO,CAAC,QAAQ,CAAC,6BAA6B;IAF1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;gBAE3C,6BAA6B,EAAE,6BAA6B;IAEzF,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,oCAAoC;CAmBhH"}
1
+ {"version":3,"file":"state-machine-validator.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-validator.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oCAAoC,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,qBACa,4BAA4B;IAG3B,OAAO,CAAC,QAAQ,CAAC,6BAA6B;IAF1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;gBAE3C,6BAA6B,EAAE,6BAA6B;IAEzF,QAAQ,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,+BAA+B,GAAG,oCAAoC;CAmBrH"}
@@ -19,10 +19,10 @@ let StateMachineValidatorService = StateMachineValidatorService_1 = class StateM
19
19
  constructor(stateMachineValidatorRegistry) {
20
20
  this.stateMachineValidatorRegistry = stateMachineValidatorRegistry;
21
21
  }
22
- validate(workflow, args) {
22
+ validate(workflowEntity, ctx) {
23
23
  const validationResults = this.stateMachineValidatorRegistry
24
24
  .getValidators()
25
- .map((validator) => validator.validate(workflow, args));
25
+ .map((validator) => validator.validate(workflowEntity, ctx.getArgs()));
26
26
  return {
27
27
  valid: validationResults.every((item) => item.valid),
28
28
  hashRecordUpdates: validationResults.reduce((prev, curr) => {
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine-validator.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-validator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAEpD,yFAAmF;AAG5E,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAGV;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC,IAAI,CAAC,CAAC;IAExE,YAA6B,6BAA4D;QAA5D,kCAA6B,GAA7B,6BAA6B,CAA+B;IAAG,CAAC;IAE7F,QAAQ,CAAC,QAAwB,EAAE,IAAqC;QACtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,6BAA6B;aACzD,aAAa,EAAE;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;QAE1D,OAAO;YACL,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACpD,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;gBACzD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC7B,OAAO;wBACL,GAAG,IAAI;wBACP,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI;qBACzB,CAAC;gBACJ,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EAAE,EAAE,CAAC;SACP,CAAC;IACJ,CAAC;CACF,CAAA;AAxBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;qCAIiD,gEAA6B;GAH9E,4BAA4B,CAwBxC"}
1
+ {"version":3,"file":"state-machine-validator.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/state-machine-validator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AAGpD,yFAAmF;AAG5E,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IAGV;IAFZ,MAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC,IAAI,CAAC,CAAC;IAExE,YAA6B,6BAA4D;QAA5D,kCAA6B,GAA7B,6BAA6B,CAA+B;IAAG,CAAC;IAE7F,QAAQ,CAAC,cAA8B,EAAE,GAAoC;QAC3E,MAAM,iBAAiB,GAAG,IAAI,CAAC,6BAA6B;aACzD,aAAa,EAAE;aACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAEzE,OAAO;YACL,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACpD,iBAAiB,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;gBACzD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBAC7B,OAAO;wBACL,GAAG,IAAI;wBACP,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI;qBACzB,CAAC;gBACJ,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EAAE,EAAE,CAAC;SACP,CAAC;IACJ,CAAC;CACF,CAAA;AAxBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;qCAIiD,gEAA6B;GAH9E,4BAA4B,CAwBxC"}
@@ -1,10 +1,11 @@
1
- import { BlockExecutionContextDto, PersistenceState, WorkflowEntity, WorkflowExecution, WorkflowInterface } from '@loopstack/common';
1
+ import { PersistenceState, RunContext, WorkflowEntity, WorkflowInterface } from '@loopstack/common';
2
2
  import { WorkflowService } from '../../persistence';
3
+ import { WorkflowExecutionContextManager } from '../utils/execution-context-manager';
3
4
  export declare class WorkflowStateService {
4
5
  private workflowService;
5
6
  constructor(workflowService: WorkflowService);
6
- getWorkflowState(block: WorkflowInterface, context: BlockExecutionContextDto): Promise<WorkflowEntity>;
7
+ getWorkflowState(block: WorkflowInterface, context: RunContext): Promise<WorkflowEntity>;
7
8
  saveWorkflowState(entity: WorkflowEntity, persistenceState: PersistenceState): Promise<void>;
8
- saveExecutionState(ctx: WorkflowExecution): Promise<void>;
9
+ saveExecutionState(workflowEntity: WorkflowEntity, ctx: WorkflowExecutionContextManager): Promise<void>;
9
10
  }
10
11
  //# sourceMappingURL=workflow-state.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-state.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,qBACa,oBAAoB;IACnB,OAAO,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAE9C,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BtG,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI5E,kBAAkB,CAAC,GAAG,EAAE,iBAAiB;CAWhD"}
1
+ {"version":3,"file":"workflow-state.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAkB,MAAM,mBAAmB,CAAC;AAEpH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAErF,qBACa,oBAAoB;IACnB,OAAO,CAAC,eAAe;gBAAf,eAAe,EAAE,eAAe;IAE9C,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BxF,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB;IAI5E,kBAAkB,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,+BAA+B;CAY9F"}
@@ -45,13 +45,16 @@ let WorkflowStateService = class WorkflowStateService {
45
45
  async saveWorkflowState(entity, persistenceState) {
46
46
  return this.workflowService.save(entity, persistenceState);
47
47
  }
48
- async saveExecutionState(ctx) {
49
- ctx.entity.history = ctx.state.serialize();
50
- ctx.entity.place = ctx.state.getMetadata('place');
51
- ctx.entity.documents = ctx.state.getMetadata('documents');
52
- ctx.entity.availableTransitions = ctx.runtime.availableTransitions || null;
53
- ctx.entity.hasError = ctx.runtime.error;
54
- await this.saveWorkflowState(ctx.entity, ctx.runtime.persistenceState);
48
+ async saveExecutionState(workflowEntity, ctx) {
49
+ workflowEntity.status = ctx.getManager().getData('status');
50
+ workflowEntity.history = ctx.getManager().serialize();
51
+ workflowEntity.place = ctx.getManager().getData('place');
52
+ workflowEntity.documents = ctx.getManager().getData('documents');
53
+ workflowEntity.availableTransitions = ctx.getManager().getData('availableTransitions') || null;
54
+ workflowEntity.hasError = ctx.getManager().getData('error');
55
+ workflowEntity.errorMessage = ctx.getManager().getData('errorMessage') || null;
56
+ workflowEntity.result = ctx.getManager().getData('result');
57
+ await this.saveWorkflowState(workflowEntity, ctx.getManager().getData('persistenceState'));
55
58
  }
56
59
  };
57
60
  exports.WorkflowStateService = WorkflowStateService;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-state.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,8CAO2B;AAE3B,mDAAoD;AAG7C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACX;IAApB,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD,KAAK,CAAC,gBAAgB,CAAC,KAAwB,EAAE,OAAiC;QAChF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K,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAClD,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAC1D,GAAG,CAAC,MAAM,CAAC,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAAC,oBAAoB,IAAI,IAAI,CAAC;QAC3E,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;QAExC,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACzE,CAAC;CACF,CAAA;AA9CY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE0B,6BAAe;GADzC,oBAAoB,CA8ChC"}
1
+ {"version":3,"file":"workflow-state.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,8CAAoH;AAEpH,mDAAoD;AAI7C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACX;IAApB,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD,KAAK,CAAC,gBAAgB,CAAC,KAAwB,EAAE,OAAmB;QAClE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE;YAChF,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI;YACjC,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAe,KAAK,CAAiB,CAAC;QACnE,IAAI,CAAC,M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AC;QAC/F,cAAc,CAAC,QAAQ,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5D,cAAc,CAAC,YAAY,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC;QAC/E,cAAc,CAAC,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,QAAQ,CAA4B,CAAC;QAEtF,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC7F,CAAC;CACF,CAAA;AA/CY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAE0B,6BAAe;GADzC,oBAAoB,CA+ChC"}
@@ -0,0 +1,26 @@
1
+ import { BlockInterface, ContextMetadata, InputMetadata, RunContext, RuntimeMetadata, StateMetadata, WorkflowInterface, WorkflowMetadataInterface } from '@loopstack/common';
2
+ import { StateManager } from './state/state-manager';
3
+ export type WorkflowExecutionContextManager = ExecutionContextManager<any, any, WorkflowMetadataInterface>;
4
+ export type InstanceMetadataInfo = {
5
+ state?: StateMetadata;
6
+ args?: InputMetadata;
7
+ context?: ContextMetadata;
8
+ runtime?: RuntimeMetadata;
9
+ };
10
+ export declare class ExecutionContextManager<TInput = any, TState = any, TMetadata = any> {
11
+ private readonly _context;
12
+ private readonly _args;
13
+ private readonly _stateManager?;
14
+ protected _wrappedInstance: WorkflowInterface;
15
+ protected _blockMetadata: InstanceMetadataInfo;
16
+ constructor(instance: BlockInterface, _context: RunContext, _args: TInput, _stateManager?: StateManager<TState, TMetadata> | undefined);
17
+ getArgs(): Readonly<TInput>;
18
+ getContext(): RunContext;
19
+ getMetadata(): InstanceMetadataInfo;
20
+ getInstance(): WorkflowInterface;
21
+ getManager(): StateManager<TState, TMetadata>;
22
+ getData(): Readonly<TMetadata>;
23
+ getState(): Readonly<TState>;
24
+ setState(newState: TState): void;
25
+ }
26
+ //# sourceMappingURL=execution-context-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context-manager.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/utils/execution-context-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,UAAU,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,yBAAyB,EAK1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,MAAM,MAAM,+BAA+B,GAAG,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,yBAAyB,CAAC,CAAC;AAE3G,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,CAAC;AAEF,qBAAa,uBAAuB,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,SAAS,GAAG,GAAG;IAM5E,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAPjC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAC9C,SAAS,CAAC,cAAc,EAAE,oBAAoB,CAAC;gBAG7C,QAAQ,EAAE,cAAc,EACP,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,YAAA;IAiBlE,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC;IAI3B,UAAU,IAAI,UAAU;IAIxB,WAAW,IAAI,oBAAoB;IAInC,WAAW,IAAI,iBA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