@bluelibs/runner 5.1.0 → 5.2.1
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 +25 -15
- package/dist/browser/index.cjs +851 -478
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.mjs +849 -478
- package/dist/browser/index.mjs.map +1 -1
- package/dist/edge/index.cjs +851 -478
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +849 -478
- package/dist/edge/index.mjs.map +1 -1
- package/dist/node/node.cjs +1305 -583
- package/dist/node/node.cjs.map +1 -1
- package/dist/node/node.mjs +1299 -583
- 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 +33 -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 +193 -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 +851 -476
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.mjs +849 -476
- package/dist/universal/index.mjs.map +1 -1
- package/package.json +15 -14
- package/readmes/AI.md +30 -9
- package/dist/browser/index.d.mts +0 -2919
- package/dist/browser/index.d.ts +0 -2919
- package/dist/edge/index.d.mts +0 -2919
- package/dist/edge/index.d.ts +0 -2919
- package/dist/node/node.d.mts +0 -4622
- package/dist/node/node.d.ts +0 -4622
- package/dist/universal/index.d.mts +0 -2919
- package/dist/universal/index.d.ts +0 -2919
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DependencyMapType, IResourceMeta, RegisterableItems, ResourceMiddlewareAttachmentType, TagType } from "../../../defs";
|
|
2
|
+
import type { BuilderState, RegisterInput, RegisterState } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Clones and patches the builder state immutably.
|
|
5
|
+
*/
|
|
6
|
+
export declare function clone<TConfig, TValue extends Promise<any>, TDeps extends DependencyMapType, TContext, TMeta extends IResourceMeta, TTags extends TagType[], TMiddleware extends ResourceMiddlewareAttachmentType[], TNextConfig = TConfig, TNextValue extends Promise<any> = TValue, TNextDeps extends DependencyMapType = TDeps, TNextContext = TContext, TNextMeta extends IResourceMeta = TMeta, TNextTags extends TagType[] = TTags, TNextMiddleware extends ResourceMiddlewareAttachmentType[] = TMiddleware>(s: BuilderState<TConfig, TValue, TDeps, TContext, TMeta, TTags, TMiddleware>, patch: Partial<BuilderState<TNextConfig, TNextValue, TNextDeps, TNextContext, TNextMeta, TNextTags, TNextMiddleware>>): BuilderState<TNextConfig, TNextValue, TNextDeps, TNextContext, TNextMeta, TNextTags, TNextMiddleware>;
|
|
7
|
+
/**
|
|
8
|
+
* Normalizes register items to an array.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toRegisterArray(items: RegisterableItems | Array<RegisterableItems>): RegisterableItems[];
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a register function to always return an array.
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeRegisterFunction<TConfig>(fn: (config: TConfig) => RegisterableItems | Array<RegisterableItems>): (config: TConfig) => RegisterableItems[];
|
|
15
|
+
/**
|
|
16
|
+
* Merges register state handling all combinations of arrays and functions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mergeRegister<TConfig>(existing: RegisterState<TConfig>, addition: RegisterInput<TConfig>, override: boolean): RegisterState<TConfig>;
|
|
19
|
+
/**
|
|
20
|
+
* Generic array merge with override support.
|
|
21
|
+
*/
|
|
22
|
+
export declare function mergeArray<T>(existing: ReadonlyArray<T> | undefined, addition: ReadonlyArray<T>, override: boolean): T[];
|
|
23
|
+
/**
|
|
24
|
+
* Merges dependencies handling all combinations of objects and functions.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mergeDependencies<TConfig, TExisting extends DependencyMapType, TNew extends DependencyMapType>(existing: TExisting | ((config: TConfig) => TExisting) | undefined, addition: TNew | ((config: TConfig) => TNew), override: boolean): (TExisting & TNew) | ((config: TConfig) => TExisting & TNew);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./resource/index";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TagFluentBuilder } from "./fluent-builder.interface";
|
|
2
|
+
import type { BuilderState } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a TagFluentBuilder from the given state.
|
|
5
|
+
*/
|
|
6
|
+
export declare function makeTagBuilder<TConfig, TEnforceIn, TEnforceOut>(state: BuilderState<TConfig, TEnforceIn, TEnforceOut>): TagFluentBuilder<TConfig, TEnforceIn, TEnforceOut>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ITag, ITagMeta, IValidationSchema } from "../../../defs";
|
|
2
|
+
export interface TagFluentBuilder<TConfig = void, TEnforceIn = void, TEnforceOut = void> {
|
|
3
|
+
id: string;
|
|
4
|
+
meta<TNewMeta extends ITagMeta>(m: TNewMeta): TagFluentBuilder<TConfig, TEnforceIn, TEnforceOut>;
|
|
5
|
+
configSchema<TNewConfig>(schema: IValidationSchema<TNewConfig>): TagFluentBuilder<TNewConfig, TEnforceIn, TEnforceOut>;
|
|
6
|
+
config<TNewConfig>(config: TNewConfig): TagFluentBuilder<TNewConfig, TEnforceIn, TEnforceOut>;
|
|
7
|
+
build(): ITag<TConfig, TEnforceIn, TEnforceOut>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TagFluentBuilder } from "./fluent-builder.interface";
|
|
2
|
+
export * from "./fluent-builder.interface";
|
|
3
|
+
export * from "./fluent-builder";
|
|
4
|
+
export * from "./types";
|
|
5
|
+
export * from "./utils";
|
|
6
|
+
/**
|
|
7
|
+
* Entry point for creating a tag builder.
|
|
8
|
+
*/
|
|
9
|
+
export declare function tagBuilder<TConfig = void, TEnforceIn = void, TEnforceOut = void>(id: string): TagFluentBuilder<TConfig, TEnforceIn, TEnforceOut>;
|
|
10
|
+
export declare const tag: typeof tagBuilder;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ITagMeta, IValidationSchema } from "../../../defs";
|
|
2
|
+
/**
|
|
3
|
+
* Internal state for the TagFluentBuilder.
|
|
4
|
+
* Kept immutable and frozen.
|
|
5
|
+
*/
|
|
6
|
+
export type BuilderState<TConfig, _TEnforceIn, _TEnforceOut> = Readonly<{
|
|
7
|
+
id: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
meta?: ITagMeta;
|
|
10
|
+
configSchema?: IValidationSchema<any>;
|
|
11
|
+
config?: TConfig;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BuilderState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Clones and patches the builder state immutably.
|
|
4
|
+
*/
|
|
5
|
+
export declare function clone<TConfig, TEnforceIn, TEnforceOut, TNextConfig = TConfig>(s: BuilderState<TConfig, TEnforceIn, TEnforceOut>, patch: Partial<BuilderState<TNextConfig, TEnforceIn, TEnforceOut>>): BuilderState<TNextConfig, TEnforceIn, TEnforceOut>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tag/index";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DependencyMapType, ITaskMeta, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { TaskFluentBuilder } from "./fluent-builder.interface";
|
|
3
|
+
import type { BuilderState } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a TaskFluentBuilder from the given state.
|
|
6
|
+
* Each builder method returns a new builder with updated state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeTaskBuilder<TInput, TOutput extends Promise<any>, TDeps extends DependencyMapType, TMeta extends ITaskMeta, TTags extends TagType[], TMiddleware extends TaskMiddlewareAttachmentType[]>(state: BuilderState<TInput, TOutput, TDeps, TMeta, TTags, TMiddleware>): TaskFluentBuilder<TInput, TOutput, TDeps, TMeta, TTags, TMiddleware>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DependencyMapType, ITask, ITaskDefinition, ITaskMeta, IValidationSchema, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { ThrowsList } from "../../../types/error";
|
|
3
|
+
import type { ResolveInput } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Fluent builder interface for constructing tasks.
|
|
6
|
+
*/
|
|
7
|
+
export interface TaskFluentBuilder<TInput = undefined, TOutput extends Promise<any> = Promise<any>, TDeps extends DependencyMapType = {}, TMeta extends ITaskMeta = ITaskMeta, TTags extends TagType[] = TagType[], TMiddleware extends TaskMiddlewareAttachmentType[] = TaskMiddlewareAttachmentType[]> {
|
|
8
|
+
id: string;
|
|
9
|
+
dependencies<TNewDeps extends DependencyMapType>(deps: TNewDeps | (() => TNewDeps), options?: {
|
|
10
|
+
override?: false;
|
|
11
|
+
}): TaskFluentBuilder<TInput, TOutput, TDeps & TNewDeps, TMeta, TTags, TMiddleware>;
|
|
12
|
+
dependencies<TNewDeps extends DependencyMapType>(deps: TNewDeps | (() => TNewDeps), options: {
|
|
13
|
+
override: true;
|
|
14
|
+
}): TaskFluentBuilder<TInput, TOutput, TNewDeps, TMeta, TTags, TMiddleware>;
|
|
15
|
+
middleware<TNewMw extends TaskMiddlewareAttachmentType[]>(mw: TNewMw, options?: {
|
|
16
|
+
override?: boolean;
|
|
17
|
+
}): TaskFluentBuilder<TInput, TOutput, TDeps, TMeta, TTags, TNewMw>;
|
|
18
|
+
tags<TNewTags extends TagType[]>(t: TNewTags, options?: {
|
|
19
|
+
override?: false;
|
|
20
|
+
}): TaskFluentBuilder<TInput, TOutput, TDeps, TMeta, [
|
|
21
|
+
...TTags,
|
|
22
|
+
...TNewTags
|
|
23
|
+
], TMiddleware>;
|
|
24
|
+
tags<TNewTags extends TagType[]>(t: TNewTags, options: {
|
|
25
|
+
override: true;
|
|
26
|
+
}): TaskFluentBuilder<TInput, TOutput, TDeps, TMeta, TNewTags, TMiddleware>;
|
|
27
|
+
inputSchema<TNewInput>(schema: IValidationSchema<TNewInput>): TaskFluentBuilder<TNewInput, TOutput, TDeps, TMeta, TTags, TMiddleware>;
|
|
28
|
+
resultSchema<TResolved>(schema: IValidationSchema<TResolved>): TaskFluentBuilder<TInput, Promise<TResolved>, TDeps, TMeta, TTags, TMiddleware>;
|
|
29
|
+
run<TNewInput = TInput, TNewOutput extends Promise<any> = TOutput>(fn: NonNullable<ITaskDefinition<ResolveInput<TInput, TNewInput>, TNewOutput, TDeps, TMeta, TTags, TMiddleware>["run"]>): TaskFluentBuilder<ResolveInput<TInput, TNewInput>, TNewOutput, TDeps, TMeta, TTags, TMiddleware>;
|
|
30
|
+
throws(list: ThrowsList): TaskFluentBuilder<TInput, TOutput, TDeps, TMeta, TTags, TMiddleware>;
|
|
31
|
+
meta<TNewMeta extends ITaskMeta>(m: TNewMeta): TaskFluentBuilder<TInput, TOutput, TDeps, TNewMeta, TTags, TMiddleware>;
|
|
32
|
+
build(): ITask<TInput, TOutput, TDeps, TMeta, TTags, TMiddleware>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ITaskMeta, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { TaskFluentBuilder } from "./fluent-builder.interface";
|
|
3
|
+
import type { PhantomTaskFluentBuilder } from "./phantom-builder.interface";
|
|
4
|
+
export * from "./fluent-builder.interface";
|
|
5
|
+
export * from "./fluent-builder";
|
|
6
|
+
export * from "./phantom-builder.interface";
|
|
7
|
+
export * from "./phantom-builder";
|
|
8
|
+
export * from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* Entry point for creating a task builder.
|
|
11
|
+
*/
|
|
12
|
+
export declare function taskBuilder(id: string): TaskFluentBuilder<undefined, Promise<any>, {}, ITaskMeta, TagType[], TaskMiddlewareAttachmentType[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Entry point for creating a phantom task builder.
|
|
15
|
+
*/
|
|
16
|
+
export declare function phantomTaskBuilder<TInput = undefined, TResolved = any>(id: string): PhantomTaskFluentBuilder<TInput, TResolved, {}, ITaskMeta, TagType[], TaskMiddlewareAttachmentType[]>;
|
|
17
|
+
export interface TaskBuilderWithPhantom {
|
|
18
|
+
(id: string): TaskFluentBuilder<undefined, Promise<any>, {}, ITaskMeta, TagType[], TaskMiddlewareAttachmentType[]>;
|
|
19
|
+
phantom: typeof phantomTaskBuilder;
|
|
20
|
+
}
|
|
21
|
+
export declare const task: TaskBuilderWithPhantom;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DependencyMapType, ITaskMeta, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { PhantomTaskFluentBuilder } from "./phantom-builder.interface";
|
|
3
|
+
import type { PhantomBuilderState } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a PhantomTaskFluentBuilder from the given state.
|
|
6
|
+
* Each builder method returns a new builder with updated state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function makePhantomTaskBuilder<TInput, TResolved, TDeps extends DependencyMapType, TMeta extends ITaskMeta, TTags extends TagType[], TMiddleware extends TaskMiddlewareAttachmentType[]>(state: PhantomBuilderState<TInput, TResolved, TDeps, TMeta, TTags, TMiddleware>): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TMeta, TTags, TMiddleware>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DependencyMapType, IPhantomTask, ITaskMeta, IValidationSchema, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { ThrowsList } from "../../../types/error";
|
|
3
|
+
/**
|
|
4
|
+
* Fluent builder interface for constructing phantom tasks.
|
|
5
|
+
*/
|
|
6
|
+
export interface PhantomTaskFluentBuilder<TInput = undefined, TResolved = any, TDeps extends DependencyMapType = {}, TMeta extends ITaskMeta = ITaskMeta, TTags extends TagType[] = TagType[], TMiddleware extends TaskMiddlewareAttachmentType[] = TaskMiddlewareAttachmentType[]> {
|
|
7
|
+
id: string;
|
|
8
|
+
dependencies<TNewDeps extends DependencyMapType>(deps: TNewDeps | (() => TNewDeps), options?: {
|
|
9
|
+
override?: false;
|
|
10
|
+
}): PhantomTaskFluentBuilder<TInput, TResolved, TDeps & TNewDeps, TMeta, TTags, TMiddleware>;
|
|
11
|
+
dependencies<TNewDeps extends DependencyMapType>(deps: TNewDeps | (() => TNewDeps), options: {
|
|
12
|
+
override: true;
|
|
13
|
+
}): PhantomTaskFluentBuilder<TInput, TResolved, TNewDeps, TMeta, TTags, TMiddleware>;
|
|
14
|
+
middleware<TNewMw extends TaskMiddlewareAttachmentType[]>(mw: TNewMw, options?: {
|
|
15
|
+
override?: boolean;
|
|
16
|
+
}): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TMeta, TTags, TNewMw>;
|
|
17
|
+
tags<TNewTags extends TagType[]>(t: TNewTags, options?: {
|
|
18
|
+
override?: false;
|
|
19
|
+
}): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TMeta, [
|
|
20
|
+
...TTags,
|
|
21
|
+
...TNewTags
|
|
22
|
+
], TMiddleware>;
|
|
23
|
+
tags<TNewTags extends TagType[]>(t: TNewTags, options: {
|
|
24
|
+
override: true;
|
|
25
|
+
}): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TMeta, TNewTags, TMiddleware>;
|
|
26
|
+
inputSchema<TNewInput>(schema: IValidationSchema<TNewInput>): PhantomTaskFluentBuilder<TNewInput, TResolved, TDeps, TMeta, TTags, TMiddleware>;
|
|
27
|
+
resultSchema<TNewResolved>(schema: IValidationSchema<TNewResolved>): PhantomTaskFluentBuilder<TInput, TNewResolved, TDeps, TMeta, TTags, TMiddleware>;
|
|
28
|
+
meta<TNewMeta extends ITaskMeta>(m: TNewMeta): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TNewMeta, TTags, TMiddleware>;
|
|
29
|
+
throws(list: ThrowsList): PhantomTaskFluentBuilder<TInput, TResolved, TDeps, TMeta, TTags, TMiddleware>;
|
|
30
|
+
build(): IPhantomTask<TInput, TResolved, TDeps, TMeta, TTags, TMiddleware>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DependencyMapType, ITaskMeta, IValidationSchema, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { ThrowsList } from "../../../types/error";
|
|
3
|
+
export type ShouldReplaceInput<T> = [T] extends [undefined] ? true : [T] extends [void] ? true : 0 extends 1 & T ? true : false;
|
|
4
|
+
export type ResolveInput<TExisting, TProposed> = ShouldReplaceInput<TExisting> extends true ? TProposed : TExisting;
|
|
5
|
+
/**
|
|
6
|
+
* Internal state for the TaskFluentBuilder.
|
|
7
|
+
* Kept immutable and frozen.
|
|
8
|
+
*/
|
|
9
|
+
export type BuilderState<_TInput, _TOutput, TDeps extends DependencyMapType, TMeta extends ITaskMeta, TTags extends TagType[], TMiddleware extends TaskMiddlewareAttachmentType[]> = Readonly<{
|
|
10
|
+
id: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
dependencies?: TDeps | (() => TDeps);
|
|
13
|
+
middleware?: TMiddleware;
|
|
14
|
+
meta?: TMeta;
|
|
15
|
+
inputSchema?: IValidationSchema<any>;
|
|
16
|
+
resultSchema?: IValidationSchema<any>;
|
|
17
|
+
throws?: ThrowsList;
|
|
18
|
+
run?: (input: unknown, dependencies: unknown) => unknown;
|
|
19
|
+
tags?: TTags;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Internal state for the PhantomTaskFluentBuilder.
|
|
23
|
+
*/
|
|
24
|
+
export type PhantomBuilderState<_TInput, _TResolved, TDeps extends DependencyMapType, TMeta extends ITaskMeta, TTags extends TagType[], TMiddleware extends TaskMiddlewareAttachmentType[]> = Readonly<{
|
|
25
|
+
id: string;
|
|
26
|
+
filePath: string;
|
|
27
|
+
dependencies?: TDeps | (() => TDeps);
|
|
28
|
+
middleware?: TMiddleware;
|
|
29
|
+
meta?: TMeta;
|
|
30
|
+
inputSchema?: IValidationSchema<any>;
|
|
31
|
+
resultSchema?: IValidationSchema<any>;
|
|
32
|
+
throws?: ThrowsList;
|
|
33
|
+
tags?: TTags;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DependencyMapType, ITaskMeta, TagType, TaskMiddlewareAttachmentType } from "../../../defs";
|
|
2
|
+
import type { BuilderState } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Clones and patches the builder state immutably.
|
|
5
|
+
*/
|
|
6
|
+
export declare function clone<TInput, TOutput, TDeps extends DependencyMapType, TMeta extends ITaskMeta, TTags extends TagType[], TMiddleware extends TaskMiddlewareAttachmentType[], TNextInput = TInput, TNextOutput = TOutput, TNextDeps extends DependencyMapType = TDeps, TNextMeta extends ITaskMeta = TMeta, TNextTags extends TagType[] = TTags, TNextMiddleware extends TaskMiddlewareAttachmentType[] = TMiddleware>(s: BuilderState<TInput, TOutput, TDeps, TMeta, TTags, TMiddleware>, patch: Partial<BuilderState<TNextInput, TNextOutput, TNextDeps, TNextMeta, TNextTags, TNextMiddleware>>): BuilderState<TNextInput, TNextOutput, TNextDeps, TNextMeta, TNextTags, TNextMiddleware>;
|
|
7
|
+
/**
|
|
8
|
+
* Generic array merge with override support.
|
|
9
|
+
*/
|
|
10
|
+
export declare function mergeArray<T>(existing: ReadonlyArray<T> | undefined, addition: ReadonlyArray<T>, override: boolean): T[];
|
|
11
|
+
/**
|
|
12
|
+
* Merges dependencies handling all combinations of objects and functions.
|
|
13
|
+
*/
|
|
14
|
+
export declare function mergeDependencies<TExisting extends DependencyMapType, TNew extends DependencyMapType>(existing: TExisting | (() => TExisting) | undefined, addition: TNew | (() => TNew), override: boolean): (TExisting & TNew) | (() => TExisting & TNew);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./task/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./task/index";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DependencyMapType } from "../../defs";
|
|
2
|
+
export declare function cloneState<S, NS>(s: S, patch: Partial<NS>): NS;
|
|
3
|
+
export declare function mergeArray<T>(existing: ReadonlyArray<T> | undefined, addition: ReadonlyArray<T>, override: boolean): T[];
|
|
4
|
+
export declare function mergeDepsNoConfig<TExisting extends DependencyMapType, TNew extends DependencyMapType>(existing: TExisting | (() => TExisting) | undefined, addition: TNew | (() => TNew), override: boolean): (TExisting & TNew) | (() => TExisting & TNew);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { contextError } from "../errors";
|
|
2
|
+
import { IAsyncContext, IAsyncContextDefinition } from "../types/asyncContext";
|
|
3
|
+
export { contextError as ContextError };
|
|
4
|
+
export declare const storage: import("..").IAsyncLocalStorage<Map<string, unknown>>;
|
|
5
|
+
/** Returns the currently active store or undefined. */
|
|
6
|
+
export declare function getCurrentStore(): Map<string, unknown> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Create a new typed Context. The result contains helpers similar to React's
|
|
9
|
+
* Context API but adapted for async usage in Runner.
|
|
10
|
+
*/
|
|
11
|
+
export declare function defineAsyncContext<T>(def: IAsyncContextDefinition<T>, filePath?: string): IAsyncContext<T>;
|
|
12
|
+
export type { IAsyncContext } from "../types/asyncContext";
|
|
13
|
+
/** Convenience creator allowing optional name. Used by tests and legacy API. */
|
|
14
|
+
/** @deprecated Use defineAsyncContext instead */
|
|
15
|
+
export declare function createContext<T>(name?: string): IAsyncContext<T>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DefaultErrorType, IErrorDefinition, IErrorHelper, IErrorDefinitionFinal } from "../types/error";
|
|
2
|
+
import { symbolError, symbolFilePath, symbolOptionalDependency } from "../types/symbols";
|
|
3
|
+
declare class RunnerError<TData extends DefaultErrorType = DefaultErrorType> extends Error {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly data: TData;
|
|
6
|
+
constructor(id: string, message: string, data: TData);
|
|
7
|
+
}
|
|
8
|
+
export declare class ErrorHelper<TData extends DefaultErrorType = DefaultErrorType> implements IErrorHelper<TData> {
|
|
9
|
+
private readonly definition;
|
|
10
|
+
[symbolError]: true;
|
|
11
|
+
[symbolFilePath]: string;
|
|
12
|
+
constructor(definition: IErrorDefinitionFinal<TData>, filePath: string);
|
|
13
|
+
get id(): string;
|
|
14
|
+
throw(data: TData): never;
|
|
15
|
+
is(error: unknown): error is RunnerError<TData>;
|
|
16
|
+
optional(): {
|
|
17
|
+
readonly inner: IErrorHelper<TData>;
|
|
18
|
+
readonly [symbolOptionalDependency]: true;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a new error that is going to be used
|
|
23
|
+
* @param definition
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare function defineError<TData extends DefaultErrorType = DefaultErrorType>(definition: IErrorDefinition<TData>, filePath?: string): ErrorHelper<TData>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DependencyMapType, IEventDefinition, ITaskMeta, IHook, IHookDefinition } from "../defs";
|
|
2
|
+
/**
|
|
3
|
+
* Define a hook (event listeners).
|
|
4
|
+
* Same shape as task with mandatory `on` and without `middleware`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineHook<D extends DependencyMapType = any, TOn extends "*" | IEventDefinition<any> | readonly IEventDefinition<any>[] = any, TMeta extends ITaskMeta = any>(hookDef: IHookDefinition<D, TOn, TMeta>): IHook<D, TOn, TMeta>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ITask, IResource, ITaskMiddleware, IResourceMiddleware, IHook } from "../defs";
|
|
2
|
+
/**
|
|
3
|
+
* Override helper that preserves the original `id` and returns the same type.
|
|
4
|
+
* You can override any property except `id`. The override is shallow-merged over the base.
|
|
5
|
+
*
|
|
6
|
+
* @param base - The base definition to override.
|
|
7
|
+
* @param patch - Properties to override (except `id`).
|
|
8
|
+
* @returns A definition of the same kind with overrides applied.
|
|
9
|
+
*/
|
|
10
|
+
type OverridePatch<TBase> = Readonly<TBase extends IHook<any, any, any> ? Omit<Partial<TBase>, "id" | "on"> : Omit<Partial<TBase>, "id">>;
|
|
11
|
+
export declare function defineOverride<TBase extends ITask<any, any, any, any, any, any> | IResource<any, any, any, any, any, any, any> | ITaskMiddleware<any, any, any, any> | IResourceMiddleware<any, any, any, any> | IHook<any, any, any>>(base: TBase, patch: OverridePatch<TBase>): TBase;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { IResource, IResourceDefinition, DependencyMapType, IResourceMeta, TagType, ResourceMiddlewareAttachmentType } from "../types/resource";
|
|
2
|
+
export declare function defineResource<TConfig = void, TValue extends Promise<any> = Promise<any>, TDeps extends DependencyMapType = {}, TPrivate = any, TMeta extends IResourceMeta = any, TTags extends TagType[] = TagType[], TMiddleware extends ResourceMiddlewareAttachmentType[] = ResourceMiddlewareAttachmentType[]>(constConfig: IResourceDefinition<TConfig, TValue, TDeps, TPrivate, any, any, TMeta, TTags, TMiddleware>): IResource<TConfig, TValue, TDeps, TPrivate, TMeta, TTags, TMiddleware>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IResourceMiddleware, IResourceMiddlewareDefinition, DependencyMapType } from "../defs";
|
|
2
|
+
export declare function defineResourceMiddleware<TConfig = any, TEnforceInputContract = void, TEnforceOutputContract = void, TDependencies extends DependencyMapType = any>(middlewareDef: IResourceMiddlewareDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>): IResourceMiddleware<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ITag, ITagDefinition } from "../defs";
|
|
2
|
+
/**
|
|
3
|
+
* Create a tag definition.
|
|
4
|
+
* - `.with(config)` to create configured instances
|
|
5
|
+
* - `.extract(tags)` to extract this tag from a list of tags or a taggable's meta
|
|
6
|
+
*
|
|
7
|
+
* @typeParam TConfig - Configuration type carried by configured tags.
|
|
8
|
+
* @typeParam TEnforceContract - Optional helper type to enforce a contract when tags are used.
|
|
9
|
+
* @param definition - The tag definition (id).
|
|
10
|
+
* @returns A tag object with helpers to configure and extract.
|
|
11
|
+
*/
|
|
12
|
+
export declare function defineTag<TConfig = void, TEnforceInputContract = void, TEnforceOutputContract = void>(definition: ITagDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract>): ITag<TConfig, TEnforceInputContract, TEnforceOutputContract>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ITask, ITaskDefinition, DependencyMapType, ITaskMeta, TagType, TaskMiddlewareAttachmentType, IPhantomTask } from "../types/task";
|
|
2
|
+
/**
|
|
3
|
+
* Define a task.
|
|
4
|
+
* Generates a strongly-typed task object with id, dependencies,
|
|
5
|
+
* middleware, and metadata.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam Input - Input type accepted by the task's `run` function.
|
|
8
|
+
* @typeParam Output - Promise type returned by the `run` function.
|
|
9
|
+
* @typeParam Deps - Dependency map type this task requires.
|
|
10
|
+
* @typeParam TOn - Event type or "*" this task listens to.
|
|
11
|
+
* @typeParam TMeta - Arbitrary metadata type carried by the task.
|
|
12
|
+
* @param taskConfig - The task definition config.
|
|
13
|
+
* @returns A branded task definition usable by the runner.
|
|
14
|
+
*/
|
|
15
|
+
export declare function defineTask<Input = undefined, Output extends Promise<any> = any, Deps extends DependencyMapType = any, TMeta extends ITaskMeta = any, TTags extends TagType[] = TagType[], TMiddleware extends TaskMiddlewareAttachmentType[] = TaskMiddlewareAttachmentType[]>(taskConfig: ITaskDefinition<Input, Output, Deps, TMeta, TTags, TMiddleware>): ITask<Input, Output, Deps, TMeta, TTags, TMiddleware>;
|
|
16
|
+
export declare namespace defineTask {
|
|
17
|
+
var phantom: <Input = undefined, Output extends Promise<any> = any>(taskConfig: Omit<ITaskDefinition<Input, Output, any, any, any, any>, "run">) => IPhantomTask<Input, Output, any, any, any, any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { ITaskMiddleware, ITaskMiddlewareDefinition, DependencyMapType } from "../types/taskMiddleware";
|
|
2
|
+
export declare function defineTaskMiddleware<TConfig = any, TEnforceInputContract = void, TEnforceOutputContract = void, TDependencies extends DependencyMapType = any>(middlewareDef: ITaskMiddlewareDefinition<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>): ITaskMiddleware<TConfig, TEnforceInputContract, TEnforceOutputContract, TDependencies>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeMiddlewareConfig<TConfig>(base: TConfig, next: TConfig): TConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DependencyMapType, RegisterableItems, ResourceForkOptions } from "../types/resource";
|
|
2
|
+
export type ResourceRegisterList = Array<RegisterableItems> | ((config: any) => Array<RegisterableItems>) | undefined;
|
|
3
|
+
type DependenciesList<TConfig, TDeps extends DependencyMapType> = TDeps | ((config: TConfig) => TDeps) | undefined;
|
|
4
|
+
export declare function resolveForkedRegisterAndDependencies<TConfig, TDeps extends DependencyMapType>(params: {
|
|
5
|
+
register: ResourceRegisterList;
|
|
6
|
+
dependencies: DependenciesList<TConfig, TDeps>;
|
|
7
|
+
forkId: string;
|
|
8
|
+
options: ResourceForkOptions | undefined;
|
|
9
|
+
}): {
|
|
10
|
+
register: ResourceRegisterList;
|
|
11
|
+
dependencies: DependenciesList<TConfig, TDeps>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard and utility functions for checking definition types.
|
|
3
|
+
*/
|
|
4
|
+
import { ITask, IResource, IResourceWithConfig, ITaskMiddleware, IResourceMiddleware, IEvent, IHook, IOptionalDependency, ITag, IPhantomTask } from "../defs";
|
|
5
|
+
import { IErrorHelper } from "../types/error";
|
|
6
|
+
import type { IAsyncContext } from "../types/asyncContext";
|
|
7
|
+
/**
|
|
8
|
+
* Type guard: checks if a definition is a Task.
|
|
9
|
+
* @param definition - Any value to test.
|
|
10
|
+
* @returns True when `definition` is a branded Task.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isTask(definition: any): definition is ITask;
|
|
13
|
+
/** Type guard: checks if a definition is a Phantom Task. */
|
|
14
|
+
export declare function isPhantomTask(definition: any): definition is IPhantomTask;
|
|
15
|
+
/**
|
|
16
|
+
* Type guard: checks if a definition is a Resource.
|
|
17
|
+
* @param definition - Any value to test.
|
|
18
|
+
* @returns True when `definition` is a branded Resource.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isResource(definition: any): definition is IResource;
|
|
21
|
+
/**
|
|
22
|
+
* Type guard: checks if a definition is a Resource that carries config via `.with()`.
|
|
23
|
+
* @param definition - Any value to test.
|
|
24
|
+
* @returns True when `definition` is a branded ResourceWithConfig.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isResourceWithConfig(definition: any): definition is IResourceWithConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Type guard: checks if a definition is an Event.
|
|
29
|
+
* @param definition - Any value to test.
|
|
30
|
+
* @returns True when `definition` is a branded Event.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isEvent(definition: any): definition is IEvent;
|
|
33
|
+
/** Type guard: checks if a definition is a Hook. */
|
|
34
|
+
export declare function isHook(definition: any): definition is IHook;
|
|
35
|
+
/**
|
|
36
|
+
* Type guard: checks if a definition is a Middleware.
|
|
37
|
+
* @param definition - Any value to test.
|
|
38
|
+
* @returns True when `definition` is a branded Middleware.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isTaskMiddleware(definition: any): definition is ITaskMiddleware;
|
|
41
|
+
export declare function isResourceMiddleware(definition: any): definition is IResourceMiddleware;
|
|
42
|
+
/**
|
|
43
|
+
* Type guard: checks if a definition is a Tag.
|
|
44
|
+
* @param definition - Any value to test.
|
|
45
|
+
* @returns True when `definition` is a branded Tag.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isTag(definition: any): definition is ITag;
|
|
48
|
+
/** Type guard: checks if a definition is an Optional Dependency wrapper. */
|
|
49
|
+
export declare function isOptional(definition: any): definition is IOptionalDependency<any>;
|
|
50
|
+
/** Type guard: checks if a definition is an Error helper. */
|
|
51
|
+
export declare function isError(definition: any): definition is IErrorHelper<any>;
|
|
52
|
+
/** Type guard: checks if a definition is an Async Context. */
|
|
53
|
+
export declare function isAsyncContext(definition: any): definition is IAsyncContext<any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core public TypeScript types for BlueLibs Runner.
|
|
3
|
+
*
|
|
4
|
+
* This file contains the strongly-typed contract for tasks, resources, events
|
|
5
|
+
* and middleware. It mirrors the mental model described in the README:
|
|
6
|
+
* - Tasks are functions
|
|
7
|
+
* - Resources are singletons (with init/dispose hooks)
|
|
8
|
+
* - Hooks are event listeners without middleware
|
|
9
|
+
* - Events are simple, strongly-typed emissions
|
|
10
|
+
* - Middleware can target both tasks and resources (taskMiddleware, resourceMiddleware)
|
|
11
|
+
*
|
|
12
|
+
* DX goals:
|
|
13
|
+
* - Crystal‑clear generics and helper types that infer dependency shapes
|
|
14
|
+
* - Friendly JSDoc you can hover in editors to understand usage instantly
|
|
15
|
+
* - Safe overrides and strong typing around config and register mechanics
|
|
16
|
+
*/
|
|
17
|
+
export * from "./types/utilities";
|
|
18
|
+
export * from "./types/symbols";
|
|
19
|
+
export * from "./types/tag";
|
|
20
|
+
export * from "./types/hook";
|
|
21
|
+
export * from "./types/resource";
|
|
22
|
+
export * from "./types/event";
|
|
23
|
+
export * from "./types/task";
|
|
24
|
+
export * from "./types/taskMiddleware";
|
|
25
|
+
export * from "./types/resourceMiddleware";
|
|
26
|
+
export * from "./types/meta";
|
|
27
|
+
export * from "./types/runner";
|
|
28
|
+
export * from "./types/asyncContext";
|
|
29
|
+
export * from "./types/error";
|
|
30
|
+
export * from "./types/contracts";
|
|
31
|
+
export * from "./types/inputFile";
|
|
32
|
+
export type { ICacheInstance } from "./globals/middleware/cache.middleware";
|
|
33
|
+
export * from "./types/storeTypes";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { DefaultErrorType } from "./types/error";
|
|
2
|
+
export declare const duplicateRegistrationError: import("./errors").IErrorHelper<{
|
|
3
|
+
type: string;
|
|
4
|
+
id: string;
|
|
5
|
+
} & DefaultErrorType>;
|
|
6
|
+
export declare const dependencyNotFoundError: import("./errors").IErrorHelper<{
|
|
7
|
+
key: string;
|
|
8
|
+
} & DefaultErrorType>;
|
|
9
|
+
export declare const unknownItemTypeError: import("./errors").IErrorHelper<{
|
|
10
|
+
item: unknown;
|
|
11
|
+
} & DefaultErrorType>;
|
|
12
|
+
export declare const contextError: import("./errors").IErrorHelper<{
|
|
13
|
+
details?: string;
|
|
14
|
+
} & DefaultErrorType>;
|
|
15
|
+
export declare const circularDependenciesError: import("./errors").IErrorHelper<{
|
|
16
|
+
cycles: string[];
|
|
17
|
+
} & DefaultErrorType>;
|
|
18
|
+
export declare const eventNotFoundError: import("./errors").IErrorHelper<{
|
|
19
|
+
id: string;
|
|
20
|
+
} & DefaultErrorType>;
|
|
21
|
+
export declare const resourceNotFoundError: import("./errors").IErrorHelper<{
|
|
22
|
+
id: string;
|
|
23
|
+
} & DefaultErrorType>;
|
|
24
|
+
export declare const middlewareNotRegisteredError: import("./errors").IErrorHelper<{
|
|
25
|
+
type: "task" | "resource";
|
|
26
|
+
source: string;
|
|
27
|
+
middlewareId: string;
|
|
28
|
+
} & DefaultErrorType>;
|
|
29
|
+
export declare const tagNotFoundError: import("./errors").IErrorHelper<{
|
|
30
|
+
id: string;
|
|
31
|
+
} & DefaultErrorType>;
|
|
32
|
+
export declare const lockedError: import("./errors").IErrorHelper<{
|
|
33
|
+
what: string;
|
|
34
|
+
} & DefaultErrorType>;
|
|
35
|
+
export declare const storeAlreadyInitializedError: import("./errors").IErrorHelper<DefaultErrorType>;
|
|
36
|
+
export declare const validationError: import("./errors").IErrorHelper<{
|
|
37
|
+
subject: string;
|
|
38
|
+
id: string;
|
|
39
|
+
originalError: string | Error;
|
|
40
|
+
} & DefaultErrorType>;
|
|
41
|
+
export declare const eventCycleError: import("./errors").IErrorHelper<{
|
|
42
|
+
path: Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
source: string;
|
|
45
|
+
}>;
|
|
46
|
+
} & DefaultErrorType>;
|
|
47
|
+
export declare const eventEmissionCycleError: import("./errors").IErrorHelper<{
|
|
48
|
+
cycles: string[];
|
|
49
|
+
} & DefaultErrorType>;
|
|
50
|
+
export declare const platformUnsupportedFunctionError: import("./errors").IErrorHelper<{
|
|
51
|
+
functionName: string;
|
|
52
|
+
} & DefaultErrorType>;
|
|
53
|
+
export declare const cancellationError: import("./errors").IErrorHelper<{
|
|
54
|
+
reason?: string;
|
|
55
|
+
} & DefaultErrorType>;
|
|
56
|
+
export declare const tunnelOwnershipConflictError: import("./errors").IErrorHelper<{
|
|
57
|
+
taskId: string;
|
|
58
|
+
currentOwnerId: string;
|
|
59
|
+
attemptedOwnerId: string;
|
|
60
|
+
} & DefaultErrorType>;
|
|
61
|
+
export declare const phantomTaskNotRoutedError: import("./errors").IErrorHelper<{
|
|
62
|
+
taskId: string;
|
|
63
|
+
} & DefaultErrorType>;
|
|
64
|
+
export declare const taskNotRegisteredError: import("./errors").IErrorHelper<{
|
|
65
|
+
taskId: string;
|
|
66
|
+
} & DefaultErrorType>;
|
|
67
|
+
/** Builder types that require validation before build() */
|
|
68
|
+
export type BuilderType = "hook" | "task-middleware" | "resource-middleware";
|
|
69
|
+
export declare const builderIncompleteError: import("./errors").IErrorHelper<{
|
|
70
|
+
type: BuilderType;
|
|
71
|
+
builderId: string;
|
|
72
|
+
missingFields: string[];
|
|
73
|
+
} & DefaultErrorType>;
|
|
74
|
+
export declare function isCancellationError(err: unknown): boolean;
|
|
75
|
+
export type { IErrorHelper } from "./types/error";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const debugLevels: {
|
|
2
|
+
normal: import("./types").DebugConfig;
|
|
3
|
+
verbose: import("./types").DebugConfig;
|
|
4
|
+
};
|
|
5
|
+
export declare const debug: {
|
|
6
|
+
levels: {
|
|
7
|
+
normal: import("./types").DebugConfig;
|
|
8
|
+
verbose: import("./types").DebugConfig;
|
|
9
|
+
};
|
|
10
|
+
};
|