@loopstack/core 0.2.0 → 0.3.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 (141) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/modules/common/common.module.js +10 -15
  3. package/dist/modules/common/common.module.js.map +1 -1
  4. package/dist/modules/common/errors/object-expression.error.d.ts +4 -0
  5. package/dist/modules/common/errors/object-expression.error.js +13 -0
  6. package/dist/modules/common/errors/object-expression.error.js.map +1 -0
  7. package/dist/modules/common/errors/template-expression.error.d.ts +4 -0
  8. package/dist/modules/common/errors/template-expression.error.js +13 -0
  9. package/dist/modules/common/errors/template-expression.error.js.map +1 -0
  10. package/dist/modules/common/services/context.service.d.ts +1 -0
  11. package/dist/modules/common/services/context.service.js +4 -0
  12. package/dist/modules/common/services/context.service.js.map +1 -1
  13. package/dist/modules/common/services/expression-handler/object-expression.handler.d.ts +20 -0
  14. package/dist/modules/common/services/expression-handler/object-expression.handler.js +125 -0
  15. package/dist/modules/common/services/expression-handler/object-expression.handler.js.map +1 -0
  16. package/dist/modules/common/services/expression-handler/template-expression.handler.d.ts +12 -0
  17. package/dist/modules/common/services/expression-handler/template-expression.handler.js +63 -0
  18. package/dist/modules/common/services/expression-handler/template-expression.handler.js.map +1 -0
  19. package/dist/modules/common/services/handlebars-helpers/comparison-handlebars-helper.service.d.ts +41 -0
  20. package/dist/modules/common/services/handlebars-helpers/comparison-handlebars-helper.service.js +416 -0
  21. package/dist/modules/common/services/handlebars-helpers/comparison-handlebars-helper.service.js.map +1 -0
  22. package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.d.ts +9 -0
  23. package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.js +124 -0
  24. package/dist/modules/common/services/handlebars-helpers/date-formatter-handlebars-helper.service.js.map +1 -0
  25. package/dist/modules/common/services/handlebars-helpers/date-formatter-helper.service.d.ts +9 -0
  26. package/dist/modules/common/services/handlebars-helpers/date-formatter-helper.service.js +124 -0
  27. package/dist/modules/common/services/handlebars-helpers/date-formatter-helper.service.js.map +1 -0
  28. package/dist/modules/common/services/handlebars-helpers/index.d.ts +2 -0
  29. package/dist/modules/common/services/handlebars-helpers/index.js +19 -0
  30. package/dist/modules/common/services/handlebars-helpers/index.js.map +1 -0
  31. package/dist/modules/common/services/handlebars-helpers/operators-helper.service.d.ts +41 -0
  32. package/dist/modules/common/services/handlebars-helpers/operators-helper.service.js +416 -0
  33. package/dist/modules/common/services/handlebars-helpers/operators-helper.service.js.map +1 -0
  34. package/dist/modules/common/services/handlebars-processor.service.d.ts +13 -0
  35. package/dist/modules/common/services/handlebars-processor.service.js +138 -0
  36. package/dist/modules/common/services/handlebars-processor.service.js.map +1 -0
  37. package/dist/modules/common/services/index.d.ts +6 -5
  38. package/dist/modules/common/services/index.js +6 -5
  39. package/dist/modules/common/services/index.js.map +1 -1
  40. package/dist/modules/common/services/template.service.d.ts +16 -0
  41. package/dist/modules/common/services/template.service.js +64 -0
  42. package/dist/modules/common/services/template.service.js.map +1 -0
  43. package/dist/modules/common/services/variable-sanitizer.service.d.ts +9 -0
  44. package/dist/modules/common/services/variable-sanitizer.service.js +84 -0
  45. package/dist/modules/common/services/variable-sanitizer.service.js.map +1 -0
  46. package/dist/modules/configuration/configuration.module.js +2 -1
  47. package/dist/modules/configuration/configuration.module.js.map +1 -1
  48. package/dist/modules/configuration/services/configuration.service.d.ts +15 -13
  49. package/dist/modules/configuration/services/configuration.service.js +97 -96
  50. package/dist/modules/configuration/services/configuration.service.js.map +1 -1
  51. package/dist/modules/configuration/services/index.d.ts +1 -0
  52. package/dist/modules/configuration/services/index.js +1 -0
  53. package/dist/modules/configuration/services/index.js.map +1 -1
  54. package/dist/modules/configuration/services/schema-registry.service.d.ts +9 -0
  55. package/dist/modules/configuration/services/schema-registry.service.js +41 -0
  56. package/dist/modules/configuration/services/schema-registry.service.js.map +1 -0
  57. package/dist/modules/persistence/services/document.service.d.ts +5 -1
  58. package/dist/modules/persistence/services/document.service.js +27 -15
  59. package/dist/modules/persistence/services/document.service.js.map +1 -1
  60. package/dist/modules/workflow-processor/services/index.d.ts +2 -1
  61. package/dist/modules/workflow-processor/services/index.js +2 -1
  62. package/dist/modules/workflow-processor/services/index.js.map +1 -1
  63. package/dist/modules/workflow-processor/services/pipeline-processor.service.d.ts +9 -8
  64. package/dist/modules/workflow-processor/services/pipeline-processor.service.js +92 -52
  65. package/dist/modules/workflow-processor/services/pipeline-processor.service.js.map +1 -1
  66. package/dist/modules/workflow-processor/services/root-processor.service.d.ts +2 -2
  67. package/dist/modules/workflow-processor/services/root-processor.service.js +1 -0
  68. package/dist/modules/workflow-processor/services/root-processor.service.js.map +1 -1
  69. package/dist/modules/workflow-processor/services/service-execution.service.d.ts +12 -0
  70. package/dist/modules/workflow-processor/services/service-execution.service.js +53 -0
  71. package/dist/modules/workflow-processor/services/service-execution.service.js.map +1 -0
  72. package/dist/modules/workflow-processor/services/state-machine-config.service.d.ts +2 -17
  73. package/dist/modules/workflow-processor/services/state-machine-config.service.js +33 -17
  74. package/dist/modules/workflow-processor/services/state-machine-config.service.js.map +1 -1
  75. package/dist/modules/workflow-processor/services/state-machine-processor.service.d.ts +11 -7
  76. package/dist/modules/workflow-processor/services/state-machine-processor.service.js +90 -24
  77. package/dist/modules/workflow-processor/services/state-machine-processor.service.js.map +1 -1
  78. package/dist/modules/workflow-processor/services/template-expression-evaluator.service.d.ts +24 -4
  79. package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js +90 -21
  80. package/dist/modules/workflow-processor/services/template-expression-evaluator.service.js.map +1 -1
  81. package/dist/modules/workflow-processor/services/tool-execution.service.d.ts +8 -20
  82. package/dist/modules/workflow-processor/services/tool-execution.service.js +31 -55
  83. package/dist/modules/workflow-processor/services/tool-execution.service.js.map +1 -1
  84. package/dist/modules/workflow-processor/services/workflow-context.service.d.ts +4 -0
  85. package/dist/modules/{common/services/template-engine.service.js → workflow-processor/services/workflow-context.service.js} +12 -15
  86. package/dist/modules/workflow-processor/services/workflow-context.service.js.map +1 -0
  87. package/dist/modules/workflow-processor/services/workflow-processor.service.d.ts +2 -2
  88. package/dist/modules/workflow-processor/services/workflow-processor.service.js +12 -8
  89. package/dist/modules/workflow-processor/services/workflow-processor.service.js.map +1 -1
  90. package/dist/modules/workflow-processor/services/workflow-state.service.d.ts +2 -2
  91. package/dist/modules/workflow-processor/services/workflow-state.service.js +5 -5
  92. package/dist/modules/workflow-processor/services/workflow-state.service.js.map +1 -1
  93. package/dist/modules/workflow-processor/tool-services/add-namespace.service.js +4 -4
  94. package/dist/modules/workflow-processor/tool-services/add-namespace.service.js.map +1 -1
  95. package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.d.ts +4 -8
  96. package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.js +38 -26
  97. package/dist/modules/workflow-processor/tool-services/batch-create-documents.service.js.map +1 -1
  98. package/dist/modules/workflow-processor/tool-services/create-document.service.d.ts +17 -138
  99. package/dist/modules/workflow-processor/tool-services/create-document.service.js +83 -31
  100. package/dist/modules/workflow-processor/tool-services/create-document.service.js.map +1 -1
  101. package/dist/modules/workflow-processor/tool-services/load-document.service.d.ts +61 -51
  102. package/dist/modules/workflow-processor/tool-services/load-document.service.js +57 -79
  103. package/dist/modules/workflow-processor/tool-services/load-document.service.js.map +1 -1
  104. package/dist/modules/workflow-processor/tool-services/mock.service.d.ts +11 -8
  105. package/dist/modules/workflow-processor/tool-services/mock.service.js +41 -9
  106. package/dist/modules/workflow-processor/tool-services/mock.service.js.map +1 -1
  107. package/dist/modules/workflow-processor/tool-services/set-context.service.d.ts +3 -0
  108. package/dist/modules/workflow-processor/tool-services/set-context.service.js +11 -5
  109. package/dist/modules/workflow-processor/tool-services/set-context.service.js.map +1 -1
  110. package/dist/modules/workflow-processor/tool-services/set-target-place.service.js +7 -6
  111. package/dist/modules/workflow-processor/tool-services/set-target-place.service.js.map +1 -1
  112. package/dist/modules/workflow-processor/tool-services/transition-selector.service.js +2 -2
  113. package/dist/modules/workflow-processor/tool-services/transition-selector.service.js.map +1 -1
  114. package/dist/modules/workflow-processor/tool-services/update-document.service.d.ts +32 -55
  115. package/dist/modules/workflow-processor/tool-services/update-document.service.js +92 -7
  116. package/dist/modules/workflow-processor/tool-services/update-document.service.js.map +1 -1
  117. package/dist/modules/workflow-processor/validators/workflow-option.validator.d.ts +1 -1
  118. package/dist/modules/workflow-processor/validators/workflow-option.validator.js +3 -3
  119. package/dist/modules/workflow-processor/validators/workflow-option.validator.js.map +1 -1
  120. package/dist/modules/workflow-processor/workflow-processor.module.js +2 -1
  121. package/dist/modules/workflow-processor/workflow-processor.module.js.map +1 -1
  122. package/dist/utils/load-configuration.js +5 -3
  123. package/dist/utils/load-configuration.js.map +1 -1
  124. package/package.json +5 -3
  125. package/dist/modules/common/services/document-helper.service.d.ts +0 -198
  126. package/dist/modules/common/services/document-helper.service.js +0 -53
  127. package/dist/modules/common/services/document-helper.service.js.map +0 -1
  128. package/dist/modules/common/services/expression-evaluator.service.d.ts +0 -5
  129. package/dist/modules/common/services/expression-evaluator.service.js +0 -44
  130. package/dist/modules/common/services/expression-evaluator.service.js.map +0 -1
  131. package/dist/modules/common/services/schema-validator.service.d.ts +0 -7
  132. package/dist/modules/common/services/schema-validator.service.js +0 -41
  133. package/dist/modules/common/services/schema-validator.service.js.map +0 -1
  134. package/dist/modules/common/services/template-engine.service.d.ts +0 -5
  135. package/dist/modules/common/services/template-engine.service.js.map +0 -1
  136. package/dist/modules/common/services/value-parser.service.d.ts +0 -19
  137. package/dist/modules/common/services/value-parser.service.js +0 -68
  138. package/dist/modules/common/services/value-parser.service.js.map +0 -1
  139. package/dist/modules/workflow-processor/services/tool-schema-validator.service.d.ts +0 -5
  140. package/dist/modules/workflow-processor/services/tool-schema-validator.service.js +0 -41
  141. package/dist/modules/workflow-processor/services/tool-schema-validator.service.js.map +0 -1
@@ -6,22 +6,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.TemplateEngineService = void 0;
9
+ exports.WorkflowContextService = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
- const ejs = require('ejs');
12
- let TemplateEngineService = class TemplateEngineService {
13
- isTemplate(value) {
14
- return typeof value === 'string' && value.indexOf('<%') !== -1;
15
- }
16
- render(template, variables) {
17
- return ejs.render(template, variables);
18
- }
19
- evaluate(value, variables) {
20
- return this.isTemplate(value) ? this.render(value, variables) : value;
11
+ let WorkflowContextService = class WorkflowContextService {
12
+ setWorkflowContextUpdate(workflow, key, value) {
13
+ if (!workflow.contextVariables) {
14
+ workflow.contextVariables = {};
15
+ }
16
+ workflow.contextVariables[key] = value;
17
+ return workflow;
21
18
  }
22
19
  };
23
- exports.TemplateEngineService = TemplateEngineService;
24
- exports.TemplateEngineService = TemplateEngineService = __decorate([
20
+ exports.WorkflowContextService = WorkflowContextService;
21
+ exports.WorkflowContextService = WorkflowContextService = __decorate([
25
22
  (0, common_1.Injectable)()
26
- ], TemplateEngineService);
27
- //# sourceMappingURL=template-engine.service.js.map
23
+ ], WorkflowContextService);
24
+ //# sourceMappingURL=workflow-context.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-context.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/services/workflow-context.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,wBAAwB,CACtB,QAAwB,EACxB,GAAW,EACX,KAAU;QAEV,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;YAC/B,QAAQ,CAAC,gBAAgB,GAAG,EAAE,CAAC;QACjC,CAAC;QAED,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACvC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AAbY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CAalC"}
@@ -1,10 +1,10 @@
1
1
  import { StateMachineProcessorService } from './state-machine-processor.service';
2
- import { ContextInterface, WorkflowType } from '@loopstack/shared';
2
+ import { ContextInterface, ConfigElement, WorkflowType } from '@loopstack/shared';
3
3
  import { WorkflowStateService } from './workflow-state.service';
4
4
  export declare class WorkflowProcessorService {
5
5
  private workflowConfigService;
6
6
  private stateMachineProcessorService;
7
7
  private readonly logger;
8
8
  constructor(workflowConfigService: WorkflowStateService, stateMachineProcessorService: StateMachineProcessorService);
9
- runStateMachineType(config: WorkflowType, context: ContextInterface): Promise<ContextInterface>;
9
+ runStateMachineType(configElement: ConfigElement<WorkflowType>, context: ContextInterface): Promise<ContextInterface>;
10
10
  }
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.WorkflowProcessorService = void 0;
14
14
  const common_1 = require("@nestjs/common");
15
15
  const state_machine_processor_service_1 = require("./state-machine-processor.service");
16
+ const shared_1 = require("@loopstack/shared");
16
17
  const workflow_state_service_1 = require("./workflow-state.service");
17
18
  let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProcessorService {
18
19
  workflowConfigService;
@@ -22,17 +23,20 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
22
23
  this.workflowConfigService = workflowConfigService;
23
24
  this.stateMachineProcessorService = stateMachineProcessorService;
24
25
  }
25
- async runStateMachineType(config, context) {
26
- const currentWorkflow = await this.workflowConfigService.getWorkflowState(config, context);
27
- const workflow = await this.stateMachineProcessorService.processStateMachine(context, currentWorkflow, config);
28
- if (workflow.place !== 'end') {
26
+ async runStateMachineType(configElement, context) {
27
+ const currentWorkflow = await this.workflowConfigService.getWorkflowState(configElement, context);
28
+ const workflow = await this.stateMachineProcessorService.processStateMachine(context, currentWorkflow, configElement);
29
+ if (workflow.status === shared_1.WorkflowState.Failed) {
30
+ context.error = true;
31
+ }
32
+ if (context.error || workflow.place !== 'end') {
29
33
  context.stop = true;
30
34
  }
31
35
  else {
32
- if (workflow.contextUpdate) {
33
- context.custom = {
34
- ...context.custom,
35
- ...workflow.contextUpdate,
36
+ if (workflow.contextVariables) {
37
+ context.variables = {
38
+ ...context.variables,
39
+ ...workflow.contextVariables,
36
40
  };
37
41
  }
38
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-processor.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/services/workflow-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uFAAiF;AAEjF,qEAAgE;AAGzD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAIzB;IACA;IAJO,MAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAEpE,YACU,qBAA2C,EAC3C,4BAA0D;QAD1D,0BAAqB,GAArB,qBAAqB,CAAsB;QAC3C,iCAA4B,GAA5B,4BAA4B,CAA8B;IACjE,CAAC;IAEJ,KAAK,CAAC,mBAAmB,CAAC,MAAoB,EAAE,OAAyB;QAEvE,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CACvE,MAAM,EACN,OAAO,CACR,CAAC;QAEF,MAAM,QAAQ,GACZ,MAAM,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CACzD,OAAO,EACP,eAAe,EACf,MAAM,CACP,CAAC;QAEJ,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,CAAC;aAAM,CAAC;YAEN,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;gBAC3B,OAAO,CAAC,MAAM,GAAG;oBACf,GAAG,OAAO,CAAC,MAAM;oBACjB,GAAG,QAAQ,CAAC,aAAa;iBAC1B,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AApCY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAKsB,6CAAoB;QACb,8DAA4B;GALzD,wBAAwB,CAoCpC"}
1
+ {"version":3,"file":"workflow-processor.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/services/workflow-processor.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uFAAiF;AACjF,8CAK2B;AAC3B,qEAAgE;AAGzD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAIzB;IACA;IAJO,MAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAC;IAEpE,YACU,qBAA2C,EAC3C,4BAA0D;QAD1D,0BAAqB,GAArB,qBAAqB,CAAsB;QAC3C,iCAA4B,GAA5B,4BAA4B,CAA8B;IACjE,CAAC;IAEJ,KAAK,CAAC,mBAAmB,CACvB,aAA0C,EAC1C,OAAyB;QAGzB,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CACvE,aAAa,EACb,OAAO,CACR,CAAC;QAEF,MAAM,QAAQ,GACZ,MAAM,IAAI,CAAC,4BAA4B,CAAC,mBAAmB,CACzD,OAAO,EACP,eAAe,EACf,aAAa,CACd,CAAC;QAEJ,IAAI,QAAQ,CAAC,MAAM,KAAK,sBAAa,CAAC,MAAM,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACvB,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACtB,CAAC;aAAM,CAAC;YAEN,IAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC;gBAC9B,OAAO,CAAC,SAAS,GAAG;oBAClB,GAAG,OAAO,CAAC,SAAS;oBACpB,GAAG,QAAQ,CAAC,gBAAgB;iBAC7B,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AA3CY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAKsB,6CAAoB;QACb,8DAA4B;GALzD,wBAAwB,CA2CpC"}
@@ -1,8 +1,8 @@
1
1
  import { WorkflowService } from '../../persistence';
2
- import { ContextInterface, WorkflowEntity, WorkflowType } from '@loopstack/shared';
2
+ import { ConfigElement, ContextInterface, WorkflowEntity, WorkflowType } from '@loopstack/shared';
3
3
  export declare class WorkflowStateService {
4
4
  private workflowService;
5
5
  private readonly logger;
6
6
  constructor(workflowService: WorkflowService);
7
- getWorkflowState(workflowConfig: WorkflowType, context: ContextInterface): Promise<WorkflowEntity>;
7
+ getWorkflowState(configElement: ConfigElement<WorkflowType>, context: ContextInterface): Promise<WorkflowEntity>;
8
8
  }
@@ -19,10 +19,10 @@ let WorkflowStateService = WorkflowStateService_1 = class WorkflowStateService {
19
19
  constructor(workflowService) {
20
20
  this.workflowService = workflowService;
21
21
  }
22
- async getWorkflowState(workflowConfig, context) {
22
+ async getWorkflowState(configElement, context) {
23
23
  const workflow = await this.workflowService
24
24
  .createFindQuery(context.namespace?.id, {
25
- name: workflowConfig.name,
25
+ name: configElement.name,
26
26
  labels: context.labels,
27
27
  })
28
28
  .getOne();
@@ -34,9 +34,9 @@ let WorkflowStateService = WorkflowStateService_1 = class WorkflowStateService {
34
34
  labels: context.labels,
35
35
  namespace: context.namespace ?? undefined,
36
36
  pipelineId: context.pipelineId,
37
- name: workflowConfig.name,
38
- title: workflowConfig.title ?? workflowConfig.name,
39
- ui: workflowConfig.ui ?? null,
37
+ name: configElement.name,
38
+ title: configElement.config.title ?? configElement.name,
39
+ ui: configElement.config.ui ?? null,
40
40
  index: context.index,
41
41
  });
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-state.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mDAAoD;AAQ7C,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAGX;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAEhE,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD,KAAK,CAAC,gBAAgB,CACpB,cAA4B,EAC5B,OAAyB;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe;aACxC,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE;YACtC,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;aACD,MAAM,EAAE,CAAC;QAEZ,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;YACjC,SAAS,EAAE,OAAO,CAAC,MAAM;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,SAAS;YACzC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,KAAK,EAAE,cAAc,CAAC,KAAK,IAAI,cAAc,CAAC,IAAI;YAClD,EAAE,EAAE,cAAc,CAAC,EAAE,IAAI,IAAI;YAC7B,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA/BY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAI0B,6BAAe;GAHzC,oBAAoB,CA+BhC"}
1
+ {"version":3,"file":"workflow-state.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/services/workflow-state.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mDAAoD;AAS7C,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IAGX;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAEhE,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD,KAAK,CAAC,gBAAgB,CACpB,aAA0C,EAC1C,OAAyB;QAEzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe;aACxC,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE;YACtC,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;aACD,MAAM,EAAE,CAAC;QAEZ,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;YACjC,SAAS,EAAE,OAAO,CAAC,MAAM;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,SAAS;YACzC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC,IAAI;YACvD,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI;YACnC,KAAK,EAAE,OAAO,CAAC,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA/BY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;qCAI0B,6BAAe;GAHzC,oBAAoB,CA+BhC"}
@@ -41,12 +41,12 @@ let AddNamespaceService = AddNamespaceService_1 = class AddNamespaceService {
41
41
  createdBy: context.userId,
42
42
  parent: context.namespace,
43
43
  });
44
- if (!workflow.contextUpdate) {
45
- workflow.contextUpdate = {};
44
+ if (!workflow.contextVariables) {
45
+ workflow.contextVariables = {};
46
46
  }
47
47
  const contextLabels = context.labels;
48
- const workflowLabels = workflow.contextUpdate.labels ?? [];
49
- workflow.contextUpdate.labels = [
48
+ const workflowLabels = workflow.contextVariables.labels ?? [];
49
+ workflow.contextVariables.labels = [
50
50
  ...contextLabels,
51
51
  ...workflowLabels,
52
52
  namespace.name,
@@ -1 +1 @@
1
- {"version":3,"file":"add-namespace.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/add-namespace.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAQ2B;AAC3B,mDAAsD;AAEtD,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,yBAAgB,CAAC,CAAC;IAC9C,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACzB,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,MAAM,GAAG,6BAAoB,CAAC,MAAM,EAAE,CAAC;AAOtC,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAGV;IAFH,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/D,YAAoB,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAE5D,KAAK,CAAC,KAAK,CACT,KAA6B,EAC7B,QAAoC,EACpC,OAAyB;QAEzB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;YACpD,IAAI,EAAE,KAAK,CAAC,KAAK;YACjB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,KAAK,CAAC,IAAI;YACpB,SAAS,EAAE,OAAO,CAAC,MAAM;YACzB,MAAM,EAAE,OAAO,CAAC,SAAS;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;YAC5B,QAAQ,CAAC,aAAa,GAAG,EAAE,CAAC;QAC9B,CAAC;QAED,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACrC,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC;QAE3D,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG;YAC9B,GAAG,aAAa;YAChB,GAAG,cAAc;YACjB,SAAS,CAAC,IAAI;SACf,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,SAAS,CAAC,IAAI,IAAI,CAAC,CAAC;QAE9D,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;CACF,CAAA;AA3CY,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAIuC,+BAAiB;GAH7C,mBAAmB,CA2C/B"}
1
+ {"version":3,"file":"add-namespace.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/add-namespace.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6BAAwB;AACxB,8CAQ2B;AAC3B,mDAAsD;AAEtD,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,yBAAgB,CAAC,CAAC;IAC9C,IAAI,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC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CAAC,CAAC;QAE9D,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;SACT,CAAC;IACJ,CAAC;CACF,CAAA;AA3CY,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAIuC,+BAAiB;GAH7C,mBAAmB,CA2C/B"}
@@ -1,6 +1,5 @@
1
1
  import { ContextInterface, ServiceInterface, ServiceCallResult, TransitionMetadataInterface } from '@loopstack/shared';
2
- import { SchemaValidatorService } from '../../common';
3
- import { ConfigurationService } from '../../configuration';
2
+ import { ConfigurationService, SchemaRegistry } from '../../configuration';
4
3
  import { z } from 'zod';
5
4
  import { WorkflowEntity } from '@loopstack/shared';
6
5
  import { DocumentService } from '../../persistence';
@@ -8,26 +7,23 @@ import { TemplateExpressionEvaluatorService } from '../services';
8
7
  declare const schema: z.ZodObject<{
9
8
  document: z.ZodString;
10
9
  name: z.ZodOptional<z.ZodString>;
11
- addSuffix: z.ZodOptional<z.ZodBoolean>;
12
10
  items: z.ZodArray<z.ZodAny, "many">;
13
11
  }, "strict", z.ZodTypeAny, {
14
12
  document: string;
15
13
  items: any[];
16
14
  name?: string | undefined;
17
- addSuffix?: boolean | undefined;
18
15
  }, {
19
16
  document: string;
20
17
  items: any[];
21
18
  name?: string | undefined;
22
- addSuffix?: boolean | undefined;
23
19
  }>;
24
20
  export declare class BatchCreateDocumentsService implements ServiceInterface {
25
- private actionHelperService;
26
21
  private loopConfigService;
27
22
  private documentService;
28
23
  private templateExpressionEvaluatorService;
24
+ private schemaRegistry;
29
25
  private readonly logger;
30
- constructor(actionHelperService: SchemaValidatorService, loopConfigService: ConfigurationService, documentService: DocumentService, templateExpressionEvaluatorService: TemplateExpressionEvaluatorService);
31
- apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface, transitionData: TransitionMetadataInterface): Promise<ServiceCallResult>;
26
+ constructor(loopConfigService: ConfigurationService, documentService: DocumentService, templateExpressionEvaluatorService: TemplateExpressionEvaluatorService, schemaRegistry: SchemaRegistry);
27
+ apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface, transitionData: TransitionMetadataInterface, parentArguments: any): Promise<ServiceCallResult>;
32
28
  }
33
29
  export {};
@@ -13,7 +13,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.BatchCreateDocumentsService = void 0;
14
14
  const common_1 = require("@nestjs/common");
15
15
  const shared_1 = require("@loopstack/shared");
16
- const common_2 = require("../../common");
17
16
  const configuration_1 = require("../../configuration");
18
17
  const zod_1 = require("zod");
19
18
  const persistence_1 = require("../../persistence");
@@ -22,57 +21,70 @@ const services_1 = require("../services");
22
21
  const config = zod_1.z
23
22
  .object({
24
23
  document: zod_1.z.string(),
25
- name: zod_1.z.union([shared_1.ExpressionString, shared_1.NonExpressionString]).optional(),
26
- addSuffix: zod_1.z.union([shared_1.ExpressionString, zod_1.z.boolean()]).optional(),
24
+ name: zod_1.z.string().optional(),
27
25
  items: zod_1.z.union([shared_1.ExpressionString, zod_1.z.array(zod_1.z.any())]),
28
26
  })
29
27
  .strict();
30
28
  const schema = zod_1.z
31
29
  .object({
32
30
  document: zod_1.z.string(),
33
- name: shared_1.NonExpressionString.optional(),
34
- addSuffix: zod_1.z.boolean().optional(),
31
+ name: zod_1.z.string().optional(),
35
32
  items: zod_1.z.array(zod_1.z.any()),
36
33
  })
37
34
  .strict();
38
35
  let BatchCreateDocumentsService = BatchCreateDocumentsService_1 = class BatchCreateDocumentsService {
39
- actionHelperService;
40
36
  loopConfigService;
41
37
  documentService;
42
38
  templateExpressionEvaluatorService;
39
+ schemaRegistry;
43
40
  logger = new common_1.Logger(BatchCreateDocumentsService_1.name);
44
- constructor(actionHelperService, loopConfigService, documentService, templateExpressionEvaluatorService) {
45
- this.actionHelperService = actionHelperService;
41
+ constructor(loopConfigService, documentService, templateExpressionEvaluatorService, schemaRegistry) {
46
42
  this.loopConfigService = loopConfigService;
47
43
  this.documentService = documentService;
48
44
  this.templateExpressionEvaluatorService = templateExpressionEvaluatorService;
45
+ this.schemaRegistry = schemaRegistry;
49
46
  }
50
- async apply(props, workflow, context, transitionData) {
47
+ async apply(props, workflow, context, transitionData, parentArguments) {
51
48
  if (!workflow) {
52
49
  throw new Error('Workflow is undefined');
53
50
  }
54
- const template = this.loopConfigService.get('documents', props.document);
55
- if (!template) {
56
- throw new Error(`Document template ${props.document} not found.`);
57
- }
58
- const evaluatedTemplate = this.templateExpressionEvaluatorService.evaluate(template, {}, context, workflow, transitionData);
51
+ const template = this.loopConfigService.resolveConfig('documents', props.document, context.includes);
52
+ const documentSkeleton = this.templateExpressionEvaluatorService.parse((0, lodash_1.omit)(template.config, ['content']), {
53
+ arguments: parentArguments,
54
+ context,
55
+ workflow,
56
+ transition: transitionData,
57
+ }, {
58
+ schema: shared_1.DocumentSchema,
59
+ });
60
+ const zodSchema = this.schemaRegistry.getZodSchema(`${template.name}.content`);
59
61
  const documents = [];
60
62
  for (let index = 0; index < props.items.length; index++) {
61
- const documentData = (0, lodash_1.merge)({}, evaluatedTemplate, props.items[index]);
62
- if (!documentData) {
63
- throw new Error(`No document data provided.`);
64
- }
65
- if (props.addSuffix) {
66
- documentData.name += `-${index + 1}`;
63
+ const itemDocumentData = (0, lodash_1.merge)({}, documentSkeleton, props.items[index]);
64
+ if (!zodSchema && itemDocumentData.content) {
65
+ throw Error(`Document creates with content no schema defined.`);
67
66
  }
68
- this.actionHelperService.validateDocument(documentData);
69
- this.logger.debug(`Create document "${documentData.name}".`);
67
+ const parsedDocumentContent = itemDocumentData.content
68
+ ? this.templateExpressionEvaluatorService.parse(itemDocumentData.content, {
69
+ arguments: parentArguments,
70
+ context,
71
+ workflow,
72
+ transition: transitionData,
73
+ }, {
74
+ schema: zodSchema,
75
+ })
76
+ : null;
77
+ const documentData = {
78
+ ...itemDocumentData,
79
+ content: parsedDocumentContent,
80
+ };
70
81
  documents.push(this.documentService.create(workflow, context, transitionData, documentData));
82
+ this.logger.debug(`Created document "${documentData.name}".`);
71
83
  }
72
84
  return {
73
85
  success: true,
74
- workflow,
75
86
  persist: true,
87
+ workflow,
76
88
  data: documents,
77
89
  };
78
90
  }
@@ -84,9 +96,9 @@ exports.BatchCreateDocumentsService = BatchCreateDocumentsService = BatchCreateD
84
96
  config,
85
97
  schema,
86
98
  }),
87
- __metadata("design:paramtypes", [common_2.SchemaValidatorService,
88
- configuration_1.ConfigurationService,
99
+ __metadata("design:paramtypes", [configuration_1.ConfigurationService,
89
100
  persistence_1.DocumentService,
90
- services_1.TemplateExpressionEvaluatorService])
101
+ services_1.TemplateExpressionEvaluatorService,
102
+ configuration_1.SchemaRegistry])
91
103
  ], BatchCreateDocumentsService);
92
104
  //# sourceMappingURL=batch-create-documents.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-create-documents.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/batch-create-documents.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAS2B;AAC3B,yCAAsD;AACtD,uDAA2D;AAE3D,6BAAwB;AAExB,mDAAoD;AACpD,mCAA+B;AAC/B,0CAAiE;AAEjE,MAAM,MAAM,GAAG,OAAC;KACb,MAAM,CAAC;IACN,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,yBAAgB,EAAE,4BAAmB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACjE,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,yBAAgB,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC9D,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,yBAAgB,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;CACrD,CAAC;KACD,MAAM,EAAE,C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CAAC;QACvC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YACxD,MAAM,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;YAChD,CAAC;YAED,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpB,YAAY,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACvC,CAAC;YAED,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CACvC,YAAuC,CACxC,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC;YAE7D,SAAS,CAAC,IAAI,CACZ,IAAI,CAAC,eAAe,CAAC,MAAM,CACzB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAuC,CACxC,CACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,SAAS;SAChB,CAAC;IACJ,CAAC;CACF,CAAA;AAvEY,kEAA2B;sCAA3B,2BAA2B;IALvC,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK+B,+BAAsB;QACxB,oCAAoB;QACtB,6BAAe;QACI,6CAAkC;GAPrE,2BAA2B,CAuEvC"}
1
+ {"version":3,"file":"batch-create-documents.service.js","sourceRoot":"","sources":["../../../../src/modules/workflow-processor/tool-services/batch-create-documents.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8CAS2B;AAC3B,uDAA2E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I,CACZ,IAAI,CAAC,eAAe,CAAC,MAAM,CACzB,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAuC,CACxC,CACF,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC;QAChE,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,IAAI,EAAE,SAAS;SAChB,CAAC;IACJ,CAAC;CACF,CAAA;AA9FY,kEAA2B;sCAA3B,2BAA2B;IALvC,IAAA,mBAAU,GAAE;IACZ,IAAA,gBAAO,EAAC;QACP,MAAM;QACN,MAAM;KACP,CAAC;qCAK6B,oCAAoB;QACtB,6BAAe;QACI,6CAAkC;QACtD,8BAAc;GAP7B,2BAA2B,CA8FvC"}
@@ -1,78 +1,13 @@
1
1
  import { ContextInterface, ServiceInterface, ServiceCallResult, TransitionMetadataInterface } from '@loopstack/shared';
2
- import { SchemaValidatorService } from '../../common';
3
- import { ConfigurationService } from '../../configuration';
2
+ import { ConfigurationService, SchemaRegistry } from '../../configuration';
4
3
  import { z } from 'zod';
5
4
  import { WorkflowEntity } from '@loopstack/shared';
6
5
  import { DocumentService } from '../../persistence';
7
6
  import { TemplateExpressionEvaluatorService } from '../services';
8
7
  declare const schema: z.ZodObject<{
9
- document: z.ZodOptional<z.ZodString>;
8
+ document: z.ZodString;
10
9
  update: z.ZodOptional<z.ZodObject<{
11
- name: z.ZodOptional<z.ZodString>;
12
- description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
13
- content: z.ZodOptional<z.ZodAny>;
14
- schema: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
15
- ui: z.ZodOptional<z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>>;
16
- tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
17
- meta: z.ZodOptional<z.ZodOptional<z.ZodObject<{
18
- mimeType: z.ZodOptional<z.ZodEnum<["text/plain", "text/html", "text/css", "text/xml", "text/markdown", "application/javascript", "application/typescript", "application/json", "application/xml", "application/yaml"]>>;
19
- invalidate: z.ZodOptional<z.ZodBoolean>;
20
- level: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"debug">, z.ZodLiteral<"info">, z.ZodLiteral<"warning">, z.ZodLiteral<"error">]>>;
21
- enableAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
- hideAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23
- data: z.ZodOptional<z.ZodAny>;
24
- }, "strip", z.ZodTypeAny, {
25
- invalidate?: boolean | undefined;
26
- data?: any;
27
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
28
- level?: "info" | "error" | "debug" | "warning" | undefined;
29
- enableAtPlaces?: string[] | undefined;
30
- hideAtPlaces?: string[] | undefined;
31
- }, {
32
- invalidate?: boolean | undefined;
33
- data?: any;
34
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
35
- level?: "info" | "error" | "debug" | "warning" | undefined;
36
- enableAtPlaces?: string[] | undefined;
37
- hideAtPlaces?: string[] | undefined;
38
- }>>>;
39
- }, "strip", z.ZodTypeAny, {
40
- name?: string | undefined;
41
- schema?: any;
42
- content?: any;
43
- ui?: any;
44
- tags?: string[] | undefined;
45
- meta?: {
46
- invalidate?: boolean | undefined;
47
- data?: any;
48
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
49
- level?: "info" | "error" | "debug" | "warning" | undefined;
50
- enableAtPlaces?: string[] | undefined;
51
- hideAtPlaces?: string[] | undefined;
52
- } | undefined;
53
- description?: string | undefined;
54
- }, {
55
- name?: string | undefined;
56
- schema?: any;
57
- content?: any;
58
- ui?: any;
59
- tags?: string[] | undefined;
60
- meta?: {
61
- invalidate?: boolean | undefined;
62
- data?: any;
63
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
64
- level?: "info" | "error" | "debug" | "warning" | undefined;
65
- enableAtPlaces?: string[] | undefined;
66
- hideAtPlaces?: string[] | undefined;
67
- } | undefined;
68
- description?: string | undefined;
69
- }>>;
70
- create: z.ZodOptional<z.ZodObject<{
71
- name: z.ZodString;
72
- description: z.ZodOptional<z.ZodString>;
73
10
  content: z.ZodAny;
74
- schema: z.ZodType<any, z.ZodTypeDef, any>;
75
- ui: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
76
11
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
12
  meta: z.ZodOptional<z.ZodObject<{
78
13
  mimeType: z.ZodOptional<z.ZodEnum<["text/plain", "text/html", "text/css", "text/xml", "text/markdown", "application/javascript", "application/typescript", "application/json", "application/xml", "application/yaml"]>>;
@@ -80,130 +15,74 @@ declare const schema: z.ZodObject<{
80
15
  level: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"debug">, z.ZodLiteral<"info">, z.ZodLiteral<"warning">, z.ZodLiteral<"error">]>>;
81
16
  enableAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
17
  hideAtPlaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
83
- data: z.ZodOptional<z.ZodAny>;
84
18
  }, "strip", z.ZodTypeAny, {
85
- invalidate?: boolean | undefined;
86
- data?: any;
87
19
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
88
- level?: "info" | "error" | "debug" | "warning" | undefined;
20
+ invalidate?: boolean | undefined;
21
+ level?: "error" | "debug" | "info" | "warning" | undefined;
89
22
  enableAtPlaces?: string[] | undefined;
90
23
  hideAtPlaces?: string[] | undefined;
91
24
  }, {
92
- invalidate?: boolean | undefined;
93
- data?: any;
94
25
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
95
- level?: "info" | "error" | "debug" | "warning" | undefined;
26
+ invalidate?: boolean | undefined;
27
+ level?: "error" | "debug" | "info" | "warning" | undefined;
96
28
  enableAtPlaces?: string[] | undefined;
97
29
  hideAtPlaces?: string[] | undefined;
98
30
  }>>;
99
31
  }, "strip", z.ZodTypeAny, {
100
- name: string;
101
- schema?: any;
102
32
  content?: any;
103
- ui?: any;
104
33
  tags?: string[] | undefined;
105
34
  meta?: {
106
- invalidate?: boolean | undefined;
107
- data?: any;
108
35
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
109
- level?: "info" | "error" | "debug" | "warning" | undefined;
36
+ invalidate?: boolean | undefined;
37
+ level?: "error" | "debug" | "info" | "warning" | undefined;
110
38
  enableAtPlaces?: string[] | undefined;
111
39
  hideAtPlaces?: string[] | undefined;
112
40
  } | undefined;
113
- description?: string | undefined;
114
41
  }, {
115
- name: string;
116
- schema?: any;
117
42
  content?: any;
118
- ui?: any;
119
43
  tags?: string[] | undefined;
120
44
  meta?: {
121
- invalidate?: boolean | undefined;
122
- data?: any;
123
45
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
124
- level?: "info" | "error" | "debug" | "warning" | undefined;
46
+ invalidate?: boolean | undefined;
47
+ level?: "error" | "debug" | "info" | "warning" | undefined;
125
48
  enableAtPlaces?: string[] | undefined;
126
49
  hideAtPlaces?: string[] | undefined;
127
50
  } | undefined;
128
- description?: string | undefined;
129
51
  }>>;
130
52
  }, "strict", z.ZodTypeAny, {
53
+ document: string;
131
54
  update?: {
132
- name?: string | undefined;
133
- schema?: any;
134
55
  content?: any;
135
- ui?: any;
136
56
  tags?: string[] | undefined;
137
57
  meta?: {
138
- invalidate?: boolean | undefined;
139
- data?: any;
140
58
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
141
- level?: "info" | "error" | "debug" | "warning" | undefined;
142
- enableAtPlaces?: string[] | undefined;
143
- hideAtPlaces?: string[] | undefined;
144
- } | undefined;
145
- description?: string | undefined;
146
- } | undefined;
147
- create?: {
148
- name: string;
149
- schema?: any;
150
- content?: any;
151
- ui?: any;
152
- tags?: string[] | undefined;
153
- meta?: {
154
59
  invalidate?: boolean | undefined;
155
- data?: any;
156
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
157
- level?: "info" | "error" | "debug" | "warning" | undefined;
60
+ level?: "error" | "debug" | "info" | "warning" | undefined;
158
61
  enableAtPlaces?: string[] | undefined;
159
62
  hideAtPlaces?: string[] | undefined;
160
63
  } | undefined;
161
- description?: string | undefined;
162
64
  } | undefined;
163
- document?: string | undefined;
164
65
  }, {
66
+ document: string;
165
67
  update?: {
166
- name?: string | undefined;
167
- schema?: any;
168
68
  content?: any;
169
- ui?: any;
170
69
  tags?: string[] | undefined;
171
70
  meta?: {
172
- invalidate?: boolean | undefined;
173
- data?: any;
174
71
  mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
175
- level?: "info" | "error" | "debug" | "warning" | undefined;
176
- enableAtPlaces?: string[] | undefined;
177
- hideAtPlaces?: string[] | undefined;
178
- } | undefined;
179
- description?: string | undefined;
180
- } | undefined;
181
- create?: {
182
- name: string;
183
- schema?: any;
184
- content?: any;
185
- ui?: any;
186
- tags?: string[] | undefined;
187
- meta?: {
188
72
  invalidate?: boolean | undefined;
189
- data?: any;
190
- mimeType?: "text/plain" | "text/html" | "text/css" | "text/xml" | "text/markdown" | "application/javascript" | "application/typescript" | "application/json" | "application/xml" | "application/yaml" | undefined;
191
- level?: "info" | "error" | "debug" | "warning" | undefined;
73
+ level?: "error" | "debug" | "info" | "warning" | undefined;
192
74
  enableAtPlaces?: string[] | undefined;
193
75
  hideAtPlaces?: string[] | undefined;
194
76
  } | undefined;
195
- description?: string | undefined;
196
77
  } | undefined;
197
- document?: string | undefined;
198
78
  }>;
199
79
  export declare class CreateDocumentService implements ServiceInterface {
200
- private actionHelperService;
201
80
  private loopConfigService;
202
81
  private documentService;
203
82
  private templateExpressionEvaluatorService;
83
+ private schemaRegistry;
204
84
  private readonly logger;
205
- constructor(actionHelperService: SchemaValidatorService, loopConfigService: ConfigurationService, documentService: DocumentService, templateExpressionEvaluatorService: TemplateExpressionEvaluatorService);
206
- getDocumentTemplate(props: z.infer<typeof schema>, workflow: WorkflowEntity, context: ContextInterface, transitionData: TransitionMetadataInterface): {};
207
- apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface, meta: TransitionMetadataInterface): Promise<ServiceCallResult>;
85
+ constructor(loopConfigService: ConfigurationService, documentService: DocumentService, templateExpressionEvaluatorService: TemplateExpressionEvaluatorService, schemaRegistry: SchemaRegistry);
86
+ apply(props: z.infer<typeof schema>, workflow: WorkflowEntity | undefined, context: ContextInterface, meta: TransitionMetadataInterface, parentArguments: any): Promise<ServiceCallResult>;
208
87
  }
209
88
  export {};