@cadenza.io/core 1.8.0 → 1.9.1
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 +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +75 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -119,13 +119,13 @@ declare abstract class SignalEmitter {
|
|
|
119
119
|
* @param data Optional payload (defaults to empty object).
|
|
120
120
|
* @edge No emission if silent; for metrics in silent mode, consider override or separate method.
|
|
121
121
|
*/
|
|
122
|
-
emit(signal: string, data?:
|
|
122
|
+
protected emit(signal: string, data?: AnyObject): void;
|
|
123
123
|
/**
|
|
124
124
|
* Emits a signal via the broker even if silent.
|
|
125
125
|
* @param signal The signal name.
|
|
126
126
|
* @param data Optional payload (defaults to empty object).
|
|
127
127
|
*/
|
|
128
|
-
emitMetric(signal: string, data?:
|
|
128
|
+
protected emitMetric(signal: string, data?: AnyObject): void;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
declare abstract class ExecutionChain {
|
|
@@ -228,6 +228,7 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
228
228
|
private workAsync;
|
|
229
229
|
private executeAsync;
|
|
230
230
|
private work;
|
|
231
|
+
protected emitWithMetadata(signal: string, context: AnyObject): void;
|
|
231
232
|
private onProgress;
|
|
232
233
|
private postProcess;
|
|
233
234
|
private onError;
|
|
@@ -315,7 +316,8 @@ declare class TaskIterator implements Iterator {
|
|
|
315
316
|
}
|
|
316
317
|
|
|
317
318
|
declare class SignalParticipant extends SignalEmitter {
|
|
318
|
-
protected
|
|
319
|
+
protected emitsSignals: Set<string>;
|
|
320
|
+
protected signalsToEmitAfter: Set<string>;
|
|
319
321
|
protected signalsToEmitOnFail: Set<string>;
|
|
320
322
|
protected observedSignals: Set<string>;
|
|
321
323
|
/**
|
|
@@ -330,7 +332,7 @@ declare class SignalParticipant extends SignalEmitter {
|
|
|
330
332
|
* @param signals The signal names.
|
|
331
333
|
* @returns This for chaining.
|
|
332
334
|
*/
|
|
333
|
-
|
|
335
|
+
emitsAfter(...signals: string[]): this;
|
|
334
336
|
emitsOnFail(...signals: string[]): this;
|
|
335
337
|
/**
|
|
336
338
|
* Unsubscribes from all observed signals.
|
|
@@ -355,6 +357,8 @@ declare class SignalParticipant extends SignalEmitter {
|
|
|
355
357
|
* @returns This for chaining.
|
|
356
358
|
*/
|
|
357
359
|
detachAllSignals(): this;
|
|
360
|
+
mapSignals(callback: (signal: string) => void): void[];
|
|
361
|
+
mapOnFailSignals(callback: (signal: string) => void): void[];
|
|
358
362
|
/**
|
|
359
363
|
* Emits attached signals.
|
|
360
364
|
* @param context The context for emission.
|
|
@@ -397,7 +401,7 @@ type SchemaDefinition = {
|
|
|
397
401
|
strict?: boolean;
|
|
398
402
|
};
|
|
399
403
|
|
|
400
|
-
type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
|
|
404
|
+
type TaskFunction = (context: AnyObject, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void) => TaskResult;
|
|
401
405
|
type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
|
|
402
406
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
403
407
|
declare class Task extends SignalParticipant implements Graph {
|
|
@@ -475,12 +479,13 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
475
479
|
/**
|
|
476
480
|
* Executes the task function after optional input validation.
|
|
477
481
|
* @param context - The GraphContext to validate and execute.
|
|
482
|
+
* @param emit
|
|
478
483
|
* @param progressCallback - Callback for progress updates.
|
|
479
484
|
* @returns TaskResult from the taskFunction or error object on validation failure.
|
|
480
485
|
* @edge If validateInputContext is true, validates context; on failure, emits 'meta.task.validationFailed' with detailed errors.
|
|
481
486
|
* @edge If validateOutputContext is true, validates output; on failure, emits 'meta.task.outputValidationFailed' with detailed errors.
|
|
482
487
|
*/
|
|
483
|
-
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
488
|
+
execute(context: GraphContext, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
484
489
|
doAfter(...tasks: Task[]): this;
|
|
485
490
|
then(...tasks: Task[]): this;
|
|
486
491
|
decouple(task: Task): void;
|
|
@@ -723,10 +728,11 @@ declare class DebounceTask extends Task {
|
|
|
723
728
|
private lastContext;
|
|
724
729
|
private lastTimeout;
|
|
725
730
|
private lastProgressCallback;
|
|
731
|
+
private lastEmitFunction;
|
|
726
732
|
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, maxWait?: number, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, inputSchema?: SchemaDefinition | undefined, validateInputSchema?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputSchema?: boolean);
|
|
727
733
|
private executeFunction;
|
|
728
734
|
private debouncedTrigger;
|
|
729
|
-
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
735
|
+
execute(context: GraphContext, emit: (signal: string, context: any) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
730
736
|
}
|
|
731
737
|
|
|
732
738
|
declare class EphemeralTask extends Task {
|
|
@@ -734,7 +740,7 @@ declare class EphemeralTask extends Task {
|
|
|
734
740
|
private readonly condition;
|
|
735
741
|
readonly isEphemeral: boolean;
|
|
736
742
|
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
737
|
-
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
743
|
+
execute(context: any, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
738
744
|
}
|
|
739
745
|
|
|
740
746
|
declare class GraphAsyncRun extends GraphRunStrategy {
|
package/dist/index.d.ts
CHANGED
|
@@ -119,13 +119,13 @@ declare abstract class SignalEmitter {
|
|
|
119
119
|
* @param data Optional payload (defaults to empty object).
|
|
120
120
|
* @edge No emission if silent; for metrics in silent mode, consider override or separate method.
|
|
121
121
|
*/
|
|
122
|
-
emit(signal: string, data?:
|
|
122
|
+
protected emit(signal: string, data?: AnyObject): void;
|
|
123
123
|
/**
|
|
124
124
|
* Emits a signal via the broker even if silent.
|
|
125
125
|
* @param signal The signal name.
|
|
126
126
|
* @param data Optional payload (defaults to empty object).
|
|
127
127
|
*/
|
|
128
|
-
emitMetric(signal: string, data?:
|
|
128
|
+
protected emitMetric(signal: string, data?: AnyObject): void;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
declare abstract class ExecutionChain {
|
|
@@ -228,6 +228,7 @@ declare class GraphNode extends SignalEmitter implements Graph {
|
|
|
228
228
|
private workAsync;
|
|
229
229
|
private executeAsync;
|
|
230
230
|
private work;
|
|
231
|
+
protected emitWithMetadata(signal: string, context: AnyObject): void;
|
|
231
232
|
private onProgress;
|
|
232
233
|
private postProcess;
|
|
233
234
|
private onError;
|
|
@@ -315,7 +316,8 @@ declare class TaskIterator implements Iterator {
|
|
|
315
316
|
}
|
|
316
317
|
|
|
317
318
|
declare class SignalParticipant extends SignalEmitter {
|
|
318
|
-
protected
|
|
319
|
+
protected emitsSignals: Set<string>;
|
|
320
|
+
protected signalsToEmitAfter: Set<string>;
|
|
319
321
|
protected signalsToEmitOnFail: Set<string>;
|
|
320
322
|
protected observedSignals: Set<string>;
|
|
321
323
|
/**
|
|
@@ -330,7 +332,7 @@ declare class SignalParticipant extends SignalEmitter {
|
|
|
330
332
|
* @param signals The signal names.
|
|
331
333
|
* @returns This for chaining.
|
|
332
334
|
*/
|
|
333
|
-
|
|
335
|
+
emitsAfter(...signals: string[]): this;
|
|
334
336
|
emitsOnFail(...signals: string[]): this;
|
|
335
337
|
/**
|
|
336
338
|
* Unsubscribes from all observed signals.
|
|
@@ -355,6 +357,8 @@ declare class SignalParticipant extends SignalEmitter {
|
|
|
355
357
|
* @returns This for chaining.
|
|
356
358
|
*/
|
|
357
359
|
detachAllSignals(): this;
|
|
360
|
+
mapSignals(callback: (signal: string) => void): void[];
|
|
361
|
+
mapOnFailSignals(callback: (signal: string) => void): void[];
|
|
358
362
|
/**
|
|
359
363
|
* Emits attached signals.
|
|
360
364
|
* @param context The context for emission.
|
|
@@ -397,7 +401,7 @@ type SchemaDefinition = {
|
|
|
397
401
|
strict?: boolean;
|
|
398
402
|
};
|
|
399
403
|
|
|
400
|
-
type TaskFunction = (context: AnyObject, progressCallback: (progress: number) => void) => TaskResult;
|
|
404
|
+
type TaskFunction = (context: AnyObject, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void) => TaskResult;
|
|
401
405
|
type TaskResult = boolean | AnyObject | Generator | Promise<any> | void;
|
|
402
406
|
type ThrottleTagGetter = (context?: AnyObject, task?: Task) => string;
|
|
403
407
|
declare class Task extends SignalParticipant implements Graph {
|
|
@@ -475,12 +479,13 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
475
479
|
/**
|
|
476
480
|
* Executes the task function after optional input validation.
|
|
477
481
|
* @param context - The GraphContext to validate and execute.
|
|
482
|
+
* @param emit
|
|
478
483
|
* @param progressCallback - Callback for progress updates.
|
|
479
484
|
* @returns TaskResult from the taskFunction or error object on validation failure.
|
|
480
485
|
* @edge If validateInputContext is true, validates context; on failure, emits 'meta.task.validationFailed' with detailed errors.
|
|
481
486
|
* @edge If validateOutputContext is true, validates output; on failure, emits 'meta.task.outputValidationFailed' with detailed errors.
|
|
482
487
|
*/
|
|
483
|
-
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
488
|
+
execute(context: GraphContext, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
484
489
|
doAfter(...tasks: Task[]): this;
|
|
485
490
|
then(...tasks: Task[]): this;
|
|
486
491
|
decouple(task: Task): void;
|
|
@@ -723,10 +728,11 @@ declare class DebounceTask extends Task {
|
|
|
723
728
|
private lastContext;
|
|
724
729
|
private lastTimeout;
|
|
725
730
|
private lastProgressCallback;
|
|
731
|
+
private lastEmitFunction;
|
|
726
732
|
constructor(name: string, task: TaskFunction, description?: string, debounceTime?: number, leading?: boolean, trailing?: boolean, maxWait?: number, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, inputSchema?: SchemaDefinition | undefined, validateInputSchema?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputSchema?: boolean);
|
|
727
733
|
private executeFunction;
|
|
728
734
|
private debouncedTrigger;
|
|
729
|
-
execute(context: GraphContext, progressCallback: (progress: number) => void): TaskResult;
|
|
735
|
+
execute(context: GraphContext, emit: (signal: string, context: any) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
730
736
|
}
|
|
731
737
|
|
|
732
738
|
declare class EphemeralTask extends Task {
|
|
@@ -734,7 +740,7 @@ declare class EphemeralTask extends Task {
|
|
|
734
740
|
private readonly condition;
|
|
735
741
|
readonly isEphemeral: boolean;
|
|
736
742
|
constructor(name: string, task: TaskFunction, description?: string, once?: boolean, condition?: (context: any) => boolean, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
|
|
737
|
-
execute(context: any, progressCallback: (progress: number) => void): TaskResult;
|
|
743
|
+
execute(context: any, emit: (signal: string, context: AnyObject) => void, progressCallback: (progress: number) => void): TaskResult;
|
|
738
744
|
}
|
|
739
745
|
|
|
740
746
|
declare class GraphAsyncRun extends GraphRunStrategy {
|
package/dist/index.js
CHANGED
|
@@ -745,6 +745,21 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
745
745
|
...this.lightExport(),
|
|
746
746
|
__scheduled: Date.now()
|
|
747
747
|
});
|
|
748
|
+
const context = this.context.getFullContext();
|
|
749
|
+
if (context.__emittedSignal !== void 0 && context.__consumedByNode === void 0 && !context.__emittedSignal.includes("meta.")) {
|
|
750
|
+
this.emit("meta.node.consumed_signal", {
|
|
751
|
+
__signal_log: {
|
|
752
|
+
signal_name: context.__emittedSignal,
|
|
753
|
+
log_type: "consume",
|
|
754
|
+
consumed_by_task_id: this.task.id,
|
|
755
|
+
task_execution_id: this.id,
|
|
756
|
+
relation_type: "listener",
|
|
757
|
+
metadata: {},
|
|
758
|
+
is_meta: false
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
context.__consumedByNode = this.id;
|
|
762
|
+
}
|
|
748
763
|
}
|
|
749
764
|
}
|
|
750
765
|
start() {
|
|
@@ -819,6 +834,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
819
834
|
try {
|
|
820
835
|
const result = this.task.execute(
|
|
821
836
|
this.context,
|
|
837
|
+
this.emitWithMetadata.bind(this),
|
|
822
838
|
this.onProgress.bind(this)
|
|
823
839
|
);
|
|
824
840
|
if (result.errored || result.failed) {
|
|
@@ -836,6 +852,26 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
836
852
|
});
|
|
837
853
|
}
|
|
838
854
|
}
|
|
855
|
+
emitWithMetadata(signal, context) {
|
|
856
|
+
this.emit(signal, {
|
|
857
|
+
...context,
|
|
858
|
+
__emittedSignal: signal,
|
|
859
|
+
__emittedByNode: this.id
|
|
860
|
+
});
|
|
861
|
+
if (!signal.includes(".meta")) {
|
|
862
|
+
this.emit("meta.node.emitted_signal", {
|
|
863
|
+
__signal_log: {
|
|
864
|
+
signal_name: signal,
|
|
865
|
+
log_type: "emit",
|
|
866
|
+
emitted_by_task_id: this.task.id,
|
|
867
|
+
task_execution_id: this.id,
|
|
868
|
+
relation_type: "emitter",
|
|
869
|
+
metadata: {},
|
|
870
|
+
is_meta: false
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
}
|
|
839
875
|
onProgress(progress) {
|
|
840
876
|
var _a, _b, _c;
|
|
841
877
|
progress = Math.min(Math.max(0, progress), 1);
|
|
@@ -860,9 +896,13 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
860
896
|
this.completeSubgraph();
|
|
861
897
|
}
|
|
862
898
|
if (this.errored || this.failed) {
|
|
863
|
-
this.task.
|
|
899
|
+
this.task.mapOnFailSignals(
|
|
900
|
+
(signal) => this.emitWithMetadata(signal, this.context)
|
|
901
|
+
);
|
|
864
902
|
} else {
|
|
865
|
-
this.task.
|
|
903
|
+
this.task.mapSignals(
|
|
904
|
+
(signal) => this.emitWithMetadata(signal, this.context)
|
|
905
|
+
);
|
|
866
906
|
}
|
|
867
907
|
this.end();
|
|
868
908
|
}
|
|
@@ -1124,8 +1164,8 @@ var import_uuid4 = require("uuid");
|
|
|
1124
1164
|
var SignalParticipant = class extends SignalEmitter {
|
|
1125
1165
|
constructor() {
|
|
1126
1166
|
super(...arguments);
|
|
1127
|
-
this.
|
|
1128
|
-
|
|
1167
|
+
this.emitsSignals = /* @__PURE__ */ new Set();
|
|
1168
|
+
this.signalsToEmitAfter = /* @__PURE__ */ new Set();
|
|
1129
1169
|
this.signalsToEmitOnFail = /* @__PURE__ */ new Set();
|
|
1130
1170
|
this.observedSignals = /* @__PURE__ */ new Set();
|
|
1131
1171
|
}
|
|
@@ -1148,12 +1188,18 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1148
1188
|
* @param signals The signal names.
|
|
1149
1189
|
* @returns This for chaining.
|
|
1150
1190
|
*/
|
|
1151
|
-
|
|
1152
|
-
signals.forEach((signal) =>
|
|
1191
|
+
emitsAfter(...signals) {
|
|
1192
|
+
signals.forEach((signal) => {
|
|
1193
|
+
this.signalsToEmitAfter.add(signal);
|
|
1194
|
+
this.emitsSignals.add(signal);
|
|
1195
|
+
});
|
|
1153
1196
|
return this;
|
|
1154
1197
|
}
|
|
1155
1198
|
emitsOnFail(...signals) {
|
|
1156
|
-
signals.forEach((signal) =>
|
|
1199
|
+
signals.forEach((signal) => {
|
|
1200
|
+
this.signalsToEmitOnFail.add(signal);
|
|
1201
|
+
this.emitsSignals.add(signal);
|
|
1202
|
+
});
|
|
1157
1203
|
return this;
|
|
1158
1204
|
}
|
|
1159
1205
|
/**
|
|
@@ -1188,7 +1234,7 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1188
1234
|
* @returns This for chaining.
|
|
1189
1235
|
*/
|
|
1190
1236
|
detachSignals(...signals) {
|
|
1191
|
-
signals.forEach((signal) => this.
|
|
1237
|
+
signals.forEach((signal) => this.signalsToEmitAfter.delete(signal));
|
|
1192
1238
|
return this;
|
|
1193
1239
|
}
|
|
1194
1240
|
/**
|
|
@@ -1196,16 +1242,22 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1196
1242
|
* @returns This for chaining.
|
|
1197
1243
|
*/
|
|
1198
1244
|
detachAllSignals() {
|
|
1199
|
-
this.
|
|
1245
|
+
this.signalsToEmitAfter.clear();
|
|
1200
1246
|
return this;
|
|
1201
1247
|
}
|
|
1248
|
+
mapSignals(callback) {
|
|
1249
|
+
return Array.from(this.signalsToEmitAfter).map(callback);
|
|
1250
|
+
}
|
|
1251
|
+
mapOnFailSignals(callback) {
|
|
1252
|
+
return Array.from(this.signalsToEmitOnFail).map(callback);
|
|
1253
|
+
}
|
|
1202
1254
|
/**
|
|
1203
1255
|
* Emits attached signals.
|
|
1204
1256
|
* @param context The context for emission.
|
|
1205
1257
|
* @edge If isMeta (from Task), suppresses further "meta.*" to prevent loops.
|
|
1206
1258
|
*/
|
|
1207
1259
|
emitSignals(context) {
|
|
1208
|
-
this.
|
|
1260
|
+
this.signalsToEmitAfter.forEach((signal) => {
|
|
1209
1261
|
this.emit(signal, context.getFullContext());
|
|
1210
1262
|
});
|
|
1211
1263
|
}
|
|
@@ -1560,14 +1612,16 @@ var Task = class extends SignalParticipant {
|
|
|
1560
1612
|
/**
|
|
1561
1613
|
* Executes the task function after optional input validation.
|
|
1562
1614
|
* @param context - The GraphContext to validate and execute.
|
|
1615
|
+
* @param emit
|
|
1563
1616
|
* @param progressCallback - Callback for progress updates.
|
|
1564
1617
|
* @returns TaskResult from the taskFunction or error object on validation failure.
|
|
1565
1618
|
* @edge If validateInputContext is true, validates context; on failure, emits 'meta.task.validationFailed' with detailed errors.
|
|
1566
1619
|
* @edge If validateOutputContext is true, validates output; on failure, emits 'meta.task.outputValidationFailed' with detailed errors.
|
|
1567
1620
|
*/
|
|
1568
|
-
execute(context, progressCallback) {
|
|
1621
|
+
execute(context, emit, progressCallback) {
|
|
1569
1622
|
return this.taskFunction(
|
|
1570
1623
|
this.isMeta ? context.getClonedFullContext() : context.getClonedContext(),
|
|
1624
|
+
emit,
|
|
1571
1625
|
progressCallback
|
|
1572
1626
|
);
|
|
1573
1627
|
}
|
|
@@ -1707,7 +1761,7 @@ var Task = class extends SignalParticipant {
|
|
|
1707
1761
|
__isMeta: this.isMeta,
|
|
1708
1762
|
__isSignal: this.isSignal,
|
|
1709
1763
|
__eventTriggers: this.observedSignals,
|
|
1710
|
-
__attachedEvents: this.
|
|
1764
|
+
__attachedEvents: this.signalsToEmitAfter,
|
|
1711
1765
|
__isDeputy: this.isDeputy,
|
|
1712
1766
|
__throttled: this.throttled,
|
|
1713
1767
|
__isEphemeral: this.isEphemeral,
|
|
@@ -2108,6 +2162,7 @@ var DebounceTask = class extends Task {
|
|
|
2108
2162
|
this.lastContext = null;
|
|
2109
2163
|
this.lastTimeout = null;
|
|
2110
2164
|
this.lastProgressCallback = null;
|
|
2165
|
+
this.lastEmitFunction = null;
|
|
2111
2166
|
this.debounceTime = debounceTime;
|
|
2112
2167
|
this.leading = leading;
|
|
2113
2168
|
this.trailing = trailing;
|
|
@@ -2121,6 +2176,7 @@ var DebounceTask = class extends Task {
|
|
|
2121
2176
|
try {
|
|
2122
2177
|
result = this.taskFunction(
|
|
2123
2178
|
this.lastContext.getClonedContext(),
|
|
2179
|
+
this.lastEmitFunction,
|
|
2124
2180
|
this.lastProgressCallback
|
|
2125
2181
|
);
|
|
2126
2182
|
} catch (error) {
|
|
@@ -2137,7 +2193,7 @@ var DebounceTask = class extends Task {
|
|
|
2137
2193
|
}
|
|
2138
2194
|
}
|
|
2139
2195
|
}
|
|
2140
|
-
debouncedTrigger(resolve, reject, context, timeout, progressCallback) {
|
|
2196
|
+
debouncedTrigger(resolve, reject, context, timeout, emit, progressCallback) {
|
|
2141
2197
|
const callNow = this.leading && this.timer === null;
|
|
2142
2198
|
const isNewBurst = this.timer === null;
|
|
2143
2199
|
if (this.timer !== null) {
|
|
@@ -2149,6 +2205,7 @@ var DebounceTask = class extends Task {
|
|
|
2149
2205
|
this.lastContext = context;
|
|
2150
2206
|
this.lastTimeout = timeout;
|
|
2151
2207
|
this.lastProgressCallback = progressCallback;
|
|
2208
|
+
this.lastEmitFunction = emit;
|
|
2152
2209
|
if (!callNow) {
|
|
2153
2210
|
this.hasLaterCall = true;
|
|
2154
2211
|
}
|
|
@@ -2181,7 +2238,7 @@ var DebounceTask = class extends Task {
|
|
|
2181
2238
|
}, this.maxWait);
|
|
2182
2239
|
}
|
|
2183
2240
|
}
|
|
2184
|
-
execute(context, progressCallback) {
|
|
2241
|
+
execute(context, emit, progressCallback) {
|
|
2185
2242
|
return new Promise((resolve, reject) => {
|
|
2186
2243
|
const timeout = setTimeout(() => {
|
|
2187
2244
|
resolve(false);
|
|
@@ -2191,6 +2248,7 @@ var DebounceTask = class extends Task {
|
|
|
2191
2248
|
reject,
|
|
2192
2249
|
context,
|
|
2193
2250
|
timeout,
|
|
2251
|
+
emit,
|
|
2194
2252
|
progressCallback
|
|
2195
2253
|
);
|
|
2196
2254
|
});
|
|
@@ -2223,9 +2281,8 @@ var EphemeralTask = class extends Task {
|
|
|
2223
2281
|
this.once = once;
|
|
2224
2282
|
this.condition = condition;
|
|
2225
2283
|
}
|
|
2226
|
-
execute(context, progressCallback) {
|
|
2227
|
-
const result = super.execute(context, progressCallback);
|
|
2228
|
-
this.emit("meta.ephemeral.executed", result);
|
|
2284
|
+
execute(context, emit, progressCallback) {
|
|
2285
|
+
const result = super.execute(context, emit, progressCallback);
|
|
2229
2286
|
if (this.once || !this.condition(result)) {
|
|
2230
2287
|
this.destroy();
|
|
2231
2288
|
return result;
|
|
@@ -3194,7 +3251,7 @@ Cadenza.mode = "production";
|
|
|
3194
3251
|
var SignalTask = class extends Task {
|
|
3195
3252
|
constructor(signal, description = "") {
|
|
3196
3253
|
super(signal, () => true, description);
|
|
3197
|
-
this.
|
|
3254
|
+
this.signalsToEmitAfter.add(signal);
|
|
3198
3255
|
}
|
|
3199
3256
|
};
|
|
3200
3257
|
|