@bluelibs/runner 5.0.0 → 5.2.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 +6 -6
- package/dist/browser/index.cjs +1039 -467
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +1037 -467
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +1039 -467
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +1037 -467
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +1490 -570
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +1485 -570
- package/dist/node/node.mjs.map +1 -1
- package/dist/types/define.d.ts +9 -0
- package/dist/types/definers/builders/asyncContext/fluent-builder.d.ts +6 -0
- package/dist/types/definers/builders/asyncContext/fluent-builder.interface.d.ts +9 -0
- package/dist/types/definers/builders/asyncContext/index.d.ts +10 -0
- package/dist/types/definers/builders/asyncContext/types.d.ts +13 -0
- package/dist/types/definers/builders/asyncContext/utils.d.ts +5 -0
- package/dist/types/definers/builders/asyncContext.d.ts +1 -0
- package/dist/types/definers/builders/core.d.ts +30 -0
- package/dist/types/definers/builders/error/fluent-builder.d.ts +7 -0
- package/dist/types/definers/builders/error/fluent-builder.interface.d.ts +10 -0
- package/dist/types/definers/builders/error/index.d.ts +11 -0
- package/dist/types/definers/builders/error/types.d.ts +14 -0
- package/dist/types/definers/builders/error/utils.d.ts +6 -0
- package/dist/types/definers/builders/error.d.ts +1 -0
- package/dist/types/definers/builders/event/fluent-builder.d.ts +7 -0
- package/dist/types/definers/builders/event/fluent-builder.interface.d.ts +18 -0
- package/dist/types/definers/builders/event/index.d.ts +10 -0
- package/dist/types/definers/builders/event/types.d.ts +8 -0
- package/dist/types/definers/builders/event/utils.d.ts +9 -0
- package/dist/types/definers/builders/event.d.ts +1 -0
- package/dist/types/definers/builders/hook/fluent-builder.d.ts +8 -0
- package/dist/types/definers/builders/hook/fluent-builder.interface.d.ts +27 -0
- package/dist/types/definers/builders/hook/index.d.ts +12 -0
- package/dist/types/definers/builders/hook/types.d.ts +14 -0
- package/dist/types/definers/builders/hook/utils.d.ts +14 -0
- package/dist/types/definers/builders/hook.d.ts +1 -0
- package/dist/types/definers/builders/middleware/index.d.ts +19 -0
- package/dist/types/definers/builders/middleware/resource.d.ts +7 -0
- package/dist/types/definers/builders/middleware/resource.interface.d.ts +18 -0
- package/dist/types/definers/builders/middleware/task.d.ts +7 -0
- package/dist/types/definers/builders/middleware/task.interface.d.ts +18 -0
- package/dist/types/definers/builders/middleware/types.d.ts +13 -0
- package/dist/types/definers/builders/middleware/utils.d.ts +18 -0
- package/dist/types/definers/builders/middleware.d.ts +1 -0
- package/dist/types/definers/builders/override/hook.d.ts +16 -0
- package/dist/types/definers/builders/override/index.d.ts +11 -0
- package/dist/types/definers/builders/override/resource-middleware.d.ts +3 -0
- package/dist/types/definers/builders/override/resource.d.ts +3 -0
- package/dist/types/definers/builders/override/task-middleware.d.ts +3 -0
- package/dist/types/definers/builders/override/task.d.ts +3 -0
- package/dist/types/definers/builders/resource/fluent-builder.d.ts +8 -0
- package/dist/types/definers/builders/resource/fluent-builder.interface.d.ts +42 -0
- package/dist/types/definers/builders/resource/index.d.ts +13 -0
- package/dist/types/definers/builders/resource/types.d.ts +37 -0
- package/dist/types/definers/builders/resource/utils.d.ts +26 -0
- package/dist/types/definers/builders/resource.d.ts +1 -0
- package/dist/types/definers/builders/tag/fluent-builder.d.ts +6 -0
- package/dist/types/definers/builders/tag/fluent-builder.interface.d.ts +8 -0
- package/dist/types/definers/builders/tag/index.d.ts +10 -0
- package/dist/types/definers/builders/tag/types.d.ts +12 -0
- package/dist/types/definers/builders/tag/utils.d.ts +5 -0
- package/dist/types/definers/builders/tag.d.ts +1 -0
- package/dist/types/definers/builders/task/fluent-builder.d.ts +8 -0
- package/dist/types/definers/builders/task/fluent-builder.interface.d.ts +33 -0
- package/dist/types/definers/builders/task/index.d.ts +21 -0
- package/dist/types/definers/builders/task/phantom-builder.d.ts +8 -0
- package/dist/types/definers/builders/task/phantom-builder.interface.d.ts +31 -0
- package/dist/types/definers/builders/task/types.d.ts +34 -0
- package/dist/types/definers/builders/task/utils.d.ts +14 -0
- package/dist/types/definers/builders/task.d.ts +1 -0
- package/dist/types/definers/builders/task.phantom.d.ts +1 -0
- package/dist/types/definers/builders/utils.d.ts +4 -0
- package/dist/types/definers/defineAsyncContext.d.ts +15 -0
- package/dist/types/definers/defineError.d.ts +27 -0
- package/dist/types/definers/defineEvent.d.ts +2 -0
- package/dist/types/definers/defineHook.d.ts +6 -0
- package/dist/types/definers/defineOverride.d.ts +12 -0
- package/dist/types/definers/defineResource.d.ts +2 -0
- package/dist/types/definers/defineResourceMiddleware.d.ts +2 -0
- package/dist/types/definers/defineTag.d.ts +12 -0
- package/dist/types/definers/defineTask.d.ts +18 -0
- package/dist/types/definers/defineTaskMiddleware.d.ts +2 -0
- package/dist/types/definers/middlewareConfig.d.ts +1 -0
- package/dist/types/definers/resourceFork.d.ts +13 -0
- package/dist/types/definers/tools.d.ts +53 -0
- package/dist/types/defs.d.ts +32 -0
- package/dist/types/errors.d.ts +75 -0
- package/dist/types/globals/debug.d.ts +10 -0
- package/dist/types/globals/globalEvents.d.ts +8 -0
- package/dist/types/globals/globalMiddleware.d.ts +97 -0
- package/dist/types/globals/globalResources.d.ts +64 -0
- package/dist/types/globals/globalTags.d.ts +12 -0
- package/dist/types/globals/middleware/cache.middleware.d.ts +36 -0
- package/dist/types/globals/middleware/circuitBreaker.middleware.d.ts +56 -0
- package/dist/types/globals/middleware/concurrency.middleware.d.ts +47 -0
- package/dist/types/globals/middleware/fallback.middleware.d.ts +23 -0
- package/dist/types/globals/middleware/rateLimit.middleware.d.ts +47 -0
- package/dist/types/globals/middleware/requireContext.middleware.d.ts +5 -0
- package/dist/types/globals/middleware/retry.middleware.d.ts +31 -0
- package/dist/types/globals/middleware/temporal.middleware.d.ts +48 -0
- package/dist/types/globals/middleware/timeout.middleware.d.ts +24 -0
- package/dist/types/globals/middleware/tunnel.middleware.d.ts +3 -0
- package/dist/types/globals/resources/debug/debug.resource.d.ts +7 -0
- package/dist/types/globals/resources/debug/debug.tag.d.ts +2 -0
- package/dist/types/globals/resources/debug/debugConfig.resource.d.ts +22 -0
- package/dist/types/globals/resources/debug/executionTracker.middleware.d.ts +50 -0
- package/dist/types/globals/resources/debug/globalEvent.hook.d.ts +27 -0
- package/dist/types/globals/resources/debug/hook.hook.d.ts +30 -0
- package/dist/types/globals/resources/debug/index.d.ts +6 -0
- package/dist/types/globals/resources/debug/middleware.hook.d.ts +30 -0
- package/dist/types/globals/resources/debug/types.d.ts +25 -0
- package/dist/types/globals/resources/debug/utils.d.ts +2 -0
- package/dist/types/globals/resources/httpClientFactory.resource.d.ts +28 -0
- package/dist/types/globals/resources/queue.resource.d.ts +10 -0
- package/dist/types/globals/resources/tunnel/error-utils.d.ts +1 -0
- package/dist/types/globals/resources/tunnel/plan.d.ts +19 -0
- package/dist/types/globals/resources/tunnel/protocol.d.ts +48 -0
- package/dist/types/globals/resources/tunnel/tunnel.policy.tag.d.ts +26 -0
- package/dist/types/globals/resources/tunnel/tunnel.tag.d.ts +2 -0
- package/dist/types/globals/resources/tunnel/types.d.ts +48 -0
- package/dist/types/globals/tunnels/index.d.ts +23 -0
- package/dist/types/globals/types.d.ts +15 -0
- package/dist/types/http-client.d.ts +26 -0
- package/dist/types/http-fetch-tunnel.resource.d.ts +11 -0
- package/dist/types/index.d.ts +44 -0
- package/dist/types/models/DependencyProcessor.d.ts +46 -0
- package/dist/types/models/EventManager.d.ts +115 -0
- package/dist/types/models/ExecutionJournal.d.ts +35 -0
- package/dist/types/models/LogPrinter.d.ts +56 -0
- package/dist/types/models/Logger.d.ts +85 -0
- package/dist/types/models/MiddlewareManager.d.ts +73 -0
- package/dist/types/models/OverrideManager.d.ts +13 -0
- package/dist/types/models/Queue.d.ts +40 -0
- package/dist/types/models/ResourceInitializer.d.ts +20 -0
- package/dist/types/models/RunResult.d.ts +41 -0
- package/dist/types/models/Semaphore.d.ts +80 -0
- package/dist/types/models/Store.d.ts +76 -0
- package/dist/types/models/StoreRegistry.d.ts +49 -0
- package/dist/types/models/StoreValidator.d.ts +8 -0
- package/dist/types/models/TaskRunner.d.ts +28 -0
- package/dist/types/models/UnhandledError.d.ts +11 -0
- package/dist/types/models/event/CycleContext.d.ts +9 -0
- package/dist/types/models/event/EmissionExecutor.d.ts +11 -0
- package/dist/types/models/event/InterceptorPipeline.d.ts +5 -0
- package/dist/types/models/event/ListenerRegistry.d.ts +31 -0
- package/dist/types/models/event/types.d.ts +50 -0
- package/dist/types/models/index.d.ts +13 -0
- package/dist/types/models/middleware/InterceptorRegistry.d.ts +56 -0
- package/dist/types/models/middleware/MiddlewareResolver.d.ts +31 -0
- package/dist/types/models/middleware/ResourceMiddlewareComposer.d.ts +34 -0
- package/dist/types/models/middleware/TaskMiddlewareComposer.d.ts +44 -0
- package/dist/types/models/middleware/ValidationHelper.d.ts +20 -0
- package/dist/types/models/middleware/index.d.ts +6 -0
- package/dist/types/models/middleware/types.d.ts +10 -0
- package/dist/types/models/utils/findCircularDependencies.d.ts +16 -0
- package/dist/types/models/utils/safeStringify.d.ts +3 -0
- package/dist/types/node/durable/bus/MemoryEventBus.d.ts +7 -0
- package/dist/types/node/durable/bus/NoopEventBus.d.ts +6 -0
- package/dist/types/node/durable/bus/RedisEventBus.d.ts +30 -0
- package/dist/types/node/durable/core/CronParser.d.ts +15 -0
- package/dist/types/node/durable/core/DurableContext.d.ts +64 -0
- package/dist/types/node/durable/core/DurableOperator.d.ts +47 -0
- package/dist/types/node/durable/core/DurableResource.d.ts +80 -0
- package/dist/types/node/durable/core/DurableService.d.ts +73 -0
- package/dist/types/node/durable/core/DurableWorker.d.ts +19 -0
- package/dist/types/node/durable/core/StepBuilder.d.ts +23 -0
- package/dist/types/node/durable/core/audit.d.ts +152 -0
- package/dist/types/node/durable/core/createRunnerDurableRuntime.d.ts +18 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.audit.d.ts +14 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.determinism.d.ts +13 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.emit.d.ts +16 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.sleep.d.ts +16 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.steps.d.ts +25 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.switch.d.ts +22 -0
- package/dist/types/node/durable/core/durable-context/DurableContext.waitForSignal.d.ts +23 -0
- package/dist/types/node/durable/core/flowShape.d.ts +50 -0
- package/dist/types/node/durable/core/ids.d.ts +11 -0
- package/dist/types/node/durable/core/index.d.ts +11 -0
- package/dist/types/node/durable/core/interfaces/bus.d.ts +13 -0
- package/dist/types/node/durable/core/interfaces/context.d.ts +105 -0
- package/dist/types/node/durable/core/interfaces/queue.d.ts +17 -0
- package/dist/types/node/durable/core/interfaces/service.d.ts +146 -0
- package/dist/types/node/durable/core/interfaces/store.d.ts +66 -0
- package/dist/types/node/durable/core/managers/AuditLogger.d.ts +29 -0
- package/dist/types/node/durable/core/managers/ExecutionManager.d.ts +48 -0
- package/dist/types/node/durable/core/managers/PollingManager.d.ts +48 -0
- package/dist/types/node/durable/core/managers/ScheduleManager.d.ts +33 -0
- package/dist/types/node/durable/core/managers/SignalHandler.d.ts +25 -0
- package/dist/types/node/durable/core/managers/TaskRegistry.d.ts +16 -0
- package/dist/types/node/durable/core/managers/WaitManager.d.ts +26 -0
- package/dist/types/node/durable/core/managers/index.d.ts +7 -0
- package/dist/types/node/durable/core/resource.d.ts +14 -0
- package/dist/types/node/durable/core/types.d.ts +84 -0
- package/dist/types/node/durable/core/utils.d.ts +28 -0
- package/dist/types/node/durable/dashboard/server.d.ts +20 -0
- package/dist/types/node/durable/emitters/runnerAuditEmitter.d.ts +6 -0
- package/dist/types/node/durable/events.d.ts +76 -0
- package/dist/types/node/durable/index.d.ts +34 -0
- package/dist/types/node/durable/optionalDeps/amqplib.d.ts +1 -0
- package/dist/types/node/durable/optionalDeps/ioredis.d.ts +1 -0
- package/dist/types/node/durable/queue/MemoryQueue.d.ts +12 -0
- package/dist/types/node/durable/queue/RabbitMQQueue.d.ts +30 -0
- package/dist/types/node/durable/resources/isolation.d.ts +15 -0
- package/dist/types/node/durable/resources/memoryDurableResource.d.ts +21 -0
- package/dist/types/node/durable/resources/redisDurableResource.d.ts +35 -0
- package/dist/types/node/durable/store/MemoryStore.d.ts +56 -0
- package/dist/types/node/durable/store/RedisStore.d.ts +89 -0
- package/dist/types/node/durable/test-utils.d.ts +29 -0
- package/dist/types/node/exposure/allowList.d.ts +3 -0
- package/dist/types/node/exposure/authenticator.d.ts +16 -0
- package/dist/types/node/exposure/cors.d.ts +4 -0
- package/dist/types/node/exposure/createNodeExposure.d.ts +2 -0
- package/dist/types/node/exposure/exposureServer.d.ts +18 -0
- package/dist/types/node/exposure/handlers/contextWrapper.d.ts +18 -0
- package/dist/types/node/exposure/handlers/errorHandlers.d.ts +23 -0
- package/dist/types/node/exposure/handlers/eventHandler.d.ts +20 -0
- package/dist/types/node/exposure/handlers/taskHandler.d.ts +24 -0
- package/dist/types/node/exposure/httpResponse.d.ts +10 -0
- package/dist/types/node/exposure/index.d.ts +3 -0
- package/dist/types/node/exposure/logging.d.ts +4 -0
- package/dist/types/node/exposure/multipart.d.ts +36 -0
- package/dist/types/node/exposure/requestBody.d.ts +11 -0
- package/dist/types/node/exposure/requestContext.d.ts +17 -0
- package/dist/types/node/exposure/requestHandlers.d.ts +29 -0
- package/dist/types/node/exposure/resource.d.ts +12 -0
- package/dist/types/node/exposure/resourceTypes.d.ts +73 -0
- package/dist/types/node/exposure/router.d.ts +17 -0
- package/dist/types/node/exposure/serverLifecycle.d.ts +13 -0
- package/dist/types/node/exposure/types.d.ts +45 -0
- package/dist/types/node/exposure/utils.d.ts +17 -0
- package/dist/types/node/files/createNodeFile.d.ts +9 -0
- package/dist/types/node/files/index.d.ts +4 -0
- package/dist/types/node/files/inputFile.model.d.ts +22 -0
- package/dist/types/node/files/inputFile.utils.d.ts +14 -0
- package/dist/types/node/http/http-mixed-client.d.ts +45 -0
- package/dist/types/node/http/http-mixed-client.factory.resource.d.ts +17 -0
- package/dist/types/node/http/http-smart-client.factory.resource.d.ts +16 -0
- package/dist/types/node/http/http-smart-client.model.d.ts +27 -0
- package/dist/types/node/http/index.d.ts +4 -0
- package/dist/types/node/index.d.ts +1 -0
- package/dist/types/node/node.d.ts +192 -0
- package/dist/types/node/platform/createFile.d.ts +9 -0
- package/dist/types/node/tunnel/allowlist.d.ts +7 -0
- package/dist/types/node/tunnel/index.d.ts +2 -0
- package/dist/types/node/upload/manifest.d.ts +23 -0
- package/dist/types/platform/adapters/browser.d.ts +14 -0
- package/dist/types/platform/adapters/edge.d.ts +5 -0
- package/dist/types/platform/adapters/node-als.d.ts +1 -0
- package/dist/types/platform/adapters/node.d.ts +15 -0
- package/dist/types/platform/adapters/universal-generic.d.ts +14 -0
- package/dist/types/platform/adapters/universal.d.ts +18 -0
- package/dist/types/platform/createFile.d.ts +10 -0
- package/dist/types/platform/createWebFile.d.ts +11 -0
- package/dist/types/platform/factory.d.ts +2 -0
- package/dist/types/platform/index.d.ts +27 -0
- package/dist/types/platform/types.d.ts +31 -0
- package/dist/types/processHooks.d.ts +2 -0
- package/dist/types/public-types.d.ts +13 -0
- package/dist/types/public.d.ts +210 -0
- package/dist/types/run.d.ts +14 -0
- package/dist/types/serializer/Serializer.d.ts +84 -0
- package/dist/types/serializer/binary-builtins.d.ts +5 -0
- package/dist/types/serializer/builtins.d.ts +47 -0
- package/dist/types/serializer/deserializer.d.ts +27 -0
- package/dist/types/serializer/error-url-builtins.d.ts +13 -0
- package/dist/types/serializer/graph-serializer.d.ts +27 -0
- package/dist/types/serializer/index.d.ts +6 -0
- package/dist/types/serializer/option-normalizers.d.ts +2 -0
- package/dist/types/serializer/regexp-validator.d.ts +34 -0
- package/dist/types/serializer/serialize-utils.d.ts +15 -0
- package/dist/types/serializer/special-values.d.ts +20 -0
- package/dist/types/serializer/tree-serializer.d.ts +20 -0
- package/dist/types/serializer/type-registry.d.ts +58 -0
- package/dist/types/serializer/types.d.ts +126 -0
- package/dist/types/serializer/validation.d.ts +34 -0
- package/dist/types/testing.d.ts +19 -0
- package/dist/types/tools/detectRunnerMode.d.ts +9 -0
- package/dist/types/tools/getCallerFile.d.ts +1 -0
- package/dist/types/tools/throws.d.ts +7 -0
- package/dist/types/tunnels/buildUniversalManifest.d.ts +24 -0
- package/dist/types/types/asyncContext.d.ts +41 -0
- package/dist/types/types/contracts.d.ts +62 -0
- package/dist/types/types/error.d.ts +39 -0
- package/dist/types/types/event.d.ts +79 -0
- package/dist/types/types/executionJournal.d.ts +29 -0
- package/dist/types/types/hook.d.ts +23 -0
- package/dist/types/types/inputFile.d.ts +34 -0
- package/dist/types/types/meta.d.ts +22 -0
- package/dist/types/types/resource.d.ts +133 -0
- package/dist/types/types/resourceMiddleware.d.ts +48 -0
- package/dist/types/types/runner.d.ts +68 -0
- package/dist/types/types/storeTypes.d.ts +46 -0
- package/dist/types/types/symbols.d.ts +34 -0
- package/dist/types/types/tag.d.ts +45 -0
- package/dist/types/types/task.d.ts +76 -0
- package/dist/types/types/taskMiddleware.d.ts +55 -0
- package/dist/types/types/utilities.d.ts +125 -0
- package/dist/universal/index.cjs +1039 -465
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs +1037 -465
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +14 -13
- package/readmes/AI.md +34 -12
- package/dist/browser/index.d.mts +0 -2890
- package/dist/browser/index.d.ts +0 -2890
- package/dist/edge/index.d.mts +0 -2890
- package/dist/edge/index.d.ts +0 -2890
- package/dist/node/node.d.mts +0 -4593
- package/dist/node/node.d.ts +0 -4593
- package/dist/universal/index.d.mts +0 -2890
- package/dist/universal/index.d.ts +0 -2890
package/dist/node/node.mjs
CHANGED
|
@@ -2639,10 +2639,10 @@ var require_bom_handling = __commonJS({
|
|
|
2639
2639
|
// node_modules/raw-body/node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
2640
2640
|
var require_merge_exports = __commonJS({
|
|
2641
2641
|
"node_modules/raw-body/node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports, module) {
|
|
2642
|
-
var
|
|
2642
|
+
var hasOwn3 = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
2643
2643
|
function mergeModules(target, module2) {
|
|
2644
2644
|
for (var key in module2) {
|
|
2645
|
-
if (
|
|
2645
|
+
if (hasOwn3(module2, key)) {
|
|
2646
2646
|
target[key] = module2[key];
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
@@ -6613,10 +6613,10 @@ var require_bom_handling2 = __commonJS({
|
|
|
6613
6613
|
// node_modules/body-parser/node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
6614
6614
|
var require_merge_exports2 = __commonJS({
|
|
6615
6615
|
"node_modules/body-parser/node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports, module) {
|
|
6616
|
-
var
|
|
6616
|
+
var hasOwn3 = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
6617
6617
|
function mergeModules(target, module2) {
|
|
6618
6618
|
for (var key in module2) {
|
|
6619
|
-
if (
|
|
6619
|
+
if (hasOwn3(module2, key)) {
|
|
6620
6620
|
target[key] = module2[key];
|
|
6621
6621
|
}
|
|
6622
6622
|
}
|
|
@@ -20940,11 +20940,11 @@ var require_object_inspect = __commonJS({
|
|
|
20940
20940
|
return false;
|
|
20941
20941
|
}
|
|
20942
20942
|
__name(isBigInt, "isBigInt");
|
|
20943
|
-
var
|
|
20943
|
+
var hasOwn3 = Object.prototype.hasOwnProperty || function(key) {
|
|
20944
20944
|
return key in this;
|
|
20945
20945
|
};
|
|
20946
20946
|
function has(obj, key) {
|
|
20947
|
-
return
|
|
20947
|
+
return hasOwn3.call(obj, key);
|
|
20948
20948
|
}
|
|
20949
20949
|
__name(has, "has");
|
|
20950
20950
|
function toStr(obj) {
|
|
@@ -21927,7 +21927,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
21927
21927
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
21928
21928
|
};
|
|
21929
21929
|
var bind = require_function_bind();
|
|
21930
|
-
var
|
|
21930
|
+
var hasOwn3 = require_hasown();
|
|
21931
21931
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
21932
21932
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
21933
21933
|
var $replace = bind.call($call, String.prototype.replace);
|
|
@@ -21952,11 +21952,11 @@ var require_get_intrinsic = __commonJS({
|
|
|
21952
21952
|
var getBaseIntrinsic = /* @__PURE__ */ __name(function getBaseIntrinsic2(name, allowMissing) {
|
|
21953
21953
|
var intrinsicName = name;
|
|
21954
21954
|
var alias;
|
|
21955
|
-
if (
|
|
21955
|
+
if (hasOwn3(LEGACY_ALIASES, intrinsicName)) {
|
|
21956
21956
|
alias = LEGACY_ALIASES[intrinsicName];
|
|
21957
21957
|
intrinsicName = "%" + alias[0] + "%";
|
|
21958
21958
|
}
|
|
21959
|
-
if (
|
|
21959
|
+
if (hasOwn3(INTRINSICS, intrinsicName)) {
|
|
21960
21960
|
var value = INTRINSICS[intrinsicName];
|
|
21961
21961
|
if (value === needsEval) {
|
|
21962
21962
|
value = doEval(intrinsicName);
|
|
@@ -22005,7 +22005,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
22005
22005
|
}
|
|
22006
22006
|
intrinsicBaseName += "." + part;
|
|
22007
22007
|
intrinsicRealName = "%" + intrinsicBaseName + "%";
|
|
22008
|
-
if (
|
|
22008
|
+
if (hasOwn3(INTRINSICS, intrinsicRealName)) {
|
|
22009
22009
|
value = INTRINSICS[intrinsicRealName];
|
|
22010
22010
|
} else if (value != null) {
|
|
22011
22011
|
if (!(part in value)) {
|
|
@@ -22023,7 +22023,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
22023
22023
|
value = value[part];
|
|
22024
22024
|
}
|
|
22025
22025
|
} else {
|
|
22026
|
-
isOwn =
|
|
22026
|
+
isOwn = hasOwn3(value, part);
|
|
22027
22027
|
value = value[part];
|
|
22028
22028
|
}
|
|
22029
22029
|
if (isOwn && !skipFurtherCaching) {
|
|
@@ -28588,6 +28588,9 @@ var symbolPhantomTask = Symbol.for(
|
|
|
28588
28588
|
"runner.task.phantom"
|
|
28589
28589
|
);
|
|
28590
28590
|
var symbolResource = Symbol.for("runner.resource");
|
|
28591
|
+
var symbolResourceForkedFrom = Symbol.for(
|
|
28592
|
+
"runner.resourceForkedFrom"
|
|
28593
|
+
);
|
|
28591
28594
|
var symbolResourceWithConfig = Symbol.for(
|
|
28592
28595
|
"runner.resourceWithConfig"
|
|
28593
28596
|
);
|
|
@@ -28617,88 +28620,227 @@ var symbolAsyncContext = Symbol.for(
|
|
|
28617
28620
|
"runner.asyncContext"
|
|
28618
28621
|
);
|
|
28619
28622
|
|
|
28620
|
-
// src/
|
|
28621
|
-
|
|
28622
|
-
|
|
28623
|
-
return mod.AsyncLocalStorage;
|
|
28623
|
+
// src/tools/getCallerFile.ts
|
|
28624
|
+
function isNodeInline() {
|
|
28625
|
+
return typeof process !== "undefined" && typeof process?.versions?.node === "string";
|
|
28624
28626
|
}
|
|
28625
|
-
__name(
|
|
28626
|
-
|
|
28627
|
-
|
|
28628
|
-
|
|
28629
|
-
|
|
28630
|
-
|
|
28631
|
-
|
|
28632
|
-
|
|
28633
|
-
|
|
28634
|
-
|
|
28635
|
-
|
|
28636
|
-
|
|
28637
|
-
|
|
28638
|
-
|
|
28639
|
-
|
|
28640
|
-
|
|
28641
|
-
|
|
28642
|
-
process.on("uncaughtException", h);
|
|
28643
|
-
return () => process.off("uncaughtException", h);
|
|
28644
|
-
}
|
|
28645
|
-
onUnhandledRejection(handler) {
|
|
28646
|
-
const h = /* @__PURE__ */ __name((reason) => handler(reason), "h");
|
|
28647
|
-
process.on("unhandledRejection", h);
|
|
28648
|
-
return () => process.off("unhandledRejection", h);
|
|
28649
|
-
}
|
|
28650
|
-
onShutdownSignal(handler) {
|
|
28651
|
-
process.on("SIGINT", handler);
|
|
28652
|
-
process.on("SIGTERM", handler);
|
|
28653
|
-
return () => {
|
|
28654
|
-
process.off("SIGINT", handler);
|
|
28655
|
-
process.off("SIGTERM", handler);
|
|
28656
|
-
};
|
|
28657
|
-
}
|
|
28658
|
-
exit(code) {
|
|
28659
|
-
process.exit(code);
|
|
28660
|
-
}
|
|
28661
|
-
getEnv(key) {
|
|
28662
|
-
return process.env[key];
|
|
28663
|
-
}
|
|
28664
|
-
hasAsyncLocalStorage() {
|
|
28665
|
-
return true;
|
|
28627
|
+
__name(isNodeInline, "isNodeInline");
|
|
28628
|
+
function getCallerFile() {
|
|
28629
|
+
const originalPrepare = Error.prepareStackTrace;
|
|
28630
|
+
try {
|
|
28631
|
+
if (isNodeInline()) {
|
|
28632
|
+
const err = new Error();
|
|
28633
|
+
Error.prepareStackTrace = (_err, stack2) => stack2;
|
|
28634
|
+
const stack = err.stack;
|
|
28635
|
+
stack.shift();
|
|
28636
|
+
stack.shift();
|
|
28637
|
+
const candidate = stack.shift();
|
|
28638
|
+
const file = candidate?.getFileName?.();
|
|
28639
|
+
return file;
|
|
28640
|
+
}
|
|
28641
|
+
return "unknown";
|
|
28642
|
+
} finally {
|
|
28643
|
+
Error.prepareStackTrace = originalPrepare;
|
|
28666
28644
|
}
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
|
|
28672
|
-
|
|
28673
|
-
|
|
28674
|
-
|
|
28675
|
-
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
|
|
28686
|
-
|
|
28687
|
-
|
|
28688
|
-
|
|
28689
|
-
|
|
28690
|
-
|
|
28691
|
-
|
|
28645
|
+
}
|
|
28646
|
+
__name(getCallerFile, "getCallerFile");
|
|
28647
|
+
|
|
28648
|
+
// src/defs.ts
|
|
28649
|
+
var defs_exports = {};
|
|
28650
|
+
__export(defs_exports, {
|
|
28651
|
+
CONTRACT: () => CONTRACT,
|
|
28652
|
+
HookDependencyState: () => HookDependencyState,
|
|
28653
|
+
RunnerMode: () => RunnerMode,
|
|
28654
|
+
isOneOf: () => isOneOf,
|
|
28655
|
+
onAnyOf: () => onAnyOf,
|
|
28656
|
+
symbolAsyncContext: () => symbolAsyncContext,
|
|
28657
|
+
symbolError: () => symbolError,
|
|
28658
|
+
symbolEvent: () => symbolEvent,
|
|
28659
|
+
symbolFilePath: () => symbolFilePath,
|
|
28660
|
+
symbolHook: () => symbolHook,
|
|
28661
|
+
symbolMiddleware: () => symbolMiddleware,
|
|
28662
|
+
symbolMiddlewareConfigured: () => symbolMiddlewareConfigured,
|
|
28663
|
+
symbolOptionalDependency: () => symbolOptionalDependency,
|
|
28664
|
+
symbolPhantomTask: () => symbolPhantomTask,
|
|
28665
|
+
symbolResource: () => symbolResource,
|
|
28666
|
+
symbolResourceForkedFrom: () => symbolResourceForkedFrom,
|
|
28667
|
+
symbolResourceMiddleware: () => symbolResourceMiddleware,
|
|
28668
|
+
symbolResourceWithConfig: () => symbolResourceWithConfig,
|
|
28669
|
+
symbolTag: () => symbolTag,
|
|
28670
|
+
symbolTagConfigured: () => symbolTagConfigured,
|
|
28671
|
+
symbolTask: () => symbolTask,
|
|
28672
|
+
symbolTaskMiddleware: () => symbolTaskMiddleware,
|
|
28673
|
+
symbolTunneledBy: () => symbolTunneledBy
|
|
28674
|
+
});
|
|
28675
|
+
|
|
28676
|
+
// src/types/event.ts
|
|
28677
|
+
function onAnyOf(...defs) {
|
|
28678
|
+
return defs;
|
|
28679
|
+
}
|
|
28680
|
+
__name(onAnyOf, "onAnyOf");
|
|
28681
|
+
function isOneOf(emission, defs) {
|
|
28682
|
+
return defs.some((d) => d.id === emission.id);
|
|
28683
|
+
}
|
|
28684
|
+
__name(isOneOf, "isOneOf");
|
|
28685
|
+
|
|
28686
|
+
// src/types/runner.ts
|
|
28687
|
+
var RunnerMode = /* @__PURE__ */ ((RunnerMode2) => {
|
|
28688
|
+
RunnerMode2["TEST"] = "test";
|
|
28689
|
+
RunnerMode2["DEV"] = "dev";
|
|
28690
|
+
RunnerMode2["PROD"] = "prod";
|
|
28691
|
+
return RunnerMode2;
|
|
28692
|
+
})(RunnerMode || {});
|
|
28693
|
+
|
|
28694
|
+
// src/types/contracts.ts
|
|
28695
|
+
var CONTRACT = Symbol.for("runner.contract");
|
|
28696
|
+
|
|
28697
|
+
// src/types/storeTypes.ts
|
|
28698
|
+
var HookDependencyState = /* @__PURE__ */ ((HookDependencyState2) => {
|
|
28699
|
+
HookDependencyState2["Pending"] = "pending";
|
|
28700
|
+
HookDependencyState2["Computing"] = "computing";
|
|
28701
|
+
HookDependencyState2["Ready"] = "ready";
|
|
28702
|
+
return HookDependencyState2;
|
|
28703
|
+
})(HookDependencyState || {});
|
|
28704
|
+
|
|
28705
|
+
// src/definers/tools.ts
|
|
28706
|
+
function isTask(definition) {
|
|
28707
|
+
return definition && definition[symbolTask];
|
|
28708
|
+
}
|
|
28709
|
+
__name(isTask, "isTask");
|
|
28710
|
+
function isResource(definition) {
|
|
28711
|
+
return definition && definition[symbolResource];
|
|
28712
|
+
}
|
|
28713
|
+
__name(isResource, "isResource");
|
|
28714
|
+
function isResourceWithConfig(definition) {
|
|
28715
|
+
return definition && definition[symbolResourceWithConfig];
|
|
28716
|
+
}
|
|
28717
|
+
__name(isResourceWithConfig, "isResourceWithConfig");
|
|
28718
|
+
function isEvent(definition) {
|
|
28719
|
+
return definition && definition[symbolEvent];
|
|
28720
|
+
}
|
|
28721
|
+
__name(isEvent, "isEvent");
|
|
28722
|
+
function isHook(definition) {
|
|
28723
|
+
return definition && definition[symbolHook];
|
|
28724
|
+
}
|
|
28725
|
+
__name(isHook, "isHook");
|
|
28726
|
+
function isTaskMiddleware(definition) {
|
|
28727
|
+
return definition && definition[symbolTaskMiddleware];
|
|
28728
|
+
}
|
|
28729
|
+
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
28730
|
+
function isResourceMiddleware(definition) {
|
|
28731
|
+
return definition && definition[symbolResourceMiddleware];
|
|
28732
|
+
}
|
|
28733
|
+
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
28734
|
+
function isTag(definition) {
|
|
28735
|
+
return definition && definition[symbolTag];
|
|
28736
|
+
}
|
|
28737
|
+
__name(isTag, "isTag");
|
|
28738
|
+
function isOptional(definition) {
|
|
28739
|
+
return definition && definition[symbolOptionalDependency];
|
|
28740
|
+
}
|
|
28741
|
+
__name(isOptional, "isOptional");
|
|
28742
|
+
function isError(definition) {
|
|
28743
|
+
return Boolean(definition && definition[symbolError]);
|
|
28744
|
+
}
|
|
28745
|
+
__name(isError, "isError");
|
|
28746
|
+
function isAsyncContext(definition) {
|
|
28747
|
+
return Boolean(definition && definition[symbolAsyncContext]);
|
|
28748
|
+
}
|
|
28749
|
+
__name(isAsyncContext, "isAsyncContext");
|
|
28750
|
+
|
|
28751
|
+
// src/tools/throws.ts
|
|
28752
|
+
function invalidThrowsEntryError(owner, item) {
|
|
28753
|
+
const got = item === null ? "null" : Array.isArray(item) ? "array" : typeof item === "object" ? "object" : typeof item;
|
|
28754
|
+
return new Error(
|
|
28755
|
+
`Invalid throws entry for ${owner.kind} ${owner.id}: expected error id string or Error helper, got ${got}`
|
|
28756
|
+
);
|
|
28757
|
+
}
|
|
28758
|
+
__name(invalidThrowsEntryError, "invalidThrowsEntryError");
|
|
28759
|
+
function toErrorIdList(owner, list) {
|
|
28760
|
+
const ids = [];
|
|
28761
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28762
|
+
for (const item of list) {
|
|
28763
|
+
let id2;
|
|
28764
|
+
if (typeof item === "string") {
|
|
28765
|
+
if (item.trim().length === 0) {
|
|
28766
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28692
28767
|
}
|
|
28693
|
-
|
|
28694
|
-
}
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28768
|
+
id2 = item;
|
|
28769
|
+
} else if (isError(item)) {
|
|
28770
|
+
id2 = item.id;
|
|
28771
|
+
if (typeof id2 !== "string" || id2.trim().length === 0) {
|
|
28772
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28773
|
+
}
|
|
28774
|
+
} else {
|
|
28775
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28776
|
+
}
|
|
28777
|
+
if (seen.has(id2)) continue;
|
|
28778
|
+
seen.add(id2);
|
|
28779
|
+
ids.push(id2);
|
|
28699
28780
|
}
|
|
28781
|
+
return ids;
|
|
28782
|
+
}
|
|
28783
|
+
__name(toErrorIdList, "toErrorIdList");
|
|
28784
|
+
function normalizeThrows(owner, throwsList) {
|
|
28785
|
+
if (throwsList === void 0) return void 0;
|
|
28786
|
+
return toErrorIdList(owner, throwsList);
|
|
28787
|
+
}
|
|
28788
|
+
__name(normalizeThrows, "normalizeThrows");
|
|
28789
|
+
|
|
28790
|
+
// src/definers/defineTask.ts
|
|
28791
|
+
function defineTask(taskConfig) {
|
|
28792
|
+
const filePath = getCallerFile();
|
|
28793
|
+
const id2 = taskConfig.id;
|
|
28794
|
+
return {
|
|
28795
|
+
[symbolTask]: true,
|
|
28796
|
+
[symbolFilePath]: filePath,
|
|
28797
|
+
id: id2,
|
|
28798
|
+
dependencies: taskConfig.dependencies || {},
|
|
28799
|
+
middleware: taskConfig.middleware || [],
|
|
28800
|
+
run: taskConfig.run,
|
|
28801
|
+
inputSchema: taskConfig.inputSchema,
|
|
28802
|
+
resultSchema: taskConfig.resultSchema,
|
|
28803
|
+
meta: taskConfig.meta || {},
|
|
28804
|
+
tags: taskConfig.tags || [],
|
|
28805
|
+
throws: normalizeThrows({ kind: "task", id: id2 }, taskConfig.throws),
|
|
28806
|
+
// autorun,
|
|
28807
|
+
optional() {
|
|
28808
|
+
return {
|
|
28809
|
+
inner: this,
|
|
28810
|
+
[symbolOptionalDependency]: true
|
|
28811
|
+
};
|
|
28812
|
+
}
|
|
28813
|
+
};
|
|
28814
|
+
}
|
|
28815
|
+
__name(defineTask, "defineTask");
|
|
28816
|
+
defineTask.phantom = (taskConfig) => {
|
|
28817
|
+
const taskDef = defineTask({
|
|
28818
|
+
...taskConfig,
|
|
28819
|
+
run: /* @__PURE__ */ __name(async (_input) => {
|
|
28820
|
+
return void 0;
|
|
28821
|
+
}, "run")
|
|
28822
|
+
});
|
|
28823
|
+
taskDef[symbolPhantomTask] = true;
|
|
28824
|
+
return taskDef;
|
|
28700
28825
|
};
|
|
28701
28826
|
|
|
28827
|
+
// src/definers/defineHook.ts
|
|
28828
|
+
function defineHook(hookDef) {
|
|
28829
|
+
const filePath = getCallerFile();
|
|
28830
|
+
return {
|
|
28831
|
+
[symbolHook]: true,
|
|
28832
|
+
[symbolFilePath]: filePath,
|
|
28833
|
+
id: hookDef.id,
|
|
28834
|
+
dependencies: hookDef.dependencies || {},
|
|
28835
|
+
on: hookDef.on,
|
|
28836
|
+
order: hookDef.order,
|
|
28837
|
+
run: hookDef.run,
|
|
28838
|
+
meta: hookDef.meta || {},
|
|
28839
|
+
tags: hookDef.tags || []
|
|
28840
|
+
};
|
|
28841
|
+
}
|
|
28842
|
+
__name(defineHook, "defineHook");
|
|
28843
|
+
|
|
28702
28844
|
// src/errors.ts
|
|
28703
28845
|
var errors_exports = {};
|
|
28704
28846
|
__export(errors_exports, {
|
|
@@ -28740,9 +28882,10 @@ var RunnerError = class extends Error {
|
|
|
28740
28882
|
var _a;
|
|
28741
28883
|
_a = symbolError;
|
|
28742
28884
|
var ErrorHelper = class {
|
|
28743
|
-
constructor(definition) {
|
|
28885
|
+
constructor(definition, filePath) {
|
|
28744
28886
|
this.definition = definition;
|
|
28745
28887
|
this[_a] = true;
|
|
28888
|
+
this[symbolFilePath] = filePath;
|
|
28746
28889
|
}
|
|
28747
28890
|
static {
|
|
28748
28891
|
__name(this, "ErrorHelper");
|
|
@@ -28765,11 +28908,15 @@ var ErrorHelper = class {
|
|
|
28765
28908
|
};
|
|
28766
28909
|
}
|
|
28767
28910
|
};
|
|
28768
|
-
function defineError(definition) {
|
|
28911
|
+
function defineError(definition, filePath) {
|
|
28769
28912
|
if (!definition.format) {
|
|
28770
28913
|
definition.format = (data) => `${JSON.stringify(data)}`;
|
|
28771
28914
|
}
|
|
28772
|
-
|
|
28915
|
+
const resolvedFilePath = filePath ?? getCallerFile();
|
|
28916
|
+
return new ErrorHelper(
|
|
28917
|
+
definition,
|
|
28918
|
+
resolvedFilePath
|
|
28919
|
+
);
|
|
28773
28920
|
}
|
|
28774
28921
|
__name(defineError, "defineError");
|
|
28775
28922
|
|
|
@@ -28807,14 +28954,17 @@ function makeErrorBuilder(state) {
|
|
|
28807
28954
|
return makeErrorBuilder(next);
|
|
28808
28955
|
},
|
|
28809
28956
|
build() {
|
|
28810
|
-
return defineError(
|
|
28811
|
-
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28957
|
+
return defineError(
|
|
28958
|
+
{
|
|
28959
|
+
id: state.id,
|
|
28960
|
+
serialize: state.serialize,
|
|
28961
|
+
parse: state.parse,
|
|
28962
|
+
dataSchema: state.dataSchema,
|
|
28963
|
+
format: state.format,
|
|
28964
|
+
meta: state.meta
|
|
28965
|
+
},
|
|
28966
|
+
state.filePath
|
|
28967
|
+
);
|
|
28818
28968
|
}
|
|
28819
28969
|
};
|
|
28820
28970
|
return builder;
|
|
@@ -28823,8 +28973,10 @@ __name(makeErrorBuilder, "makeErrorBuilder");
|
|
|
28823
28973
|
|
|
28824
28974
|
// src/definers/builders/error/index.ts
|
|
28825
28975
|
function errorBuilder(id2) {
|
|
28976
|
+
const filePath = getCallerFile();
|
|
28826
28977
|
const initial = Object.freeze({
|
|
28827
28978
|
id: id2,
|
|
28979
|
+
filePath,
|
|
28828
28980
|
serialize: void 0,
|
|
28829
28981
|
parse: void 0,
|
|
28830
28982
|
dataSchema: void 0,
|
|
@@ -28835,103 +28987,87 @@ function errorBuilder(id2) {
|
|
|
28835
28987
|
__name(errorBuilder, "errorBuilder");
|
|
28836
28988
|
var error = errorBuilder;
|
|
28837
28989
|
|
|
28838
|
-
// src/
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
var dependencyNotFoundError = error("runner.errors.dependencyNotFound").format(
|
|
28843
|
-
({ key }) => `Dependency ${key.toString()} not found. Did you forget to register it through a resource?`
|
|
28844
|
-
).build();
|
|
28845
|
-
var unknownItemTypeError = error(
|
|
28846
|
-
"runner.errors.unknownItemType"
|
|
28847
|
-
).format(
|
|
28848
|
-
({ item }) => `Unknown item type: ${String(
|
|
28849
|
-
item
|
|
28850
|
-
)}. Please ensure you are not using different versions of '@bluelibs/runner'`
|
|
28851
|
-
).build();
|
|
28852
|
-
var contextError = error(
|
|
28853
|
-
"runner.errors.context"
|
|
28854
|
-
).format(({ details }) => details ?? "Context error").build();
|
|
28855
|
-
var circularDependenciesError = error("runner.errors.circularDependencies").format(({ cycles }) => {
|
|
28856
|
-
const cycleDetails = cycles.map((cycle) => ` \u2022 ${cycle}`).join("\n");
|
|
28857
|
-
const hasMiddleware = cycles.some((cycle) => cycle.includes("middleware"));
|
|
28858
|
-
let guidance = "\n\nTo resolve circular dependencies:";
|
|
28859
|
-
guidance += "\n \u2022 Consider refactoring to reduce coupling between components";
|
|
28860
|
-
guidance += "\n \u2022 Extract shared dependencies into separate resources";
|
|
28861
|
-
if (hasMiddleware) {
|
|
28862
|
-
guidance += "\n \u2022 For middleware: you can filter out tasks/resources using everywhere(fn)";
|
|
28863
|
-
guidance += "\n \u2022 Consider using events for communication instead of direct dependencies";
|
|
28864
|
-
}
|
|
28865
|
-
return `Circular dependencies detected:
|
|
28866
|
-
${cycleDetails}${guidance}`;
|
|
28867
|
-
}).build();
|
|
28868
|
-
var eventNotFoundError = error(
|
|
28869
|
-
"runner.errors.eventNotFound"
|
|
28870
|
-
).format(
|
|
28871
|
-
({ id: id2 }) => `Event "${id2.toString()}" not found. Did you forget to register it?`
|
|
28872
|
-
).build();
|
|
28873
|
-
var resourceNotFoundError = error(
|
|
28874
|
-
"runner.errors.resourceNotFound"
|
|
28875
|
-
).format(
|
|
28876
|
-
({ id: id2 }) => `Resource "${id2.toString()}" not found. Did you forget to register it or are you using the correct id?`
|
|
28877
|
-
).build();
|
|
28878
|
-
var middlewareNotRegisteredError = error("runner.errors.middlewareNotRegistered").format(
|
|
28879
|
-
({ type, source, middlewareId }) => `Middleware inside ${type} "${source}" depends on "${middlewareId}" but it's not registered. Did you forget to register it?`
|
|
28880
|
-
).build();
|
|
28881
|
-
var tagNotFoundError = error(
|
|
28882
|
-
"runner.errors.tagNotFound"
|
|
28883
|
-
).format(
|
|
28884
|
-
({ id: id2 }) => `Tag "${id2}" not registered. Did you forget to register it inside a resource?`
|
|
28885
|
-
).build();
|
|
28886
|
-
var lockedError = error(
|
|
28887
|
-
"runner.errors.locked"
|
|
28888
|
-
).format(
|
|
28889
|
-
({ what }) => `Cannot modify the ${what.toString()} when it is locked.`
|
|
28890
|
-
).build();
|
|
28891
|
-
var storeAlreadyInitializedError = error(
|
|
28892
|
-
"runner.errors.storeAlreadyInitialized"
|
|
28893
|
-
).format(() => "Store already initialized. Cannot reinitialize.").build();
|
|
28894
|
-
var validationError = error("runner.errors.validation").format(({ subject, id: id2, originalError }) => {
|
|
28895
|
-
const errorMessage2 = originalError instanceof Error ? originalError.message : String(originalError);
|
|
28896
|
-
return `${subject} validation failed for ${id2.toString()}: ${errorMessage2}`;
|
|
28897
|
-
}).build();
|
|
28898
|
-
var eventCycleError = error("runner.errors.eventCycle").format(({ path: path4 }) => {
|
|
28899
|
-
const chain = path4.map((p) => `${p.id}\u2190${p.source}`).join(" -> ");
|
|
28900
|
-
return `Event emission cycle detected:
|
|
28901
|
-
${chain}
|
|
28902
|
-
|
|
28903
|
-
Break the cycle by changing hook logic (avoid mutual emits) or gate with conditions/tags.`;
|
|
28904
|
-
}).build();
|
|
28905
|
-
var eventEmissionCycleError = error("runner.errors.eventEmissionCycle").format(({ cycles }) => {
|
|
28906
|
-
const list = cycles.map((c) => ` \u2022 ${c}`).join("\n");
|
|
28907
|
-
return `Event emission cycles detected between hooks and events:
|
|
28908
|
-
${list}
|
|
28909
|
-
|
|
28910
|
-
This was detected at compile time (dry-run). Break the cycle by avoiding mutual emits between hooks or scoping hooks using tags.`;
|
|
28911
|
-
}).build();
|
|
28912
|
-
var platformUnsupportedFunctionError = error("runner.errors.platformUnsupportedFunction").format(
|
|
28913
|
-
({ functionName }) => `Platform function not supported in this environment: ${functionName}. Detected platform: ${detectEnvironment()}.`
|
|
28914
|
-
).build();
|
|
28915
|
-
var cancellationError = error(
|
|
28916
|
-
"runner.errors.cancellation"
|
|
28917
|
-
).format(({ reason }) => reason || "Operation cancelled").build();
|
|
28918
|
-
var tunnelOwnershipConflictError = error("runner.errors.tunnelOwnershipConflict").format(
|
|
28919
|
-
({ 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.`
|
|
28920
|
-
).build();
|
|
28921
|
-
var phantomTaskNotRoutedError = error("runner.errors.phantomTaskNotRouted").format(
|
|
28922
|
-
({ 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).`
|
|
28923
|
-
).build();
|
|
28924
|
-
var taskNotRegisteredError = error("runner.errors.taskNotRegistered").format(
|
|
28925
|
-
({ taskId }) => `Task "${taskId}" is not registered in the Store. This is an internal error\u2014ensure the task is registered before execution.`
|
|
28926
|
-
).build();
|
|
28927
|
-
var builderIncompleteError = error("runner.errors.builderIncomplete").format(({ type, builderId, missingFields }) => {
|
|
28928
|
-
const typeLabel = type === "hook" ? "Hook" : type === "task-middleware" ? "Task middleware" : "Resource middleware";
|
|
28929
|
-
return `${typeLabel} "${builderId}" is incomplete. Missing required: ${missingFields.join(", ")}. Call ${missingFields.map((f) => `.${f}()`).join(" and ")} before .build().`;
|
|
28930
|
-
}).build();
|
|
28931
|
-
function isCancellationError(err) {
|
|
28932
|
-
return cancellationError.is(err);
|
|
28990
|
+
// src/platform/adapters/node-als.ts
|
|
28991
|
+
async function loadAsyncLocalStorageClass() {
|
|
28992
|
+
const mod = __require("async_hooks");
|
|
28993
|
+
return mod.AsyncLocalStorage;
|
|
28933
28994
|
}
|
|
28934
|
-
__name(
|
|
28995
|
+
__name(loadAsyncLocalStorageClass, "loadAsyncLocalStorageClass");
|
|
28996
|
+
|
|
28997
|
+
// src/platform/adapters/node.ts
|
|
28998
|
+
var NodePlatformAdapter = class {
|
|
28999
|
+
constructor() {
|
|
29000
|
+
this.id = "node";
|
|
29001
|
+
this.setTimeout = globalThis.setTimeout;
|
|
29002
|
+
this.clearTimeout = globalThis.clearTimeout;
|
|
29003
|
+
}
|
|
29004
|
+
static {
|
|
29005
|
+
__name(this, "NodePlatformAdapter");
|
|
29006
|
+
}
|
|
29007
|
+
async init() {
|
|
29008
|
+
this.alsClass = await loadAsyncLocalStorageClass();
|
|
29009
|
+
}
|
|
29010
|
+
onUncaughtException(handler) {
|
|
29011
|
+
const h = /* @__PURE__ */ __name((error2) => handler(error2), "h");
|
|
29012
|
+
process.on("uncaughtException", h);
|
|
29013
|
+
return () => process.off("uncaughtException", h);
|
|
29014
|
+
}
|
|
29015
|
+
onUnhandledRejection(handler) {
|
|
29016
|
+
const h = /* @__PURE__ */ __name((reason) => handler(reason), "h");
|
|
29017
|
+
process.on("unhandledRejection", h);
|
|
29018
|
+
return () => process.off("unhandledRejection", h);
|
|
29019
|
+
}
|
|
29020
|
+
onShutdownSignal(handler) {
|
|
29021
|
+
process.on("SIGINT", handler);
|
|
29022
|
+
process.on("SIGTERM", handler);
|
|
29023
|
+
return () => {
|
|
29024
|
+
process.off("SIGINT", handler);
|
|
29025
|
+
process.off("SIGTERM", handler);
|
|
29026
|
+
};
|
|
29027
|
+
}
|
|
29028
|
+
exit(code) {
|
|
29029
|
+
process.exit(code);
|
|
29030
|
+
}
|
|
29031
|
+
getEnv(key) {
|
|
29032
|
+
return process.env[key];
|
|
29033
|
+
}
|
|
29034
|
+
hasAsyncLocalStorage() {
|
|
29035
|
+
return true;
|
|
29036
|
+
}
|
|
29037
|
+
createAsyncLocalStorage() {
|
|
29038
|
+
let instance;
|
|
29039
|
+
const ensure = /* @__PURE__ */ __name(() => {
|
|
29040
|
+
if (!this.alsClass) {
|
|
29041
|
+
let als;
|
|
29042
|
+
const forceNoop = typeof process !== "undefined" && !!process.env?.RUNNER_FORCE_NOOP_ALS;
|
|
29043
|
+
if (!forceNoop) {
|
|
29044
|
+
try {
|
|
29045
|
+
const mod = __require("async_hooks");
|
|
29046
|
+
als = mod?.AsyncLocalStorage;
|
|
29047
|
+
} catch (_) {
|
|
29048
|
+
als = void 0;
|
|
29049
|
+
}
|
|
29050
|
+
}
|
|
29051
|
+
this.alsClass = als || class NoopAsyncLocalStorage {
|
|
29052
|
+
static {
|
|
29053
|
+
__name(this, "NoopAsyncLocalStorage");
|
|
29054
|
+
}
|
|
29055
|
+
getStore() {
|
|
29056
|
+
return void 0;
|
|
29057
|
+
}
|
|
29058
|
+
run(_store, callback) {
|
|
29059
|
+
return callback();
|
|
29060
|
+
}
|
|
29061
|
+
};
|
|
29062
|
+
}
|
|
29063
|
+
return instance ??= new this.alsClass();
|
|
29064
|
+
}, "ensure");
|
|
29065
|
+
return {
|
|
29066
|
+
getStore: /* @__PURE__ */ __name(() => ensure().getStore(), "getStore"),
|
|
29067
|
+
run: /* @__PURE__ */ __name((store2, callback) => ensure().run(store2, callback), "run")
|
|
29068
|
+
};
|
|
29069
|
+
}
|
|
29070
|
+
};
|
|
28935
29071
|
|
|
28936
29072
|
// src/platform/adapters/browser.ts
|
|
28937
29073
|
var BrowserPlatformAdapter = class {
|
|
@@ -29224,16 +29360,11 @@ function setPlatform(adapter) {
|
|
|
29224
29360
|
adapter.id;
|
|
29225
29361
|
}
|
|
29226
29362
|
__name(setPlatform, "setPlatform");
|
|
29227
|
-
function isNode() {
|
|
29228
|
-
{
|
|
29229
|
-
return true;
|
|
29230
|
-
}
|
|
29231
|
-
}
|
|
29232
|
-
__name(isNode, "isNode");
|
|
29233
29363
|
var PlatformAdapter = class {
|
|
29364
|
+
static {
|
|
29365
|
+
__name(this, "PlatformAdapter");
|
|
29366
|
+
}
|
|
29234
29367
|
constructor(env) {
|
|
29235
|
-
this.setTimeout = globalThis.setTimeout;
|
|
29236
|
-
this.clearTimeout = globalThis.clearTimeout;
|
|
29237
29368
|
const kind = env ?? detectEnvironment();
|
|
29238
29369
|
this.env = kind;
|
|
29239
29370
|
switch (kind) {
|
|
@@ -29253,9 +29384,8 @@ var PlatformAdapter = class {
|
|
|
29253
29384
|
this.inner = new UniversalPlatformAdapter();
|
|
29254
29385
|
}
|
|
29255
29386
|
this.id = this.inner.id;
|
|
29256
|
-
|
|
29257
|
-
|
|
29258
|
-
__name(this, "PlatformAdapter");
|
|
29387
|
+
this.setTimeout = this.inner.setTimeout;
|
|
29388
|
+
this.clearTimeout = this.inner.clearTimeout;
|
|
29259
29389
|
}
|
|
29260
29390
|
async init() {
|
|
29261
29391
|
return this.inner.init();
|
|
@@ -29283,208 +29413,285 @@ var PlatformAdapter = class {
|
|
|
29283
29413
|
}
|
|
29284
29414
|
};
|
|
29285
29415
|
|
|
29286
|
-
// src/
|
|
29287
|
-
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29293
|
-
|
|
29294
|
-
|
|
29295
|
-
|
|
29296
|
-
|
|
29297
|
-
|
|
29298
|
-
|
|
29299
|
-
|
|
29300
|
-
|
|
29301
|
-
|
|
29302
|
-
|
|
29416
|
+
// src/errors.ts
|
|
29417
|
+
var duplicateRegistrationError = error("runner.errors.duplicateRegistration").format(
|
|
29418
|
+
({ 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.`
|
|
29419
|
+
).build();
|
|
29420
|
+
var dependencyNotFoundError = error("runner.errors.dependencyNotFound").format(
|
|
29421
|
+
({ key }) => `Dependency ${key.toString()} not found. Did you forget to register it through a resource?`
|
|
29422
|
+
).build();
|
|
29423
|
+
var unknownItemTypeError = error(
|
|
29424
|
+
"runner.errors.unknownItemType"
|
|
29425
|
+
).format(
|
|
29426
|
+
({ item }) => `Unknown item type: ${String(
|
|
29427
|
+
item
|
|
29428
|
+
)}. Please ensure you are not using different versions of '@bluelibs/runner'`
|
|
29429
|
+
).build();
|
|
29430
|
+
var contextError = error(
|
|
29431
|
+
"runner.errors.context"
|
|
29432
|
+
).format(({ details }) => details ?? "Context error").build();
|
|
29433
|
+
var circularDependenciesError = error("runner.errors.circularDependencies").format(({ cycles }) => {
|
|
29434
|
+
const cycleDetails = cycles.map((cycle) => ` \u2022 ${cycle}`).join("\n");
|
|
29435
|
+
const hasMiddleware = cycles.some((cycle) => cycle.includes("middleware"));
|
|
29436
|
+
let guidance = "\n\nTo resolve circular dependencies:";
|
|
29437
|
+
guidance += "\n \u2022 Consider refactoring to reduce coupling between components";
|
|
29438
|
+
guidance += "\n \u2022 Extract shared dependencies into separate resources";
|
|
29439
|
+
if (hasMiddleware) {
|
|
29440
|
+
guidance += "\n \u2022 For middleware: you can filter out tasks/resources using everywhere(fn)";
|
|
29441
|
+
guidance += "\n \u2022 Consider using events for communication instead of direct dependencies";
|
|
29303
29442
|
}
|
|
29304
|
-
|
|
29305
|
-
|
|
29306
|
-
|
|
29307
|
-
|
|
29308
|
-
|
|
29309
|
-
|
|
29310
|
-
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
|
|
29317
|
-
|
|
29318
|
-
|
|
29319
|
-
|
|
29320
|
-
|
|
29321
|
-
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
|
|
29328
|
-
|
|
29329
|
-
|
|
29330
|
-
|
|
29331
|
-
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
|
|
29335
|
-
}
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29443
|
+
return `Circular dependencies detected:
|
|
29444
|
+
${cycleDetails}${guidance}`;
|
|
29445
|
+
}).build();
|
|
29446
|
+
var eventNotFoundError = error(
|
|
29447
|
+
"runner.errors.eventNotFound"
|
|
29448
|
+
).format(
|
|
29449
|
+
({ id: id2 }) => `Event "${id2.toString()}" not found. Did you forget to register it?`
|
|
29450
|
+
).build();
|
|
29451
|
+
var resourceNotFoundError = error(
|
|
29452
|
+
"runner.errors.resourceNotFound"
|
|
29453
|
+
).format(
|
|
29454
|
+
({ id: id2 }) => `Resource "${id2.toString()}" not found. Did you forget to register it or are you using the correct id?`
|
|
29455
|
+
).build();
|
|
29456
|
+
var middlewareNotRegisteredError = error("runner.errors.middlewareNotRegistered").format(
|
|
29457
|
+
({ type, source, middlewareId }) => `Middleware inside ${type} "${source}" depends on "${middlewareId}" but it's not registered. Did you forget to register it?`
|
|
29458
|
+
).build();
|
|
29459
|
+
var tagNotFoundError = error(
|
|
29460
|
+
"runner.errors.tagNotFound"
|
|
29461
|
+
).format(
|
|
29462
|
+
({ id: id2 }) => `Tag "${id2}" not registered. Did you forget to register it inside a resource?`
|
|
29463
|
+
).build();
|
|
29464
|
+
var lockedError = error(
|
|
29465
|
+
"runner.errors.locked"
|
|
29466
|
+
).format(
|
|
29467
|
+
({ what }) => `Cannot modify the ${what.toString()} when it is locked.`
|
|
29468
|
+
).build();
|
|
29469
|
+
var storeAlreadyInitializedError = error(
|
|
29470
|
+
"runner.errors.storeAlreadyInitialized"
|
|
29471
|
+
).format(() => "Store already initialized. Cannot reinitialize.").build();
|
|
29472
|
+
var validationError = error("runner.errors.validation").format(({ subject, id: id2, originalError }) => {
|
|
29473
|
+
const errorMessage2 = originalError instanceof Error ? originalError.message : String(originalError);
|
|
29474
|
+
return `${subject} validation failed for ${id2.toString()}: ${errorMessage2}`;
|
|
29475
|
+
}).build();
|
|
29476
|
+
var eventCycleError = error("runner.errors.eventCycle").format(({ path: path4 }) => {
|
|
29477
|
+
const chain = path4.map((p) => `${p.id}\u2190${p.source}`).join(" -> ");
|
|
29478
|
+
return `Event emission cycle detected:
|
|
29479
|
+
${chain}
|
|
29341
29480
|
|
|
29342
|
-
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
})(RunnerMode || {});
|
|
29481
|
+
Break the cycle by changing hook logic (avoid mutual emits) or gate with conditions/tags.`;
|
|
29482
|
+
}).build();
|
|
29483
|
+
var eventEmissionCycleError = error("runner.errors.eventEmissionCycle").format(({ cycles }) => {
|
|
29484
|
+
const list = cycles.map((c) => ` \u2022 ${c}`).join("\n");
|
|
29485
|
+
return `Event emission cycles detected between hooks and events:
|
|
29486
|
+
${list}
|
|
29349
29487
|
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
}
|
|
29354
|
-
|
|
29355
|
-
|
|
29356
|
-
|
|
29357
|
-
}
|
|
29358
|
-
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
|
|
29362
|
-
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
}
|
|
29366
|
-
|
|
29367
|
-
|
|
29368
|
-
|
|
29369
|
-
}
|
|
29370
|
-
|
|
29371
|
-
function
|
|
29372
|
-
return
|
|
29373
|
-
}
|
|
29374
|
-
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
29375
|
-
function isResourceMiddleware(definition) {
|
|
29376
|
-
return definition && definition[symbolResourceMiddleware];
|
|
29377
|
-
}
|
|
29378
|
-
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
29379
|
-
function isTag(definition) {
|
|
29380
|
-
return definition && definition[symbolTag];
|
|
29381
|
-
}
|
|
29382
|
-
__name(isTag, "isTag");
|
|
29383
|
-
function isOptional(definition) {
|
|
29384
|
-
return definition && definition[symbolOptionalDependency];
|
|
29385
|
-
}
|
|
29386
|
-
__name(isOptional, "isOptional");
|
|
29387
|
-
function isError(definition) {
|
|
29388
|
-
return Boolean(definition && definition[symbolError]);
|
|
29389
|
-
}
|
|
29390
|
-
__name(isError, "isError");
|
|
29391
|
-
function isAsyncContext(definition) {
|
|
29392
|
-
return Boolean(definition && definition[symbolAsyncContext]);
|
|
29488
|
+
This was detected at compile time (dry-run). Break the cycle by avoiding mutual emits between hooks or scoping hooks using tags.`;
|
|
29489
|
+
}).build();
|
|
29490
|
+
var platformUnsupportedFunctionError = error("runner.errors.platformUnsupportedFunction").format(
|
|
29491
|
+
({ functionName }) => `Platform function not supported in this environment: ${functionName}. Detected platform: ${detectEnvironment()}.`
|
|
29492
|
+
).build();
|
|
29493
|
+
var cancellationError = error(
|
|
29494
|
+
"runner.errors.cancellation"
|
|
29495
|
+
).format(({ reason }) => reason || "Operation cancelled").build();
|
|
29496
|
+
var tunnelOwnershipConflictError = error("runner.errors.tunnelOwnershipConflict").format(
|
|
29497
|
+
({ 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.`
|
|
29498
|
+
).build();
|
|
29499
|
+
var phantomTaskNotRoutedError = error("runner.errors.phantomTaskNotRouted").format(
|
|
29500
|
+
({ 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).`
|
|
29501
|
+
).build();
|
|
29502
|
+
var taskNotRegisteredError = error("runner.errors.taskNotRegistered").format(
|
|
29503
|
+
({ taskId }) => `Task "${taskId}" is not registered in the Store. This is an internal error\u2014ensure the task is registered before execution.`
|
|
29504
|
+
).build();
|
|
29505
|
+
var builderIncompleteError = error("runner.errors.builderIncomplete").format(({ type, builderId, missingFields }) => {
|
|
29506
|
+
const typeLabel = type === "hook" ? "Hook" : type === "task-middleware" ? "Task middleware" : "Resource middleware";
|
|
29507
|
+
return `${typeLabel} "${builderId}" is incomplete. Missing required: ${missingFields.join(", ")}. Call ${missingFields.map((f) => `.${f}()`).join(" and ")} before .build().`;
|
|
29508
|
+
}).build();
|
|
29509
|
+
function isCancellationError(err) {
|
|
29510
|
+
return cancellationError.is(err);
|
|
29393
29511
|
}
|
|
29394
|
-
__name(
|
|
29512
|
+
__name(isCancellationError, "isCancellationError");
|
|
29395
29513
|
|
|
29396
|
-
// src/
|
|
29397
|
-
function
|
|
29398
|
-
const
|
|
29399
|
-
|
|
29400
|
-
|
|
29401
|
-
|
|
29514
|
+
// src/definers/resourceFork.ts
|
|
29515
|
+
function resolveReId(forkId, options) {
|
|
29516
|
+
const fallback = /* @__PURE__ */ __name((id2) => `${forkId}.${id2}`, "fallback");
|
|
29517
|
+
const reId = options?.reId ?? fallback;
|
|
29518
|
+
return (id2) => {
|
|
29519
|
+
const next = reId(id2);
|
|
29520
|
+
if (typeof next !== "string" || next.length === 0) {
|
|
29521
|
+
throw new Error(`fork(reId) must return a non-empty string for "${id2}"`);
|
|
29522
|
+
}
|
|
29523
|
+
return next;
|
|
29524
|
+
};
|
|
29402
29525
|
}
|
|
29403
|
-
__name(
|
|
29404
|
-
function
|
|
29405
|
-
const
|
|
29406
|
-
|
|
29407
|
-
|
|
29408
|
-
|
|
29409
|
-
|
|
29410
|
-
|
|
29411
|
-
|
|
29526
|
+
__name(resolveReId, "resolveReId");
|
|
29527
|
+
function remapResourceDependenciesInObject(deps, options) {
|
|
29528
|
+
const remapObject = /* @__PURE__ */ __name((deps2) => {
|
|
29529
|
+
const out = { ...deps2 };
|
|
29530
|
+
for (const [key, value] of Object.entries(deps2)) {
|
|
29531
|
+
if (isOptional(value)) {
|
|
29532
|
+
const inner = value.inner;
|
|
29533
|
+
if (isResource(inner)) {
|
|
29534
|
+
const forked = options.getForkedResourceByBaseId(inner.id);
|
|
29535
|
+
if (forked) {
|
|
29536
|
+
out[key] = { ...value, inner: forked };
|
|
29537
|
+
}
|
|
29538
|
+
}
|
|
29539
|
+
continue;
|
|
29412
29540
|
}
|
|
29413
|
-
|
|
29414
|
-
|
|
29415
|
-
|
|
29416
|
-
|
|
29417
|
-
|
|
29541
|
+
if (isResource(value)) {
|
|
29542
|
+
const forked = options.getForkedResourceByBaseId(value.id);
|
|
29543
|
+
if (forked) {
|
|
29544
|
+
out[key] = forked;
|
|
29545
|
+
}
|
|
29418
29546
|
}
|
|
29419
|
-
} else {
|
|
29420
|
-
throw invalidThrowsEntryError(owner, item);
|
|
29421
29547
|
}
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
|
|
29425
|
-
}
|
|
29426
|
-
return ids;
|
|
29548
|
+
return out;
|
|
29549
|
+
}, "remapObject");
|
|
29550
|
+
return remapObject(deps);
|
|
29427
29551
|
}
|
|
29428
|
-
__name(
|
|
29429
|
-
function
|
|
29430
|
-
|
|
29431
|
-
|
|
29552
|
+
__name(remapResourceDependenciesInObject, "remapResourceDependenciesInObject");
|
|
29553
|
+
function toResourceOnlyRegisterItems(items) {
|
|
29554
|
+
const out = [];
|
|
29555
|
+
for (const item of items) {
|
|
29556
|
+
if (isResourceWithConfig(item)) {
|
|
29557
|
+
out.push({
|
|
29558
|
+
kind: "withConfig",
|
|
29559
|
+
resource: item.resource,
|
|
29560
|
+
config: item.config
|
|
29561
|
+
});
|
|
29562
|
+
continue;
|
|
29563
|
+
}
|
|
29564
|
+
if (isResource(item)) {
|
|
29565
|
+
out.push({ kind: "resource", resource: item });
|
|
29566
|
+
continue;
|
|
29567
|
+
}
|
|
29568
|
+
}
|
|
29569
|
+
return out;
|
|
29432
29570
|
}
|
|
29433
|
-
__name(
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
const
|
|
29438
|
-
|
|
29439
|
-
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
|
|
29448
|
-
|
|
29449
|
-
|
|
29450
|
-
|
|
29451
|
-
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
|
|
29455
|
-
|
|
29571
|
+
__name(toResourceOnlyRegisterItems, "toResourceOnlyRegisterItems");
|
|
29572
|
+
function createDeepForkContext(forkId, options) {
|
|
29573
|
+
const reId = resolveReId(forkId, options);
|
|
29574
|
+
const forkedResourceByBaseId = /* @__PURE__ */ new Map();
|
|
29575
|
+
const ensureForked = /* @__PURE__ */ __name((base) => {
|
|
29576
|
+
const cached = forkedResourceByBaseId.get(base.id);
|
|
29577
|
+
if (cached) return cached;
|
|
29578
|
+
const forked = base.fork(reId(base.id), { register: "drop" });
|
|
29579
|
+
forkedResourceByBaseId.set(base.id, forked);
|
|
29580
|
+
const baseRegister = base.register;
|
|
29581
|
+
const ensureForkedForRegisterConfig = /* @__PURE__ */ __name((config) => {
|
|
29582
|
+
const items = typeof baseRegister === "function" ? baseRegister(config) : baseRegister;
|
|
29583
|
+
for (const candidate of toResourceOnlyRegisterItems(items)) {
|
|
29584
|
+
ensureForked(candidate.resource);
|
|
29585
|
+
}
|
|
29586
|
+
return items;
|
|
29587
|
+
}, "ensureForkedForRegisterConfig");
|
|
29588
|
+
const mapRegisterItems2 = /* @__PURE__ */ __name((items) => {
|
|
29589
|
+
const resourceItems = toResourceOnlyRegisterItems(items);
|
|
29590
|
+
const out = [];
|
|
29591
|
+
for (const candidate of resourceItems) {
|
|
29592
|
+
if (candidate.kind === "resource") {
|
|
29593
|
+
out.push(ensureForked(candidate.resource));
|
|
29594
|
+
continue;
|
|
29595
|
+
}
|
|
29596
|
+
out.push(ensureForked(candidate.resource).with(candidate.config));
|
|
29597
|
+
}
|
|
29598
|
+
return out;
|
|
29599
|
+
}, "mapRegisterItems");
|
|
29600
|
+
forked.register = typeof baseRegister === "function" ? (config) => {
|
|
29601
|
+
const items = ensureForkedForRegisterConfig(config);
|
|
29602
|
+
return mapRegisterItems2(items);
|
|
29603
|
+
} : (() => {
|
|
29604
|
+
ensureForkedForRegisterConfig(void 0);
|
|
29605
|
+
return mapRegisterItems2(baseRegister);
|
|
29606
|
+
})();
|
|
29607
|
+
const baseDependencies = base.dependencies;
|
|
29608
|
+
const remapDepsObject = /* @__PURE__ */ __name((deps) => remapResourceDependenciesInObject(deps, {
|
|
29609
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29610
|
+
}), "remapDepsObject");
|
|
29611
|
+
if (!baseDependencies) {
|
|
29612
|
+
forked.dependencies = baseDependencies;
|
|
29613
|
+
} else {
|
|
29614
|
+
forked.dependencies = (config) => {
|
|
29615
|
+
ensureForkedForRegisterConfig(config);
|
|
29616
|
+
const deps = typeof baseDependencies === "function" ? baseDependencies(config) : baseDependencies;
|
|
29617
|
+
return remapDepsObject(deps);
|
|
29456
29618
|
};
|
|
29457
29619
|
}
|
|
29620
|
+
return forked;
|
|
29621
|
+
}, "ensureForked");
|
|
29622
|
+
const ensureForkedForRegisterItems = /* @__PURE__ */ __name((items) => {
|
|
29623
|
+
for (const candidate of toResourceOnlyRegisterItems(items)) {
|
|
29624
|
+
ensureForked(candidate.resource);
|
|
29625
|
+
}
|
|
29626
|
+
}, "ensureForkedForRegisterItems");
|
|
29627
|
+
const mapRegisterItems = /* @__PURE__ */ __name((items) => {
|
|
29628
|
+
ensureForkedForRegisterItems(items);
|
|
29629
|
+
const resourceItems = toResourceOnlyRegisterItems(items);
|
|
29630
|
+
const out = [];
|
|
29631
|
+
for (const candidate of resourceItems) {
|
|
29632
|
+
if (candidate.kind === "resource") {
|
|
29633
|
+
out.push(ensureForked(candidate.resource));
|
|
29634
|
+
continue;
|
|
29635
|
+
}
|
|
29636
|
+
out.push(ensureForked(candidate.resource).with(candidate.config));
|
|
29637
|
+
}
|
|
29638
|
+
return out;
|
|
29639
|
+
}, "mapRegisterItems");
|
|
29640
|
+
const remapDependencies = /* @__PURE__ */ __name((dependencies) => {
|
|
29641
|
+
if (!dependencies) return dependencies;
|
|
29642
|
+
const remapObj = /* @__PURE__ */ __name((deps) => remapResourceDependenciesInObject(deps, {
|
|
29643
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29644
|
+
}), "remapObj");
|
|
29645
|
+
if (typeof dependencies === "function") {
|
|
29646
|
+
return (config) => remapObj(dependencies(config));
|
|
29647
|
+
}
|
|
29648
|
+
return remapObj(dependencies);
|
|
29649
|
+
}, "remapDependencies");
|
|
29650
|
+
return {
|
|
29651
|
+
reId,
|
|
29652
|
+
ensureForkedForRegisterItems,
|
|
29653
|
+
mapRegisterItems,
|
|
29654
|
+
remapDependencies,
|
|
29655
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29458
29656
|
};
|
|
29459
29657
|
}
|
|
29460
|
-
__name(
|
|
29461
|
-
|
|
29462
|
-
const
|
|
29463
|
-
|
|
29464
|
-
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
|
|
29468
|
-
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29658
|
+
__name(createDeepForkContext, "createDeepForkContext");
|
|
29659
|
+
function resolveForkedRegisterAndDependencies(params) {
|
|
29660
|
+
const { register, dependencies, forkId, options } = params;
|
|
29661
|
+
const mode = options?.register ?? "keep";
|
|
29662
|
+
if (mode === "drop") {
|
|
29663
|
+
return { register: [], dependencies };
|
|
29664
|
+
}
|
|
29665
|
+
if (mode !== "deep") {
|
|
29666
|
+
return { register, dependencies };
|
|
29667
|
+
}
|
|
29668
|
+
if (!register) {
|
|
29669
|
+
return { register, dependencies };
|
|
29670
|
+
}
|
|
29671
|
+
const ctx = createDeepForkContext(forkId, options);
|
|
29672
|
+
if (typeof register === "function") {
|
|
29673
|
+
return {
|
|
29674
|
+
register: /* @__PURE__ */ __name((config) => {
|
|
29675
|
+
const baseItems = register(config);
|
|
29676
|
+
return ctx.mapRegisterItems(baseItems);
|
|
29677
|
+
}, "register"),
|
|
29678
|
+
dependencies: dependencies ? (config) => {
|
|
29679
|
+
const baseItems = register(config);
|
|
29680
|
+
ctx.ensureForkedForRegisterItems(baseItems);
|
|
29681
|
+
const baseDeps = typeof dependencies === "function" ? dependencies(config) : dependencies;
|
|
29682
|
+
return remapResourceDependenciesInObject(baseDeps, {
|
|
29683
|
+
getForkedResourceByBaseId: ctx.getForkedResourceByBaseId
|
|
29684
|
+
});
|
|
29685
|
+
} : dependencies
|
|
29686
|
+
};
|
|
29687
|
+
}
|
|
29688
|
+
ctx.ensureForkedForRegisterItems(register);
|
|
29475
29689
|
return {
|
|
29476
|
-
|
|
29477
|
-
|
|
29478
|
-
id: hookDef.id,
|
|
29479
|
-
dependencies: hookDef.dependencies || {},
|
|
29480
|
-
on: hookDef.on,
|
|
29481
|
-
order: hookDef.order,
|
|
29482
|
-
run: hookDef.run,
|
|
29483
|
-
meta: hookDef.meta || {},
|
|
29484
|
-
tags: hookDef.tags || []
|
|
29690
|
+
register: ctx.mapRegisterItems(register),
|
|
29691
|
+
dependencies: ctx.remapDependencies(dependencies)
|
|
29485
29692
|
};
|
|
29486
29693
|
}
|
|
29487
|
-
__name(
|
|
29694
|
+
__name(resolveForkedRegisterAndDependencies, "resolveForkedRegisterAndDependencies");
|
|
29488
29695
|
|
|
29489
29696
|
// src/definers/defineResource.ts
|
|
29490
29697
|
function defineResource(constConfig) {
|
|
@@ -29531,12 +29738,25 @@ function defineResource(constConfig) {
|
|
|
29531
29738
|
[symbolOptionalDependency]: true
|
|
29532
29739
|
};
|
|
29533
29740
|
},
|
|
29534
|
-
fork(newId) {
|
|
29535
|
-
|
|
29741
|
+
fork(newId, options) {
|
|
29742
|
+
const forkedParts = resolveForkedRegisterAndDependencies({
|
|
29743
|
+
register: constConfig.register,
|
|
29744
|
+
dependencies: constConfig.dependencies,
|
|
29745
|
+
forkId: newId,
|
|
29746
|
+
options
|
|
29747
|
+
});
|
|
29748
|
+
const forked = defineResource({
|
|
29536
29749
|
...constConfig,
|
|
29537
29750
|
id: newId,
|
|
29751
|
+
register: forkedParts.register,
|
|
29752
|
+
dependencies: forkedParts.dependencies,
|
|
29538
29753
|
[symbolFilePath]: filePath
|
|
29539
29754
|
});
|
|
29755
|
+
forked[symbolResourceForkedFrom] = {
|
|
29756
|
+
fromId: id2,
|
|
29757
|
+
forkedAtFilePath: getCallerFile()
|
|
29758
|
+
};
|
|
29759
|
+
return forked;
|
|
29540
29760
|
}
|
|
29541
29761
|
};
|
|
29542
29762
|
}
|
|
@@ -29664,7 +29884,7 @@ function defineOverride(base, patch) {
|
|
|
29664
29884
|
...patch,
|
|
29665
29885
|
id: base.id
|
|
29666
29886
|
};
|
|
29667
|
-
if (base.on !== void 0) {
|
|
29887
|
+
if ("on" in base && base.on !== void 0) {
|
|
29668
29888
|
overridden.on = base.on;
|
|
29669
29889
|
}
|
|
29670
29890
|
return overridden;
|
|
@@ -29784,6 +30004,309 @@ var SymbolPolicy = /* @__PURE__ */ ((SymbolPolicy2) => {
|
|
|
29784
30004
|
SymbolPolicy2["Disabled"] = "Disabled";
|
|
29785
30005
|
return SymbolPolicy2;
|
|
29786
30006
|
})(SymbolPolicy || {});
|
|
30007
|
+
var SymbolPolicyErrorMessage = /* @__PURE__ */ ((SymbolPolicyErrorMessage2) => {
|
|
30008
|
+
SymbolPolicyErrorMessage2["GlobalSymbolsNotAllowed"] = "Global symbols are not allowed";
|
|
30009
|
+
SymbolPolicyErrorMessage2["SymbolsNotAllowed"] = "Symbols are not allowed";
|
|
30010
|
+
SymbolPolicyErrorMessage2["UnsupportedSymbolPolicy"] = "Unsupported symbol policy";
|
|
30011
|
+
return SymbolPolicyErrorMessage2;
|
|
30012
|
+
})(SymbolPolicyErrorMessage || {});
|
|
30013
|
+
|
|
30014
|
+
// src/serializer/binary-builtins.ts
|
|
30015
|
+
var INVALID_PAYLOAD_MESSAGE_PREFIX = "Invalid";
|
|
30016
|
+
var typedArrayTypeIds = [
|
|
30017
|
+
"Int8Array",
|
|
30018
|
+
"Uint8Array",
|
|
30019
|
+
"Uint8ClampedArray",
|
|
30020
|
+
"Int16Array",
|
|
30021
|
+
"Uint16Array",
|
|
30022
|
+
"Int32Array",
|
|
30023
|
+
"Uint32Array",
|
|
30024
|
+
"Float32Array",
|
|
30025
|
+
"Float64Array",
|
|
30026
|
+
"BigInt64Array",
|
|
30027
|
+
"BigUint64Array"
|
|
30028
|
+
];
|
|
30029
|
+
var getTypedArrayConstructor = /* @__PURE__ */ __name((typeId) => {
|
|
30030
|
+
const value = globalThis[typeId];
|
|
30031
|
+
if (typeof value !== "function") {
|
|
30032
|
+
return null;
|
|
30033
|
+
}
|
|
30034
|
+
return value;
|
|
30035
|
+
}, "getTypedArrayConstructor");
|
|
30036
|
+
var getRuntimeBufferConstructor = /* @__PURE__ */ __name(() => {
|
|
30037
|
+
const value = globalThis.Buffer;
|
|
30038
|
+
if (typeof value !== "function") {
|
|
30039
|
+
return null;
|
|
30040
|
+
}
|
|
30041
|
+
const valueRecord = value;
|
|
30042
|
+
if (typeof valueRecord.from !== "function" || typeof valueRecord.isBuffer !== "function") {
|
|
30043
|
+
return null;
|
|
30044
|
+
}
|
|
30045
|
+
return value;
|
|
30046
|
+
}, "getRuntimeBufferConstructor");
|
|
30047
|
+
var isNodeBuffer = /* @__PURE__ */ __name((value) => {
|
|
30048
|
+
const runtimeBufferConstructor = getRuntimeBufferConstructor();
|
|
30049
|
+
if (!runtimeBufferConstructor) {
|
|
30050
|
+
return false;
|
|
30051
|
+
}
|
|
30052
|
+
return runtimeBufferConstructor.isBuffer(value);
|
|
30053
|
+
}, "isNodeBuffer");
|
|
30054
|
+
var assertBytePayload = /* @__PURE__ */ __name((payload, typeId) => {
|
|
30055
|
+
if (!Array.isArray(payload)) {
|
|
30056
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30057
|
+
}
|
|
30058
|
+
const bytes = new Array(payload.length);
|
|
30059
|
+
for (let index = 0; index < payload.length; index += 1) {
|
|
30060
|
+
const byteValue = payload[index];
|
|
30061
|
+
if (typeof byteValue !== "number" || !Number.isInteger(byteValue) || byteValue < 0 || byteValue > 255) {
|
|
30062
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30063
|
+
}
|
|
30064
|
+
bytes[index] = byteValue;
|
|
30065
|
+
}
|
|
30066
|
+
return bytes;
|
|
30067
|
+
}, "assertBytePayload");
|
|
30068
|
+
var toBytePayload = /* @__PURE__ */ __name((value) => Array.from(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)), "toBytePayload");
|
|
30069
|
+
var bytesToArrayBuffer = /* @__PURE__ */ __name((payload, typeId) => {
|
|
30070
|
+
const bytes = assertBytePayload(payload, typeId);
|
|
30071
|
+
return Uint8Array.from(bytes).buffer;
|
|
30072
|
+
}, "bytesToArrayBuffer");
|
|
30073
|
+
var deserializeTypedArray = /* @__PURE__ */ __name((typeId, payload) => {
|
|
30074
|
+
const typedArrayConstructor = getTypedArrayConstructor(typeId);
|
|
30075
|
+
if (!typedArrayConstructor) {
|
|
30076
|
+
throw new Error(`${typeId} is not available in this runtime`);
|
|
30077
|
+
}
|
|
30078
|
+
const bytes = assertBytePayload(payload, typeId);
|
|
30079
|
+
const bytesPerElement = typedArrayConstructor.BYTES_PER_ELEMENT;
|
|
30080
|
+
if (bytes.length % bytesPerElement !== 0) {
|
|
30081
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30082
|
+
}
|
|
30083
|
+
const arrayBuffer = Uint8Array.from(bytes).buffer;
|
|
30084
|
+
return new typedArrayConstructor(arrayBuffer);
|
|
30085
|
+
}, "deserializeTypedArray");
|
|
30086
|
+
var createTypedArrayType = /* @__PURE__ */ __name((typeId) => ({
|
|
30087
|
+
id: typeId,
|
|
30088
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30089
|
+
const typedArrayConstructor = getTypedArrayConstructor(typeId);
|
|
30090
|
+
if (!typedArrayConstructor) {
|
|
30091
|
+
return false;
|
|
30092
|
+
}
|
|
30093
|
+
if (!(value instanceof typedArrayConstructor)) {
|
|
30094
|
+
return false;
|
|
30095
|
+
}
|
|
30096
|
+
if (typeId === "Uint8Array" && isNodeBuffer(value)) {
|
|
30097
|
+
return false;
|
|
30098
|
+
}
|
|
30099
|
+
return true;
|
|
30100
|
+
}, "is"),
|
|
30101
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30102
|
+
deserialize: /* @__PURE__ */ __name((payload) => deserializeTypedArray(typeId, payload), "deserialize"),
|
|
30103
|
+
strategy: "value"
|
|
30104
|
+
}), "createTypedArrayType");
|
|
30105
|
+
var ArrayBufferType = {
|
|
30106
|
+
id: "ArrayBuffer",
|
|
30107
|
+
is: /* @__PURE__ */ __name((value) => value instanceof ArrayBuffer, "is"),
|
|
30108
|
+
serialize: /* @__PURE__ */ __name((value) => Array.from(new Uint8Array(value)), "serialize"),
|
|
30109
|
+
deserialize: /* @__PURE__ */ __name((payload) => bytesToArrayBuffer(payload, "ArrayBuffer"), "deserialize"),
|
|
30110
|
+
strategy: "value"
|
|
30111
|
+
};
|
|
30112
|
+
var DataViewType = {
|
|
30113
|
+
id: "DataView",
|
|
30114
|
+
is: /* @__PURE__ */ __name((value) => value instanceof DataView, "is"),
|
|
30115
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30116
|
+
deserialize: /* @__PURE__ */ __name((payload) => new DataView(bytesToArrayBuffer(payload, "DataView")), "deserialize"),
|
|
30117
|
+
strategy: "value"
|
|
30118
|
+
};
|
|
30119
|
+
var BufferType = {
|
|
30120
|
+
id: "Buffer",
|
|
30121
|
+
is: /* @__PURE__ */ __name((value) => isNodeBuffer(value), "is"),
|
|
30122
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30123
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30124
|
+
const bytes = assertBytePayload(payload, "Buffer");
|
|
30125
|
+
const runtimeBufferConstructor = getRuntimeBufferConstructor();
|
|
30126
|
+
if (runtimeBufferConstructor) {
|
|
30127
|
+
return runtimeBufferConstructor.from(bytes);
|
|
30128
|
+
}
|
|
30129
|
+
return Uint8Array.from(bytes);
|
|
30130
|
+
}, "deserialize"),
|
|
30131
|
+
strategy: "value"
|
|
30132
|
+
};
|
|
30133
|
+
var typedArrayTypes = typedArrayTypeIds.map(
|
|
30134
|
+
(typeId) => createTypedArrayType(typeId)
|
|
30135
|
+
);
|
|
30136
|
+
var binaryBuiltInTypes = [
|
|
30137
|
+
ArrayBufferType,
|
|
30138
|
+
DataViewType,
|
|
30139
|
+
BufferType,
|
|
30140
|
+
...typedArrayTypes
|
|
30141
|
+
];
|
|
30142
|
+
|
|
30143
|
+
// src/serializer/error-url-builtins.ts
|
|
30144
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
30145
|
+
var errorReservedPropertyNames = /* @__PURE__ */ new Set([
|
|
30146
|
+
"name",
|
|
30147
|
+
"message",
|
|
30148
|
+
"stack",
|
|
30149
|
+
"cause"
|
|
30150
|
+
]);
|
|
30151
|
+
var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
30152
|
+
var isUnsafePropertyName = /* @__PURE__ */ __name((propertyName) => propertyName === "__proto__" || propertyName === "constructor" || propertyName === "prototype", "isUnsafePropertyName");
|
|
30153
|
+
var collectErrorCustomFields = /* @__PURE__ */ __name((error2) => {
|
|
30154
|
+
const customFields = {};
|
|
30155
|
+
for (const propertyName of Object.getOwnPropertyNames(error2)) {
|
|
30156
|
+
if (errorReservedPropertyNames.has(propertyName)) {
|
|
30157
|
+
continue;
|
|
30158
|
+
}
|
|
30159
|
+
if (isUnsafePropertyName(propertyName)) {
|
|
30160
|
+
continue;
|
|
30161
|
+
}
|
|
30162
|
+
const descriptor = Object.getOwnPropertyDescriptor(error2, propertyName);
|
|
30163
|
+
if (!descriptor || !("value" in descriptor)) {
|
|
30164
|
+
continue;
|
|
30165
|
+
}
|
|
30166
|
+
customFields[propertyName] = descriptor.value;
|
|
30167
|
+
}
|
|
30168
|
+
return customFields;
|
|
30169
|
+
}, "collectErrorCustomFields");
|
|
30170
|
+
var assertSerializedErrorPayload = /* @__PURE__ */ __name((value) => {
|
|
30171
|
+
if (!isRecord(value)) {
|
|
30172
|
+
throw new Error("Invalid Error payload");
|
|
30173
|
+
}
|
|
30174
|
+
const { name, message, stack, customFields } = value;
|
|
30175
|
+
if (typeof name !== "string" || typeof message !== "string") {
|
|
30176
|
+
throw new Error("Invalid Error payload");
|
|
30177
|
+
}
|
|
30178
|
+
if (stack !== void 0 && typeof stack !== "string") {
|
|
30179
|
+
throw new Error("Invalid Error payload");
|
|
30180
|
+
}
|
|
30181
|
+
if (customFields !== void 0 && !isRecord(customFields)) {
|
|
30182
|
+
throw new Error("Invalid Error payload");
|
|
30183
|
+
}
|
|
30184
|
+
const normalizedCustomFields = {};
|
|
30185
|
+
const customFieldEntries = Object.entries(customFields ?? {});
|
|
30186
|
+
for (const [propertyName, propertyValue] of customFieldEntries) {
|
|
30187
|
+
if (isUnsafePropertyName(propertyName)) {
|
|
30188
|
+
continue;
|
|
30189
|
+
}
|
|
30190
|
+
normalizedCustomFields[propertyName] = propertyValue;
|
|
30191
|
+
}
|
|
30192
|
+
return {
|
|
30193
|
+
name,
|
|
30194
|
+
message,
|
|
30195
|
+
stack,
|
|
30196
|
+
hasCause: hasOwn.call(value, "cause"),
|
|
30197
|
+
cause: value.cause,
|
|
30198
|
+
customFields: normalizedCustomFields
|
|
30199
|
+
};
|
|
30200
|
+
}, "assertSerializedErrorPayload");
|
|
30201
|
+
var getUrlConstructor = /* @__PURE__ */ __name(() => {
|
|
30202
|
+
const value = globalThis.URL;
|
|
30203
|
+
if (typeof value !== "function") {
|
|
30204
|
+
return null;
|
|
30205
|
+
}
|
|
30206
|
+
return value;
|
|
30207
|
+
}, "getUrlConstructor");
|
|
30208
|
+
var getUrlSearchParamsConstructor = /* @__PURE__ */ __name(() => {
|
|
30209
|
+
const value = globalThis.URLSearchParams;
|
|
30210
|
+
if (typeof value !== "function") {
|
|
30211
|
+
return null;
|
|
30212
|
+
}
|
|
30213
|
+
return value;
|
|
30214
|
+
}, "getUrlSearchParamsConstructor");
|
|
30215
|
+
var ErrorType = {
|
|
30216
|
+
id: "Error",
|
|
30217
|
+
is: /* @__PURE__ */ __name((value) => value instanceof Error, "is"),
|
|
30218
|
+
serialize: /* @__PURE__ */ __name((error2) => {
|
|
30219
|
+
const serializedErrorPayload = {
|
|
30220
|
+
name: error2.name,
|
|
30221
|
+
message: error2.message,
|
|
30222
|
+
customFields: collectErrorCustomFields(error2)
|
|
30223
|
+
};
|
|
30224
|
+
if (typeof error2.stack === "string") {
|
|
30225
|
+
serializedErrorPayload.stack = error2.stack;
|
|
30226
|
+
}
|
|
30227
|
+
if (hasOwn.call(error2, "cause")) {
|
|
30228
|
+
serializedErrorPayload.cause = error2.cause;
|
|
30229
|
+
}
|
|
30230
|
+
return serializedErrorPayload;
|
|
30231
|
+
}, "serialize"),
|
|
30232
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30233
|
+
const { name, message, stack, hasCause, cause, customFields } = assertSerializedErrorPayload(payload);
|
|
30234
|
+
const restoredError = new Error(message);
|
|
30235
|
+
restoredError.name = name;
|
|
30236
|
+
if (stack !== void 0) {
|
|
30237
|
+
Object.defineProperty(restoredError, "stack", {
|
|
30238
|
+
value: stack,
|
|
30239
|
+
writable: true,
|
|
30240
|
+
configurable: true,
|
|
30241
|
+
enumerable: false
|
|
30242
|
+
});
|
|
30243
|
+
}
|
|
30244
|
+
if (hasCause) {
|
|
30245
|
+
Object.defineProperty(restoredError, "cause", {
|
|
30246
|
+
value: cause,
|
|
30247
|
+
writable: true,
|
|
30248
|
+
configurable: true,
|
|
30249
|
+
enumerable: false
|
|
30250
|
+
});
|
|
30251
|
+
}
|
|
30252
|
+
for (const [propertyName, propertyValue] of Object.entries(customFields)) {
|
|
30253
|
+
if (errorReservedPropertyNames.has(propertyName)) {
|
|
30254
|
+
continue;
|
|
30255
|
+
}
|
|
30256
|
+
restoredError[propertyName] = propertyValue;
|
|
30257
|
+
}
|
|
30258
|
+
return restoredError;
|
|
30259
|
+
}, "deserialize")
|
|
30260
|
+
};
|
|
30261
|
+
var URLType = {
|
|
30262
|
+
id: "URL",
|
|
30263
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30264
|
+
const runtimeUrlConstructor = getUrlConstructor();
|
|
30265
|
+
if (!runtimeUrlConstructor) {
|
|
30266
|
+
return false;
|
|
30267
|
+
}
|
|
30268
|
+
return value instanceof runtimeUrlConstructor;
|
|
30269
|
+
}, "is"),
|
|
30270
|
+
serialize: /* @__PURE__ */ __name((value) => value.href, "serialize"),
|
|
30271
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30272
|
+
if (typeof payload !== "string") {
|
|
30273
|
+
throw new Error("Invalid URL payload");
|
|
30274
|
+
}
|
|
30275
|
+
const runtimeUrlConstructor = getUrlConstructor();
|
|
30276
|
+
if (!runtimeUrlConstructor) {
|
|
30277
|
+
throw new Error("URL is not available in this runtime");
|
|
30278
|
+
}
|
|
30279
|
+
return new runtimeUrlConstructor(payload);
|
|
30280
|
+
}, "deserialize"),
|
|
30281
|
+
strategy: "value"
|
|
30282
|
+
};
|
|
30283
|
+
var URLSearchParamsType = {
|
|
30284
|
+
id: "URLSearchParams",
|
|
30285
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30286
|
+
const runtimeUrlSearchParamsConstructor = getUrlSearchParamsConstructor();
|
|
30287
|
+
if (!runtimeUrlSearchParamsConstructor) {
|
|
30288
|
+
return false;
|
|
30289
|
+
}
|
|
30290
|
+
return value instanceof runtimeUrlSearchParamsConstructor;
|
|
30291
|
+
}, "is"),
|
|
30292
|
+
serialize: /* @__PURE__ */ __name((value) => value.toString(), "serialize"),
|
|
30293
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30294
|
+
if (typeof payload !== "string") {
|
|
30295
|
+
throw new Error("Invalid URLSearchParams payload");
|
|
30296
|
+
}
|
|
30297
|
+
const runtimeUrlSearchParamsConstructor = getUrlSearchParamsConstructor();
|
|
30298
|
+
if (!runtimeUrlSearchParamsConstructor) {
|
|
30299
|
+
throw new Error("URLSearchParams is not available in this runtime");
|
|
30300
|
+
}
|
|
30301
|
+
return new runtimeUrlSearchParamsConstructor(payload);
|
|
30302
|
+
}, "deserialize"),
|
|
30303
|
+
strategy: "value"
|
|
30304
|
+
};
|
|
30305
|
+
var errorAndUrlBuiltInTypes = [
|
|
30306
|
+
ErrorType,
|
|
30307
|
+
URLType,
|
|
30308
|
+
URLSearchParamsType
|
|
30309
|
+
];
|
|
29787
30310
|
|
|
29788
30311
|
// src/serializer/special-values.ts
|
|
29789
30312
|
var serializeUndefined = /* @__PURE__ */ __name(() => ({
|
|
@@ -29989,7 +30512,9 @@ var builtInTypes = [
|
|
|
29989
30512
|
UndefinedType,
|
|
29990
30513
|
NonFiniteNumberType,
|
|
29991
30514
|
BigIntType,
|
|
29992
|
-
SymbolType
|
|
30515
|
+
SymbolType,
|
|
30516
|
+
...errorAndUrlBuiltInTypes,
|
|
30517
|
+
...binaryBuiltInTypes
|
|
29993
30518
|
];
|
|
29994
30519
|
|
|
29995
30520
|
// src/serializer/type-registry.ts
|
|
@@ -30480,7 +31005,7 @@ var serializeTreeValue = /* @__PURE__ */ __name((value, context, depth, options)
|
|
|
30480
31005
|
}, "serializeTreeValue");
|
|
30481
31006
|
|
|
30482
31007
|
// src/serializer/deserializer.ts
|
|
30483
|
-
var
|
|
31008
|
+
var hasOwn2 = Object.prototype.hasOwnProperty;
|
|
30484
31009
|
var copyOwnProperties = /* @__PURE__ */ __name((target, source, unsafeKeys) => {
|
|
30485
31010
|
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
30486
31011
|
for (const key of Object.keys(descriptors)) {
|
|
@@ -30561,7 +31086,7 @@ var deserializeValue = /* @__PURE__ */ __name((value, context, depth, options) =
|
|
|
30561
31086
|
const obj = {};
|
|
30562
31087
|
const source = value;
|
|
30563
31088
|
for (const key in source) {
|
|
30564
|
-
if (!
|
|
31089
|
+
if (!hasOwn2.call(source, key)) {
|
|
30565
31090
|
continue;
|
|
30566
31091
|
}
|
|
30567
31092
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30606,7 +31131,7 @@ var resolveReference = /* @__PURE__ */ __name((id2, context, depth, options) =>
|
|
|
30606
31131
|
context.resolved.set(id2, target);
|
|
30607
31132
|
const source = node.value;
|
|
30608
31133
|
for (const key in source) {
|
|
30609
|
-
if (!
|
|
31134
|
+
if (!hasOwn2.call(source, key)) {
|
|
30610
31135
|
continue;
|
|
30611
31136
|
}
|
|
30612
31137
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30678,7 +31203,7 @@ var mergePlaceholder = /* @__PURE__ */ __name((placeholder, result, unsafeKeys)
|
|
|
30678
31203
|
const target = placeholder;
|
|
30679
31204
|
const source = result;
|
|
30680
31205
|
for (const key in source) {
|
|
30681
|
-
if (!
|
|
31206
|
+
if (!hasOwn2.call(source, key)) {
|
|
30682
31207
|
continue;
|
|
30683
31208
|
}
|
|
30684
31209
|
if (isUnsafeKey(key, unsafeKeys)) {
|
|
@@ -30711,7 +31236,7 @@ var deserializeLegacy = /* @__PURE__ */ __name((value, depth, options) => {
|
|
|
30711
31236
|
const obj = {};
|
|
30712
31237
|
const source = value;
|
|
30713
31238
|
for (const key in source) {
|
|
30714
|
-
if (!
|
|
31239
|
+
if (!hasOwn2.call(source, key)) {
|
|
30715
31240
|
continue;
|
|
30716
31241
|
}
|
|
30717
31242
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30722,6 +31247,26 @@ var deserializeLegacy = /* @__PURE__ */ __name((value, depth, options) => {
|
|
|
30722
31247
|
return obj;
|
|
30723
31248
|
}, "deserializeLegacy");
|
|
30724
31249
|
|
|
31250
|
+
// src/serializer/option-normalizers.ts
|
|
31251
|
+
var normalizeMaxDepth = /* @__PURE__ */ __name((value, fallback) => {
|
|
31252
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
31253
|
+
return Number.POSITIVE_INFINITY;
|
|
31254
|
+
}
|
|
31255
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
|
|
31256
|
+
return Math.floor(value);
|
|
31257
|
+
}
|
|
31258
|
+
return fallback;
|
|
31259
|
+
}, "normalizeMaxDepth");
|
|
31260
|
+
var normalizeMaxRegExpPatternLength = /* @__PURE__ */ __name((value, fallback) => {
|
|
31261
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
31262
|
+
return Number.POSITIVE_INFINITY;
|
|
31263
|
+
}
|
|
31264
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
31265
|
+
return Math.floor(value);
|
|
31266
|
+
}
|
|
31267
|
+
return fallback;
|
|
31268
|
+
}, "normalizeMaxRegExpPatternLength");
|
|
31269
|
+
|
|
30725
31270
|
// src/serializer/Serializer.ts
|
|
30726
31271
|
var GRAPH_VERSION = 1;
|
|
30727
31272
|
var DEFAULT_MAX_DEPTH = 1e3;
|
|
@@ -30757,10 +31302,11 @@ var Serializer = class {
|
|
|
30757
31302
|
return check(pattern, index);
|
|
30758
31303
|
}, "isBoundedQuantifier");
|
|
30759
31304
|
this.indent = options.pretty ? 2 : void 0;
|
|
30760
|
-
|
|
30761
|
-
this.
|
|
30762
|
-
|
|
30763
|
-
|
|
31305
|
+
this.maxDepth = normalizeMaxDepth(options.maxDepth, DEFAULT_MAX_DEPTH);
|
|
31306
|
+
this.maxRegExpPatternLength = normalizeMaxRegExpPatternLength(
|
|
31307
|
+
options.maxRegExpPatternLength,
|
|
31308
|
+
DEFAULT_MAX_REGEXP_PATTERN_LENGTH
|
|
31309
|
+
);
|
|
30764
31310
|
this.allowUnsafeRegExp = options.allowUnsafeRegExp ?? false;
|
|
30765
31311
|
this.unsafeKeys = DEFAULT_UNSAFE_KEYS;
|
|
30766
31312
|
this.typeRegistry = new TypeRegistry({
|
|
@@ -30895,13 +31441,6 @@ var Serializer = class {
|
|
|
30895
31441
|
}
|
|
30896
31442
|
};
|
|
30897
31443
|
|
|
30898
|
-
// src/serializer/index.ts
|
|
30899
|
-
var defaultSerializer = new Serializer();
|
|
30900
|
-
function getDefaultSerializer() {
|
|
30901
|
-
return defaultSerializer;
|
|
30902
|
-
}
|
|
30903
|
-
__name(getDefaultSerializer, "getDefaultSerializer");
|
|
30904
|
-
|
|
30905
31444
|
// src/definers/defineAsyncContext.ts
|
|
30906
31445
|
var platform = getPlatform();
|
|
30907
31446
|
var storage = platform.createAsyncLocalStorage();
|
|
@@ -30909,13 +31448,14 @@ function getCurrentStore() {
|
|
|
30909
31448
|
return storage.getStore();
|
|
30910
31449
|
}
|
|
30911
31450
|
__name(getCurrentStore, "getCurrentStore");
|
|
30912
|
-
function defineAsyncContext(def) {
|
|
31451
|
+
function defineAsyncContext(def, filePath) {
|
|
30913
31452
|
if (!platform.hasAsyncLocalStorage()) {
|
|
30914
31453
|
platformUnsupportedFunctionError.throw({
|
|
30915
31454
|
functionName: `createAsyncLocalStorage: Cannot create context ${def.id}: no async storage available in this environment`
|
|
30916
31455
|
});
|
|
30917
31456
|
}
|
|
30918
31457
|
const ctxId = def.id;
|
|
31458
|
+
const resolvedFilePath = filePath ?? getCallerFile();
|
|
30919
31459
|
const use = /* @__PURE__ */ __name(() => {
|
|
30920
31460
|
const store2 = getCurrentStore();
|
|
30921
31461
|
if (!store2 || !store2.has(ctxId)) {
|
|
@@ -30932,10 +31472,11 @@ function defineAsyncContext(def) {
|
|
|
30932
31472
|
map.set(ctxId, value);
|
|
30933
31473
|
return storage.run(map, fn);
|
|
30934
31474
|
}, "provide");
|
|
30935
|
-
const serializer3 =
|
|
31475
|
+
const serializer3 = new Serializer();
|
|
30936
31476
|
const api = {
|
|
30937
31477
|
id: ctxId,
|
|
30938
31478
|
[symbolAsyncContext]: true,
|
|
31479
|
+
[symbolFilePath]: resolvedFilePath,
|
|
30939
31480
|
use,
|
|
30940
31481
|
/* istanbul ignore next */
|
|
30941
31482
|
provide(value, fn) {
|
|
@@ -31587,12 +32128,12 @@ var EventManager = class {
|
|
|
31587
32128
|
data,
|
|
31588
32129
|
timestamp: /* @__PURE__ */ new Date(),
|
|
31589
32130
|
source,
|
|
31590
|
-
meta: eventDefinition.meta || {},
|
|
32131
|
+
meta: { ...eventDefinition.meta || {} },
|
|
31591
32132
|
stopPropagation: /* @__PURE__ */ __name(() => {
|
|
31592
32133
|
propagationStopped = true;
|
|
31593
32134
|
}, "stopPropagation"),
|
|
31594
32135
|
isPropagationStopped: /* @__PURE__ */ __name(() => propagationStopped, "isPropagationStopped"),
|
|
31595
|
-
tags: eventDefinition.tags
|
|
32136
|
+
tags: [...eventDefinition.tags]
|
|
31596
32137
|
};
|
|
31597
32138
|
const baseEmit = /* @__PURE__ */ __name(async (eventToEmit) => {
|
|
31598
32139
|
if (allListeners.length === 0) {
|
|
@@ -31618,10 +32159,14 @@ var EventManager = class {
|
|
|
31618
32159
|
if (!interceptor) {
|
|
31619
32160
|
return baseEmit(eventToEmit);
|
|
31620
32161
|
}
|
|
31621
|
-
return interceptor(
|
|
31622
|
-
(
|
|
31623
|
-
|
|
31624
|
-
|
|
32162
|
+
return interceptor((nextEvent) => {
|
|
32163
|
+
this.assertPropagationMethodsUnchanged(
|
|
32164
|
+
eventDefinition.id,
|
|
32165
|
+
eventToEmit,
|
|
32166
|
+
nextEvent
|
|
32167
|
+
);
|
|
32168
|
+
return runInterceptor(index + 1, nextEvent);
|
|
32169
|
+
}, eventToEmit);
|
|
31625
32170
|
}, "runInterceptor");
|
|
31626
32171
|
await runInterceptor(0, event2);
|
|
31627
32172
|
return deepestEvent;
|
|
@@ -31732,21 +32277,24 @@ var EventManager = class {
|
|
|
31732
32277
|
lockedError.throw({ what: "EventManager" });
|
|
31733
32278
|
}
|
|
31734
32279
|
}
|
|
31735
|
-
|
|
31736
|
-
|
|
31737
|
-
|
|
31738
|
-
|
|
31739
|
-
|
|
31740
|
-
|
|
31741
|
-
|
|
31742
|
-
|
|
32280
|
+
assertPropagationMethodsUnchanged(eventId, currentEvent, nextEvent) {
|
|
32281
|
+
if (nextEvent.stopPropagation !== currentEvent.stopPropagation || nextEvent.isPropagationStopped !== currentEvent.isPropagationStopped) {
|
|
32282
|
+
validationError.throw({
|
|
32283
|
+
subject: "Event interceptor",
|
|
32284
|
+
id: eventId,
|
|
32285
|
+
originalError: new Error(
|
|
32286
|
+
"Interceptors cannot override stopPropagation/isPropagationStopped"
|
|
32287
|
+
)
|
|
32288
|
+
});
|
|
32289
|
+
}
|
|
31743
32290
|
}
|
|
31744
32291
|
/**
|
|
31745
32292
|
* Disposes the EventManager, releasing all listeners and interceptors.
|
|
31746
|
-
* Alias for clear() following the IResource disposal pattern.
|
|
31747
32293
|
*/
|
|
31748
32294
|
dispose() {
|
|
31749
|
-
this.clear();
|
|
32295
|
+
this.registry.clear();
|
|
32296
|
+
this.emissionInterceptors.length = 0;
|
|
32297
|
+
this.hookInterceptors.length = 0;
|
|
31750
32298
|
}
|
|
31751
32299
|
/**
|
|
31752
32300
|
* Retrieves cached merged listeners for an event, or creates them if not cached.
|
|
@@ -33053,7 +33601,7 @@ var TaskRunner = class {
|
|
|
33053
33601
|
__name(this, "TaskRunner");
|
|
33054
33602
|
}
|
|
33055
33603
|
/**
|
|
33056
|
-
* Begins the execution of
|
|
33604
|
+
* Begins the execution of a task. These are registered tasks and all sanity checks have been performed at this stage to ensure consistency of the object.
|
|
33057
33605
|
* This function can throw only if any of the event listeners or run function throws
|
|
33058
33606
|
* @param task the task to be run
|
|
33059
33607
|
* @param input the input to be passed to the task
|
|
@@ -33082,8 +33630,6 @@ var TaskRunner = class {
|
|
|
33082
33630
|
/**
|
|
33083
33631
|
* Creates the function with the chain of middleware.
|
|
33084
33632
|
* @param task
|
|
33085
|
-
* @param input
|
|
33086
|
-
* @param taskDependencies
|
|
33087
33633
|
* @returns
|
|
33088
33634
|
*/
|
|
33089
33635
|
createRunnerWithMiddleware(task2) {
|
|
@@ -33103,7 +33649,7 @@ var ResourceInitializer = class {
|
|
|
33103
33649
|
__name(this, "ResourceInitializer");
|
|
33104
33650
|
}
|
|
33105
33651
|
/**
|
|
33106
|
-
* Begins the execution of
|
|
33652
|
+
* Begins the execution of a task. These are registered tasks and all sanity checks have been performed at this stage to ensure consistency of the object.
|
|
33107
33653
|
* This function can throw only if any of the event listeners or run function throws
|
|
33108
33654
|
*/
|
|
33109
33655
|
async initializeResource(resource2, config, dependencies) {
|
|
@@ -33593,23 +34139,28 @@ var DependencyProcessor = class {
|
|
|
33593
34139
|
middleware.computedDependencies = computedDependencies;
|
|
33594
34140
|
middleware.isInitialized = true;
|
|
33595
34141
|
}
|
|
33596
|
-
for (const resource2 of this.store.resources.values()) {
|
|
33597
|
-
await this.processResourceDependencies(resource2);
|
|
33598
|
-
}
|
|
33599
|
-
for (const task2 of this.store.tasks.values()) {
|
|
33600
|
-
await this.computeTaskDependencies(task2);
|
|
33601
|
-
}
|
|
33602
34142
|
for (const hookStoreElement of this.store.hooks.values()) {
|
|
33603
34143
|
const hook2 = hookStoreElement.hook;
|
|
33604
34144
|
const deps = hook2.dependencies;
|
|
34145
|
+
hookStoreElement.dependencyState = "computing" /* Computing */;
|
|
33605
34146
|
hookStoreElement.computedDependencies = await this.extractDependencies(
|
|
33606
34147
|
deps,
|
|
33607
34148
|
hook2.id
|
|
33608
34149
|
);
|
|
34150
|
+
hookStoreElement.dependencyState = "ready" /* Ready */;
|
|
34151
|
+
}
|
|
34152
|
+
for (const resource2 of this.store.resources.values()) {
|
|
34153
|
+
await this.processResourceDependencies(resource2);
|
|
34154
|
+
}
|
|
34155
|
+
for (const task2 of this.store.tasks.values()) {
|
|
34156
|
+
await this.computeTaskDependencies(task2);
|
|
33609
34157
|
}
|
|
33610
34158
|
await this.initializeUninitializedResources();
|
|
33611
34159
|
}
|
|
33612
34160
|
async computeTaskDependencies(task2) {
|
|
34161
|
+
if (task2.isInitialized) {
|
|
34162
|
+
return;
|
|
34163
|
+
}
|
|
33613
34164
|
const deps = task2.task.dependencies;
|
|
33614
34165
|
task2.computedDependencies = await this.extractDependencies(
|
|
33615
34166
|
deps,
|
|
@@ -33741,6 +34292,9 @@ var DependencyProcessor = class {
|
|
|
33741
34292
|
if (receivedEvent.source === hook2.id) {
|
|
33742
34293
|
return;
|
|
33743
34294
|
}
|
|
34295
|
+
if (hookStoreElement.dependencyState !== "ready" /* Ready */) {
|
|
34296
|
+
return;
|
|
34297
|
+
}
|
|
33744
34298
|
return this.eventManager.executeHookWithInterceptors(
|
|
33745
34299
|
hook2,
|
|
33746
34300
|
receivedEvent,
|
|
@@ -33857,7 +34411,7 @@ var DependencyProcessor = class {
|
|
|
33857
34411
|
}
|
|
33858
34412
|
const st = storeTask;
|
|
33859
34413
|
if (!st.isInitialized) {
|
|
33860
|
-
const dependencies =
|
|
34414
|
+
const dependencies = st.task.dependencies;
|
|
33861
34415
|
st.computedDependencies = await this.extractDependencies(
|
|
33862
34416
|
dependencies,
|
|
33863
34417
|
st.task.id
|
|
@@ -33883,14 +34437,19 @@ var DependencyProcessor = class {
|
|
|
33883
34437
|
wrapped = this.wrapResourceDependencies(depMap, raw);
|
|
33884
34438
|
sr.computedDependencies = wrapped;
|
|
33885
34439
|
}
|
|
33886
|
-
|
|
33887
|
-
|
|
33888
|
-
|
|
33889
|
-
|
|
33890
|
-
|
|
33891
|
-
|
|
33892
|
-
|
|
33893
|
-
|
|
34440
|
+
try {
|
|
34441
|
+
const { value, context } = await this.resourceInitializer.initializeResource(
|
|
34442
|
+
resource2,
|
|
34443
|
+
config,
|
|
34444
|
+
wrapped
|
|
34445
|
+
);
|
|
34446
|
+
sr.context = context;
|
|
34447
|
+
sr.value = value;
|
|
34448
|
+
sr.isInitialized = true;
|
|
34449
|
+
this.store.recordResourceInitialized(resource2.id);
|
|
34450
|
+
} catch (error2) {
|
|
34451
|
+
this.rethrowResourceInitError(resource2.id, error2);
|
|
34452
|
+
}
|
|
33894
34453
|
}
|
|
33895
34454
|
return sr.value;
|
|
33896
34455
|
}
|
|
@@ -34093,7 +34652,8 @@ var StoreRegistry = class {
|
|
|
34093
34652
|
const hook2 = this.getFreshValue(item, this.hooks, "hook", overrideMode);
|
|
34094
34653
|
this.hooks.set(hook2.id, {
|
|
34095
34654
|
hook: hook2,
|
|
34096
|
-
computedDependencies: {}
|
|
34655
|
+
computedDependencies: {},
|
|
34656
|
+
dependencyState: "pending" /* Pending */
|
|
34097
34657
|
});
|
|
34098
34658
|
}
|
|
34099
34659
|
storeTaskMiddleware(item, storingMode = "normal") {
|
|
@@ -34148,7 +34708,10 @@ var StoreRegistry = class {
|
|
|
34148
34708
|
return prepared;
|
|
34149
34709
|
}
|
|
34150
34710
|
computeRegistrationDeeply(element, config) {
|
|
34151
|
-
|
|
34711
|
+
let items = typeof element.register === "function" ? element.register(config) : element.register;
|
|
34712
|
+
if (!items) {
|
|
34713
|
+
items = [];
|
|
34714
|
+
}
|
|
34152
34715
|
element.register = items;
|
|
34153
34716
|
for (const item of items) {
|
|
34154
34717
|
this.storeGenericItem(item);
|
|
@@ -34686,25 +35249,27 @@ var InterceptorRegistry = class {
|
|
|
34686
35249
|
* Gets all global task interceptors
|
|
34687
35250
|
*/
|
|
34688
35251
|
getGlobalTaskInterceptors() {
|
|
34689
|
-
return this.taskInterceptors;
|
|
35252
|
+
return Object.freeze([...this.taskInterceptors]);
|
|
34690
35253
|
}
|
|
34691
35254
|
/**
|
|
34692
35255
|
* Gets all global resource interceptors
|
|
34693
35256
|
*/
|
|
34694
35257
|
getGlobalResourceInterceptors() {
|
|
34695
|
-
return this.resourceInterceptors;
|
|
35258
|
+
return Object.freeze([...this.resourceInterceptors]);
|
|
34696
35259
|
}
|
|
34697
35260
|
/**
|
|
34698
35261
|
* Gets interceptors for a specific task middleware
|
|
34699
35262
|
*/
|
|
34700
35263
|
getTaskMiddlewareInterceptors(middlewareId) {
|
|
34701
|
-
|
|
35264
|
+
const interceptors = this.perTaskMiddleware.get(middlewareId) ?? [];
|
|
35265
|
+
return Object.freeze([...interceptors]);
|
|
34702
35266
|
}
|
|
34703
35267
|
/**
|
|
34704
35268
|
* Gets interceptors for a specific resource middleware
|
|
34705
35269
|
*/
|
|
34706
35270
|
getResourceMiddlewareInterceptors(middlewareId) {
|
|
34707
|
-
|
|
35271
|
+
const interceptors = this.perResourceMiddleware.get(middlewareId) ?? [];
|
|
35272
|
+
return Object.freeze([...interceptors]);
|
|
34708
35273
|
}
|
|
34709
35274
|
};
|
|
34710
35275
|
|
|
@@ -35183,10 +35748,8 @@ var ResourceMiddlewareComposer = class {
|
|
|
35183
35748
|
|
|
35184
35749
|
// src/models/MiddlewareManager.ts
|
|
35185
35750
|
var MiddlewareManager = class {
|
|
35186
|
-
constructor(store2,
|
|
35751
|
+
constructor(store2, _eventManager, _logger) {
|
|
35187
35752
|
this.store = store2;
|
|
35188
|
-
this.eventManager = eventManager;
|
|
35189
|
-
this.logger = logger;
|
|
35190
35753
|
this.interceptorRegistry = new InterceptorRegistry();
|
|
35191
35754
|
this.middlewareResolver = new MiddlewareResolver(store2);
|
|
35192
35755
|
this.taskComposer = new TaskMiddlewareComposer(
|
|
@@ -35227,14 +35790,6 @@ var MiddlewareManager = class {
|
|
|
35227
35790
|
lock() {
|
|
35228
35791
|
this.interceptorRegistry.lock();
|
|
35229
35792
|
}
|
|
35230
|
-
/**
|
|
35231
|
-
* Adds an interceptor for task or resource middleware execution
|
|
35232
|
-
* Interceptors are executed in the order they are added, with the ability to
|
|
35233
|
-
* modify, log, or prevent middleware execution
|
|
35234
|
-
*
|
|
35235
|
-
* @param kind - The type of middleware to intercept ("task" or "resource")
|
|
35236
|
-
* @param interceptor - The interceptor function to add
|
|
35237
|
-
*/
|
|
35238
35793
|
intercept(kind, interceptor) {
|
|
35239
35794
|
if (kind === "task") {
|
|
35240
35795
|
this.interceptorRegistry.addGlobalTaskInterceptor(
|
|
@@ -35246,13 +35801,6 @@ var MiddlewareManager = class {
|
|
|
35246
35801
|
);
|
|
35247
35802
|
}
|
|
35248
35803
|
}
|
|
35249
|
-
/**
|
|
35250
|
-
* Adds an interceptor for a specific middleware instance with better type safety
|
|
35251
|
-
* This method automatically determines the type and provides type-safe access
|
|
35252
|
-
*
|
|
35253
|
-
* @param middleware - The middleware instance to intercept
|
|
35254
|
-
* @param interceptor - The interceptor function with proper typing
|
|
35255
|
-
*/
|
|
35256
35804
|
interceptMiddleware(middleware, interceptor) {
|
|
35257
35805
|
if (isTaskMiddleware(middleware)) {
|
|
35258
35806
|
this.interceptorRegistry.addTaskMiddlewareInterceptor(
|
|
@@ -35391,12 +35939,17 @@ var Store = class {
|
|
|
35391
35939
|
}
|
|
35392
35940
|
}
|
|
35393
35941
|
registerGlobalComponents() {
|
|
35942
|
+
if (!this.taskRunner) {
|
|
35943
|
+
throw new Error(
|
|
35944
|
+
"TaskRunner is not set. Call store.setTaskRunner() before initializeStore()."
|
|
35945
|
+
);
|
|
35946
|
+
}
|
|
35394
35947
|
const builtInResourcesMap = /* @__PURE__ */ new Map();
|
|
35395
35948
|
builtInResourcesMap.set(globalResources.store, this);
|
|
35396
35949
|
builtInResourcesMap.set(globalResources.eventManager, this.eventManager);
|
|
35397
35950
|
builtInResourcesMap.set(globalResources.logger, this.logger);
|
|
35398
35951
|
builtInResourcesMap.set(globalResources.taskRunner, this.taskRunner);
|
|
35399
|
-
builtInResourcesMap.set(globalResources.serializer,
|
|
35952
|
+
builtInResourcesMap.set(globalResources.serializer, new Serializer());
|
|
35400
35953
|
builtInResourcesMap.set(
|
|
35401
35954
|
globalResources.middlewareManager,
|
|
35402
35955
|
this.middlewareManager
|
|
@@ -35456,8 +36009,11 @@ var Store = class {
|
|
|
35456
36009
|
setTaskRunner(taskRunner) {
|
|
35457
36010
|
this.taskRunner = taskRunner;
|
|
35458
36011
|
}
|
|
35459
|
-
setupRootResource(
|
|
35460
|
-
root
|
|
36012
|
+
setupRootResource(rootDefinition, config) {
|
|
36013
|
+
const root = {
|
|
36014
|
+
...rootDefinition,
|
|
36015
|
+
dependencies: typeof rootDefinition.dependencies === "function" ? rootDefinition.dependencies(config) : rootDefinition.dependencies
|
|
36016
|
+
};
|
|
35461
36017
|
this.root = {
|
|
35462
36018
|
resource: root,
|
|
35463
36019
|
computedDependencies: {},
|
|
@@ -36010,6 +36566,18 @@ var RunResult = class {
|
|
|
36010
36566
|
}
|
|
36011
36567
|
return this.store.resources.get(resourceId).value;
|
|
36012
36568
|
}, "getResourceValue");
|
|
36569
|
+
/**
|
|
36570
|
+
* Get the config of a resource from the run result.
|
|
36571
|
+
* @param resource - The resource to get the config of.
|
|
36572
|
+
* @returns The config passed for the resource.
|
|
36573
|
+
*/
|
|
36574
|
+
this.getResourceConfig = /* @__PURE__ */ __name((resource2) => {
|
|
36575
|
+
const resourceId = typeof resource2 === "string" ? resource2 : resource2.id;
|
|
36576
|
+
if (!this.store.resources.has(resourceId)) {
|
|
36577
|
+
throw new Error(`Resource "${resourceId}" not found.`);
|
|
36578
|
+
}
|
|
36579
|
+
return this.store.resources.get(resourceId).config;
|
|
36580
|
+
}, "getResourceConfig");
|
|
36013
36581
|
this.dispose = /* @__PURE__ */ __name(() => {
|
|
36014
36582
|
return this.disposeFn();
|
|
36015
36583
|
}, "dispose");
|
|
@@ -37191,7 +37759,7 @@ function makeAsyncContextBuilder(state) {
|
|
|
37191
37759
|
configSchema: state.configSchema,
|
|
37192
37760
|
meta: state.meta
|
|
37193
37761
|
};
|
|
37194
|
-
return defineAsyncContext(def);
|
|
37762
|
+
return defineAsyncContext(def, state.filePath);
|
|
37195
37763
|
}
|
|
37196
37764
|
};
|
|
37197
37765
|
return builder;
|
|
@@ -37200,8 +37768,10 @@ __name(makeAsyncContextBuilder, "makeAsyncContextBuilder");
|
|
|
37200
37768
|
|
|
37201
37769
|
// src/definers/builders/asyncContext/index.ts
|
|
37202
37770
|
function asyncContextBuilder(id2) {
|
|
37771
|
+
const filePath = getCallerFile();
|
|
37203
37772
|
const initial = Object.freeze({
|
|
37204
37773
|
id: id2,
|
|
37774
|
+
filePath,
|
|
37205
37775
|
serialize: void 0,
|
|
37206
37776
|
parse: void 0,
|
|
37207
37777
|
configSchema: void 0,
|
|
@@ -37674,7 +38244,7 @@ function override(base) {
|
|
|
37674
38244
|
}
|
|
37675
38245
|
__name(override, "override");
|
|
37676
38246
|
|
|
37677
|
-
// src/
|
|
38247
|
+
// src/public.ts
|
|
37678
38248
|
init_http_fetch_tunnel_resource();
|
|
37679
38249
|
var globals = {
|
|
37680
38250
|
events: globalEvents,
|
|
@@ -38818,15 +39388,15 @@ var UNSAFE_ERROR_FIELDS = /* @__PURE__ */ new Set([
|
|
|
38818
39388
|
"cause" /* Cause */,
|
|
38819
39389
|
"sql" /* Sql */
|
|
38820
39390
|
]);
|
|
38821
|
-
var
|
|
38822
|
-
var isJsonBody = /* @__PURE__ */ __name((value) =>
|
|
38823
|
-
var toErrorRecord = /* @__PURE__ */ __name((value) =>
|
|
39391
|
+
var isRecord2 = /* @__PURE__ */ __name((value) => !!value && typeof value === "object", "isRecord");
|
|
39392
|
+
var isJsonBody = /* @__PURE__ */ __name((value) => isRecord2(value) && typeof value.ok === "boolean", "isJsonBody");
|
|
39393
|
+
var toErrorRecord = /* @__PURE__ */ __name((value) => isRecord2(value) ? value : void 0, "toErrorRecord");
|
|
38824
39394
|
var sanitizeErrorResponse = /* @__PURE__ */ __name((response) => {
|
|
38825
|
-
const asRecord =
|
|
39395
|
+
const asRecord = isRecord2(response) ? response : void 0;
|
|
38826
39396
|
const statusRaw = asRecord?.status ?? asRecord?.statusCode;
|
|
38827
39397
|
const status = typeof statusRaw === "number" && Number.isFinite(statusRaw) ? statusRaw : 500;
|
|
38828
39398
|
const bodyRaw = asRecord?.body;
|
|
38829
|
-
const body =
|
|
39399
|
+
const body = isRecord2(bodyRaw) ? bodyRaw : void 0;
|
|
38830
39400
|
const errorRaw = (body ? toErrorRecord(body.error) : void 0) ?? toErrorRecord(asRecord?.error);
|
|
38831
39401
|
const normalizedBody = (() => {
|
|
38832
39402
|
if (isJsonBody(bodyRaw)) {
|
|
@@ -38883,7 +39453,7 @@ var resolveAppErrorExtra = /* @__PURE__ */ __name((store2, error2) => {
|
|
|
38883
39453
|
try {
|
|
38884
39454
|
for (const helper of store2.errors.values()) {
|
|
38885
39455
|
if (helper.is(error2)) {
|
|
38886
|
-
if (!
|
|
39456
|
+
if (!isRecord2(error2)) return { id: void 0, data: void 0 };
|
|
38887
39457
|
const name = error2["name" /* Name */];
|
|
38888
39458
|
const id2 = typeof name === "string" ? name : void 0;
|
|
38889
39459
|
const data = error2["data" /* Data */];
|
|
@@ -39599,10 +40169,10 @@ function createDurableStepId(id2) {
|
|
|
39599
40169
|
return { id: id2 };
|
|
39600
40170
|
}
|
|
39601
40171
|
__name(createDurableStepId, "createDurableStepId");
|
|
39602
|
-
function
|
|
40172
|
+
function isRecord3(value) {
|
|
39603
40173
|
return typeof value === "object" && value !== null;
|
|
39604
40174
|
}
|
|
39605
|
-
__name(
|
|
40175
|
+
__name(isRecord3, "isRecord");
|
|
39606
40176
|
function sleepMs(ms) {
|
|
39607
40177
|
return new Promise((resolve) => {
|
|
39608
40178
|
const timer = setTimeout$1(resolve, ms);
|
|
@@ -39632,7 +40202,7 @@ function createExecutionId() {
|
|
|
39632
40202
|
}
|
|
39633
40203
|
__name(createExecutionId, "createExecutionId");
|
|
39634
40204
|
function parseSignalState(value) {
|
|
39635
|
-
if (!
|
|
40205
|
+
if (!isRecord3(value)) return null;
|
|
39636
40206
|
const state = value.state;
|
|
39637
40207
|
if (state === "waiting") {
|
|
39638
40208
|
const timerId = value.timerId;
|
|
@@ -39674,6 +40244,7 @@ var DurableAuditEntryKind = {
|
|
|
39674
40244
|
SignalDelivered: "signal_delivered",
|
|
39675
40245
|
SignalTimedOut: "signal_timed_out",
|
|
39676
40246
|
EmitPublished: "emit_published",
|
|
40247
|
+
SwitchEvaluated: "switch_evaluated",
|
|
39677
40248
|
Note: "note"
|
|
39678
40249
|
};
|
|
39679
40250
|
function isDurableInternalStepId(stepId) {
|
|
@@ -39697,15 +40268,194 @@ var SuspensionSignal = class extends Error {
|
|
|
39697
40268
|
}
|
|
39698
40269
|
};
|
|
39699
40270
|
|
|
40271
|
+
// src/node/durable/core/DurableOperator.ts
|
|
40272
|
+
var DurableOperator = class {
|
|
40273
|
+
constructor(store2) {
|
|
40274
|
+
this.store = store2;
|
|
40275
|
+
}
|
|
40276
|
+
static {
|
|
40277
|
+
__name(this, "DurableOperator");
|
|
40278
|
+
}
|
|
40279
|
+
async listExecutions(options) {
|
|
40280
|
+
if (this.store.listExecutions) {
|
|
40281
|
+
return await this.store.listExecutions(options);
|
|
40282
|
+
}
|
|
40283
|
+
return await this.store.listIncompleteExecutions();
|
|
40284
|
+
}
|
|
40285
|
+
async getExecutionDetail(executionId) {
|
|
40286
|
+
const execution = await this.store.getExecution(executionId);
|
|
40287
|
+
const steps = this.store.listStepResults ? await this.store.listStepResults(executionId) : [];
|
|
40288
|
+
const audit = this.store.listAuditEntries ? await this.store.listAuditEntries(executionId) : [];
|
|
40289
|
+
return { execution, steps, audit };
|
|
40290
|
+
}
|
|
40291
|
+
/**
|
|
40292
|
+
* Resets an execution from `compensation_failed` (or other states) to `pending`.
|
|
40293
|
+
* This effectively retries the workflow from the last memoized step.
|
|
40294
|
+
*/
|
|
40295
|
+
async retryRollback(executionId) {
|
|
40296
|
+
if (!this.store.retryRollback) {
|
|
40297
|
+
throw new Error("Store does not support retryRollback");
|
|
40298
|
+
}
|
|
40299
|
+
await this.store.retryRollback(executionId);
|
|
40300
|
+
}
|
|
40301
|
+
/**
|
|
40302
|
+
* Manually marks a step as completed with a specific result.
|
|
40303
|
+
* Useful for skipping broken steps or providing a manual fix.
|
|
40304
|
+
*/
|
|
40305
|
+
async skipStep(executionId, stepId) {
|
|
40306
|
+
if (!this.store.skipStep) {
|
|
40307
|
+
throw new Error("Store does not support skipStep");
|
|
40308
|
+
}
|
|
40309
|
+
await this.store.skipStep(executionId, stepId);
|
|
40310
|
+
}
|
|
40311
|
+
/**
|
|
40312
|
+
* Forces an execution to the `failed` state.
|
|
40313
|
+
*/
|
|
40314
|
+
async forceFail(executionId, reason) {
|
|
40315
|
+
if (!this.store.forceFail) {
|
|
40316
|
+
throw new Error("Store does not support forceFail");
|
|
40317
|
+
}
|
|
40318
|
+
await this.store.forceFail(executionId, { message: reason });
|
|
40319
|
+
}
|
|
40320
|
+
/**
|
|
40321
|
+
* Manually patches the result of a step.
|
|
40322
|
+
* Useful when a step failed to save its result but the side effect occurred.
|
|
40323
|
+
*/
|
|
40324
|
+
async editState(executionId, stepId, newState) {
|
|
40325
|
+
if (!this.store.editStepResult) {
|
|
40326
|
+
throw new Error("Store does not support editStepResult");
|
|
40327
|
+
}
|
|
40328
|
+
await this.store.editStepResult(executionId, stepId, newState);
|
|
40329
|
+
}
|
|
40330
|
+
/**
|
|
40331
|
+
* Lists all executions that require manual intervention.
|
|
40332
|
+
*/
|
|
40333
|
+
async listStuckExecutions() {
|
|
40334
|
+
if (!this.store.listStuckExecutions) {
|
|
40335
|
+
throw new Error("Store does not support listStuckExecutions");
|
|
40336
|
+
}
|
|
40337
|
+
return await this.store.listStuckExecutions();
|
|
40338
|
+
}
|
|
40339
|
+
};
|
|
40340
|
+
|
|
40341
|
+
// src/node/durable/core/flowShape.ts
|
|
40342
|
+
var FlowRecorder = class {
|
|
40343
|
+
constructor() {
|
|
40344
|
+
this.nodes = [];
|
|
40345
|
+
this.executionId = "__flow_record__";
|
|
40346
|
+
this.attempt = 0;
|
|
40347
|
+
}
|
|
40348
|
+
static {
|
|
40349
|
+
__name(this, "FlowRecorder");
|
|
40350
|
+
}
|
|
40351
|
+
resolveStepId(stepId) {
|
|
40352
|
+
return typeof stepId === "string" ? stepId : stepId.id;
|
|
40353
|
+
}
|
|
40354
|
+
step(stepId, optionsOrFn, _fn) {
|
|
40355
|
+
const id2 = this.resolveStepId(stepId);
|
|
40356
|
+
if (optionsOrFn === void 0) {
|
|
40357
|
+
return new FlowStepRecorder(this, id2);
|
|
40358
|
+
}
|
|
40359
|
+
this.nodes.push({ kind: "step", stepId: id2, hasCompensation: false });
|
|
40360
|
+
return Promise.resolve(void 0);
|
|
40361
|
+
}
|
|
40362
|
+
async sleep(durationMs, options) {
|
|
40363
|
+
this.nodes.push({
|
|
40364
|
+
kind: "sleep",
|
|
40365
|
+
durationMs,
|
|
40366
|
+
stepId: options?.stepId
|
|
40367
|
+
});
|
|
40368
|
+
}
|
|
40369
|
+
async waitForSignal(signal, options) {
|
|
40370
|
+
this.nodes.push({
|
|
40371
|
+
kind: "waitForSignal",
|
|
40372
|
+
signalId: signal.id,
|
|
40373
|
+
timeoutMs: options?.timeoutMs,
|
|
40374
|
+
stepId: options?.stepId
|
|
40375
|
+
});
|
|
40376
|
+
return void 0;
|
|
40377
|
+
}
|
|
40378
|
+
async emit(_event, _payload, options) {
|
|
40379
|
+
this.nodes.push({
|
|
40380
|
+
kind: "emit",
|
|
40381
|
+
eventId: _event.id,
|
|
40382
|
+
stepId: options?.stepId
|
|
40383
|
+
});
|
|
40384
|
+
}
|
|
40385
|
+
async switch(stepId, _value, branches, defaultBranch) {
|
|
40386
|
+
this.nodes.push({
|
|
40387
|
+
kind: "switch",
|
|
40388
|
+
stepId,
|
|
40389
|
+
branchIds: branches.map((b) => b.id),
|
|
40390
|
+
hasDefault: defaultBranch !== void 0
|
|
40391
|
+
});
|
|
40392
|
+
return void 0;
|
|
40393
|
+
}
|
|
40394
|
+
async note(message, _meta) {
|
|
40395
|
+
this.nodes.push({ kind: "note", message });
|
|
40396
|
+
}
|
|
40397
|
+
async rollback() {
|
|
40398
|
+
}
|
|
40399
|
+
};
|
|
40400
|
+
var FlowStepRecorder = class {
|
|
40401
|
+
constructor(recorder, stepId) {
|
|
40402
|
+
this.recorder = recorder;
|
|
40403
|
+
this.stepId = stepId;
|
|
40404
|
+
this.hasDown = false;
|
|
40405
|
+
}
|
|
40406
|
+
static {
|
|
40407
|
+
__name(this, "FlowStepRecorder");
|
|
40408
|
+
}
|
|
40409
|
+
up(_fn) {
|
|
40410
|
+
return this;
|
|
40411
|
+
}
|
|
40412
|
+
down(_fn) {
|
|
40413
|
+
this.hasDown = true;
|
|
40414
|
+
return this;
|
|
40415
|
+
}
|
|
40416
|
+
then(onfulfilled, onrejected) {
|
|
40417
|
+
this.recorder.nodes.push({
|
|
40418
|
+
kind: "step",
|
|
40419
|
+
stepId: this.stepId,
|
|
40420
|
+
hasCompensation: this.hasDown
|
|
40421
|
+
});
|
|
40422
|
+
const result = Promise.resolve(void 0);
|
|
40423
|
+
return result.then(
|
|
40424
|
+
onfulfilled ?? ((v) => v),
|
|
40425
|
+
onrejected
|
|
40426
|
+
);
|
|
40427
|
+
}
|
|
40428
|
+
};
|
|
40429
|
+
async function recordFlowShape(descriptor) {
|
|
40430
|
+
const recorder = new FlowRecorder();
|
|
40431
|
+
await descriptor(recorder);
|
|
40432
|
+
return { nodes: recorder.nodes };
|
|
40433
|
+
}
|
|
40434
|
+
__name(recordFlowShape, "recordFlowShape");
|
|
40435
|
+
|
|
39700
40436
|
// src/node/durable/core/DurableResource.ts
|
|
39701
|
-
var DurableResource = class {
|
|
39702
|
-
constructor(service, contextStorage) {
|
|
40437
|
+
var DurableResource = class _DurableResource {
|
|
40438
|
+
constructor(service, contextStorage, store2, runnerStore) {
|
|
39703
40439
|
this.service = service;
|
|
39704
40440
|
this.contextStorage = contextStorage;
|
|
40441
|
+
this.store = store2;
|
|
40442
|
+
this.runnerStore = runnerStore;
|
|
40443
|
+
this.operatorInstance = null;
|
|
39705
40444
|
}
|
|
39706
40445
|
static {
|
|
39707
40446
|
__name(this, "DurableResource");
|
|
39708
40447
|
}
|
|
40448
|
+
get operator() {
|
|
40449
|
+
if (!this.store) {
|
|
40450
|
+
throw new Error(
|
|
40451
|
+
"Durable operator API is not available: store was not provided to DurableResource. Use a Runner durable resource (durableResource/memoryDurableResource/redisDurableResource) or construct a DurableOperator(store) directly."
|
|
40452
|
+
);
|
|
40453
|
+
}
|
|
40454
|
+
if (!this.operatorInstance) {
|
|
40455
|
+
this.operatorInstance = new DurableOperator(this.store);
|
|
40456
|
+
}
|
|
40457
|
+
return this.operatorInstance;
|
|
40458
|
+
}
|
|
39709
40459
|
use() {
|
|
39710
40460
|
const ctx = this.contextStorage.getStore();
|
|
39711
40461
|
if (!ctx) {
|
|
@@ -39715,6 +40465,47 @@ var DurableResource = class {
|
|
|
39715
40465
|
}
|
|
39716
40466
|
return ctx;
|
|
39717
40467
|
}
|
|
40468
|
+
async describe(task2, input) {
|
|
40469
|
+
if (!this.runnerStore) {
|
|
40470
|
+
throw new Error(
|
|
40471
|
+
"Durable describe API is not available: runner store was not provided to DurableResource. Use a Runner durable resource (durableResource/memoryDurableResource/redisDurableResource) instead of manually constructing DurableResource."
|
|
40472
|
+
);
|
|
40473
|
+
}
|
|
40474
|
+
const storeTask = this.runnerStore.tasks.get(task2.id);
|
|
40475
|
+
if (!storeTask) {
|
|
40476
|
+
throw new Error(
|
|
40477
|
+
`Cannot describe task "${task2.id}": task is not registered in the runtime store.`
|
|
40478
|
+
);
|
|
40479
|
+
}
|
|
40480
|
+
const effectiveTask = storeTask.task;
|
|
40481
|
+
if (!storeTask.computedDependencies) {
|
|
40482
|
+
throw new Error(
|
|
40483
|
+
`Cannot describe task "${task2.id}": task dependencies are not available in the runtime store.`
|
|
40484
|
+
);
|
|
40485
|
+
}
|
|
40486
|
+
const deps = storeTask.computedDependencies;
|
|
40487
|
+
return await recordFlowShape(async (ctx) => {
|
|
40488
|
+
const depsWithRecorder = this.injectRecorderIntoDurableDeps(deps, ctx);
|
|
40489
|
+
await effectiveTask.run(input, depsWithRecorder);
|
|
40490
|
+
});
|
|
40491
|
+
}
|
|
40492
|
+
injectRecorderIntoDurableDeps(deps, ctx) {
|
|
40493
|
+
const next = { ...deps };
|
|
40494
|
+
for (const [key, value] of Object.entries(deps)) {
|
|
40495
|
+
if (!(value instanceof _DurableResource)) {
|
|
40496
|
+
continue;
|
|
40497
|
+
}
|
|
40498
|
+
next[key] = new Proxy(value, {
|
|
40499
|
+
get(target, prop, receiver) {
|
|
40500
|
+
if (prop === "use") {
|
|
40501
|
+
return () => ctx;
|
|
40502
|
+
}
|
|
40503
|
+
return Reflect.get(target, prop, receiver);
|
|
40504
|
+
}
|
|
40505
|
+
});
|
|
40506
|
+
}
|
|
40507
|
+
return next;
|
|
40508
|
+
}
|
|
39718
40509
|
startExecution(task2, input, options) {
|
|
39719
40510
|
return this.service.startExecution(task2, input, options);
|
|
39720
40511
|
}
|
|
@@ -40410,7 +41201,7 @@ var ScheduleManager = class {
|
|
|
40410
41201
|
// src/node/durable/core/managers/SignalHandler.ts
|
|
40411
41202
|
var isWaitingSignalStep = /* @__PURE__ */ __name((step) => {
|
|
40412
41203
|
const result = step.result;
|
|
40413
|
-
if (!
|
|
41204
|
+
if (!isRecord3(result)) return false;
|
|
40414
41205
|
const waitResult = result;
|
|
40415
41206
|
if (waitResult.state !== "waiting") return false;
|
|
40416
41207
|
if (typeof waitResult.signalId !== "string") return false;
|
|
@@ -40887,7 +41678,7 @@ function getSignalId(signal) {
|
|
|
40887
41678
|
}
|
|
40888
41679
|
__name(getSignalId, "getSignalId");
|
|
40889
41680
|
function parseSignalStepState(value) {
|
|
40890
|
-
if (!
|
|
41681
|
+
if (!isRecord3(value)) return null;
|
|
40891
41682
|
const state = value.state;
|
|
40892
41683
|
if (state === "waiting") {
|
|
40893
41684
|
const signalId = value.signalId;
|
|
@@ -41083,6 +41874,58 @@ async function waitForSignalDurably(params) {
|
|
|
41083
41874
|
}
|
|
41084
41875
|
__name(waitForSignalDurably, "waitForSignalDurably");
|
|
41085
41876
|
|
|
41877
|
+
// src/node/durable/core/durable-context/DurableContext.switch.ts
|
|
41878
|
+
async function switchDurably(params) {
|
|
41879
|
+
await params.assertNotCancelled();
|
|
41880
|
+
params.assertUniqueStepId(params.stepId);
|
|
41881
|
+
const cached = await params.store.getStepResult(
|
|
41882
|
+
params.executionId,
|
|
41883
|
+
params.stepId
|
|
41884
|
+
);
|
|
41885
|
+
if (cached) {
|
|
41886
|
+
const persisted = cached.result;
|
|
41887
|
+
return persisted.result;
|
|
41888
|
+
}
|
|
41889
|
+
const startedAt = Date.now();
|
|
41890
|
+
let matchedBranch = null;
|
|
41891
|
+
for (const branch of params.branches) {
|
|
41892
|
+
if (branch.match(params.value)) {
|
|
41893
|
+
matchedBranch = { id: branch.id, run: branch.run };
|
|
41894
|
+
break;
|
|
41895
|
+
}
|
|
41896
|
+
}
|
|
41897
|
+
if (!matchedBranch && params.defaultBranch) {
|
|
41898
|
+
matchedBranch = {
|
|
41899
|
+
id: params.defaultBranch.id,
|
|
41900
|
+
run: params.defaultBranch.run
|
|
41901
|
+
};
|
|
41902
|
+
}
|
|
41903
|
+
if (!matchedBranch) {
|
|
41904
|
+
throw new Error(
|
|
41905
|
+
`Durable switch '${params.stepId}': no branch matched and no default provided`
|
|
41906
|
+
);
|
|
41907
|
+
}
|
|
41908
|
+
const result = await matchedBranch.run(params.value);
|
|
41909
|
+
const durationMs = Date.now() - startedAt;
|
|
41910
|
+
await params.store.saveStepResult({
|
|
41911
|
+
executionId: params.executionId,
|
|
41912
|
+
stepId: params.stepId,
|
|
41913
|
+
result: {
|
|
41914
|
+
branchId: matchedBranch.id,
|
|
41915
|
+
result
|
|
41916
|
+
},
|
|
41917
|
+
completedAt: /* @__PURE__ */ new Date()
|
|
41918
|
+
});
|
|
41919
|
+
await params.appendAuditEntry({
|
|
41920
|
+
kind: DurableAuditEntryKind.SwitchEvaluated,
|
|
41921
|
+
stepId: params.stepId,
|
|
41922
|
+
branchId: matchedBranch.id,
|
|
41923
|
+
durationMs
|
|
41924
|
+
});
|
|
41925
|
+
return result;
|
|
41926
|
+
}
|
|
41927
|
+
__name(switchDurably, "switchDurably");
|
|
41928
|
+
|
|
41086
41929
|
// src/node/durable/core/DurableContext.ts
|
|
41087
41930
|
var DurableContext = class {
|
|
41088
41931
|
constructor(store2, bus, executionId, attempt, options = {}) {
|
|
@@ -41203,6 +42046,20 @@ var DurableContext = class {
|
|
|
41203
42046
|
options
|
|
41204
42047
|
});
|
|
41205
42048
|
}
|
|
42049
|
+
async switch(stepId, value, branches, defaultBranch) {
|
|
42050
|
+
this.determinism.assertUserStepId(stepId);
|
|
42051
|
+
return await switchDurably({
|
|
42052
|
+
store: this.store,
|
|
42053
|
+
executionId: this.executionId,
|
|
42054
|
+
assertNotCancelled: this.assertNotCancelled.bind(this),
|
|
42055
|
+
appendAuditEntry: this.audit.append,
|
|
42056
|
+
assertUniqueStepId: this.determinism.assertUniqueStepId,
|
|
42057
|
+
stepId,
|
|
42058
|
+
value,
|
|
42059
|
+
branches,
|
|
42060
|
+
defaultBranch
|
|
42061
|
+
});
|
|
42062
|
+
}
|
|
41206
42063
|
async note(message, meta) {
|
|
41207
42064
|
if (!this.audit.isEnabled()) return;
|
|
41208
42065
|
const stepId = `__note:${this.noteIndex}`;
|
|
@@ -42016,13 +42873,11 @@ async function initDurableWorker(service, queue) {
|
|
|
42016
42873
|
}
|
|
42017
42874
|
__name(initDurableWorker, "initDurableWorker");
|
|
42018
42875
|
|
|
42019
|
-
// src/node/durable/core/
|
|
42020
|
-
|
|
42021
|
-
|
|
42022
|
-
|
|
42023
|
-
|
|
42024
|
-
}).init(async (config, { taskRunner, eventManager, runnerStore }) => {
|
|
42025
|
-
const runnerEmitter = createDurableRunnerAuditEmitter({ eventManager });
|
|
42876
|
+
// src/node/durable/core/createRunnerDurableRuntime.ts
|
|
42877
|
+
async function createRunnerDurableRuntime(config, deps) {
|
|
42878
|
+
const runnerEmitter = createDurableRunnerAuditEmitter({
|
|
42879
|
+
eventManager: deps.eventManager
|
|
42880
|
+
});
|
|
42026
42881
|
const userEmitter = config.audit?.emitter;
|
|
42027
42882
|
const auditEmitter = userEmitter ? {
|
|
42028
42883
|
emit: /* @__PURE__ */ __name(async (entry) => {
|
|
@@ -42045,7 +42900,10 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42045
42900
|
},
|
|
42046
42901
|
taskExecutor: {
|
|
42047
42902
|
run: /* @__PURE__ */ __name(async (task2, input) => {
|
|
42048
|
-
const outputPromise = await taskRunner.run(
|
|
42903
|
+
const outputPromise = await deps.taskRunner.run(
|
|
42904
|
+
task2,
|
|
42905
|
+
input
|
|
42906
|
+
);
|
|
42049
42907
|
if (outputPromise === void 0) {
|
|
42050
42908
|
throw new Error(
|
|
42051
42909
|
`Durable task '${task2.id}' completed without a result promise.`
|
|
@@ -42055,7 +42913,7 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42055
42913
|
}, "run")
|
|
42056
42914
|
},
|
|
42057
42915
|
taskResolver: /* @__PURE__ */ __name((taskId) => {
|
|
42058
|
-
const storeTask = runnerStore.tasks.get(taskId);
|
|
42916
|
+
const storeTask = deps.runnerStore.tasks.get(taskId);
|
|
42059
42917
|
return storeTask?.task;
|
|
42060
42918
|
}, "taskResolver"),
|
|
42061
42919
|
contextProvider: /* @__PURE__ */ __name((ctx, fn) => contextStorage.run(ctx, fn), "contextProvider")
|
|
@@ -42063,81 +42921,30 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42063
42921
|
if (config.worker === true && config.queue) {
|
|
42064
42922
|
await initDurableWorker(service, config.queue);
|
|
42065
42923
|
}
|
|
42066
|
-
return new DurableResource(
|
|
42924
|
+
return new DurableResource(
|
|
42925
|
+
service,
|
|
42926
|
+
contextStorage,
|
|
42927
|
+
config.store,
|
|
42928
|
+
deps.runnerStore
|
|
42929
|
+
);
|
|
42930
|
+
}
|
|
42931
|
+
__name(createRunnerDurableRuntime, "createRunnerDurableRuntime");
|
|
42932
|
+
|
|
42933
|
+
// src/node/durable/core/resource.ts
|
|
42934
|
+
var durableResource = r.resource("base.durable").register(durableEventsArray).dependencies({
|
|
42935
|
+
taskRunner: globals.resources.taskRunner,
|
|
42936
|
+
eventManager: globals.resources.eventManager,
|
|
42937
|
+
runnerStore: globals.resources.store
|
|
42938
|
+
}).init(async (config, { taskRunner, eventManager, runnerStore }) => {
|
|
42939
|
+
return await createRunnerDurableRuntime(config, {
|
|
42940
|
+
taskRunner,
|
|
42941
|
+
eventManager,
|
|
42942
|
+
runnerStore
|
|
42943
|
+
});
|
|
42067
42944
|
}).dispose(
|
|
42068
42945
|
async (durable, config) => disposeDurableService(durable.service, config)
|
|
42069
42946
|
).build();
|
|
42070
42947
|
|
|
42071
|
-
// src/node/durable/core/DurableOperator.ts
|
|
42072
|
-
var DurableOperator = class {
|
|
42073
|
-
constructor(store2) {
|
|
42074
|
-
this.store = store2;
|
|
42075
|
-
}
|
|
42076
|
-
static {
|
|
42077
|
-
__name(this, "DurableOperator");
|
|
42078
|
-
}
|
|
42079
|
-
async listExecutions(options) {
|
|
42080
|
-
if (this.store.listExecutions) {
|
|
42081
|
-
return await this.store.listExecutions(options);
|
|
42082
|
-
}
|
|
42083
|
-
return await this.store.listIncompleteExecutions();
|
|
42084
|
-
}
|
|
42085
|
-
async getExecutionDetail(executionId) {
|
|
42086
|
-
const execution = await this.store.getExecution(executionId);
|
|
42087
|
-
const steps = this.store.listStepResults ? await this.store.listStepResults(executionId) : [];
|
|
42088
|
-
const audit = this.store.listAuditEntries ? await this.store.listAuditEntries(executionId) : [];
|
|
42089
|
-
return { execution, steps, audit };
|
|
42090
|
-
}
|
|
42091
|
-
/**
|
|
42092
|
-
* Resets an execution from `compensation_failed` (or other states) to `pending`.
|
|
42093
|
-
* This effectively retries the workflow from the last memoized step.
|
|
42094
|
-
*/
|
|
42095
|
-
async retryRollback(executionId) {
|
|
42096
|
-
if (!this.store.retryRollback) {
|
|
42097
|
-
throw new Error("Store does not support retryRollback");
|
|
42098
|
-
}
|
|
42099
|
-
await this.store.retryRollback(executionId);
|
|
42100
|
-
}
|
|
42101
|
-
/**
|
|
42102
|
-
* Manually marks a step as completed with a specific result.
|
|
42103
|
-
* Useful for skipping broken steps or providing a manual fix.
|
|
42104
|
-
*/
|
|
42105
|
-
async skipStep(executionId, stepId) {
|
|
42106
|
-
if (!this.store.skipStep) {
|
|
42107
|
-
throw new Error("Store does not support skipStep");
|
|
42108
|
-
}
|
|
42109
|
-
await this.store.skipStep(executionId, stepId);
|
|
42110
|
-
}
|
|
42111
|
-
/**
|
|
42112
|
-
* Forces an execution to the `failed` state.
|
|
42113
|
-
*/
|
|
42114
|
-
async forceFail(executionId, reason) {
|
|
42115
|
-
if (!this.store.forceFail) {
|
|
42116
|
-
throw new Error("Store does not support forceFail");
|
|
42117
|
-
}
|
|
42118
|
-
await this.store.forceFail(executionId, { message: reason });
|
|
42119
|
-
}
|
|
42120
|
-
/**
|
|
42121
|
-
* Manually patches the result of a step.
|
|
42122
|
-
* Useful when a step failed to save its result but the side effect occurred.
|
|
42123
|
-
*/
|
|
42124
|
-
async editState(executionId, stepId, newState) {
|
|
42125
|
-
if (!this.store.editStepResult) {
|
|
42126
|
-
throw new Error("Store does not support editStepResult");
|
|
42127
|
-
}
|
|
42128
|
-
await this.store.editStepResult(executionId, stepId, newState);
|
|
42129
|
-
}
|
|
42130
|
-
/**
|
|
42131
|
-
* Lists all executions that require manual intervention.
|
|
42132
|
-
*/
|
|
42133
|
-
async listStuckExecutions() {
|
|
42134
|
-
if (!this.store.listStuckExecutions) {
|
|
42135
|
-
throw new Error("Store does not support listStuckExecutions");
|
|
42136
|
-
}
|
|
42137
|
-
return await this.store.listStuckExecutions();
|
|
42138
|
-
}
|
|
42139
|
-
};
|
|
42140
|
-
|
|
42141
42948
|
// src/node/durable/dashboard/server.ts
|
|
42142
42949
|
var express = __toESM(require_express2());
|
|
42143
42950
|
function findUp(startDir, filename) {
|
|
@@ -42521,7 +43328,7 @@ function createIORedisClient(url) {
|
|
|
42521
43328
|
__name(createIORedisClient, "createIORedisClient");
|
|
42522
43329
|
|
|
42523
43330
|
// src/node/durable/store/RedisStore.ts
|
|
42524
|
-
var serializer2 =
|
|
43331
|
+
var serializer2 = new Serializer();
|
|
42525
43332
|
var RedisStore = class {
|
|
42526
43333
|
static {
|
|
42527
43334
|
__name(this, "RedisStore");
|
|
@@ -43265,6 +44072,114 @@ async function waitUntil(predicate, options) {
|
|
|
43265
44072
|
}
|
|
43266
44073
|
__name(waitUntil, "waitUntil");
|
|
43267
44074
|
|
|
44075
|
+
// src/node/durable/resources/memoryDurableResource.ts
|
|
44076
|
+
var memoryDurableResource = r.resource("base.durable.memory").register(durableEventsArray).dependencies({
|
|
44077
|
+
taskRunner: globals.resources.taskRunner,
|
|
44078
|
+
eventManager: globals.resources.eventManager,
|
|
44079
|
+
runnerStore: globals.resources.store
|
|
44080
|
+
}).context(() => ({ runtimeConfig: null })).init(async function(config, { taskRunner, eventManager, runnerStore }, ctx) {
|
|
44081
|
+
config.namespace ?? this.id;
|
|
44082
|
+
const shouldCreateQueue = config.queue?.enabled ?? config.worker === true;
|
|
44083
|
+
const queue = shouldCreateQueue ? new MemoryQueue() : void 0;
|
|
44084
|
+
const worker = config.worker ?? Boolean(queue);
|
|
44085
|
+
const runtimeConfig = {
|
|
44086
|
+
...config,
|
|
44087
|
+
worker,
|
|
44088
|
+
store: new MemoryStore(),
|
|
44089
|
+
eventBus: new MemoryEventBus(),
|
|
44090
|
+
queue
|
|
44091
|
+
};
|
|
44092
|
+
ctx.runtimeConfig = runtimeConfig;
|
|
44093
|
+
return await createRunnerDurableRuntime(runtimeConfig, {
|
|
44094
|
+
taskRunner,
|
|
44095
|
+
eventManager,
|
|
44096
|
+
runnerStore
|
|
44097
|
+
});
|
|
44098
|
+
}).dispose(async (durable, _config, _deps, ctx) => {
|
|
44099
|
+
if (!ctx.runtimeConfig) return;
|
|
44100
|
+
await disposeDurableService(durable.service, ctx.runtimeConfig);
|
|
44101
|
+
}).build();
|
|
44102
|
+
|
|
44103
|
+
// src/node/durable/resources/isolation.ts
|
|
44104
|
+
function normalizePrefix(prefix) {
|
|
44105
|
+
return prefix.endsWith(":") ? prefix : `${prefix}:`;
|
|
44106
|
+
}
|
|
44107
|
+
__name(normalizePrefix, "normalizePrefix");
|
|
44108
|
+
function deriveDurableIsolation(params) {
|
|
44109
|
+
if (params.namespace.trim().length === 0) {
|
|
44110
|
+
validationError.throw({
|
|
44111
|
+
subject: "Durable isolation namespace",
|
|
44112
|
+
id: "params.namespace",
|
|
44113
|
+
originalError: "must be a non-empty string"
|
|
44114
|
+
});
|
|
44115
|
+
}
|
|
44116
|
+
const encodedNamespace = encodeURIComponent(params.namespace);
|
|
44117
|
+
const storePrefix = normalizePrefix(
|
|
44118
|
+
params.storePrefix ?? `durable:${encodedNamespace}:`
|
|
44119
|
+
);
|
|
44120
|
+
const busPrefix = normalizePrefix(
|
|
44121
|
+
params.busPrefix ?? `durable:bus:${encodedNamespace}:`
|
|
44122
|
+
);
|
|
44123
|
+
return {
|
|
44124
|
+
namespace: params.namespace,
|
|
44125
|
+
encodedNamespace,
|
|
44126
|
+
storePrefix,
|
|
44127
|
+
busPrefix,
|
|
44128
|
+
queueName: params.queueName ?? `durable_executions:${encodedNamespace}`,
|
|
44129
|
+
deadLetterQueueName: params.deadLetterQueueName ?? `durable_executions:dlq:${encodedNamespace}`
|
|
44130
|
+
};
|
|
44131
|
+
}
|
|
44132
|
+
__name(deriveDurableIsolation, "deriveDurableIsolation");
|
|
44133
|
+
|
|
44134
|
+
// src/node/durable/resources/redisDurableResource.ts
|
|
44135
|
+
var redisDurableResource = r.resource("base.durable.redis").register(durableEventsArray).dependencies({
|
|
44136
|
+
taskRunner: globals.resources.taskRunner,
|
|
44137
|
+
eventManager: globals.resources.eventManager,
|
|
44138
|
+
runnerStore: globals.resources.store
|
|
44139
|
+
}).context(() => ({ runtimeConfig: null })).init(async function(config, { taskRunner, eventManager, runnerStore }, ctx) {
|
|
44140
|
+
const namespace = config.namespace ?? this.id;
|
|
44141
|
+
const isolation = deriveDurableIsolation({
|
|
44142
|
+
namespace,
|
|
44143
|
+
storePrefix: config.store?.prefix,
|
|
44144
|
+
busPrefix: config.eventBus?.prefix,
|
|
44145
|
+
queueName: config.queue?.name,
|
|
44146
|
+
deadLetterQueueName: config.queue?.deadLetter
|
|
44147
|
+
});
|
|
44148
|
+
const queue = config.queue ? new RabbitMQQueue({
|
|
44149
|
+
url: config.queue.url,
|
|
44150
|
+
prefetch: config.queue.prefetch,
|
|
44151
|
+
queue: {
|
|
44152
|
+
name: isolation.queueName,
|
|
44153
|
+
quorum: config.queue.quorum,
|
|
44154
|
+
deadLetter: isolation.deadLetterQueueName,
|
|
44155
|
+
messageTtl: config.queue.messageTtl
|
|
44156
|
+
}
|
|
44157
|
+
}) : void 0;
|
|
44158
|
+
const worker = config.worker ?? Boolean(queue);
|
|
44159
|
+
const runtimeConfig = {
|
|
44160
|
+
...config,
|
|
44161
|
+
worker,
|
|
44162
|
+
store: new RedisStore({
|
|
44163
|
+
redis: config.redis.url,
|
|
44164
|
+
prefix: isolation.storePrefix
|
|
44165
|
+
}),
|
|
44166
|
+
eventBus: new RedisEventBus({
|
|
44167
|
+
redis: config.redis.url,
|
|
44168
|
+
prefix: isolation.busPrefix
|
|
44169
|
+
}),
|
|
44170
|
+
queue
|
|
44171
|
+
};
|
|
44172
|
+
ctx.runtimeConfig = runtimeConfig;
|
|
44173
|
+
return await createRunnerDurableRuntime(runtimeConfig, {
|
|
44174
|
+
taskRunner,
|
|
44175
|
+
eventManager,
|
|
44176
|
+
runnerStore
|
|
44177
|
+
});
|
|
44178
|
+
}).dispose(async (durable, _config, _deps, ctx) => {
|
|
44179
|
+
if (!ctx.runtimeConfig) return;
|
|
44180
|
+
await disposeDurableService(durable.service, ctx.runtimeConfig);
|
|
44181
|
+
}).build();
|
|
44182
|
+
|
|
43268
44183
|
// src/node/node.ts
|
|
43269
44184
|
var globals2 = {
|
|
43270
44185
|
...globals,
|
|
@@ -43595,6 +44510,6 @@ serve-static/index.js:
|
|
|
43595
44510
|
*)
|
|
43596
44511
|
*/
|
|
43597
44512
|
|
|
43598
|
-
export { DependencyProcessor, DurableAuditEntryKind, DurableContext, DurableExecutionError, DurableOperator, DurableResource, DurableService, DurableWorker, errors_exports as Errors, EventManager, ExecutionStatus, Logger, MemoryEventBus, MemoryQueue, MemoryStore, MiddlewareManager, NoopEventBus, PlatformAdapter, Queue, RabbitMQQueue, RedisEventBus, RedisStore, ResourceInitializer, RunResult, ScheduleStatus, ScheduleType, Semaphore, Serializer, StepBuilder, Store, SuspensionSignal, TaskRunner, TimerStatus, TimerType, allFalse, defineAsyncContext as asyncContext, bindProcessErrorHandler, createContext2 as createContext, createDashboardMiddleware, createDefaultUnhandledError, createDurableAuditEntryId, createDurableRunnerAuditEmitter, createDurableStepId, createDurableTestSetup, createExposureFetch, createHttpClient, createHttpMixedClient, createHttpSmartClient, createNodeFile, createTestResource, debug, debugLevels, defs_exports as definitions, disposeDurableService, durableEvents, durableEventsArray, durableResource, defineEvent as event, getConfig,
|
|
44513
|
+
export { DependencyProcessor, DurableAuditEntryKind, DurableContext, DurableExecutionError, DurableOperator, DurableResource, DurableService, DurableWorker, errors_exports as Errors, EventManager, ExecutionStatus, LogPrinter, Logger, MemoryEventBus, MemoryQueue, MemoryStore, MiddlewareManager, NoopEventBus, PlatformAdapter, Queue, RabbitMQQueue, RedisEventBus, RedisStore, ResourceInitializer, RunResult, ScheduleStatus, ScheduleType, Semaphore, Serializer, StepBuilder, Store, SuspensionSignal, SymbolPolicy, SymbolPolicyErrorMessage, TaskRunner, TimerStatus, TimerType, allFalse, defineAsyncContext as asyncContext, bindProcessErrorHandler, createContext2 as createContext, createDashboardMiddleware, createDefaultUnhandledError, createDurableAuditEntryId, createDurableRunnerAuditEmitter, createDurableStepId, createDurableTestSetup, createExposureFetch, createHttpClient, createHttpMixedClient, createHttpSmartClient, createNodeFile, createRunnerDurableRuntime, createTestResource, debug, debugLevels, defs_exports as definitions, disposeDurableService, durableEvents, durableEventsArray, durableResource, defineEvent as event, getConfig, globals2 as globals, hasExposureContext, defineHook as hook, initDurableService, initDurableWorker, isDurableInternalStepId, journal, levelNormal, levelVerbose, memoryDurableResource, nodeExposure, normalizeError, defineOverride as override, r, readInputFileToBuffer, redisDurableResource, defineResource as resource, defineResourceMiddleware as resourceMiddleware, run2 as run, safeReportUnhandledError, setPlatform, defineTag as tag, defineTask as task, defineTaskMiddleware as taskMiddleware, useExposureContext, waitUntil, writeInputFileToPath };
|
|
43599
44514
|
//# sourceMappingURL=node.mjs.map
|
|
43600
44515
|
//# sourceMappingURL=node.mjs.map
|