@cadenza.io/core 3.13.0 → 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/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ function deepCloneFilter(input, filterOut = () => false) {
13
13
  const currentTarget = key !== void 0 ? target[key] : target;
14
14
  if (
15
15
  // TODO Should probably not be done like this...
16
- key === "__taskInstance" || key === "__routineInstance" || key === "__task" || key === "__routine" || key === "__tasks" || key === "__routines" || key === "__httpServer" || key === "__httpsServer" || key === "__socketServer"
16
+ key === "taskInstance" || key === "routineInstance" || key === "task" || key === "routine" || key === "tasks" || key === "routines" || key === "httpServer" || key === "httpsServer"
17
17
  ) {
18
18
  target[key] = source;
19
19
  continue;
@@ -1280,7 +1280,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1280
1280
  }
1281
1281
  this.emit(signal, data);
1282
1282
  if (!this.task.emitsSignals.has(signal)) {
1283
- this.task.attachSignal(signal);
1283
+ this.task.emitsSignals.add(signal);
1284
1284
  }
1285
1285
  }
1286
1286
  /**
@@ -1308,7 +1308,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1308
1308
  }
1309
1309
  this.emitMetrics(signal, data);
1310
1310
  if (!this.task.emitsSignals.has(signal)) {
1311
- this.task.attachSignal(signal);
1311
+ this.task.emitsSignals.add(signal);
1312
1312
  }
1313
1313
  }
1314
1314
  /**
@@ -1825,7 +1825,7 @@ var GraphRoutine = class extends SignalEmitter {
1825
1825
  description: this.description,
1826
1826
  isMeta: this.isMeta
1827
1827
  },
1828
- __routineInstance: this
1828
+ routineInstance: this
1829
1829
  });
1830
1830
  tasks.forEach((t) => {
1831
1831
  this.tasks.add(t);
@@ -2072,7 +2072,7 @@ var Task = class _Task extends SignalEmitter {
2072
2072
  // inputContextSchemaId: this.inputContextSchema,
2073
2073
  // outputContextSchemaId: this.outputContextSchema,
2074
2074
  },
2075
- __taskInstance: this,
2075
+ taskInstance: this,
2076
2076
  __isSubMeta: this.isSubMeta
2077
2077
  });
2078
2078
  }
@@ -2871,11 +2871,11 @@ var GraphRegistry = class _GraphRegistry {
2871
2871
  this.registerTask = new Task(
2872
2872
  "Register task",
2873
2873
  (context) => {
2874
- const { __taskInstance } = context;
2875
- if (__taskInstance && !this.tasks.has(__taskInstance.name)) {
2876
- this.tasks.set(__taskInstance.name, __taskInstance);
2874
+ const { taskInstance } = context;
2875
+ if (taskInstance && !this.tasks.has(taskInstance.name)) {
2876
+ this.tasks.set(taskInstance.name, taskInstance);
2877
2877
  }
2878
- delete context.__taskInstance;
2878
+ delete context.taskInstance;
2879
2879
  return true;
2880
2880
  },
2881
2881
  "Registers tasks. Seed for meta.taskCreated",
@@ -2914,7 +2914,7 @@ var GraphRegistry = class _GraphRegistry {
2914
2914
  const { __name } = context;
2915
2915
  for (const task of this.tasks.values()) {
2916
2916
  if (task.name === __name) {
2917
- return { ...context, __task: task };
2917
+ return { ...context, task };
2918
2918
  }
2919
2919
  }
2920
2920
  return false;
@@ -2928,13 +2928,13 @@ var GraphRegistry = class _GraphRegistry {
2928
2928
  const layerTasks = Array.from(this.tasks.values()).filter(
2929
2929
  (task) => task.layerIndex === __layerIndex
2930
2930
  );
2931
- return { ...context, __tasks: layerTasks };
2931
+ return { ...context, tasks: layerTasks };
2932
2932
  },
2933
2933
  "Gets tasks by layer index."
2934
2934
  );
2935
2935
  this.getAllTasks = Cadenza.createMetaTask(
2936
2936
  "Get all tasks",
2937
- (context) => ({ ...context, __tasks: Array.from(this.tasks.values()) }),
2937
+ (context) => ({ ...context, tasks: Array.from(this.tasks.values()) }),
2938
2938
  // Use arrow to capture this
2939
2939
  "Gets all tasks."
2940
2940
  );
@@ -2942,7 +2942,7 @@ var GraphRegistry = class _GraphRegistry {
2942
2942
  "Do for each task",
2943
2943
  function* (context) {
2944
2944
  for (const task of this.tasks.values()) {
2945
- yield { ...context, __task: task };
2945
+ yield { ...context, task };
2946
2946
  }
2947
2947
  }.bind(this),
2948
2948
  // Bind to capture this in generator
@@ -2960,11 +2960,11 @@ var GraphRegistry = class _GraphRegistry {
2960
2960
  this.registerRoutine = Cadenza.createMetaTask(
2961
2961
  "Register routine",
2962
2962
  (context) => {
2963
- const { __routineInstance } = context;
2964
- if (__routineInstance && !this.routines.has(__routineInstance.name)) {
2965
- this.routines.set(__routineInstance.name, __routineInstance);
2963
+ const { routineInstance } = context;
2964
+ if (routineInstance && !this.routines.has(routineInstance.name)) {
2965
+ this.routines.set(routineInstance.name, routineInstance);
2966
2966
  }
2967
- delete context.__routineInstance;
2967
+ delete context.routineInstance;
2968
2968
  return true;
2969
2969
  },
2970
2970
  "Registers routine."
@@ -2975,7 +2975,7 @@ var GraphRegistry = class _GraphRegistry {
2975
2975
  const { __name } = context;
2976
2976
  for (const routine of this.routines.values()) {
2977
2977
  if (routine.name === __name) {
2978
- return { ...context, __routine: routine };
2978
+ return { ...context, routine };
2979
2979
  }
2980
2980
  }
2981
2981
  return false;
@@ -2986,7 +2986,7 @@ var GraphRegistry = class _GraphRegistry {
2986
2986
  "Get all routines",
2987
2987
  (context) => ({
2988
2988
  ...context,
2989
- __routines: Array.from(this.routines.values())
2989
+ routines: Array.from(this.routines.values())
2990
2990
  }),
2991
2991
  // Use arrow to capture this
2992
2992
  "Gets all routines."
@@ -2995,7 +2995,7 @@ var GraphRegistry = class _GraphRegistry {
2995
2995
  "Do for each routine",
2996
2996
  function* (context) {
2997
2997
  for (const routine of this.routines.values()) {
2998
- yield { ...context, __routine: routine };
2998
+ yield { ...context, routine };
2999
2999
  }
3000
3000
  }.bind(this),
3001
3001
  "Yields each routine."
@@ -3202,10 +3202,10 @@ var GraphRunner = class extends SignalEmitter {
3202
3202
  }
3203
3203
  // TODO This should not live here. This is deputy related.
3204
3204
  startRun(context, emit) {
3205
- if (context.__task || context.__routine) {
3206
- const routine = context.__task ?? context.__routine;
3207
- delete context.__task;
3208
- delete context.__routine;
3205
+ if (context.task || context.routine) {
3206
+ const routine = context.task ?? context.routine;
3207
+ delete context.task;
3208
+ delete context.routine;
3209
3209
  context.__routineExecId = context.__metadata?.__deputyExecId ?? null;
3210
3210
  context.__isDeputy = true;
3211
3211
  this.run(routine, context);