@cadenza.io/core 1.2.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 +155 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,22 +21,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
DebounceTask: () => DebounceTask,
|
|
24
|
-
DebouncedMetaTask: () => DebouncedMetaTask,
|
|
25
|
-
EphemeralMetaTask: () => EphemeralMetaTask,
|
|
26
24
|
EphemeralTask: () => EphemeralTask,
|
|
27
25
|
GraphContext: () => GraphContext,
|
|
28
26
|
GraphRegistry: () => GraphRegistry,
|
|
29
27
|
GraphRoutine: () => GraphRoutine,
|
|
30
|
-
|
|
31
|
-
MetaTask: () => MetaTask,
|
|
28
|
+
GraphRun: () => GraphRun,
|
|
32
29
|
SignalEmitter: () => SignalEmitter,
|
|
33
|
-
SignalMetaTask: () => SignalMetaTask,
|
|
34
30
|
SignalParticipant: () => SignalParticipant,
|
|
35
31
|
SignalTask: () => SignalTask,
|
|
36
32
|
Task: () => Task,
|
|
37
|
-
ThrottledMetaTask: () => ThrottledMetaTask,
|
|
38
33
|
ThrottledTask: () => ThrottledTask,
|
|
39
|
-
UniqueMetaTask: () => UniqueMetaTask,
|
|
40
34
|
UniqueTask: () => UniqueTask,
|
|
41
35
|
default: () => index_default
|
|
42
36
|
});
|
|
@@ -47,8 +41,8 @@ var SignalBroker = class _SignalBroker {
|
|
|
47
41
|
// execId -> emitted signals
|
|
48
42
|
constructor() {
|
|
49
43
|
this.signalObservers = /* @__PURE__ */ new Map();
|
|
50
|
-
// For loop prevention: Per-execId recent emits (cleared post-run or TTL)
|
|
51
44
|
this.emitStacks = /* @__PURE__ */ new Map();
|
|
45
|
+
this.addSignal("meta.signal.added");
|
|
52
46
|
}
|
|
53
47
|
/**
|
|
54
48
|
* Singleton instance for signal management.
|
|
@@ -65,10 +59,32 @@ var SignalBroker = class _SignalBroker {
|
|
|
65
59
|
* @param runner Standard runner for user signals.
|
|
66
60
|
* @param metaRunner Meta runner for 'meta.' signals (suppresses further meta-emits).
|
|
67
61
|
*/
|
|
68
|
-
|
|
62
|
+
bootstrap(runner, metaRunner) {
|
|
69
63
|
this.runner = runner;
|
|
70
64
|
this.metaRunner = metaRunner;
|
|
71
65
|
}
|
|
66
|
+
init() {
|
|
67
|
+
Cadenza.createMetaTask(
|
|
68
|
+
"Execute and clear queued signals",
|
|
69
|
+
() => {
|
|
70
|
+
for (const [id, signals] of this.emitStacks.entries()) {
|
|
71
|
+
signals.forEach((context, signal) => {
|
|
72
|
+
this.execute(signal, context);
|
|
73
|
+
signals.delete(signal);
|
|
74
|
+
});
|
|
75
|
+
this.emitStacks.delete(id);
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
},
|
|
79
|
+
"Executes queued signals and clears the stack"
|
|
80
|
+
).doOn("meta.clear_signal_queue_requested");
|
|
81
|
+
this.getSignalsTask = Cadenza.createMetaTask("Get signals", (ctx) => {
|
|
82
|
+
return {
|
|
83
|
+
__signals: Array.from(this.signalObservers.keys()),
|
|
84
|
+
...ctx
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
72
88
|
/**
|
|
73
89
|
* Observes a signal with a routine/task.
|
|
74
90
|
* @param signal The signal (e.g., 'domain.action', 'domain.*' for wildcards).
|
|
@@ -104,30 +120,34 @@ var SignalBroker = class _SignalBroker {
|
|
|
104
120
|
*/
|
|
105
121
|
emit(signal, context = {}) {
|
|
106
122
|
const execId = context.__graphExecId || "global";
|
|
107
|
-
if (!this.emitStacks.has(execId)) this.emitStacks.set(execId, /* @__PURE__ */ new
|
|
123
|
+
if (!this.emitStacks.has(execId)) this.emitStacks.set(execId, /* @__PURE__ */ new Map());
|
|
108
124
|
const stack = this.emitStacks.get(execId);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
stack.add(signal);
|
|
113
|
-
this.executeListener(signal, context);
|
|
125
|
+
stack.set(signal, context);
|
|
126
|
+
let executed = false;
|
|
114
127
|
try {
|
|
115
|
-
|
|
116
|
-
for (let i = parts.length; i > 0; i--) {
|
|
117
|
-
const parent = parts.slice(0, i).join(".");
|
|
118
|
-
this.executeListener(parent, context);
|
|
119
|
-
this.executeListener(parent + ".*", context);
|
|
120
|
-
}
|
|
128
|
+
executed = this.execute(signal, context);
|
|
121
129
|
} finally {
|
|
122
|
-
stack.delete(signal);
|
|
130
|
+
if (executed) stack.delete(signal);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
execute(signal, context) {
|
|
134
|
+
let executed;
|
|
135
|
+
executed = this.executeListener(signal, context);
|
|
136
|
+
const parts = signal.slice(0, Math.max(signal.lastIndexOf(":"), signal.lastIndexOf("."))).split(".");
|
|
137
|
+
for (let i = parts.length; i > 0; i--) {
|
|
138
|
+
const parent = parts.slice(0, i).join(".");
|
|
139
|
+
executed = executed || this.executeListener(parent + ".*", context);
|
|
123
140
|
}
|
|
141
|
+
return executed;
|
|
124
142
|
}
|
|
125
143
|
executeListener(signal, context) {
|
|
126
144
|
const obs = this.signalObservers.get(signal);
|
|
127
145
|
const runner = this.getRunner(signal);
|
|
128
146
|
if (obs && runner) {
|
|
129
147
|
obs.fn(runner, Array.from(obs.tasks), context);
|
|
148
|
+
return true;
|
|
130
149
|
}
|
|
150
|
+
return false;
|
|
131
151
|
}
|
|
132
152
|
addSignal(signal) {
|
|
133
153
|
if (!this.signalObservers.has(signal)) {
|
|
@@ -135,6 +155,7 @@ var SignalBroker = class _SignalBroker {
|
|
|
135
155
|
fn: (runner, tasks, context) => runner.run(tasks, context),
|
|
136
156
|
tasks: /* @__PURE__ */ new Set()
|
|
137
157
|
});
|
|
158
|
+
this.emit("meta.signal.added", { __signal: signal });
|
|
138
159
|
}
|
|
139
160
|
}
|
|
140
161
|
/**
|
|
@@ -1073,13 +1094,14 @@ var SignalParticipant = class extends SignalEmitter {
|
|
|
1073
1094
|
|
|
1074
1095
|
// src/graph/definition/GraphRoutine.ts
|
|
1075
1096
|
var GraphRoutine = class extends SignalParticipant {
|
|
1076
|
-
constructor(name, tasks, description) {
|
|
1097
|
+
constructor(name, tasks, description, isMeta = false) {
|
|
1077
1098
|
super();
|
|
1078
1099
|
this.isMeta = false;
|
|
1079
1100
|
this.tasks = /* @__PURE__ */ new Set();
|
|
1080
1101
|
this.id = (0, import_uuid4.v4)();
|
|
1081
1102
|
this.name = name;
|
|
1082
1103
|
this.description = description;
|
|
1104
|
+
this.isMeta = isMeta;
|
|
1083
1105
|
tasks.forEach((t) => this.tasks.add(t));
|
|
1084
1106
|
this.emit("meta.routine.created", { __routine: this });
|
|
1085
1107
|
}
|
|
@@ -1159,14 +1181,16 @@ var Task = class extends SignalParticipant {
|
|
|
1159
1181
|
* @param concurrency Limit.
|
|
1160
1182
|
* @param timeout ms.
|
|
1161
1183
|
* @param register Register via signal (default true).
|
|
1184
|
+
* @param isUnique
|
|
1185
|
+
* @param isMeta
|
|
1162
1186
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
1163
1187
|
*/
|
|
1164
|
-
constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true) {
|
|
1188
|
+
constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false) {
|
|
1165
1189
|
super();
|
|
1190
|
+
this.isMeta = false;
|
|
1166
1191
|
this.isUnique = false;
|
|
1167
1192
|
this.throttled = false;
|
|
1168
1193
|
this.isSignal = false;
|
|
1169
|
-
this.isMeta = false;
|
|
1170
1194
|
this.isDeputy = false;
|
|
1171
1195
|
this.isEphemeral = false;
|
|
1172
1196
|
this.layerIndex = 0;
|
|
@@ -1181,6 +1205,8 @@ var Task = class extends SignalParticipant {
|
|
|
1181
1205
|
this.description = description;
|
|
1182
1206
|
this.concurrency = concurrency;
|
|
1183
1207
|
this.timeout = timeout;
|
|
1208
|
+
this.isUnique = isUnique;
|
|
1209
|
+
this.isMeta = isMeta;
|
|
1184
1210
|
if (register) {
|
|
1185
1211
|
this.emit("meta.task.created", { __task: this });
|
|
1186
1212
|
}
|
|
@@ -1348,6 +1374,7 @@ var Task = class extends SignalParticipant {
|
|
|
1348
1374
|
__concurrency: this.concurrency,
|
|
1349
1375
|
__timeout: this.timeout,
|
|
1350
1376
|
__functionString: this.taskFunction.toString(),
|
|
1377
|
+
__getTagCallback: this.getTag.toString(),
|
|
1351
1378
|
__nextTasks: Array.from(this.nextTasks).map((t) => t.id),
|
|
1352
1379
|
__onFailTasks: Array.from(this.onFailTasks).map((t) => t.id),
|
|
1353
1380
|
__previousTasks: Array.from(this.predecessorTasks).map((t) => t.id)
|
|
@@ -1364,20 +1391,12 @@ var Task = class extends SignalParticipant {
|
|
|
1364
1391
|
}
|
|
1365
1392
|
};
|
|
1366
1393
|
|
|
1367
|
-
// src/graph/definition/meta/MetaTask.ts
|
|
1368
|
-
var MetaTask = class extends Task {
|
|
1369
|
-
constructor() {
|
|
1370
|
-
super(...arguments);
|
|
1371
|
-
this.isMeta = true;
|
|
1372
|
-
}
|
|
1373
|
-
};
|
|
1374
|
-
|
|
1375
1394
|
// src/registry/GraphRegistry.ts
|
|
1376
1395
|
var GraphRegistry = class _GraphRegistry {
|
|
1377
1396
|
constructor() {
|
|
1378
1397
|
this.tasks = /* @__PURE__ */ new Map();
|
|
1379
1398
|
this.routines = /* @__PURE__ */ new Map();
|
|
1380
|
-
this.registerTask = new
|
|
1399
|
+
this.registerTask = new Task(
|
|
1381
1400
|
"Registry Seed",
|
|
1382
1401
|
(context) => {
|
|
1383
1402
|
const { __task } = context;
|
|
@@ -1387,7 +1406,12 @@ var GraphRegistry = class _GraphRegistry {
|
|
|
1387
1406
|
}
|
|
1388
1407
|
return true;
|
|
1389
1408
|
},
|
|
1390
|
-
"Registers tasks. Seed for meta.taskCreated"
|
|
1409
|
+
"Registers tasks. Seed for meta.taskCreated",
|
|
1410
|
+
0,
|
|
1411
|
+
0,
|
|
1412
|
+
true,
|
|
1413
|
+
false,
|
|
1414
|
+
true
|
|
1391
1415
|
).doOn("meta.task.created");
|
|
1392
1416
|
this.tasks.set(this.registerTask.id, this.registerTask);
|
|
1393
1417
|
this.updateTaskId = Cadenza.createMetaTask(
|
|
@@ -1684,49 +1708,37 @@ var GraphRunner = class extends SignalEmitter {
|
|
|
1684
1708
|
}
|
|
1685
1709
|
};
|
|
1686
1710
|
|
|
1687
|
-
// src/graph/definition/UniqueTask.ts
|
|
1688
|
-
var UniqueTask = class extends Task {
|
|
1689
|
-
constructor() {
|
|
1690
|
-
super(...arguments);
|
|
1691
|
-
this.isUnique = true;
|
|
1692
|
-
}
|
|
1693
|
-
};
|
|
1694
|
-
|
|
1695
|
-
// src/graph/definition/meta/UniqueMetaTask.ts
|
|
1696
|
-
var UniqueMetaTask = class extends UniqueTask {
|
|
1697
|
-
constructor() {
|
|
1698
|
-
super(...arguments);
|
|
1699
|
-
this.isMeta = true;
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
|
|
1703
1711
|
// src/graph/definition/ThrottledTask.ts
|
|
1704
1712
|
var ThrottledTask = class extends Task {
|
|
1705
|
-
constructor(name, task, description = "", getTagCallback = (context, task2) => "default", concurrency = 1, timeout = 0, register = true) {
|
|
1706
|
-
super(
|
|
1713
|
+
constructor(name, task, description = "", getTagCallback = (context, task2) => "default", concurrency = 1, timeout = 0, register = true, isUnique = false, isMeta = false) {
|
|
1714
|
+
super(
|
|
1715
|
+
name,
|
|
1716
|
+
task,
|
|
1717
|
+
description,
|
|
1718
|
+
concurrency,
|
|
1719
|
+
timeout,
|
|
1720
|
+
register,
|
|
1721
|
+
isUnique,
|
|
1722
|
+
isMeta
|
|
1723
|
+
);
|
|
1707
1724
|
this.throttled = true;
|
|
1708
1725
|
this.getTag = (context) => getTagCallback(context, this);
|
|
1709
1726
|
}
|
|
1710
|
-
export() {
|
|
1711
|
-
return {
|
|
1712
|
-
...super.export(),
|
|
1713
|
-
__getTagCallback: this.getTag.toString()
|
|
1714
|
-
};
|
|
1715
|
-
}
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
// src/graph/definition/meta/ThrottledMetaTask.ts
|
|
1719
|
-
var ThrottledMetaTask = class extends ThrottledTask {
|
|
1720
|
-
constructor() {
|
|
1721
|
-
super(...arguments);
|
|
1722
|
-
this.isMeta = true;
|
|
1723
|
-
}
|
|
1724
1727
|
};
|
|
1725
1728
|
|
|
1726
1729
|
// src/graph/definition/DebounceTask.ts
|
|
1727
1730
|
var DebounceTask = class extends Task {
|
|
1728
|
-
constructor(name, task, description = "", debounceTime = 1e3, leading = false, trailing = true, concurrency = 0, timeout = 0, register = true) {
|
|
1729
|
-
super(
|
|
1731
|
+
constructor(name, task, description = "", debounceTime = 1e3, leading = false, trailing = true, concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false) {
|
|
1732
|
+
super(
|
|
1733
|
+
name,
|
|
1734
|
+
task,
|
|
1735
|
+
description,
|
|
1736
|
+
concurrency,
|
|
1737
|
+
timeout,
|
|
1738
|
+
register,
|
|
1739
|
+
isUnique,
|
|
1740
|
+
isMeta
|
|
1741
|
+
);
|
|
1730
1742
|
this.timer = null;
|
|
1731
1743
|
this.lastResolve = null;
|
|
1732
1744
|
this.lastReject = null;
|
|
@@ -1795,18 +1807,19 @@ var DebounceTask = class extends Task {
|
|
|
1795
1807
|
}
|
|
1796
1808
|
};
|
|
1797
1809
|
|
|
1798
|
-
// src/graph/definition/meta/DebouncedMetaTask.ts
|
|
1799
|
-
var DebouncedMetaTask = class extends DebounceTask {
|
|
1800
|
-
constructor() {
|
|
1801
|
-
super(...arguments);
|
|
1802
|
-
this.isMeta = true;
|
|
1803
|
-
}
|
|
1804
|
-
};
|
|
1805
|
-
|
|
1806
1810
|
// src/graph/definition/EphemeralTask.ts
|
|
1807
1811
|
var EphemeralTask = class extends Task {
|
|
1808
|
-
constructor(name, task, description = "", once = true, condition = () => true, concurrency = 0, timeout = 0, register = false) {
|
|
1809
|
-
super(
|
|
1812
|
+
constructor(name, task, description = "", once = true, condition = () => true, concurrency = 0, timeout = 0, register = false, isUnique = false, isMeta = false) {
|
|
1813
|
+
super(
|
|
1814
|
+
name,
|
|
1815
|
+
task,
|
|
1816
|
+
description,
|
|
1817
|
+
concurrency,
|
|
1818
|
+
timeout,
|
|
1819
|
+
register,
|
|
1820
|
+
isUnique,
|
|
1821
|
+
isMeta
|
|
1822
|
+
);
|
|
1810
1823
|
this.isEphemeral = true;
|
|
1811
1824
|
this.once = once;
|
|
1812
1825
|
this.condition = condition;
|
|
@@ -1821,22 +1834,6 @@ var EphemeralTask = class extends Task {
|
|
|
1821
1834
|
}
|
|
1822
1835
|
};
|
|
1823
1836
|
|
|
1824
|
-
// src/graph/definition/meta/EphemeralMetaTask.ts
|
|
1825
|
-
var EphemeralMetaTask = class extends EphemeralTask {
|
|
1826
|
-
constructor() {
|
|
1827
|
-
super(...arguments);
|
|
1828
|
-
this.isMeta = true;
|
|
1829
|
-
}
|
|
1830
|
-
};
|
|
1831
|
-
|
|
1832
|
-
// src/graph/definition/meta/MetaRoutine.ts
|
|
1833
|
-
var MetaRoutine = class extends GraphRoutine {
|
|
1834
|
-
constructor() {
|
|
1835
|
-
super(...arguments);
|
|
1836
|
-
this.isMeta = true;
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
1837
|
// src/interfaces/ExecutionChain.ts
|
|
1841
1838
|
var ExecutionChain = class {
|
|
1842
1839
|
setNext(next) {
|
|
@@ -2351,8 +2348,9 @@ var Cadenza = class {
|
|
|
2351
2348
|
this.broker = SignalBroker.instance;
|
|
2352
2349
|
this.runner = new GraphRunner();
|
|
2353
2350
|
this.metaRunner = new GraphRunner(true);
|
|
2354
|
-
this.broker.
|
|
2351
|
+
this.broker.bootstrap(this.runner, this.metaRunner);
|
|
2355
2352
|
this.registry = GraphRegistry.instance;
|
|
2353
|
+
this.broker.init();
|
|
2356
2354
|
this.runner.init();
|
|
2357
2355
|
this.metaRunner.init();
|
|
2358
2356
|
}
|
|
@@ -2384,7 +2382,9 @@ var Cadenza = class {
|
|
|
2384
2382
|
static createTask(name, func, description, options = {
|
|
2385
2383
|
concurrency: 0,
|
|
2386
2384
|
timeout: 0,
|
|
2387
|
-
register: true
|
|
2385
|
+
register: true,
|
|
2386
|
+
isUnique: false,
|
|
2387
|
+
isMeta: false
|
|
2388
2388
|
}) {
|
|
2389
2389
|
this.bootstrap();
|
|
2390
2390
|
this.validateName(name);
|
|
@@ -2394,7 +2394,9 @@ var Cadenza = class {
|
|
|
2394
2394
|
description,
|
|
2395
2395
|
options.concurrency,
|
|
2396
2396
|
options.timeout,
|
|
2397
|
-
options.register
|
|
2397
|
+
options.register,
|
|
2398
|
+
options.isUnique,
|
|
2399
|
+
options.isMeta
|
|
2398
2400
|
);
|
|
2399
2401
|
}
|
|
2400
2402
|
/**
|
|
@@ -2410,18 +2412,12 @@ var Cadenza = class {
|
|
|
2410
2412
|
static createMetaTask(name, func, description, options = {
|
|
2411
2413
|
concurrency: 0,
|
|
2412
2414
|
timeout: 0,
|
|
2413
|
-
register: true
|
|
2415
|
+
register: true,
|
|
2416
|
+
isUnique: false,
|
|
2417
|
+
isMeta: true
|
|
2414
2418
|
}) {
|
|
2415
|
-
|
|
2416
|
-
this.
|
|
2417
|
-
return new MetaTask(
|
|
2418
|
-
name,
|
|
2419
|
-
func,
|
|
2420
|
-
description,
|
|
2421
|
-
options.concurrency,
|
|
2422
|
-
options.timeout,
|
|
2423
|
-
options.register
|
|
2424
|
-
);
|
|
2419
|
+
options.isMeta = true;
|
|
2420
|
+
return this.createTask(name, func, description, options);
|
|
2425
2421
|
}
|
|
2426
2422
|
/**
|
|
2427
2423
|
* Creates a UniqueTask (executes once per execution ID, merging parents) and registers it.
|
|
@@ -2436,18 +2432,12 @@ var Cadenza = class {
|
|
|
2436
2432
|
static createUniqueTask(name, func, description, options = {
|
|
2437
2433
|
concurrency: 0,
|
|
2438
2434
|
timeout: 0,
|
|
2439
|
-
register: true
|
|
2435
|
+
register: true,
|
|
2436
|
+
isUnique: true,
|
|
2437
|
+
isMeta: false
|
|
2440
2438
|
}) {
|
|
2441
|
-
|
|
2442
|
-
this.
|
|
2443
|
-
return new UniqueTask(
|
|
2444
|
-
name,
|
|
2445
|
-
func,
|
|
2446
|
-
description,
|
|
2447
|
-
options.concurrency,
|
|
2448
|
-
options.timeout,
|
|
2449
|
-
options.register
|
|
2450
|
-
);
|
|
2439
|
+
options.isUnique = true;
|
|
2440
|
+
return this.createTask(name, func, description, options);
|
|
2451
2441
|
}
|
|
2452
2442
|
/**
|
|
2453
2443
|
* Creates a UniqueMetaTask for meta-layer joins.
|
|
@@ -2460,18 +2450,12 @@ var Cadenza = class {
|
|
|
2460
2450
|
static createUniqueMetaTask(name, func, description, options = {
|
|
2461
2451
|
concurrency: 0,
|
|
2462
2452
|
timeout: 0,
|
|
2463
|
-
register: true
|
|
2453
|
+
register: true,
|
|
2454
|
+
isUnique: true,
|
|
2455
|
+
isMeta: true
|
|
2464
2456
|
}) {
|
|
2465
|
-
|
|
2466
|
-
this.
|
|
2467
|
-
return new UniqueMetaTask(
|
|
2468
|
-
name,
|
|
2469
|
-
func,
|
|
2470
|
-
description,
|
|
2471
|
-
options.concurrency,
|
|
2472
|
-
options.timeout,
|
|
2473
|
-
options.register
|
|
2474
|
-
);
|
|
2457
|
+
options.isMeta = true;
|
|
2458
|
+
return this.createUniqueTask(name, func, description, options);
|
|
2475
2459
|
}
|
|
2476
2460
|
/**
|
|
2477
2461
|
* Creates a ThrottledTask (rate-limited by concurrency or custom groups) and registers it.
|
|
@@ -2486,7 +2470,9 @@ var Cadenza = class {
|
|
|
2486
2470
|
static createThrottledTask(name, func, throttledIdGetter, description, options = {
|
|
2487
2471
|
concurrency: 1,
|
|
2488
2472
|
timeout: 0,
|
|
2489
|
-
register: true
|
|
2473
|
+
register: true,
|
|
2474
|
+
isUnique: false,
|
|
2475
|
+
isMeta: false
|
|
2490
2476
|
}) {
|
|
2491
2477
|
this.bootstrap();
|
|
2492
2478
|
this.validateName(name);
|
|
@@ -2497,7 +2483,9 @@ var Cadenza = class {
|
|
|
2497
2483
|
throttledIdGetter,
|
|
2498
2484
|
options.concurrency,
|
|
2499
2485
|
options.timeout,
|
|
2500
|
-
options.register
|
|
2486
|
+
options.register,
|
|
2487
|
+
options.isUnique,
|
|
2488
|
+
options.isMeta
|
|
2501
2489
|
);
|
|
2502
2490
|
}
|
|
2503
2491
|
/**
|
|
@@ -2512,18 +2500,17 @@ var Cadenza = class {
|
|
|
2512
2500
|
static createThrottledMetaTask(name, func, throttledIdGetter, description, options = {
|
|
2513
2501
|
concurrency: 0,
|
|
2514
2502
|
timeout: 0,
|
|
2515
|
-
register: true
|
|
2503
|
+
register: true,
|
|
2504
|
+
isUnique: false,
|
|
2505
|
+
isMeta: true
|
|
2516
2506
|
}) {
|
|
2517
|
-
|
|
2518
|
-
this.
|
|
2519
|
-
return new ThrottledMetaTask(
|
|
2507
|
+
options.isMeta = true;
|
|
2508
|
+
return this.createThrottledTask(
|
|
2520
2509
|
name,
|
|
2521
2510
|
func,
|
|
2522
|
-
description,
|
|
2523
2511
|
throttledIdGetter,
|
|
2524
|
-
|
|
2525
|
-
options
|
|
2526
|
-
options.register
|
|
2512
|
+
description,
|
|
2513
|
+
options
|
|
2527
2514
|
);
|
|
2528
2515
|
}
|
|
2529
2516
|
/**
|
|
@@ -2541,7 +2528,9 @@ var Cadenza = class {
|
|
|
2541
2528
|
timeout: 0,
|
|
2542
2529
|
register: true,
|
|
2543
2530
|
leading: false,
|
|
2544
|
-
trailing: true
|
|
2531
|
+
trailing: true,
|
|
2532
|
+
isUnique: false,
|
|
2533
|
+
isMeta: false
|
|
2545
2534
|
}) {
|
|
2546
2535
|
this.bootstrap();
|
|
2547
2536
|
this.validateName(name);
|
|
@@ -2554,7 +2543,9 @@ var Cadenza = class {
|
|
|
2554
2543
|
options.trailing,
|
|
2555
2544
|
options.concurrency,
|
|
2556
2545
|
options.timeout,
|
|
2557
|
-
options.register
|
|
2546
|
+
options.register,
|
|
2547
|
+
options.isUnique,
|
|
2548
|
+
options.isMeta
|
|
2558
2549
|
);
|
|
2559
2550
|
}
|
|
2560
2551
|
/**
|
|
@@ -2571,20 +2562,17 @@ var Cadenza = class {
|
|
|
2571
2562
|
timeout: 0,
|
|
2572
2563
|
register: true,
|
|
2573
2564
|
leading: false,
|
|
2574
|
-
trailing: true
|
|
2565
|
+
trailing: true,
|
|
2566
|
+
isUnique: false,
|
|
2567
|
+
isMeta: false
|
|
2575
2568
|
}) {
|
|
2576
|
-
|
|
2577
|
-
this.
|
|
2578
|
-
return new DebouncedMetaTask(
|
|
2569
|
+
options.isMeta = true;
|
|
2570
|
+
return this.createDebounceTask(
|
|
2579
2571
|
name,
|
|
2580
2572
|
func,
|
|
2581
2573
|
description,
|
|
2582
2574
|
debounceTime,
|
|
2583
|
-
options
|
|
2584
|
-
options.trailing,
|
|
2585
|
-
options.concurrency,
|
|
2586
|
-
options.timeout,
|
|
2587
|
-
options.register
|
|
2575
|
+
options
|
|
2588
2576
|
);
|
|
2589
2577
|
}
|
|
2590
2578
|
/**
|
|
@@ -2602,7 +2590,9 @@ var Cadenza = class {
|
|
|
2602
2590
|
static createEphemeralTask(name, func, description, once = true, destroyCondition = () => true, options = {
|
|
2603
2591
|
concurrency: 0,
|
|
2604
2592
|
timeout: 0,
|
|
2605
|
-
register: true
|
|
2593
|
+
register: true,
|
|
2594
|
+
isUnique: false,
|
|
2595
|
+
isMeta: false
|
|
2606
2596
|
}) {
|
|
2607
2597
|
this.bootstrap();
|
|
2608
2598
|
this.validateName(name);
|
|
@@ -2614,7 +2604,9 @@ var Cadenza = class {
|
|
|
2614
2604
|
destroyCondition,
|
|
2615
2605
|
options.concurrency,
|
|
2616
2606
|
options.timeout,
|
|
2617
|
-
options.register
|
|
2607
|
+
options.register,
|
|
2608
|
+
options.isUnique,
|
|
2609
|
+
options.isMeta
|
|
2618
2610
|
);
|
|
2619
2611
|
}
|
|
2620
2612
|
/**
|
|
@@ -2632,17 +2624,14 @@ var Cadenza = class {
|
|
|
2632
2624
|
timeout: 0,
|
|
2633
2625
|
register: true
|
|
2634
2626
|
}) {
|
|
2635
|
-
|
|
2636
|
-
this.
|
|
2637
|
-
return new EphemeralMetaTask(
|
|
2627
|
+
options.isMeta = true;
|
|
2628
|
+
return this.createEphemeralTask(
|
|
2638
2629
|
name,
|
|
2639
2630
|
func,
|
|
2640
2631
|
description,
|
|
2641
2632
|
once,
|
|
2642
2633
|
destroyCondition,
|
|
2643
|
-
options
|
|
2644
|
-
options.timeout,
|
|
2645
|
-
options.register
|
|
2634
|
+
options
|
|
2646
2635
|
);
|
|
2647
2636
|
}
|
|
2648
2637
|
/**
|
|
@@ -2672,9 +2661,9 @@ var Cadenza = class {
|
|
|
2672
2661
|
this.bootstrap();
|
|
2673
2662
|
this.validateName(name);
|
|
2674
2663
|
if (tasks.length === 0) {
|
|
2675
|
-
console.warn(`
|
|
2664
|
+
console.warn(`Routine '${name}' created with no starting tasks (no-op).`);
|
|
2676
2665
|
}
|
|
2677
|
-
return new
|
|
2666
|
+
return new GraphRoutine(name, tasks, description, true);
|
|
2678
2667
|
}
|
|
2679
2668
|
static reset() {
|
|
2680
2669
|
var _a, _b;
|
|
@@ -2692,11 +2681,11 @@ var SignalTask = class extends Task {
|
|
|
2692
2681
|
}
|
|
2693
2682
|
};
|
|
2694
2683
|
|
|
2695
|
-
// src/graph/definition/
|
|
2696
|
-
var
|
|
2684
|
+
// src/graph/definition/UniqueTask.ts
|
|
2685
|
+
var UniqueTask = class extends Task {
|
|
2697
2686
|
constructor() {
|
|
2698
2687
|
super(...arguments);
|
|
2699
|
-
this.
|
|
2688
|
+
this.isUnique = true;
|
|
2700
2689
|
}
|
|
2701
2690
|
};
|
|
2702
2691
|
|
|
@@ -2705,22 +2694,16 @@ var index_default = Cadenza;
|
|
|
2705
2694
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2706
2695
|
0 && (module.exports = {
|
|
2707
2696
|
DebounceTask,
|
|
2708
|
-
DebouncedMetaTask,
|
|
2709
|
-
EphemeralMetaTask,
|
|
2710
2697
|
EphemeralTask,
|
|
2711
2698
|
GraphContext,
|
|
2712
2699
|
GraphRegistry,
|
|
2713
2700
|
GraphRoutine,
|
|
2714
|
-
|
|
2715
|
-
MetaTask,
|
|
2701
|
+
GraphRun,
|
|
2716
2702
|
SignalEmitter,
|
|
2717
|
-
SignalMetaTask,
|
|
2718
2703
|
SignalParticipant,
|
|
2719
2704
|
SignalTask,
|
|
2720
2705
|
Task,
|
|
2721
|
-
ThrottledMetaTask,
|
|
2722
2706
|
ThrottledTask,
|
|
2723
|
-
UniqueMetaTask,
|
|
2724
2707
|
UniqueTask
|
|
2725
2708
|
});
|
|
2726
2709
|
//# sourceMappingURL=index.js.map
|