@loopstack/core 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/dtos/client-message.dto.d.ts +1 -0
- package/dist/common/dtos/client-message.dto.d.ts.map +1 -1
- package/dist/common/dtos/client-message.dto.js +1 -0
- package/dist/common/dtos/client-message.dto.js.map +1 -1
- package/dist/common/services/client-message.service.d.ts.map +1 -1
- package/dist/common/services/client-message.service.js +1 -0
- package/dist/common/services/client-message.service.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/loop-core.module.d.ts.map +1 -1
- package/dist/loop-core.module.js +5 -0
- package/dist/loop-core.module.js.map +1 -1
- package/dist/workflow-processor/services/create-workflow.service.js +3 -3
- package/dist/workflow-processor/services/create-workflow.service.js.map +1 -1
- package/dist/workflow-processor/services/document-persistence.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/document-persistence.service.js +6 -5
- package/dist/workflow-processor/services/document-persistence.service.js.map +1 -1
- package/dist/workflow-processor/services/processors/workflow-processor.service.d.ts +2 -4
- package/dist/workflow-processor/services/processors/workflow-processor.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/processors/workflow-processor.service.js +75 -47
- package/dist/workflow-processor/services/processors/workflow-processor.service.js.map +1 -1
- package/dist/workflow-processor/services/root-processor.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/root-processor.service.js +4 -2
- package/dist/workflow-processor/services/root-processor.service.js.map +1 -1
- package/dist/workflow-processor/services/tool-logging.interceptor.d.ts +2 -2
- package/dist/workflow-processor/services/tool-logging.interceptor.d.ts.map +1 -1
- package/dist/workflow-processor/services/tool-logging.interceptor.js.map +1 -1
- package/dist/workflow-processor/services/tool-pipeline.service.d.ts +2 -2
- package/dist/workflow-processor/services/tool-pipeline.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/tool-pipeline.service.js.map +1 -1
- package/dist/workflow-processor/services/workflow-orchestration.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/workflow-orchestration.service.js +4 -2
- package/dist/workflow-processor/services/workflow-orchestration.service.js.map +1 -1
- package/dist/workflow-processor/utils/execution-scope.d.ts +3 -0
- package/dist/workflow-processor/utils/execution-scope.d.ts.map +1 -1
- package/dist/workflow-processor/utils/execution-scope.js.map +1 -1
- package/dist/workflows/fan-out/fan-out.types.d.ts +103 -0
- package/dist/workflows/fan-out/fan-out.types.d.ts.map +1 -0
- package/dist/workflows/fan-out/fan-out.types.js +44 -0
- package/dist/workflows/fan-out/fan-out.types.js.map +1 -0
- package/dist/workflows/fan-out/fan-out.workflow.d.ts +27 -0
- package/dist/workflows/fan-out/fan-out.workflow.d.ts.map +1 -0
- package/dist/workflows/fan-out/fan-out.workflow.js +127 -0
- package/dist/workflows/fan-out/fan-out.workflow.js.map +1 -0
- package/dist/workflows/index.d.ts +5 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +5 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/sequence/sequence.types.d.ts +106 -0
- package/dist/workflows/sequence/sequence.types.d.ts.map +1 -0
- package/dist/workflows/sequence/sequence.types.js +44 -0
- package/dist/workflows/sequence/sequence.types.js.map +1 -0
- package/dist/workflows/sequence/sequence.workflow.d.ts +27 -0
- package/dist/workflows/sequence/sequence.workflow.d.ts.map +1 -0
- package/dist/workflows/sequence/sequence.workflow.js +141 -0
- package/dist/workflows/sequence/sequence.workflow.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-message.dto.d.ts","sourceRoot":"","sources":["../../../src/common/dtos/client-message.dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,qBAAa,gBAAiB,YAAW,sBAAsB;IAC7D,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAG,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAG,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;gBAEX,OAAO,EAAE,sBAAsB;CAG5C"}
|
|
1
|
+
{"version":3,"file":"client-message.dto.d.ts","sourceRoot":"","sources":["../../../src/common/dtos/client-message.dto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,qBAAa,gBAAiB,YAAW,sBAAsB;IAC7D,MAAM,EAAG,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAG,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAG,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;gBAEX,OAAO,EAAE,sBAAsB;CAG5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-message.dto.js","sourceRoot":"","sources":["../../../src/common/dtos/client-message.dto.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAiB;IACvB,QAAQ,CAAU;IAClB,EAAE,CAAU;IACZ,UAAU,CAAU;IACpB,WAAW,CAAU;IACrB,IAAI,CAAU;IAGd,YAAY,OAA+B;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"client-message.dto.js","sourceRoot":"","sources":["../../../src/common/dtos/client-message.dto.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,gBAAgB;IAC3B,MAAM,CAAiB;IACvB,QAAQ,CAAU;IAClB,EAAE,CAAU;IACZ,UAAU,CAAU;IACpB,QAAQ,CAAU;IAClB,WAAW,CAAU;IACrB,IAAI,CAAU;IAGd,YAAY,OAA+B;QACzC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-message.service.d.ts","sourceRoot":"","sources":["../../../src/common/services/client-message.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,qBACa,oBAAoB;IAI7B,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,aAAa;IAJvB,QAAQ,EAAE,MAAM,CAAC;gBAGP,YAAY,EAAE,aAAa,EAC3B,aAAa,EAAE,aAAa;IAKtC,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAIxC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"client-message.service.d.ts","sourceRoot":"","sources":["../../../src/common/services/client-message.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGpE,qBACa,oBAAoB;IAI7B,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,aAAa;IAJvB,QAAQ,EAAE,MAAM,CAAC;gBAGP,YAAY,EAAE,aAAa,EAC3B,aAAa,EAAE,aAAa;IAKtC,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAIxC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc;IAc1D,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAYxE,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc;CAW3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-message.service.js","sourceRoot":"","sources":["../../../src/common/services/client-message.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIrB;IACA;IAJV,QAAQ,CAAS;IAEjB,YACU,YAA2B,EAC3B,aAA4B;QAD5B,iBAAY,GAAZ,YAAY,CAAe;QAC3B,kBAAa,GAAb,aAAa,CAAe;QAEpC,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAS,eAAe,CAAE,CAAC;IAC9D,CAAC;IAED,QAAQ,CAAC,OAA+B;QACtC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,qBAAqB,CAAC,IAAY,EAAE,MAAsB;QACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,EAAE;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,sBAAsB,CAAC,IAAY,EAAE,WAAmB,EAAE,MAAc;QACtE,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,qBAAqB,CAAC,IAAY,EAAE,MAAsB;QACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,EAAE;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;
|
|
1
|
+
{"version":3,"file":"client-message.service.js","sourceRoot":"","sources":["../../../src/common/services/client-message.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAG1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAIrB;IACA;IAJV,QAAQ,CAAS;IAEjB,YACU,YAA2B,EAC3B,aAA4B;QAD5B,iBAAY,GAAZ,YAAY,CAAe;QAC3B,kBAAa,GAAb,aAAa,CAAe;QAEpC,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAS,eAAe,CAAE,CAAC;IAC9D,CAAC;IAED,QAAQ,CAAC,OAA+B;QACtC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAED,qBAAqB,CAAC,IAAY,EAAE,MAAsB;QACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,EAAE;YACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,SAAS;YACtC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,sBAAsB,CAAC,IAAY,EAAE,WAAmB,EAAE,MAAc;QACtE,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,qBAAqB,CAAC,IAAY,EAAE,MAAsB;QACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CACpB,gBAAgB,EAChB,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM,CAAC,SAAS;YACxB,UAAU,EAAE,MAAM,CAAC,EAAE;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AAnDY,oBAAoB;IADhC,UAAU,EAAE;qCAKa,aAAa;QACZ,aAAa;GAL3B,oBAAoB,CAmDhC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * from './common/index.js';
|
|
|
3
3
|
export * from './persistence/index.js';
|
|
4
4
|
export * from './scheduler/index.js';
|
|
5
5
|
export * from './workflow-processor/index.js';
|
|
6
|
+
export * from './workflows/index.js';
|
|
6
7
|
export * from './loop-core.module.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AAErC,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,6 @@ export * from './common/index.js';
|
|
|
3
3
|
export * from './persistence/index.js';
|
|
4
4
|
export * from './scheduler/index.js';
|
|
5
5
|
export * from './workflow-processor/index.js';
|
|
6
|
+
export * from './workflows/index.js';
|
|
6
7
|
export * from './loop-core.module.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AAErC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-core.module.d.ts","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAC;AAoBzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"loop-core.module.d.ts","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAC;AAoBzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAyBtF,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AA6HD,qBAEa,cAAc;IACzB,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,qBAA0B,GAAG,aAAa;IAgBlE,MAAM,CAAC,UAAU,IAAI,aAAa;CASnC"}
|
package/dist/loop-core.module.js
CHANGED
|
@@ -17,6 +17,7 @@ import { TaskSchedulerService } from './scheduler/services/task-scheduler.servic
|
|
|
17
17
|
import { TaskQueueModule } from './scheduler/task-queue.module.js';
|
|
18
18
|
import { BlockProcessor, CreateWorkflowService, DocumentPersistenceService, DocumentStore, FeatureRegistryService, ProcessorFactory, RootProcessorService, StudioDiscoveryService, ToolLoggingInterceptor, ToolPipelineService, ToolRegistryService, TransitionResolverService, WorkflowMemoryMonitorService, WorkflowOrchestrationService, WorkflowProcessorService, WorkflowRegistryService, WorkflowStateService, } from './workflow-processor/services/index.js';
|
|
19
19
|
import { ExecutionScope, TemplateRenderer } from './workflow-processor/utils/index.js';
|
|
20
|
+
import { FanOutWorkflow, SequenceWorkflow } from './workflows/index.js';
|
|
20
21
|
const ENTITIES = [WorkflowEntity, DocumentEntity, WorkspaceEntity, WorkflowCheckpointEntity];
|
|
21
22
|
const PROVIDERS = [
|
|
22
23
|
ClientMessageService,
|
|
@@ -42,6 +43,8 @@ const PROVIDERS = [
|
|
|
42
43
|
StudioDiscoveryService,
|
|
43
44
|
FeatureRegistryService,
|
|
44
45
|
ToolRegistryService,
|
|
46
|
+
FanOutWorkflow,
|
|
47
|
+
SequenceWorkflow,
|
|
45
48
|
{
|
|
46
49
|
provide: TOOL_PIPELINE,
|
|
47
50
|
useExisting: ToolPipelineService,
|
|
@@ -94,6 +97,8 @@ const EXPORTS = [
|
|
|
94
97
|
StudioDiscoveryService,
|
|
95
98
|
FeatureRegistryService,
|
|
96
99
|
ToolRegistryService,
|
|
100
|
+
FanOutWorkflow,
|
|
101
|
+
SequenceWorkflow,
|
|
97
102
|
WORKFLOW_ORCHESTRATOR,
|
|
98
103
|
TEMPLATE_RENDERER,
|
|
99
104
|
TOOL_PIPELINE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-core.module.js","sourceRoot":"","sources":["../src/loop-core.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,EAAY,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,O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aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC;gBACtD,YAAY;gBACZ,kBAAkB,CAAC,OAAO,EAAE;gBAC5B,eAAe;gBACf,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;aACvC;YACD,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,OAAO;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,UAAU;QACf,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,kBAAkB,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC;YAC1G,SAAS,EAAE,CAAC,GAAG,SAAS,EAAE,mBAAmB,CAAC;YAC9C,OAAO,EAAE,CAAC,GAAG,eAAe,EAAE,oBAAoB,CAAC;SACpD,CAAC;IACJ,CAAC;CACF,CAAA;AA1BY,cAAc;IAF1B,MAAM,EAAE;IACR,MAAM,CAAC,EAAE,CAAC;GACE,cAAc,CA0B1B"}
|
|
@@ -20,9 +20,9 @@ let CreateWorkflowService = CreateWorkflowService_1 = class CreateWorkflowServic
|
|
|
20
20
|
this.workflowService = workflowService;
|
|
21
21
|
}
|
|
22
22
|
validateWorkflowArgs(workflow, data) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
data.args = schema
|
|
23
|
+
const schema = getBlockArgsSchema(workflow);
|
|
24
|
+
if (schema) {
|
|
25
|
+
data.args = schema.parse(data.args ?? {});
|
|
26
26
|
}
|
|
27
27
|
return data;
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-workflow.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/create-workflow.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAsD,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAIb;IACA;IAJF,MAAM,GAAG,IAAI,MAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEjE,YACmB,gBAAkC,EAClC,eAAgC;QADhC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,oBAAe,GAAf,eAAe,CAAiB;IAChD,CAAC;IAEI,oBAAoB,CAAC,QAA2B,EAAE,IAA6B;QACrF,
|
|
1
|
+
{"version":3,"file":"create-workflow.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/create-workflow.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAsD,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAIb;IACA;IAJF,MAAM,GAAG,IAAI,MAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEjE,YACmB,gBAAkC,EAClC,eAAgC;QADhC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,oBAAe,GAAf,eAAe,CAAiB;IAChD,CAAC;IAEI,oBAAoB,CAAC,QAA2B,EAAE,IAA6B;QACrF,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;QACvE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAMD,KAAK,CAAC,MAAM,CACV,QAA2B,EAC3B,cAAiD,EACjD,IAA6B,EAC7B,IAAY,EACZ,gBAAyB;QAEzB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QACpE,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,cAAc,GAA0B,IAAI,CAAC;QACjD,IAAI,gBAAgB,EAAE,CAAC;YACrB,cAAc,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,gBAAgB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACtF,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC7F,CAAC;CACF,CAAA;AA5CY,qBAAqB;IADjC,UAAU,EAAE;qCAK0B,gBAAgB;QACjB,eAAe;GALxC,qBAAqB,CA4CjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-persistence.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/document-persistence.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAsC,MAAM,mBAAmB,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AAEvE,qBACa,0BAA0B;IAInC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;gBAGnD,cAAc,EAAE,cAAc,EAE9B,kBAAkB,EAAE,UAAU,CAAC,cAAc,CAAC;IAW3D,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"document-persistence.service.d.ts","sourceRoot":"","sources":["../../../src/workflow-processor/services/document-persistence.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAsC,MAAM,mBAAmB,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AAEvE,qBACa,0BAA0B;IAInC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAE/B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;gBAGnD,cAAc,EAAE,cAAc,EAE9B,kBAAkB,EAAE,UAAU,CAAC,cAAc,CAAC;IAW3D,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,cAAc,CAAC;YAgEZ,UAAU;IAoDxB,OAAO,CAAC,eAAe;CA2BxB"}
|
|
@@ -38,14 +38,15 @@ let DocumentPersistenceService = DocumentPersistenceService_1 = class DocumentPe
|
|
|
38
38
|
const defaultTags = blockOptions?.tags ?? [];
|
|
39
39
|
const validateMode = options?.validate ?? 'strict';
|
|
40
40
|
const { content: validatedContent, error } = this.validateContent(contentSchema, content, validateMode, documentName);
|
|
41
|
-
const
|
|
41
|
+
const key = options?.key ?? randomUUID();
|
|
42
42
|
const entity = this.documentRepository.create({
|
|
43
|
-
|
|
43
|
+
key,
|
|
44
44
|
documentName,
|
|
45
45
|
content: validatedContent,
|
|
46
46
|
meta: dynamicMeta && Object.keys(dynamicMeta).length > 0 ? dynamicMeta : null,
|
|
47
47
|
error: error ?? null,
|
|
48
48
|
tags: defaultTags,
|
|
49
|
+
internal: blockOptions?.internal ?? false,
|
|
49
50
|
transition: transition.id,
|
|
50
51
|
place: transition.to,
|
|
51
52
|
labels: scope.labels,
|
|
@@ -63,11 +64,11 @@ let DocumentPersistenceService = DocumentPersistenceService_1 = class DocumentPe
|
|
|
63
64
|
}
|
|
64
65
|
async addToCache(scope, document) {
|
|
65
66
|
const { documents, queryRunner } = scope;
|
|
66
|
-
const existingIndex = document.
|
|
67
|
+
const existingIndex = document.key ? documents.findIndex((d) => d.key === document.key) : -1;
|
|
67
68
|
const invalidated = [];
|
|
68
69
|
let inheritedIndex;
|
|
69
70
|
for (const doc of documents) {
|
|
70
|
-
if (doc.
|
|
71
|
+
if (doc.key === document.key && doc.meta?.invalidate !== false) {
|
|
71
72
|
if (inheritedIndex === undefined) {
|
|
72
73
|
inheritedIndex = doc.index;
|
|
73
74
|
}
|
|
@@ -96,7 +97,7 @@ let DocumentPersistenceService = DocumentPersistenceService_1 = class DocumentPe
|
|
|
96
97
|
}
|
|
97
98
|
else {
|
|
98
99
|
document.index = inheritedIndex ?? documents.length;
|
|
99
|
-
this.logger.debug(`addDocument: ${document.documentName}(
|
|
100
|
+
this.logger.debug(`addDocument: ${document.documentName}(key=${document.key}) → index=${document.index} (inherited=${inheritedIndex !== undefined}, docCount=${documents.length})`);
|
|
100
101
|
documents.push(document);
|
|
101
102
|
}
|
|
102
103
|
scope.persistenceState = { documentsUpdated: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-persistence.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/document-persistence.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,M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E,KAAK,EAAE,GAAG,IAAI,CAAC,eAAe,CAC/D,aAAa,EACb,OAAO,EACP,YAAY,EACZ,YAAY,CACb,CAAC;QAGF,MAAM,
|
|
1
|
+
{"version":3,"file":"document-persistence.service.js","sourceRoot":"","sources":["../../../src/workflow-processor/services/document-persistence.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,cAAc,EAAuB,eAAe,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAsB,MAAM,mBAAmB,CAAC;AAGhE,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAIlB;IAEA;IALF,MAAM,GAAG,IAAI,MAAM,CAAC,4BAA0B,CAAC,IAAI,CAAC,CAAC;IAEtE,YACmB,cAA8B,EAE9B,kBAA8C;QAF9C,mBAAc,GAAd,cAAc,CAAgB;QAE9B,uBAAkB,GAAlB,kBAAkB,CAA4B;IAC9D,CAAC;IAUJ,KAAK,CAAC,MAAM,CACV,YAAoB,EACpB,aAAqB,EACrB,OAAgB,EAChB,OAA6B;QAE7B,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;QACxC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;QAC7F,CAAC;QAGD,MAAM,YAAY,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;QACpD,MAAM,aAAa,GAA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,EAAE,CAAC;YACpB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;qBAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;qBAC1E,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,MAAM,IAAI,qBAAqB,CAAC,aAAa,YAAY,6CAA6C,MAAM,EAAE,CAAC,CAAC;YAClH,CAAC;YAGD,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QACvD,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;CACF,CAAA;AArKY,0BAA0B;IADtC,UAAU,EAAE;IAMR,WAAA,gBAAgB,CAAC,cAAc,CAAC,CAAA;qCADA,cAAc;QAEV,UAAU;GANtC,0BAA0B,CAqKtC"}
|
|
@@ -2,7 +2,6 @@ import { DataSource } from 'typeorm';
|
|
|
2
2
|
import { WorkflowEntity, WorkflowInterface, WorkflowMetadataInterface } from '@loopstack/common';
|
|
3
3
|
import { Processor } from '../../../common/index.js';
|
|
4
4
|
import { ExecutionScope } from '../../utils/index.js';
|
|
5
|
-
import { DocumentPersistenceService } from '../document-persistence.service.js';
|
|
6
5
|
import { TransitionResolverService } from '../transition-resolver.service.js';
|
|
7
6
|
import { WorkflowMemoryMonitorService } from '../workflow-memory-monitor.service.js';
|
|
8
7
|
import { WorkflowStateService } from '../workflow-state.service.js';
|
|
@@ -11,10 +10,9 @@ export declare class WorkflowProcessorService implements Processor {
|
|
|
11
10
|
private readonly transitionResolverService;
|
|
12
11
|
private readonly executionScope;
|
|
13
12
|
private readonly memoryMonitor;
|
|
14
|
-
private readonly documentPersistenceService;
|
|
15
13
|
private readonly dataSource;
|
|
16
14
|
private readonly logger;
|
|
17
|
-
constructor(workflowStateService: WorkflowStateService, transitionResolverService: TransitionResolverService, executionScope: ExecutionScope, memoryMonitor: WorkflowMemoryMonitorService,
|
|
15
|
+
constructor(workflowStateService: WorkflowStateService, transitionResolverService: TransitionResolverService, executionScope: ExecutionScope, memoryMonitor: WorkflowMemoryMonitorService, dataSource: DataSource);
|
|
18
16
|
process(workflow: WorkflowInterface, args: Record<string, unknown> | undefined, context: {
|
|
19
17
|
root: string;
|
|
20
18
|
userId: string;
|
|
@@ -31,7 +29,7 @@ export declare class WorkflowProcessorService implements Processor {
|
|
|
31
29
|
private buildWorkflowContext;
|
|
32
30
|
private invokeTransition;
|
|
33
31
|
private validateState;
|
|
34
|
-
private
|
|
32
|
+
private assertVoidReturn;
|
|
35
33
|
private invokeGuard;
|
|
36
34
|
private executeTransition;
|
|
37
35
|
private handleTransitionError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-processor.service.d.ts","sourceRoot":"","sources":["../../../../src/workflow-processor/services/processors/workflow-processor.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"workflow-processor.service.d.ts","sourceRoot":"","sources":["../../../../src/workflow-processor/services/processors/workflow-processor.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAGL,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EAG1B,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAoB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAsB,MAAM,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,CAAC,gBAAgB;IAYxB,OAAO,CAAC,WAAW;YAeL,iBAAiB;YAsGjB,qBAAqB;IAiEnC,OAAO,CAAC,eAAe;YAOT,mBAAmB;CAwLlC"}
|
|
@@ -10,12 +10,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var WorkflowProcessorService_1;
|
|
11
11
|
import { Injectable, Logger } from '@nestjs/common';
|
|
12
12
|
import { DataSource } from 'typeorm';
|
|
13
|
-
import {
|
|
13
|
+
import { getGuardMetadataMap, getWorkflowStateSchema, } from '@loopstack/common';
|
|
14
14
|
import { WorkflowState, WorkflowState as WorkflowStateEnum } from '@loopstack/contracts/enums';
|
|
15
15
|
import { ConfigTraceError } from '../../../common/index.js';
|
|
16
16
|
import { ExecutionScope } from '../../utils/index.js';
|
|
17
|
-
import { DocumentPersistenceService } from '../document-persistence.service.js';
|
|
18
|
-
import { resolveDocumentName } from '../document-store.service.js';
|
|
19
17
|
import { TransitionResolverService } from '../transition-resolver.service.js';
|
|
20
18
|
import { WorkflowMemoryMonitorService } from '../workflow-memory-monitor.service.js';
|
|
21
19
|
import { WorkflowStateService } from '../workflow-state.service.js';
|
|
@@ -27,20 +25,16 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
27
25
|
transitionResolverService;
|
|
28
26
|
executionScope;
|
|
29
27
|
memoryMonitor;
|
|
30
|
-
documentPersistenceService;
|
|
31
28
|
dataSource;
|
|
32
29
|
logger = new Logger(WorkflowProcessorService_1.name);
|
|
33
|
-
constructor(workflowStateService, transitionResolverService, executionScope, memoryMonitor,
|
|
30
|
+
constructor(workflowStateService, transitionResolverService, executionScope, memoryMonitor, dataSource) {
|
|
34
31
|
this.workflowStateService = workflowStateService;
|
|
35
32
|
this.transitionResolverService = transitionResolverService;
|
|
36
33
|
this.executionScope = executionScope;
|
|
37
34
|
this.memoryMonitor = memoryMonitor;
|
|
38
|
-
this.documentPersistenceService = documentPersistenceService;
|
|
39
35
|
this.dataSource = dataSource;
|
|
40
36
|
}
|
|
41
37
|
async process(workflow, args, context) {
|
|
42
|
-
const schema = getBlockArgsSchema(workflow);
|
|
43
|
-
const validArgs = schema ? schema.parse(args) : args;
|
|
44
38
|
const isStateless = !!context.options?.stateless;
|
|
45
39
|
let workflowEntity;
|
|
46
40
|
let pendingTransition;
|
|
@@ -93,13 +87,16 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
93
87
|
workspaceId: context.workspaceId,
|
|
94
88
|
workflowId: context.workflowId ?? '',
|
|
95
89
|
labels: context.labels ?? [],
|
|
96
|
-
args:
|
|
90
|
+
args: args ? Object.freeze({ ...args }) : undefined,
|
|
97
91
|
options: context.options,
|
|
98
92
|
cache: new Map(),
|
|
99
93
|
queryRunner: null,
|
|
100
94
|
documents: meta.documents,
|
|
101
95
|
persistenceState: meta.persistenceState,
|
|
102
96
|
transition: undefined,
|
|
97
|
+
stateDraft: {},
|
|
98
|
+
resultDraft: {},
|
|
99
|
+
resultDirty: false,
|
|
103
100
|
};
|
|
104
101
|
this.logger.debug(`Process state machine for workflow ${workflow.constructor.name}`);
|
|
105
102
|
this.memoryMonitor.logWorkflowStart(workflow.constructor.name);
|
|
@@ -173,11 +170,12 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
173
170
|
.join('; ');
|
|
174
171
|
throw new Error(`State validation failed after transition '${methodName}' (→ ${to}) on ${workflow.constructor.name}: ${issues}`);
|
|
175
172
|
}
|
|
176
|
-
|
|
173
|
+
assertVoidReturn(workflow, methodName, returnValue) {
|
|
177
174
|
if (returnValue === undefined)
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
return;
|
|
176
|
+
throw new Error(`Transition '${methodName}' on ${workflow.constructor.name} returned a value. ` +
|
|
177
|
+
`Transitions must return void — use this.assignState() / this.setState() / ` +
|
|
178
|
+
`this.assignResult() / this.setResult() instead.`);
|
|
181
179
|
}
|
|
182
180
|
invokeGuard(workflow, guardMethodName, state) {
|
|
183
181
|
const method = workflow[guardMethodName];
|
|
@@ -191,12 +189,20 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
191
189
|
const timeoutMs = transitionMeta?.timeout ?? defaultTimeout;
|
|
192
190
|
const workflowCtx = this.buildWorkflowContext(scopeData, meta);
|
|
193
191
|
const invokeMethod = () => {
|
|
192
|
+
scopeData.stateDraft = { ...state };
|
|
193
|
+
scopeData.resultDraft = meta.result ? { ...meta.result } : {};
|
|
194
|
+
scopeData.resultDirty = false;
|
|
194
195
|
const methodPromise = this.executionScope.run(scopeData, () => this.invokeTransition(workflow, methodName, workflowCtx, state, data));
|
|
195
196
|
return timeoutMs > 0 ? Promise.race([methodPromise, rejectAfter(timeoutMs, methodName)]) : methodPromise;
|
|
196
197
|
};
|
|
197
198
|
if (!workflowEntity) {
|
|
198
199
|
const returnValue = await invokeMethod();
|
|
199
|
-
|
|
200
|
+
this.assertVoidReturn(workflow, methodName, returnValue);
|
|
201
|
+
const newState = scopeData.stateDraft;
|
|
202
|
+
this.validateState(workflow, methodName, to, newState);
|
|
203
|
+
if (scopeData.resultDirty) {
|
|
204
|
+
meta.result = scopeData.resultDraft;
|
|
205
|
+
}
|
|
200
206
|
meta.place = to;
|
|
201
207
|
meta.version++;
|
|
202
208
|
this.memoryMonitor.logTransition(workflowName, methodName, scopeData.documents, meta.version);
|
|
@@ -204,6 +210,7 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
204
210
|
}
|
|
205
211
|
const documentsSnapshot = structuredClone(scopeData.documents);
|
|
206
212
|
const persistenceStateSnapshot = structuredClone(scopeData.persistenceState);
|
|
213
|
+
const resultSnapshot = meta.result;
|
|
207
214
|
const queryRunner = this.dataSource.createQueryRunner();
|
|
208
215
|
await queryRunner.connect();
|
|
209
216
|
await queryRunner.startTransaction();
|
|
@@ -211,9 +218,11 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
211
218
|
scopeData.queryRunner = queryRunner;
|
|
212
219
|
this.logger.debug(`Applying transition: ${methodName} (${meta.place} → ${to})`);
|
|
213
220
|
const returnValue = await invokeMethod();
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
221
|
+
this.assertVoidReturn(workflow, methodName, returnValue);
|
|
222
|
+
const newState = scopeData.stateDraft;
|
|
223
|
+
this.validateState(workflow, methodName, to, newState);
|
|
224
|
+
if (scopeData.resultDirty) {
|
|
225
|
+
meta.result = scopeData.resultDraft;
|
|
217
226
|
}
|
|
218
227
|
meta.place = to;
|
|
219
228
|
meta.version++;
|
|
@@ -228,6 +237,7 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
228
237
|
await queryRunner.rollbackTransaction();
|
|
229
238
|
scopeData.documents = documentsSnapshot;
|
|
230
239
|
scopeData.persistenceState = persistenceStateSnapshot;
|
|
240
|
+
meta.result = resultSnapshot;
|
|
231
241
|
throw error;
|
|
232
242
|
}
|
|
233
243
|
finally {
|
|
@@ -235,39 +245,34 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
235
245
|
await queryRunner.release();
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
|
-
async handleTransitionError(
|
|
248
|
+
async handleTransitionError(meta, error, transitionMeta) {
|
|
239
249
|
meta.version++;
|
|
240
|
-
|
|
241
|
-
await this.executionScope.run(scopeData, async () => {
|
|
242
|
-
await this.documentPersistenceService.create(resolveDocumentName(ErrorDocument), ErrorDocument, { error: error.message }, { id: `error_${Date.now()}` });
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
catch (docError) {
|
|
246
|
-
this.logger.warn(`Failed to save error document: ${docError instanceof Error ? docError.message : String(docError)}`);
|
|
247
|
-
}
|
|
248
|
-
const retry = transitionMeta.retry ?? normalizeRetryConfig();
|
|
249
|
-
const methodName = transitionMeta.methodName;
|
|
250
|
+
const { methodName, retryAttempts, retryDelay, retryBackoff, retryMaxDelay, retryTarget, errorPlace } = transitionMeta;
|
|
250
251
|
let retryCount = meta.retryCount ?? 0;
|
|
251
252
|
if (meta.retryTransitionId !== methodName) {
|
|
252
253
|
retryCount = 0;
|
|
253
254
|
}
|
|
254
255
|
this.logger.warn(`Transition '${methodName}' failed (attempt ${retryCount + 1}): ${error.message}`);
|
|
255
|
-
if (
|
|
256
|
+
if (retryAttempts > 0 && retryCount < retryAttempts) {
|
|
256
257
|
retryCount++;
|
|
257
258
|
meta.retryCount = retryCount;
|
|
258
259
|
meta.retryTransitionId = methodName;
|
|
259
260
|
meta.errorMessage = error.message;
|
|
260
261
|
meta.hasError = true;
|
|
261
|
-
const delayMs =
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
const delayMs = retryBackoff === 'exponential' ? Math.min(retryDelay * Math.pow(2, retryCount - 1), retryMaxDelay) : retryDelay;
|
|
263
|
+
if (retryTarget) {
|
|
264
|
+
this.logger.log(`Auto-retry ${retryCount}/${retryAttempts} for '${methodName}' via target place '${retryTarget}' in ${delayMs}ms`);
|
|
265
|
+
meta.place = retryTarget;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.logger.log(`Auto-retry ${retryCount}/${retryAttempts} for '${methodName}' in ${delayMs}ms`);
|
|
269
|
+
}
|
|
265
270
|
meta._retrySignal = { delayMs };
|
|
266
271
|
return;
|
|
267
272
|
}
|
|
268
|
-
if (
|
|
269
|
-
this.logger.log(`
|
|
270
|
-
meta.place =
|
|
273
|
+
if (errorPlace) {
|
|
274
|
+
this.logger.log(`Routing failure of '${methodName}' to error place '${errorPlace}'`);
|
|
275
|
+
meta.place = errorPlace;
|
|
271
276
|
meta.hasError = true;
|
|
272
277
|
meta.errorMessage = error.message;
|
|
273
278
|
meta.retryCount = 0;
|
|
@@ -280,8 +285,8 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
280
285
|
meta.retryCount = retryCount + 1;
|
|
281
286
|
meta.retryTransitionId = methodName;
|
|
282
287
|
}
|
|
283
|
-
clearRetryState(meta) {
|
|
284
|
-
if (meta.retryTransitionId) {
|
|
288
|
+
clearRetryState(meta, justSucceededMethodName) {
|
|
289
|
+
if (meta.retryTransitionId === justSucceededMethodName) {
|
|
285
290
|
meta.retryCount = 0;
|
|
286
291
|
meta.retryTransitionId = undefined;
|
|
287
292
|
}
|
|
@@ -314,18 +319,42 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
314
319
|
if (workflowEntity) {
|
|
315
320
|
await this.workflowStateService.saveExecutionState(workflowEntity, state, meta);
|
|
316
321
|
}
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
const rawPayload = (pendingTransition.payload ?? {});
|
|
323
|
+
const rawData = 'data' in rawPayload ? rawPayload.data : undefined;
|
|
324
|
+
const status = rawPayload.status ?? 'completed';
|
|
325
|
+
const isFailureCallback = status === 'failed' || status === 'canceled';
|
|
326
|
+
if (isFailureCallback && (waitTransition.errorPlace || waitTransition.retryAttempts > 0)) {
|
|
327
|
+
const errorMessage = rawPayload.errorMessage ?? `Sub-workflow ${status}`;
|
|
328
|
+
const subError = new Error(errorMessage);
|
|
329
|
+
this.logger.warn(`Wait transition '${waitTransition.methodName}' received ${status} callback: ${errorMessage}`);
|
|
330
|
+
await this.handleTransitionError(meta, subError, waitTransition);
|
|
331
|
+
const errorAvailable = this.transitionResolverService.getAvailableTransitions(workflow, meta.place);
|
|
332
|
+
meta.availableTransitions = errorAvailable.map((t) => ({
|
|
333
|
+
id: t.methodName,
|
|
334
|
+
from: meta.place,
|
|
335
|
+
to: t.to,
|
|
336
|
+
trigger: t.wait ? 'manual' : undefined,
|
|
337
|
+
}));
|
|
338
|
+
return state;
|
|
339
|
+
}
|
|
340
|
+
const validatedData = waitTransition.schema && !isFailureCallback ? waitTransition.schema.parse(rawData) : rawData;
|
|
341
|
+
const transitionInput = {
|
|
342
|
+
workflowId: rawPayload.workflowId ?? pendingTransition.workflowId,
|
|
343
|
+
status,
|
|
344
|
+
hasError: typeof rawPayload.hasError === 'boolean' ? rawPayload.hasError : status !== 'completed',
|
|
345
|
+
errorMessage: rawPayload.errorMessage ?? null,
|
|
346
|
+
data: validatedData,
|
|
347
|
+
...(rawPayload.meta !== undefined ? { meta: rawPayload.meta } : {}),
|
|
348
|
+
};
|
|
320
349
|
try {
|
|
321
|
-
const result = await this.executeTransition(scopeData, meta, workflow, waitTransition.methodName, waitTransition.to,
|
|
350
|
+
const result = await this.executeTransition(scopeData, meta, workflow, waitTransition.methodName, waitTransition.to, transitionInput, state, workflowEntity, workflowName, waitTransition);
|
|
322
351
|
state = result.newState;
|
|
323
|
-
this.clearRetryState(meta);
|
|
352
|
+
this.clearRetryState(meta, waitTransition.methodName);
|
|
324
353
|
}
|
|
325
354
|
catch (e) {
|
|
326
355
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
327
356
|
this.logger.error(new ConfigTraceError(error, workflow));
|
|
328
|
-
await this.handleTransitionError(
|
|
357
|
+
await this.handleTransitionError(meta, error, waitTransition);
|
|
329
358
|
const errorAvailable = this.transitionResolverService.getAvailableTransitions(workflow, meta.place);
|
|
330
359
|
meta.availableTransitions = errorAvailable.map((t) => ({
|
|
331
360
|
id: t.methodName,
|
|
@@ -366,12 +395,12 @@ let WorkflowProcessorService = WorkflowProcessorService_1 = class WorkflowProces
|
|
|
366
395
|
try {
|
|
367
396
|
const result = await this.executeTransition(scopeData, meta, workflow, next.methodName, next.to, undefined, state, workflowEntity, workflowName, next);
|
|
368
397
|
state = result.newState;
|
|
369
|
-
this.clearRetryState(meta);
|
|
398
|
+
this.clearRetryState(meta, next.methodName);
|
|
370
399
|
}
|
|
371
400
|
catch (e) {
|
|
372
401
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
373
402
|
this.logger.error(new ConfigTraceError(error, workflow));
|
|
374
|
-
await this.handleTransitionError(
|
|
403
|
+
await this.handleTransitionError(meta, error, next);
|
|
375
404
|
const errorAvailable = this.transitionResolverService.getAvailableTransitions(workflow, meta.place);
|
|
376
405
|
meta.availableTransitions = errorAvailable.map((t) => ({
|
|
377
406
|
id: t.methodName,
|
|
@@ -391,7 +420,6 @@ WorkflowProcessorService = WorkflowProcessorService_1 = __decorate([
|
|
|
391
420
|
TransitionResolverService,
|
|
392
421
|
ExecutionScope,
|
|
393
422
|
WorkflowMemoryMonitorService,
|
|
394
|
-
DocumentPersistenceService,
|
|
395
423
|
DataSource])
|
|
396
424
|
], WorkflowProcessorService);
|
|
397
425
|
export { WorkflowProcessorService };
|