@loopstack/core 0.35.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/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 +1 -1
- package/dist/workflow-processor/services/processors/workflow-processor.service.d.ts.map +1 -1
- package/dist/workflow-processor/services/processors/workflow-processor.service.js +71 -30
- 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.js +2 -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 +59 -39
- package/dist/workflows/fan-out/fan-out.types.d.ts.map +1 -1
- package/dist/workflows/fan-out/fan-out.types.js +29 -14
- package/dist/workflows/fan-out/fan-out.types.js.map +1 -1
- package/dist/workflows/fan-out/fan-out.workflow.d.ts +9 -9
- package/dist/workflows/fan-out/fan-out.workflow.d.ts.map +1 -1
- package/dist/workflows/fan-out/fan-out.workflow.js +17 -45
- package/dist/workflows/fan-out/fan-out.workflow.js.map +1 -1
- package/dist/workflows/sequence/sequence.types.d.ts +61 -41
- package/dist/workflows/sequence/sequence.types.d.ts.map +1 -1
- package/dist/workflows/sequence/sequence.types.js +29 -14
- package/dist/workflows/sequence/sequence.types.js.map +1 -1
- package/dist/workflows/sequence/sequence.workflow.d.ts +7 -9
- package/dist/workflows/sequence/sequence.workflow.d.ts.map +1 -1
- package/dist/workflows/sequence/sequence.workflow.js +20 -48
- package/dist/workflows/sequence/sequence.workflow.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequence.workflow.d.ts","sourceRoot":"","sources":["../../../src/workflows/sequence/sequence.workflow.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"sequence.workflow.d.ts","sourceRoot":"","sources":["../../../src/workflows/sequence/sequence.workflow.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EAKZ,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gEAAgE,CAAC;AACzG,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAE7B,UAAU,aAAa;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,YAAY,CAAC;IAEnB,OAAO,EAAE,OAAO,CAAC;CAClB;AA4BD,qBAMa,gBAAiB,SAAQ,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC;IAE5C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBADuB,YAAY,EAAE,oBAAoB,EACjE,QAAQ,EAAE,uBAAuB;IAM9C,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC;IAsBzD,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC;IA0CjG,IAAI,CAAC,KAAK,EAAE,aAAa;IAIzB,OAAO,CAAC,WAAW;YAIL,OAAO;IAUrB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -22,51 +22,39 @@ let SequenceWorkflow = class SequenceWorkflow extends BaseWorkflow {
|
|
|
22
22
|
this.orchestrator = orchestrator;
|
|
23
23
|
this.registry = registry;
|
|
24
24
|
}
|
|
25
|
-
async run(args, options) {
|
|
26
|
-
if (!args) {
|
|
27
|
-
throw new Error('SequenceWorkflow requires { items } — see the SequenceInput type.');
|
|
28
|
-
}
|
|
29
|
-
const { entries, itemsWereArray } = this.normalizeItems(args.items);
|
|
30
|
-
const normalized = {
|
|
31
|
-
entries,
|
|
32
|
-
itemsWereArray,
|
|
33
|
-
mode: args.mode ?? 'all',
|
|
34
|
-
};
|
|
35
|
-
return super.run(normalized, options);
|
|
36
|
-
}
|
|
37
25
|
async start(state, ctx) {
|
|
38
|
-
const
|
|
39
|
-
const itemKeys =
|
|
40
|
-
|
|
26
|
+
const { entries, itemsWereArray, mode } = ctx.args;
|
|
27
|
+
const itemKeys = entries.map(([key]) => key);
|
|
28
|
+
entries.forEach(([, item]) => this.resolveClass(item.workflow));
|
|
41
29
|
if (itemKeys.length > 0) {
|
|
42
|
-
await this.queueAt(args, 0);
|
|
30
|
+
await this.queueAt(ctx.args, 0);
|
|
43
31
|
}
|
|
44
|
-
|
|
32
|
+
this.assignState({
|
|
45
33
|
currentIndex: 0,
|
|
46
34
|
results: {},
|
|
47
35
|
itemKeys,
|
|
48
|
-
itemsWereArray
|
|
49
|
-
mode
|
|
36
|
+
itemsWereArray,
|
|
37
|
+
mode,
|
|
50
38
|
aborted: false,
|
|
51
|
-
};
|
|
39
|
+
});
|
|
52
40
|
}
|
|
53
|
-
async onChildComplete(state,
|
|
54
|
-
const args = ctx.args;
|
|
41
|
+
async onChildComplete(state, input, ctx) {
|
|
55
42
|
const key = state.itemKeys[state.currentIndex];
|
|
56
43
|
if (!key) {
|
|
57
44
|
throw new Error('Sequence received a child callback with no matching active item.');
|
|
58
45
|
}
|
|
59
|
-
const status =
|
|
60
|
-
const isError =
|
|
46
|
+
const status = input.status;
|
|
47
|
+
const isError = input.hasError;
|
|
61
48
|
const entry = isError
|
|
62
49
|
? { status, error: `Child workflow ${status}.` }
|
|
63
|
-
: { status, data:
|
|
50
|
+
: { status, data: input.data };
|
|
64
51
|
const newResults = { ...state.results, [key]: entry };
|
|
65
52
|
const nextIndex = state.currentIndex + 1;
|
|
66
53
|
const shouldContinue = state.mode === 'allSettled' || !isError;
|
|
67
54
|
if (shouldContinue && nextIndex < state.itemKeys.length) {
|
|
68
|
-
await this.queueAt(args, nextIndex);
|
|
69
|
-
|
|
55
|
+
await this.queueAt(ctx.args, nextIndex);
|
|
56
|
+
this.assignState({ currentIndex: nextIndex, results: newResults });
|
|
57
|
+
return;
|
|
70
58
|
}
|
|
71
59
|
if (!shouldContinue) {
|
|
72
60
|
for (let i = nextIndex; i < state.itemKeys.length; i++) {
|
|
@@ -76,15 +64,14 @@ let SequenceWorkflow = class SequenceWorkflow extends BaseWorkflow {
|
|
|
76
64
|
};
|
|
77
65
|
}
|
|
78
66
|
}
|
|
79
|
-
|
|
80
|
-
...state,
|
|
67
|
+
this.assignState({
|
|
81
68
|
currentIndex: state.itemKeys.length,
|
|
82
69
|
results: newResults,
|
|
83
70
|
aborted: !shouldContinue,
|
|
84
|
-
};
|
|
71
|
+
});
|
|
85
72
|
}
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
done(state) {
|
|
74
|
+
this.setResult(this.buildResult(state));
|
|
88
75
|
}
|
|
89
76
|
allComplete(state) {
|
|
90
77
|
return state.currentIndex >= state.itemKeys.length;
|
|
@@ -120,21 +107,6 @@ let SequenceWorkflow = class SequenceWorkflow extends BaseWorkflow {
|
|
|
120
107
|
const { instance } = this.registry.resolve(workflowName);
|
|
121
108
|
return instance.constructor;
|
|
122
109
|
}
|
|
123
|
-
normalizeItems(items) {
|
|
124
|
-
const itemsWereArray = Array.isArray(items);
|
|
125
|
-
const rawEntries = itemsWereArray
|
|
126
|
-
? items.map((item, index) => [item.label ?? String(index), item])
|
|
127
|
-
: Object.entries(items);
|
|
128
|
-
const seen = new Set();
|
|
129
|
-
const entries = rawEntries.map(([key, item]) => {
|
|
130
|
-
if (seen.has(key)) {
|
|
131
|
-
throw new Error(`Sequence item key "${key}" is duplicated. Keys must be unique.`);
|
|
132
|
-
}
|
|
133
|
-
seen.add(key);
|
|
134
|
-
return [key, item];
|
|
135
|
-
});
|
|
136
|
-
return { entries, itemsWereArray };
|
|
137
|
-
}
|
|
138
110
|
};
|
|
139
111
|
__decorate([
|
|
140
112
|
Transition({ to: 'awaiting' }),
|
|
@@ -153,7 +125,7 @@ __decorate([
|
|
|
153
125
|
Guard('allComplete'),
|
|
154
126
|
__metadata("design:type", Function),
|
|
155
127
|
__metadata("design:paramtypes", [Object]),
|
|
156
|
-
__metadata("design:returntype",
|
|
128
|
+
__metadata("design:returntype", void 0)
|
|
157
129
|
], SequenceWorkflow.prototype, "done", null);
|
|
158
130
|
SequenceWorkflow = __decorate([
|
|
159
131
|
Workflow({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequence.workflow.js","sourceRoot":"","sources":["../../../src/workflows/sequence/sequence.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,KAAK,
|
|
1
|
+
{"version":3,"file":"sequence.workflow.js","sourceRoot":"","sources":["../../../src/workflows/sequence/sequence.workflow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,KAAK,EACL,UAAU,EACV,qBAAqB,EACrB,QAAQ,GAET,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gEAAgE,CAAC;AACzG,OAAO,EAEL,kBAAkB,GAKnB,MAAM,qBAAqB,CAAC;AA4CtB,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,YAAyC;IAE3B;IAC/B;IAFnB,YACkD,YAAkC,EACjE,QAAiC;QAElD,KAAK,EAAE,CAAC;QAHwC,iBAAY,GAAZ,YAAY,CAAsB;QACjE,aAAQ,GAAR,QAAQ,CAAyB;IAGpD,CAAC;IAGK,AAAN,KAAK,CAAC,KAAK,CAAC,KAAoB,EAAE,GAA6B;QAC7D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QACnD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QAG7C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEhE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;QAED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U,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC;;;;6CAoB9B;AAGK;IADL,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;uDAuC5D;AAID;IAFC,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IAC3C,KAAK,CAAC,aAAa,CAAC;;;;4CAGpB;AA3EU,gBAAgB;IAN5B,QAAQ,CAAC;QACR,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,6EAA6E;QAC1F,MAAM,EAAE,kBAAkB;KAC3B,CAAC;IAGG,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;6CACH,uBAAuB;GAHzC,gBAAgB,CAqH5B"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@loopstack/core",
|
|
3
3
|
"displayName": "Loopstack Core Module",
|
|
4
4
|
"description": "The core module of the loopstack automation framework",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.36.0",
|
|
6
6
|
"repository": "loopstack-ai/core",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"watch": "nest build --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@loopstack/common": "^0.
|
|
34
|
+
"@loopstack/common": "^0.36.0",
|
|
35
35
|
"handlebars": "^4.7.9",
|
|
36
36
|
"lodash": "^4.18.1",
|
|
37
37
|
"yaml": "^2.8.3"
|