@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.d.mts CHANGED
@@ -651,7 +651,7 @@ declare class GraphRunner extends SignalEmitter {
651
651
  setVerbose(value: boolean): void;
652
652
  destroy(): void;
653
653
  setStrategy(strategy: GraphRunStrategy): void;
654
- startRun(context: AnyObject): boolean;
654
+ startRun(context: AnyObject, emit: (signal: string, ctx: AnyObject) => void): boolean;
655
655
  }
656
656
 
657
657
  declare class SignalBroker {
package/dist/index.d.ts CHANGED
@@ -651,7 +651,7 @@ declare class GraphRunner extends SignalEmitter {
651
651
  setVerbose(value: boolean): void;
652
652
  destroy(): void;
653
653
  setStrategy(strategy: GraphRunStrategy): void;
654
- startRun(context: AnyObject): boolean;
654
+ startRun(context: AnyObject, emit: (signal: string, ctx: AnyObject) => void): boolean;
655
655
  }
656
656
 
657
657
  declare class SignalBroker {
package/dist/index.js CHANGED
@@ -862,7 +862,6 @@ var GraphNode = class _GraphNode extends SignalEmitter {
862
862
  return this.executionStart;
863
863
  }
864
864
  end() {
865
- var _a;
866
865
  if (this.executionStart === 0) {
867
866
  return 0;
868
867
  }
@@ -897,24 +896,21 @@ var GraphNode = class _GraphNode extends SignalEmitter {
897
896
  });
898
897
  if (this.graphDone()) {
899
898
  const context2 = this.context.export();
900
- if ((_a = context2.context.__metadata) == null ? void 0 : _a.__deputyExecId)
899
+ if (context2.context.__isDeputy)
901
900
  this.emitWithMetadata(
902
- `meta.node.graph_completed:${context2.context.__metadata.__deputyExecId}`,
903
- context2
901
+ `meta.node.graph_completed:${this.routineExecId}`,
902
+ context2.context
904
903
  );
905
- this.emitMetricsWithMetadata(
906
- `meta.node.ended_routine_execution:${this.routineExecId}`,
907
- {
908
- data: {
909
- isRunning: false,
910
- isComplete: true,
911
- resultContext: this.context.export(),
912
- progress: 1,
913
- ended: formatTimestamp(end)
914
- },
915
- filter: { uuid: this.routineExecId }
916
- }
917
- );
904
+ this.emitMetricsWithMetadata("meta.node.ended_routine_execution", {
905
+ data: {
906
+ isRunning: false,
907
+ isComplete: true,
908
+ resultContext: context2,
909
+ progress: 1,
910
+ ended: formatTimestamp(end)
911
+ },
912
+ filter: { uuid: this.routineExecId }
913
+ });
918
914
  }
919
915
  return end;
920
916
  }
@@ -2215,6 +2211,7 @@ var GraphRegistry = class _GraphRegistry {
2215
2211
  const { __name } = context;
2216
2212
  for (const task of this.tasks.values()) {
2217
2213
  if (task.name === __name) {
2214
+ console.log("TASK FOUND", task.name);
2218
2215
  return { ...context, __task: task };
2219
2216
  }
2220
2217
  }
@@ -2479,15 +2476,21 @@ var GraphRunner = class extends SignalEmitter {
2479
2476
  this.currentRun = new GraphRun(this.strategy);
2480
2477
  }
2481
2478
  }
2482
- startRun(context) {
2483
- var _a;
2479
+ startRun(context, emit) {
2480
+ var _a, _b, _c;
2481
+ console.log("START RUN", context);
2484
2482
  if (context.__task || context.__routine) {
2485
2483
  const routine = (_a = context.__task) != null ? _a : context.__routine;
2484
+ delete context.__task;
2485
+ delete context.__routine;
2486
+ context.__routineExecId = (_c = (_b = context.__metadata) == null ? void 0 : _b.__deputyExecId) != null ? _c : null;
2487
+ context.__isDeputy = true;
2486
2488
  this.run(routine, context);
2487
2489
  return true;
2488
2490
  } else {
2489
2491
  context.errored = true;
2490
2492
  context.__error = "No routine or task defined.";
2493
+ emit("meta.runner.failed", context);
2491
2494
  return false;
2492
2495
  }
2493
2496
  }