@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.cjs
CHANGED
|
@@ -2666,10 +2666,10 @@ var require_bom_handling = __commonJS({
|
|
|
2666
2666
|
// node_modules/raw-body/node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
2667
2667
|
var require_merge_exports = __commonJS({
|
|
2668
2668
|
"node_modules/raw-body/node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports, module) {
|
|
2669
|
-
var
|
|
2669
|
+
var hasOwn3 = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
2670
2670
|
function mergeModules(target, module2) {
|
|
2671
2671
|
for (var key in module2) {
|
|
2672
|
-
if (
|
|
2672
|
+
if (hasOwn3(module2, key)) {
|
|
2673
2673
|
target[key] = module2[key];
|
|
2674
2674
|
}
|
|
2675
2675
|
}
|
|
@@ -6640,10 +6640,10 @@ var require_bom_handling2 = __commonJS({
|
|
|
6640
6640
|
// node_modules/body-parser/node_modules/iconv-lite/lib/helpers/merge-exports.js
|
|
6641
6641
|
var require_merge_exports2 = __commonJS({
|
|
6642
6642
|
"node_modules/body-parser/node_modules/iconv-lite/lib/helpers/merge-exports.js"(exports, module) {
|
|
6643
|
-
var
|
|
6643
|
+
var hasOwn3 = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn;
|
|
6644
6644
|
function mergeModules(target, module2) {
|
|
6645
6645
|
for (var key in module2) {
|
|
6646
|
-
if (
|
|
6646
|
+
if (hasOwn3(module2, key)) {
|
|
6647
6647
|
target[key] = module2[key];
|
|
6648
6648
|
}
|
|
6649
6649
|
}
|
|
@@ -20967,11 +20967,11 @@ var require_object_inspect = __commonJS({
|
|
|
20967
20967
|
return false;
|
|
20968
20968
|
}
|
|
20969
20969
|
__name(isBigInt, "isBigInt");
|
|
20970
|
-
var
|
|
20970
|
+
var hasOwn3 = Object.prototype.hasOwnProperty || function(key) {
|
|
20971
20971
|
return key in this;
|
|
20972
20972
|
};
|
|
20973
20973
|
function has(obj, key) {
|
|
20974
|
-
return
|
|
20974
|
+
return hasOwn3.call(obj, key);
|
|
20975
20975
|
}
|
|
20976
20976
|
__name(has, "has");
|
|
20977
20977
|
function toStr(obj) {
|
|
@@ -21954,7 +21954,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
21954
21954
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
21955
21955
|
};
|
|
21956
21956
|
var bind = require_function_bind();
|
|
21957
|
-
var
|
|
21957
|
+
var hasOwn3 = require_hasown();
|
|
21958
21958
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
21959
21959
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
21960
21960
|
var $replace = bind.call($call, String.prototype.replace);
|
|
@@ -21979,11 +21979,11 @@ var require_get_intrinsic = __commonJS({
|
|
|
21979
21979
|
var getBaseIntrinsic = /* @__PURE__ */ __name(function getBaseIntrinsic2(name, allowMissing) {
|
|
21980
21980
|
var intrinsicName = name;
|
|
21981
21981
|
var alias;
|
|
21982
|
-
if (
|
|
21982
|
+
if (hasOwn3(LEGACY_ALIASES, intrinsicName)) {
|
|
21983
21983
|
alias = LEGACY_ALIASES[intrinsicName];
|
|
21984
21984
|
intrinsicName = "%" + alias[0] + "%";
|
|
21985
21985
|
}
|
|
21986
|
-
if (
|
|
21986
|
+
if (hasOwn3(INTRINSICS, intrinsicName)) {
|
|
21987
21987
|
var value = INTRINSICS[intrinsicName];
|
|
21988
21988
|
if (value === needsEval) {
|
|
21989
21989
|
value = doEval(intrinsicName);
|
|
@@ -22032,7 +22032,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
22032
22032
|
}
|
|
22033
22033
|
intrinsicBaseName += "." + part;
|
|
22034
22034
|
intrinsicRealName = "%" + intrinsicBaseName + "%";
|
|
22035
|
-
if (
|
|
22035
|
+
if (hasOwn3(INTRINSICS, intrinsicRealName)) {
|
|
22036
22036
|
value = INTRINSICS[intrinsicRealName];
|
|
22037
22037
|
} else if (value != null) {
|
|
22038
22038
|
if (!(part in value)) {
|
|
@@ -22050,7 +22050,7 @@ var require_get_intrinsic = __commonJS({
|
|
|
22050
22050
|
value = value[part];
|
|
22051
22051
|
}
|
|
22052
22052
|
} else {
|
|
22053
|
-
isOwn =
|
|
22053
|
+
isOwn = hasOwn3(value, part);
|
|
22054
22054
|
value = value[part];
|
|
22055
22055
|
}
|
|
22056
22056
|
if (isOwn && !skipFurtherCaching) {
|
|
@@ -28615,6 +28615,9 @@ var symbolPhantomTask = Symbol.for(
|
|
|
28615
28615
|
"runner.task.phantom"
|
|
28616
28616
|
);
|
|
28617
28617
|
var symbolResource = Symbol.for("runner.resource");
|
|
28618
|
+
var symbolResourceForkedFrom = Symbol.for(
|
|
28619
|
+
"runner.resourceForkedFrom"
|
|
28620
|
+
);
|
|
28618
28621
|
var symbolResourceWithConfig = Symbol.for(
|
|
28619
28622
|
"runner.resourceWithConfig"
|
|
28620
28623
|
);
|
|
@@ -28644,88 +28647,227 @@ var symbolAsyncContext = Symbol.for(
|
|
|
28644
28647
|
"runner.asyncContext"
|
|
28645
28648
|
);
|
|
28646
28649
|
|
|
28647
|
-
// src/
|
|
28648
|
-
|
|
28649
|
-
|
|
28650
|
-
return mod.AsyncLocalStorage;
|
|
28650
|
+
// src/tools/getCallerFile.ts
|
|
28651
|
+
function isNodeInline() {
|
|
28652
|
+
return typeof process !== "undefined" && typeof process?.versions?.node === "string";
|
|
28651
28653
|
}
|
|
28652
|
-
__name(
|
|
28653
|
-
|
|
28654
|
-
|
|
28655
|
-
|
|
28656
|
-
|
|
28657
|
-
|
|
28658
|
-
|
|
28659
|
-
|
|
28660
|
-
|
|
28661
|
-
|
|
28662
|
-
|
|
28663
|
-
|
|
28664
|
-
|
|
28665
|
-
|
|
28666
|
-
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
process.on("uncaughtException", h);
|
|
28670
|
-
return () => process.off("uncaughtException", h);
|
|
28671
|
-
}
|
|
28672
|
-
onUnhandledRejection(handler) {
|
|
28673
|
-
const h = /* @__PURE__ */ __name((reason) => handler(reason), "h");
|
|
28674
|
-
process.on("unhandledRejection", h);
|
|
28675
|
-
return () => process.off("unhandledRejection", h);
|
|
28676
|
-
}
|
|
28677
|
-
onShutdownSignal(handler) {
|
|
28678
|
-
process.on("SIGINT", handler);
|
|
28679
|
-
process.on("SIGTERM", handler);
|
|
28680
|
-
return () => {
|
|
28681
|
-
process.off("SIGINT", handler);
|
|
28682
|
-
process.off("SIGTERM", handler);
|
|
28683
|
-
};
|
|
28684
|
-
}
|
|
28685
|
-
exit(code) {
|
|
28686
|
-
process.exit(code);
|
|
28687
|
-
}
|
|
28688
|
-
getEnv(key) {
|
|
28689
|
-
return process.env[key];
|
|
28690
|
-
}
|
|
28691
|
-
hasAsyncLocalStorage() {
|
|
28692
|
-
return true;
|
|
28654
|
+
__name(isNodeInline, "isNodeInline");
|
|
28655
|
+
function getCallerFile() {
|
|
28656
|
+
const originalPrepare = Error.prepareStackTrace;
|
|
28657
|
+
try {
|
|
28658
|
+
if (isNodeInline()) {
|
|
28659
|
+
const err = new Error();
|
|
28660
|
+
Error.prepareStackTrace = (_err, stack2) => stack2;
|
|
28661
|
+
const stack = err.stack;
|
|
28662
|
+
stack.shift();
|
|
28663
|
+
stack.shift();
|
|
28664
|
+
const candidate = stack.shift();
|
|
28665
|
+
const file = candidate?.getFileName?.();
|
|
28666
|
+
return file;
|
|
28667
|
+
}
|
|
28668
|
+
return "unknown";
|
|
28669
|
+
} finally {
|
|
28670
|
+
Error.prepareStackTrace = originalPrepare;
|
|
28693
28671
|
}
|
|
28694
|
-
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
|
|
28706
|
-
|
|
28707
|
-
|
|
28708
|
-
|
|
28709
|
-
|
|
28710
|
-
|
|
28711
|
-
|
|
28712
|
-
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28672
|
+
}
|
|
28673
|
+
__name(getCallerFile, "getCallerFile");
|
|
28674
|
+
|
|
28675
|
+
// src/defs.ts
|
|
28676
|
+
var defs_exports = {};
|
|
28677
|
+
__export(defs_exports, {
|
|
28678
|
+
CONTRACT: () => CONTRACT,
|
|
28679
|
+
HookDependencyState: () => HookDependencyState,
|
|
28680
|
+
RunnerMode: () => RunnerMode,
|
|
28681
|
+
isOneOf: () => isOneOf,
|
|
28682
|
+
onAnyOf: () => onAnyOf,
|
|
28683
|
+
symbolAsyncContext: () => symbolAsyncContext,
|
|
28684
|
+
symbolError: () => symbolError,
|
|
28685
|
+
symbolEvent: () => symbolEvent,
|
|
28686
|
+
symbolFilePath: () => symbolFilePath,
|
|
28687
|
+
symbolHook: () => symbolHook,
|
|
28688
|
+
symbolMiddleware: () => symbolMiddleware,
|
|
28689
|
+
symbolMiddlewareConfigured: () => symbolMiddlewareConfigured,
|
|
28690
|
+
symbolOptionalDependency: () => symbolOptionalDependency,
|
|
28691
|
+
symbolPhantomTask: () => symbolPhantomTask,
|
|
28692
|
+
symbolResource: () => symbolResource,
|
|
28693
|
+
symbolResourceForkedFrom: () => symbolResourceForkedFrom,
|
|
28694
|
+
symbolResourceMiddleware: () => symbolResourceMiddleware,
|
|
28695
|
+
symbolResourceWithConfig: () => symbolResourceWithConfig,
|
|
28696
|
+
symbolTag: () => symbolTag,
|
|
28697
|
+
symbolTagConfigured: () => symbolTagConfigured,
|
|
28698
|
+
symbolTask: () => symbolTask,
|
|
28699
|
+
symbolTaskMiddleware: () => symbolTaskMiddleware,
|
|
28700
|
+
symbolTunneledBy: () => symbolTunneledBy
|
|
28701
|
+
});
|
|
28702
|
+
|
|
28703
|
+
// src/types/event.ts
|
|
28704
|
+
function onAnyOf(...defs) {
|
|
28705
|
+
return defs;
|
|
28706
|
+
}
|
|
28707
|
+
__name(onAnyOf, "onAnyOf");
|
|
28708
|
+
function isOneOf(emission, defs) {
|
|
28709
|
+
return defs.some((d) => d.id === emission.id);
|
|
28710
|
+
}
|
|
28711
|
+
__name(isOneOf, "isOneOf");
|
|
28712
|
+
|
|
28713
|
+
// src/types/runner.ts
|
|
28714
|
+
var RunnerMode = /* @__PURE__ */ ((RunnerMode2) => {
|
|
28715
|
+
RunnerMode2["TEST"] = "test";
|
|
28716
|
+
RunnerMode2["DEV"] = "dev";
|
|
28717
|
+
RunnerMode2["PROD"] = "prod";
|
|
28718
|
+
return RunnerMode2;
|
|
28719
|
+
})(RunnerMode || {});
|
|
28720
|
+
|
|
28721
|
+
// src/types/contracts.ts
|
|
28722
|
+
var CONTRACT = Symbol.for("runner.contract");
|
|
28723
|
+
|
|
28724
|
+
// src/types/storeTypes.ts
|
|
28725
|
+
var HookDependencyState = /* @__PURE__ */ ((HookDependencyState2) => {
|
|
28726
|
+
HookDependencyState2["Pending"] = "pending";
|
|
28727
|
+
HookDependencyState2["Computing"] = "computing";
|
|
28728
|
+
HookDependencyState2["Ready"] = "ready";
|
|
28729
|
+
return HookDependencyState2;
|
|
28730
|
+
})(HookDependencyState || {});
|
|
28731
|
+
|
|
28732
|
+
// src/definers/tools.ts
|
|
28733
|
+
function isTask(definition) {
|
|
28734
|
+
return definition && definition[symbolTask];
|
|
28735
|
+
}
|
|
28736
|
+
__name(isTask, "isTask");
|
|
28737
|
+
function isResource(definition) {
|
|
28738
|
+
return definition && definition[symbolResource];
|
|
28739
|
+
}
|
|
28740
|
+
__name(isResource, "isResource");
|
|
28741
|
+
function isResourceWithConfig(definition) {
|
|
28742
|
+
return definition && definition[symbolResourceWithConfig];
|
|
28743
|
+
}
|
|
28744
|
+
__name(isResourceWithConfig, "isResourceWithConfig");
|
|
28745
|
+
function isEvent(definition) {
|
|
28746
|
+
return definition && definition[symbolEvent];
|
|
28747
|
+
}
|
|
28748
|
+
__name(isEvent, "isEvent");
|
|
28749
|
+
function isHook(definition) {
|
|
28750
|
+
return definition && definition[symbolHook];
|
|
28751
|
+
}
|
|
28752
|
+
__name(isHook, "isHook");
|
|
28753
|
+
function isTaskMiddleware(definition) {
|
|
28754
|
+
return definition && definition[symbolTaskMiddleware];
|
|
28755
|
+
}
|
|
28756
|
+
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
28757
|
+
function isResourceMiddleware(definition) {
|
|
28758
|
+
return definition && definition[symbolResourceMiddleware];
|
|
28759
|
+
}
|
|
28760
|
+
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
28761
|
+
function isTag(definition) {
|
|
28762
|
+
return definition && definition[symbolTag];
|
|
28763
|
+
}
|
|
28764
|
+
__name(isTag, "isTag");
|
|
28765
|
+
function isOptional(definition) {
|
|
28766
|
+
return definition && definition[symbolOptionalDependency];
|
|
28767
|
+
}
|
|
28768
|
+
__name(isOptional, "isOptional");
|
|
28769
|
+
function isError(definition) {
|
|
28770
|
+
return Boolean(definition && definition[symbolError]);
|
|
28771
|
+
}
|
|
28772
|
+
__name(isError, "isError");
|
|
28773
|
+
function isAsyncContext(definition) {
|
|
28774
|
+
return Boolean(definition && definition[symbolAsyncContext]);
|
|
28775
|
+
}
|
|
28776
|
+
__name(isAsyncContext, "isAsyncContext");
|
|
28777
|
+
|
|
28778
|
+
// src/tools/throws.ts
|
|
28779
|
+
function invalidThrowsEntryError(owner, item) {
|
|
28780
|
+
const got = item === null ? "null" : Array.isArray(item) ? "array" : typeof item === "object" ? "object" : typeof item;
|
|
28781
|
+
return new Error(
|
|
28782
|
+
`Invalid throws entry for ${owner.kind} ${owner.id}: expected error id string or Error helper, got ${got}`
|
|
28783
|
+
);
|
|
28784
|
+
}
|
|
28785
|
+
__name(invalidThrowsEntryError, "invalidThrowsEntryError");
|
|
28786
|
+
function toErrorIdList(owner, list) {
|
|
28787
|
+
const ids = [];
|
|
28788
|
+
const seen = /* @__PURE__ */ new Set();
|
|
28789
|
+
for (const item of list) {
|
|
28790
|
+
let id2;
|
|
28791
|
+
if (typeof item === "string") {
|
|
28792
|
+
if (item.trim().length === 0) {
|
|
28793
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28719
28794
|
}
|
|
28720
|
-
|
|
28721
|
-
}
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28795
|
+
id2 = item;
|
|
28796
|
+
} else if (isError(item)) {
|
|
28797
|
+
id2 = item.id;
|
|
28798
|
+
if (typeof id2 !== "string" || id2.trim().length === 0) {
|
|
28799
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28800
|
+
}
|
|
28801
|
+
} else {
|
|
28802
|
+
throw invalidThrowsEntryError(owner, item);
|
|
28803
|
+
}
|
|
28804
|
+
if (seen.has(id2)) continue;
|
|
28805
|
+
seen.add(id2);
|
|
28806
|
+
ids.push(id2);
|
|
28726
28807
|
}
|
|
28808
|
+
return ids;
|
|
28809
|
+
}
|
|
28810
|
+
__name(toErrorIdList, "toErrorIdList");
|
|
28811
|
+
function normalizeThrows(owner, throwsList) {
|
|
28812
|
+
if (throwsList === void 0) return void 0;
|
|
28813
|
+
return toErrorIdList(owner, throwsList);
|
|
28814
|
+
}
|
|
28815
|
+
__name(normalizeThrows, "normalizeThrows");
|
|
28816
|
+
|
|
28817
|
+
// src/definers/defineTask.ts
|
|
28818
|
+
function defineTask(taskConfig) {
|
|
28819
|
+
const filePath = getCallerFile();
|
|
28820
|
+
const id2 = taskConfig.id;
|
|
28821
|
+
return {
|
|
28822
|
+
[symbolTask]: true,
|
|
28823
|
+
[symbolFilePath]: filePath,
|
|
28824
|
+
id: id2,
|
|
28825
|
+
dependencies: taskConfig.dependencies || {},
|
|
28826
|
+
middleware: taskConfig.middleware || [],
|
|
28827
|
+
run: taskConfig.run,
|
|
28828
|
+
inputSchema: taskConfig.inputSchema,
|
|
28829
|
+
resultSchema: taskConfig.resultSchema,
|
|
28830
|
+
meta: taskConfig.meta || {},
|
|
28831
|
+
tags: taskConfig.tags || [],
|
|
28832
|
+
throws: normalizeThrows({ kind: "task", id: id2 }, taskConfig.throws),
|
|
28833
|
+
// autorun,
|
|
28834
|
+
optional() {
|
|
28835
|
+
return {
|
|
28836
|
+
inner: this,
|
|
28837
|
+
[symbolOptionalDependency]: true
|
|
28838
|
+
};
|
|
28839
|
+
}
|
|
28840
|
+
};
|
|
28841
|
+
}
|
|
28842
|
+
__name(defineTask, "defineTask");
|
|
28843
|
+
defineTask.phantom = (taskConfig) => {
|
|
28844
|
+
const taskDef = defineTask({
|
|
28845
|
+
...taskConfig,
|
|
28846
|
+
run: /* @__PURE__ */ __name(async (_input) => {
|
|
28847
|
+
return void 0;
|
|
28848
|
+
}, "run")
|
|
28849
|
+
});
|
|
28850
|
+
taskDef[symbolPhantomTask] = true;
|
|
28851
|
+
return taskDef;
|
|
28727
28852
|
};
|
|
28728
28853
|
|
|
28854
|
+
// src/definers/defineHook.ts
|
|
28855
|
+
function defineHook(hookDef) {
|
|
28856
|
+
const filePath = getCallerFile();
|
|
28857
|
+
return {
|
|
28858
|
+
[symbolHook]: true,
|
|
28859
|
+
[symbolFilePath]: filePath,
|
|
28860
|
+
id: hookDef.id,
|
|
28861
|
+
dependencies: hookDef.dependencies || {},
|
|
28862
|
+
on: hookDef.on,
|
|
28863
|
+
order: hookDef.order,
|
|
28864
|
+
run: hookDef.run,
|
|
28865
|
+
meta: hookDef.meta || {},
|
|
28866
|
+
tags: hookDef.tags || []
|
|
28867
|
+
};
|
|
28868
|
+
}
|
|
28869
|
+
__name(defineHook, "defineHook");
|
|
28870
|
+
|
|
28729
28871
|
// src/errors.ts
|
|
28730
28872
|
var errors_exports = {};
|
|
28731
28873
|
__export(errors_exports, {
|
|
@@ -28767,9 +28909,10 @@ var RunnerError = class extends Error {
|
|
|
28767
28909
|
var _a;
|
|
28768
28910
|
_a = symbolError;
|
|
28769
28911
|
var ErrorHelper = class {
|
|
28770
|
-
constructor(definition) {
|
|
28912
|
+
constructor(definition, filePath) {
|
|
28771
28913
|
this.definition = definition;
|
|
28772
28914
|
this[_a] = true;
|
|
28915
|
+
this[symbolFilePath] = filePath;
|
|
28773
28916
|
}
|
|
28774
28917
|
static {
|
|
28775
28918
|
__name(this, "ErrorHelper");
|
|
@@ -28792,11 +28935,15 @@ var ErrorHelper = class {
|
|
|
28792
28935
|
};
|
|
28793
28936
|
}
|
|
28794
28937
|
};
|
|
28795
|
-
function defineError(definition) {
|
|
28938
|
+
function defineError(definition, filePath) {
|
|
28796
28939
|
if (!definition.format) {
|
|
28797
28940
|
definition.format = (data) => `${JSON.stringify(data)}`;
|
|
28798
28941
|
}
|
|
28799
|
-
|
|
28942
|
+
const resolvedFilePath = filePath ?? getCallerFile();
|
|
28943
|
+
return new ErrorHelper(
|
|
28944
|
+
definition,
|
|
28945
|
+
resolvedFilePath
|
|
28946
|
+
);
|
|
28800
28947
|
}
|
|
28801
28948
|
__name(defineError, "defineError");
|
|
28802
28949
|
|
|
@@ -28834,14 +28981,17 @@ function makeErrorBuilder(state) {
|
|
|
28834
28981
|
return makeErrorBuilder(next);
|
|
28835
28982
|
},
|
|
28836
28983
|
build() {
|
|
28837
|
-
return defineError(
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
|
|
28844
|
-
|
|
28984
|
+
return defineError(
|
|
28985
|
+
{
|
|
28986
|
+
id: state.id,
|
|
28987
|
+
serialize: state.serialize,
|
|
28988
|
+
parse: state.parse,
|
|
28989
|
+
dataSchema: state.dataSchema,
|
|
28990
|
+
format: state.format,
|
|
28991
|
+
meta: state.meta
|
|
28992
|
+
},
|
|
28993
|
+
state.filePath
|
|
28994
|
+
);
|
|
28845
28995
|
}
|
|
28846
28996
|
};
|
|
28847
28997
|
return builder;
|
|
@@ -28850,8 +29000,10 @@ __name(makeErrorBuilder, "makeErrorBuilder");
|
|
|
28850
29000
|
|
|
28851
29001
|
// src/definers/builders/error/index.ts
|
|
28852
29002
|
function errorBuilder(id2) {
|
|
29003
|
+
const filePath = getCallerFile();
|
|
28853
29004
|
const initial = Object.freeze({
|
|
28854
29005
|
id: id2,
|
|
29006
|
+
filePath,
|
|
28855
29007
|
serialize: void 0,
|
|
28856
29008
|
parse: void 0,
|
|
28857
29009
|
dataSchema: void 0,
|
|
@@ -28862,103 +29014,87 @@ function errorBuilder(id2) {
|
|
|
28862
29014
|
__name(errorBuilder, "errorBuilder");
|
|
28863
29015
|
var error = errorBuilder;
|
|
28864
29016
|
|
|
28865
|
-
// src/
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
var dependencyNotFoundError = error("runner.errors.dependencyNotFound").format(
|
|
28870
|
-
({ key }) => `Dependency ${key.toString()} not found. Did you forget to register it through a resource?`
|
|
28871
|
-
).build();
|
|
28872
|
-
var unknownItemTypeError = error(
|
|
28873
|
-
"runner.errors.unknownItemType"
|
|
28874
|
-
).format(
|
|
28875
|
-
({ item }) => `Unknown item type: ${String(
|
|
28876
|
-
item
|
|
28877
|
-
)}. Please ensure you are not using different versions of '@bluelibs/runner'`
|
|
28878
|
-
).build();
|
|
28879
|
-
var contextError = error(
|
|
28880
|
-
"runner.errors.context"
|
|
28881
|
-
).format(({ details }) => details ?? "Context error").build();
|
|
28882
|
-
var circularDependenciesError = error("runner.errors.circularDependencies").format(({ cycles }) => {
|
|
28883
|
-
const cycleDetails = cycles.map((cycle) => ` \u2022 ${cycle}`).join("\n");
|
|
28884
|
-
const hasMiddleware = cycles.some((cycle) => cycle.includes("middleware"));
|
|
28885
|
-
let guidance = "\n\nTo resolve circular dependencies:";
|
|
28886
|
-
guidance += "\n \u2022 Consider refactoring to reduce coupling between components";
|
|
28887
|
-
guidance += "\n \u2022 Extract shared dependencies into separate resources";
|
|
28888
|
-
if (hasMiddleware) {
|
|
28889
|
-
guidance += "\n \u2022 For middleware: you can filter out tasks/resources using everywhere(fn)";
|
|
28890
|
-
guidance += "\n \u2022 Consider using events for communication instead of direct dependencies";
|
|
28891
|
-
}
|
|
28892
|
-
return `Circular dependencies detected:
|
|
28893
|
-
${cycleDetails}${guidance}`;
|
|
28894
|
-
}).build();
|
|
28895
|
-
var eventNotFoundError = error(
|
|
28896
|
-
"runner.errors.eventNotFound"
|
|
28897
|
-
).format(
|
|
28898
|
-
({ id: id2 }) => `Event "${id2.toString()}" not found. Did you forget to register it?`
|
|
28899
|
-
).build();
|
|
28900
|
-
var resourceNotFoundError = error(
|
|
28901
|
-
"runner.errors.resourceNotFound"
|
|
28902
|
-
).format(
|
|
28903
|
-
({ id: id2 }) => `Resource "${id2.toString()}" not found. Did you forget to register it or are you using the correct id?`
|
|
28904
|
-
).build();
|
|
28905
|
-
var middlewareNotRegisteredError = error("runner.errors.middlewareNotRegistered").format(
|
|
28906
|
-
({ type, source, middlewareId }) => `Middleware inside ${type} "${source}" depends on "${middlewareId}" but it's not registered. Did you forget to register it?`
|
|
28907
|
-
).build();
|
|
28908
|
-
var tagNotFoundError = error(
|
|
28909
|
-
"runner.errors.tagNotFound"
|
|
28910
|
-
).format(
|
|
28911
|
-
({ id: id2 }) => `Tag "${id2}" not registered. Did you forget to register it inside a resource?`
|
|
28912
|
-
).build();
|
|
28913
|
-
var lockedError = error(
|
|
28914
|
-
"runner.errors.locked"
|
|
28915
|
-
).format(
|
|
28916
|
-
({ what }) => `Cannot modify the ${what.toString()} when it is locked.`
|
|
28917
|
-
).build();
|
|
28918
|
-
var storeAlreadyInitializedError = error(
|
|
28919
|
-
"runner.errors.storeAlreadyInitialized"
|
|
28920
|
-
).format(() => "Store already initialized. Cannot reinitialize.").build();
|
|
28921
|
-
var validationError = error("runner.errors.validation").format(({ subject, id: id2, originalError }) => {
|
|
28922
|
-
const errorMessage2 = originalError instanceof Error ? originalError.message : String(originalError);
|
|
28923
|
-
return `${subject} validation failed for ${id2.toString()}: ${errorMessage2}`;
|
|
28924
|
-
}).build();
|
|
28925
|
-
var eventCycleError = error("runner.errors.eventCycle").format(({ path: path4 }) => {
|
|
28926
|
-
const chain = path4.map((p) => `${p.id}\u2190${p.source}`).join(" -> ");
|
|
28927
|
-
return `Event emission cycle detected:
|
|
28928
|
-
${chain}
|
|
28929
|
-
|
|
28930
|
-
Break the cycle by changing hook logic (avoid mutual emits) or gate with conditions/tags.`;
|
|
28931
|
-
}).build();
|
|
28932
|
-
var eventEmissionCycleError = error("runner.errors.eventEmissionCycle").format(({ cycles }) => {
|
|
28933
|
-
const list = cycles.map((c) => ` \u2022 ${c}`).join("\n");
|
|
28934
|
-
return `Event emission cycles detected between hooks and events:
|
|
28935
|
-
${list}
|
|
28936
|
-
|
|
28937
|
-
This was detected at compile time (dry-run). Break the cycle by avoiding mutual emits between hooks or scoping hooks using tags.`;
|
|
28938
|
-
}).build();
|
|
28939
|
-
var platformUnsupportedFunctionError = error("runner.errors.platformUnsupportedFunction").format(
|
|
28940
|
-
({ functionName }) => `Platform function not supported in this environment: ${functionName}. Detected platform: ${detectEnvironment()}.`
|
|
28941
|
-
).build();
|
|
28942
|
-
var cancellationError = error(
|
|
28943
|
-
"runner.errors.cancellation"
|
|
28944
|
-
).format(({ reason }) => reason || "Operation cancelled").build();
|
|
28945
|
-
var tunnelOwnershipConflictError = error("runner.errors.tunnelOwnershipConflict").format(
|
|
28946
|
-
({ 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.`
|
|
28947
|
-
).build();
|
|
28948
|
-
var phantomTaskNotRoutedError = error("runner.errors.phantomTaskNotRouted").format(
|
|
28949
|
-
({ 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).`
|
|
28950
|
-
).build();
|
|
28951
|
-
var taskNotRegisteredError = error("runner.errors.taskNotRegistered").format(
|
|
28952
|
-
({ taskId }) => `Task "${taskId}" is not registered in the Store. This is an internal error\u2014ensure the task is registered before execution.`
|
|
28953
|
-
).build();
|
|
28954
|
-
var builderIncompleteError = error("runner.errors.builderIncomplete").format(({ type, builderId, missingFields }) => {
|
|
28955
|
-
const typeLabel = type === "hook" ? "Hook" : type === "task-middleware" ? "Task middleware" : "Resource middleware";
|
|
28956
|
-
return `${typeLabel} "${builderId}" is incomplete. Missing required: ${missingFields.join(", ")}. Call ${missingFields.map((f) => `.${f}()`).join(" and ")} before .build().`;
|
|
28957
|
-
}).build();
|
|
28958
|
-
function isCancellationError(err) {
|
|
28959
|
-
return cancellationError.is(err);
|
|
29017
|
+
// src/platform/adapters/node-als.ts
|
|
29018
|
+
async function loadAsyncLocalStorageClass() {
|
|
29019
|
+
const mod = __require("async_hooks");
|
|
29020
|
+
return mod.AsyncLocalStorage;
|
|
28960
29021
|
}
|
|
28961
|
-
__name(
|
|
29022
|
+
__name(loadAsyncLocalStorageClass, "loadAsyncLocalStorageClass");
|
|
29023
|
+
|
|
29024
|
+
// src/platform/adapters/node.ts
|
|
29025
|
+
var NodePlatformAdapter = class {
|
|
29026
|
+
constructor() {
|
|
29027
|
+
this.id = "node";
|
|
29028
|
+
this.setTimeout = globalThis.setTimeout;
|
|
29029
|
+
this.clearTimeout = globalThis.clearTimeout;
|
|
29030
|
+
}
|
|
29031
|
+
static {
|
|
29032
|
+
__name(this, "NodePlatformAdapter");
|
|
29033
|
+
}
|
|
29034
|
+
async init() {
|
|
29035
|
+
this.alsClass = await loadAsyncLocalStorageClass();
|
|
29036
|
+
}
|
|
29037
|
+
onUncaughtException(handler) {
|
|
29038
|
+
const h = /* @__PURE__ */ __name((error2) => handler(error2), "h");
|
|
29039
|
+
process.on("uncaughtException", h);
|
|
29040
|
+
return () => process.off("uncaughtException", h);
|
|
29041
|
+
}
|
|
29042
|
+
onUnhandledRejection(handler) {
|
|
29043
|
+
const h = /* @__PURE__ */ __name((reason) => handler(reason), "h");
|
|
29044
|
+
process.on("unhandledRejection", h);
|
|
29045
|
+
return () => process.off("unhandledRejection", h);
|
|
29046
|
+
}
|
|
29047
|
+
onShutdownSignal(handler) {
|
|
29048
|
+
process.on("SIGINT", handler);
|
|
29049
|
+
process.on("SIGTERM", handler);
|
|
29050
|
+
return () => {
|
|
29051
|
+
process.off("SIGINT", handler);
|
|
29052
|
+
process.off("SIGTERM", handler);
|
|
29053
|
+
};
|
|
29054
|
+
}
|
|
29055
|
+
exit(code) {
|
|
29056
|
+
process.exit(code);
|
|
29057
|
+
}
|
|
29058
|
+
getEnv(key) {
|
|
29059
|
+
return process.env[key];
|
|
29060
|
+
}
|
|
29061
|
+
hasAsyncLocalStorage() {
|
|
29062
|
+
return true;
|
|
29063
|
+
}
|
|
29064
|
+
createAsyncLocalStorage() {
|
|
29065
|
+
let instance;
|
|
29066
|
+
const ensure = /* @__PURE__ */ __name(() => {
|
|
29067
|
+
if (!this.alsClass) {
|
|
29068
|
+
let als;
|
|
29069
|
+
const forceNoop = typeof process !== "undefined" && !!process.env?.RUNNER_FORCE_NOOP_ALS;
|
|
29070
|
+
if (!forceNoop) {
|
|
29071
|
+
try {
|
|
29072
|
+
const mod = __require("async_hooks");
|
|
29073
|
+
als = mod?.AsyncLocalStorage;
|
|
29074
|
+
} catch (_) {
|
|
29075
|
+
als = void 0;
|
|
29076
|
+
}
|
|
29077
|
+
}
|
|
29078
|
+
this.alsClass = als || class NoopAsyncLocalStorage {
|
|
29079
|
+
static {
|
|
29080
|
+
__name(this, "NoopAsyncLocalStorage");
|
|
29081
|
+
}
|
|
29082
|
+
getStore() {
|
|
29083
|
+
return void 0;
|
|
29084
|
+
}
|
|
29085
|
+
run(_store, callback) {
|
|
29086
|
+
return callback();
|
|
29087
|
+
}
|
|
29088
|
+
};
|
|
29089
|
+
}
|
|
29090
|
+
return instance ??= new this.alsClass();
|
|
29091
|
+
}, "ensure");
|
|
29092
|
+
return {
|
|
29093
|
+
getStore: /* @__PURE__ */ __name(() => ensure().getStore(), "getStore"),
|
|
29094
|
+
run: /* @__PURE__ */ __name((store2, callback) => ensure().run(store2, callback), "run")
|
|
29095
|
+
};
|
|
29096
|
+
}
|
|
29097
|
+
};
|
|
28962
29098
|
|
|
28963
29099
|
// src/platform/adapters/browser.ts
|
|
28964
29100
|
var BrowserPlatformAdapter = class {
|
|
@@ -29251,16 +29387,11 @@ function setPlatform(adapter) {
|
|
|
29251
29387
|
adapter.id;
|
|
29252
29388
|
}
|
|
29253
29389
|
__name(setPlatform, "setPlatform");
|
|
29254
|
-
function isNode() {
|
|
29255
|
-
{
|
|
29256
|
-
return true;
|
|
29257
|
-
}
|
|
29258
|
-
}
|
|
29259
|
-
__name(isNode, "isNode");
|
|
29260
29390
|
var PlatformAdapter = class {
|
|
29391
|
+
static {
|
|
29392
|
+
__name(this, "PlatformAdapter");
|
|
29393
|
+
}
|
|
29261
29394
|
constructor(env) {
|
|
29262
|
-
this.setTimeout = globalThis.setTimeout;
|
|
29263
|
-
this.clearTimeout = globalThis.clearTimeout;
|
|
29264
29395
|
const kind = env ?? detectEnvironment();
|
|
29265
29396
|
this.env = kind;
|
|
29266
29397
|
switch (kind) {
|
|
@@ -29280,9 +29411,8 @@ var PlatformAdapter = class {
|
|
|
29280
29411
|
this.inner = new UniversalPlatformAdapter();
|
|
29281
29412
|
}
|
|
29282
29413
|
this.id = this.inner.id;
|
|
29283
|
-
|
|
29284
|
-
|
|
29285
|
-
__name(this, "PlatformAdapter");
|
|
29414
|
+
this.setTimeout = this.inner.setTimeout;
|
|
29415
|
+
this.clearTimeout = this.inner.clearTimeout;
|
|
29286
29416
|
}
|
|
29287
29417
|
async init() {
|
|
29288
29418
|
return this.inner.init();
|
|
@@ -29310,208 +29440,285 @@ var PlatformAdapter = class {
|
|
|
29310
29440
|
}
|
|
29311
29441
|
};
|
|
29312
29442
|
|
|
29313
|
-
// src/
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
|
|
29317
|
-
|
|
29318
|
-
|
|
29319
|
-
|
|
29320
|
-
|
|
29321
|
-
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
|
|
29328
|
-
|
|
29329
|
-
|
|
29443
|
+
// src/errors.ts
|
|
29444
|
+
var duplicateRegistrationError = error("runner.errors.duplicateRegistration").format(
|
|
29445
|
+
({ 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.`
|
|
29446
|
+
).build();
|
|
29447
|
+
var dependencyNotFoundError = error("runner.errors.dependencyNotFound").format(
|
|
29448
|
+
({ key }) => `Dependency ${key.toString()} not found. Did you forget to register it through a resource?`
|
|
29449
|
+
).build();
|
|
29450
|
+
var unknownItemTypeError = error(
|
|
29451
|
+
"runner.errors.unknownItemType"
|
|
29452
|
+
).format(
|
|
29453
|
+
({ item }) => `Unknown item type: ${String(
|
|
29454
|
+
item
|
|
29455
|
+
)}. Please ensure you are not using different versions of '@bluelibs/runner'`
|
|
29456
|
+
).build();
|
|
29457
|
+
var contextError = error(
|
|
29458
|
+
"runner.errors.context"
|
|
29459
|
+
).format(({ details }) => details ?? "Context error").build();
|
|
29460
|
+
var circularDependenciesError = error("runner.errors.circularDependencies").format(({ cycles }) => {
|
|
29461
|
+
const cycleDetails = cycles.map((cycle) => ` \u2022 ${cycle}`).join("\n");
|
|
29462
|
+
const hasMiddleware = cycles.some((cycle) => cycle.includes("middleware"));
|
|
29463
|
+
let guidance = "\n\nTo resolve circular dependencies:";
|
|
29464
|
+
guidance += "\n \u2022 Consider refactoring to reduce coupling between components";
|
|
29465
|
+
guidance += "\n \u2022 Extract shared dependencies into separate resources";
|
|
29466
|
+
if (hasMiddleware) {
|
|
29467
|
+
guidance += "\n \u2022 For middleware: you can filter out tasks/resources using everywhere(fn)";
|
|
29468
|
+
guidance += "\n \u2022 Consider using events for communication instead of direct dependencies";
|
|
29330
29469
|
}
|
|
29331
|
-
|
|
29332
|
-
|
|
29333
|
-
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29341
|
-
|
|
29342
|
-
|
|
29343
|
-
|
|
29344
|
-
|
|
29345
|
-
|
|
29346
|
-
|
|
29347
|
-
|
|
29348
|
-
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
|
|
29354
|
-
|
|
29355
|
-
|
|
29356
|
-
|
|
29357
|
-
|
|
29358
|
-
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
|
|
29362
|
-
}
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
|
|
29366
|
-
|
|
29367
|
-
|
|
29470
|
+
return `Circular dependencies detected:
|
|
29471
|
+
${cycleDetails}${guidance}`;
|
|
29472
|
+
}).build();
|
|
29473
|
+
var eventNotFoundError = error(
|
|
29474
|
+
"runner.errors.eventNotFound"
|
|
29475
|
+
).format(
|
|
29476
|
+
({ id: id2 }) => `Event "${id2.toString()}" not found. Did you forget to register it?`
|
|
29477
|
+
).build();
|
|
29478
|
+
var resourceNotFoundError = error(
|
|
29479
|
+
"runner.errors.resourceNotFound"
|
|
29480
|
+
).format(
|
|
29481
|
+
({ id: id2 }) => `Resource "${id2.toString()}" not found. Did you forget to register it or are you using the correct id?`
|
|
29482
|
+
).build();
|
|
29483
|
+
var middlewareNotRegisteredError = error("runner.errors.middlewareNotRegistered").format(
|
|
29484
|
+
({ type, source, middlewareId }) => `Middleware inside ${type} "${source}" depends on "${middlewareId}" but it's not registered. Did you forget to register it?`
|
|
29485
|
+
).build();
|
|
29486
|
+
var tagNotFoundError = error(
|
|
29487
|
+
"runner.errors.tagNotFound"
|
|
29488
|
+
).format(
|
|
29489
|
+
({ id: id2 }) => `Tag "${id2}" not registered. Did you forget to register it inside a resource?`
|
|
29490
|
+
).build();
|
|
29491
|
+
var lockedError = error(
|
|
29492
|
+
"runner.errors.locked"
|
|
29493
|
+
).format(
|
|
29494
|
+
({ what }) => `Cannot modify the ${what.toString()} when it is locked.`
|
|
29495
|
+
).build();
|
|
29496
|
+
var storeAlreadyInitializedError = error(
|
|
29497
|
+
"runner.errors.storeAlreadyInitialized"
|
|
29498
|
+
).format(() => "Store already initialized. Cannot reinitialize.").build();
|
|
29499
|
+
var validationError = error("runner.errors.validation").format(({ subject, id: id2, originalError }) => {
|
|
29500
|
+
const errorMessage2 = originalError instanceof Error ? originalError.message : String(originalError);
|
|
29501
|
+
return `${subject} validation failed for ${id2.toString()}: ${errorMessage2}`;
|
|
29502
|
+
}).build();
|
|
29503
|
+
var eventCycleError = error("runner.errors.eventCycle").format(({ path: path4 }) => {
|
|
29504
|
+
const chain = path4.map((p) => `${p.id}\u2190${p.source}`).join(" -> ");
|
|
29505
|
+
return `Event emission cycle detected:
|
|
29506
|
+
${chain}
|
|
29368
29507
|
|
|
29369
|
-
|
|
29370
|
-
|
|
29371
|
-
|
|
29372
|
-
|
|
29373
|
-
|
|
29374
|
-
|
|
29375
|
-
})(RunnerMode || {});
|
|
29508
|
+
Break the cycle by changing hook logic (avoid mutual emits) or gate with conditions/tags.`;
|
|
29509
|
+
}).build();
|
|
29510
|
+
var eventEmissionCycleError = error("runner.errors.eventEmissionCycle").format(({ cycles }) => {
|
|
29511
|
+
const list = cycles.map((c) => ` \u2022 ${c}`).join("\n");
|
|
29512
|
+
return `Event emission cycles detected between hooks and events:
|
|
29513
|
+
${list}
|
|
29376
29514
|
|
|
29377
|
-
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
}
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29384
|
-
}
|
|
29385
|
-
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
|
|
29391
|
-
|
|
29392
|
-
}
|
|
29393
|
-
|
|
29394
|
-
|
|
29395
|
-
|
|
29396
|
-
}
|
|
29397
|
-
|
|
29398
|
-
function
|
|
29399
|
-
return
|
|
29400
|
-
}
|
|
29401
|
-
__name(isTaskMiddleware, "isTaskMiddleware");
|
|
29402
|
-
function isResourceMiddleware(definition) {
|
|
29403
|
-
return definition && definition[symbolResourceMiddleware];
|
|
29404
|
-
}
|
|
29405
|
-
__name(isResourceMiddleware, "isResourceMiddleware");
|
|
29406
|
-
function isTag(definition) {
|
|
29407
|
-
return definition && definition[symbolTag];
|
|
29408
|
-
}
|
|
29409
|
-
__name(isTag, "isTag");
|
|
29410
|
-
function isOptional(definition) {
|
|
29411
|
-
return definition && definition[symbolOptionalDependency];
|
|
29412
|
-
}
|
|
29413
|
-
__name(isOptional, "isOptional");
|
|
29414
|
-
function isError(definition) {
|
|
29415
|
-
return Boolean(definition && definition[symbolError]);
|
|
29416
|
-
}
|
|
29417
|
-
__name(isError, "isError");
|
|
29418
|
-
function isAsyncContext(definition) {
|
|
29419
|
-
return Boolean(definition && definition[symbolAsyncContext]);
|
|
29515
|
+
This was detected at compile time (dry-run). Break the cycle by avoiding mutual emits between hooks or scoping hooks using tags.`;
|
|
29516
|
+
}).build();
|
|
29517
|
+
var platformUnsupportedFunctionError = error("runner.errors.platformUnsupportedFunction").format(
|
|
29518
|
+
({ functionName }) => `Platform function not supported in this environment: ${functionName}. Detected platform: ${detectEnvironment()}.`
|
|
29519
|
+
).build();
|
|
29520
|
+
var cancellationError = error(
|
|
29521
|
+
"runner.errors.cancellation"
|
|
29522
|
+
).format(({ reason }) => reason || "Operation cancelled").build();
|
|
29523
|
+
var tunnelOwnershipConflictError = error("runner.errors.tunnelOwnershipConflict").format(
|
|
29524
|
+
({ 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.`
|
|
29525
|
+
).build();
|
|
29526
|
+
var phantomTaskNotRoutedError = error("runner.errors.phantomTaskNotRouted").format(
|
|
29527
|
+
({ 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).`
|
|
29528
|
+
).build();
|
|
29529
|
+
var taskNotRegisteredError = error("runner.errors.taskNotRegistered").format(
|
|
29530
|
+
({ taskId }) => `Task "${taskId}" is not registered in the Store. This is an internal error\u2014ensure the task is registered before execution.`
|
|
29531
|
+
).build();
|
|
29532
|
+
var builderIncompleteError = error("runner.errors.builderIncomplete").format(({ type, builderId, missingFields }) => {
|
|
29533
|
+
const typeLabel = type === "hook" ? "Hook" : type === "task-middleware" ? "Task middleware" : "Resource middleware";
|
|
29534
|
+
return `${typeLabel} "${builderId}" is incomplete. Missing required: ${missingFields.join(", ")}. Call ${missingFields.map((f) => `.${f}()`).join(" and ")} before .build().`;
|
|
29535
|
+
}).build();
|
|
29536
|
+
function isCancellationError(err) {
|
|
29537
|
+
return cancellationError.is(err);
|
|
29420
29538
|
}
|
|
29421
|
-
__name(
|
|
29539
|
+
__name(isCancellationError, "isCancellationError");
|
|
29422
29540
|
|
|
29423
|
-
// src/
|
|
29424
|
-
function
|
|
29425
|
-
const
|
|
29426
|
-
|
|
29427
|
-
|
|
29428
|
-
|
|
29541
|
+
// src/definers/resourceFork.ts
|
|
29542
|
+
function resolveReId(forkId, options) {
|
|
29543
|
+
const fallback = /* @__PURE__ */ __name((id2) => `${forkId}.${id2}`, "fallback");
|
|
29544
|
+
const reId = options?.reId ?? fallback;
|
|
29545
|
+
return (id2) => {
|
|
29546
|
+
const next = reId(id2);
|
|
29547
|
+
if (typeof next !== "string" || next.length === 0) {
|
|
29548
|
+
throw new Error(`fork(reId) must return a non-empty string for "${id2}"`);
|
|
29549
|
+
}
|
|
29550
|
+
return next;
|
|
29551
|
+
};
|
|
29429
29552
|
}
|
|
29430
|
-
__name(
|
|
29431
|
-
function
|
|
29432
|
-
const
|
|
29433
|
-
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
|
|
29438
|
-
|
|
29553
|
+
__name(resolveReId, "resolveReId");
|
|
29554
|
+
function remapResourceDependenciesInObject(deps, options) {
|
|
29555
|
+
const remapObject = /* @__PURE__ */ __name((deps2) => {
|
|
29556
|
+
const out = { ...deps2 };
|
|
29557
|
+
for (const [key, value] of Object.entries(deps2)) {
|
|
29558
|
+
if (isOptional(value)) {
|
|
29559
|
+
const inner = value.inner;
|
|
29560
|
+
if (isResource(inner)) {
|
|
29561
|
+
const forked = options.getForkedResourceByBaseId(inner.id);
|
|
29562
|
+
if (forked) {
|
|
29563
|
+
out[key] = { ...value, inner: forked };
|
|
29564
|
+
}
|
|
29565
|
+
}
|
|
29566
|
+
continue;
|
|
29439
29567
|
}
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29568
|
+
if (isResource(value)) {
|
|
29569
|
+
const forked = options.getForkedResourceByBaseId(value.id);
|
|
29570
|
+
if (forked) {
|
|
29571
|
+
out[key] = forked;
|
|
29572
|
+
}
|
|
29445
29573
|
}
|
|
29446
|
-
} else {
|
|
29447
|
-
throw invalidThrowsEntryError(owner, item);
|
|
29448
29574
|
}
|
|
29449
|
-
|
|
29450
|
-
|
|
29451
|
-
|
|
29452
|
-
}
|
|
29453
|
-
return ids;
|
|
29575
|
+
return out;
|
|
29576
|
+
}, "remapObject");
|
|
29577
|
+
return remapObject(deps);
|
|
29454
29578
|
}
|
|
29455
|
-
__name(
|
|
29456
|
-
function
|
|
29457
|
-
|
|
29458
|
-
|
|
29579
|
+
__name(remapResourceDependenciesInObject, "remapResourceDependenciesInObject");
|
|
29580
|
+
function toResourceOnlyRegisterItems(items) {
|
|
29581
|
+
const out = [];
|
|
29582
|
+
for (const item of items) {
|
|
29583
|
+
if (isResourceWithConfig(item)) {
|
|
29584
|
+
out.push({
|
|
29585
|
+
kind: "withConfig",
|
|
29586
|
+
resource: item.resource,
|
|
29587
|
+
config: item.config
|
|
29588
|
+
});
|
|
29589
|
+
continue;
|
|
29590
|
+
}
|
|
29591
|
+
if (isResource(item)) {
|
|
29592
|
+
out.push({ kind: "resource", resource: item });
|
|
29593
|
+
continue;
|
|
29594
|
+
}
|
|
29595
|
+
}
|
|
29596
|
+
return out;
|
|
29459
29597
|
}
|
|
29460
|
-
__name(
|
|
29461
|
-
|
|
29462
|
-
|
|
29463
|
-
|
|
29464
|
-
const
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
|
|
29468
|
-
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29476
|
-
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29482
|
-
|
|
29598
|
+
__name(toResourceOnlyRegisterItems, "toResourceOnlyRegisterItems");
|
|
29599
|
+
function createDeepForkContext(forkId, options) {
|
|
29600
|
+
const reId = resolveReId(forkId, options);
|
|
29601
|
+
const forkedResourceByBaseId = /* @__PURE__ */ new Map();
|
|
29602
|
+
const ensureForked = /* @__PURE__ */ __name((base) => {
|
|
29603
|
+
const cached = forkedResourceByBaseId.get(base.id);
|
|
29604
|
+
if (cached) return cached;
|
|
29605
|
+
const forked = base.fork(reId(base.id), { register: "drop" });
|
|
29606
|
+
forkedResourceByBaseId.set(base.id, forked);
|
|
29607
|
+
const baseRegister = base.register;
|
|
29608
|
+
const ensureForkedForRegisterConfig = /* @__PURE__ */ __name((config) => {
|
|
29609
|
+
const items = typeof baseRegister === "function" ? baseRegister(config) : baseRegister;
|
|
29610
|
+
for (const candidate of toResourceOnlyRegisterItems(items)) {
|
|
29611
|
+
ensureForked(candidate.resource);
|
|
29612
|
+
}
|
|
29613
|
+
return items;
|
|
29614
|
+
}, "ensureForkedForRegisterConfig");
|
|
29615
|
+
const mapRegisterItems2 = /* @__PURE__ */ __name((items) => {
|
|
29616
|
+
const resourceItems = toResourceOnlyRegisterItems(items);
|
|
29617
|
+
const out = [];
|
|
29618
|
+
for (const candidate of resourceItems) {
|
|
29619
|
+
if (candidate.kind === "resource") {
|
|
29620
|
+
out.push(ensureForked(candidate.resource));
|
|
29621
|
+
continue;
|
|
29622
|
+
}
|
|
29623
|
+
out.push(ensureForked(candidate.resource).with(candidate.config));
|
|
29624
|
+
}
|
|
29625
|
+
return out;
|
|
29626
|
+
}, "mapRegisterItems");
|
|
29627
|
+
forked.register = typeof baseRegister === "function" ? (config) => {
|
|
29628
|
+
const items = ensureForkedForRegisterConfig(config);
|
|
29629
|
+
return mapRegisterItems2(items);
|
|
29630
|
+
} : (() => {
|
|
29631
|
+
ensureForkedForRegisterConfig(void 0);
|
|
29632
|
+
return mapRegisterItems2(baseRegister);
|
|
29633
|
+
})();
|
|
29634
|
+
const baseDependencies = base.dependencies;
|
|
29635
|
+
const remapDepsObject = /* @__PURE__ */ __name((deps) => remapResourceDependenciesInObject(deps, {
|
|
29636
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29637
|
+
}), "remapDepsObject");
|
|
29638
|
+
if (!baseDependencies) {
|
|
29639
|
+
forked.dependencies = baseDependencies;
|
|
29640
|
+
} else {
|
|
29641
|
+
forked.dependencies = (config) => {
|
|
29642
|
+
ensureForkedForRegisterConfig(config);
|
|
29643
|
+
const deps = typeof baseDependencies === "function" ? baseDependencies(config) : baseDependencies;
|
|
29644
|
+
return remapDepsObject(deps);
|
|
29483
29645
|
};
|
|
29484
29646
|
}
|
|
29647
|
+
return forked;
|
|
29648
|
+
}, "ensureForked");
|
|
29649
|
+
const ensureForkedForRegisterItems = /* @__PURE__ */ __name((items) => {
|
|
29650
|
+
for (const candidate of toResourceOnlyRegisterItems(items)) {
|
|
29651
|
+
ensureForked(candidate.resource);
|
|
29652
|
+
}
|
|
29653
|
+
}, "ensureForkedForRegisterItems");
|
|
29654
|
+
const mapRegisterItems = /* @__PURE__ */ __name((items) => {
|
|
29655
|
+
ensureForkedForRegisterItems(items);
|
|
29656
|
+
const resourceItems = toResourceOnlyRegisterItems(items);
|
|
29657
|
+
const out = [];
|
|
29658
|
+
for (const candidate of resourceItems) {
|
|
29659
|
+
if (candidate.kind === "resource") {
|
|
29660
|
+
out.push(ensureForked(candidate.resource));
|
|
29661
|
+
continue;
|
|
29662
|
+
}
|
|
29663
|
+
out.push(ensureForked(candidate.resource).with(candidate.config));
|
|
29664
|
+
}
|
|
29665
|
+
return out;
|
|
29666
|
+
}, "mapRegisterItems");
|
|
29667
|
+
const remapDependencies = /* @__PURE__ */ __name((dependencies) => {
|
|
29668
|
+
if (!dependencies) return dependencies;
|
|
29669
|
+
const remapObj = /* @__PURE__ */ __name((deps) => remapResourceDependenciesInObject(deps, {
|
|
29670
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29671
|
+
}), "remapObj");
|
|
29672
|
+
if (typeof dependencies === "function") {
|
|
29673
|
+
return (config) => remapObj(dependencies(config));
|
|
29674
|
+
}
|
|
29675
|
+
return remapObj(dependencies);
|
|
29676
|
+
}, "remapDependencies");
|
|
29677
|
+
return {
|
|
29678
|
+
reId,
|
|
29679
|
+
ensureForkedForRegisterItems,
|
|
29680
|
+
mapRegisterItems,
|
|
29681
|
+
remapDependencies,
|
|
29682
|
+
getForkedResourceByBaseId: /* @__PURE__ */ __name((id2) => forkedResourceByBaseId.get(id2), "getForkedResourceByBaseId")
|
|
29485
29683
|
};
|
|
29486
29684
|
}
|
|
29487
|
-
__name(
|
|
29488
|
-
|
|
29489
|
-
const
|
|
29490
|
-
|
|
29491
|
-
|
|
29492
|
-
|
|
29493
|
-
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
|
|
29497
|
-
|
|
29498
|
-
|
|
29499
|
-
|
|
29500
|
-
|
|
29501
|
-
|
|
29685
|
+
__name(createDeepForkContext, "createDeepForkContext");
|
|
29686
|
+
function resolveForkedRegisterAndDependencies(params) {
|
|
29687
|
+
const { register, dependencies, forkId, options } = params;
|
|
29688
|
+
const mode = options?.register ?? "keep";
|
|
29689
|
+
if (mode === "drop") {
|
|
29690
|
+
return { register: [], dependencies };
|
|
29691
|
+
}
|
|
29692
|
+
if (mode !== "deep") {
|
|
29693
|
+
return { register, dependencies };
|
|
29694
|
+
}
|
|
29695
|
+
if (!register) {
|
|
29696
|
+
return { register, dependencies };
|
|
29697
|
+
}
|
|
29698
|
+
const ctx = createDeepForkContext(forkId, options);
|
|
29699
|
+
if (typeof register === "function") {
|
|
29700
|
+
return {
|
|
29701
|
+
register: /* @__PURE__ */ __name((config) => {
|
|
29702
|
+
const baseItems = register(config);
|
|
29703
|
+
return ctx.mapRegisterItems(baseItems);
|
|
29704
|
+
}, "register"),
|
|
29705
|
+
dependencies: dependencies ? (config) => {
|
|
29706
|
+
const baseItems = register(config);
|
|
29707
|
+
ctx.ensureForkedForRegisterItems(baseItems);
|
|
29708
|
+
const baseDeps = typeof dependencies === "function" ? dependencies(config) : dependencies;
|
|
29709
|
+
return remapResourceDependenciesInObject(baseDeps, {
|
|
29710
|
+
getForkedResourceByBaseId: ctx.getForkedResourceByBaseId
|
|
29711
|
+
});
|
|
29712
|
+
} : dependencies
|
|
29713
|
+
};
|
|
29714
|
+
}
|
|
29715
|
+
ctx.ensureForkedForRegisterItems(register);
|
|
29502
29716
|
return {
|
|
29503
|
-
|
|
29504
|
-
|
|
29505
|
-
id: hookDef.id,
|
|
29506
|
-
dependencies: hookDef.dependencies || {},
|
|
29507
|
-
on: hookDef.on,
|
|
29508
|
-
order: hookDef.order,
|
|
29509
|
-
run: hookDef.run,
|
|
29510
|
-
meta: hookDef.meta || {},
|
|
29511
|
-
tags: hookDef.tags || []
|
|
29717
|
+
register: ctx.mapRegisterItems(register),
|
|
29718
|
+
dependencies: ctx.remapDependencies(dependencies)
|
|
29512
29719
|
};
|
|
29513
29720
|
}
|
|
29514
|
-
__name(
|
|
29721
|
+
__name(resolveForkedRegisterAndDependencies, "resolveForkedRegisterAndDependencies");
|
|
29515
29722
|
|
|
29516
29723
|
// src/definers/defineResource.ts
|
|
29517
29724
|
function defineResource(constConfig) {
|
|
@@ -29558,12 +29765,25 @@ function defineResource(constConfig) {
|
|
|
29558
29765
|
[symbolOptionalDependency]: true
|
|
29559
29766
|
};
|
|
29560
29767
|
},
|
|
29561
|
-
fork(newId) {
|
|
29562
|
-
|
|
29768
|
+
fork(newId, options) {
|
|
29769
|
+
const forkedParts = resolveForkedRegisterAndDependencies({
|
|
29770
|
+
register: constConfig.register,
|
|
29771
|
+
dependencies: constConfig.dependencies,
|
|
29772
|
+
forkId: newId,
|
|
29773
|
+
options
|
|
29774
|
+
});
|
|
29775
|
+
const forked = defineResource({
|
|
29563
29776
|
...constConfig,
|
|
29564
29777
|
id: newId,
|
|
29778
|
+
register: forkedParts.register,
|
|
29779
|
+
dependencies: forkedParts.dependencies,
|
|
29565
29780
|
[symbolFilePath]: filePath
|
|
29566
29781
|
});
|
|
29782
|
+
forked[symbolResourceForkedFrom] = {
|
|
29783
|
+
fromId: id2,
|
|
29784
|
+
forkedAtFilePath: getCallerFile()
|
|
29785
|
+
};
|
|
29786
|
+
return forked;
|
|
29567
29787
|
}
|
|
29568
29788
|
};
|
|
29569
29789
|
}
|
|
@@ -29691,7 +29911,7 @@ function defineOverride(base, patch) {
|
|
|
29691
29911
|
...patch,
|
|
29692
29912
|
id: base.id
|
|
29693
29913
|
};
|
|
29694
|
-
if (base.on !== void 0) {
|
|
29914
|
+
if ("on" in base && base.on !== void 0) {
|
|
29695
29915
|
overridden.on = base.on;
|
|
29696
29916
|
}
|
|
29697
29917
|
return overridden;
|
|
@@ -29811,6 +30031,309 @@ var SymbolPolicy = /* @__PURE__ */ ((SymbolPolicy2) => {
|
|
|
29811
30031
|
SymbolPolicy2["Disabled"] = "Disabled";
|
|
29812
30032
|
return SymbolPolicy2;
|
|
29813
30033
|
})(SymbolPolicy || {});
|
|
30034
|
+
var SymbolPolicyErrorMessage = /* @__PURE__ */ ((SymbolPolicyErrorMessage2) => {
|
|
30035
|
+
SymbolPolicyErrorMessage2["GlobalSymbolsNotAllowed"] = "Global symbols are not allowed";
|
|
30036
|
+
SymbolPolicyErrorMessage2["SymbolsNotAllowed"] = "Symbols are not allowed";
|
|
30037
|
+
SymbolPolicyErrorMessage2["UnsupportedSymbolPolicy"] = "Unsupported symbol policy";
|
|
30038
|
+
return SymbolPolicyErrorMessage2;
|
|
30039
|
+
})(SymbolPolicyErrorMessage || {});
|
|
30040
|
+
|
|
30041
|
+
// src/serializer/binary-builtins.ts
|
|
30042
|
+
var INVALID_PAYLOAD_MESSAGE_PREFIX = "Invalid";
|
|
30043
|
+
var typedArrayTypeIds = [
|
|
30044
|
+
"Int8Array",
|
|
30045
|
+
"Uint8Array",
|
|
30046
|
+
"Uint8ClampedArray",
|
|
30047
|
+
"Int16Array",
|
|
30048
|
+
"Uint16Array",
|
|
30049
|
+
"Int32Array",
|
|
30050
|
+
"Uint32Array",
|
|
30051
|
+
"Float32Array",
|
|
30052
|
+
"Float64Array",
|
|
30053
|
+
"BigInt64Array",
|
|
30054
|
+
"BigUint64Array"
|
|
30055
|
+
];
|
|
30056
|
+
var getTypedArrayConstructor = /* @__PURE__ */ __name((typeId) => {
|
|
30057
|
+
const value = globalThis[typeId];
|
|
30058
|
+
if (typeof value !== "function") {
|
|
30059
|
+
return null;
|
|
30060
|
+
}
|
|
30061
|
+
return value;
|
|
30062
|
+
}, "getTypedArrayConstructor");
|
|
30063
|
+
var getRuntimeBufferConstructor = /* @__PURE__ */ __name(() => {
|
|
30064
|
+
const value = globalThis.Buffer;
|
|
30065
|
+
if (typeof value !== "function") {
|
|
30066
|
+
return null;
|
|
30067
|
+
}
|
|
30068
|
+
const valueRecord = value;
|
|
30069
|
+
if (typeof valueRecord.from !== "function" || typeof valueRecord.isBuffer !== "function") {
|
|
30070
|
+
return null;
|
|
30071
|
+
}
|
|
30072
|
+
return value;
|
|
30073
|
+
}, "getRuntimeBufferConstructor");
|
|
30074
|
+
var isNodeBuffer = /* @__PURE__ */ __name((value) => {
|
|
30075
|
+
const runtimeBufferConstructor = getRuntimeBufferConstructor();
|
|
30076
|
+
if (!runtimeBufferConstructor) {
|
|
30077
|
+
return false;
|
|
30078
|
+
}
|
|
30079
|
+
return runtimeBufferConstructor.isBuffer(value);
|
|
30080
|
+
}, "isNodeBuffer");
|
|
30081
|
+
var assertBytePayload = /* @__PURE__ */ __name((payload, typeId) => {
|
|
30082
|
+
if (!Array.isArray(payload)) {
|
|
30083
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30084
|
+
}
|
|
30085
|
+
const bytes = new Array(payload.length);
|
|
30086
|
+
for (let index = 0; index < payload.length; index += 1) {
|
|
30087
|
+
const byteValue = payload[index];
|
|
30088
|
+
if (typeof byteValue !== "number" || !Number.isInteger(byteValue) || byteValue < 0 || byteValue > 255) {
|
|
30089
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30090
|
+
}
|
|
30091
|
+
bytes[index] = byteValue;
|
|
30092
|
+
}
|
|
30093
|
+
return bytes;
|
|
30094
|
+
}, "assertBytePayload");
|
|
30095
|
+
var toBytePayload = /* @__PURE__ */ __name((value) => Array.from(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)), "toBytePayload");
|
|
30096
|
+
var bytesToArrayBuffer = /* @__PURE__ */ __name((payload, typeId) => {
|
|
30097
|
+
const bytes = assertBytePayload(payload, typeId);
|
|
30098
|
+
return Uint8Array.from(bytes).buffer;
|
|
30099
|
+
}, "bytesToArrayBuffer");
|
|
30100
|
+
var deserializeTypedArray = /* @__PURE__ */ __name((typeId, payload) => {
|
|
30101
|
+
const typedArrayConstructor = getTypedArrayConstructor(typeId);
|
|
30102
|
+
if (!typedArrayConstructor) {
|
|
30103
|
+
throw new Error(`${typeId} is not available in this runtime`);
|
|
30104
|
+
}
|
|
30105
|
+
const bytes = assertBytePayload(payload, typeId);
|
|
30106
|
+
const bytesPerElement = typedArrayConstructor.BYTES_PER_ELEMENT;
|
|
30107
|
+
if (bytes.length % bytesPerElement !== 0) {
|
|
30108
|
+
throw new Error(`${INVALID_PAYLOAD_MESSAGE_PREFIX} ${typeId} payload`);
|
|
30109
|
+
}
|
|
30110
|
+
const arrayBuffer = Uint8Array.from(bytes).buffer;
|
|
30111
|
+
return new typedArrayConstructor(arrayBuffer);
|
|
30112
|
+
}, "deserializeTypedArray");
|
|
30113
|
+
var createTypedArrayType = /* @__PURE__ */ __name((typeId) => ({
|
|
30114
|
+
id: typeId,
|
|
30115
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30116
|
+
const typedArrayConstructor = getTypedArrayConstructor(typeId);
|
|
30117
|
+
if (!typedArrayConstructor) {
|
|
30118
|
+
return false;
|
|
30119
|
+
}
|
|
30120
|
+
if (!(value instanceof typedArrayConstructor)) {
|
|
30121
|
+
return false;
|
|
30122
|
+
}
|
|
30123
|
+
if (typeId === "Uint8Array" && isNodeBuffer(value)) {
|
|
30124
|
+
return false;
|
|
30125
|
+
}
|
|
30126
|
+
return true;
|
|
30127
|
+
}, "is"),
|
|
30128
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30129
|
+
deserialize: /* @__PURE__ */ __name((payload) => deserializeTypedArray(typeId, payload), "deserialize"),
|
|
30130
|
+
strategy: "value"
|
|
30131
|
+
}), "createTypedArrayType");
|
|
30132
|
+
var ArrayBufferType = {
|
|
30133
|
+
id: "ArrayBuffer",
|
|
30134
|
+
is: /* @__PURE__ */ __name((value) => value instanceof ArrayBuffer, "is"),
|
|
30135
|
+
serialize: /* @__PURE__ */ __name((value) => Array.from(new Uint8Array(value)), "serialize"),
|
|
30136
|
+
deserialize: /* @__PURE__ */ __name((payload) => bytesToArrayBuffer(payload, "ArrayBuffer"), "deserialize"),
|
|
30137
|
+
strategy: "value"
|
|
30138
|
+
};
|
|
30139
|
+
var DataViewType = {
|
|
30140
|
+
id: "DataView",
|
|
30141
|
+
is: /* @__PURE__ */ __name((value) => value instanceof DataView, "is"),
|
|
30142
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30143
|
+
deserialize: /* @__PURE__ */ __name((payload) => new DataView(bytesToArrayBuffer(payload, "DataView")), "deserialize"),
|
|
30144
|
+
strategy: "value"
|
|
30145
|
+
};
|
|
30146
|
+
var BufferType = {
|
|
30147
|
+
id: "Buffer",
|
|
30148
|
+
is: /* @__PURE__ */ __name((value) => isNodeBuffer(value), "is"),
|
|
30149
|
+
serialize: /* @__PURE__ */ __name((value) => toBytePayload(value), "serialize"),
|
|
30150
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30151
|
+
const bytes = assertBytePayload(payload, "Buffer");
|
|
30152
|
+
const runtimeBufferConstructor = getRuntimeBufferConstructor();
|
|
30153
|
+
if (runtimeBufferConstructor) {
|
|
30154
|
+
return runtimeBufferConstructor.from(bytes);
|
|
30155
|
+
}
|
|
30156
|
+
return Uint8Array.from(bytes);
|
|
30157
|
+
}, "deserialize"),
|
|
30158
|
+
strategy: "value"
|
|
30159
|
+
};
|
|
30160
|
+
var typedArrayTypes = typedArrayTypeIds.map(
|
|
30161
|
+
(typeId) => createTypedArrayType(typeId)
|
|
30162
|
+
);
|
|
30163
|
+
var binaryBuiltInTypes = [
|
|
30164
|
+
ArrayBufferType,
|
|
30165
|
+
DataViewType,
|
|
30166
|
+
BufferType,
|
|
30167
|
+
...typedArrayTypes
|
|
30168
|
+
];
|
|
30169
|
+
|
|
30170
|
+
// src/serializer/error-url-builtins.ts
|
|
30171
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
30172
|
+
var errorReservedPropertyNames = /* @__PURE__ */ new Set([
|
|
30173
|
+
"name",
|
|
30174
|
+
"message",
|
|
30175
|
+
"stack",
|
|
30176
|
+
"cause"
|
|
30177
|
+
]);
|
|
30178
|
+
var isRecord = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
30179
|
+
var isUnsafePropertyName = /* @__PURE__ */ __name((propertyName) => propertyName === "__proto__" || propertyName === "constructor" || propertyName === "prototype", "isUnsafePropertyName");
|
|
30180
|
+
var collectErrorCustomFields = /* @__PURE__ */ __name((error2) => {
|
|
30181
|
+
const customFields = {};
|
|
30182
|
+
for (const propertyName of Object.getOwnPropertyNames(error2)) {
|
|
30183
|
+
if (errorReservedPropertyNames.has(propertyName)) {
|
|
30184
|
+
continue;
|
|
30185
|
+
}
|
|
30186
|
+
if (isUnsafePropertyName(propertyName)) {
|
|
30187
|
+
continue;
|
|
30188
|
+
}
|
|
30189
|
+
const descriptor = Object.getOwnPropertyDescriptor(error2, propertyName);
|
|
30190
|
+
if (!descriptor || !("value" in descriptor)) {
|
|
30191
|
+
continue;
|
|
30192
|
+
}
|
|
30193
|
+
customFields[propertyName] = descriptor.value;
|
|
30194
|
+
}
|
|
30195
|
+
return customFields;
|
|
30196
|
+
}, "collectErrorCustomFields");
|
|
30197
|
+
var assertSerializedErrorPayload = /* @__PURE__ */ __name((value) => {
|
|
30198
|
+
if (!isRecord(value)) {
|
|
30199
|
+
throw new Error("Invalid Error payload");
|
|
30200
|
+
}
|
|
30201
|
+
const { name, message, stack, customFields } = value;
|
|
30202
|
+
if (typeof name !== "string" || typeof message !== "string") {
|
|
30203
|
+
throw new Error("Invalid Error payload");
|
|
30204
|
+
}
|
|
30205
|
+
if (stack !== void 0 && typeof stack !== "string") {
|
|
30206
|
+
throw new Error("Invalid Error payload");
|
|
30207
|
+
}
|
|
30208
|
+
if (customFields !== void 0 && !isRecord(customFields)) {
|
|
30209
|
+
throw new Error("Invalid Error payload");
|
|
30210
|
+
}
|
|
30211
|
+
const normalizedCustomFields = {};
|
|
30212
|
+
const customFieldEntries = Object.entries(customFields ?? {});
|
|
30213
|
+
for (const [propertyName, propertyValue] of customFieldEntries) {
|
|
30214
|
+
if (isUnsafePropertyName(propertyName)) {
|
|
30215
|
+
continue;
|
|
30216
|
+
}
|
|
30217
|
+
normalizedCustomFields[propertyName] = propertyValue;
|
|
30218
|
+
}
|
|
30219
|
+
return {
|
|
30220
|
+
name,
|
|
30221
|
+
message,
|
|
30222
|
+
stack,
|
|
30223
|
+
hasCause: hasOwn.call(value, "cause"),
|
|
30224
|
+
cause: value.cause,
|
|
30225
|
+
customFields: normalizedCustomFields
|
|
30226
|
+
};
|
|
30227
|
+
}, "assertSerializedErrorPayload");
|
|
30228
|
+
var getUrlConstructor = /* @__PURE__ */ __name(() => {
|
|
30229
|
+
const value = globalThis.URL;
|
|
30230
|
+
if (typeof value !== "function") {
|
|
30231
|
+
return null;
|
|
30232
|
+
}
|
|
30233
|
+
return value;
|
|
30234
|
+
}, "getUrlConstructor");
|
|
30235
|
+
var getUrlSearchParamsConstructor = /* @__PURE__ */ __name(() => {
|
|
30236
|
+
const value = globalThis.URLSearchParams;
|
|
30237
|
+
if (typeof value !== "function") {
|
|
30238
|
+
return null;
|
|
30239
|
+
}
|
|
30240
|
+
return value;
|
|
30241
|
+
}, "getUrlSearchParamsConstructor");
|
|
30242
|
+
var ErrorType = {
|
|
30243
|
+
id: "Error",
|
|
30244
|
+
is: /* @__PURE__ */ __name((value) => value instanceof Error, "is"),
|
|
30245
|
+
serialize: /* @__PURE__ */ __name((error2) => {
|
|
30246
|
+
const serializedErrorPayload = {
|
|
30247
|
+
name: error2.name,
|
|
30248
|
+
message: error2.message,
|
|
30249
|
+
customFields: collectErrorCustomFields(error2)
|
|
30250
|
+
};
|
|
30251
|
+
if (typeof error2.stack === "string") {
|
|
30252
|
+
serializedErrorPayload.stack = error2.stack;
|
|
30253
|
+
}
|
|
30254
|
+
if (hasOwn.call(error2, "cause")) {
|
|
30255
|
+
serializedErrorPayload.cause = error2.cause;
|
|
30256
|
+
}
|
|
30257
|
+
return serializedErrorPayload;
|
|
30258
|
+
}, "serialize"),
|
|
30259
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30260
|
+
const { name, message, stack, hasCause, cause, customFields } = assertSerializedErrorPayload(payload);
|
|
30261
|
+
const restoredError = new Error(message);
|
|
30262
|
+
restoredError.name = name;
|
|
30263
|
+
if (stack !== void 0) {
|
|
30264
|
+
Object.defineProperty(restoredError, "stack", {
|
|
30265
|
+
value: stack,
|
|
30266
|
+
writable: true,
|
|
30267
|
+
configurable: true,
|
|
30268
|
+
enumerable: false
|
|
30269
|
+
});
|
|
30270
|
+
}
|
|
30271
|
+
if (hasCause) {
|
|
30272
|
+
Object.defineProperty(restoredError, "cause", {
|
|
30273
|
+
value: cause,
|
|
30274
|
+
writable: true,
|
|
30275
|
+
configurable: true,
|
|
30276
|
+
enumerable: false
|
|
30277
|
+
});
|
|
30278
|
+
}
|
|
30279
|
+
for (const [propertyName, propertyValue] of Object.entries(customFields)) {
|
|
30280
|
+
if (errorReservedPropertyNames.has(propertyName)) {
|
|
30281
|
+
continue;
|
|
30282
|
+
}
|
|
30283
|
+
restoredError[propertyName] = propertyValue;
|
|
30284
|
+
}
|
|
30285
|
+
return restoredError;
|
|
30286
|
+
}, "deserialize")
|
|
30287
|
+
};
|
|
30288
|
+
var URLType = {
|
|
30289
|
+
id: "URL",
|
|
30290
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30291
|
+
const runtimeUrlConstructor = getUrlConstructor();
|
|
30292
|
+
if (!runtimeUrlConstructor) {
|
|
30293
|
+
return false;
|
|
30294
|
+
}
|
|
30295
|
+
return value instanceof runtimeUrlConstructor;
|
|
30296
|
+
}, "is"),
|
|
30297
|
+
serialize: /* @__PURE__ */ __name((value) => value.href, "serialize"),
|
|
30298
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30299
|
+
if (typeof payload !== "string") {
|
|
30300
|
+
throw new Error("Invalid URL payload");
|
|
30301
|
+
}
|
|
30302
|
+
const runtimeUrlConstructor = getUrlConstructor();
|
|
30303
|
+
if (!runtimeUrlConstructor) {
|
|
30304
|
+
throw new Error("URL is not available in this runtime");
|
|
30305
|
+
}
|
|
30306
|
+
return new runtimeUrlConstructor(payload);
|
|
30307
|
+
}, "deserialize"),
|
|
30308
|
+
strategy: "value"
|
|
30309
|
+
};
|
|
30310
|
+
var URLSearchParamsType = {
|
|
30311
|
+
id: "URLSearchParams",
|
|
30312
|
+
is: /* @__PURE__ */ __name((value) => {
|
|
30313
|
+
const runtimeUrlSearchParamsConstructor = getUrlSearchParamsConstructor();
|
|
30314
|
+
if (!runtimeUrlSearchParamsConstructor) {
|
|
30315
|
+
return false;
|
|
30316
|
+
}
|
|
30317
|
+
return value instanceof runtimeUrlSearchParamsConstructor;
|
|
30318
|
+
}, "is"),
|
|
30319
|
+
serialize: /* @__PURE__ */ __name((value) => value.toString(), "serialize"),
|
|
30320
|
+
deserialize: /* @__PURE__ */ __name((payload) => {
|
|
30321
|
+
if (typeof payload !== "string") {
|
|
30322
|
+
throw new Error("Invalid URLSearchParams payload");
|
|
30323
|
+
}
|
|
30324
|
+
const runtimeUrlSearchParamsConstructor = getUrlSearchParamsConstructor();
|
|
30325
|
+
if (!runtimeUrlSearchParamsConstructor) {
|
|
30326
|
+
throw new Error("URLSearchParams is not available in this runtime");
|
|
30327
|
+
}
|
|
30328
|
+
return new runtimeUrlSearchParamsConstructor(payload);
|
|
30329
|
+
}, "deserialize"),
|
|
30330
|
+
strategy: "value"
|
|
30331
|
+
};
|
|
30332
|
+
var errorAndUrlBuiltInTypes = [
|
|
30333
|
+
ErrorType,
|
|
30334
|
+
URLType,
|
|
30335
|
+
URLSearchParamsType
|
|
30336
|
+
];
|
|
29814
30337
|
|
|
29815
30338
|
// src/serializer/special-values.ts
|
|
29816
30339
|
var serializeUndefined = /* @__PURE__ */ __name(() => ({
|
|
@@ -30016,7 +30539,9 @@ var builtInTypes = [
|
|
|
30016
30539
|
UndefinedType,
|
|
30017
30540
|
NonFiniteNumberType,
|
|
30018
30541
|
BigIntType,
|
|
30019
|
-
SymbolType
|
|
30542
|
+
SymbolType,
|
|
30543
|
+
...errorAndUrlBuiltInTypes,
|
|
30544
|
+
...binaryBuiltInTypes
|
|
30020
30545
|
];
|
|
30021
30546
|
|
|
30022
30547
|
// src/serializer/type-registry.ts
|
|
@@ -30507,7 +31032,7 @@ var serializeTreeValue = /* @__PURE__ */ __name((value, context, depth, options)
|
|
|
30507
31032
|
}, "serializeTreeValue");
|
|
30508
31033
|
|
|
30509
31034
|
// src/serializer/deserializer.ts
|
|
30510
|
-
var
|
|
31035
|
+
var hasOwn2 = Object.prototype.hasOwnProperty;
|
|
30511
31036
|
var copyOwnProperties = /* @__PURE__ */ __name((target, source, unsafeKeys) => {
|
|
30512
31037
|
const descriptors = Object.getOwnPropertyDescriptors(source);
|
|
30513
31038
|
for (const key of Object.keys(descriptors)) {
|
|
@@ -30588,7 +31113,7 @@ var deserializeValue = /* @__PURE__ */ __name((value, context, depth, options) =
|
|
|
30588
31113
|
const obj = {};
|
|
30589
31114
|
const source = value;
|
|
30590
31115
|
for (const key in source) {
|
|
30591
|
-
if (!
|
|
31116
|
+
if (!hasOwn2.call(source, key)) {
|
|
30592
31117
|
continue;
|
|
30593
31118
|
}
|
|
30594
31119
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30633,7 +31158,7 @@ var resolveReference = /* @__PURE__ */ __name((id2, context, depth, options) =>
|
|
|
30633
31158
|
context.resolved.set(id2, target);
|
|
30634
31159
|
const source = node.value;
|
|
30635
31160
|
for (const key in source) {
|
|
30636
|
-
if (!
|
|
31161
|
+
if (!hasOwn2.call(source, key)) {
|
|
30637
31162
|
continue;
|
|
30638
31163
|
}
|
|
30639
31164
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30705,7 +31230,7 @@ var mergePlaceholder = /* @__PURE__ */ __name((placeholder, result, unsafeKeys)
|
|
|
30705
31230
|
const target = placeholder;
|
|
30706
31231
|
const source = result;
|
|
30707
31232
|
for (const key in source) {
|
|
30708
|
-
if (!
|
|
31233
|
+
if (!hasOwn2.call(source, key)) {
|
|
30709
31234
|
continue;
|
|
30710
31235
|
}
|
|
30711
31236
|
if (isUnsafeKey(key, unsafeKeys)) {
|
|
@@ -30738,7 +31263,7 @@ var deserializeLegacy = /* @__PURE__ */ __name((value, depth, options) => {
|
|
|
30738
31263
|
const obj = {};
|
|
30739
31264
|
const source = value;
|
|
30740
31265
|
for (const key in source) {
|
|
30741
|
-
if (!
|
|
31266
|
+
if (!hasOwn2.call(source, key)) {
|
|
30742
31267
|
continue;
|
|
30743
31268
|
}
|
|
30744
31269
|
if (isUnsafeKey(key, options.unsafeKeys)) {
|
|
@@ -30749,6 +31274,26 @@ var deserializeLegacy = /* @__PURE__ */ __name((value, depth, options) => {
|
|
|
30749
31274
|
return obj;
|
|
30750
31275
|
}, "deserializeLegacy");
|
|
30751
31276
|
|
|
31277
|
+
// src/serializer/option-normalizers.ts
|
|
31278
|
+
var normalizeMaxDepth = /* @__PURE__ */ __name((value, fallback) => {
|
|
31279
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
31280
|
+
return Number.POSITIVE_INFINITY;
|
|
31281
|
+
}
|
|
31282
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
|
|
31283
|
+
return Math.floor(value);
|
|
31284
|
+
}
|
|
31285
|
+
return fallback;
|
|
31286
|
+
}, "normalizeMaxDepth");
|
|
31287
|
+
var normalizeMaxRegExpPatternLength = /* @__PURE__ */ __name((value, fallback) => {
|
|
31288
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
31289
|
+
return Number.POSITIVE_INFINITY;
|
|
31290
|
+
}
|
|
31291
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
31292
|
+
return Math.floor(value);
|
|
31293
|
+
}
|
|
31294
|
+
return fallback;
|
|
31295
|
+
}, "normalizeMaxRegExpPatternLength");
|
|
31296
|
+
|
|
30752
31297
|
// src/serializer/Serializer.ts
|
|
30753
31298
|
var GRAPH_VERSION = 1;
|
|
30754
31299
|
var DEFAULT_MAX_DEPTH = 1e3;
|
|
@@ -30784,10 +31329,11 @@ var Serializer = class {
|
|
|
30784
31329
|
return check(pattern, index);
|
|
30785
31330
|
}, "isBoundedQuantifier");
|
|
30786
31331
|
this.indent = options.pretty ? 2 : void 0;
|
|
30787
|
-
|
|
30788
|
-
this.
|
|
30789
|
-
|
|
30790
|
-
|
|
31332
|
+
this.maxDepth = normalizeMaxDepth(options.maxDepth, DEFAULT_MAX_DEPTH);
|
|
31333
|
+
this.maxRegExpPatternLength = normalizeMaxRegExpPatternLength(
|
|
31334
|
+
options.maxRegExpPatternLength,
|
|
31335
|
+
DEFAULT_MAX_REGEXP_PATTERN_LENGTH
|
|
31336
|
+
);
|
|
30791
31337
|
this.allowUnsafeRegExp = options.allowUnsafeRegExp ?? false;
|
|
30792
31338
|
this.unsafeKeys = DEFAULT_UNSAFE_KEYS;
|
|
30793
31339
|
this.typeRegistry = new TypeRegistry({
|
|
@@ -30922,13 +31468,6 @@ var Serializer = class {
|
|
|
30922
31468
|
}
|
|
30923
31469
|
};
|
|
30924
31470
|
|
|
30925
|
-
// src/serializer/index.ts
|
|
30926
|
-
var defaultSerializer = new Serializer();
|
|
30927
|
-
function getDefaultSerializer() {
|
|
30928
|
-
return defaultSerializer;
|
|
30929
|
-
}
|
|
30930
|
-
__name(getDefaultSerializer, "getDefaultSerializer");
|
|
30931
|
-
|
|
30932
31471
|
// src/definers/defineAsyncContext.ts
|
|
30933
31472
|
var platform = getPlatform();
|
|
30934
31473
|
var storage = platform.createAsyncLocalStorage();
|
|
@@ -30936,13 +31475,14 @@ function getCurrentStore() {
|
|
|
30936
31475
|
return storage.getStore();
|
|
30937
31476
|
}
|
|
30938
31477
|
__name(getCurrentStore, "getCurrentStore");
|
|
30939
|
-
function defineAsyncContext(def) {
|
|
31478
|
+
function defineAsyncContext(def, filePath) {
|
|
30940
31479
|
if (!platform.hasAsyncLocalStorage()) {
|
|
30941
31480
|
platformUnsupportedFunctionError.throw({
|
|
30942
31481
|
functionName: `createAsyncLocalStorage: Cannot create context ${def.id}: no async storage available in this environment`
|
|
30943
31482
|
});
|
|
30944
31483
|
}
|
|
30945
31484
|
const ctxId = def.id;
|
|
31485
|
+
const resolvedFilePath = filePath ?? getCallerFile();
|
|
30946
31486
|
const use = /* @__PURE__ */ __name(() => {
|
|
30947
31487
|
const store2 = getCurrentStore();
|
|
30948
31488
|
if (!store2 || !store2.has(ctxId)) {
|
|
@@ -30959,10 +31499,11 @@ function defineAsyncContext(def) {
|
|
|
30959
31499
|
map.set(ctxId, value);
|
|
30960
31500
|
return storage.run(map, fn);
|
|
30961
31501
|
}, "provide");
|
|
30962
|
-
const serializer3 =
|
|
31502
|
+
const serializer3 = new Serializer();
|
|
30963
31503
|
const api = {
|
|
30964
31504
|
id: ctxId,
|
|
30965
31505
|
[symbolAsyncContext]: true,
|
|
31506
|
+
[symbolFilePath]: resolvedFilePath,
|
|
30966
31507
|
use,
|
|
30967
31508
|
/* istanbul ignore next */
|
|
30968
31509
|
provide(value, fn) {
|
|
@@ -31614,12 +32155,12 @@ var EventManager = class {
|
|
|
31614
32155
|
data,
|
|
31615
32156
|
timestamp: /* @__PURE__ */ new Date(),
|
|
31616
32157
|
source,
|
|
31617
|
-
meta: eventDefinition.meta || {},
|
|
32158
|
+
meta: { ...eventDefinition.meta || {} },
|
|
31618
32159
|
stopPropagation: /* @__PURE__ */ __name(() => {
|
|
31619
32160
|
propagationStopped = true;
|
|
31620
32161
|
}, "stopPropagation"),
|
|
31621
32162
|
isPropagationStopped: /* @__PURE__ */ __name(() => propagationStopped, "isPropagationStopped"),
|
|
31622
|
-
tags: eventDefinition.tags
|
|
32163
|
+
tags: [...eventDefinition.tags]
|
|
31623
32164
|
};
|
|
31624
32165
|
const baseEmit = /* @__PURE__ */ __name(async (eventToEmit) => {
|
|
31625
32166
|
if (allListeners.length === 0) {
|
|
@@ -31645,10 +32186,14 @@ var EventManager = class {
|
|
|
31645
32186
|
if (!interceptor) {
|
|
31646
32187
|
return baseEmit(eventToEmit);
|
|
31647
32188
|
}
|
|
31648
|
-
return interceptor(
|
|
31649
|
-
(
|
|
31650
|
-
|
|
31651
|
-
|
|
32189
|
+
return interceptor((nextEvent) => {
|
|
32190
|
+
this.assertPropagationMethodsUnchanged(
|
|
32191
|
+
eventDefinition.id,
|
|
32192
|
+
eventToEmit,
|
|
32193
|
+
nextEvent
|
|
32194
|
+
);
|
|
32195
|
+
return runInterceptor(index + 1, nextEvent);
|
|
32196
|
+
}, eventToEmit);
|
|
31652
32197
|
}, "runInterceptor");
|
|
31653
32198
|
await runInterceptor(0, event2);
|
|
31654
32199
|
return deepestEvent;
|
|
@@ -31759,21 +32304,24 @@ var EventManager = class {
|
|
|
31759
32304
|
lockedError.throw({ what: "EventManager" });
|
|
31760
32305
|
}
|
|
31761
32306
|
}
|
|
31762
|
-
|
|
31763
|
-
|
|
31764
|
-
|
|
31765
|
-
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
31769
|
-
|
|
32307
|
+
assertPropagationMethodsUnchanged(eventId, currentEvent, nextEvent) {
|
|
32308
|
+
if (nextEvent.stopPropagation !== currentEvent.stopPropagation || nextEvent.isPropagationStopped !== currentEvent.isPropagationStopped) {
|
|
32309
|
+
validationError.throw({
|
|
32310
|
+
subject: "Event interceptor",
|
|
32311
|
+
id: eventId,
|
|
32312
|
+
originalError: new Error(
|
|
32313
|
+
"Interceptors cannot override stopPropagation/isPropagationStopped"
|
|
32314
|
+
)
|
|
32315
|
+
});
|
|
32316
|
+
}
|
|
31770
32317
|
}
|
|
31771
32318
|
/**
|
|
31772
32319
|
* Disposes the EventManager, releasing all listeners and interceptors.
|
|
31773
|
-
* Alias for clear() following the IResource disposal pattern.
|
|
31774
32320
|
*/
|
|
31775
32321
|
dispose() {
|
|
31776
|
-
this.clear();
|
|
32322
|
+
this.registry.clear();
|
|
32323
|
+
this.emissionInterceptors.length = 0;
|
|
32324
|
+
this.hookInterceptors.length = 0;
|
|
31777
32325
|
}
|
|
31778
32326
|
/**
|
|
31779
32327
|
* Retrieves cached merged listeners for an event, or creates them if not cached.
|
|
@@ -33080,7 +33628,7 @@ var TaskRunner = class {
|
|
|
33080
33628
|
__name(this, "TaskRunner");
|
|
33081
33629
|
}
|
|
33082
33630
|
/**
|
|
33083
|
-
* Begins the execution of
|
|
33631
|
+
* 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.
|
|
33084
33632
|
* This function can throw only if any of the event listeners or run function throws
|
|
33085
33633
|
* @param task the task to be run
|
|
33086
33634
|
* @param input the input to be passed to the task
|
|
@@ -33109,8 +33657,6 @@ var TaskRunner = class {
|
|
|
33109
33657
|
/**
|
|
33110
33658
|
* Creates the function with the chain of middleware.
|
|
33111
33659
|
* @param task
|
|
33112
|
-
* @param input
|
|
33113
|
-
* @param taskDependencies
|
|
33114
33660
|
* @returns
|
|
33115
33661
|
*/
|
|
33116
33662
|
createRunnerWithMiddleware(task2) {
|
|
@@ -33130,7 +33676,7 @@ var ResourceInitializer = class {
|
|
|
33130
33676
|
__name(this, "ResourceInitializer");
|
|
33131
33677
|
}
|
|
33132
33678
|
/**
|
|
33133
|
-
* Begins the execution of
|
|
33679
|
+
* 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.
|
|
33134
33680
|
* This function can throw only if any of the event listeners or run function throws
|
|
33135
33681
|
*/
|
|
33136
33682
|
async initializeResource(resource2, config, dependencies) {
|
|
@@ -33620,23 +34166,28 @@ var DependencyProcessor = class {
|
|
|
33620
34166
|
middleware.computedDependencies = computedDependencies;
|
|
33621
34167
|
middleware.isInitialized = true;
|
|
33622
34168
|
}
|
|
33623
|
-
for (const resource2 of this.store.resources.values()) {
|
|
33624
|
-
await this.processResourceDependencies(resource2);
|
|
33625
|
-
}
|
|
33626
|
-
for (const task2 of this.store.tasks.values()) {
|
|
33627
|
-
await this.computeTaskDependencies(task2);
|
|
33628
|
-
}
|
|
33629
34169
|
for (const hookStoreElement of this.store.hooks.values()) {
|
|
33630
34170
|
const hook2 = hookStoreElement.hook;
|
|
33631
34171
|
const deps = hook2.dependencies;
|
|
34172
|
+
hookStoreElement.dependencyState = "computing" /* Computing */;
|
|
33632
34173
|
hookStoreElement.computedDependencies = await this.extractDependencies(
|
|
33633
34174
|
deps,
|
|
33634
34175
|
hook2.id
|
|
33635
34176
|
);
|
|
34177
|
+
hookStoreElement.dependencyState = "ready" /* Ready */;
|
|
34178
|
+
}
|
|
34179
|
+
for (const resource2 of this.store.resources.values()) {
|
|
34180
|
+
await this.processResourceDependencies(resource2);
|
|
34181
|
+
}
|
|
34182
|
+
for (const task2 of this.store.tasks.values()) {
|
|
34183
|
+
await this.computeTaskDependencies(task2);
|
|
33636
34184
|
}
|
|
33637
34185
|
await this.initializeUninitializedResources();
|
|
33638
34186
|
}
|
|
33639
34187
|
async computeTaskDependencies(task2) {
|
|
34188
|
+
if (task2.isInitialized) {
|
|
34189
|
+
return;
|
|
34190
|
+
}
|
|
33640
34191
|
const deps = task2.task.dependencies;
|
|
33641
34192
|
task2.computedDependencies = await this.extractDependencies(
|
|
33642
34193
|
deps,
|
|
@@ -33768,6 +34319,9 @@ var DependencyProcessor = class {
|
|
|
33768
34319
|
if (receivedEvent.source === hook2.id) {
|
|
33769
34320
|
return;
|
|
33770
34321
|
}
|
|
34322
|
+
if (hookStoreElement.dependencyState !== "ready" /* Ready */) {
|
|
34323
|
+
return;
|
|
34324
|
+
}
|
|
33771
34325
|
return this.eventManager.executeHookWithInterceptors(
|
|
33772
34326
|
hook2,
|
|
33773
34327
|
receivedEvent,
|
|
@@ -33884,7 +34438,7 @@ var DependencyProcessor = class {
|
|
|
33884
34438
|
}
|
|
33885
34439
|
const st = storeTask;
|
|
33886
34440
|
if (!st.isInitialized) {
|
|
33887
|
-
const dependencies =
|
|
34441
|
+
const dependencies = st.task.dependencies;
|
|
33888
34442
|
st.computedDependencies = await this.extractDependencies(
|
|
33889
34443
|
dependencies,
|
|
33890
34444
|
st.task.id
|
|
@@ -33910,14 +34464,19 @@ var DependencyProcessor = class {
|
|
|
33910
34464
|
wrapped = this.wrapResourceDependencies(depMap, raw);
|
|
33911
34465
|
sr.computedDependencies = wrapped;
|
|
33912
34466
|
}
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
|
|
33916
|
-
|
|
33917
|
-
|
|
33918
|
-
|
|
33919
|
-
|
|
33920
|
-
|
|
34467
|
+
try {
|
|
34468
|
+
const { value, context } = await this.resourceInitializer.initializeResource(
|
|
34469
|
+
resource2,
|
|
34470
|
+
config,
|
|
34471
|
+
wrapped
|
|
34472
|
+
);
|
|
34473
|
+
sr.context = context;
|
|
34474
|
+
sr.value = value;
|
|
34475
|
+
sr.isInitialized = true;
|
|
34476
|
+
this.store.recordResourceInitialized(resource2.id);
|
|
34477
|
+
} catch (error2) {
|
|
34478
|
+
this.rethrowResourceInitError(resource2.id, error2);
|
|
34479
|
+
}
|
|
33921
34480
|
}
|
|
33922
34481
|
return sr.value;
|
|
33923
34482
|
}
|
|
@@ -34120,7 +34679,8 @@ var StoreRegistry = class {
|
|
|
34120
34679
|
const hook2 = this.getFreshValue(item, this.hooks, "hook", overrideMode);
|
|
34121
34680
|
this.hooks.set(hook2.id, {
|
|
34122
34681
|
hook: hook2,
|
|
34123
|
-
computedDependencies: {}
|
|
34682
|
+
computedDependencies: {},
|
|
34683
|
+
dependencyState: "pending" /* Pending */
|
|
34124
34684
|
});
|
|
34125
34685
|
}
|
|
34126
34686
|
storeTaskMiddleware(item, storingMode = "normal") {
|
|
@@ -34175,7 +34735,10 @@ var StoreRegistry = class {
|
|
|
34175
34735
|
return prepared;
|
|
34176
34736
|
}
|
|
34177
34737
|
computeRegistrationDeeply(element, config) {
|
|
34178
|
-
|
|
34738
|
+
let items = typeof element.register === "function" ? element.register(config) : element.register;
|
|
34739
|
+
if (!items) {
|
|
34740
|
+
items = [];
|
|
34741
|
+
}
|
|
34179
34742
|
element.register = items;
|
|
34180
34743
|
for (const item of items) {
|
|
34181
34744
|
this.storeGenericItem(item);
|
|
@@ -34713,25 +35276,27 @@ var InterceptorRegistry = class {
|
|
|
34713
35276
|
* Gets all global task interceptors
|
|
34714
35277
|
*/
|
|
34715
35278
|
getGlobalTaskInterceptors() {
|
|
34716
|
-
return this.taskInterceptors;
|
|
35279
|
+
return Object.freeze([...this.taskInterceptors]);
|
|
34717
35280
|
}
|
|
34718
35281
|
/**
|
|
34719
35282
|
* Gets all global resource interceptors
|
|
34720
35283
|
*/
|
|
34721
35284
|
getGlobalResourceInterceptors() {
|
|
34722
|
-
return this.resourceInterceptors;
|
|
35285
|
+
return Object.freeze([...this.resourceInterceptors]);
|
|
34723
35286
|
}
|
|
34724
35287
|
/**
|
|
34725
35288
|
* Gets interceptors for a specific task middleware
|
|
34726
35289
|
*/
|
|
34727
35290
|
getTaskMiddlewareInterceptors(middlewareId) {
|
|
34728
|
-
|
|
35291
|
+
const interceptors = this.perTaskMiddleware.get(middlewareId) ?? [];
|
|
35292
|
+
return Object.freeze([...interceptors]);
|
|
34729
35293
|
}
|
|
34730
35294
|
/**
|
|
34731
35295
|
* Gets interceptors for a specific resource middleware
|
|
34732
35296
|
*/
|
|
34733
35297
|
getResourceMiddlewareInterceptors(middlewareId) {
|
|
34734
|
-
|
|
35298
|
+
const interceptors = this.perResourceMiddleware.get(middlewareId) ?? [];
|
|
35299
|
+
return Object.freeze([...interceptors]);
|
|
34735
35300
|
}
|
|
34736
35301
|
};
|
|
34737
35302
|
|
|
@@ -35210,10 +35775,8 @@ var ResourceMiddlewareComposer = class {
|
|
|
35210
35775
|
|
|
35211
35776
|
// src/models/MiddlewareManager.ts
|
|
35212
35777
|
var MiddlewareManager = class {
|
|
35213
|
-
constructor(store2,
|
|
35778
|
+
constructor(store2, _eventManager, _logger) {
|
|
35214
35779
|
this.store = store2;
|
|
35215
|
-
this.eventManager = eventManager;
|
|
35216
|
-
this.logger = logger;
|
|
35217
35780
|
this.interceptorRegistry = new InterceptorRegistry();
|
|
35218
35781
|
this.middlewareResolver = new MiddlewareResolver(store2);
|
|
35219
35782
|
this.taskComposer = new TaskMiddlewareComposer(
|
|
@@ -35254,14 +35817,6 @@ var MiddlewareManager = class {
|
|
|
35254
35817
|
lock() {
|
|
35255
35818
|
this.interceptorRegistry.lock();
|
|
35256
35819
|
}
|
|
35257
|
-
/**
|
|
35258
|
-
* Adds an interceptor for task or resource middleware execution
|
|
35259
|
-
* Interceptors are executed in the order they are added, with the ability to
|
|
35260
|
-
* modify, log, or prevent middleware execution
|
|
35261
|
-
*
|
|
35262
|
-
* @param kind - The type of middleware to intercept ("task" or "resource")
|
|
35263
|
-
* @param interceptor - The interceptor function to add
|
|
35264
|
-
*/
|
|
35265
35820
|
intercept(kind, interceptor) {
|
|
35266
35821
|
if (kind === "task") {
|
|
35267
35822
|
this.interceptorRegistry.addGlobalTaskInterceptor(
|
|
@@ -35273,13 +35828,6 @@ var MiddlewareManager = class {
|
|
|
35273
35828
|
);
|
|
35274
35829
|
}
|
|
35275
35830
|
}
|
|
35276
|
-
/**
|
|
35277
|
-
* Adds an interceptor for a specific middleware instance with better type safety
|
|
35278
|
-
* This method automatically determines the type and provides type-safe access
|
|
35279
|
-
*
|
|
35280
|
-
* @param middleware - The middleware instance to intercept
|
|
35281
|
-
* @param interceptor - The interceptor function with proper typing
|
|
35282
|
-
*/
|
|
35283
35831
|
interceptMiddleware(middleware, interceptor) {
|
|
35284
35832
|
if (isTaskMiddleware(middleware)) {
|
|
35285
35833
|
this.interceptorRegistry.addTaskMiddlewareInterceptor(
|
|
@@ -35418,12 +35966,17 @@ var Store = class {
|
|
|
35418
35966
|
}
|
|
35419
35967
|
}
|
|
35420
35968
|
registerGlobalComponents() {
|
|
35969
|
+
if (!this.taskRunner) {
|
|
35970
|
+
throw new Error(
|
|
35971
|
+
"TaskRunner is not set. Call store.setTaskRunner() before initializeStore()."
|
|
35972
|
+
);
|
|
35973
|
+
}
|
|
35421
35974
|
const builtInResourcesMap = /* @__PURE__ */ new Map();
|
|
35422
35975
|
builtInResourcesMap.set(globalResources.store, this);
|
|
35423
35976
|
builtInResourcesMap.set(globalResources.eventManager, this.eventManager);
|
|
35424
35977
|
builtInResourcesMap.set(globalResources.logger, this.logger);
|
|
35425
35978
|
builtInResourcesMap.set(globalResources.taskRunner, this.taskRunner);
|
|
35426
|
-
builtInResourcesMap.set(globalResources.serializer,
|
|
35979
|
+
builtInResourcesMap.set(globalResources.serializer, new Serializer());
|
|
35427
35980
|
builtInResourcesMap.set(
|
|
35428
35981
|
globalResources.middlewareManager,
|
|
35429
35982
|
this.middlewareManager
|
|
@@ -35483,8 +36036,11 @@ var Store = class {
|
|
|
35483
36036
|
setTaskRunner(taskRunner) {
|
|
35484
36037
|
this.taskRunner = taskRunner;
|
|
35485
36038
|
}
|
|
35486
|
-
setupRootResource(
|
|
35487
|
-
root
|
|
36039
|
+
setupRootResource(rootDefinition, config) {
|
|
36040
|
+
const root = {
|
|
36041
|
+
...rootDefinition,
|
|
36042
|
+
dependencies: typeof rootDefinition.dependencies === "function" ? rootDefinition.dependencies(config) : rootDefinition.dependencies
|
|
36043
|
+
};
|
|
35488
36044
|
this.root = {
|
|
35489
36045
|
resource: root,
|
|
35490
36046
|
computedDependencies: {},
|
|
@@ -36037,6 +36593,18 @@ var RunResult = class {
|
|
|
36037
36593
|
}
|
|
36038
36594
|
return this.store.resources.get(resourceId).value;
|
|
36039
36595
|
}, "getResourceValue");
|
|
36596
|
+
/**
|
|
36597
|
+
* Get the config of a resource from the run result.
|
|
36598
|
+
* @param resource - The resource to get the config of.
|
|
36599
|
+
* @returns The config passed for the resource.
|
|
36600
|
+
*/
|
|
36601
|
+
this.getResourceConfig = /* @__PURE__ */ __name((resource2) => {
|
|
36602
|
+
const resourceId = typeof resource2 === "string" ? resource2 : resource2.id;
|
|
36603
|
+
if (!this.store.resources.has(resourceId)) {
|
|
36604
|
+
throw new Error(`Resource "${resourceId}" not found.`);
|
|
36605
|
+
}
|
|
36606
|
+
return this.store.resources.get(resourceId).config;
|
|
36607
|
+
}, "getResourceConfig");
|
|
36040
36608
|
this.dispose = /* @__PURE__ */ __name(() => {
|
|
36041
36609
|
return this.disposeFn();
|
|
36042
36610
|
}, "dispose");
|
|
@@ -37218,7 +37786,7 @@ function makeAsyncContextBuilder(state) {
|
|
|
37218
37786
|
configSchema: state.configSchema,
|
|
37219
37787
|
meta: state.meta
|
|
37220
37788
|
};
|
|
37221
|
-
return defineAsyncContext(def);
|
|
37789
|
+
return defineAsyncContext(def, state.filePath);
|
|
37222
37790
|
}
|
|
37223
37791
|
};
|
|
37224
37792
|
return builder;
|
|
@@ -37227,8 +37795,10 @@ __name(makeAsyncContextBuilder, "makeAsyncContextBuilder");
|
|
|
37227
37795
|
|
|
37228
37796
|
// src/definers/builders/asyncContext/index.ts
|
|
37229
37797
|
function asyncContextBuilder(id2) {
|
|
37798
|
+
const filePath = getCallerFile();
|
|
37230
37799
|
const initial = Object.freeze({
|
|
37231
37800
|
id: id2,
|
|
37801
|
+
filePath,
|
|
37232
37802
|
serialize: void 0,
|
|
37233
37803
|
parse: void 0,
|
|
37234
37804
|
configSchema: void 0,
|
|
@@ -37701,7 +38271,7 @@ function override(base) {
|
|
|
37701
38271
|
}
|
|
37702
38272
|
__name(override, "override");
|
|
37703
38273
|
|
|
37704
|
-
// src/
|
|
38274
|
+
// src/public.ts
|
|
37705
38275
|
init_http_fetch_tunnel_resource();
|
|
37706
38276
|
var globals = {
|
|
37707
38277
|
events: globalEvents,
|
|
@@ -38845,15 +39415,15 @@ var UNSAFE_ERROR_FIELDS = /* @__PURE__ */ new Set([
|
|
|
38845
39415
|
"cause" /* Cause */,
|
|
38846
39416
|
"sql" /* Sql */
|
|
38847
39417
|
]);
|
|
38848
|
-
var
|
|
38849
|
-
var isJsonBody = /* @__PURE__ */ __name((value) =>
|
|
38850
|
-
var toErrorRecord = /* @__PURE__ */ __name((value) =>
|
|
39418
|
+
var isRecord2 = /* @__PURE__ */ __name((value) => !!value && typeof value === "object", "isRecord");
|
|
39419
|
+
var isJsonBody = /* @__PURE__ */ __name((value) => isRecord2(value) && typeof value.ok === "boolean", "isJsonBody");
|
|
39420
|
+
var toErrorRecord = /* @__PURE__ */ __name((value) => isRecord2(value) ? value : void 0, "toErrorRecord");
|
|
38851
39421
|
var sanitizeErrorResponse = /* @__PURE__ */ __name((response) => {
|
|
38852
|
-
const asRecord =
|
|
39422
|
+
const asRecord = isRecord2(response) ? response : void 0;
|
|
38853
39423
|
const statusRaw = asRecord?.status ?? asRecord?.statusCode;
|
|
38854
39424
|
const status = typeof statusRaw === "number" && Number.isFinite(statusRaw) ? statusRaw : 500;
|
|
38855
39425
|
const bodyRaw = asRecord?.body;
|
|
38856
|
-
const body =
|
|
39426
|
+
const body = isRecord2(bodyRaw) ? bodyRaw : void 0;
|
|
38857
39427
|
const errorRaw = (body ? toErrorRecord(body.error) : void 0) ?? toErrorRecord(asRecord?.error);
|
|
38858
39428
|
const normalizedBody = (() => {
|
|
38859
39429
|
if (isJsonBody(bodyRaw)) {
|
|
@@ -38910,7 +39480,7 @@ var resolveAppErrorExtra = /* @__PURE__ */ __name((store2, error2) => {
|
|
|
38910
39480
|
try {
|
|
38911
39481
|
for (const helper of store2.errors.values()) {
|
|
38912
39482
|
if (helper.is(error2)) {
|
|
38913
|
-
if (!
|
|
39483
|
+
if (!isRecord2(error2)) return { id: void 0, data: void 0 };
|
|
38914
39484
|
const name = error2["name" /* Name */];
|
|
38915
39485
|
const id2 = typeof name === "string" ? name : void 0;
|
|
38916
39486
|
const data = error2["data" /* Data */];
|
|
@@ -39626,10 +40196,10 @@ function createDurableStepId(id2) {
|
|
|
39626
40196
|
return { id: id2 };
|
|
39627
40197
|
}
|
|
39628
40198
|
__name(createDurableStepId, "createDurableStepId");
|
|
39629
|
-
function
|
|
40199
|
+
function isRecord3(value) {
|
|
39630
40200
|
return typeof value === "object" && value !== null;
|
|
39631
40201
|
}
|
|
39632
|
-
__name(
|
|
40202
|
+
__name(isRecord3, "isRecord");
|
|
39633
40203
|
function sleepMs(ms) {
|
|
39634
40204
|
return new Promise((resolve) => {
|
|
39635
40205
|
const timer = timers.setTimeout(resolve, ms);
|
|
@@ -39659,7 +40229,7 @@ function createExecutionId() {
|
|
|
39659
40229
|
}
|
|
39660
40230
|
__name(createExecutionId, "createExecutionId");
|
|
39661
40231
|
function parseSignalState(value) {
|
|
39662
|
-
if (!
|
|
40232
|
+
if (!isRecord3(value)) return null;
|
|
39663
40233
|
const state = value.state;
|
|
39664
40234
|
if (state === "waiting") {
|
|
39665
40235
|
const timerId = value.timerId;
|
|
@@ -39701,6 +40271,7 @@ var DurableAuditEntryKind = {
|
|
|
39701
40271
|
SignalDelivered: "signal_delivered",
|
|
39702
40272
|
SignalTimedOut: "signal_timed_out",
|
|
39703
40273
|
EmitPublished: "emit_published",
|
|
40274
|
+
SwitchEvaluated: "switch_evaluated",
|
|
39704
40275
|
Note: "note"
|
|
39705
40276
|
};
|
|
39706
40277
|
function isDurableInternalStepId(stepId) {
|
|
@@ -39724,15 +40295,194 @@ var SuspensionSignal = class extends Error {
|
|
|
39724
40295
|
}
|
|
39725
40296
|
};
|
|
39726
40297
|
|
|
40298
|
+
// src/node/durable/core/DurableOperator.ts
|
|
40299
|
+
var DurableOperator = class {
|
|
40300
|
+
constructor(store2) {
|
|
40301
|
+
this.store = store2;
|
|
40302
|
+
}
|
|
40303
|
+
static {
|
|
40304
|
+
__name(this, "DurableOperator");
|
|
40305
|
+
}
|
|
40306
|
+
async listExecutions(options) {
|
|
40307
|
+
if (this.store.listExecutions) {
|
|
40308
|
+
return await this.store.listExecutions(options);
|
|
40309
|
+
}
|
|
40310
|
+
return await this.store.listIncompleteExecutions();
|
|
40311
|
+
}
|
|
40312
|
+
async getExecutionDetail(executionId) {
|
|
40313
|
+
const execution = await this.store.getExecution(executionId);
|
|
40314
|
+
const steps = this.store.listStepResults ? await this.store.listStepResults(executionId) : [];
|
|
40315
|
+
const audit = this.store.listAuditEntries ? await this.store.listAuditEntries(executionId) : [];
|
|
40316
|
+
return { execution, steps, audit };
|
|
40317
|
+
}
|
|
40318
|
+
/**
|
|
40319
|
+
* Resets an execution from `compensation_failed` (or other states) to `pending`.
|
|
40320
|
+
* This effectively retries the workflow from the last memoized step.
|
|
40321
|
+
*/
|
|
40322
|
+
async retryRollback(executionId) {
|
|
40323
|
+
if (!this.store.retryRollback) {
|
|
40324
|
+
throw new Error("Store does not support retryRollback");
|
|
40325
|
+
}
|
|
40326
|
+
await this.store.retryRollback(executionId);
|
|
40327
|
+
}
|
|
40328
|
+
/**
|
|
40329
|
+
* Manually marks a step as completed with a specific result.
|
|
40330
|
+
* Useful for skipping broken steps or providing a manual fix.
|
|
40331
|
+
*/
|
|
40332
|
+
async skipStep(executionId, stepId) {
|
|
40333
|
+
if (!this.store.skipStep) {
|
|
40334
|
+
throw new Error("Store does not support skipStep");
|
|
40335
|
+
}
|
|
40336
|
+
await this.store.skipStep(executionId, stepId);
|
|
40337
|
+
}
|
|
40338
|
+
/**
|
|
40339
|
+
* Forces an execution to the `failed` state.
|
|
40340
|
+
*/
|
|
40341
|
+
async forceFail(executionId, reason) {
|
|
40342
|
+
if (!this.store.forceFail) {
|
|
40343
|
+
throw new Error("Store does not support forceFail");
|
|
40344
|
+
}
|
|
40345
|
+
await this.store.forceFail(executionId, { message: reason });
|
|
40346
|
+
}
|
|
40347
|
+
/**
|
|
40348
|
+
* Manually patches the result of a step.
|
|
40349
|
+
* Useful when a step failed to save its result but the side effect occurred.
|
|
40350
|
+
*/
|
|
40351
|
+
async editState(executionId, stepId, newState) {
|
|
40352
|
+
if (!this.store.editStepResult) {
|
|
40353
|
+
throw new Error("Store does not support editStepResult");
|
|
40354
|
+
}
|
|
40355
|
+
await this.store.editStepResult(executionId, stepId, newState);
|
|
40356
|
+
}
|
|
40357
|
+
/**
|
|
40358
|
+
* Lists all executions that require manual intervention.
|
|
40359
|
+
*/
|
|
40360
|
+
async listStuckExecutions() {
|
|
40361
|
+
if (!this.store.listStuckExecutions) {
|
|
40362
|
+
throw new Error("Store does not support listStuckExecutions");
|
|
40363
|
+
}
|
|
40364
|
+
return await this.store.listStuckExecutions();
|
|
40365
|
+
}
|
|
40366
|
+
};
|
|
40367
|
+
|
|
40368
|
+
// src/node/durable/core/flowShape.ts
|
|
40369
|
+
var FlowRecorder = class {
|
|
40370
|
+
constructor() {
|
|
40371
|
+
this.nodes = [];
|
|
40372
|
+
this.executionId = "__flow_record__";
|
|
40373
|
+
this.attempt = 0;
|
|
40374
|
+
}
|
|
40375
|
+
static {
|
|
40376
|
+
__name(this, "FlowRecorder");
|
|
40377
|
+
}
|
|
40378
|
+
resolveStepId(stepId) {
|
|
40379
|
+
return typeof stepId === "string" ? stepId : stepId.id;
|
|
40380
|
+
}
|
|
40381
|
+
step(stepId, optionsOrFn, _fn) {
|
|
40382
|
+
const id2 = this.resolveStepId(stepId);
|
|
40383
|
+
if (optionsOrFn === void 0) {
|
|
40384
|
+
return new FlowStepRecorder(this, id2);
|
|
40385
|
+
}
|
|
40386
|
+
this.nodes.push({ kind: "step", stepId: id2, hasCompensation: false });
|
|
40387
|
+
return Promise.resolve(void 0);
|
|
40388
|
+
}
|
|
40389
|
+
async sleep(durationMs, options) {
|
|
40390
|
+
this.nodes.push({
|
|
40391
|
+
kind: "sleep",
|
|
40392
|
+
durationMs,
|
|
40393
|
+
stepId: options?.stepId
|
|
40394
|
+
});
|
|
40395
|
+
}
|
|
40396
|
+
async waitForSignal(signal, options) {
|
|
40397
|
+
this.nodes.push({
|
|
40398
|
+
kind: "waitForSignal",
|
|
40399
|
+
signalId: signal.id,
|
|
40400
|
+
timeoutMs: options?.timeoutMs,
|
|
40401
|
+
stepId: options?.stepId
|
|
40402
|
+
});
|
|
40403
|
+
return void 0;
|
|
40404
|
+
}
|
|
40405
|
+
async emit(_event, _payload, options) {
|
|
40406
|
+
this.nodes.push({
|
|
40407
|
+
kind: "emit",
|
|
40408
|
+
eventId: _event.id,
|
|
40409
|
+
stepId: options?.stepId
|
|
40410
|
+
});
|
|
40411
|
+
}
|
|
40412
|
+
async switch(stepId, _value, branches, defaultBranch) {
|
|
40413
|
+
this.nodes.push({
|
|
40414
|
+
kind: "switch",
|
|
40415
|
+
stepId,
|
|
40416
|
+
branchIds: branches.map((b) => b.id),
|
|
40417
|
+
hasDefault: defaultBranch !== void 0
|
|
40418
|
+
});
|
|
40419
|
+
return void 0;
|
|
40420
|
+
}
|
|
40421
|
+
async note(message, _meta) {
|
|
40422
|
+
this.nodes.push({ kind: "note", message });
|
|
40423
|
+
}
|
|
40424
|
+
async rollback() {
|
|
40425
|
+
}
|
|
40426
|
+
};
|
|
40427
|
+
var FlowStepRecorder = class {
|
|
40428
|
+
constructor(recorder, stepId) {
|
|
40429
|
+
this.recorder = recorder;
|
|
40430
|
+
this.stepId = stepId;
|
|
40431
|
+
this.hasDown = false;
|
|
40432
|
+
}
|
|
40433
|
+
static {
|
|
40434
|
+
__name(this, "FlowStepRecorder");
|
|
40435
|
+
}
|
|
40436
|
+
up(_fn) {
|
|
40437
|
+
return this;
|
|
40438
|
+
}
|
|
40439
|
+
down(_fn) {
|
|
40440
|
+
this.hasDown = true;
|
|
40441
|
+
return this;
|
|
40442
|
+
}
|
|
40443
|
+
then(onfulfilled, onrejected) {
|
|
40444
|
+
this.recorder.nodes.push({
|
|
40445
|
+
kind: "step",
|
|
40446
|
+
stepId: this.stepId,
|
|
40447
|
+
hasCompensation: this.hasDown
|
|
40448
|
+
});
|
|
40449
|
+
const result = Promise.resolve(void 0);
|
|
40450
|
+
return result.then(
|
|
40451
|
+
onfulfilled ?? ((v) => v),
|
|
40452
|
+
onrejected
|
|
40453
|
+
);
|
|
40454
|
+
}
|
|
40455
|
+
};
|
|
40456
|
+
async function recordFlowShape(descriptor) {
|
|
40457
|
+
const recorder = new FlowRecorder();
|
|
40458
|
+
await descriptor(recorder);
|
|
40459
|
+
return { nodes: recorder.nodes };
|
|
40460
|
+
}
|
|
40461
|
+
__name(recordFlowShape, "recordFlowShape");
|
|
40462
|
+
|
|
39727
40463
|
// src/node/durable/core/DurableResource.ts
|
|
39728
|
-
var DurableResource = class {
|
|
39729
|
-
constructor(service, contextStorage) {
|
|
40464
|
+
var DurableResource = class _DurableResource {
|
|
40465
|
+
constructor(service, contextStorage, store2, runnerStore) {
|
|
39730
40466
|
this.service = service;
|
|
39731
40467
|
this.contextStorage = contextStorage;
|
|
40468
|
+
this.store = store2;
|
|
40469
|
+
this.runnerStore = runnerStore;
|
|
40470
|
+
this.operatorInstance = null;
|
|
39732
40471
|
}
|
|
39733
40472
|
static {
|
|
39734
40473
|
__name(this, "DurableResource");
|
|
39735
40474
|
}
|
|
40475
|
+
get operator() {
|
|
40476
|
+
if (!this.store) {
|
|
40477
|
+
throw new Error(
|
|
40478
|
+
"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."
|
|
40479
|
+
);
|
|
40480
|
+
}
|
|
40481
|
+
if (!this.operatorInstance) {
|
|
40482
|
+
this.operatorInstance = new DurableOperator(this.store);
|
|
40483
|
+
}
|
|
40484
|
+
return this.operatorInstance;
|
|
40485
|
+
}
|
|
39736
40486
|
use() {
|
|
39737
40487
|
const ctx = this.contextStorage.getStore();
|
|
39738
40488
|
if (!ctx) {
|
|
@@ -39742,6 +40492,47 @@ var DurableResource = class {
|
|
|
39742
40492
|
}
|
|
39743
40493
|
return ctx;
|
|
39744
40494
|
}
|
|
40495
|
+
async describe(task2, input) {
|
|
40496
|
+
if (!this.runnerStore) {
|
|
40497
|
+
throw new Error(
|
|
40498
|
+
"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."
|
|
40499
|
+
);
|
|
40500
|
+
}
|
|
40501
|
+
const storeTask = this.runnerStore.tasks.get(task2.id);
|
|
40502
|
+
if (!storeTask) {
|
|
40503
|
+
throw new Error(
|
|
40504
|
+
`Cannot describe task "${task2.id}": task is not registered in the runtime store.`
|
|
40505
|
+
);
|
|
40506
|
+
}
|
|
40507
|
+
const effectiveTask = storeTask.task;
|
|
40508
|
+
if (!storeTask.computedDependencies) {
|
|
40509
|
+
throw new Error(
|
|
40510
|
+
`Cannot describe task "${task2.id}": task dependencies are not available in the runtime store.`
|
|
40511
|
+
);
|
|
40512
|
+
}
|
|
40513
|
+
const deps = storeTask.computedDependencies;
|
|
40514
|
+
return await recordFlowShape(async (ctx) => {
|
|
40515
|
+
const depsWithRecorder = this.injectRecorderIntoDurableDeps(deps, ctx);
|
|
40516
|
+
await effectiveTask.run(input, depsWithRecorder);
|
|
40517
|
+
});
|
|
40518
|
+
}
|
|
40519
|
+
injectRecorderIntoDurableDeps(deps, ctx) {
|
|
40520
|
+
const next = { ...deps };
|
|
40521
|
+
for (const [key, value] of Object.entries(deps)) {
|
|
40522
|
+
if (!(value instanceof _DurableResource)) {
|
|
40523
|
+
continue;
|
|
40524
|
+
}
|
|
40525
|
+
next[key] = new Proxy(value, {
|
|
40526
|
+
get(target, prop, receiver) {
|
|
40527
|
+
if (prop === "use") {
|
|
40528
|
+
return () => ctx;
|
|
40529
|
+
}
|
|
40530
|
+
return Reflect.get(target, prop, receiver);
|
|
40531
|
+
}
|
|
40532
|
+
});
|
|
40533
|
+
}
|
|
40534
|
+
return next;
|
|
40535
|
+
}
|
|
39745
40536
|
startExecution(task2, input, options) {
|
|
39746
40537
|
return this.service.startExecution(task2, input, options);
|
|
39747
40538
|
}
|
|
@@ -40437,7 +41228,7 @@ var ScheduleManager = class {
|
|
|
40437
41228
|
// src/node/durable/core/managers/SignalHandler.ts
|
|
40438
41229
|
var isWaitingSignalStep = /* @__PURE__ */ __name((step) => {
|
|
40439
41230
|
const result = step.result;
|
|
40440
|
-
if (!
|
|
41231
|
+
if (!isRecord3(result)) return false;
|
|
40441
41232
|
const waitResult = result;
|
|
40442
41233
|
if (waitResult.state !== "waiting") return false;
|
|
40443
41234
|
if (typeof waitResult.signalId !== "string") return false;
|
|
@@ -40914,7 +41705,7 @@ function getSignalId(signal) {
|
|
|
40914
41705
|
}
|
|
40915
41706
|
__name(getSignalId, "getSignalId");
|
|
40916
41707
|
function parseSignalStepState(value) {
|
|
40917
|
-
if (!
|
|
41708
|
+
if (!isRecord3(value)) return null;
|
|
40918
41709
|
const state = value.state;
|
|
40919
41710
|
if (state === "waiting") {
|
|
40920
41711
|
const signalId = value.signalId;
|
|
@@ -41110,6 +41901,58 @@ async function waitForSignalDurably(params) {
|
|
|
41110
41901
|
}
|
|
41111
41902
|
__name(waitForSignalDurably, "waitForSignalDurably");
|
|
41112
41903
|
|
|
41904
|
+
// src/node/durable/core/durable-context/DurableContext.switch.ts
|
|
41905
|
+
async function switchDurably(params) {
|
|
41906
|
+
await params.assertNotCancelled();
|
|
41907
|
+
params.assertUniqueStepId(params.stepId);
|
|
41908
|
+
const cached = await params.store.getStepResult(
|
|
41909
|
+
params.executionId,
|
|
41910
|
+
params.stepId
|
|
41911
|
+
);
|
|
41912
|
+
if (cached) {
|
|
41913
|
+
const persisted = cached.result;
|
|
41914
|
+
return persisted.result;
|
|
41915
|
+
}
|
|
41916
|
+
const startedAt = Date.now();
|
|
41917
|
+
let matchedBranch = null;
|
|
41918
|
+
for (const branch of params.branches) {
|
|
41919
|
+
if (branch.match(params.value)) {
|
|
41920
|
+
matchedBranch = { id: branch.id, run: branch.run };
|
|
41921
|
+
break;
|
|
41922
|
+
}
|
|
41923
|
+
}
|
|
41924
|
+
if (!matchedBranch && params.defaultBranch) {
|
|
41925
|
+
matchedBranch = {
|
|
41926
|
+
id: params.defaultBranch.id,
|
|
41927
|
+
run: params.defaultBranch.run
|
|
41928
|
+
};
|
|
41929
|
+
}
|
|
41930
|
+
if (!matchedBranch) {
|
|
41931
|
+
throw new Error(
|
|
41932
|
+
`Durable switch '${params.stepId}': no branch matched and no default provided`
|
|
41933
|
+
);
|
|
41934
|
+
}
|
|
41935
|
+
const result = await matchedBranch.run(params.value);
|
|
41936
|
+
const durationMs = Date.now() - startedAt;
|
|
41937
|
+
await params.store.saveStepResult({
|
|
41938
|
+
executionId: params.executionId,
|
|
41939
|
+
stepId: params.stepId,
|
|
41940
|
+
result: {
|
|
41941
|
+
branchId: matchedBranch.id,
|
|
41942
|
+
result
|
|
41943
|
+
},
|
|
41944
|
+
completedAt: /* @__PURE__ */ new Date()
|
|
41945
|
+
});
|
|
41946
|
+
await params.appendAuditEntry({
|
|
41947
|
+
kind: DurableAuditEntryKind.SwitchEvaluated,
|
|
41948
|
+
stepId: params.stepId,
|
|
41949
|
+
branchId: matchedBranch.id,
|
|
41950
|
+
durationMs
|
|
41951
|
+
});
|
|
41952
|
+
return result;
|
|
41953
|
+
}
|
|
41954
|
+
__name(switchDurably, "switchDurably");
|
|
41955
|
+
|
|
41113
41956
|
// src/node/durable/core/DurableContext.ts
|
|
41114
41957
|
var DurableContext = class {
|
|
41115
41958
|
constructor(store2, bus, executionId, attempt, options = {}) {
|
|
@@ -41230,6 +42073,20 @@ var DurableContext = class {
|
|
|
41230
42073
|
options
|
|
41231
42074
|
});
|
|
41232
42075
|
}
|
|
42076
|
+
async switch(stepId, value, branches, defaultBranch) {
|
|
42077
|
+
this.determinism.assertUserStepId(stepId);
|
|
42078
|
+
return await switchDurably({
|
|
42079
|
+
store: this.store,
|
|
42080
|
+
executionId: this.executionId,
|
|
42081
|
+
assertNotCancelled: this.assertNotCancelled.bind(this),
|
|
42082
|
+
appendAuditEntry: this.audit.append,
|
|
42083
|
+
assertUniqueStepId: this.determinism.assertUniqueStepId,
|
|
42084
|
+
stepId,
|
|
42085
|
+
value,
|
|
42086
|
+
branches,
|
|
42087
|
+
defaultBranch
|
|
42088
|
+
});
|
|
42089
|
+
}
|
|
41233
42090
|
async note(message, meta) {
|
|
41234
42091
|
if (!this.audit.isEnabled()) return;
|
|
41235
42092
|
const stepId = `__note:${this.noteIndex}`;
|
|
@@ -42043,13 +42900,11 @@ async function initDurableWorker(service, queue) {
|
|
|
42043
42900
|
}
|
|
42044
42901
|
__name(initDurableWorker, "initDurableWorker");
|
|
42045
42902
|
|
|
42046
|
-
// src/node/durable/core/
|
|
42047
|
-
|
|
42048
|
-
|
|
42049
|
-
|
|
42050
|
-
|
|
42051
|
-
}).init(async (config, { taskRunner, eventManager, runnerStore }) => {
|
|
42052
|
-
const runnerEmitter = createDurableRunnerAuditEmitter({ eventManager });
|
|
42903
|
+
// src/node/durable/core/createRunnerDurableRuntime.ts
|
|
42904
|
+
async function createRunnerDurableRuntime(config, deps) {
|
|
42905
|
+
const runnerEmitter = createDurableRunnerAuditEmitter({
|
|
42906
|
+
eventManager: deps.eventManager
|
|
42907
|
+
});
|
|
42053
42908
|
const userEmitter = config.audit?.emitter;
|
|
42054
42909
|
const auditEmitter = userEmitter ? {
|
|
42055
42910
|
emit: /* @__PURE__ */ __name(async (entry) => {
|
|
@@ -42072,7 +42927,10 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42072
42927
|
},
|
|
42073
42928
|
taskExecutor: {
|
|
42074
42929
|
run: /* @__PURE__ */ __name(async (task2, input) => {
|
|
42075
|
-
const outputPromise = await taskRunner.run(
|
|
42930
|
+
const outputPromise = await deps.taskRunner.run(
|
|
42931
|
+
task2,
|
|
42932
|
+
input
|
|
42933
|
+
);
|
|
42076
42934
|
if (outputPromise === void 0) {
|
|
42077
42935
|
throw new Error(
|
|
42078
42936
|
`Durable task '${task2.id}' completed without a result promise.`
|
|
@@ -42082,7 +42940,7 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42082
42940
|
}, "run")
|
|
42083
42941
|
},
|
|
42084
42942
|
taskResolver: /* @__PURE__ */ __name((taskId) => {
|
|
42085
|
-
const storeTask = runnerStore.tasks.get(taskId);
|
|
42943
|
+
const storeTask = deps.runnerStore.tasks.get(taskId);
|
|
42086
42944
|
return storeTask?.task;
|
|
42087
42945
|
}, "taskResolver"),
|
|
42088
42946
|
contextProvider: /* @__PURE__ */ __name((ctx, fn) => contextStorage.run(ctx, fn), "contextProvider")
|
|
@@ -42090,81 +42948,30 @@ var durableResource = r.resource("base.durable").register(durableEventsArray).de
|
|
|
42090
42948
|
if (config.worker === true && config.queue) {
|
|
42091
42949
|
await initDurableWorker(service, config.queue);
|
|
42092
42950
|
}
|
|
42093
|
-
return new DurableResource(
|
|
42951
|
+
return new DurableResource(
|
|
42952
|
+
service,
|
|
42953
|
+
contextStorage,
|
|
42954
|
+
config.store,
|
|
42955
|
+
deps.runnerStore
|
|
42956
|
+
);
|
|
42957
|
+
}
|
|
42958
|
+
__name(createRunnerDurableRuntime, "createRunnerDurableRuntime");
|
|
42959
|
+
|
|
42960
|
+
// src/node/durable/core/resource.ts
|
|
42961
|
+
var durableResource = r.resource("base.durable").register(durableEventsArray).dependencies({
|
|
42962
|
+
taskRunner: globals.resources.taskRunner,
|
|
42963
|
+
eventManager: globals.resources.eventManager,
|
|
42964
|
+
runnerStore: globals.resources.store
|
|
42965
|
+
}).init(async (config, { taskRunner, eventManager, runnerStore }) => {
|
|
42966
|
+
return await createRunnerDurableRuntime(config, {
|
|
42967
|
+
taskRunner,
|
|
42968
|
+
eventManager,
|
|
42969
|
+
runnerStore
|
|
42970
|
+
});
|
|
42094
42971
|
}).dispose(
|
|
42095
42972
|
async (durable, config) => disposeDurableService(durable.service, config)
|
|
42096
42973
|
).build();
|
|
42097
42974
|
|
|
42098
|
-
// src/node/durable/core/DurableOperator.ts
|
|
42099
|
-
var DurableOperator = class {
|
|
42100
|
-
constructor(store2) {
|
|
42101
|
-
this.store = store2;
|
|
42102
|
-
}
|
|
42103
|
-
static {
|
|
42104
|
-
__name(this, "DurableOperator");
|
|
42105
|
-
}
|
|
42106
|
-
async listExecutions(options) {
|
|
42107
|
-
if (this.store.listExecutions) {
|
|
42108
|
-
return await this.store.listExecutions(options);
|
|
42109
|
-
}
|
|
42110
|
-
return await this.store.listIncompleteExecutions();
|
|
42111
|
-
}
|
|
42112
|
-
async getExecutionDetail(executionId) {
|
|
42113
|
-
const execution = await this.store.getExecution(executionId);
|
|
42114
|
-
const steps = this.store.listStepResults ? await this.store.listStepResults(executionId) : [];
|
|
42115
|
-
const audit = this.store.listAuditEntries ? await this.store.listAuditEntries(executionId) : [];
|
|
42116
|
-
return { execution, steps, audit };
|
|
42117
|
-
}
|
|
42118
|
-
/**
|
|
42119
|
-
* Resets an execution from `compensation_failed` (or other states) to `pending`.
|
|
42120
|
-
* This effectively retries the workflow from the last memoized step.
|
|
42121
|
-
*/
|
|
42122
|
-
async retryRollback(executionId) {
|
|
42123
|
-
if (!this.store.retryRollback) {
|
|
42124
|
-
throw new Error("Store does not support retryRollback");
|
|
42125
|
-
}
|
|
42126
|
-
await this.store.retryRollback(executionId);
|
|
42127
|
-
}
|
|
42128
|
-
/**
|
|
42129
|
-
* Manually marks a step as completed with a specific result.
|
|
42130
|
-
* Useful for skipping broken steps or providing a manual fix.
|
|
42131
|
-
*/
|
|
42132
|
-
async skipStep(executionId, stepId) {
|
|
42133
|
-
if (!this.store.skipStep) {
|
|
42134
|
-
throw new Error("Store does not support skipStep");
|
|
42135
|
-
}
|
|
42136
|
-
await this.store.skipStep(executionId, stepId);
|
|
42137
|
-
}
|
|
42138
|
-
/**
|
|
42139
|
-
* Forces an execution to the `failed` state.
|
|
42140
|
-
*/
|
|
42141
|
-
async forceFail(executionId, reason) {
|
|
42142
|
-
if (!this.store.forceFail) {
|
|
42143
|
-
throw new Error("Store does not support forceFail");
|
|
42144
|
-
}
|
|
42145
|
-
await this.store.forceFail(executionId, { message: reason });
|
|
42146
|
-
}
|
|
42147
|
-
/**
|
|
42148
|
-
* Manually patches the result of a step.
|
|
42149
|
-
* Useful when a step failed to save its result but the side effect occurred.
|
|
42150
|
-
*/
|
|
42151
|
-
async editState(executionId, stepId, newState) {
|
|
42152
|
-
if (!this.store.editStepResult) {
|
|
42153
|
-
throw new Error("Store does not support editStepResult");
|
|
42154
|
-
}
|
|
42155
|
-
await this.store.editStepResult(executionId, stepId, newState);
|
|
42156
|
-
}
|
|
42157
|
-
/**
|
|
42158
|
-
* Lists all executions that require manual intervention.
|
|
42159
|
-
*/
|
|
42160
|
-
async listStuckExecutions() {
|
|
42161
|
-
if (!this.store.listStuckExecutions) {
|
|
42162
|
-
throw new Error("Store does not support listStuckExecutions");
|
|
42163
|
-
}
|
|
42164
|
-
return await this.store.listStuckExecutions();
|
|
42165
|
-
}
|
|
42166
|
-
};
|
|
42167
|
-
|
|
42168
42975
|
// src/node/durable/dashboard/server.ts
|
|
42169
42976
|
var express = __toESM(require_express2());
|
|
42170
42977
|
function findUp(startDir, filename) {
|
|
@@ -42548,7 +43355,7 @@ function createIORedisClient(url) {
|
|
|
42548
43355
|
__name(createIORedisClient, "createIORedisClient");
|
|
42549
43356
|
|
|
42550
43357
|
// src/node/durable/store/RedisStore.ts
|
|
42551
|
-
var serializer2 =
|
|
43358
|
+
var serializer2 = new Serializer();
|
|
42552
43359
|
var RedisStore = class {
|
|
42553
43360
|
static {
|
|
42554
43361
|
__name(this, "RedisStore");
|
|
@@ -43292,6 +44099,114 @@ async function waitUntil(predicate, options) {
|
|
|
43292
44099
|
}
|
|
43293
44100
|
__name(waitUntil, "waitUntil");
|
|
43294
44101
|
|
|
44102
|
+
// src/node/durable/resources/memoryDurableResource.ts
|
|
44103
|
+
var memoryDurableResource = r.resource("base.durable.memory").register(durableEventsArray).dependencies({
|
|
44104
|
+
taskRunner: globals.resources.taskRunner,
|
|
44105
|
+
eventManager: globals.resources.eventManager,
|
|
44106
|
+
runnerStore: globals.resources.store
|
|
44107
|
+
}).context(() => ({ runtimeConfig: null })).init(async function(config, { taskRunner, eventManager, runnerStore }, ctx) {
|
|
44108
|
+
config.namespace ?? this.id;
|
|
44109
|
+
const shouldCreateQueue = config.queue?.enabled ?? config.worker === true;
|
|
44110
|
+
const queue = shouldCreateQueue ? new MemoryQueue() : void 0;
|
|
44111
|
+
const worker = config.worker ?? Boolean(queue);
|
|
44112
|
+
const runtimeConfig = {
|
|
44113
|
+
...config,
|
|
44114
|
+
worker,
|
|
44115
|
+
store: new MemoryStore(),
|
|
44116
|
+
eventBus: new MemoryEventBus(),
|
|
44117
|
+
queue
|
|
44118
|
+
};
|
|
44119
|
+
ctx.runtimeConfig = runtimeConfig;
|
|
44120
|
+
return await createRunnerDurableRuntime(runtimeConfig, {
|
|
44121
|
+
taskRunner,
|
|
44122
|
+
eventManager,
|
|
44123
|
+
runnerStore
|
|
44124
|
+
});
|
|
44125
|
+
}).dispose(async (durable, _config, _deps, ctx) => {
|
|
44126
|
+
if (!ctx.runtimeConfig) return;
|
|
44127
|
+
await disposeDurableService(durable.service, ctx.runtimeConfig);
|
|
44128
|
+
}).build();
|
|
44129
|
+
|
|
44130
|
+
// src/node/durable/resources/isolation.ts
|
|
44131
|
+
function normalizePrefix(prefix) {
|
|
44132
|
+
return prefix.endsWith(":") ? prefix : `${prefix}:`;
|
|
44133
|
+
}
|
|
44134
|
+
__name(normalizePrefix, "normalizePrefix");
|
|
44135
|
+
function deriveDurableIsolation(params) {
|
|
44136
|
+
if (params.namespace.trim().length === 0) {
|
|
44137
|
+
validationError.throw({
|
|
44138
|
+
subject: "Durable isolation namespace",
|
|
44139
|
+
id: "params.namespace",
|
|
44140
|
+
originalError: "must be a non-empty string"
|
|
44141
|
+
});
|
|
44142
|
+
}
|
|
44143
|
+
const encodedNamespace = encodeURIComponent(params.namespace);
|
|
44144
|
+
const storePrefix = normalizePrefix(
|
|
44145
|
+
params.storePrefix ?? `durable:${encodedNamespace}:`
|
|
44146
|
+
);
|
|
44147
|
+
const busPrefix = normalizePrefix(
|
|
44148
|
+
params.busPrefix ?? `durable:bus:${encodedNamespace}:`
|
|
44149
|
+
);
|
|
44150
|
+
return {
|
|
44151
|
+
namespace: params.namespace,
|
|
44152
|
+
encodedNamespace,
|
|
44153
|
+
storePrefix,
|
|
44154
|
+
busPrefix,
|
|
44155
|
+
queueName: params.queueName ?? `durable_executions:${encodedNamespace}`,
|
|
44156
|
+
deadLetterQueueName: params.deadLetterQueueName ?? `durable_executions:dlq:${encodedNamespace}`
|
|
44157
|
+
};
|
|
44158
|
+
}
|
|
44159
|
+
__name(deriveDurableIsolation, "deriveDurableIsolation");
|
|
44160
|
+
|
|
44161
|
+
// src/node/durable/resources/redisDurableResource.ts
|
|
44162
|
+
var redisDurableResource = r.resource("base.durable.redis").register(durableEventsArray).dependencies({
|
|
44163
|
+
taskRunner: globals.resources.taskRunner,
|
|
44164
|
+
eventManager: globals.resources.eventManager,
|
|
44165
|
+
runnerStore: globals.resources.store
|
|
44166
|
+
}).context(() => ({ runtimeConfig: null })).init(async function(config, { taskRunner, eventManager, runnerStore }, ctx) {
|
|
44167
|
+
const namespace = config.namespace ?? this.id;
|
|
44168
|
+
const isolation = deriveDurableIsolation({
|
|
44169
|
+
namespace,
|
|
44170
|
+
storePrefix: config.store?.prefix,
|
|
44171
|
+
busPrefix: config.eventBus?.prefix,
|
|
44172
|
+
queueName: config.queue?.name,
|
|
44173
|
+
deadLetterQueueName: config.queue?.deadLetter
|
|
44174
|
+
});
|
|
44175
|
+
const queue = config.queue ? new RabbitMQQueue({
|
|
44176
|
+
url: config.queue.url,
|
|
44177
|
+
prefetch: config.queue.prefetch,
|
|
44178
|
+
queue: {
|
|
44179
|
+
name: isolation.queueName,
|
|
44180
|
+
quorum: config.queue.quorum,
|
|
44181
|
+
deadLetter: isolation.deadLetterQueueName,
|
|
44182
|
+
messageTtl: config.queue.messageTtl
|
|
44183
|
+
}
|
|
44184
|
+
}) : void 0;
|
|
44185
|
+
const worker = config.worker ?? Boolean(queue);
|
|
44186
|
+
const runtimeConfig = {
|
|
44187
|
+
...config,
|
|
44188
|
+
worker,
|
|
44189
|
+
store: new RedisStore({
|
|
44190
|
+
redis: config.redis.url,
|
|
44191
|
+
prefix: isolation.storePrefix
|
|
44192
|
+
}),
|
|
44193
|
+
eventBus: new RedisEventBus({
|
|
44194
|
+
redis: config.redis.url,
|
|
44195
|
+
prefix: isolation.busPrefix
|
|
44196
|
+
}),
|
|
44197
|
+
queue
|
|
44198
|
+
};
|
|
44199
|
+
ctx.runtimeConfig = runtimeConfig;
|
|
44200
|
+
return await createRunnerDurableRuntime(runtimeConfig, {
|
|
44201
|
+
taskRunner,
|
|
44202
|
+
eventManager,
|
|
44203
|
+
runnerStore
|
|
44204
|
+
});
|
|
44205
|
+
}).dispose(async (durable, _config, _deps, ctx) => {
|
|
44206
|
+
if (!ctx.runtimeConfig) return;
|
|
44207
|
+
await disposeDurableService(durable.service, ctx.runtimeConfig);
|
|
44208
|
+
}).build();
|
|
44209
|
+
|
|
43295
44210
|
// src/node/node.ts
|
|
43296
44211
|
var globals2 = {
|
|
43297
44212
|
...globals,
|
|
@@ -43633,6 +44548,7 @@ exports.DurableWorker = DurableWorker;
|
|
|
43633
44548
|
exports.Errors = errors_exports;
|
|
43634
44549
|
exports.EventManager = EventManager;
|
|
43635
44550
|
exports.ExecutionStatus = ExecutionStatus;
|
|
44551
|
+
exports.LogPrinter = LogPrinter;
|
|
43636
44552
|
exports.Logger = Logger;
|
|
43637
44553
|
exports.MemoryEventBus = MemoryEventBus;
|
|
43638
44554
|
exports.MemoryQueue = MemoryQueue;
|
|
@@ -43653,6 +44569,8 @@ exports.Serializer = Serializer;
|
|
|
43653
44569
|
exports.StepBuilder = StepBuilder;
|
|
43654
44570
|
exports.Store = Store;
|
|
43655
44571
|
exports.SuspensionSignal = SuspensionSignal;
|
|
44572
|
+
exports.SymbolPolicy = SymbolPolicy;
|
|
44573
|
+
exports.SymbolPolicyErrorMessage = SymbolPolicyErrorMessage;
|
|
43656
44574
|
exports.TaskRunner = TaskRunner;
|
|
43657
44575
|
exports.TimerStatus = TimerStatus;
|
|
43658
44576
|
exports.TimerType = TimerType;
|
|
@@ -43671,6 +44589,7 @@ exports.createHttpClient = createHttpClient;
|
|
|
43671
44589
|
exports.createHttpMixedClient = createHttpMixedClient;
|
|
43672
44590
|
exports.createHttpSmartClient = createHttpSmartClient;
|
|
43673
44591
|
exports.createNodeFile = createNodeFile;
|
|
44592
|
+
exports.createRunnerDurableRuntime = createRunnerDurableRuntime;
|
|
43674
44593
|
exports.createTestResource = createTestResource;
|
|
43675
44594
|
exports.debug = debug;
|
|
43676
44595
|
exports.debugLevels = debugLevels;
|
|
@@ -43681,7 +44600,6 @@ exports.durableEventsArray = durableEventsArray;
|
|
|
43681
44600
|
exports.durableResource = durableResource;
|
|
43682
44601
|
exports.event = defineEvent;
|
|
43683
44602
|
exports.getConfig = getConfig;
|
|
43684
|
-
exports.getDefaultSerializer = getDefaultSerializer;
|
|
43685
44603
|
exports.globals = globals2;
|
|
43686
44604
|
exports.hasExposureContext = hasExposureContext;
|
|
43687
44605
|
exports.hook = defineHook;
|
|
@@ -43691,11 +44609,13 @@ exports.isDurableInternalStepId = isDurableInternalStepId;
|
|
|
43691
44609
|
exports.journal = journal;
|
|
43692
44610
|
exports.levelNormal = levelNormal;
|
|
43693
44611
|
exports.levelVerbose = levelVerbose;
|
|
44612
|
+
exports.memoryDurableResource = memoryDurableResource;
|
|
43694
44613
|
exports.nodeExposure = nodeExposure;
|
|
43695
44614
|
exports.normalizeError = normalizeError;
|
|
43696
44615
|
exports.override = defineOverride;
|
|
43697
44616
|
exports.r = r;
|
|
43698
44617
|
exports.readInputFileToBuffer = readInputFileToBuffer;
|
|
44618
|
+
exports.redisDurableResource = redisDurableResource;
|
|
43699
44619
|
exports.resource = defineResource;
|
|
43700
44620
|
exports.resourceMiddleware = defineResourceMiddleware;
|
|
43701
44621
|
exports.run = run2;
|