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