@cadenza.io/core 1.3.0 → 1.4.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 +43 -67
- package/dist/index.d.ts +43 -67
- package/dist/index.js +153 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -369,10 +369,10 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
369
369
|
readonly description: string;
|
|
370
370
|
concurrency: number;
|
|
371
371
|
timeout: number;
|
|
372
|
+
readonly isMeta: boolean;
|
|
372
373
|
readonly isUnique: boolean;
|
|
373
374
|
readonly throttled: boolean;
|
|
374
375
|
readonly isSignal: boolean;
|
|
375
|
-
readonly isMeta: boolean;
|
|
376
376
|
readonly isDeputy: boolean;
|
|
377
377
|
readonly isEphemeral: boolean;
|
|
378
378
|
layerIndex: number;
|
|
@@ -390,9 +390,11 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
390
390
|
* @param concurrency Limit.
|
|
391
391
|
* @param timeout ms.
|
|
392
392
|
* @param register Register via signal (default true).
|
|
393
|
+
* @param isUnique
|
|
394
|
+
* @param isMeta
|
|
393
395
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
394
396
|
*/
|
|
395
|
-
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean);
|
|
397
|
+
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
396
398
|
getTag(context?: AnyObject): string;
|
|
397
399
|
setGlobalId(id: string): void;
|
|
398
400
|
setTimeout(timeout: number): void;
|
|
@@ -479,7 +481,7 @@ declare class GraphRoutine extends SignalParticipant {
|
|
|
479
481
|
readonly description: string;
|
|
480
482
|
readonly isMeta: boolean;
|
|
481
483
|
private tasks;
|
|
482
|
-
constructor(name: string, tasks: Task[], description: string);
|
|
484
|
+
constructor(name: string, tasks: Task[], description: string, isMeta?: boolean);
|
|
483
485
|
/**
|
|
484
486
|
* Applies callback to starting tasks.
|
|
485
487
|
* @param callBack The callback.
|
|
@@ -545,18 +547,20 @@ declare class SignalBroker {
|
|
|
545
547
|
static get instance(): SignalBroker;
|
|
546
548
|
protected runner: GraphRunner | undefined;
|
|
547
549
|
protected metaRunner: GraphRunner | undefined;
|
|
550
|
+
getSignalsTask: Task | undefined;
|
|
548
551
|
protected signalObservers: Map<string, {
|
|
549
552
|
fn: (runner: GraphRunner, tasks: (Task | GraphRoutine)[], context: AnyObject) => void;
|
|
550
553
|
tasks: Set<Task | GraphRoutine>;
|
|
551
554
|
}>;
|
|
552
|
-
protected emitStacks: Map<string,
|
|
555
|
+
protected emitStacks: Map<string, Map<string, AnyObject>>;
|
|
553
556
|
protected constructor();
|
|
554
557
|
/**
|
|
555
558
|
* Initializes with runners.
|
|
556
559
|
* @param runner Standard runner for user signals.
|
|
557
560
|
* @param metaRunner Meta runner for 'meta.' signals (suppresses further meta-emits).
|
|
558
561
|
*/
|
|
559
|
-
|
|
562
|
+
bootstrap(runner: GraphRunner, metaRunner: GraphRunner): void;
|
|
563
|
+
init(): void;
|
|
560
564
|
/**
|
|
561
565
|
* Observes a signal with a routine/task.
|
|
562
566
|
* @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
|
|
@@ -580,6 +584,7 @@ declare class SignalBroker {
|
|
|
580
584
|
* @throws Error on detected loop.
|
|
581
585
|
*/
|
|
582
586
|
emit(signal: string, context?: AnyObject): void;
|
|
587
|
+
execute(signal: string, context: AnyObject): boolean;
|
|
583
588
|
private executeListener;
|
|
584
589
|
private addSignal;
|
|
585
590
|
/**
|
|
@@ -591,53 +596,34 @@ declare class SignalBroker {
|
|
|
591
596
|
reset(): void;
|
|
592
597
|
}
|
|
593
598
|
|
|
594
|
-
declare class MetaTask extends Task {
|
|
595
|
-
readonly isMeta: boolean;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
599
|
declare class GraphRegistry {
|
|
599
600
|
private static _instance;
|
|
600
601
|
static get instance(): GraphRegistry;
|
|
601
602
|
private tasks;
|
|
602
603
|
private routines;
|
|
603
|
-
registerTask:
|
|
604
|
-
updateTaskId:
|
|
605
|
-
getTaskById:
|
|
606
|
-
getTaskByName:
|
|
607
|
-
getTasksByLayer:
|
|
608
|
-
getAllTasks:
|
|
609
|
-
doForEachTask:
|
|
610
|
-
deleteTask:
|
|
611
|
-
registerRoutine:
|
|
612
|
-
updateRoutineId:
|
|
613
|
-
getRoutineById:
|
|
614
|
-
getRoutineByName:
|
|
615
|
-
getAllRoutines:
|
|
616
|
-
doForEachRoutine:
|
|
617
|
-
deleteRoutine:
|
|
604
|
+
registerTask: Task;
|
|
605
|
+
updateTaskId: Task;
|
|
606
|
+
getTaskById: Task;
|
|
607
|
+
getTaskByName: Task;
|
|
608
|
+
getTasksByLayer: Task;
|
|
609
|
+
getAllTasks: Task;
|
|
610
|
+
doForEachTask: Task;
|
|
611
|
+
deleteTask: Task;
|
|
612
|
+
registerRoutine: Task;
|
|
613
|
+
updateRoutineId: Task;
|
|
614
|
+
getRoutineById: Task;
|
|
615
|
+
getRoutineByName: Task;
|
|
616
|
+
getAllRoutines: Task;
|
|
617
|
+
doForEachRoutine: Task;
|
|
618
|
+
deleteRoutine: Task;
|
|
618
619
|
private constructor();
|
|
619
620
|
reset(): void;
|
|
620
621
|
}
|
|
621
622
|
|
|
622
|
-
declare class UniqueTask extends Task {
|
|
623
|
-
readonly isUnique: boolean;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
declare class UniqueMetaTask extends UniqueTask {
|
|
627
|
-
readonly isMeta: boolean;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
623
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
631
624
|
declare class ThrottledTask extends Task {
|
|
632
625
|
readonly throttled: boolean;
|
|
633
|
-
constructor(name: string, task: TaskFunction, description?: string, getTagCallback?: ThrottleTagGetter, concurrency?: number, timeout?: number, register?: boolean);
|
|
634
|
-
export(): {
|
|
635
|
-
__getTagCallback: string;
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
declare class ThrottledMetaTask extends ThrottledTask {
|
|
640
|
-
readonly isMeta: boolean;
|
|
626
|
+
constructor(name: string, task: TaskFunction, description?: string, getTagCallback?: ThrottleTagGetter, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
641
627
|
}
|
|
642
628
|
|
|
643
629
|
interface DebounceOptions {
|
|
@@ -653,32 +639,20 @@ declare class DebounceTask extends Task {
|
|
|
653
639
|
private lastReject;
|
|
654
640
|
private lastContext;
|
|
655
641
|
private lastTimeout;
|
|
656
|
-
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, concurrency?: number, timeout?: number, register?: boolean);
|
|
642
|
+
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
657
643
|
private executeFunction;
|
|
658
644
|
private debouncedTrigger;
|
|
659
645
|
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
660
646
|
}
|
|
661
647
|
|
|
662
|
-
declare class DebouncedMetaTask extends DebounceTask {
|
|
663
|
-
readonly isMeta: boolean;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
648
|
declare class EphemeralTask extends Task {
|
|
667
649
|
private readonly once;
|
|
668
650
|
private readonly condition;
|
|
669
651
|
readonly isEphemeral: boolean;
|
|
670
|
-
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean);
|
|
652
|
+
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
671
653
|
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
672
654
|
}
|
|
673
655
|
|
|
674
|
-
declare class EphemeralMetaTask extends EphemeralTask {
|
|
675
|
-
readonly isMeta: boolean;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
declare class MetaRoutine extends GraphRoutine {
|
|
679
|
-
readonly isMeta: boolean;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
656
|
declare class GraphAsyncRun extends GraphRunStrategy {
|
|
683
657
|
constructor();
|
|
684
658
|
run(): Promise<void>;
|
|
@@ -695,14 +669,16 @@ interface TaskOptions {
|
|
|
695
669
|
concurrency?: number;
|
|
696
670
|
timeout?: number;
|
|
697
671
|
register?: boolean;
|
|
672
|
+
isUnique?: boolean;
|
|
673
|
+
isMeta?: boolean;
|
|
698
674
|
}
|
|
699
675
|
declare class Cadenza {
|
|
700
676
|
static broker: SignalBroker;
|
|
701
677
|
static runner: GraphRunner;
|
|
702
678
|
static metaRunner: GraphRunner;
|
|
703
679
|
static registry: GraphRegistry;
|
|
704
|
-
|
|
705
|
-
|
|
680
|
+
protected static isBootstrapped: boolean;
|
|
681
|
+
protected static bootstrap(): void;
|
|
706
682
|
static get runStrategy(): {
|
|
707
683
|
PARALLEL: GraphAsyncRun;
|
|
708
684
|
SEQUENTIAL: GraphStandardRun;
|
|
@@ -712,7 +688,7 @@ declare class Cadenza {
|
|
|
712
688
|
* @param name The name to validate.
|
|
713
689
|
* @throws Error if invalid.
|
|
714
690
|
*/
|
|
715
|
-
|
|
691
|
+
protected static validateName(name: string): void;
|
|
716
692
|
/**
|
|
717
693
|
* Creates a standard Task and registers it in the GraphRegistry.
|
|
718
694
|
* @param name Unique identifier for the task.
|
|
@@ -733,7 +709,7 @@ declare class Cadenza {
|
|
|
733
709
|
* @returns The created MetaTask instance.
|
|
734
710
|
* @throws Error if name invalid or duplicate.
|
|
735
711
|
*/
|
|
736
|
-
static createMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
712
|
+
static createMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
737
713
|
/**
|
|
738
714
|
* Creates a UniqueTask (executes once per execution ID, merging parents) and registers it.
|
|
739
715
|
* Use for fan-in/joins after parallel branches.
|
|
@@ -744,7 +720,7 @@ declare class Cadenza {
|
|
|
744
720
|
* @returns The created UniqueTask.
|
|
745
721
|
* @throws Error if invalid.
|
|
746
722
|
*/
|
|
747
|
-
static createUniqueTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
723
|
+
static createUniqueTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
748
724
|
/**
|
|
749
725
|
* Creates a UniqueMetaTask for meta-layer joins.
|
|
750
726
|
* @param name Unique identifier.
|
|
@@ -753,7 +729,7 @@ declare class Cadenza {
|
|
|
753
729
|
* @param options Optional task options.
|
|
754
730
|
* @returns The created UniqueMetaTask.
|
|
755
731
|
*/
|
|
756
|
-
static createUniqueMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
732
|
+
static createUniqueMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
757
733
|
/**
|
|
758
734
|
* Creates a ThrottledTask (rate-limited by concurrency or custom groups) and registers it.
|
|
759
735
|
* @param name Unique identifier.
|
|
@@ -774,7 +750,7 @@ declare class Cadenza {
|
|
|
774
750
|
* @param options Optional task options.
|
|
775
751
|
* @returns The created ThrottledMetaTask.
|
|
776
752
|
*/
|
|
777
|
-
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions):
|
|
753
|
+
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions): ThrottledTask;
|
|
778
754
|
/**
|
|
779
755
|
* Creates a DebounceTask (delays exec until quiet period) and registers it.
|
|
780
756
|
* @param name Identifier.
|
|
@@ -795,7 +771,7 @@ declare class Cadenza {
|
|
|
795
771
|
* @param options Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
796
772
|
* @returns The created DebouncedMetaTask.
|
|
797
773
|
*/
|
|
798
|
-
static createDebounceMetaTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions):
|
|
774
|
+
static createDebounceMetaTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions): DebounceTask;
|
|
799
775
|
/**
|
|
800
776
|
* Creates an EphemeralTask (self-destructs after exec or condition) without default registration.
|
|
801
777
|
* Useful for transients; optionally register if needed.
|
|
@@ -819,7 +795,7 @@ declare class Cadenza {
|
|
|
819
795
|
* @param options Optional task options.
|
|
820
796
|
* @returns The created EphemeralMetaTask.
|
|
821
797
|
*/
|
|
822
|
-
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, once?: boolean, destroyCondition?: (context: any) => boolean, options?: TaskOptions):
|
|
798
|
+
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, once?: boolean, destroyCondition?: (context: any) => boolean, options?: TaskOptions): EphemeralTask;
|
|
823
799
|
/**
|
|
824
800
|
* Creates a GraphRoutine (named entry to starting tasks) and registers it.
|
|
825
801
|
* @param name Unique identifier.
|
|
@@ -836,7 +812,7 @@ declare class Cadenza {
|
|
|
836
812
|
* @param description Optional.
|
|
837
813
|
* @returns The created MetaRoutine.
|
|
838
814
|
*/
|
|
839
|
-
static createMetaRoutine(name: string, tasks: Task[], description?: string):
|
|
815
|
+
static createMetaRoutine(name: string, tasks: Task[], description?: string): GraphRoutine;
|
|
840
816
|
static reset(): void;
|
|
841
817
|
}
|
|
842
818
|
|
|
@@ -844,8 +820,8 @@ declare class SignalTask extends Task {
|
|
|
844
820
|
constructor(signal: string, description?: string);
|
|
845
821
|
}
|
|
846
822
|
|
|
847
|
-
declare class
|
|
848
|
-
readonly
|
|
823
|
+
declare class UniqueTask extends Task {
|
|
824
|
+
readonly isUnique: boolean;
|
|
849
825
|
}
|
|
850
826
|
|
|
851
|
-
export { type AnyObject, DebounceTask,
|
|
827
|
+
export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, ThrottledTask, UniqueTask, Cadenza as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -369,10 +369,10 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
369
369
|
readonly description: string;
|
|
370
370
|
concurrency: number;
|
|
371
371
|
timeout: number;
|
|
372
|
+
readonly isMeta: boolean;
|
|
372
373
|
readonly isUnique: boolean;
|
|
373
374
|
readonly throttled: boolean;
|
|
374
375
|
readonly isSignal: boolean;
|
|
375
|
-
readonly isMeta: boolean;
|
|
376
376
|
readonly isDeputy: boolean;
|
|
377
377
|
readonly isEphemeral: boolean;
|
|
378
378
|
layerIndex: number;
|
|
@@ -390,9 +390,11 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
390
390
|
* @param concurrency Limit.
|
|
391
391
|
* @param timeout ms.
|
|
392
392
|
* @param register Register via signal (default true).
|
|
393
|
+
* @param isUnique
|
|
394
|
+
* @param isMeta
|
|
393
395
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
394
396
|
*/
|
|
395
|
-
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean);
|
|
397
|
+
constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
396
398
|
getTag(context?: AnyObject): string;
|
|
397
399
|
setGlobalId(id: string): void;
|
|
398
400
|
setTimeout(timeout: number): void;
|
|
@@ -479,7 +481,7 @@ declare class GraphRoutine extends SignalParticipant {
|
|
|
479
481
|
readonly description: string;
|
|
480
482
|
readonly isMeta: boolean;
|
|
481
483
|
private tasks;
|
|
482
|
-
constructor(name: string, tasks: Task[], description: string);
|
|
484
|
+
constructor(name: string, tasks: Task[], description: string, isMeta?: boolean);
|
|
483
485
|
/**
|
|
484
486
|
* Applies callback to starting tasks.
|
|
485
487
|
* @param callBack The callback.
|
|
@@ -545,18 +547,20 @@ declare class SignalBroker {
|
|
|
545
547
|
static get instance(): SignalBroker;
|
|
546
548
|
protected runner: GraphRunner | undefined;
|
|
547
549
|
protected metaRunner: GraphRunner | undefined;
|
|
550
|
+
getSignalsTask: Task | undefined;
|
|
548
551
|
protected signalObservers: Map<string, {
|
|
549
552
|
fn: (runner: GraphRunner, tasks: (Task | GraphRoutine)[], context: AnyObject) => void;
|
|
550
553
|
tasks: Set<Task | GraphRoutine>;
|
|
551
554
|
}>;
|
|
552
|
-
protected emitStacks: Map<string,
|
|
555
|
+
protected emitStacks: Map<string, Map<string, AnyObject>>;
|
|
553
556
|
protected constructor();
|
|
554
557
|
/**
|
|
555
558
|
* Initializes with runners.
|
|
556
559
|
* @param runner Standard runner for user signals.
|
|
557
560
|
* @param metaRunner Meta runner for 'meta.' signals (suppresses further meta-emits).
|
|
558
561
|
*/
|
|
559
|
-
|
|
562
|
+
bootstrap(runner: GraphRunner, metaRunner: GraphRunner): void;
|
|
563
|
+
init(): void;
|
|
560
564
|
/**
|
|
561
565
|
* Observes a signal with a routine/task.
|
|
562
566
|
* @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
|
|
@@ -580,6 +584,7 @@ declare class SignalBroker {
|
|
|
580
584
|
* @throws Error on detected loop.
|
|
581
585
|
*/
|
|
582
586
|
emit(signal: string, context?: AnyObject): void;
|
|
587
|
+
execute(signal: string, context: AnyObject): boolean;
|
|
583
588
|
private executeListener;
|
|
584
589
|
private addSignal;
|
|
585
590
|
/**
|
|
@@ -591,53 +596,34 @@ declare class SignalBroker {
|
|
|
591
596
|
reset(): void;
|
|
592
597
|
}
|
|
593
598
|
|
|
594
|
-
declare class MetaTask extends Task {
|
|
595
|
-
readonly isMeta: boolean;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
599
|
declare class GraphRegistry {
|
|
599
600
|
private static _instance;
|
|
600
601
|
static get instance(): GraphRegistry;
|
|
601
602
|
private tasks;
|
|
602
603
|
private routines;
|
|
603
|
-
registerTask:
|
|
604
|
-
updateTaskId:
|
|
605
|
-
getTaskById:
|
|
606
|
-
getTaskByName:
|
|
607
|
-
getTasksByLayer:
|
|
608
|
-
getAllTasks:
|
|
609
|
-
doForEachTask:
|
|
610
|
-
deleteTask:
|
|
611
|
-
registerRoutine:
|
|
612
|
-
updateRoutineId:
|
|
613
|
-
getRoutineById:
|
|
614
|
-
getRoutineByName:
|
|
615
|
-
getAllRoutines:
|
|
616
|
-
doForEachRoutine:
|
|
617
|
-
deleteRoutine:
|
|
604
|
+
registerTask: Task;
|
|
605
|
+
updateTaskId: Task;
|
|
606
|
+
getTaskById: Task;
|
|
607
|
+
getTaskByName: Task;
|
|
608
|
+
getTasksByLayer: Task;
|
|
609
|
+
getAllTasks: Task;
|
|
610
|
+
doForEachTask: Task;
|
|
611
|
+
deleteTask: Task;
|
|
612
|
+
registerRoutine: Task;
|
|
613
|
+
updateRoutineId: Task;
|
|
614
|
+
getRoutineById: Task;
|
|
615
|
+
getRoutineByName: Task;
|
|
616
|
+
getAllRoutines: Task;
|
|
617
|
+
doForEachRoutine: Task;
|
|
618
|
+
deleteRoutine: Task;
|
|
618
619
|
private constructor();
|
|
619
620
|
reset(): void;
|
|
620
621
|
}
|
|
621
622
|
|
|
622
|
-
declare class UniqueTask extends Task {
|
|
623
|
-
readonly isUnique: boolean;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
declare class UniqueMetaTask extends UniqueTask {
|
|
627
|
-
readonly isMeta: boolean;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
623
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
631
624
|
declare class ThrottledTask extends Task {
|
|
632
625
|
readonly throttled: boolean;
|
|
633
|
-
constructor(name: string, task: TaskFunction, description?: string, getTagCallback?: ThrottleTagGetter, concurrency?: number, timeout?: number, register?: boolean);
|
|
634
|
-
export(): {
|
|
635
|
-
__getTagCallback: string;
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
declare class ThrottledMetaTask extends ThrottledTask {
|
|
640
|
-
readonly isMeta: boolean;
|
|
626
|
+
constructor(name: string, task: TaskFunction, description?: string, getTagCallback?: ThrottleTagGetter, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
641
627
|
}
|
|
642
628
|
|
|
643
629
|
interface DebounceOptions {
|
|
@@ -653,32 +639,20 @@ declare class DebounceTask extends Task {
|
|
|
653
639
|
private lastReject;
|
|
654
640
|
private lastContext;
|
|
655
641
|
private lastTimeout;
|
|
656
|
-
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, concurrency?: number, timeout?: number, register?: boolean);
|
|
642
|
+
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
657
643
|
private executeFunction;
|
|
658
644
|
private debouncedTrigger;
|
|
659
645
|
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
660
646
|
}
|
|
661
647
|
|
|
662
|
-
declare class DebouncedMetaTask extends DebounceTask {
|
|
663
|
-
readonly isMeta: boolean;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
648
|
declare class EphemeralTask extends Task {
|
|
667
649
|
private readonly once;
|
|
668
650
|
private readonly condition;
|
|
669
651
|
readonly isEphemeral: boolean;
|
|
670
|
-
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean);
|
|
652
|
+
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean);
|
|
671
653
|
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
672
654
|
}
|
|
673
655
|
|
|
674
|
-
declare class EphemeralMetaTask extends EphemeralTask {
|
|
675
|
-
readonly isMeta: boolean;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
declare class MetaRoutine extends GraphRoutine {
|
|
679
|
-
readonly isMeta: boolean;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
656
|
declare class GraphAsyncRun extends GraphRunStrategy {
|
|
683
657
|
constructor();
|
|
684
658
|
run(): Promise<void>;
|
|
@@ -695,14 +669,16 @@ interface TaskOptions {
|
|
|
695
669
|
concurrency?: number;
|
|
696
670
|
timeout?: number;
|
|
697
671
|
register?: boolean;
|
|
672
|
+
isUnique?: boolean;
|
|
673
|
+
isMeta?: boolean;
|
|
698
674
|
}
|
|
699
675
|
declare class Cadenza {
|
|
700
676
|
static broker: SignalBroker;
|
|
701
677
|
static runner: GraphRunner;
|
|
702
678
|
static metaRunner: GraphRunner;
|
|
703
679
|
static registry: GraphRegistry;
|
|
704
|
-
|
|
705
|
-
|
|
680
|
+
protected static isBootstrapped: boolean;
|
|
681
|
+
protected static bootstrap(): void;
|
|
706
682
|
static get runStrategy(): {
|
|
707
683
|
PARALLEL: GraphAsyncRun;
|
|
708
684
|
SEQUENTIAL: GraphStandardRun;
|
|
@@ -712,7 +688,7 @@ declare class Cadenza {
|
|
|
712
688
|
* @param name The name to validate.
|
|
713
689
|
* @throws Error if invalid.
|
|
714
690
|
*/
|
|
715
|
-
|
|
691
|
+
protected static validateName(name: string): void;
|
|
716
692
|
/**
|
|
717
693
|
* Creates a standard Task and registers it in the GraphRegistry.
|
|
718
694
|
* @param name Unique identifier for the task.
|
|
@@ -733,7 +709,7 @@ declare class Cadenza {
|
|
|
733
709
|
* @returns The created MetaTask instance.
|
|
734
710
|
* @throws Error if name invalid or duplicate.
|
|
735
711
|
*/
|
|
736
|
-
static createMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
712
|
+
static createMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
737
713
|
/**
|
|
738
714
|
* Creates a UniqueTask (executes once per execution ID, merging parents) and registers it.
|
|
739
715
|
* Use for fan-in/joins after parallel branches.
|
|
@@ -744,7 +720,7 @@ declare class Cadenza {
|
|
|
744
720
|
* @returns The created UniqueTask.
|
|
745
721
|
* @throws Error if invalid.
|
|
746
722
|
*/
|
|
747
|
-
static createUniqueTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
723
|
+
static createUniqueTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
748
724
|
/**
|
|
749
725
|
* Creates a UniqueMetaTask for meta-layer joins.
|
|
750
726
|
* @param name Unique identifier.
|
|
@@ -753,7 +729,7 @@ declare class Cadenza {
|
|
|
753
729
|
* @param options Optional task options.
|
|
754
730
|
* @returns The created UniqueMetaTask.
|
|
755
731
|
*/
|
|
756
|
-
static createUniqueMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions):
|
|
732
|
+
static createUniqueMetaTask(name: string, func: TaskFunction, description?: string, options?: TaskOptions): Task;
|
|
757
733
|
/**
|
|
758
734
|
* Creates a ThrottledTask (rate-limited by concurrency or custom groups) and registers it.
|
|
759
735
|
* @param name Unique identifier.
|
|
@@ -774,7 +750,7 @@ declare class Cadenza {
|
|
|
774
750
|
* @param options Optional task options.
|
|
775
751
|
* @returns The created ThrottledMetaTask.
|
|
776
752
|
*/
|
|
777
|
-
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions):
|
|
753
|
+
static createThrottledMetaTask(name: string, func: TaskFunction, throttledIdGetter?: ThrottleTagGetter, description?: string, options?: TaskOptions): ThrottledTask;
|
|
778
754
|
/**
|
|
779
755
|
* Creates a DebounceTask (delays exec until quiet period) and registers it.
|
|
780
756
|
* @param name Identifier.
|
|
@@ -795,7 +771,7 @@ declare class Cadenza {
|
|
|
795
771
|
* @param options Optional task options plus optional debounce config (e.g., leading/trailing).
|
|
796
772
|
* @returns The created DebouncedMetaTask.
|
|
797
773
|
*/
|
|
798
|
-
static createDebounceMetaTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions):
|
|
774
|
+
static createDebounceMetaTask(name: string, func: TaskFunction, description?: string, debounceTime?: number, options?: TaskOptions & DebounceOptions): DebounceTask;
|
|
799
775
|
/**
|
|
800
776
|
* Creates an EphemeralTask (self-destructs after exec or condition) without default registration.
|
|
801
777
|
* Useful for transients; optionally register if needed.
|
|
@@ -819,7 +795,7 @@ declare class Cadenza {
|
|
|
819
795
|
* @param options Optional task options.
|
|
820
796
|
* @returns The created EphemeralMetaTask.
|
|
821
797
|
*/
|
|
822
|
-
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, once?: boolean, destroyCondition?: (context: any) => boolean, options?: TaskOptions):
|
|
798
|
+
static createEphemeralMetaTask(name: string, func: TaskFunction, description?: string, once?: boolean, destroyCondition?: (context: any) => boolean, options?: TaskOptions): EphemeralTask;
|
|
823
799
|
/**
|
|
824
800
|
* Creates a GraphRoutine (named entry to starting tasks) and registers it.
|
|
825
801
|
* @param name Unique identifier.
|
|
@@ -836,7 +812,7 @@ declare class Cadenza {
|
|
|
836
812
|
* @param description Optional.
|
|
837
813
|
* @returns The created MetaRoutine.
|
|
838
814
|
*/
|
|
839
|
-
static createMetaRoutine(name: string, tasks: Task[], description?: string):
|
|
815
|
+
static createMetaRoutine(name: string, tasks: Task[], description?: string): GraphRoutine;
|
|
840
816
|
static reset(): void;
|
|
841
817
|
}
|
|
842
818
|
|
|
@@ -844,8 +820,8 @@ declare class SignalTask extends Task {
|
|
|
844
820
|
constructor(signal: string, description?: string);
|
|
845
821
|
}
|
|
846
822
|
|
|
847
|
-
declare class
|
|
848
|
-
readonly
|
|
823
|
+
declare class UniqueTask extends Task {
|
|
824
|
+
readonly isUnique: boolean;
|
|
849
825
|
}
|
|
850
826
|
|
|
851
|
-
export { type AnyObject, DebounceTask,
|
|
827
|
+
export { type AnyObject, DebounceTask, EphemeralTask, GraphContext, GraphRegistry, GraphRoutine, GraphRun, SignalEmitter, SignalParticipant, SignalTask, Task, type TaskOptions, type TaskResult, ThrottledTask, UniqueTask, Cadenza as default };
|