@cadenza.io/core 3.13.1 → 3.13.2
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/README.md +1 -1
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ function deepCloneFilter(input, filterOut = () => false) {
|
|
|
50
50
|
const currentTarget = key !== void 0 ? target[key] : target;
|
|
51
51
|
if (
|
|
52
52
|
// TODO Should probably not be done like this...
|
|
53
|
-
key === "
|
|
53
|
+
key === "taskInstance" || key === "routineInstance" || key === "task" || key === "routine" || key === "tasks" || key === "routines" || key === "httpServer" || key === "httpsServer"
|
|
54
54
|
) {
|
|
55
55
|
target[key] = source;
|
|
56
56
|
continue;
|
|
@@ -1862,7 +1862,7 @@ var GraphRoutine = class extends SignalEmitter {
|
|
|
1862
1862
|
description: this.description,
|
|
1863
1863
|
isMeta: this.isMeta
|
|
1864
1864
|
},
|
|
1865
|
-
|
|
1865
|
+
routineInstance: this
|
|
1866
1866
|
});
|
|
1867
1867
|
tasks.forEach((t) => {
|
|
1868
1868
|
this.tasks.add(t);
|
|
@@ -2109,7 +2109,7 @@ var Task = class _Task extends SignalEmitter {
|
|
|
2109
2109
|
// inputContextSchemaId: this.inputContextSchema,
|
|
2110
2110
|
// outputContextSchemaId: this.outputContextSchema,
|
|
2111
2111
|
},
|
|
2112
|
-
|
|
2112
|
+
taskInstance: this,
|
|
2113
2113
|
__isSubMeta: this.isSubMeta
|
|
2114
2114
|
});
|
|
2115
2115
|
}
|
|
@@ -2908,11 +2908,11 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
2908
2908
|
this.registerTask = new Task(
|
|
2909
2909
|
"Register task",
|
|
2910
2910
|
(context) => {
|
|
2911
|
-
const {
|
|
2912
|
-
if (
|
|
2913
|
-
this.tasks.set(
|
|
2911
|
+
const { taskInstance } = context;
|
|
2912
|
+
if (taskInstance && !this.tasks.has(taskInstance.name)) {
|
|
2913
|
+
this.tasks.set(taskInstance.name, taskInstance);
|
|
2914
2914
|
}
|
|
2915
|
-
delete context.
|
|
2915
|
+
delete context.taskInstance;
|
|
2916
2916
|
return true;
|
|
2917
2917
|
},
|
|
2918
2918
|
"Registers tasks. Seed for meta.taskCreated",
|
|
@@ -2951,7 +2951,7 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
2951
2951
|
const { __name } = context;
|
|
2952
2952
|
for (const task of this.tasks.values()) {
|
|
2953
2953
|
if (task.name === __name) {
|
|
2954
|
-
return { ...context,
|
|
2954
|
+
return { ...context, task };
|
|
2955
2955
|
}
|
|
2956
2956
|
}
|
|
2957
2957
|
return false;
|
|
@@ -2965,13 +2965,13 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
2965
2965
|
const layerTasks = Array.from(this.tasks.values()).filter(
|
|
2966
2966
|
(task) => task.layerIndex === __layerIndex
|
|
2967
2967
|
);
|
|
2968
|
-
return { ...context,
|
|
2968
|
+
return { ...context, tasks: layerTasks };
|
|
2969
2969
|
},
|
|
2970
2970
|
"Gets tasks by layer index."
|
|
2971
2971
|
);
|
|
2972
2972
|
this.getAllTasks = Cadenza.createMetaTask(
|
|
2973
2973
|
"Get all tasks",
|
|
2974
|
-
(context) => ({ ...context,
|
|
2974
|
+
(context) => ({ ...context, tasks: Array.from(this.tasks.values()) }),
|
|
2975
2975
|
// Use arrow to capture this
|
|
2976
2976
|
"Gets all tasks."
|
|
2977
2977
|
);
|
|
@@ -2979,7 +2979,7 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
2979
2979
|
"Do for each task",
|
|
2980
2980
|
function* (context) {
|
|
2981
2981
|
for (const task of this.tasks.values()) {
|
|
2982
|
-
yield { ...context,
|
|
2982
|
+
yield { ...context, task };
|
|
2983
2983
|
}
|
|
2984
2984
|
}.bind(this),
|
|
2985
2985
|
// Bind to capture this in generator
|
|
@@ -2997,11 +2997,11 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
2997
2997
|
this.registerRoutine = Cadenza.createMetaTask(
|
|
2998
2998
|
"Register routine",
|
|
2999
2999
|
(context) => {
|
|
3000
|
-
const {
|
|
3001
|
-
if (
|
|
3002
|
-
this.routines.set(
|
|
3000
|
+
const { routineInstance } = context;
|
|
3001
|
+
if (routineInstance && !this.routines.has(routineInstance.name)) {
|
|
3002
|
+
this.routines.set(routineInstance.name, routineInstance);
|
|
3003
3003
|
}
|
|
3004
|
-
delete context.
|
|
3004
|
+
delete context.routineInstance;
|
|
3005
3005
|
return true;
|
|
3006
3006
|
},
|
|
3007
3007
|
"Registers routine."
|
|
@@ -3012,7 +3012,7 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
3012
3012
|
const { __name } = context;
|
|
3013
3013
|
for (const routine of this.routines.values()) {
|
|
3014
3014
|
if (routine.name === __name) {
|
|
3015
|
-
return { ...context,
|
|
3015
|
+
return { ...context, routine };
|
|
3016
3016
|
}
|
|
3017
3017
|
}
|
|
3018
3018
|
return false;
|
|
@@ -3023,7 +3023,7 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
3023
3023
|
"Get all routines",
|
|
3024
3024
|
(context) => ({
|
|
3025
3025
|
...context,
|
|
3026
|
-
|
|
3026
|
+
routines: Array.from(this.routines.values())
|
|
3027
3027
|
}),
|
|
3028
3028
|
// Use arrow to capture this
|
|
3029
3029
|
"Gets all routines."
|
|
@@ -3032,7 +3032,7 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
3032
3032
|
"Do for each routine",
|
|
3033
3033
|
function* (context) {
|
|
3034
3034
|
for (const routine of this.routines.values()) {
|
|
3035
|
-
yield { ...context,
|
|
3035
|
+
yield { ...context, routine };
|
|
3036
3036
|
}
|
|
3037
3037
|
}.bind(this),
|
|
3038
3038
|
"Yields each routine."
|
|
@@ -3239,10 +3239,10 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
3239
3239
|
}
|
|
3240
3240
|
// TODO This should not live here. This is deputy related.
|
|
3241
3241
|
startRun(context, emit) {
|
|
3242
|
-
if (context.
|
|
3243
|
-
const routine = context.
|
|
3244
|
-
delete context.
|
|
3245
|
-
delete context.
|
|
3242
|
+
if (context.task || context.routine) {
|
|
3243
|
+
const routine = context.task ?? context.routine;
|
|
3244
|
+
delete context.task;
|
|
3245
|
+
delete context.routine;
|
|
3246
3246
|
context.__routineExecId = context.__metadata?.__deputyExecId ?? null;
|
|
3247
3247
|
context.__isDeputy = true;
|
|
3248
3248
|
this.run(routine, context);
|