@cadenza.io/core 3.0.18 → 3.0.20

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
@@ -825,7 +825,6 @@ var GraphNode = class _GraphNode extends SignalEmitter {
825
825
  return this.executionStart;
826
826
  }
827
827
  end() {
828
- var _a;
829
828
  if (this.executionStart === 0) {
830
829
  return 0;
831
830
  }
@@ -860,24 +859,21 @@ var GraphNode = class _GraphNode extends SignalEmitter {
860
859
  });
861
860
  if (this.graphDone()) {
862
861
  const context2 = this.context.export();
863
- if ((_a = context2.context.__metadata) == null ? void 0 : _a.__deputyExecId)
862
+ if (context2.context.__isDeputy)
864
863
  this.emitWithMetadata(
865
- `meta.node.graph_completed:${context2.context.__metadata.__deputyExecId}`,
866
- context2
864
+ `meta.node.graph_completed:${this.routineExecId}`,
865
+ context2.context
867
866
  );
868
- this.emitMetricsWithMetadata(
869
- `meta.node.ended_routine_execution:${this.routineExecId}`,
870
- {
871
- data: {
872
- isRunning: false,
873
- isComplete: true,
874
- resultContext: this.context.export(),
875
- progress: 1,
876
- ended: formatTimestamp(end)
877
- },
878
- filter: { uuid: this.routineExecId }
879
- }
880
- );
867
+ this.emitMetricsWithMetadata("meta.node.ended_routine_execution", {
868
+ data: {
869
+ isRunning: false,
870
+ isComplete: true,
871
+ resultContext: context2,
872
+ progress: 1,
873
+ ended: formatTimestamp(end)
874
+ },
875
+ filter: { uuid: this.routineExecId }
876
+ });
881
877
  }
882
878
  return end;
883
879
  }
@@ -2178,6 +2174,7 @@ var GraphRegistry = class _GraphRegistry {
2178
2174
  const { __name } = context;
2179
2175
  for (const task of this.tasks.values()) {
2180
2176
  if (task.name === __name) {
2177
+ console.log("TASK FOUND", task.name);
2181
2178
  return { ...context, __task: task };
2182
2179
  }
2183
2180
  }
@@ -2442,15 +2439,21 @@ var GraphRunner = class extends SignalEmitter {
2442
2439
  this.currentRun = new GraphRun(this.strategy);
2443
2440
  }
2444
2441
  }
2445
- startRun(context) {
2446
- var _a;
2442
+ startRun(context, emit) {
2443
+ var _a, _b, _c;
2444
+ console.log("START RUN", context);
2447
2445
  if (context.__task || context.__routine) {
2448
2446
  const routine = (_a = context.__task) != null ? _a : context.__routine;
2447
+ delete context.__task;
2448
+ delete context.__routine;
2449
+ context.__routineExecId = (_c = (_b = context.__metadata) == null ? void 0 : _b.__deputyExecId) != null ? _c : null;
2450
+ context.__isDeputy = true;
2449
2451
  this.run(routine, context);
2450
2452
  return true;
2451
2453
  } else {
2452
2454
  context.errored = true;
2453
2455
  context.__error = "No routine or task defined.";
2456
+ emit("meta.runner.failed", context);
2454
2457
  return false;
2455
2458
  }
2456
2459
  }