@bluelibs/runner 5.2.1 → 5.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/README.md +54 -1
- package/dist/browser/index.cjs +977 -800
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +975 -801
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +977 -800
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +975 -801
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +1994 -2056
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +1990 -2010
- package/dist/node/node.mjs.map +1 -1
- package/dist/types/definers/builders/error/fluent-builder.interface.d.ts +6 -0
- package/dist/types/definers/builders/error/index.d.ts +10 -1
- package/dist/types/definers/builders/error/types.d.ts +2 -0
- package/dist/types/definers/builders/event/utils.d.ts +1 -4
- package/dist/types/definers/builders/hook/utils.d.ts +1 -4
- package/dist/types/definers/builders/middleware/utils.d.ts +1 -4
- package/dist/types/definers/builders/resource/utils.d.ts +1 -4
- package/dist/types/definers/builders/shared/mergeUtils.d.ts +5 -0
- package/dist/types/definers/builders/task/utils.d.ts +1 -4
- package/dist/types/definers/builders/utils.d.ts +1 -1
- package/dist/types/definers/defineError.d.ts +5 -3
- package/dist/types/defs.d.ts +1 -0
- package/dist/types/errors.d.ts +20 -21
- package/dist/types/globals/resources/tunnel/protocol.d.ts +3 -0
- package/dist/types/models/DependencyProcessor.d.ts +1 -1
- package/dist/types/models/MiddlewareManager.d.ts +2 -2
- package/dist/types/models/RunResult.d.ts +1 -1
- package/dist/types/models/Store.d.ts +15 -13
- package/dist/types/models/StoreRegistry.d.ts +19 -16
- package/dist/types/models/middleware/ResourceMiddlewareComposer.d.ts +2 -2
- package/dist/types/models/utils/buildDependencyGraph.d.ts +12 -0
- package/dist/types/models/utils/dependencyStrategies.d.ts +15 -0
- package/dist/types/models/utils/disposeOrder.d.ts +7 -0
- package/dist/types/node/durable/core/DurableResource.d.ts +24 -9
- package/dist/types/node/durable/core/DurableService.d.ts +15 -9
- package/dist/types/node/durable/core/interfaces/service.d.ts +27 -19
- package/dist/types/node/durable/core/interfaces/store.d.ts +1 -1
- package/dist/types/node/durable/core/managers/ExecutionManager.d.ts +34 -4
- package/dist/types/node/durable/core/managers/ScheduleManager.d.ts +5 -3
- package/dist/types/node/durable/core/managers/TaskRegistry.d.ts +5 -5
- package/dist/types/node/durable/core/managers/WaitManager.d.ts +1 -1
- package/dist/types/node/durable/core/resource.d.ts +5 -5
- package/dist/types/node/durable/index.d.ts +1 -0
- package/dist/types/node/durable/resources/memoryDurableResource.d.ts +5 -5
- package/dist/types/node/durable/resources/redisDurableResource.d.ts +5 -5
- package/dist/types/node/durable/tags/durableWorkflow.tag.d.ts +19 -0
- package/dist/types/node/exposure/requestContext.d.ts +1 -1
- package/dist/types/node/exposure/resource.d.ts +7 -7
- package/dist/types/node/http/http-mixed-client.factory.resource.d.ts +1 -1
- package/dist/types/node/http/http-smart-client.factory.resource.d.ts +1 -1
- package/dist/types/node/node.d.ts +1 -184
- package/dist/types/platform/adapters/edge.d.ts +17 -0
- package/dist/types/platform/adapters/universal-generic.d.ts +3 -0
- package/dist/types/platform/index.d.ts +1 -0
- package/dist/types/platform/types.d.ts +7 -1
- package/dist/types/public.d.ts +6 -1
- package/dist/types/testing.d.ts +0 -1
- package/dist/types/tools/LockableMap.d.ts +20 -0
- package/dist/types/types/error.d.ts +22 -1
- package/dist/types/types/resource.d.ts +2 -4
- package/dist/types/types/symbols.d.ts +3 -3
- package/dist/types/types/tagged.d.ts +18 -0
- package/dist/types/types/task.d.ts +1 -1
- package/dist/ui/assets/index-Bo7Gi6Vq.js +141 -0
- package/dist/ui/assets/index-Y_9aLumt.css +1 -0
- package/dist/ui/index.html +2 -3
- package/dist/universal/index.cjs +977 -800
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs +975 -801
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +1 -2
- package/readmes/AI.md +59 -12
- package/dist/ui/assets/index-2cb8f39f.js +0 -141
- package/dist/ui/assets/index-b1f988bf.css +0 -1
- /package/dist/types/{tunnels → tools}/buildUniversalManifest.d.ts +0 -0
- /package/dist/types/{processHooks.d.ts → tools/processShutdownHooks.d.ts} +0 -0
package/dist/universal/index.cjs
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
var lruCache = require('lru-cache');
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
7
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
11
8
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -13,152 +10,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
13
10
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
15
12
|
});
|
|
16
|
-
var __esm = (fn, res) => function __init() {
|
|
17
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
18
|
-
};
|
|
19
13
|
var __export = (target, all) => {
|
|
20
14
|
for (var name in all)
|
|
21
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
16
|
};
|
|
23
|
-
var __copyProps = (to, from, except, desc) => {
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
-
for (let key of __getOwnPropNames(from))
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
-
}
|
|
29
|
-
return to;
|
|
30
|
-
};
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// src/serializer/regexp-validator.ts
|
|
34
|
-
var regexp_validator_exports = {};
|
|
35
|
-
__export(regexp_validator_exports, {
|
|
36
|
-
assertRegExpPayload: () => assertRegExpPayload,
|
|
37
|
-
isBoundedQuantifier: () => isBoundedQuantifier,
|
|
38
|
-
isQuantifierAt: () => isQuantifierAt,
|
|
39
|
-
isQuantifierChar: () => isQuantifierChar,
|
|
40
|
-
isRegExpPatternSafe: () => isRegExpPatternSafe
|
|
41
|
-
});
|
|
42
|
-
var isQuantifierAt, isQuantifierChar, isBoundedQuantifier, isRegExpPatternSafe, assertRegExpPayload;
|
|
43
|
-
var init_regexp_validator = __esm({
|
|
44
|
-
"src/serializer/regexp-validator.ts"() {
|
|
45
|
-
isQuantifierAt = /* @__PURE__ */ __name((pattern, index) => {
|
|
46
|
-
if (index >= pattern.length) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
const char = pattern[index];
|
|
50
|
-
if (char === "*" || char === "+" || char === "?") {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (char === "{") {
|
|
54
|
-
return isBoundedQuantifier(pattern, index);
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}, "isQuantifierAt");
|
|
58
|
-
isQuantifierChar = /* @__PURE__ */ __name((char, pattern, index) => {
|
|
59
|
-
if (char === "*" || char === "+") {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
if (char === "?") {
|
|
63
|
-
if (index > 0 && pattern[index - 1] === "(") {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
if (char === "{") {
|
|
69
|
-
return isBoundedQuantifier(pattern, index);
|
|
70
|
-
}
|
|
71
|
-
return false;
|
|
72
|
-
}, "isQuantifierChar");
|
|
73
|
-
isBoundedQuantifier = /* @__PURE__ */ __name((pattern, index) => {
|
|
74
|
-
let sawDigit = false;
|
|
75
|
-
let sawComma = false;
|
|
76
|
-
for (let i = index + 1; i < pattern.length; i += 1) {
|
|
77
|
-
const char = pattern[i];
|
|
78
|
-
if (char >= "0" && char <= "9") {
|
|
79
|
-
sawDigit = true;
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (char === "," && !sawComma) {
|
|
83
|
-
sawComma = true;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (char === "}") {
|
|
87
|
-
return sawDigit;
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
}, "isBoundedQuantifier");
|
|
93
|
-
isRegExpPatternSafe = /* @__PURE__ */ __name((pattern) => {
|
|
94
|
-
const groupStack = [];
|
|
95
|
-
let escaped = false;
|
|
96
|
-
let inCharClass = false;
|
|
97
|
-
for (let index = 0; index < pattern.length; index += 1) {
|
|
98
|
-
const char = pattern[index];
|
|
99
|
-
if (escaped) {
|
|
100
|
-
escaped = false;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (char === "\\") {
|
|
104
|
-
escaped = true;
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (inCharClass) {
|
|
108
|
-
if (char === "]") {
|
|
109
|
-
inCharClass = false;
|
|
110
|
-
}
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
if (char === "[") {
|
|
114
|
-
inCharClass = true;
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (char === "(") {
|
|
118
|
-
groupStack.push({ hasQuantifier: false });
|
|
119
|
-
if (pattern[index + 1] === "?") {
|
|
120
|
-
index += 1;
|
|
121
|
-
}
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
if (char === ")") {
|
|
125
|
-
const group = groupStack.pop();
|
|
126
|
-
if (group?.hasQuantifier && isQuantifierAt(pattern, index + 1)) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
if (group?.hasQuantifier && groupStack.length > 0) {
|
|
130
|
-
groupStack[groupStack.length - 1].hasQuantifier = true;
|
|
131
|
-
}
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (isQuantifierChar(char, pattern, index)) {
|
|
135
|
-
if (groupStack.length > 0) {
|
|
136
|
-
groupStack[groupStack.length - 1].hasQuantifier = true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}, "isRegExpPatternSafe");
|
|
142
|
-
assertRegExpPayload = /* @__PURE__ */ __name((value, options) => {
|
|
143
|
-
if (!value || typeof value !== "object") {
|
|
144
|
-
throw new Error("Invalid RegExp payload");
|
|
145
|
-
}
|
|
146
|
-
const record = value;
|
|
147
|
-
if (typeof record.pattern !== "string" || typeof record.flags !== "string") {
|
|
148
|
-
throw new Error("Invalid RegExp payload");
|
|
149
|
-
}
|
|
150
|
-
if (record.pattern.length > options.maxPatternLength) {
|
|
151
|
-
throw new Error(
|
|
152
|
-
`RegExp pattern exceeds limit (${options.maxPatternLength})`
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
if (!options.allowUnsafe && !isRegExpPatternSafe(record.pattern)) {
|
|
156
|
-
throw new Error("Unsafe RegExp pattern");
|
|
157
|
-
}
|
|
158
|
-
return { pattern: record.pattern, flags: record.flags };
|
|
159
|
-
}, "assertRegExpPayload");
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
17
|
|
|
163
18
|
// src/types/symbols.ts
|
|
164
19
|
var symbolTask = Symbol.for("runner.task");
|
|
@@ -166,9 +21,7 @@ var symbolPhantomTask = Symbol.for(
|
|
|
166
21
|
"runner.task.phantom"
|
|
167
22
|
);
|
|
168
23
|
var symbolResource = Symbol.for("runner.resource");
|
|
169
|
-
var
|
|
170
|
-
"runner.resourceForkedFrom"
|
|
171
|
-
);
|
|
24
|
+
var symbolForkedFrom = Symbol.for("runner.forkedFrom");
|
|
172
25
|
var symbolResourceWithConfig = Symbol.for(
|
|
173
26
|
"runner.resourceWithConfig"
|
|
174
27
|
);
|
|
@@ -198,227 +51,6 @@ var symbolAsyncContext = Symbol.for(
|
|
|
198
51
|
"runner.asyncContext"
|
|
199
52
|
);
|
|
200
53
|
|
|
201
|
-
// src/tools/getCallerFile.ts
|
|
202
|
-
function isNodeInline() {
|
|
203
|
-
return typeof process !== "undefined" && typeof process?.versions?.node === "string";
|
|
204
|
-
}
|
|
205
|
-
__name(isNodeInline, "isNodeInline");
|
|
206
|
-
function getCallerFile() {
|
|
207
|
-
const originalPrepare = Error.prepareStackTrace;
|
|
208
|
-
try {
|
|
209
|
-
if (isNodeInline()) {
|
|
210
|
-
const err = new Error();
|
|
211
|
-
Error.prepareStackTrace = (_err, stack2) => stack2;
|
|
212
|
-
const stack = err.stack;
|
|
213
|
-
stack.shift();
|
|
214
|
-
stack.shift();
|
|
215
|
-
const candidate = stack.shift();
|
|
216
|
-
const file = candidate?.getFileName?.();
|
|
217
|
-
return file;
|
|
218
|
-
}
|
|
219
|
-
return "unknown";
|
|
220
|
-
} finally {
|
|
221
|
-
Error.prepareStackTrace = originalPrepare;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
__name(getCallerFile, "getCallerFile");
|
|
225
|
-
|
|
226
|
-
// src/defs.ts
|
|
227
|
-
var defs_exports = {};
|
|
228
|
-
__export(defs_exports, {
|
|
229
|
-
CONTRACT: () => CONTRACT,
|
|
230
|
-
HookDependencyState: () => HookDependencyState,
|
|
231
|
-
RunnerMode: () => RunnerMode,
|
|
232
|
-
isOneOf: () => isOneOf,
|
|
233
|
-
onAnyOf: () => onAnyOf,
|
|
234
|
-
symbolAsyncContext: () => symbolAsyncContext,
|
|
235
|
-
symbolError: () => symbolError,
|
|
236
|
-
symbolEvent: () => symbolEvent,
|
|
237
|
-
symbolFilePath: () => symbolFilePath,
|
|
238
|
-
symbolHook: () => symbolHook,
|
|
239
|
-
symbolMiddleware: () => symbolMiddleware,
|
|
240
|
-
symbolMiddlewareConfigured: () => symbolMiddlewareConfigured,
|
|
241
|
-
symbolOptionalDependency: () => symbolOptionalDependency,
|
|
242
|
-
symbolPhantomTask: () => symbolPhantomTask,
|
|
243
|
-
symbolResource: () => symbolResource,
|
|
244
|
-
symbolResourceForkedFrom: () => symbolResourceForkedFrom,
|
|
245
|
-
symbolResourceMiddleware: () => symbolResourceMiddleware,
|
|
246
|
-
symbolResourceWithConfig: () => symbolResourceWithConfig,
|
|
247
|
-
symbolTag: () => symbolTag,
|
|
248
|
-
symbolTagConfigured: () => symbolTagConfigured,
|
|
249
|
-
symbolTask: () => symbolTask,
|
|
250
|
-
symbolTaskMiddleware: () => symbolTaskMiddleware,
|
|
251
|
-
symbolTunneledBy: () => symbolTunneledBy
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// src/types/event.ts
|
|
255
|
-
function onAnyOf(...defs) {
|
|
256
|
-
return defs;
|
|
257
|
-
}
|
|
258
|
-
__name(onAnyOf, "onAnyOf");
|
|
259
|
-
function isOneOf(emission, defs) {
|
|
260
|
-
return defs.some((d) => d.id === emission.id);
|
|
261
|
-
}
|
|
262
|
-
__name(isOneOf, "isOneOf");
|
|
263
|
-
|
|
264
|
-
// src/types/runner.ts
|
|
265
|
-
var RunnerMode = /* @__PURE__ */ ((RunnerMode2) => {
|
|
266
|
-
RunnerMode2["TEST"] = "test";
|
|
267
|
-
RunnerMode2["DEV"] = "dev";
|
|
268
|
-
RunnerMode2["PROD"] = "prod";
|
|
269
|
-
return RunnerMode2;
|
|
270
|
-
})(RunnerMode || {});
|
|
271
|
-
|
|
272
|
-
// src/types/contracts.ts
|
|
273
|
-
var CONTRACT = Symbol.for("runner.contract");
|
|
274
|
-
|
|
275
|
-
// src/types/storeTypes.ts
|
|
276
|
-
var HookDependencyState = /* @__PURE__ */ ((HookDependencyState2) => {
|
|
277
|
-
HookDependencyState2["Pending"] = "pending";
|
|
278
|
-
HookDependencyState2["Computing"] = "computing";
|
|
279
|
-
HookDependencyState2["Ready"] = "ready";
|
|
280
|
-
return HookDependencyState2;
|
|
281
|
-
})(HookDependencyState || {});
|
|
282
|
-
|
|
283
|
-
// src/definers/tools.ts
|
|
284
|
-
function isTask(definition) {
|
|
285
|
-
return definition && definition[symbolTask];
|
|
286
|
-
}
|
|
287
|
-
__name(isTask, "isTask");
|
|
288
|
-
function isResource(definition) {
|
|
289
|
-
return definition && definition[symbolResource];
|
|
290
|
-
}
|
|
291
|
-
__name(isResource, "isResource");
|
|
292
|
-
function isResourceWithConfig(definition) {
|
|
293
|
-
return definition && definition[symbolResourceWithConfig];
|
|
294
|
-
}
|
|
295
|
-
__name(isResourceWithConfig, "isResourceWithConfig");
|
|
296
|
-
function isEvent(definition) {
|
|
297
|
-
return definition && definition[symbolEvent];
|
|
298
|
-
}
|
|
299
|
-
__name(isEvent, "isEvent");
|
|
300
|
-
function isHook(definition) {
|
|
301
|
-
return definition && definition[symbolHook];
|
|
302
|
-
}
|
|
303
|
-
__name(isHook, "isHook");
|
|
304
|
-
function isTaskMiddleware(definition) {
|
|
305
|
-
return definition && definition[symbolTaskMiddleware];
|
|
306
|
-
}
|
|
307
|
-
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
308
|
-
function isResourceMiddleware(definition) {
|
|
309
|
-
return definition && definition[symbolResourceMiddleware];
|
|
310
|
-
}
|
|
311
|
-
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
312
|
-
function isTag(definition) {
|
|
313
|
-
return definition && definition[symbolTag];
|
|
314
|
-
}
|
|
315
|
-
__name(isTag, "isTag");
|
|
316
|
-
function isOptional(definition) {
|
|
317
|
-
return definition && definition[symbolOptionalDependency];
|
|
318
|
-
}
|
|
319
|
-
__name(isOptional, "isOptional");
|
|
320
|
-
function isError(definition) {
|
|
321
|
-
return Boolean(definition && definition[symbolError]);
|
|
322
|
-
}
|
|
323
|
-
__name(isError, "isError");
|
|
324
|
-
function isAsyncContext(definition) {
|
|
325
|
-
return Boolean(definition && definition[symbolAsyncContext]);
|
|
326
|
-
}
|
|
327
|
-
__name(isAsyncContext, "isAsyncContext");
|
|
328
|
-
|
|
329
|
-
// src/tools/throws.ts
|
|
330
|
-
function invalidThrowsEntryError(owner, item) {
|
|
331
|
-
const got = item === null ? "null" : Array.isArray(item) ? "array" : typeof item === "object" ? "object" : typeof item;
|
|
332
|
-
return new Error(
|
|
333
|
-
`Invalid throws entry for ${owner.kind} ${owner.id}: expected error id string or Error helper, got ${got}`
|
|
334
|
-
);
|
|
335
|
-
}
|
|
336
|
-
__name(invalidThrowsEntryError, "invalidThrowsEntryError");
|
|
337
|
-
function toErrorIdList(owner, list) {
|
|
338
|
-
const ids = [];
|
|
339
|
-
const seen = /* @__PURE__ */ new Set();
|
|
340
|
-
for (const item of list) {
|
|
341
|
-
let id2;
|
|
342
|
-
if (typeof item === "string") {
|
|
343
|
-
if (item.trim().length === 0) {
|
|
344
|
-
throw invalidThrowsEntryError(owner, item);
|
|
345
|
-
}
|
|
346
|
-
id2 = item;
|
|
347
|
-
} else if (isError(item)) {
|
|
348
|
-
id2 = item.id;
|
|
349
|
-
if (typeof id2 !== "string" || id2.trim().length === 0) {
|
|
350
|
-
throw invalidThrowsEntryError(owner, item);
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
throw invalidThrowsEntryError(owner, item);
|
|
354
|
-
}
|
|
355
|
-
if (seen.has(id2)) continue;
|
|
356
|
-
seen.add(id2);
|
|
357
|
-
ids.push(id2);
|
|
358
|
-
}
|
|
359
|
-
return ids;
|
|
360
|
-
}
|
|
361
|
-
__name(toErrorIdList, "toErrorIdList");
|
|
362
|
-
function normalizeThrows(owner, throwsList) {
|
|
363
|
-
if (throwsList === void 0) return void 0;
|
|
364
|
-
return toErrorIdList(owner, throwsList);
|
|
365
|
-
}
|
|
366
|
-
__name(normalizeThrows, "normalizeThrows");
|
|
367
|
-
|
|
368
|
-
// src/definers/defineTask.ts
|
|
369
|
-
function defineTask(taskConfig) {
|
|
370
|
-
const filePath = getCallerFile();
|
|
371
|
-
const id2 = taskConfig.id;
|
|
372
|
-
return {
|
|
373
|
-
[symbolTask]: true,
|
|
374
|
-
[symbolFilePath]: filePath,
|
|
375
|
-
id: id2,
|
|
376
|
-
dependencies: taskConfig.dependencies || {},
|
|
377
|
-
middleware: taskConfig.middleware || [],
|
|
378
|
-
run: taskConfig.run,
|
|
379
|
-
inputSchema: taskConfig.inputSchema,
|
|
380
|
-
resultSchema: taskConfig.resultSchema,
|
|
381
|
-
meta: taskConfig.meta || {},
|
|
382
|
-
tags: taskConfig.tags || [],
|
|
383
|
-
throws: normalizeThrows({ kind: "task", id: id2 }, taskConfig.throws),
|
|
384
|
-
// autorun,
|
|
385
|
-
optional() {
|
|
386
|
-
return {
|
|
387
|
-
inner: this,
|
|
388
|
-
[symbolOptionalDependency]: true
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
__name(defineTask, "defineTask");
|
|
394
|
-
defineTask.phantom = (taskConfig) => {
|
|
395
|
-
const taskDef = defineTask({
|
|
396
|
-
...taskConfig,
|
|
397
|
-
run: /* @__PURE__ */ __name(async (_input) => {
|
|
398
|
-
return void 0;
|
|
399
|
-
}, "run")
|
|
400
|
-
});
|
|
401
|
-
taskDef[symbolPhantomTask] = true;
|
|
402
|
-
return taskDef;
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
// src/definers/defineHook.ts
|
|
406
|
-
function defineHook(hookDef) {
|
|
407
|
-
const filePath = getCallerFile();
|
|
408
|
-
return {
|
|
409
|
-
[symbolHook]: true,
|
|
410
|
-
[symbolFilePath]: filePath,
|
|
411
|
-
id: hookDef.id,
|
|
412
|
-
dependencies: hookDef.dependencies || {},
|
|
413
|
-
on: hookDef.on,
|
|
414
|
-
order: hookDef.order,
|
|
415
|
-
run: hookDef.run,
|
|
416
|
-
meta: hookDef.meta || {},
|
|
417
|
-
tags: hookDef.tags || []
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
__name(defineHook, "defineHook");
|
|
421
|
-
|
|
422
54
|
// src/errors.ts
|
|
423
55
|
var errors_exports = {};
|
|
424
56
|
__export(errors_exports, {
|
|
@@ -431,7 +63,6 @@ __export(errors_exports, {
|
|
|
431
63
|
eventCycleError: () => eventCycleError,
|
|
432
64
|
eventEmissionCycleError: () => eventEmissionCycleError,
|
|
433
65
|
eventNotFoundError: () => eventNotFoundError,
|
|
434
|
-
isCancellationError: () => isCancellationError,
|
|
435
66
|
lockedError: () => lockedError,
|
|
436
67
|
middlewareNotRegisteredError: () => middlewareNotRegisteredError,
|
|
437
68
|
phantomTaskNotRoutedError: () => phantomTaskNotRoutedError,
|
|
@@ -445,13 +76,52 @@ __export(errors_exports, {
|
|
|
445
76
|
validationError: () => validationError
|
|
446
77
|
});
|
|
447
78
|
|
|
79
|
+
// src/tools/getCallerFile.ts
|
|
80
|
+
function isNodeInline() {
|
|
81
|
+
return typeof process !== "undefined" && typeof process?.versions?.node === "string";
|
|
82
|
+
}
|
|
83
|
+
__name(isNodeInline, "isNodeInline");
|
|
84
|
+
function getCallerFile() {
|
|
85
|
+
const originalPrepare = Error.prepareStackTrace;
|
|
86
|
+
try {
|
|
87
|
+
if (isNodeInline()) {
|
|
88
|
+
const err = new Error();
|
|
89
|
+
Error.prepareStackTrace = (_err, stack2) => stack2;
|
|
90
|
+
const stack = err.stack;
|
|
91
|
+
stack.shift();
|
|
92
|
+
stack.shift();
|
|
93
|
+
const candidate = stack.shift();
|
|
94
|
+
const file = candidate?.getFileName?.();
|
|
95
|
+
return file;
|
|
96
|
+
}
|
|
97
|
+
return "unknown";
|
|
98
|
+
} finally {
|
|
99
|
+
Error.prepareStackTrace = originalPrepare;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
__name(getCallerFile, "getCallerFile");
|
|
103
|
+
|
|
448
104
|
// src/definers/defineError.ts
|
|
105
|
+
var isValidHttpCode = /* @__PURE__ */ __name((value) => Number.isInteger(value) && value >= 100 && value <= 599, "isValidHttpCode");
|
|
106
|
+
var assertHttpCode = /* @__PURE__ */ __name((value) => {
|
|
107
|
+
if (!isValidHttpCode(value)) {
|
|
108
|
+
throw new Error(
|
|
109
|
+
`Error httpCode must be an integer between 100 and 599. Received: ${value}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
}, "assertHttpCode");
|
|
449
113
|
var RunnerError = class extends Error {
|
|
450
|
-
constructor(id2, message, data) {
|
|
451
|
-
super(
|
|
114
|
+
constructor(id2, message, data, httpCode, remediation) {
|
|
115
|
+
super(
|
|
116
|
+
remediation !== void 0 ? `${message}
|
|
117
|
+
|
|
118
|
+
Remediation: ${remediation}` : message
|
|
119
|
+
);
|
|
452
120
|
this.id = id2;
|
|
453
121
|
this.data = data;
|
|
454
122
|
this.name = id2;
|
|
123
|
+
this.httpCode = httpCode;
|
|
124
|
+
this.remediation = remediation;
|
|
455
125
|
}
|
|
456
126
|
static {
|
|
457
127
|
__name(this, "RunnerError");
|
|
@@ -471,10 +141,20 @@ var ErrorHelper = class {
|
|
|
471
141
|
get id() {
|
|
472
142
|
return this.definition.id;
|
|
473
143
|
}
|
|
144
|
+
get httpCode() {
|
|
145
|
+
return this.definition.httpCode;
|
|
146
|
+
}
|
|
474
147
|
throw(data) {
|
|
475
148
|
const parsed = this.definition.dataSchema ? this.definition.dataSchema.parse(data) : data;
|
|
476
149
|
const message = this.definition.format(parsed);
|
|
477
|
-
|
|
150
|
+
const remediation = typeof this.definition.remediation === "function" ? this.definition.remediation(parsed) : this.definition.remediation;
|
|
151
|
+
throw new RunnerError(
|
|
152
|
+
this.definition.id,
|
|
153
|
+
message,
|
|
154
|
+
parsed,
|
|
155
|
+
this.definition.httpCode,
|
|
156
|
+
remediation
|
|
157
|
+
);
|
|
478
158
|
}
|
|
479
159
|
is(error2) {
|
|
480
160
|
return error2 instanceof RunnerError && error2.name === this.definition.id;
|
|
@@ -487,6 +167,9 @@ var ErrorHelper = class {
|
|
|
487
167
|
}
|
|
488
168
|
};
|
|
489
169
|
function defineError(definition, filePath) {
|
|
170
|
+
if (definition.httpCode !== void 0) {
|
|
171
|
+
assertHttpCode(definition.httpCode);
|
|
172
|
+
}
|
|
490
173
|
if (!definition.format) {
|
|
491
174
|
definition.format = (data) => `${JSON.stringify(data)}`;
|
|
492
175
|
}
|
|
@@ -508,9 +191,22 @@ function clone(s, patch) {
|
|
|
508
191
|
__name(clone, "clone");
|
|
509
192
|
|
|
510
193
|
// src/definers/builders/error/fluent-builder.ts
|
|
194
|
+
var isValidHttpCode2 = /* @__PURE__ */ __name((value) => Number.isInteger(value) && value >= 100 && value <= 599, "isValidHttpCode");
|
|
195
|
+
var assertHttpCode2 = /* @__PURE__ */ __name((value) => {
|
|
196
|
+
if (!isValidHttpCode2(value)) {
|
|
197
|
+
throw new Error(
|
|
198
|
+
`Error httpCode must be an integer between 100 and 599. Received: ${value}`
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}, "assertHttpCode");
|
|
511
202
|
function makeErrorBuilder(state) {
|
|
512
203
|
const builder = {
|
|
513
204
|
id: state.id,
|
|
205
|
+
httpCode(code) {
|
|
206
|
+
assertHttpCode2(code);
|
|
207
|
+
const next = clone(state, { httpCode: code });
|
|
208
|
+
return makeErrorBuilder(next);
|
|
209
|
+
},
|
|
514
210
|
serialize(fn) {
|
|
515
211
|
const next = clone(state, { serialize: fn });
|
|
516
212
|
return makeErrorBuilder(next);
|
|
@@ -527,6 +223,10 @@ function makeErrorBuilder(state) {
|
|
|
527
223
|
const next = clone(state, { format: fn });
|
|
528
224
|
return makeErrorBuilder(next);
|
|
529
225
|
},
|
|
226
|
+
remediation(advice) {
|
|
227
|
+
const next = clone(state, { remediation: advice });
|
|
228
|
+
return makeErrorBuilder(next);
|
|
229
|
+
},
|
|
530
230
|
meta(m) {
|
|
531
231
|
const next = clone(state, { meta: m });
|
|
532
232
|
return makeErrorBuilder(next);
|
|
@@ -535,10 +235,12 @@ function makeErrorBuilder(state) {
|
|
|
535
235
|
return defineError(
|
|
536
236
|
{
|
|
537
237
|
id: state.id,
|
|
238
|
+
httpCode: state.httpCode,
|
|
538
239
|
serialize: state.serialize,
|
|
539
240
|
parse: state.parse,
|
|
540
241
|
dataSchema: state.dataSchema,
|
|
541
242
|
format: state.format,
|
|
243
|
+
remediation: state.remediation,
|
|
542
244
|
meta: state.meta
|
|
543
245
|
},
|
|
544
246
|
state.filePath
|
|
@@ -555,6 +257,7 @@ function errorBuilder(id2) {
|
|
|
555
257
|
const initial = Object.freeze({
|
|
556
258
|
id: id2,
|
|
557
259
|
filePath,
|
|
260
|
+
httpCode: void 0,
|
|
558
261
|
serialize: void 0,
|
|
559
262
|
parse: void 0,
|
|
560
263
|
dataSchema: void 0,
|
|
@@ -563,7 +266,13 @@ function errorBuilder(id2) {
|
|
|
563
266
|
return makeErrorBuilder(initial);
|
|
564
267
|
}
|
|
565
268
|
__name(errorBuilder, "errorBuilder");
|
|
566
|
-
|
|
269
|
+
function isRunnerError(error2) {
|
|
270
|
+
return error2 instanceof RunnerError;
|
|
271
|
+
}
|
|
272
|
+
__name(isRunnerError, "isRunnerError");
|
|
273
|
+
var error = Object.assign(errorBuilder, {
|
|
274
|
+
is: isRunnerError
|
|
275
|
+
});
|
|
567
276
|
|
|
568
277
|
// src/platform/adapters/node-als.ts
|
|
569
278
|
async function loadAsyncLocalStorageClass() {
|
|
@@ -729,20 +438,67 @@ var EdgePlatformAdapter = class extends BrowserPlatformAdapter {
|
|
|
729
438
|
constructor() {
|
|
730
439
|
super(...arguments);
|
|
731
440
|
this.id = "edge";
|
|
441
|
+
this.alsClass = null;
|
|
442
|
+
this.alsProbed = false;
|
|
732
443
|
}
|
|
733
444
|
static {
|
|
734
445
|
__name(this, "EdgePlatformAdapter");
|
|
735
446
|
}
|
|
447
|
+
async init() {
|
|
448
|
+
await this.probeAsyncLocalStorage();
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Attempt to discover AsyncLocalStorage from the runtime.
|
|
452
|
+
* Checks globalThis first, then tries `import("node:async_hooks")`.
|
|
453
|
+
*/
|
|
454
|
+
probeGlobalAsyncLocalStorage() {
|
|
455
|
+
if (this.alsClass) return true;
|
|
456
|
+
const g = globalThis;
|
|
457
|
+
if (typeof g.AsyncLocalStorage === "function") {
|
|
458
|
+
this.alsClass = g.AsyncLocalStorage;
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
async probeAsyncLocalStorage() {
|
|
464
|
+
if (this.alsProbed) return;
|
|
465
|
+
if (this.probeGlobalAsyncLocalStorage()) {
|
|
466
|
+
this.alsProbed = true;
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
const mod = await import('async_hooks');
|
|
471
|
+
if (mod?.AsyncLocalStorage) {
|
|
472
|
+
this.alsClass = mod.AsyncLocalStorage;
|
|
473
|
+
}
|
|
474
|
+
} catch {
|
|
475
|
+
} finally {
|
|
476
|
+
this.alsProbed = true;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
736
479
|
onShutdownSignal(_handler) {
|
|
737
480
|
return () => {
|
|
738
481
|
};
|
|
739
482
|
}
|
|
483
|
+
hasAsyncLocalStorage() {
|
|
484
|
+
this.probeGlobalAsyncLocalStorage();
|
|
485
|
+
return this.alsClass !== null;
|
|
486
|
+
}
|
|
487
|
+
createAsyncLocalStorage() {
|
|
488
|
+
this.probeGlobalAsyncLocalStorage();
|
|
489
|
+
if (this.alsClass) {
|
|
490
|
+
return new this.alsClass();
|
|
491
|
+
}
|
|
492
|
+
return super.createAsyncLocalStorage();
|
|
493
|
+
}
|
|
740
494
|
};
|
|
741
495
|
|
|
742
496
|
// src/platform/adapters/universal-generic.ts
|
|
743
497
|
var GenericUniversalPlatformAdapter = class {
|
|
744
498
|
constructor() {
|
|
745
499
|
this.id = "universal";
|
|
500
|
+
this.alsClass = null;
|
|
501
|
+
this.alsProbed = false;
|
|
746
502
|
this.setTimeout = globalThis.setTimeout;
|
|
747
503
|
this.clearTimeout = globalThis.clearTimeout;
|
|
748
504
|
}
|
|
@@ -751,6 +507,23 @@ var GenericUniversalPlatformAdapter = class {
|
|
|
751
507
|
}
|
|
752
508
|
async init() {
|
|
753
509
|
}
|
|
510
|
+
probeAsyncLocalStorage() {
|
|
511
|
+
if (this.alsProbed) return;
|
|
512
|
+
this.alsProbed = true;
|
|
513
|
+
const g = globalThis;
|
|
514
|
+
if (typeof g.Deno === "undefined") return;
|
|
515
|
+
if (typeof g.AsyncLocalStorage === "function") {
|
|
516
|
+
this.alsClass = g.AsyncLocalStorage;
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
try {
|
|
520
|
+
const mod = __require("async_hooks");
|
|
521
|
+
if (mod?.AsyncLocalStorage) {
|
|
522
|
+
this.alsClass = mod.AsyncLocalStorage;
|
|
523
|
+
}
|
|
524
|
+
} catch {
|
|
525
|
+
}
|
|
526
|
+
}
|
|
754
527
|
onUncaughtException(handler) {
|
|
755
528
|
const tgt = globalThis;
|
|
756
529
|
if (tgt.addEventListener) {
|
|
@@ -805,9 +578,14 @@ var GenericUniversalPlatformAdapter = class {
|
|
|
805
578
|
return void 0;
|
|
806
579
|
}
|
|
807
580
|
hasAsyncLocalStorage() {
|
|
808
|
-
|
|
581
|
+
this.probeAsyncLocalStorage();
|
|
582
|
+
return this.alsClass !== null;
|
|
809
583
|
}
|
|
810
584
|
createAsyncLocalStorage() {
|
|
585
|
+
this.probeAsyncLocalStorage();
|
|
586
|
+
if (this.alsClass) {
|
|
587
|
+
return new this.alsClass();
|
|
588
|
+
}
|
|
811
589
|
return {
|
|
812
590
|
getStore: /* @__PURE__ */ __name(() => {
|
|
813
591
|
platformUnsupportedFunctionError.throw({
|
|
@@ -865,6 +643,10 @@ var UniversalPlatformAdapter = class {
|
|
|
865
643
|
if (this.inner) return;
|
|
866
644
|
const kind = detectEnvironment();
|
|
867
645
|
const global = globalThis;
|
|
646
|
+
if (typeof global.Deno !== "undefined") {
|
|
647
|
+
this.inner = new GenericUniversalPlatformAdapter();
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
868
650
|
if (typeof global.document !== "undefined" || typeof global.addEventListener === "function") {
|
|
869
651
|
this.inner = new BrowserPlatformAdapter();
|
|
870
652
|
} else {
|
|
@@ -994,9 +776,13 @@ var PlatformAdapter = class {
|
|
|
994
776
|
// src/errors.ts
|
|
995
777
|
var duplicateRegistrationError = error("runner.errors.duplicateRegistration").format(
|
|
996
778
|
({ type, id: id2 }) => `${type} "${id2.toString()}" already registered. You might have used the same 'id' in two different components or you may have registered the same element twice.`
|
|
779
|
+
).remediation(
|
|
780
|
+
({ type }) => `Ensure each ${type} has a unique id. If you need the same definition in multiple places, use .fork() to create a copy with a new id.`
|
|
997
781
|
).build();
|
|
998
782
|
var dependencyNotFoundError = error("runner.errors.dependencyNotFound").format(
|
|
999
783
|
({ key }) => `Dependency ${key.toString()} not found. Did you forget to register it through a resource?`
|
|
784
|
+
).remediation(
|
|
785
|
+
({ key }) => `Register the dependency "${key.toString()}" in a parent resource using .register([${key.toString()}]). If the dependency is optional, use .optional() when declaring it.`
|
|
1000
786
|
).build();
|
|
1001
787
|
var unknownItemTypeError = error(
|
|
1002
788
|
"runner.errors.unknownItemType"
|
|
@@ -1004,10 +790,14 @@ var unknownItemTypeError = error(
|
|
|
1004
790
|
({ item }) => `Unknown item type: ${String(
|
|
1005
791
|
item
|
|
1006
792
|
)}. Please ensure you are not using different versions of '@bluelibs/runner'`
|
|
793
|
+
).remediation(
|
|
794
|
+
"Check that all packages depend on the same version of '@bluelibs/runner'. Run 'npm ls @bluelibs/runner' to detect duplicates."
|
|
1007
795
|
).build();
|
|
1008
796
|
var contextError = error(
|
|
1009
797
|
"runner.errors.context"
|
|
1010
|
-
).format(({ details }) => details ?? "Context error").
|
|
798
|
+
).format(({ details }) => details ?? "Context error").remediation(
|
|
799
|
+
"Verify the async context is registered in a parent resource and that .provide() was called before .use(). If the context is optional, use .optional() when declaring the dependency."
|
|
800
|
+
).build();
|
|
1011
801
|
var circularDependenciesError = error("runner.errors.circularDependencies").format(({ cycles }) => {
|
|
1012
802
|
const cycleDetails = cycles.map((cycle) => ` \u2022 ${cycle}`).join("\n");
|
|
1013
803
|
const hasMiddleware = cycles.some((cycle) => cycle.includes("middleware"));
|
|
@@ -1020,36 +810,54 @@ var circularDependenciesError = error("runner.errors.circularDependencies").form
|
|
|
1020
810
|
}
|
|
1021
811
|
return `Circular dependencies detected:
|
|
1022
812
|
${cycleDetails}${guidance}`;
|
|
1023
|
-
}).
|
|
813
|
+
}).remediation(
|
|
814
|
+
"Break the cycle by extracting shared state into a new resource that both sides depend on, or use events for indirect communication."
|
|
815
|
+
).build();
|
|
1024
816
|
var eventNotFoundError = error(
|
|
1025
817
|
"runner.errors.eventNotFound"
|
|
1026
818
|
).format(
|
|
1027
819
|
({ id: id2 }) => `Event "${id2.toString()}" not found. Did you forget to register it?`
|
|
820
|
+
).remediation(
|
|
821
|
+
({ id: id2 }) => `Add the event "${id2.toString()}" to a parent resource via .register([yourEvent]). Ensure the event definition is built with r.event("${id2.toString()}").build().`
|
|
1028
822
|
).build();
|
|
1029
823
|
var resourceNotFoundError = error(
|
|
1030
824
|
"runner.errors.resourceNotFound"
|
|
1031
825
|
).format(
|
|
1032
826
|
({ id: id2 }) => `Resource "${id2.toString()}" not found. Did you forget to register it or are you using the correct id?`
|
|
827
|
+
).remediation(
|
|
828
|
+
({ id: id2 }) => `Register the resource "${id2.toString()}" in a parent resource via .register([yourResource]). Verify the id string matches exactly (ids are case-sensitive).`
|
|
1033
829
|
).build();
|
|
1034
830
|
var middlewareNotRegisteredError = error("runner.errors.middlewareNotRegistered").format(
|
|
1035
831
|
({ type, source, middlewareId }) => `Middleware inside ${type} "${source}" depends on "${middlewareId}" but it's not registered. Did you forget to register it?`
|
|
832
|
+
).remediation(
|
|
833
|
+
({ middlewareId }) => `Register the middleware "${middlewareId}" alongside its consumer in a parent resource via .register([yourMiddleware]).`
|
|
1036
834
|
).build();
|
|
1037
835
|
var tagNotFoundError = error(
|
|
1038
836
|
"runner.errors.tagNotFound"
|
|
1039
837
|
).format(
|
|
1040
838
|
({ id: id2 }) => `Tag "${id2}" not registered. Did you forget to register it inside a resource?`
|
|
839
|
+
).remediation(
|
|
840
|
+
({ id: id2 }) => `Register the tag "${id2}" in a parent resource via .register([yourTag]). Tags must be registered before they can be queried.`
|
|
1041
841
|
).build();
|
|
1042
842
|
var lockedError = error(
|
|
1043
843
|
"runner.errors.locked"
|
|
1044
844
|
).format(
|
|
1045
845
|
({ what }) => `Cannot modify the ${what.toString()} when it is locked.`
|
|
846
|
+
).remediation(
|
|
847
|
+
({ what }) => `The ${what.toString()} is locked after initialization. Perform all modifications before calling run().`
|
|
1046
848
|
).build();
|
|
1047
849
|
var storeAlreadyInitializedError = error(
|
|
1048
850
|
"runner.errors.storeAlreadyInitialized"
|
|
1049
|
-
).format(() => "Store already initialized. Cannot reinitialize.").
|
|
851
|
+
).format(() => "Store already initialized. Cannot reinitialize.").remediation(
|
|
852
|
+
"Do not call run() more than once on the same resource tree. Create a fresh resource if you need a separate runtime."
|
|
853
|
+
).build();
|
|
1050
854
|
var validationError = error("runner.errors.validation").format(({ subject, id: id2, originalError }) => {
|
|
1051
855
|
const errorMessage = originalError instanceof Error ? originalError.message : String(originalError);
|
|
1052
856
|
return `${subject} validation failed for ${id2.toString()}: ${errorMessage}`;
|
|
857
|
+
}).remediation(({ subject, id: id2 }) => {
|
|
858
|
+
const lower = subject.toLowerCase();
|
|
859
|
+
const schemaHint = lower.includes("input") ? "inputSchema" : lower.includes("config") ? "configSchema" : lower.includes("result") ? "resultSchema" : "schema";
|
|
860
|
+
return `Check the ${subject} passed to "${id2.toString()}". Ensure it matches the schema defined via .${schemaHint}().`;
|
|
1053
861
|
}).build();
|
|
1054
862
|
var eventCycleError = error("runner.errors.eventCycle").format(({ path }) => {
|
|
1055
863
|
const chain = path.map((p) => `${p.id}\u2190${p.source}`).join(" -> ");
|
|
@@ -1057,37 +865,245 @@ var eventCycleError = error("runner.errors.eventCycle").format(({ path }) => {
|
|
|
1057
865
|
${chain}
|
|
1058
866
|
|
|
1059
867
|
Break the cycle by changing hook logic (avoid mutual emits) or gate with conditions/tags.`;
|
|
1060
|
-
}).
|
|
868
|
+
}).remediation(
|
|
869
|
+
"Refactor hooks to avoid circular event emissions. Use conditional guards, split events into finer-grained signals, or introduce an intermediate task to break the cycle."
|
|
870
|
+
).build();
|
|
1061
871
|
var eventEmissionCycleError = error("runner.errors.eventEmissionCycle").format(({ cycles }) => {
|
|
1062
872
|
const list = cycles.map((c) => ` \u2022 ${c}`).join("\n");
|
|
1063
873
|
return `Event emission cycles detected between hooks and events:
|
|
1064
874
|
${list}
|
|
1065
875
|
|
|
1066
876
|
This was detected at compile time (dry-run). Break the cycle by avoiding mutual emits between hooks or scoping hooks using tags.`;
|
|
1067
|
-
}).
|
|
877
|
+
}).remediation(
|
|
878
|
+
"Redesign the event/hook graph so no hook emits an event that eventually triggers itself. Use tags or conditional logic to prevent re-entrant emissions."
|
|
879
|
+
).build();
|
|
1068
880
|
var platformUnsupportedFunctionError = error("runner.errors.platformUnsupportedFunction").format(
|
|
1069
881
|
({ functionName }) => `Platform function not supported in this environment: ${functionName}. Detected platform: ${detectEnvironment()}.`
|
|
882
|
+
).remediation(
|
|
883
|
+
({ functionName }) => `The function "${functionName}" requires a Node.js environment. If running in a browser or edge runtime, use a platform-compatible alternative or guard the call with a platform check.`
|
|
1070
884
|
).build();
|
|
1071
885
|
var cancellationError = error(
|
|
1072
886
|
"runner.errors.cancellation"
|
|
1073
|
-
).format(({ reason }) => reason || "Operation cancelled").
|
|
887
|
+
).format(({ reason }) => reason || "Operation cancelled").remediation(
|
|
888
|
+
"The operation was cancelled, typically via an AbortController signal. If this is unexpected, check timeout middleware settings or ensure the caller is not aborting prematurely."
|
|
889
|
+
).build();
|
|
1074
890
|
var tunnelOwnershipConflictError = error("runner.errors.tunnelOwnershipConflict").format(
|
|
1075
891
|
({ taskId, currentOwnerId, attemptedOwnerId }) => `Task "${taskId}" is already tunneled by resource "${currentOwnerId}". Resource "${attemptedOwnerId}" cannot tunnel it again. Ensure each task is owned by a single tunnel client.`
|
|
892
|
+
).remediation(
|
|
893
|
+
({ taskId }) => `Each task can only be tunneled by one client. Remove the duplicate tunnel registration for "${taskId}" or split the task into separate definitions with distinct ids.`
|
|
1076
894
|
).build();
|
|
1077
895
|
var phantomTaskNotRoutedError = error("runner.errors.phantomTaskNotRouted").format(
|
|
1078
896
|
({ taskId }) => `Phantom task "${taskId}" is not routed through any tunnel. Ensure a tunnel client selects this task id (or avoid calling the phantom task directly).`
|
|
897
|
+
).remediation(
|
|
898
|
+
({ taskId }) => `Configure a tunnel client resource to select "${taskId}" so it routes to a remote server. Phantom tasks cannot be executed locally \u2014 they only serve as local proxies for remote tasks.`
|
|
1079
899
|
).build();
|
|
1080
900
|
var taskNotRegisteredError = error("runner.errors.taskNotRegistered").format(
|
|
1081
901
|
({ taskId }) => `Task "${taskId}" is not registered in the Store. This is an internal error\u2014ensure the task is registered before execution.`
|
|
902
|
+
).remediation(
|
|
903
|
+
({ taskId }) => `Register the task "${taskId}" in a parent resource via .register([yourTask]) before calling run(). If this error persists, it may indicate an internal framework bug.`
|
|
1082
904
|
).build();
|
|
1083
905
|
var builderIncompleteError = error("runner.errors.builderIncomplete").format(({ type, builderId, missingFields }) => {
|
|
1084
906
|
const typeLabel = type === "hook" ? "Hook" : type === "task-middleware" ? "Task middleware" : "Resource middleware";
|
|
1085
907
|
return `${typeLabel} "${builderId}" is incomplete. Missing required: ${missingFields.join(", ")}. Call ${missingFields.map((f) => `.${f}()`).join(" and ")} before .build().`;
|
|
1086
|
-
}).
|
|
1087
|
-
|
|
1088
|
-
|
|
908
|
+
}).remediation(
|
|
909
|
+
({ missingFields }) => `Add the missing builder steps: ${missingFields.map((f) => `.${f}()`).join(", ")} before calling .build().`
|
|
910
|
+
).build();
|
|
911
|
+
|
|
912
|
+
// src/defs.ts
|
|
913
|
+
var defs_exports = {};
|
|
914
|
+
__export(defs_exports, {
|
|
915
|
+
CONTRACT: () => CONTRACT,
|
|
916
|
+
HookDependencyState: () => HookDependencyState,
|
|
917
|
+
RunnerMode: () => RunnerMode,
|
|
918
|
+
isOneOf: () => isOneOf,
|
|
919
|
+
onAnyOf: () => onAnyOf,
|
|
920
|
+
symbolAsyncContext: () => symbolAsyncContext,
|
|
921
|
+
symbolError: () => symbolError,
|
|
922
|
+
symbolEvent: () => symbolEvent,
|
|
923
|
+
symbolFilePath: () => symbolFilePath,
|
|
924
|
+
symbolForkedFrom: () => symbolForkedFrom,
|
|
925
|
+
symbolHook: () => symbolHook,
|
|
926
|
+
symbolMiddleware: () => symbolMiddleware,
|
|
927
|
+
symbolMiddlewareConfigured: () => symbolMiddlewareConfigured,
|
|
928
|
+
symbolOptionalDependency: () => symbolOptionalDependency,
|
|
929
|
+
symbolPhantomTask: () => symbolPhantomTask,
|
|
930
|
+
symbolResource: () => symbolResource,
|
|
931
|
+
symbolResourceMiddleware: () => symbolResourceMiddleware,
|
|
932
|
+
symbolResourceWithConfig: () => symbolResourceWithConfig,
|
|
933
|
+
symbolTag: () => symbolTag,
|
|
934
|
+
symbolTagConfigured: () => symbolTagConfigured,
|
|
935
|
+
symbolTask: () => symbolTask,
|
|
936
|
+
symbolTaskMiddleware: () => symbolTaskMiddleware,
|
|
937
|
+
symbolTunneledBy: () => symbolTunneledBy
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// src/types/event.ts
|
|
941
|
+
function onAnyOf(...defs) {
|
|
942
|
+
return defs;
|
|
943
|
+
}
|
|
944
|
+
__name(onAnyOf, "onAnyOf");
|
|
945
|
+
function isOneOf(emission, defs) {
|
|
946
|
+
return defs.some((d) => d.id === emission.id);
|
|
947
|
+
}
|
|
948
|
+
__name(isOneOf, "isOneOf");
|
|
949
|
+
|
|
950
|
+
// src/types/runner.ts
|
|
951
|
+
var RunnerMode = /* @__PURE__ */ ((RunnerMode2) => {
|
|
952
|
+
RunnerMode2["TEST"] = "test";
|
|
953
|
+
RunnerMode2["DEV"] = "dev";
|
|
954
|
+
RunnerMode2["PROD"] = "prod";
|
|
955
|
+
return RunnerMode2;
|
|
956
|
+
})(RunnerMode || {});
|
|
957
|
+
|
|
958
|
+
// src/types/contracts.ts
|
|
959
|
+
var CONTRACT = Symbol.for("runner.contract");
|
|
960
|
+
|
|
961
|
+
// src/types/storeTypes.ts
|
|
962
|
+
var HookDependencyState = /* @__PURE__ */ ((HookDependencyState2) => {
|
|
963
|
+
HookDependencyState2["Pending"] = "pending";
|
|
964
|
+
HookDependencyState2["Computing"] = "computing";
|
|
965
|
+
HookDependencyState2["Ready"] = "ready";
|
|
966
|
+
return HookDependencyState2;
|
|
967
|
+
})(HookDependencyState || {});
|
|
968
|
+
|
|
969
|
+
// src/definers/tools.ts
|
|
970
|
+
function isTask(definition) {
|
|
971
|
+
return definition && definition[symbolTask];
|
|
972
|
+
}
|
|
973
|
+
__name(isTask, "isTask");
|
|
974
|
+
function isResource(definition) {
|
|
975
|
+
return definition && definition[symbolResource];
|
|
976
|
+
}
|
|
977
|
+
__name(isResource, "isResource");
|
|
978
|
+
function isResourceWithConfig(definition) {
|
|
979
|
+
return definition && definition[symbolResourceWithConfig];
|
|
980
|
+
}
|
|
981
|
+
__name(isResourceWithConfig, "isResourceWithConfig");
|
|
982
|
+
function isEvent(definition) {
|
|
983
|
+
return definition && definition[symbolEvent];
|
|
984
|
+
}
|
|
985
|
+
__name(isEvent, "isEvent");
|
|
986
|
+
function isHook(definition) {
|
|
987
|
+
return definition && definition[symbolHook];
|
|
988
|
+
}
|
|
989
|
+
__name(isHook, "isHook");
|
|
990
|
+
function isTaskMiddleware(definition) {
|
|
991
|
+
return definition && definition[symbolTaskMiddleware];
|
|
992
|
+
}
|
|
993
|
+
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
994
|
+
function isResourceMiddleware(definition) {
|
|
995
|
+
return definition && definition[symbolResourceMiddleware];
|
|
996
|
+
}
|
|
997
|
+
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
998
|
+
function isTag(definition) {
|
|
999
|
+
return definition && definition[symbolTag];
|
|
1000
|
+
}
|
|
1001
|
+
__name(isTag, "isTag");
|
|
1002
|
+
function isOptional(definition) {
|
|
1003
|
+
return definition && definition[symbolOptionalDependency];
|
|
1004
|
+
}
|
|
1005
|
+
__name(isOptional, "isOptional");
|
|
1006
|
+
function isError(definition) {
|
|
1007
|
+
return Boolean(definition && definition[symbolError]);
|
|
1089
1008
|
}
|
|
1090
|
-
__name(
|
|
1009
|
+
__name(isError, "isError");
|
|
1010
|
+
function isAsyncContext(definition) {
|
|
1011
|
+
return Boolean(definition && definition[symbolAsyncContext]);
|
|
1012
|
+
}
|
|
1013
|
+
__name(isAsyncContext, "isAsyncContext");
|
|
1014
|
+
|
|
1015
|
+
// src/tools/throws.ts
|
|
1016
|
+
function invalidThrowsEntryError(owner, item) {
|
|
1017
|
+
const got = item === null ? "null" : Array.isArray(item) ? "array" : typeof item === "object" ? "object" : typeof item;
|
|
1018
|
+
return new Error(
|
|
1019
|
+
`Invalid throws entry for ${owner.kind} ${owner.id}: expected error id string or Error helper, got ${got}`
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
__name(invalidThrowsEntryError, "invalidThrowsEntryError");
|
|
1023
|
+
function toErrorIdList(owner, list) {
|
|
1024
|
+
const ids = [];
|
|
1025
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1026
|
+
for (const item of list) {
|
|
1027
|
+
let id2;
|
|
1028
|
+
if (typeof item === "string") {
|
|
1029
|
+
if (item.trim().length === 0) {
|
|
1030
|
+
throw invalidThrowsEntryError(owner, item);
|
|
1031
|
+
}
|
|
1032
|
+
id2 = item;
|
|
1033
|
+
} else if (isError(item)) {
|
|
1034
|
+
id2 = item.id;
|
|
1035
|
+
if (typeof id2 !== "string" || id2.trim().length === 0) {
|
|
1036
|
+
throw invalidThrowsEntryError(owner, item);
|
|
1037
|
+
}
|
|
1038
|
+
} else {
|
|
1039
|
+
throw invalidThrowsEntryError(owner, item);
|
|
1040
|
+
}
|
|
1041
|
+
if (seen.has(id2)) continue;
|
|
1042
|
+
seen.add(id2);
|
|
1043
|
+
ids.push(id2);
|
|
1044
|
+
}
|
|
1045
|
+
return ids;
|
|
1046
|
+
}
|
|
1047
|
+
__name(toErrorIdList, "toErrorIdList");
|
|
1048
|
+
function normalizeThrows(owner, throwsList) {
|
|
1049
|
+
if (throwsList === void 0) return void 0;
|
|
1050
|
+
return toErrorIdList(owner, throwsList);
|
|
1051
|
+
}
|
|
1052
|
+
__name(normalizeThrows, "normalizeThrows");
|
|
1053
|
+
|
|
1054
|
+
// src/definers/defineTask.ts
|
|
1055
|
+
function defineTask(taskConfig) {
|
|
1056
|
+
const filePath = getCallerFile();
|
|
1057
|
+
const id2 = taskConfig.id;
|
|
1058
|
+
return {
|
|
1059
|
+
[symbolTask]: true,
|
|
1060
|
+
[symbolFilePath]: filePath,
|
|
1061
|
+
id: id2,
|
|
1062
|
+
dependencies: taskConfig.dependencies || {},
|
|
1063
|
+
middleware: taskConfig.middleware || [],
|
|
1064
|
+
run: taskConfig.run,
|
|
1065
|
+
inputSchema: taskConfig.inputSchema,
|
|
1066
|
+
resultSchema: taskConfig.resultSchema,
|
|
1067
|
+
meta: taskConfig.meta || {},
|
|
1068
|
+
tags: taskConfig.tags || [],
|
|
1069
|
+
throws: normalizeThrows({ kind: "task", id: id2 }, taskConfig.throws),
|
|
1070
|
+
// autorun,
|
|
1071
|
+
optional() {
|
|
1072
|
+
return {
|
|
1073
|
+
inner: this,
|
|
1074
|
+
[symbolOptionalDependency]: true
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
__name(defineTask, "defineTask");
|
|
1080
|
+
defineTask.phantom = (taskConfig) => {
|
|
1081
|
+
const taskDef = defineTask({
|
|
1082
|
+
...taskConfig,
|
|
1083
|
+
run: /* @__PURE__ */ __name(async (_input) => {
|
|
1084
|
+
phantomTaskNotRoutedError.throw({ taskId: taskConfig.id });
|
|
1085
|
+
}, "run")
|
|
1086
|
+
});
|
|
1087
|
+
taskDef[symbolPhantomTask] = true;
|
|
1088
|
+
return taskDef;
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
// src/definers/defineHook.ts
|
|
1092
|
+
function defineHook(hookDef) {
|
|
1093
|
+
const filePath = getCallerFile();
|
|
1094
|
+
return {
|
|
1095
|
+
[symbolHook]: true,
|
|
1096
|
+
[symbolFilePath]: filePath,
|
|
1097
|
+
id: hookDef.id,
|
|
1098
|
+
dependencies: hookDef.dependencies || {},
|
|
1099
|
+
on: hookDef.on,
|
|
1100
|
+
order: hookDef.order,
|
|
1101
|
+
run: hookDef.run,
|
|
1102
|
+
meta: hookDef.meta || {},
|
|
1103
|
+
tags: hookDef.tags || []
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
__name(defineHook, "defineHook");
|
|
1091
1107
|
|
|
1092
1108
|
// src/definers/resourceFork.ts
|
|
1093
1109
|
function resolveReId(forkId, options) {
|
|
@@ -1317,6 +1333,7 @@ function defineResource(constConfig) {
|
|
|
1317
1333
|
};
|
|
1318
1334
|
},
|
|
1319
1335
|
fork(newId, options) {
|
|
1336
|
+
const forkCallerFilePath = getCallerFile();
|
|
1320
1337
|
const forkedParts = resolveForkedRegisterAndDependencies({
|
|
1321
1338
|
register: constConfig.register,
|
|
1322
1339
|
dependencies: constConfig.dependencies,
|
|
@@ -1328,11 +1345,10 @@ function defineResource(constConfig) {
|
|
|
1328
1345
|
id: newId,
|
|
1329
1346
|
register: forkedParts.register,
|
|
1330
1347
|
dependencies: forkedParts.dependencies,
|
|
1331
|
-
[symbolFilePath]:
|
|
1348
|
+
[symbolFilePath]: forkCallerFilePath
|
|
1332
1349
|
});
|
|
1333
|
-
forked[
|
|
1334
|
-
fromId: id2
|
|
1335
|
-
forkedAtFilePath: getCallerFile()
|
|
1350
|
+
forked[symbolForkedFrom] = {
|
|
1351
|
+
fromId: id2
|
|
1336
1352
|
};
|
|
1337
1353
|
return forked;
|
|
1338
1354
|
}
|
|
@@ -1563,7 +1579,7 @@ __name(defineTag, "defineTag");
|
|
|
1563
1579
|
|
|
1564
1580
|
// src/globals/middleware/requireContext.middleware.ts
|
|
1565
1581
|
var requireContextTaskMiddleware = defineTaskMiddleware({
|
|
1566
|
-
id: "globals.middleware.requireContext",
|
|
1582
|
+
id: "globals.middleware.task.requireContext",
|
|
1567
1583
|
async run({ task: task2, next }, _deps, config) {
|
|
1568
1584
|
if (!config.context) {
|
|
1569
1585
|
throw new Error(
|
|
@@ -2095,8 +2111,124 @@ var builtInTypes = [
|
|
|
2095
2111
|
...binaryBuiltInTypes
|
|
2096
2112
|
];
|
|
2097
2113
|
|
|
2114
|
+
// src/serializer/regexp-validator.ts
|
|
2115
|
+
var isQuantifierAt = /* @__PURE__ */ __name((pattern, index) => {
|
|
2116
|
+
if (index >= pattern.length) {
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2119
|
+
const char = pattern[index];
|
|
2120
|
+
if (char === "*" || char === "+" || char === "?") {
|
|
2121
|
+
return true;
|
|
2122
|
+
}
|
|
2123
|
+
if (char === "{") {
|
|
2124
|
+
return isBoundedQuantifier(pattern, index);
|
|
2125
|
+
}
|
|
2126
|
+
return false;
|
|
2127
|
+
}, "isQuantifierAt");
|
|
2128
|
+
var isQuantifierChar = /* @__PURE__ */ __name((char, pattern, index) => {
|
|
2129
|
+
if (char === "*" || char === "+") {
|
|
2130
|
+
return true;
|
|
2131
|
+
}
|
|
2132
|
+
if (char === "?") {
|
|
2133
|
+
if (index > 0 && pattern[index - 1] === "(") {
|
|
2134
|
+
return false;
|
|
2135
|
+
}
|
|
2136
|
+
return true;
|
|
2137
|
+
}
|
|
2138
|
+
if (char === "{") {
|
|
2139
|
+
return isBoundedQuantifier(pattern, index);
|
|
2140
|
+
}
|
|
2141
|
+
return false;
|
|
2142
|
+
}, "isQuantifierChar");
|
|
2143
|
+
var isBoundedQuantifier = /* @__PURE__ */ __name((pattern, index) => {
|
|
2144
|
+
let sawDigit = false;
|
|
2145
|
+
let sawComma = false;
|
|
2146
|
+
for (let i = index + 1; i < pattern.length; i += 1) {
|
|
2147
|
+
const char = pattern[i];
|
|
2148
|
+
if (char >= "0" && char <= "9") {
|
|
2149
|
+
sawDigit = true;
|
|
2150
|
+
continue;
|
|
2151
|
+
}
|
|
2152
|
+
if (char === "," && !sawComma) {
|
|
2153
|
+
sawComma = true;
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
if (char === "}") {
|
|
2157
|
+
return sawDigit;
|
|
2158
|
+
}
|
|
2159
|
+
return false;
|
|
2160
|
+
}
|
|
2161
|
+
return false;
|
|
2162
|
+
}, "isBoundedQuantifier");
|
|
2163
|
+
var isRegExpPatternSafe = /* @__PURE__ */ __name((pattern) => {
|
|
2164
|
+
const groupStack = [];
|
|
2165
|
+
let escaped = false;
|
|
2166
|
+
let inCharClass = false;
|
|
2167
|
+
for (let index = 0; index < pattern.length; index += 1) {
|
|
2168
|
+
const char = pattern[index];
|
|
2169
|
+
if (escaped) {
|
|
2170
|
+
escaped = false;
|
|
2171
|
+
continue;
|
|
2172
|
+
}
|
|
2173
|
+
if (char === "\\") {
|
|
2174
|
+
escaped = true;
|
|
2175
|
+
continue;
|
|
2176
|
+
}
|
|
2177
|
+
if (inCharClass) {
|
|
2178
|
+
if (char === "]") {
|
|
2179
|
+
inCharClass = false;
|
|
2180
|
+
}
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
if (char === "[") {
|
|
2184
|
+
inCharClass = true;
|
|
2185
|
+
continue;
|
|
2186
|
+
}
|
|
2187
|
+
if (char === "(") {
|
|
2188
|
+
groupStack.push({ hasQuantifier: false });
|
|
2189
|
+
if (pattern[index + 1] === "?") {
|
|
2190
|
+
index += 1;
|
|
2191
|
+
}
|
|
2192
|
+
continue;
|
|
2193
|
+
}
|
|
2194
|
+
if (char === ")") {
|
|
2195
|
+
const group = groupStack.pop();
|
|
2196
|
+
if (group?.hasQuantifier && isQuantifierAt(pattern, index + 1)) {
|
|
2197
|
+
return false;
|
|
2198
|
+
}
|
|
2199
|
+
if (group?.hasQuantifier && groupStack.length > 0) {
|
|
2200
|
+
groupStack[groupStack.length - 1].hasQuantifier = true;
|
|
2201
|
+
}
|
|
2202
|
+
continue;
|
|
2203
|
+
}
|
|
2204
|
+
if (isQuantifierChar(char, pattern, index)) {
|
|
2205
|
+
if (groupStack.length > 0) {
|
|
2206
|
+
groupStack[groupStack.length - 1].hasQuantifier = true;
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return true;
|
|
2211
|
+
}, "isRegExpPatternSafe");
|
|
2212
|
+
var assertRegExpPayload = /* @__PURE__ */ __name((value, options) => {
|
|
2213
|
+
if (!value || typeof value !== "object") {
|
|
2214
|
+
throw new Error("Invalid RegExp payload");
|
|
2215
|
+
}
|
|
2216
|
+
const record = value;
|
|
2217
|
+
if (typeof record.pattern !== "string" || typeof record.flags !== "string") {
|
|
2218
|
+
throw new Error("Invalid RegExp payload");
|
|
2219
|
+
}
|
|
2220
|
+
if (record.pattern.length > options.maxPatternLength) {
|
|
2221
|
+
throw new Error(
|
|
2222
|
+
`RegExp pattern exceeds limit (${options.maxPatternLength})`
|
|
2223
|
+
);
|
|
2224
|
+
}
|
|
2225
|
+
if (!options.allowUnsafe && !isRegExpPatternSafe(record.pattern)) {
|
|
2226
|
+
throw new Error("Unsafe RegExp pattern");
|
|
2227
|
+
}
|
|
2228
|
+
return { pattern: record.pattern, flags: record.flags };
|
|
2229
|
+
}, "assertRegExpPayload");
|
|
2230
|
+
|
|
2098
2231
|
// src/serializer/type-registry.ts
|
|
2099
|
-
init_regexp_validator();
|
|
2100
2232
|
var TypeRegistry = class {
|
|
2101
2233
|
constructor(options) {
|
|
2102
2234
|
this.typeRegistry = /* @__PURE__ */ new Map();
|
|
@@ -2855,29 +2987,25 @@ var Serializer = class {
|
|
|
2855
2987
|
* @internal - Exposed for testing RegExp safety validation
|
|
2856
2988
|
*/
|
|
2857
2989
|
this.isRegExpPatternSafe = /* @__PURE__ */ __name((pattern) => {
|
|
2858
|
-
|
|
2859
|
-
return check(pattern);
|
|
2990
|
+
return isRegExpPatternSafe(pattern);
|
|
2860
2991
|
}, "isRegExpPatternSafe");
|
|
2861
2992
|
/**
|
|
2862
2993
|
* @internal - Exposed for testing quantifier detection
|
|
2863
2994
|
*/
|
|
2864
2995
|
this.isQuantifierAt = /* @__PURE__ */ __name((pattern, index) => {
|
|
2865
|
-
|
|
2866
|
-
return check(pattern, index);
|
|
2996
|
+
return isQuantifierAt(pattern, index);
|
|
2867
2997
|
}, "isQuantifierAt");
|
|
2868
2998
|
/**
|
|
2869
2999
|
* @internal - Exposed for testing quantifier character detection
|
|
2870
3000
|
*/
|
|
2871
3001
|
this.isQuantifierChar = /* @__PURE__ */ __name((char, pattern, index) => {
|
|
2872
|
-
|
|
2873
|
-
return check(char, pattern, index);
|
|
3002
|
+
return isQuantifierChar(char, pattern, index);
|
|
2874
3003
|
}, "isQuantifierChar");
|
|
2875
3004
|
/**
|
|
2876
3005
|
* @internal - Exposed for testing bounded quantifier detection
|
|
2877
3006
|
*/
|
|
2878
3007
|
this.isBoundedQuantifier = /* @__PURE__ */ __name((pattern, index) => {
|
|
2879
|
-
|
|
2880
|
-
return check(pattern, index);
|
|
3008
|
+
return isBoundedQuantifier(pattern, index);
|
|
2881
3009
|
}, "isBoundedQuantifier");
|
|
2882
3010
|
this.indent = options.pretty ? 2 : void 0;
|
|
2883
3011
|
this.maxDepth = normalizeMaxDepth(options.maxDepth, DEFAULT_MAX_DEPTH);
|
|
@@ -3207,7 +3335,7 @@ var cacheFactoryTask = defineTask({
|
|
|
3207
3335
|
});
|
|
3208
3336
|
var journalKeys = {
|
|
3209
3337
|
/** Whether the result was served from cache (true) or freshly computed (false) */
|
|
3210
|
-
hit: journal.createKey("globals.middleware.cache.hit")
|
|
3338
|
+
hit: journal.createKey("globals.middleware.task.cache.hit")
|
|
3211
3339
|
};
|
|
3212
3340
|
var cacheResource = defineResource({
|
|
3213
3341
|
id: "globals.resources.cache",
|
|
@@ -3237,7 +3365,7 @@ var cacheResource = defineResource({
|
|
|
3237
3365
|
});
|
|
3238
3366
|
var defaultKeyBuilder = /* @__PURE__ */ __name((taskId, input) => `${taskId}-${JSON.stringify(input)}`, "defaultKeyBuilder");
|
|
3239
3367
|
var cacheMiddleware = defineTaskMiddleware({
|
|
3240
|
-
id: "globals.middleware.cache",
|
|
3368
|
+
id: "globals.middleware.task.cache",
|
|
3241
3369
|
dependencies: { cache: cacheResource },
|
|
3242
3370
|
async run({ task: task2, next, journal: journal2 }, deps, config) {
|
|
3243
3371
|
const { cache } = deps;
|
|
@@ -3288,11 +3416,11 @@ var CircuitBreakerOpenError = class extends Error {
|
|
|
3288
3416
|
var journalKeys2 = {
|
|
3289
3417
|
/** Current state of the circuit breaker (CLOSED, OPEN, or HALF_OPEN) */
|
|
3290
3418
|
state: journal.createKey(
|
|
3291
|
-
"globals.middleware.circuitBreaker.state"
|
|
3419
|
+
"globals.middleware.task.circuitBreaker.state"
|
|
3292
3420
|
),
|
|
3293
3421
|
/** Current failure count */
|
|
3294
3422
|
failures: journal.createKey(
|
|
3295
|
-
"globals.middleware.circuitBreaker.failures"
|
|
3423
|
+
"globals.middleware.task.circuitBreaker.failures"
|
|
3296
3424
|
)
|
|
3297
3425
|
};
|
|
3298
3426
|
var circuitBreakerResource = defineResource({
|
|
@@ -3305,7 +3433,7 @@ var circuitBreakerResource = defineResource({
|
|
|
3305
3433
|
}, "init")
|
|
3306
3434
|
});
|
|
3307
3435
|
var circuitBreakerMiddleware = defineTaskMiddleware({
|
|
3308
|
-
id: "globals.middleware.circuitBreaker",
|
|
3436
|
+
id: "globals.middleware.task.circuitBreaker",
|
|
3309
3437
|
dependencies: { state: circuitBreakerResource },
|
|
3310
3438
|
async run({ task: task2, next, journal: journal2 }, { state }, config) {
|
|
3311
3439
|
const taskId = task2.definition.id;
|
|
@@ -3885,12 +4013,12 @@ var EventManager = class {
|
|
|
3885
4013
|
|
|
3886
4014
|
// src/models/Semaphore.ts
|
|
3887
4015
|
var SemaphoreEvents = {
|
|
3888
|
-
queued: defineEvent({ id: "semaphore.queued" }),
|
|
3889
|
-
acquired: defineEvent({ id: "semaphore.acquired" }),
|
|
3890
|
-
released: defineEvent({ id: "semaphore.released" }),
|
|
3891
|
-
timeout: defineEvent({ id: "semaphore.timeout" }),
|
|
3892
|
-
aborted: defineEvent({ id: "semaphore.aborted" }),
|
|
3893
|
-
disposed: defineEvent({ id: "semaphore.disposed" })
|
|
4016
|
+
queued: defineEvent({ id: "semaphore.events.queued" }),
|
|
4017
|
+
acquired: defineEvent({ id: "semaphore.events.acquired" }),
|
|
4018
|
+
released: defineEvent({ id: "semaphore.events.released" }),
|
|
4019
|
+
timeout: defineEvent({ id: "semaphore.events.timeout" }),
|
|
4020
|
+
aborted: defineEvent({ id: "semaphore.events.aborted" }),
|
|
4021
|
+
disposed: defineEvent({ id: "semaphore.events.disposed" })
|
|
3894
4022
|
};
|
|
3895
4023
|
var Semaphore = class {
|
|
3896
4024
|
constructor(maxPermits) {
|
|
@@ -4163,7 +4291,7 @@ var concurrencyResource = defineResource({
|
|
|
4163
4291
|
}), "init")
|
|
4164
4292
|
});
|
|
4165
4293
|
var concurrencyTaskMiddleware = defineTaskMiddleware({
|
|
4166
|
-
id: "globals.middleware.concurrency",
|
|
4294
|
+
id: "globals.middleware.task.concurrency",
|
|
4167
4295
|
dependencies: { state: concurrencyResource },
|
|
4168
4296
|
async run({ task: task2, next }, { state }, config) {
|
|
4169
4297
|
let semaphore = config.semaphore;
|
|
@@ -4242,14 +4370,16 @@ var RateLimitError = class extends Error {
|
|
|
4242
4370
|
var journalKeys3 = {
|
|
4243
4371
|
/** Number of remaining requests in the current window */
|
|
4244
4372
|
remaining: journal.createKey(
|
|
4245
|
-
"globals.middleware.rateLimit.remaining"
|
|
4373
|
+
"globals.middleware.task.rateLimit.remaining"
|
|
4246
4374
|
),
|
|
4247
4375
|
/** Timestamp when the current window resets */
|
|
4248
4376
|
resetTime: journal.createKey(
|
|
4249
|
-
"globals.middleware.rateLimit.resetTime"
|
|
4377
|
+
"globals.middleware.task.rateLimit.resetTime"
|
|
4250
4378
|
),
|
|
4251
4379
|
/** Maximum requests allowed per window */
|
|
4252
|
-
limit: journal.createKey(
|
|
4380
|
+
limit: journal.createKey(
|
|
4381
|
+
"globals.middleware.task.rateLimit.limit"
|
|
4382
|
+
)
|
|
4253
4383
|
};
|
|
4254
4384
|
var rateLimitResource = defineResource({
|
|
4255
4385
|
id: "globals.resources.rateLimit",
|
|
@@ -4261,7 +4391,7 @@ var rateLimitResource = defineResource({
|
|
|
4261
4391
|
}, "init")
|
|
4262
4392
|
});
|
|
4263
4393
|
var rateLimitTaskMiddleware = defineTaskMiddleware({
|
|
4264
|
-
id: "globals.middleware.rateLimit",
|
|
4394
|
+
id: "globals.middleware.task.rateLimit",
|
|
4265
4395
|
configSchema: rateLimitConfigSchema,
|
|
4266
4396
|
dependencies: { state: rateLimitResource },
|
|
4267
4397
|
async run({ task: task2, next, journal: journal2 }, { state }, config) {
|
|
@@ -4309,7 +4439,7 @@ var temporalResource = defineResource({
|
|
|
4309
4439
|
}, "init")
|
|
4310
4440
|
});
|
|
4311
4441
|
var debounceTaskMiddleware = defineTaskMiddleware({
|
|
4312
|
-
id: "globals.middleware.debounce",
|
|
4442
|
+
id: "globals.middleware.task.debounce",
|
|
4313
4443
|
dependencies: { state: temporalResource },
|
|
4314
4444
|
async run({ task: task2, next }, { state }, config) {
|
|
4315
4445
|
const { debounceStates } = state;
|
|
@@ -4346,7 +4476,7 @@ var debounceTaskMiddleware = defineTaskMiddleware({
|
|
|
4346
4476
|
}
|
|
4347
4477
|
});
|
|
4348
4478
|
var throttleTaskMiddleware = defineTaskMiddleware({
|
|
4349
|
-
id: "globals.middleware.throttle",
|
|
4479
|
+
id: "globals.middleware.task.throttle",
|
|
4350
4480
|
dependencies: { state: temporalResource },
|
|
4351
4481
|
async run({ task: task2, next }, { state }, config) {
|
|
4352
4482
|
const { throttleStates } = state;
|
|
@@ -4418,12 +4548,12 @@ var throttleTaskMiddleware = defineTaskMiddleware({
|
|
|
4418
4548
|
|
|
4419
4549
|
// src/models/Queue.ts
|
|
4420
4550
|
var QueueEvents = {
|
|
4421
|
-
enqueue: defineEvent({ id: "queue.enqueue" }),
|
|
4422
|
-
start: defineEvent({ id: "queue.start" }),
|
|
4423
|
-
finish: defineEvent({ id: "queue.finish" }),
|
|
4424
|
-
error: defineEvent({ id: "queue.error" }),
|
|
4425
|
-
cancel: defineEvent({ id: "queue.cancel" }),
|
|
4426
|
-
disposed: defineEvent({ id: "queue.disposed" })
|
|
4551
|
+
enqueue: defineEvent({ id: "queue.events.enqueue" }),
|
|
4552
|
+
start: defineEvent({ id: "queue.events.start" }),
|
|
4553
|
+
finish: defineEvent({ id: "queue.events.finish" }),
|
|
4554
|
+
error: defineEvent({ id: "queue.events.error" }),
|
|
4555
|
+
cancel: defineEvent({ id: "queue.events.cancel" }),
|
|
4556
|
+
disposed: defineEvent({ id: "queue.events.disposed" })
|
|
4427
4557
|
};
|
|
4428
4558
|
var Queue = class {
|
|
4429
4559
|
constructor() {
|
|
@@ -4582,6 +4712,7 @@ var TunnelError = class extends Error {
|
|
|
4582
4712
|
this.name = "TunnelError";
|
|
4583
4713
|
this.code = code;
|
|
4584
4714
|
this.details = details;
|
|
4715
|
+
this.httpCode = extras?.httpCode;
|
|
4585
4716
|
this.id = extras?.id;
|
|
4586
4717
|
this.data = extras?.data;
|
|
4587
4718
|
}
|
|
@@ -4596,6 +4727,7 @@ function toTunnelError(input, fallbackMessage) {
|
|
|
4596
4727
|
const pe = input;
|
|
4597
4728
|
const msg = pe.message || fallbackMessage || "Tunnel error";
|
|
4598
4729
|
return new TunnelError(pe.code, msg, pe.details, {
|
|
4730
|
+
httpCode: pe.httpCode,
|
|
4599
4731
|
id: pe.id,
|
|
4600
4732
|
data: pe.data
|
|
4601
4733
|
});
|
|
@@ -4787,7 +4919,7 @@ function createExposureFetch(cfg) {
|
|
|
4787
4919
|
}
|
|
4788
4920
|
__name(createExposureFetch, "createExposureFetch");
|
|
4789
4921
|
|
|
4790
|
-
// src/
|
|
4922
|
+
// src/tools/buildUniversalManifest.ts
|
|
4791
4923
|
function buildUniversalManifest(input) {
|
|
4792
4924
|
const nodeFiles = [];
|
|
4793
4925
|
const webFiles = [];
|
|
@@ -4844,6 +4976,15 @@ function toHeaders(auth) {
|
|
|
4844
4976
|
return headers;
|
|
4845
4977
|
}
|
|
4846
4978
|
__name(toHeaders, "toHeaders");
|
|
4979
|
+
function rethrowWithRegistry(e, errorRegistry) {
|
|
4980
|
+
const te = e;
|
|
4981
|
+
if (errorRegistry && te.id && te.data) {
|
|
4982
|
+
const helper = errorRegistry.get(String(te.id));
|
|
4983
|
+
if (helper) helper.throw(te.data);
|
|
4984
|
+
}
|
|
4985
|
+
throw e;
|
|
4986
|
+
}
|
|
4987
|
+
__name(rethrowWithRegistry, "rethrowWithRegistry");
|
|
4847
4988
|
function createHttpClient(cfg) {
|
|
4848
4989
|
const baseUrl = cfg.baseUrl.replace(/\/$/, "");
|
|
4849
4990
|
if (!baseUrl) throw new Error("createHttpClient requires baseUrl");
|
|
@@ -4910,12 +5051,7 @@ function createHttpClient(cfg) {
|
|
|
4910
5051
|
fallbackMessage: "Tunnel task error"
|
|
4911
5052
|
});
|
|
4912
5053
|
} catch (e) {
|
|
4913
|
-
|
|
4914
|
-
if (cfg.errorRegistry && te.id && te.data) {
|
|
4915
|
-
const helper = cfg.errorRegistry.get(String(te.id));
|
|
4916
|
-
if (helper) helper.throw(te.data);
|
|
4917
|
-
}
|
|
4918
|
-
throw e;
|
|
5054
|
+
rethrowWithRegistry(e, cfg.errorRegistry);
|
|
4919
5055
|
}
|
|
4920
5056
|
}
|
|
4921
5057
|
if (manifest.nodeFiles.length > 0) {
|
|
@@ -4926,24 +5062,14 @@ function createHttpClient(cfg) {
|
|
|
4926
5062
|
try {
|
|
4927
5063
|
return await fetchClient.task(id2, input);
|
|
4928
5064
|
} catch (e) {
|
|
4929
|
-
|
|
4930
|
-
if (cfg.errorRegistry && te.id && te.data) {
|
|
4931
|
-
const helper = cfg.errorRegistry.get(String(te.id));
|
|
4932
|
-
if (helper) helper.throw(te.data);
|
|
4933
|
-
}
|
|
4934
|
-
throw e;
|
|
5065
|
+
rethrowWithRegistry(e, cfg.errorRegistry);
|
|
4935
5066
|
}
|
|
4936
5067
|
},
|
|
4937
5068
|
async event(id2, payload) {
|
|
4938
5069
|
try {
|
|
4939
5070
|
return await fetchClient.event(id2, payload);
|
|
4940
5071
|
} catch (e) {
|
|
4941
|
-
|
|
4942
|
-
if (cfg.errorRegistry && te.id && te.data) {
|
|
4943
|
-
const helper = cfg.errorRegistry.get(String(te.id));
|
|
4944
|
-
if (helper) helper.throw(te.data);
|
|
4945
|
-
}
|
|
4946
|
-
throw e;
|
|
5072
|
+
rethrowWithRegistry(e, cfg.errorRegistry);
|
|
4947
5073
|
}
|
|
4948
5074
|
},
|
|
4949
5075
|
async eventWithResult(id2, payload) {
|
|
@@ -4955,12 +5081,7 @@ function createHttpClient(cfg) {
|
|
|
4955
5081
|
}
|
|
4956
5082
|
return await fetchClient.eventWithResult(id2, payload);
|
|
4957
5083
|
} catch (e) {
|
|
4958
|
-
|
|
4959
|
-
if (cfg.errorRegistry && te.id && te.data) {
|
|
4960
|
-
const helper = cfg.errorRegistry.get(String(te.id));
|
|
4961
|
-
if (helper) helper.throw(te.data);
|
|
4962
|
-
}
|
|
4963
|
-
throw e;
|
|
5084
|
+
rethrowWithRegistry(e, cfg.errorRegistry);
|
|
4964
5085
|
}
|
|
4965
5086
|
}
|
|
4966
5087
|
};
|
|
@@ -5243,13 +5364,15 @@ var retryResourceMiddleware = defineResourceMiddleware({
|
|
|
5243
5364
|
var journalKeys6 = {
|
|
5244
5365
|
/** Whether the fallback path was taken (true) or primary succeeded (false) */
|
|
5245
5366
|
active: journal.createKey(
|
|
5246
|
-
"globals.middleware.fallback.active"
|
|
5367
|
+
"globals.middleware.task.fallback.active"
|
|
5247
5368
|
),
|
|
5248
5369
|
/** The error that triggered the fallback (only set when active is true) */
|
|
5249
|
-
error: journal.createKey(
|
|
5370
|
+
error: journal.createKey(
|
|
5371
|
+
"globals.middleware.task.fallback.error"
|
|
5372
|
+
)
|
|
5250
5373
|
};
|
|
5251
5374
|
var fallbackTaskMiddleware = defineTaskMiddleware({
|
|
5252
|
-
id: "globals.middleware.fallback",
|
|
5375
|
+
id: "globals.middleware.task.fallback",
|
|
5253
5376
|
dependencies: {
|
|
5254
5377
|
taskRunner: globalResources.taskRunner
|
|
5255
5378
|
},
|
|
@@ -5892,6 +6015,34 @@ var Logger = class _Logger {
|
|
|
5892
6015
|
}
|
|
5893
6016
|
};
|
|
5894
6017
|
|
|
6018
|
+
// src/models/utils/dependencyStrategies.ts
|
|
6019
|
+
var dependencyStrategies = [
|
|
6020
|
+
{
|
|
6021
|
+
matches: isResource,
|
|
6022
|
+
getStoreMap: /* @__PURE__ */ __name((store2) => store2.resources, "getStoreMap")
|
|
6023
|
+
},
|
|
6024
|
+
{
|
|
6025
|
+
matches: isTask,
|
|
6026
|
+
getStoreMap: /* @__PURE__ */ __name((store2) => store2.tasks, "getStoreMap")
|
|
6027
|
+
},
|
|
6028
|
+
{
|
|
6029
|
+
matches: isEvent,
|
|
6030
|
+
getStoreMap: /* @__PURE__ */ __name((store2) => store2.events, "getStoreMap")
|
|
6031
|
+
},
|
|
6032
|
+
{
|
|
6033
|
+
matches: isError,
|
|
6034
|
+
getStoreMap: /* @__PURE__ */ __name((store2) => store2.errors, "getStoreMap")
|
|
6035
|
+
},
|
|
6036
|
+
{
|
|
6037
|
+
matches: isAsyncContext,
|
|
6038
|
+
getStoreMap: /* @__PURE__ */ __name((store2) => store2.asyncContexts, "getStoreMap")
|
|
6039
|
+
}
|
|
6040
|
+
];
|
|
6041
|
+
function findDependencyStrategy(item) {
|
|
6042
|
+
return dependencyStrategies.find((s) => s.matches(item));
|
|
6043
|
+
}
|
|
6044
|
+
__name(findDependencyStrategy, "findDependencyStrategy");
|
|
6045
|
+
|
|
5895
6046
|
// src/models/DependencyProcessor.ts
|
|
5896
6047
|
var DependencyProcessor = class {
|
|
5897
6048
|
constructor(store2, eventManager, taskRunner, logger) {
|
|
@@ -5999,7 +6150,16 @@ var DependencyProcessor = class {
|
|
|
5999
6150
|
}
|
|
6000
6151
|
throw error2;
|
|
6001
6152
|
}
|
|
6002
|
-
|
|
6153
|
+
const wrapper = new Error(`${prefix}: ${String(error2)}`);
|
|
6154
|
+
Object.defineProperty(wrapper, "resourceId", {
|
|
6155
|
+
value: resourceId,
|
|
6156
|
+
configurable: true
|
|
6157
|
+
});
|
|
6158
|
+
Object.defineProperty(wrapper, "cause", {
|
|
6159
|
+
value: error2,
|
|
6160
|
+
configurable: true
|
|
6161
|
+
});
|
|
6162
|
+
throw wrapper;
|
|
6003
6163
|
}
|
|
6004
6164
|
/**
|
|
6005
6165
|
* Computes and caches dependencies for a resource (if not already computed).
|
|
@@ -6142,46 +6302,35 @@ var DependencyProcessor = class {
|
|
|
6142
6302
|
return object;
|
|
6143
6303
|
}
|
|
6144
6304
|
async extractDependency(object, source) {
|
|
6145
|
-
this.logger.trace(
|
|
6305
|
+
this.logger.trace(
|
|
6306
|
+
`Extracting dependency -> ${source} -> ${object?.id}`
|
|
6307
|
+
);
|
|
6308
|
+
let isOpt = false;
|
|
6309
|
+
let item = object;
|
|
6146
6310
|
if (isOptional(object)) {
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
const exists = this.store.errors.get(inner.id) !== void 0;
|
|
6159
|
-
return exists ? inner : void 0;
|
|
6160
|
-
} else if (isAsyncContext(inner)) {
|
|
6161
|
-
const exists = this.store.asyncContexts.get(inner.id) !== void 0;
|
|
6162
|
-
return exists ? inner : void 0;
|
|
6163
|
-
}
|
|
6164
|
-
unknownItemTypeError.throw({ item: inner });
|
|
6165
|
-
}
|
|
6166
|
-
if (isResource(object)) {
|
|
6167
|
-
return this.extractResourceDependency(object);
|
|
6168
|
-
} else if (isTask(object)) {
|
|
6169
|
-
return this.extractTaskDependency(object);
|
|
6170
|
-
} else if (isEvent(object)) {
|
|
6171
|
-
return this.extractEventDependency(object, source);
|
|
6172
|
-
} else if (isError(object)) {
|
|
6173
|
-
if (this.store.errors.get(object.id) === void 0) {
|
|
6174
|
-
dependencyNotFoundError.throw({ key: `Error ${object.id}` });
|
|
6175
|
-
}
|
|
6176
|
-
return object;
|
|
6177
|
-
} else if (isAsyncContext(object)) {
|
|
6178
|
-
if (this.store.asyncContexts.get(object.id) === void 0) {
|
|
6179
|
-
dependencyNotFoundError.throw({ key: `AsyncContext ${object.id}` });
|
|
6180
|
-
}
|
|
6181
|
-
return object;
|
|
6182
|
-
} else {
|
|
6183
|
-
unknownItemTypeError.throw({ item: object });
|
|
6311
|
+
isOpt = true;
|
|
6312
|
+
item = object.inner;
|
|
6313
|
+
}
|
|
6314
|
+
const itemWithId = item;
|
|
6315
|
+
const strategy = findDependencyStrategy(item);
|
|
6316
|
+
if (!strategy) {
|
|
6317
|
+
return unknownItemTypeError.throw({ item });
|
|
6318
|
+
}
|
|
6319
|
+
if (isOpt) {
|
|
6320
|
+
const exists = strategy.getStoreMap(this.store).has(itemWithId.id);
|
|
6321
|
+
if (!exists) return void 0;
|
|
6184
6322
|
}
|
|
6323
|
+
if (isResource(item)) return this.extractResourceDependency(item);
|
|
6324
|
+
if (isTask(item)) return this.extractTaskDependency(item);
|
|
6325
|
+
if (isEvent(item)) return this.extractEventDependency(item, source);
|
|
6326
|
+
if (!isOpt) {
|
|
6327
|
+
const exists = strategy.getStoreMap(this.store).has(itemWithId.id);
|
|
6328
|
+
if (!exists) {
|
|
6329
|
+
const label = isError(item) ? "Error" : "AsyncContext";
|
|
6330
|
+
dependencyNotFoundError.throw({ key: `${label} ${itemWithId.id}` });
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
return item;
|
|
6185
6334
|
}
|
|
6186
6335
|
/**
|
|
6187
6336
|
* Converts the event into a running functions with real inputs
|
|
@@ -6378,19 +6527,246 @@ var StoreValidator = class {
|
|
|
6378
6527
|
}
|
|
6379
6528
|
};
|
|
6380
6529
|
|
|
6530
|
+
// src/models/utils/buildDependencyGraph.ts
|
|
6531
|
+
function setupBlankNodes(registry, nodeMap, dependents) {
|
|
6532
|
+
for (const task2 of registry.tasks.values()) {
|
|
6533
|
+
const node = {
|
|
6534
|
+
id: task2.task.id,
|
|
6535
|
+
dependencies: {}
|
|
6536
|
+
};
|
|
6537
|
+
nodeMap.set(task2.task.id, node);
|
|
6538
|
+
dependents.push(node);
|
|
6539
|
+
}
|
|
6540
|
+
for (const middleware of registry.taskMiddlewares.values()) {
|
|
6541
|
+
const node = {
|
|
6542
|
+
id: middleware.middleware.id,
|
|
6543
|
+
dependencies: {}
|
|
6544
|
+
};
|
|
6545
|
+
nodeMap.set(middleware.middleware.id, node);
|
|
6546
|
+
dependents.push(node);
|
|
6547
|
+
}
|
|
6548
|
+
for (const middleware of registry.resourceMiddlewares.values()) {
|
|
6549
|
+
const node = {
|
|
6550
|
+
id: middleware.middleware.id,
|
|
6551
|
+
dependencies: {}
|
|
6552
|
+
};
|
|
6553
|
+
nodeMap.set(middleware.middleware.id, node);
|
|
6554
|
+
dependents.push(node);
|
|
6555
|
+
}
|
|
6556
|
+
for (const resource2 of registry.resources.values()) {
|
|
6557
|
+
const node = {
|
|
6558
|
+
id: resource2.resource.id,
|
|
6559
|
+
dependencies: {}
|
|
6560
|
+
};
|
|
6561
|
+
nodeMap.set(resource2.resource.id, node);
|
|
6562
|
+
dependents.push(node);
|
|
6563
|
+
}
|
|
6564
|
+
for (const hook2 of registry.hooks.values()) {
|
|
6565
|
+
const node = {
|
|
6566
|
+
id: hook2.hook.id,
|
|
6567
|
+
dependencies: {}
|
|
6568
|
+
};
|
|
6569
|
+
nodeMap.set(hook2.hook.id, node);
|
|
6570
|
+
dependents.push(node);
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
__name(setupBlankNodes, "setupBlankNodes");
|
|
6574
|
+
function buildDependencyGraph(registry) {
|
|
6575
|
+
const depenedants = [];
|
|
6576
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
6577
|
+
setupBlankNodes(registry, nodeMap, depenedants);
|
|
6578
|
+
for (const task2 of registry.tasks.values()) {
|
|
6579
|
+
const node = nodeMap.get(task2.task.id);
|
|
6580
|
+
if (task2.task.dependencies) {
|
|
6581
|
+
for (const [depKey, depItem] of Object.entries(task2.task.dependencies)) {
|
|
6582
|
+
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6583
|
+
const depNode = nodeMap.get(candidate.id);
|
|
6584
|
+
if (depNode) {
|
|
6585
|
+
node.dependencies[depKey] = depNode;
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
}
|
|
6589
|
+
const t = task2.task;
|
|
6590
|
+
for (const middleware of t.middleware) {
|
|
6591
|
+
const middlewareNode = nodeMap.get(middleware.id);
|
|
6592
|
+
if (middlewareNode) {
|
|
6593
|
+
node.dependencies[middleware.id] = middlewareNode;
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
}
|
|
6597
|
+
for (const storeTaskMiddleware of registry.taskMiddlewares.values()) {
|
|
6598
|
+
const node = nodeMap.get(storeTaskMiddleware.middleware.id);
|
|
6599
|
+
const { middleware } = storeTaskMiddleware;
|
|
6600
|
+
if (middleware.dependencies) {
|
|
6601
|
+
for (const [depKey, depItem] of Object.entries(middleware.dependencies)) {
|
|
6602
|
+
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6603
|
+
const depNode = nodeMap.get(candidate.id);
|
|
6604
|
+
if (depNode) {
|
|
6605
|
+
node.dependencies[depKey] = depNode;
|
|
6606
|
+
}
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
if (middleware.everywhere) {
|
|
6610
|
+
const filter = typeof middleware.everywhere === "function" ? middleware.everywhere : () => true;
|
|
6611
|
+
for (const task2 of registry.tasks.values()) {
|
|
6612
|
+
if (filter(task2.task)) {
|
|
6613
|
+
const taskNode = nodeMap.get(task2.task.id);
|
|
6614
|
+
taskNode.dependencies[`__middleware.${middleware.id}`] = node;
|
|
6615
|
+
}
|
|
6616
|
+
}
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
for (const storeResourceMiddleware of registry.resourceMiddlewares.values()) {
|
|
6620
|
+
const node = nodeMap.get(storeResourceMiddleware.middleware.id);
|
|
6621
|
+
const { middleware } = storeResourceMiddleware;
|
|
6622
|
+
if (middleware.dependencies) {
|
|
6623
|
+
for (const [depKey, depItem] of Object.entries(middleware.dependencies)) {
|
|
6624
|
+
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6625
|
+
const depNode = nodeMap.get(candidate.id);
|
|
6626
|
+
if (depNode) {
|
|
6627
|
+
node.dependencies[depKey] = depNode;
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
}
|
|
6631
|
+
if (middleware.everywhere) {
|
|
6632
|
+
const filter = typeof middleware.everywhere === "function" ? middleware.everywhere : () => true;
|
|
6633
|
+
for (const resource2 of registry.resources.values()) {
|
|
6634
|
+
if (filter(resource2.resource)) {
|
|
6635
|
+
const resourceNode = nodeMap.get(resource2.resource.id);
|
|
6636
|
+
resourceNode.dependencies[`__middleware.${middleware.id}`] = node;
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
}
|
|
6640
|
+
}
|
|
6641
|
+
for (const resource2 of registry.resources.values()) {
|
|
6642
|
+
const node = nodeMap.get(resource2.resource.id);
|
|
6643
|
+
if (resource2.resource.dependencies) {
|
|
6644
|
+
for (const [depKey, depItem] of Object.entries(
|
|
6645
|
+
resource2.resource.dependencies
|
|
6646
|
+
)) {
|
|
6647
|
+
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6648
|
+
const depNode = nodeMap.get(candidate.id);
|
|
6649
|
+
if (depNode) {
|
|
6650
|
+
node.dependencies[depKey] = depNode;
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
}
|
|
6654
|
+
for (const middleware of resource2.resource.middleware) {
|
|
6655
|
+
const middlewareNode = nodeMap.get(middleware.id);
|
|
6656
|
+
if (middlewareNode) {
|
|
6657
|
+
node.dependencies[middleware.id] = middlewareNode;
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
for (const hook2 of registry.hooks.values()) {
|
|
6662
|
+
const node = nodeMap.get(hook2.hook.id);
|
|
6663
|
+
if (hook2.hook.dependencies) {
|
|
6664
|
+
for (const [depKey, depItem] of Object.entries(hook2.hook.dependencies)) {
|
|
6665
|
+
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6666
|
+
const depNode = nodeMap.get(candidate.id);
|
|
6667
|
+
if (depNode) {
|
|
6668
|
+
node.dependencies[depKey] = depNode;
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
}
|
|
6672
|
+
}
|
|
6673
|
+
return depenedants;
|
|
6674
|
+
}
|
|
6675
|
+
__name(buildDependencyGraph, "buildDependencyGraph");
|
|
6676
|
+
function buildEventEmissionGraph(registry) {
|
|
6677
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
6678
|
+
for (const e of registry.events.values()) {
|
|
6679
|
+
nodes.set(e.event.id, { id: e.event.id, dependencies: {} });
|
|
6680
|
+
}
|
|
6681
|
+
for (const h of registry.hooks.values()) {
|
|
6682
|
+
const listened = [];
|
|
6683
|
+
const on = h.hook.on;
|
|
6684
|
+
if (on === "*") continue;
|
|
6685
|
+
if (Array.isArray(on))
|
|
6686
|
+
listened.push(...on.map((e) => e.id));
|
|
6687
|
+
else listened.push(on.id);
|
|
6688
|
+
const depEvents = [];
|
|
6689
|
+
const deps = h.hook.dependencies;
|
|
6690
|
+
if (deps) {
|
|
6691
|
+
for (const value of Object.values(deps)) {
|
|
6692
|
+
const candidate = isOptional(value) ? value.inner : value;
|
|
6693
|
+
if (candidate && isEvent(candidate)) {
|
|
6694
|
+
depEvents.push(candidate.id);
|
|
6695
|
+
}
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
for (const srcId of listened) {
|
|
6699
|
+
const srcNode = nodes.get(srcId);
|
|
6700
|
+
if (!srcNode) continue;
|
|
6701
|
+
for (const dstId of depEvents) {
|
|
6702
|
+
if (srcId === dstId) continue;
|
|
6703
|
+
const dstNode = nodes.get(dstId);
|
|
6704
|
+
if (dstNode) {
|
|
6705
|
+
srcNode.dependencies[dstId] = dstNode;
|
|
6706
|
+
}
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
return Array.from(nodes.values());
|
|
6711
|
+
}
|
|
6712
|
+
__name(buildEventEmissionGraph, "buildEventEmissionGraph");
|
|
6713
|
+
|
|
6714
|
+
// src/tools/LockableMap.ts
|
|
6715
|
+
var LockableMap = class extends Map {
|
|
6716
|
+
static {
|
|
6717
|
+
__name(this, "LockableMap");
|
|
6718
|
+
}
|
|
6719
|
+
#locked = false;
|
|
6720
|
+
#name;
|
|
6721
|
+
constructor(name) {
|
|
6722
|
+
super();
|
|
6723
|
+
this.#name = name ?? "LockableMap";
|
|
6724
|
+
}
|
|
6725
|
+
/** Whether the map is currently locked. */
|
|
6726
|
+
get locked() {
|
|
6727
|
+
return this.#locked;
|
|
6728
|
+
}
|
|
6729
|
+
/** Permanently lock the map — no further mutations allowed. */
|
|
6730
|
+
lock() {
|
|
6731
|
+
this.#locked = true;
|
|
6732
|
+
}
|
|
6733
|
+
/** @throws if the map is locked */
|
|
6734
|
+
throwIfLocked() {
|
|
6735
|
+
if (this.#locked) {
|
|
6736
|
+
throw new Error(`Cannot modify "${this.#name}" \u2014 the map is locked.`);
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
set(key, value) {
|
|
6740
|
+
this.throwIfLocked();
|
|
6741
|
+
return super.set(key, value);
|
|
6742
|
+
}
|
|
6743
|
+
delete(key) {
|
|
6744
|
+
this.throwIfLocked();
|
|
6745
|
+
return super.delete(key);
|
|
6746
|
+
}
|
|
6747
|
+
clear() {
|
|
6748
|
+
this.throwIfLocked();
|
|
6749
|
+
super.clear();
|
|
6750
|
+
}
|
|
6751
|
+
};
|
|
6752
|
+
|
|
6381
6753
|
// src/models/StoreRegistry.ts
|
|
6382
6754
|
var StoreRegistry = class {
|
|
6383
6755
|
constructor(store2) {
|
|
6384
6756
|
this.store = store2;
|
|
6385
|
-
this.tasks =
|
|
6386
|
-
this.resources =
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
this.
|
|
6390
|
-
this.
|
|
6391
|
-
this.
|
|
6392
|
-
this.
|
|
6393
|
-
this.
|
|
6757
|
+
this.tasks = new LockableMap("tasks");
|
|
6758
|
+
this.resources = new LockableMap(
|
|
6759
|
+
"resources"
|
|
6760
|
+
);
|
|
6761
|
+
this.events = new LockableMap("events");
|
|
6762
|
+
this.taskMiddlewares = new LockableMap("taskMiddlewares");
|
|
6763
|
+
this.resourceMiddlewares = new LockableMap("resourceMiddlewares");
|
|
6764
|
+
this.hooks = new LockableMap("hooks");
|
|
6765
|
+
this.tags = new LockableMap("tags");
|
|
6766
|
+
this.asyncContexts = new LockableMap(
|
|
6767
|
+
"asyncContexts"
|
|
6768
|
+
);
|
|
6769
|
+
this.errors = new LockableMap("errors");
|
|
6394
6770
|
this.validator = new StoreValidator(this);
|
|
6395
6771
|
}
|
|
6396
6772
|
static {
|
|
@@ -6399,6 +6775,18 @@ var StoreRegistry = class {
|
|
|
6399
6775
|
getValidator() {
|
|
6400
6776
|
return this.validator;
|
|
6401
6777
|
}
|
|
6778
|
+
/** Lock every map in the registry, preventing further mutations. */
|
|
6779
|
+
lockAll() {
|
|
6780
|
+
this.tasks.lock();
|
|
6781
|
+
this.resources.lock();
|
|
6782
|
+
this.events.lock();
|
|
6783
|
+
this.taskMiddlewares.lock();
|
|
6784
|
+
this.resourceMiddlewares.lock();
|
|
6785
|
+
this.hooks.lock();
|
|
6786
|
+
this.tags.lock();
|
|
6787
|
+
this.asyncContexts.lock();
|
|
6788
|
+
this.errors.lock();
|
|
6789
|
+
}
|
|
6402
6790
|
storeGenericItem(item) {
|
|
6403
6791
|
if (isTask(item)) {
|
|
6404
6792
|
this.storeTask(item);
|
|
@@ -6535,195 +6923,14 @@ var StoreRegistry = class {
|
|
|
6535
6923
|
}
|
|
6536
6924
|
// Feels like a dependencyProcessor task?
|
|
6537
6925
|
getDependentNodes() {
|
|
6538
|
-
|
|
6539
|
-
const nodeMap = /* @__PURE__ */ new Map();
|
|
6540
|
-
this.setupBlankNodes(nodeMap, depenedants);
|
|
6541
|
-
for (const task2 of this.tasks.values()) {
|
|
6542
|
-
const node = nodeMap.get(task2.task.id);
|
|
6543
|
-
if (task2.task.dependencies) {
|
|
6544
|
-
for (const [depKey, depItem] of Object.entries(
|
|
6545
|
-
task2.task.dependencies
|
|
6546
|
-
)) {
|
|
6547
|
-
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6548
|
-
const depNode = nodeMap.get(candidate.id);
|
|
6549
|
-
if (depNode) {
|
|
6550
|
-
node.dependencies[depKey] = depNode;
|
|
6551
|
-
}
|
|
6552
|
-
}
|
|
6553
|
-
}
|
|
6554
|
-
const t = task2.task;
|
|
6555
|
-
for (const middleware of t.middleware) {
|
|
6556
|
-
const middlewareNode = nodeMap.get(middleware.id);
|
|
6557
|
-
if (middlewareNode) {
|
|
6558
|
-
node.dependencies[middleware.id] = middlewareNode;
|
|
6559
|
-
}
|
|
6560
|
-
}
|
|
6561
|
-
}
|
|
6562
|
-
for (const storeTaskMiddleware of this.taskMiddlewares.values()) {
|
|
6563
|
-
const node = nodeMap.get(storeTaskMiddleware.middleware.id);
|
|
6564
|
-
const { middleware } = storeTaskMiddleware;
|
|
6565
|
-
if (middleware.dependencies) {
|
|
6566
|
-
for (const [depKey, depItem] of Object.entries(
|
|
6567
|
-
middleware.dependencies
|
|
6568
|
-
)) {
|
|
6569
|
-
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6570
|
-
const depNode = nodeMap.get(candidate.id);
|
|
6571
|
-
if (depNode) {
|
|
6572
|
-
node.dependencies[depKey] = depNode;
|
|
6573
|
-
}
|
|
6574
|
-
}
|
|
6575
|
-
}
|
|
6576
|
-
if (middleware.everywhere) {
|
|
6577
|
-
const filter = typeof middleware.everywhere === "function" ? middleware.everywhere : () => true;
|
|
6578
|
-
for (const task2 of this.tasks.values()) {
|
|
6579
|
-
if (filter(task2.task)) {
|
|
6580
|
-
const taskNode = nodeMap.get(task2.task.id);
|
|
6581
|
-
taskNode.dependencies[`__middleware.${middleware.id}`] = node;
|
|
6582
|
-
}
|
|
6583
|
-
}
|
|
6584
|
-
}
|
|
6585
|
-
}
|
|
6586
|
-
for (const storeResourceMiddleware of this.resourceMiddlewares.values()) {
|
|
6587
|
-
const node = nodeMap.get(storeResourceMiddleware.middleware.id);
|
|
6588
|
-
const { middleware } = storeResourceMiddleware;
|
|
6589
|
-
if (middleware.dependencies) {
|
|
6590
|
-
for (const [depKey, depItem] of Object.entries(
|
|
6591
|
-
middleware.dependencies
|
|
6592
|
-
)) {
|
|
6593
|
-
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6594
|
-
const depNode = nodeMap.get(candidate.id);
|
|
6595
|
-
if (depNode) {
|
|
6596
|
-
node.dependencies[depKey] = depNode;
|
|
6597
|
-
}
|
|
6598
|
-
}
|
|
6599
|
-
}
|
|
6600
|
-
if (middleware.everywhere) {
|
|
6601
|
-
const filter = typeof middleware.everywhere === "function" ? middleware.everywhere : () => true;
|
|
6602
|
-
for (const resource2 of this.resources.values()) {
|
|
6603
|
-
if (filter(resource2.resource)) {
|
|
6604
|
-
const resourceNode = nodeMap.get(resource2.resource.id);
|
|
6605
|
-
resourceNode.dependencies[`__middleware.${middleware.id}`] = node;
|
|
6606
|
-
}
|
|
6607
|
-
}
|
|
6608
|
-
}
|
|
6609
|
-
}
|
|
6610
|
-
for (const resource2 of this.resources.values()) {
|
|
6611
|
-
const node = nodeMap.get(resource2.resource.id);
|
|
6612
|
-
if (resource2.resource.dependencies) {
|
|
6613
|
-
for (const [depKey, depItem] of Object.entries(
|
|
6614
|
-
resource2.resource.dependencies
|
|
6615
|
-
)) {
|
|
6616
|
-
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6617
|
-
const depNode = nodeMap.get(candidate.id);
|
|
6618
|
-
if (depNode) {
|
|
6619
|
-
node.dependencies[depKey] = depNode;
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
}
|
|
6623
|
-
for (const middleware of resource2.resource.middleware) {
|
|
6624
|
-
const middlewareNode = nodeMap.get(middleware.id);
|
|
6625
|
-
if (middlewareNode) {
|
|
6626
|
-
node.dependencies[middleware.id] = middlewareNode;
|
|
6627
|
-
}
|
|
6628
|
-
}
|
|
6629
|
-
}
|
|
6630
|
-
for (const hook2 of this.hooks.values()) {
|
|
6631
|
-
const node = nodeMap.get(hook2.hook.id);
|
|
6632
|
-
if (hook2.hook.dependencies) {
|
|
6633
|
-
for (const [depKey, depItem] of Object.entries(
|
|
6634
|
-
hook2.hook.dependencies
|
|
6635
|
-
)) {
|
|
6636
|
-
const candidate = isOptional(depItem) ? depItem.inner : depItem;
|
|
6637
|
-
const depNode = nodeMap.get(candidate.id);
|
|
6638
|
-
if (depNode) {
|
|
6639
|
-
node.dependencies[depKey] = depNode;
|
|
6640
|
-
}
|
|
6641
|
-
}
|
|
6642
|
-
}
|
|
6643
|
-
}
|
|
6644
|
-
return depenedants;
|
|
6926
|
+
return buildDependencyGraph(this);
|
|
6645
6927
|
}
|
|
6646
6928
|
/**
|
|
6647
6929
|
* Builds a directed graph of event emissions based on hooks listening to events
|
|
6648
6930
|
* and their dependencies on events (emission capability). Ignores wildcard hooks by default.
|
|
6649
6931
|
*/
|
|
6650
6932
|
buildEventEmissionGraph() {
|
|
6651
|
-
|
|
6652
|
-
for (const e of this.events.values()) {
|
|
6653
|
-
nodes.set(e.event.id, { id: e.event.id, dependencies: {} });
|
|
6654
|
-
}
|
|
6655
|
-
for (const h of this.hooks.values()) {
|
|
6656
|
-
const listened = [];
|
|
6657
|
-
const on = h.hook.on;
|
|
6658
|
-
if (on === "*") continue;
|
|
6659
|
-
if (Array.isArray(on))
|
|
6660
|
-
listened.push(...on.map((e) => e.id));
|
|
6661
|
-
else listened.push(on.id);
|
|
6662
|
-
const depEvents = [];
|
|
6663
|
-
const deps = h.hook.dependencies;
|
|
6664
|
-
if (deps) {
|
|
6665
|
-
for (const value of Object.values(deps)) {
|
|
6666
|
-
const candidate = isOptional(value) ? value.inner : value;
|
|
6667
|
-
if (candidate && isEvent(candidate)) {
|
|
6668
|
-
depEvents.push(candidate.id);
|
|
6669
|
-
}
|
|
6670
|
-
}
|
|
6671
|
-
}
|
|
6672
|
-
for (const srcId of listened) {
|
|
6673
|
-
const srcNode = nodes.get(srcId);
|
|
6674
|
-
if (!srcNode) continue;
|
|
6675
|
-
for (const dstId of depEvents) {
|
|
6676
|
-
if (srcId === dstId) continue;
|
|
6677
|
-
const dstNode = nodes.get(dstId);
|
|
6678
|
-
if (dstNode) {
|
|
6679
|
-
srcNode.dependencies[dstId] = dstNode;
|
|
6680
|
-
}
|
|
6681
|
-
}
|
|
6682
|
-
}
|
|
6683
|
-
}
|
|
6684
|
-
return Array.from(nodes.values());
|
|
6685
|
-
}
|
|
6686
|
-
setupBlankNodes(nodeMap, depenedants) {
|
|
6687
|
-
for (const task2 of this.tasks.values()) {
|
|
6688
|
-
const node = {
|
|
6689
|
-
id: task2.task.id,
|
|
6690
|
-
dependencies: {}
|
|
6691
|
-
};
|
|
6692
|
-
nodeMap.set(task2.task.id, node);
|
|
6693
|
-
depenedants.push(node);
|
|
6694
|
-
}
|
|
6695
|
-
for (const middleware of this.taskMiddlewares.values()) {
|
|
6696
|
-
const node = {
|
|
6697
|
-
id: middleware.middleware.id,
|
|
6698
|
-
dependencies: {}
|
|
6699
|
-
};
|
|
6700
|
-
nodeMap.set(middleware.middleware.id, node);
|
|
6701
|
-
depenedants.push(node);
|
|
6702
|
-
}
|
|
6703
|
-
for (const middleware of this.resourceMiddlewares.values()) {
|
|
6704
|
-
const node = {
|
|
6705
|
-
id: middleware.middleware.id,
|
|
6706
|
-
dependencies: {}
|
|
6707
|
-
};
|
|
6708
|
-
nodeMap.set(middleware.middleware.id, node);
|
|
6709
|
-
depenedants.push(node);
|
|
6710
|
-
}
|
|
6711
|
-
for (const resource2 of this.resources.values()) {
|
|
6712
|
-
const node = {
|
|
6713
|
-
id: resource2.resource.id,
|
|
6714
|
-
dependencies: {}
|
|
6715
|
-
};
|
|
6716
|
-
nodeMap.set(resource2.resource.id, node);
|
|
6717
|
-
depenedants.push(node);
|
|
6718
|
-
}
|
|
6719
|
-
for (const hook2 of this.hooks.values()) {
|
|
6720
|
-
const node = {
|
|
6721
|
-
id: hook2.hook.id,
|
|
6722
|
-
dependencies: {}
|
|
6723
|
-
};
|
|
6724
|
-
nodeMap.set(hook2.hook.id, node);
|
|
6725
|
-
depenedants.push(node);
|
|
6726
|
-
}
|
|
6933
|
+
return buildEventEmissionGraph(this);
|
|
6727
6934
|
}
|
|
6728
6935
|
getTasksWithTag(tag2) {
|
|
6729
6936
|
const tagId = typeof tag2 === "string" ? tag2 : tag2.id;
|
|
@@ -7657,6 +7864,63 @@ function detectRunnerMode(explicitMode) {
|
|
|
7657
7864
|
}
|
|
7658
7865
|
__name(detectRunnerMode, "detectRunnerMode");
|
|
7659
7866
|
|
|
7867
|
+
// src/models/utils/disposeOrder.ts
|
|
7868
|
+
function getResourcesInDisposeOrder(resources, initializedResourceIds) {
|
|
7869
|
+
const initializedResources = Array.from(resources.values()).filter(
|
|
7870
|
+
(r2) => r2.isInitialized
|
|
7871
|
+
);
|
|
7872
|
+
const initOrderHasAllInitialized = initializedResourceIds.length === initializedResources.length && initializedResources.every(
|
|
7873
|
+
(r2) => initializedResourceIds.includes(r2.resource.id)
|
|
7874
|
+
);
|
|
7875
|
+
if (initOrderHasAllInitialized) {
|
|
7876
|
+
const byId = new Map(
|
|
7877
|
+
initializedResources.map((r2) => [r2.resource.id, r2])
|
|
7878
|
+
);
|
|
7879
|
+
return initializedResourceIds.slice().reverse().map((id2) => byId.get(id2)).filter((r2) => Boolean(r2));
|
|
7880
|
+
}
|
|
7881
|
+
const visitState = /* @__PURE__ */ new Map();
|
|
7882
|
+
const initOrder = [];
|
|
7883
|
+
let cycleDetected = false;
|
|
7884
|
+
const getDependencyIds = /* @__PURE__ */ __name((resource2) => {
|
|
7885
|
+
const raw = resource2.resource.dependencies;
|
|
7886
|
+
if (!raw) return [];
|
|
7887
|
+
const deps = raw;
|
|
7888
|
+
if (!deps || typeof deps !== "object") return [];
|
|
7889
|
+
const out = [];
|
|
7890
|
+
const collect = /* @__PURE__ */ __name((value) => {
|
|
7891
|
+
if (isOptional(value)) {
|
|
7892
|
+
collect(value.inner);
|
|
7893
|
+
return;
|
|
7894
|
+
}
|
|
7895
|
+
if (isResource(value)) {
|
|
7896
|
+
out.push(value.id);
|
|
7897
|
+
}
|
|
7898
|
+
}, "collect");
|
|
7899
|
+
Object.values(deps).forEach(collect);
|
|
7900
|
+
return out;
|
|
7901
|
+
}, "getDependencyIds");
|
|
7902
|
+
const visit = /* @__PURE__ */ __name((resourceId) => {
|
|
7903
|
+
const state = visitState.get(resourceId);
|
|
7904
|
+
if (state === "visited") return;
|
|
7905
|
+
if (state === "visiting") {
|
|
7906
|
+
cycleDetected = true;
|
|
7907
|
+
return;
|
|
7908
|
+
}
|
|
7909
|
+
const resource2 = resources.get(resourceId);
|
|
7910
|
+
if (!resource2) return;
|
|
7911
|
+
visitState.set(resourceId, "visiting");
|
|
7912
|
+
getDependencyIds(resource2).forEach(visit);
|
|
7913
|
+
visitState.set(resourceId, "visited");
|
|
7914
|
+
initOrder.push(resource2);
|
|
7915
|
+
}, "visit");
|
|
7916
|
+
initializedResources.forEach((r2) => visit(r2.resource.id));
|
|
7917
|
+
if (cycleDetected) {
|
|
7918
|
+
return initializedResources.slice().reverse();
|
|
7919
|
+
}
|
|
7920
|
+
return initOrder.reverse();
|
|
7921
|
+
}
|
|
7922
|
+
__name(getResourcesInDisposeOrder, "getResourcesInDisposeOrder");
|
|
7923
|
+
|
|
7660
7924
|
// src/models/Store.ts
|
|
7661
7925
|
var Store = class {
|
|
7662
7926
|
constructor(eventManager, logger, onUnhandledError, mode) {
|
|
@@ -7721,6 +7985,7 @@ var Store = class {
|
|
|
7721
7985
|
}
|
|
7722
7986
|
lock() {
|
|
7723
7987
|
this.#isLocked = true;
|
|
7988
|
+
this.registry.lockAll();
|
|
7724
7989
|
}
|
|
7725
7990
|
checkLock() {
|
|
7726
7991
|
if (this.#isLocked) {
|
|
@@ -7862,58 +8127,7 @@ var Store = class {
|
|
|
7862
8127
|
this.initializedResourceIds.push(resourceId);
|
|
7863
8128
|
}
|
|
7864
8129
|
getResourcesInDisposeOrder() {
|
|
7865
|
-
|
|
7866
|
-
(r2) => r2.isInitialized
|
|
7867
|
-
);
|
|
7868
|
-
const initOrderHasAllInitialized = this.initializedResourceIds.length === initializedResources.length && initializedResources.every(
|
|
7869
|
-
(r2) => this.initializedResourceIds.includes(r2.resource.id)
|
|
7870
|
-
);
|
|
7871
|
-
if (initOrderHasAllInitialized) {
|
|
7872
|
-
const byId = new Map(
|
|
7873
|
-
initializedResources.map((r2) => [r2.resource.id, r2])
|
|
7874
|
-
);
|
|
7875
|
-
return this.initializedResourceIds.slice().reverse().map((id2) => byId.get(id2)).filter((r2) => Boolean(r2));
|
|
7876
|
-
}
|
|
7877
|
-
const visitState = /* @__PURE__ */ new Map();
|
|
7878
|
-
const initOrder = [];
|
|
7879
|
-
let cycleDetected = false;
|
|
7880
|
-
const getDependencyIds = /* @__PURE__ */ __name((resource2) => {
|
|
7881
|
-
const raw = resource2.resource.dependencies;
|
|
7882
|
-
if (!raw) return [];
|
|
7883
|
-
const deps = raw;
|
|
7884
|
-
if (!deps || typeof deps !== "object") return [];
|
|
7885
|
-
const out = [];
|
|
7886
|
-
const collect = /* @__PURE__ */ __name((value) => {
|
|
7887
|
-
if (isOptional(value)) {
|
|
7888
|
-
collect(value.inner);
|
|
7889
|
-
return;
|
|
7890
|
-
}
|
|
7891
|
-
if (isResource(value)) {
|
|
7892
|
-
out.push(value.id);
|
|
7893
|
-
}
|
|
7894
|
-
}, "collect");
|
|
7895
|
-
Object.values(deps).forEach(collect);
|
|
7896
|
-
return out;
|
|
7897
|
-
}, "getDependencyIds");
|
|
7898
|
-
const visit = /* @__PURE__ */ __name((resourceId) => {
|
|
7899
|
-
const state = visitState.get(resourceId);
|
|
7900
|
-
if (state === "visited") return;
|
|
7901
|
-
if (state === "visiting") {
|
|
7902
|
-
cycleDetected = true;
|
|
7903
|
-
return;
|
|
7904
|
-
}
|
|
7905
|
-
const resource2 = this.resources.get(resourceId);
|
|
7906
|
-
if (!resource2) return;
|
|
7907
|
-
visitState.set(resourceId, "visiting");
|
|
7908
|
-
getDependencyIds(resource2).forEach(visit);
|
|
7909
|
-
visitState.set(resourceId, "visited");
|
|
7910
|
-
initOrder.push(resource2);
|
|
7911
|
-
}, "visit");
|
|
7912
|
-
initializedResources.forEach((r2) => visit(r2.resource.id));
|
|
7913
|
-
if (cycleDetected) {
|
|
7914
|
-
return initializedResources.slice().reverse();
|
|
7915
|
-
}
|
|
7916
|
-
return initOrder.reverse();
|
|
8130
|
+
return getResourcesInDisposeOrder(this.resources, this.initializedResourceIds);
|
|
7917
8131
|
}
|
|
7918
8132
|
/**
|
|
7919
8133
|
* Internal, avoid using this method directly.
|
|
@@ -7929,21 +8143,11 @@ var Store = class {
|
|
|
7929
8143
|
storeGenericItem(item) {
|
|
7930
8144
|
return this.registry.storeGenericItem(item);
|
|
7931
8145
|
}
|
|
7932
|
-
/**
|
|
7933
|
-
* Returns all tasks with the given tag.
|
|
7934
|
-
* @param tag - The tag to filter by.
|
|
7935
|
-
* @returns The tasks with the given tag.
|
|
7936
|
-
*/
|
|
7937
8146
|
getTasksWithTag(tag2) {
|
|
7938
|
-
return this.registry.getTasksWithTag(tag2);
|
|
8147
|
+
return typeof tag2 === "string" ? this.registry.getTasksWithTag(tag2) : this.registry.getTasksWithTag(tag2);
|
|
7939
8148
|
}
|
|
7940
|
-
/**
|
|
7941
|
-
* Returns all resources with the given tag.
|
|
7942
|
-
* @param tag - The tag to filter by.
|
|
7943
|
-
* @returns The resources with the given tag.
|
|
7944
|
-
*/
|
|
7945
8149
|
getResourcesWithTag(tag2) {
|
|
7946
|
-
return this.registry.getResourcesWithTag(tag2);
|
|
8150
|
+
return typeof tag2 === "string" ? this.registry.getResourcesWithTag(tag2) : this.registry.getResourcesWithTag(tag2);
|
|
7947
8151
|
}
|
|
7948
8152
|
};
|
|
7949
8153
|
|
|
@@ -8206,7 +8410,7 @@ var debugResource = defineResource({
|
|
|
8206
8410
|
tags: [globalTags.system]
|
|
8207
8411
|
});
|
|
8208
8412
|
|
|
8209
|
-
// src/
|
|
8413
|
+
// src/tools/processShutdownHooks.ts
|
|
8210
8414
|
var platform2 = getPlatform();
|
|
8211
8415
|
var activeErrorHandlers = /* @__PURE__ */ new Set();
|
|
8212
8416
|
var processSafetyNetsInstalled = false;
|
|
@@ -8544,6 +8748,16 @@ function buildTestFacade(deps) {
|
|
|
8544
8748
|
}
|
|
8545
8749
|
__name(buildTestFacade, "buildTestFacade");
|
|
8546
8750
|
|
|
8751
|
+
// src/definers/builders/shared/mergeUtils.ts
|
|
8752
|
+
function mergeArray(existing, addition, override2) {
|
|
8753
|
+
const toArray = [...addition];
|
|
8754
|
+
if (override2 || !existing) {
|
|
8755
|
+
return toArray;
|
|
8756
|
+
}
|
|
8757
|
+
return [...existing, ...toArray];
|
|
8758
|
+
}
|
|
8759
|
+
__name(mergeArray, "mergeArray");
|
|
8760
|
+
|
|
8547
8761
|
// src/definers/builders/resource/utils.ts
|
|
8548
8762
|
function clone2(s, patch) {
|
|
8549
8763
|
return Object.freeze({
|
|
@@ -8588,14 +8802,6 @@ function mergeRegister(existing, addition, override2) {
|
|
|
8588
8802
|
];
|
|
8589
8803
|
}
|
|
8590
8804
|
__name(mergeRegister, "mergeRegister");
|
|
8591
|
-
function mergeArray(existing, addition, override2) {
|
|
8592
|
-
const toArray = [...addition];
|
|
8593
|
-
if (override2 || !existing) {
|
|
8594
|
-
return toArray;
|
|
8595
|
-
}
|
|
8596
|
-
return [...existing, ...toArray];
|
|
8597
|
-
}
|
|
8598
|
-
__name(mergeArray, "mergeArray");
|
|
8599
8805
|
function mergeDependencies(existing, addition, override2) {
|
|
8600
8806
|
const isFnExisting = typeof existing === "function";
|
|
8601
8807
|
const isFnAddition = typeof addition === "function";
|
|
@@ -8759,14 +8965,6 @@ function clone3(s, patch) {
|
|
|
8759
8965
|
});
|
|
8760
8966
|
}
|
|
8761
8967
|
__name(clone3, "clone");
|
|
8762
|
-
function mergeArray2(existing, addition, override2) {
|
|
8763
|
-
const toArray = [...addition];
|
|
8764
|
-
if (override2 || !existing) {
|
|
8765
|
-
return toArray;
|
|
8766
|
-
}
|
|
8767
|
-
return [...existing, ...toArray];
|
|
8768
|
-
}
|
|
8769
|
-
__name(mergeArray2, "mergeArray");
|
|
8770
8968
|
function mergeDependencies2(existing, addition, override2) {
|
|
8771
8969
|
const isFnExisting = typeof existing === "function";
|
|
8772
8970
|
const isFnAddition = typeof addition === "function";
|
|
@@ -8822,14 +9020,14 @@ function makeTaskBuilder(state) {
|
|
|
8822
9020
|
middleware(mw, options) {
|
|
8823
9021
|
const override2 = options?.override ?? false;
|
|
8824
9022
|
const next = clone3(state, {
|
|
8825
|
-
middleware:
|
|
9023
|
+
middleware: mergeArray(state.middleware, mw, override2)
|
|
8826
9024
|
});
|
|
8827
9025
|
return makeTaskBuilder(next);
|
|
8828
9026
|
},
|
|
8829
9027
|
tags(t, options) {
|
|
8830
9028
|
const override2 = options?.override ?? false;
|
|
8831
9029
|
const next = clone3(state, {
|
|
8832
|
-
tags:
|
|
9030
|
+
tags: mergeArray(state.tags, t, override2)
|
|
8833
9031
|
});
|
|
8834
9032
|
return makeTaskBuilder(next);
|
|
8835
9033
|
},
|
|
@@ -8905,14 +9103,14 @@ function makePhantomTaskBuilder(state) {
|
|
|
8905
9103
|
middleware(mw, options) {
|
|
8906
9104
|
const override2 = options?.override ?? false;
|
|
8907
9105
|
const next = clone3(state, {
|
|
8908
|
-
middleware:
|
|
9106
|
+
middleware: mergeArray(state.middleware, mw, override2)
|
|
8909
9107
|
});
|
|
8910
9108
|
return makePhantomTaskBuilder(next);
|
|
8911
9109
|
},
|
|
8912
9110
|
tags(t, options) {
|
|
8913
9111
|
const override2 = options?.override ?? false;
|
|
8914
9112
|
const next = clone3(state, {
|
|
8915
|
-
tags:
|
|
9113
|
+
tags: mergeArray(state.tags, t, override2)
|
|
8916
9114
|
});
|
|
8917
9115
|
return makePhantomTaskBuilder(
|
|
8918
9116
|
next
|
|
@@ -9001,14 +9199,6 @@ function clone4(s, patch) {
|
|
|
9001
9199
|
});
|
|
9002
9200
|
}
|
|
9003
9201
|
__name(clone4, "clone");
|
|
9004
|
-
function mergeArray3(existing, addition, override2) {
|
|
9005
|
-
const toArray = [...addition];
|
|
9006
|
-
if (override2 || !existing) {
|
|
9007
|
-
return toArray;
|
|
9008
|
-
}
|
|
9009
|
-
return [...existing, ...toArray];
|
|
9010
|
-
}
|
|
9011
|
-
__name(mergeArray3, "mergeArray");
|
|
9012
9202
|
|
|
9013
9203
|
// src/definers/builders/event/fluent-builder.ts
|
|
9014
9204
|
function makeEventBuilder(state) {
|
|
@@ -9023,7 +9213,7 @@ function makeEventBuilder(state) {
|
|
|
9023
9213
|
tags(t, options) {
|
|
9024
9214
|
const override2 = options?.override ?? false;
|
|
9025
9215
|
const next = clone4(state, {
|
|
9026
|
-
tags:
|
|
9216
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9027
9217
|
});
|
|
9028
9218
|
return makeEventBuilder(next);
|
|
9029
9219
|
},
|
|
@@ -9071,14 +9261,6 @@ function clone5(s, patch) {
|
|
|
9071
9261
|
});
|
|
9072
9262
|
}
|
|
9073
9263
|
__name(clone5, "clone");
|
|
9074
|
-
function mergeArray4(existing, addition, override2) {
|
|
9075
|
-
const toArray = [...addition];
|
|
9076
|
-
if (override2 || !existing) {
|
|
9077
|
-
return toArray;
|
|
9078
|
-
}
|
|
9079
|
-
return [...existing, ...toArray];
|
|
9080
|
-
}
|
|
9081
|
-
__name(mergeArray4, "mergeArray");
|
|
9082
9264
|
function mergeDependencies3(existing, addition, override2) {
|
|
9083
9265
|
const isFnExisting = typeof existing === "function";
|
|
9084
9266
|
const isFnAddition = typeof addition === "function";
|
|
@@ -9152,7 +9334,7 @@ function makeHookBuilder(state) {
|
|
|
9152
9334
|
tags(t, options) {
|
|
9153
9335
|
const override2 = options?.override ?? false;
|
|
9154
9336
|
const next = clone5(state, {
|
|
9155
|
-
tags:
|
|
9337
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9156
9338
|
});
|
|
9157
9339
|
return makeHookBuilder(next);
|
|
9158
9340
|
},
|
|
@@ -9229,14 +9411,6 @@ function cloneRes(s, patch) {
|
|
|
9229
9411
|
});
|
|
9230
9412
|
}
|
|
9231
9413
|
__name(cloneRes, "cloneRes");
|
|
9232
|
-
function mergeArray5(existing, addition, override2) {
|
|
9233
|
-
const toArray = [...addition];
|
|
9234
|
-
if (override2 || !existing) {
|
|
9235
|
-
return toArray;
|
|
9236
|
-
}
|
|
9237
|
-
return [...existing, ...toArray];
|
|
9238
|
-
}
|
|
9239
|
-
__name(mergeArray5, "mergeArray");
|
|
9240
9414
|
function mergeDependencies4(existing, addition, override2) {
|
|
9241
9415
|
const isFnExisting = typeof existing === "function";
|
|
9242
9416
|
const isFnAddition = typeof addition === "function";
|
|
@@ -9317,7 +9491,7 @@ function makeTaskMiddlewareBuilder(state) {
|
|
|
9317
9491
|
tags(t, options) {
|
|
9318
9492
|
const override2 = options?.override ?? false;
|
|
9319
9493
|
const next = cloneTask(state, {
|
|
9320
|
-
tags:
|
|
9494
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9321
9495
|
});
|
|
9322
9496
|
return makeTaskMiddlewareBuilder(next);
|
|
9323
9497
|
},
|
|
@@ -9389,7 +9563,7 @@ function makeResourceMiddlewareBuilder(state) {
|
|
|
9389
9563
|
tags(t, options) {
|
|
9390
9564
|
const override2 = options?.override ?? false;
|
|
9391
9565
|
const next = cloneRes(state, {
|
|
9392
|
-
tags:
|
|
9566
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9393
9567
|
});
|
|
9394
9568
|
return makeResourceMiddlewareBuilder(next);
|
|
9395
9569
|
},
|
|
@@ -9600,7 +9774,7 @@ function makeHookOverrideBuilder(base, state) {
|
|
|
9600
9774
|
tags(t, options) {
|
|
9601
9775
|
const override2 = options?.override ?? false;
|
|
9602
9776
|
const next = cloneHookState(state, {
|
|
9603
|
-
tags:
|
|
9777
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9604
9778
|
});
|
|
9605
9779
|
return makeHookOverrideBuilder(base, next);
|
|
9606
9780
|
},
|
|
@@ -9805,7 +9979,7 @@ function makeResourceMiddlewareOverrideBuilder(base, state) {
|
|
|
9805
9979
|
tags(t, options) {
|
|
9806
9980
|
const override2 = options?.override ?? false;
|
|
9807
9981
|
const next = cloneResourceMiddlewareState(state, {
|
|
9808
|
-
tags:
|
|
9982
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9809
9983
|
});
|
|
9810
9984
|
return makeResourceMiddlewareOverrideBuilder(base, next);
|
|
9811
9985
|
},
|
|
@@ -9865,14 +10039,14 @@ function makeTaskOverrideBuilder(base, state) {
|
|
|
9865
10039
|
middleware(mw, options) {
|
|
9866
10040
|
const override2 = options?.override ?? false;
|
|
9867
10041
|
const next = cloneTaskState(state, {
|
|
9868
|
-
middleware:
|
|
10042
|
+
middleware: mergeArray(state.middleware, mw, override2)
|
|
9869
10043
|
});
|
|
9870
10044
|
return makeTaskOverrideBuilder(base, next);
|
|
9871
10045
|
},
|
|
9872
10046
|
tags(t, options) {
|
|
9873
10047
|
const override2 = options?.override ?? false;
|
|
9874
10048
|
const next = cloneTaskState(state, {
|
|
9875
|
-
tags:
|
|
10049
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9876
10050
|
});
|
|
9877
10051
|
return makeTaskOverrideBuilder(base, next);
|
|
9878
10052
|
},
|
|
@@ -9981,7 +10155,7 @@ function makeTaskMiddlewareOverrideBuilder(base, state) {
|
|
|
9981
10155
|
tags(t, options) {
|
|
9982
10156
|
const override2 = options?.override ?? false;
|
|
9983
10157
|
const next = cloneTaskMiddlewareState(state, {
|
|
9984
|
-
tags:
|
|
10158
|
+
tags: mergeArray(state.tags, t, override2)
|
|
9985
10159
|
});
|
|
9986
10160
|
return makeTaskMiddlewareOverrideBuilder(base, next);
|
|
9987
10161
|
},
|
|
@@ -10060,6 +10234,7 @@ var r = Object.freeze({
|
|
|
10060
10234
|
exports.DependencyProcessor = DependencyProcessor;
|
|
10061
10235
|
exports.Errors = errors_exports;
|
|
10062
10236
|
exports.EventManager = EventManager;
|
|
10237
|
+
exports.LockableMap = LockableMap;
|
|
10063
10238
|
exports.LogPrinter = LogPrinter;
|
|
10064
10239
|
exports.Logger = Logger;
|
|
10065
10240
|
exports.MiddlewareManager = MiddlewareManager;
|
|
@@ -10067,6 +10242,7 @@ exports.PlatformAdapter = PlatformAdapter;
|
|
|
10067
10242
|
exports.Queue = Queue;
|
|
10068
10243
|
exports.ResourceInitializer = ResourceInitializer;
|
|
10069
10244
|
exports.RunResult = RunResult;
|
|
10245
|
+
exports.RunnerError = RunnerError;
|
|
10070
10246
|
exports.Semaphore = Semaphore;
|
|
10071
10247
|
exports.Serializer = Serializer;
|
|
10072
10248
|
exports.Store = Store;
|
|
@@ -10076,6 +10252,7 @@ exports.TaskRunner = TaskRunner;
|
|
|
10076
10252
|
exports.allFalse = allFalse;
|
|
10077
10253
|
exports.asyncContext = defineAsyncContext;
|
|
10078
10254
|
exports.bindProcessErrorHandler = bindProcessErrorHandler;
|
|
10255
|
+
exports.cancellationError = cancellationError;
|
|
10079
10256
|
exports.createContext = createContext2;
|
|
10080
10257
|
exports.createDefaultUnhandledError = createDefaultUnhandledError;
|
|
10081
10258
|
exports.createExposureFetch = createExposureFetch;
|