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