@cadenza.io/core 3.15.11 → 3.15.13

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
@@ -1279,6 +1279,7 @@ declare class GraphRoutine extends SignalEmitter {
1279
1279
  readonly isMeta: boolean;
1280
1280
  tasks: Set<Task>;
1281
1281
  registered: boolean;
1282
+ registeredTasks: Set<Task>;
1282
1283
  observedSignals: Set<string>;
1283
1284
  constructor(name: string, tasks: Task[], description: string, isMeta?: boolean);
1284
1285
  /**
@@ -1473,7 +1474,7 @@ declare class SignalBroker {
1473
1474
  * @param startDateTime Optional absolute Date when the *first* emission after `leading` should occur.
1474
1475
  * @returns a handle with `clear()` to stop the loop.
1475
1476
  */
1476
- throttle(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1477
+ interval(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1477
1478
  debounce(signal: string, context: any, delayMs?: number): void;
1478
1479
  /**
1479
1480
  * Emits a signal with the specified context, triggering any associated handlers for that signal.
@@ -1791,9 +1792,10 @@ declare class Cadenza {
1791
1792
  */
1792
1793
  static emit(event: string, data?: AnyObject): void;
1793
1794
  static schedule(taskName: string, context: AnyObject, timeoutMs: number, exactDateTime?: Date): void;
1794
- static throttle(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1795
+ static interval(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1795
1796
  static debounce(signalName: string, context: any, delayMs: number): void;
1796
1797
  static get(taskName: string): Task | undefined;
1798
+ static getRoutine(routineName: string): GraphRoutine | undefined;
1797
1799
  /**
1798
1800
  * Creates and registers a new task with the specified parameters and options.
1799
1801
  * Tasks are the basic building blocks of Cadenza graphs and are responsible for executing logic.
package/dist/index.d.ts CHANGED
@@ -1279,6 +1279,7 @@ declare class GraphRoutine extends SignalEmitter {
1279
1279
  readonly isMeta: boolean;
1280
1280
  tasks: Set<Task>;
1281
1281
  registered: boolean;
1282
+ registeredTasks: Set<Task>;
1282
1283
  observedSignals: Set<string>;
1283
1284
  constructor(name: string, tasks: Task[], description: string, isMeta?: boolean);
1284
1285
  /**
@@ -1473,7 +1474,7 @@ declare class SignalBroker {
1473
1474
  * @param startDateTime Optional absolute Date when the *first* emission after `leading` should occur.
1474
1475
  * @returns a handle with `clear()` to stop the loop.
1475
1476
  */
1476
- throttle(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1477
+ interval(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1477
1478
  debounce(signal: string, context: any, delayMs?: number): void;
1478
1479
  /**
1479
1480
  * Emits a signal with the specified context, triggering any associated handlers for that signal.
@@ -1791,9 +1792,10 @@ declare class Cadenza {
1791
1792
  */
1792
1793
  static emit(event: string, data?: AnyObject): void;
1793
1794
  static schedule(taskName: string, context: AnyObject, timeoutMs: number, exactDateTime?: Date): void;
1794
- static throttle(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1795
+ static interval(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1795
1796
  static debounce(signalName: string, context: any, delayMs: number): void;
1796
1797
  static get(taskName: string): Task | undefined;
1798
+ static getRoutine(routineName: string): GraphRoutine | undefined;
1797
1799
  /**
1798
1800
  * Creates and registers a new task with the specified parameters and options.
1799
1801
  * Tasks are the basic building blocks of Cadenza graphs and are responsible for executing logic.
package/dist/index.js CHANGED
@@ -448,7 +448,7 @@ var SignalBroker = class _SignalBroker {
448
448
  * @param startDateTime Optional absolute Date when the *first* emission after `leading` should occur.
449
449
  * @returns a handle with `clear()` to stop the loop.
450
450
  */
451
- throttle(signal, context, intervalMs = 6e4, leading = false, startDateTime) {
451
+ interval(signal, context, intervalMs = 6e4, leading = false, startDateTime) {
452
452
  if (intervalMs <= 0) {
453
453
  throw new Error("intervalMs must be a positive number");
454
454
  }
@@ -1776,7 +1776,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
1776
1776
  generateNewNodes(result) {
1777
1777
  const groupId = (0, import_uuid4.v4)();
1778
1778
  const newNodes = [];
1779
- if (typeof result !== "boolean") {
1779
+ if (result && typeof result !== "boolean") {
1780
1780
  this.failed = result.failed !== void 0 && result.failed || result.error !== void 0;
1781
1781
  if (!this.failed) {
1782
1782
  newNodes.push(
@@ -2036,6 +2036,7 @@ var GraphRoutine = class extends SignalEmitter {
2036
2036
  this.isMeta = false;
2037
2037
  this.tasks = /* @__PURE__ */ new Set();
2038
2038
  this.registered = false;
2039
+ this.registeredTasks = /* @__PURE__ */ new Set();
2039
2040
  this.observedSignals = /* @__PURE__ */ new Set();
2040
2041
  this.name = name;
2041
2042
  this.description = description;
@@ -4506,8 +4507,8 @@ var Cadenza = class {
4506
4507
  static schedule(taskName, context, timeoutMs, exactDateTime) {
4507
4508
  this.broker?.schedule(taskName, context, timeoutMs, exactDateTime);
4508
4509
  }
4509
- static throttle(taskName, context, intervalMs, leading = false, startDateTime) {
4510
- this.broker?.throttle(
4510
+ static interval(taskName, context, intervalMs, leading = false, startDateTime) {
4511
+ this.broker?.interval(
4511
4512
  taskName,
4512
4513
  context,
4513
4514
  intervalMs,
@@ -4521,6 +4522,9 @@ var Cadenza = class {
4521
4522
  static get(taskName) {
4522
4523
  return this.registry?.tasks.get(taskName);
4523
4524
  }
4525
+ static getRoutine(routineName) {
4526
+ return this.registry?.routines.get(routineName);
4527
+ }
4524
4528
  /**
4525
4529
  * Creates and registers a new task with the specified parameters and options.
4526
4530
  * Tasks are the basic building blocks of Cadenza graphs and are responsible for executing logic.