@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/README.md CHANGED
@@ -123,7 +123,7 @@ Cadenza.createTask('My task', (ctx) => {
123
123
  }).emits('meta.some.event');
124
124
 
125
125
  Cadenza.createMetaTask('My meta task', (ctx) => {
126
- console.log(ctx.__task.name);
126
+ console.log(ctx.task.name);
127
127
  return true;
128
128
  })
129
129
  .doOn('meta.some.event')
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 === "__taskInstance" || key === "__routineInstance" || key === "__task" || key === "__routine" || key === "__tasks" || key === "__routines" || key === "__httpServer" || key === "__httpsServer" || key === "__socketServer"
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;
@@ -1317,7 +1317,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1317
1317
  }
1318
1318
  this.emit(signal, data);
1319
1319
  if (!this.task.emitsSignals.has(signal)) {
1320
- this.task.attachSignal(signal);
1320
+ this.task.emitsSignals.add(signal);
1321
1321
  }
1322
1322
  }
1323
1323
  /**
@@ -1345,7 +1345,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1345
1345
  }
1346
1346
  this.emitMetrics(signal, data);
1347
1347
  if (!this.task.emitsSignals.has(signal)) {
1348
- this.task.attachSignal(signal);
1348
+ this.task.emitsSignals.add(signal);
1349
1349
  }
1350
1350
  }
1351
1351
  /**
@@ -1862,7 +1862,7 @@ var GraphRoutine = class extends SignalEmitter {
1862
1862
  description: this.description,
1863
1863
  isMeta: this.isMeta
1864
1864
  },
1865
- __routineInstance: this
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
- __taskInstance: this,
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 { __taskInstance } = context;
2912
- if (__taskInstance && !this.tasks.has(__taskInstance.name)) {
2913
- this.tasks.set(__taskInstance.name, __taskInstance);
2911
+ const { taskInstance } = context;
2912
+ if (taskInstance && !this.tasks.has(taskInstance.name)) {
2913
+ this.tasks.set(taskInstance.name, taskInstance);
2914
2914
  }
2915
- delete context.__taskInstance;
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, __task: task };
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, __tasks: layerTasks };
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, __tasks: Array.from(this.tasks.values()) }),
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, __task: task };
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 { __routineInstance } = context;
3001
- if (__routineInstance && !this.routines.has(__routineInstance.name)) {
3002
- this.routines.set(__routineInstance.name, __routineInstance);
3000
+ const { routineInstance } = context;
3001
+ if (routineInstance && !this.routines.has(routineInstance.name)) {
3002
+ this.routines.set(routineInstance.name, routineInstance);
3003
3003
  }
3004
- delete context.__routineInstance;
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, __routine: routine };
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
- __routines: Array.from(this.routines.values())
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, __routine: routine };
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.__task || context.__routine) {
3243
- const routine = context.__task ?? context.__routine;
3244
- delete context.__task;
3245
- delete context.__routine;
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);