@cadenza.io/core 3.13.3 → 3.15.0

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
@@ -1000,6 +1000,7 @@ declare class Task extends SignalEmitter implements Graph {
1000
1000
  * @return {any[]} An array containing the results of applying the callback function to each predecessor task.
1001
1001
  */
1002
1002
  mapPrevious(callback: (task: Task) => any): any[];
1003
+ makeRoutine(name: string, description: string): this;
1003
1004
  /**
1004
1005
  * Adds the specified signals to the current instance, making it observe them.
1005
1006
  * If the instance is already observing a signal, it will be skipped.
@@ -1027,11 +1028,10 @@ declare class Task extends SignalEmitter implements Graph {
1027
1028
  /**
1028
1029
  * Attaches a signal to the current context and emits metadata if the register flag is set.
1029
1030
  *
1030
- * @param {string} signal - The name of the signal to attach.
1031
- * @param {boolean} [isOnFail=false] - Indicates if the signal should be marked as "on fail".
1031
+ * @param {...string} signals - The names of the signals to attach.
1032
1032
  * @return {void} This method does not return a value.
1033
1033
  */
1034
- attachSignal(signal: string, isOnFail?: boolean): void;
1034
+ attachSignal(...signals: string[]): Task;
1035
1035
  /**
1036
1036
  * Unsubscribes the current instance from the specified signals.
1037
1037
  * This method removes the signals from the observedSignals set, unsubscribes
@@ -1358,7 +1358,6 @@ declare class GraphRunner extends SignalEmitter {
1358
1358
  * @edge Creates 'Start run' meta-task chained to registry gets.
1359
1359
  */
1360
1360
  constructor(isMeta?: boolean);
1361
- init(): void;
1362
1361
  /**
1363
1362
  * Adds tasks or routines to the current execution pipeline. Supports both individual tasks,
1364
1363
  * routines, or arrays of tasks and routines. Handles metadata and execution context management.
@@ -1405,7 +1404,6 @@ declare class GraphRunner extends SignalEmitter {
1405
1404
  * @return {void}
1406
1405
  */
1407
1406
  setStrategy(strategy: GraphRunStrategy): void;
1408
- startRun(context: AnyObject, emit: (signal: string, ctx: AnyObject) => void): boolean;
1409
1407
  }
1410
1408
 
1411
1409
  /**
@@ -1431,6 +1429,7 @@ declare class SignalBroker {
1431
1429
  validateSignalName(signalName: string): void;
1432
1430
  runner: GraphRunner | undefined;
1433
1431
  metaRunner: GraphRunner | undefined;
1432
+ debouncedEmitters: Map<string, any>;
1434
1433
  clearSignalsTask: Task | undefined;
1435
1434
  getSignalsTask: Task | undefined;
1436
1435
  registerSignalTask: Task | undefined;
@@ -1439,6 +1438,7 @@ declare class SignalBroker {
1439
1438
  tasks: Set<Task | GraphRoutine>;
1440
1439
  registered: boolean;
1441
1440
  }>;
1441
+ emittedSignalsRegistry: Set<string>;
1442
1442
  emitStacks: Map<string, Map<string, AnyObject>>;
1443
1443
  constructor();
1444
1444
  /**
@@ -1460,6 +1460,7 @@ declare class SignalBroker {
1460
1460
  * @edge Duplicates ignored; supports wildcards for broad listening.
1461
1461
  */
1462
1462
  observe(signal: string, routineOrTask: Task | GraphRoutine): void;
1463
+ registerEmittedSignal(signal: string): void;
1463
1464
  /**
1464
1465
  * Unsubscribes a routine/task from a signal.
1465
1466
  * @param signal The signal.
@@ -1488,6 +1489,7 @@ declare class SignalBroker {
1488
1489
  * @returns a handle with `clear()` to stop the loop.
1489
1490
  */
1490
1491
  throttle(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1492
+ debounce(signal: string, context: any, delayMs?: number): void;
1491
1493
  /**
1492
1494
  * Emits a signal with the specified context, triggering any associated handlers for that signal.
1493
1495
  *
@@ -1532,6 +1534,7 @@ declare class SignalBroker {
1532
1534
  * @returns Array of signals.
1533
1535
  */
1534
1536
  listObservedSignals(): string[];
1537
+ listEmittedSignals(): string[];
1535
1538
  reset(): void;
1536
1539
  }
1537
1540
 
@@ -1804,6 +1807,7 @@ declare class Cadenza {
1804
1807
  static emit(event: string, data?: AnyObject): void;
1805
1808
  static schedule(taskName: string, context: AnyObject, timeoutMs: number, exactDateTime?: Date): void;
1806
1809
  static throttle(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1810
+ static debounce(signalName: string, context: any, delayMs: number): void;
1807
1811
  static get(taskName: string): Task | undefined;
1808
1812
  /**
1809
1813
  * Creates and registers a new task with the specified parameters and options.
package/dist/index.d.ts CHANGED
@@ -1000,6 +1000,7 @@ declare class Task extends SignalEmitter implements Graph {
1000
1000
  * @return {any[]} An array containing the results of applying the callback function to each predecessor task.
1001
1001
  */
1002
1002
  mapPrevious(callback: (task: Task) => any): any[];
1003
+ makeRoutine(name: string, description: string): this;
1003
1004
  /**
1004
1005
  * Adds the specified signals to the current instance, making it observe them.
1005
1006
  * If the instance is already observing a signal, it will be skipped.
@@ -1027,11 +1028,10 @@ declare class Task extends SignalEmitter implements Graph {
1027
1028
  /**
1028
1029
  * Attaches a signal to the current context and emits metadata if the register flag is set.
1029
1030
  *
1030
- * @param {string} signal - The name of the signal to attach.
1031
- * @param {boolean} [isOnFail=false] - Indicates if the signal should be marked as "on fail".
1031
+ * @param {...string} signals - The names of the signals to attach.
1032
1032
  * @return {void} This method does not return a value.
1033
1033
  */
1034
- attachSignal(signal: string, isOnFail?: boolean): void;
1034
+ attachSignal(...signals: string[]): Task;
1035
1035
  /**
1036
1036
  * Unsubscribes the current instance from the specified signals.
1037
1037
  * This method removes the signals from the observedSignals set, unsubscribes
@@ -1358,7 +1358,6 @@ declare class GraphRunner extends SignalEmitter {
1358
1358
  * @edge Creates 'Start run' meta-task chained to registry gets.
1359
1359
  */
1360
1360
  constructor(isMeta?: boolean);
1361
- init(): void;
1362
1361
  /**
1363
1362
  * Adds tasks or routines to the current execution pipeline. Supports both individual tasks,
1364
1363
  * routines, or arrays of tasks and routines. Handles metadata and execution context management.
@@ -1405,7 +1404,6 @@ declare class GraphRunner extends SignalEmitter {
1405
1404
  * @return {void}
1406
1405
  */
1407
1406
  setStrategy(strategy: GraphRunStrategy): void;
1408
- startRun(context: AnyObject, emit: (signal: string, ctx: AnyObject) => void): boolean;
1409
1407
  }
1410
1408
 
1411
1409
  /**
@@ -1431,6 +1429,7 @@ declare class SignalBroker {
1431
1429
  validateSignalName(signalName: string): void;
1432
1430
  runner: GraphRunner | undefined;
1433
1431
  metaRunner: GraphRunner | undefined;
1432
+ debouncedEmitters: Map<string, any>;
1434
1433
  clearSignalsTask: Task | undefined;
1435
1434
  getSignalsTask: Task | undefined;
1436
1435
  registerSignalTask: Task | undefined;
@@ -1439,6 +1438,7 @@ declare class SignalBroker {
1439
1438
  tasks: Set<Task | GraphRoutine>;
1440
1439
  registered: boolean;
1441
1440
  }>;
1441
+ emittedSignalsRegistry: Set<string>;
1442
1442
  emitStacks: Map<string, Map<string, AnyObject>>;
1443
1443
  constructor();
1444
1444
  /**
@@ -1460,6 +1460,7 @@ declare class SignalBroker {
1460
1460
  * @edge Duplicates ignored; supports wildcards for broad listening.
1461
1461
  */
1462
1462
  observe(signal: string, routineOrTask: Task | GraphRoutine): void;
1463
+ registerEmittedSignal(signal: string): void;
1463
1464
  /**
1464
1465
  * Unsubscribes a routine/task from a signal.
1465
1466
  * @param signal The signal.
@@ -1488,6 +1489,7 @@ declare class SignalBroker {
1488
1489
  * @returns a handle with `clear()` to stop the loop.
1489
1490
  */
1490
1491
  throttle(signal: string, context: AnyObject, intervalMs?: number, leading?: boolean, startDateTime?: Date): ThrottleHandle;
1492
+ debounce(signal: string, context: any, delayMs?: number): void;
1491
1493
  /**
1492
1494
  * Emits a signal with the specified context, triggering any associated handlers for that signal.
1493
1495
  *
@@ -1532,6 +1534,7 @@ declare class SignalBroker {
1532
1534
  * @returns Array of signals.
1533
1535
  */
1534
1536
  listObservedSignals(): string[];
1537
+ listEmittedSignals(): string[];
1535
1538
  reset(): void;
1536
1539
  }
1537
1540
 
@@ -1804,6 +1807,7 @@ declare class Cadenza {
1804
1807
  static emit(event: string, data?: AnyObject): void;
1805
1808
  static schedule(taskName: string, context: AnyObject, timeoutMs: number, exactDateTime?: Date): void;
1806
1809
  static throttle(taskName: string, context: AnyObject, intervalMs: number, leading?: boolean, startDateTime?: Date): void;
1810
+ static debounce(signalName: string, context: any, delayMs: number): void;
1807
1811
  static get(taskName: string): Task | undefined;
1808
1812
  /**
1809
1813
  * Creates and registers a new task with the specified parameters and options.