@velajs/vela 1.18.0 → 1.19.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/CHANGELOG.md +78 -14
- package/dist/configurable-module.builder-5FGMaXG6.js +91 -0
- package/dist/configurable-module.builder-5FGMaXG6.js.map +1 -0
- package/dist/container-BqUHID4l.js +645 -0
- package/dist/container-BqUHID4l.js.map +1 -0
- package/dist/cron-matcher-C9qv5OUA.js +113 -0
- package/dist/cron-matcher-C9qv5OUA.js.map +1 -0
- package/dist/decorate-GcSMAbKn.js +528 -0
- package/dist/decorate-GcSMAbKn.js.map +1 -0
- package/dist/decorators-C8YBFCIk.js +53 -0
- package/dist/decorators-C8YBFCIk.js.map +1 -0
- package/dist/define-module-NOyOZNXD.js +235 -0
- package/dist/define-module-NOyOZNXD.js.map +1 -0
- package/dist/discovery.service-BYm95SSD.js +368 -0
- package/dist/discovery.service-BYm95SSD.js.map +1 -0
- package/dist/discovery.service-Cpf1QcZ5.d.ts +648 -0
- package/dist/i18n/index.d.ts +138 -10
- package/dist/i18n/index.js +270 -8
- package/dist/i18n/index.js.map +1 -0
- package/dist/index-D72EQfcC.d.ts +430 -0
- package/dist/index-DhShDLCM.d.ts +2310 -0
- package/dist/index.d.ts +6 -66
- package/dist/index.js +14 -71
- package/dist/internal.d.ts +13 -17
- package/dist/internal.js +6 -19
- package/dist/live/index.d.ts +2 -12
- package/dist/live/index.js +826 -16
- package/dist/live/index.js.map +1 -0
- package/dist/metadata.registry-D1od8ZBt.d.ts +842 -0
- package/dist/plugin-ByBlVOve.js +1387 -0
- package/dist/plugin-ByBlVOve.js.map +1 -0
- package/dist/queue/index.d.ts +247 -10
- package/dist/queue/index.js +384 -12
- package/dist/queue/index.js.map +1 -0
- package/dist/request-context-C3nCGJNd.js +26 -0
- package/dist/request-context-C3nCGJNd.js.map +1 -0
- package/dist/route.manager-DRAZ5X04.js +991 -0
- package/dist/route.manager-DRAZ5X04.js.map +1 -0
- package/dist/schedule-node/index.d.ts +32 -3
- package/dist/schedule-node/index.js +97 -3
- package/dist/schedule-node/index.js.map +1 -0
- package/dist/schedule.registry-DVm7Jp5w.d.ts +55 -0
- package/dist/seeder/index.d.ts +75 -5
- package/dist/seeder/index.js +105 -4
- package/dist/seeder/index.js.map +1 -0
- package/dist/signed-url-CMmi0SIb.js +56 -0
- package/dist/signed-url-CMmi0SIb.js.map +1 -0
- package/dist/signed-url-DKhgja4U.d.ts +16 -0
- package/dist/src-eb5CI6Xn.js +2151 -0
- package/dist/src-eb5CI6Xn.js.map +1 -0
- package/dist/storage/index.d.ts +57 -4
- package/dist/storage/index.js +22 -5
- package/dist/storage/index.js.map +1 -0
- package/dist/streaming/index.d.ts +2 -2
- package/dist/streaming/index.js +2 -1
- package/dist/websocket/index.d.ts +3 -12
- package/dist/websocket/index.js +2 -16
- package/dist/websocket-DXmB-MWJ.js +697 -0
- package/dist/websocket-DXmB-MWJ.js.map +1 -0
- package/dist/websocket-node/index.d.ts +108 -6
- package/dist/websocket-node/index.js +228 -6
- package/dist/websocket-node/index.js.map +1 -0
- package/package.json +67 -53
- package/dist/__tests__/workers/entry.d.ts +0 -9
- package/dist/__tests__/workers-als/entry-als.d.ts +0 -9
- package/dist/application.d.ts +0 -91
- package/dist/application.js +0 -308
- package/dist/cache/cache.decorators.d.ts +0 -2
- package/dist/cache/cache.decorators.js +0 -4
- package/dist/cache/cache.interceptor.d.ts +0 -9
- package/dist/cache/cache.interceptor.js +0 -60
- package/dist/cache/cache.module.d.ts +0 -7
- package/dist/cache/cache.module.js +0 -58
- package/dist/cache/cache.service.d.ts +0 -9
- package/dist/cache/cache.service.js +0 -42
- package/dist/cache/cache.store.d.ts +0 -12
- package/dist/cache/cache.store.js +0 -51
- package/dist/cache/cache.tokens.d.ts +0 -6
- package/dist/cache/cache.tokens.js +0 -5
- package/dist/cache/cache.types.d.ts +0 -41
- package/dist/cache/cache.types.js +0 -1
- package/dist/cache/index.d.ts +0 -8
- package/dist/cache/index.js +0 -7
- package/dist/cache/tiered-cache.store.d.ts +0 -19
- package/dist/cache/tiered-cache.store.js +0 -40
- package/dist/config/config.module.d.ts +0 -19
- package/dist/config/config.module.js +0 -98
- package/dist/config/config.service.d.ts +0 -20
- package/dist/config/config.service.js +0 -43
- package/dist/config/config.store.d.ts +0 -46
- package/dist/config/config.store.js +0 -119
- package/dist/config/config.tokens.d.ts +0 -13
- package/dist/config/config.tokens.js +0 -14
- package/dist/config/config.types.d.ts +0 -41
- package/dist/config/config.types.js +0 -4
- package/dist/config/index.d.ts +0 -7
- package/dist/config/index.js +0 -5
- package/dist/config/register-as.d.ts +0 -52
- package/dist/config/register-as.js +0 -39
- package/dist/constants.d.ts +0 -44
- package/dist/constants.js +0 -46
- package/dist/container/container.d.ts +0 -154
- package/dist/container/container.js +0 -849
- package/dist/container/decorators.d.ts +0 -17
- package/dist/container/decorators.js +0 -57
- package/dist/container/disposable.d.ts +0 -5
- package/dist/container/disposable.js +0 -33
- package/dist/container/index.d.ts +0 -6
- package/dist/container/index.js +0 -5
- package/dist/container/mixin.d.ts +0 -24
- package/dist/container/mixin.js +0 -26
- package/dist/container/module-ref.d.ts +0 -21
- package/dist/container/module-ref.js +0 -48
- package/dist/container/types.d.ts +0 -154
- package/dist/container/types.js +0 -49
- package/dist/cors/cors.module.d.ts +0 -7
- package/dist/cors/cors.module.js +0 -37
- package/dist/cors/cors.tokens.d.ts +0 -3
- package/dist/cors/cors.tokens.js +0 -2
- package/dist/cors/cors.types.d.ts +0 -8
- package/dist/cors/cors.types.js +0 -1
- package/dist/cors/index.d.ts +0 -3
- package/dist/cors/index.js +0 -2
- package/dist/crypto/signed-url.d.ts +0 -12
- package/dist/crypto/signed-url.js +0 -60
- package/dist/discovery/discoverable.decorator.d.ts +0 -38
- package/dist/discovery/discoverable.decorator.js +0 -42
- package/dist/discovery/discovery.service.d.ts +0 -102
- package/dist/discovery/discovery.service.js +0 -177
- package/dist/discovery/index.d.ts +0 -2
- package/dist/discovery/index.js +0 -2
- package/dist/entrypoint/entrypoint.registry.d.ts +0 -42
- package/dist/entrypoint/entrypoint.registry.js +0 -112
- package/dist/entrypoint/entrypoint.types.d.ts +0 -41
- package/dist/entrypoint/entrypoint.types.js +0 -3
- package/dist/entrypoint/execution-context.d.ts +0 -15
- package/dist/entrypoint/execution-context.js +0 -21
- package/dist/entrypoint/execution-scope.d.ts +0 -21
- package/dist/entrypoint/execution-scope.js +0 -28
- package/dist/entrypoint/index.d.ts +0 -4
- package/dist/entrypoint/index.js +0 -4
- package/dist/errors/http-exception.d.ts +0 -62
- package/dist/errors/http-exception.js +0 -134
- package/dist/errors/index.d.ts +0 -1
- package/dist/errors/index.js +0 -1
- package/dist/event-emitter/event-emitter.decorators.d.ts +0 -1
- package/dist/event-emitter/event-emitter.decorators.js +0 -10
- package/dist/event-emitter/event-emitter.module.d.ts +0 -2
- package/dist/event-emitter/event-emitter.module.js +0 -23
- package/dist/event-emitter/event-emitter.service.d.ts +0 -13
- package/dist/event-emitter/event-emitter.service.js +0 -127
- package/dist/event-emitter/event-emitter.subscriber.d.ts +0 -9
- package/dist/event-emitter/event-emitter.subscriber.js +0 -45
- package/dist/event-emitter/event-emitter.tokens.d.ts +0 -1
- package/dist/event-emitter/event-emitter.tokens.js +0 -1
- package/dist/event-emitter/event-emitter.types.d.ts +0 -5
- package/dist/event-emitter/event-emitter.types.js +0 -1
- package/dist/event-emitter/index.d.ts +0 -6
- package/dist/event-emitter/index.js +0 -5
- package/dist/factory/adapter.d.ts +0 -36
- package/dist/factory/adapter.js +0 -18
- package/dist/factory/bootstrap.d.ts +0 -23
- package/dist/factory/bootstrap.js +0 -108
- package/dist/factory.d.ts +0 -16
- package/dist/factory.js +0 -36
- package/dist/fetch/fetch.module.d.ts +0 -7
- package/dist/fetch/fetch.module.js +0 -31
- package/dist/fetch/fetch.service.d.ts +0 -24
- package/dist/fetch/fetch.service.js +0 -145
- package/dist/fetch/fetch.types.d.ts +0 -24
- package/dist/fetch/fetch.types.js +0 -1
- package/dist/fetch/index.d.ts +0 -3
- package/dist/fetch/index.js +0 -2
- package/dist/health/health.http.d.ts +0 -14
- package/dist/health/health.http.js +0 -75
- package/dist/health/health.indicator.d.ts +0 -9
- package/dist/health/health.indicator.js +0 -32
- package/dist/health/health.module.d.ts +0 -2
- package/dist/health/health.module.js +0 -26
- package/dist/health/health.service.d.ts +0 -7
- package/dist/health/health.service.js +0 -69
- package/dist/health/health.types.d.ts +0 -15
- package/dist/health/health.types.js +0 -1
- package/dist/health/index.d.ts +0 -6
- package/dist/health/index.js +0 -4
- package/dist/http/ambient.d.ts +0 -17
- package/dist/http/ambient.js +0 -44
- package/dist/http/argument-resolver.d.ts +0 -10
- package/dist/http/argument-resolver.js +0 -89
- package/dist/http/decorators.d.ts +0 -198
- package/dist/http/decorators.js +0 -321
- package/dist/http/execution-context.d.ts +0 -8
- package/dist/http/execution-context.js +0 -35
- package/dist/http/handler-executor.d.ts +0 -20
- package/dist/http/handler-executor.js +0 -111
- package/dist/http/index.d.ts +0 -12
- package/dist/http/index.js +0 -7
- package/dist/http/instantiate.d.ts +0 -4
- package/dist/http/instantiate.js +0 -45
- package/dist/http/lazy-param.decorator.d.ts +0 -37
- package/dist/http/lazy-param.decorator.js +0 -117
- package/dist/http/request-container.d.ts +0 -16
- package/dist/http/request-container.js +0 -19
- package/dist/http/request-context.d.ts +0 -13
- package/dist/http/request-context.js +0 -22
- package/dist/http/response-mapper.d.ts +0 -8
- package/dist/http/response-mapper.js +0 -42
- package/dist/http/route-contributor.d.ts +0 -68
- package/dist/http/route-contributor.js +0 -22
- package/dist/http/route-map.d.ts +0 -30
- package/dist/http/route-map.js +0 -27
- package/dist/http/route.manager.d.ts +0 -92
- package/dist/http/route.manager.js +0 -481
- package/dist/http/types.d.ts +0 -37
- package/dist/http/types.js +0 -1
- package/dist/http/url/index.d.ts +0 -4
- package/dist/http/url/index.js +0 -3
- package/dist/http/url/signed-url.guard.d.ts +0 -27
- package/dist/http/url/signed-url.guard.js +0 -62
- package/dist/http/url/signing-secret.d.ts +0 -20
- package/dist/http/url/signing-secret.js +0 -24
- package/dist/http/url/url-generator.service.d.ts +0 -52
- package/dist/http/url/url-generator.service.js +0 -104
- package/dist/i18n/deep-merge.d.ts +0 -2
- package/dist/i18n/deep-merge.js +0 -15
- package/dist/i18n/i18n.middleware.d.ts +0 -15
- package/dist/i18n/i18n.middleware.js +0 -94
- package/dist/i18n/i18n.module.d.ts +0 -13
- package/dist/i18n/i18n.module.js +0 -69
- package/dist/i18n/i18n.options.d.ts +0 -30
- package/dist/i18n/i18n.options.js +0 -16
- package/dist/i18n/i18n.service.d.ts +0 -20
- package/dist/i18n/i18n.service.js +0 -49
- package/dist/i18n/i18n.tokens.d.ts +0 -6
- package/dist/i18n/i18n.tokens.js +0 -3
- package/dist/i18n/i18n.types.d.ts +0 -6
- package/dist/i18n/i18n.types.js +0 -1
- package/dist/i18n/message-loader.service.d.ts +0 -21
- package/dist/i18n/message-loader.service.js +0 -90
- package/dist/i18n/message-registry.d.ts +0 -16
- package/dist/i18n/message-registry.js +0 -49
- package/dist/lifecycle/index.d.ts +0 -20
- package/dist/lifecycle/index.js +0 -15
- package/dist/live/live.cursor.d.ts +0 -22
- package/dist/live/live.cursor.js +0 -56
- package/dist/live/live.decorators.d.ts +0 -32
- package/dist/live/live.decorators.js +0 -46
- package/dist/live/live.delta.d.ts +0 -15
- package/dist/live/live.delta.js +0 -51
- package/dist/live/live.engine.d.ts +0 -81
- package/dist/live/live.engine.js +0 -448
- package/dist/live/live.invalidation.d.ts +0 -45
- package/dist/live/live.invalidation.js +0 -99
- package/dist/live/live.module.d.ts +0 -28
- package/dist/live/live.module.js +0 -87
- package/dist/live/live.tokens.d.ts +0 -9
- package/dist/live/live.tokens.js +0 -8
- package/dist/live/live.types.d.ts +0 -138
- package/dist/live/live.types.js +0 -1
- package/dist/live/presence.d.ts +0 -44
- package/dist/live/presence.js +0 -130
- package/dist/metadata.d.ts +0 -10
- package/dist/metadata.js +0 -20
- package/dist/module/configurable-module.builder.d.ts +0 -56
- package/dist/module/configurable-module.builder.js +0 -84
- package/dist/module/configurable-module.types.d.ts +0 -93
- package/dist/module/configurable-module.types.js +0 -5
- package/dist/module/decorators.d.ts +0 -10
- package/dist/module/decorators.js +0 -47
- package/dist/module/define-module.d.ts +0 -112
- package/dist/module/define-module.js +0 -232
- package/dist/module/graph.d.ts +0 -10
- package/dist/module/graph.js +0 -35
- package/dist/module/index.d.ts +0 -10
- package/dist/module/index.js +0 -7
- package/dist/module/lazy-modules.d.ts +0 -82
- package/dist/module/lazy-modules.js +0 -231
- package/dist/module/lazy-provider.d.ts +0 -65
- package/dist/module/lazy-provider.js +0 -111
- package/dist/module/middleware.d.ts +0 -30
- package/dist/module/middleware.js +0 -67
- package/dist/module/module-loader.d.ts +0 -58
- package/dist/module/module-loader.js +0 -484
- package/dist/module/stable-hash.d.ts +0 -15
- package/dist/module/stable-hash.js +0 -52
- package/dist/module/types.d.ts +0 -1
- package/dist/module/types.js +0 -1
- package/dist/openapi/decorators.d.ts +0 -34
- package/dist/openapi/decorators.js +0 -66
- package/dist/openapi/document.d.ts +0 -3
- package/dist/openapi/document.js +0 -316
- package/dist/openapi/index.d.ts +0 -7
- package/dist/openapi/index.js +0 -6
- package/dist/openapi/redoc-ui.d.ts +0 -1
- package/dist/openapi/redoc-ui.js +0 -19
- package/dist/openapi/scalar-ui.d.ts +0 -1
- package/dist/openapi/scalar-ui.js +0 -19
- package/dist/openapi/swagger-ui.d.ts +0 -1
- package/dist/openapi/swagger-ui.js +0 -23
- package/dist/openapi/types.d.ts +0 -182
- package/dist/openapi/types.js +0 -4
- package/dist/openapi/zod-to-json-schema.d.ts +0 -4
- package/dist/openapi/zod-to-json-schema.js +0 -57
- package/dist/pipeline/app-providers.d.ts +0 -10
- package/dist/pipeline/app-providers.js +0 -43
- package/dist/pipeline/component.manager.d.ts +0 -25
- package/dist/pipeline/component.manager.js +0 -66
- package/dist/pipeline/decorators.d.ts +0 -10
- package/dist/pipeline/decorators.js +0 -42
- package/dist/pipeline/index.d.ts +0 -12
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/pipeline-runner.d.ts +0 -31
- package/dist/pipeline/pipeline-runner.js +0 -40
- package/dist/pipeline/pipes.d.ts +0 -48
- package/dist/pipeline/pipes.js +0 -104
- package/dist/pipeline/reflector.d.ts +0 -86
- package/dist/pipeline/reflector.js +0 -121
- package/dist/pipeline/scoped-components.d.ts +0 -26
- package/dist/pipeline/scoped-components.js +0 -27
- package/dist/pipeline/tokens.d.ts +0 -33
- package/dist/pipeline/tokens.js +0 -27
- package/dist/pipeline/types.d.ts +0 -64
- package/dist/pipeline/types.js +0 -1
- package/dist/plugin/plugin.d.ts +0 -31
- package/dist/plugin/plugin.js +0 -111
- package/dist/queue/inline.driver.d.ts +0 -30
- package/dist/queue/inline.driver.js +0 -58
- package/dist/queue/queue.binding.d.ts +0 -23
- package/dist/queue/queue.binding.js +0 -53
- package/dist/queue/queue.client.d.ts +0 -20
- package/dist/queue/queue.client.js +0 -33
- package/dist/queue/queue.decorators.d.ts +0 -23
- package/dist/queue/queue.decorators.js +0 -46
- package/dist/queue/queue.dispatch.d.ts +0 -36
- package/dist/queue/queue.dispatch.js +0 -102
- package/dist/queue/queue.module.d.ts +0 -32
- package/dist/queue/queue.module.js +0 -80
- package/dist/queue/queue.tokens.d.ts +0 -21
- package/dist/queue/queue.tokens.js +0 -34
- package/dist/queue/queue.types.d.ts +0 -61
- package/dist/queue/queue.types.js +0 -4
- package/dist/registry/index.d.ts +0 -2
- package/dist/registry/index.js +0 -1
- package/dist/registry/metadata.registry.d.ts +0 -73
- package/dist/registry/metadata.registry.js +0 -357
- package/dist/registry/paths.d.ts +0 -3
- package/dist/registry/paths.js +0 -15
- package/dist/registry/types.d.ts +0 -116
- package/dist/registry/types.js +0 -1
- package/dist/registry/util.d.ts +0 -3
- package/dist/registry/util.js +0 -8
- package/dist/schedule/cron-matcher.d.ts +0 -2
- package/dist/schedule/cron-matcher.js +0 -62
- package/dist/schedule/index.d.ts +0 -8
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/schedule.decorators.d.ts +0 -2
- package/dist/schedule/schedule.decorators.js +0 -18
- package/dist/schedule/schedule.module.d.ts +0 -9
- package/dist/schedule/schedule.module.js +0 -28
- package/dist/schedule/schedule.registry.d.ts +0 -23
- package/dist/schedule/schedule.registry.js +0 -63
- package/dist/schedule/schedule.tokens.d.ts +0 -2
- package/dist/schedule/schedule.tokens.js +0 -2
- package/dist/schedule/schedule.types.d.ts +0 -8
- package/dist/schedule/schedule.types.js +0 -1
- package/dist/schedule-node/schedule-node.module.d.ts +0 -9
- package/dist/schedule-node/schedule-node.module.js +0 -28
- package/dist/schedule-node/schedule.executor.d.ts +0 -19
- package/dist/schedule-node/schedule.executor.js +0 -107
- package/dist/seeder/seeder.decorator.d.ts +0 -7
- package/dist/seeder/seeder.decorator.js +0 -15
- package/dist/seeder/seeder.module.d.ts +0 -16
- package/dist/seeder/seeder.module.js +0 -44
- package/dist/seeder/seeder.registry.d.ts +0 -23
- package/dist/seeder/seeder.registry.js +0 -83
- package/dist/seeder/seeder.tokens.d.ts +0 -2
- package/dist/seeder/seeder.tokens.js +0 -1
- package/dist/seeder/seeder.types.d.ts +0 -20
- package/dist/seeder/seeder.types.js +0 -1
- package/dist/serialization/index.d.ts +0 -2
- package/dist/serialization/index.js +0 -2
- package/dist/serialization/serialize.decorator.d.ts +0 -6
- package/dist/serialization/serialize.decorator.js +0 -7
- package/dist/serialization/serializer.interceptor.d.ts +0 -4
- package/dist/serialization/serializer.interceptor.js +0 -16
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.js +0 -1
- package/dist/services/logger.d.ts +0 -59
- package/dist/services/logger.js +0 -159
- package/dist/storage/path-template.d.ts +0 -9
- package/dist/storage/path-template.js +0 -20
- package/dist/storage/storage.types.d.ts +0 -41
- package/dist/storage/storage.types.js +0 -5
- package/dist/throttler/index.d.ts +0 -6
- package/dist/throttler/index.js +0 -5
- package/dist/throttler/throttler.decorators.d.ts +0 -3
- package/dist/throttler/throttler.decorators.js +0 -4
- package/dist/throttler/throttler.guard.d.ts +0 -9
- package/dist/throttler/throttler.guard.js +0 -72
- package/dist/throttler/throttler.module.d.ts +0 -7
- package/dist/throttler/throttler.module.js +0 -41
- package/dist/throttler/throttler.storage.d.ts +0 -10
- package/dist/throttler/throttler.storage.js +0 -44
- package/dist/throttler/throttler.tokens.d.ts +0 -6
- package/dist/throttler/throttler.tokens.js +0 -5
- package/dist/throttler/throttler.types.d.ts +0 -25
- package/dist/throttler/throttler.types.js +0 -1
- package/dist/validation/create-zod-dto.d.ts +0 -13
- package/dist/validation/create-zod-dto.js +0 -18
- package/dist/validation/index.d.ts +0 -3
- package/dist/validation/index.js +0 -2
- package/dist/validation/validation.pipe.d.ts +0 -4
- package/dist/validation/validation.pipe.js +0 -19
- package/dist/websocket/websocket.decorators.d.ts +0 -47
- package/dist/websocket/websocket.decorators.js +0 -80
- package/dist/websocket/websocket.module.d.ts +0 -35
- package/dist/websocket/websocket.module.js +0 -63
- package/dist/websocket/websocket.tokens.d.ts +0 -30
- package/dist/websocket/websocket.tokens.js +0 -27
- package/dist/websocket/websocket.types.d.ts +0 -102
- package/dist/websocket/websocket.types.js +0 -4
- package/dist/websocket/ws-argument-resolver.d.ts +0 -13
- package/dist/websocket/ws-argument-resolver.js +0 -40
- package/dist/websocket/ws-dispatcher.d.ts +0 -54
- package/dist/websocket/ws-dispatcher.js +0 -322
- package/dist/websocket/ws-exception.d.ts +0 -16
- package/dist/websocket/ws-exception.js +0 -32
- package/dist/websocket/ws-execution-context.d.ts +0 -9
- package/dist/websocket/ws-execution-context.js +0 -24
- package/dist/websocket/ws-server.d.ts +0 -31
- package/dist/websocket/ws-server.js +0 -74
- package/dist/websocket/ws-sync.d.ts +0 -47
- package/dist/websocket/ws-sync.js +0 -74
- package/dist/websocket-node/node-ws-client.d.ts +0 -24
- package/dist/websocket-node/node-ws-client.js +0 -49
- package/dist/websocket-node/redis-live.d.ts +0 -24
- package/dist/websocket-node/redis-live.js +0 -57
- package/dist/websocket-node/redis-sync.d.ts +0 -33
- package/dist/websocket-node/redis-sync.js +0 -56
- package/dist/websocket-node/register-gateways.d.ts +0 -20
- package/dist/websocket-node/register-gateways.js +0 -61
package/dist/queue/index.js
CHANGED
|
@@ -1,12 +1,384 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { C as InjectionToken } from "../decorate-GcSMAbKn.js";
|
|
2
|
+
import { F as shouldFilterCatch, G as getMetadata, L as PipelineRunner, W as defineMetadata } from "../route.manager-DRAZ5X04.js";
|
|
3
|
+
import { n as resolveErrorReporter, t as DiscoveryService } from "../discovery.service-BYm95SSD.js";
|
|
4
|
+
import { t as Container } from "../container-BqUHID4l.js";
|
|
5
|
+
import { _ as EntrypointRegistry, y as registerEntrypointKind } from "../plugin-ByBlVOve.js";
|
|
6
|
+
import { E as runInEntrypointScope, T as buildEntrypointExecutionContext, w as resolveScopedComponents } from "../src-eb5CI6Xn.js";
|
|
7
|
+
import { n as defineModule, r as stableHash } from "../define-module-NOyOZNXD.js";
|
|
8
|
+
import { E as createDiscoverableDecorator } from "../websocket-DXmB-MWJ.js";
|
|
9
|
+
//#region src/queue/inline.driver.ts
|
|
10
|
+
/**
|
|
11
|
+
* In-process driver for dev, tests, and single-isolate apps. Edge-pure: no
|
|
12
|
+
* timers — `immediate` mode uses `queueMicrotask`. `delayMs` is not
|
|
13
|
+
* supported (warns once through the bound error hook's diagnostics side).
|
|
14
|
+
*/
|
|
15
|
+
function inline(options = {}) {
|
|
16
|
+
const mode = options.mode ?? "immediate";
|
|
17
|
+
const buffer = [];
|
|
18
|
+
let dispatch;
|
|
19
|
+
let onError;
|
|
20
|
+
let warnedDelay = false;
|
|
21
|
+
const deliverDetached = (job) => {
|
|
22
|
+
queueMicrotask(() => {
|
|
23
|
+
dispatch(job).catch((error) => onError?.(error, job));
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
kind: "inline",
|
|
28
|
+
get size() {
|
|
29
|
+
return buffer.length;
|
|
30
|
+
},
|
|
31
|
+
async enqueue(job, addOptions) {
|
|
32
|
+
if (addOptions?.delayMs !== void 0 && !warnedDelay) {
|
|
33
|
+
warnedDelay = true;
|
|
34
|
+
console.warn(`[vela] inline() queue driver does not support delayMs — job '${job.name}' delivers without delay.`);
|
|
35
|
+
}
|
|
36
|
+
if (mode === "manual" || !dispatch) {
|
|
37
|
+
buffer.push(job);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
deliverDetached(job);
|
|
41
|
+
},
|
|
42
|
+
bind(fn, hooks) {
|
|
43
|
+
dispatch = fn;
|
|
44
|
+
onError = hooks?.onError;
|
|
45
|
+
if (mode === "immediate" && buffer.length > 0) for (const job of buffer.splice(0)) deliverDetached(job);
|
|
46
|
+
},
|
|
47
|
+
async flush() {
|
|
48
|
+
if (!dispatch) return 0;
|
|
49
|
+
const jobs = buffer.splice(0);
|
|
50
|
+
const errors = [];
|
|
51
|
+
let delivered = 0;
|
|
52
|
+
for (const job of jobs) try {
|
|
53
|
+
await dispatch(job);
|
|
54
|
+
delivered++;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
errors.push(error);
|
|
57
|
+
}
|
|
58
|
+
if (errors.length > 0) throw new AggregateError(errors, `queue flush: ${errors.length} of ${jobs.length} jobs failed (${delivered} delivered)`);
|
|
59
|
+
return delivered;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/queue/queue.client.ts
|
|
65
|
+
/**
|
|
66
|
+
* Producer handle for one named queue — inject via `queueToken(name)`:
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}
|
|
70
|
+
* await this.email.add('welcome', { userId });
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* `add()` resolves when the DRIVER accepted the job, not when a processor
|
|
74
|
+
* handled it (the inline driver's `immediate` mode delivers on a following
|
|
75
|
+
* microtask; platform drivers deliver in another isolate entirely).
|
|
76
|
+
*/
|
|
77
|
+
var QueueClient = class {
|
|
78
|
+
queue;
|
|
79
|
+
driver;
|
|
80
|
+
constructor(queue, driver) {
|
|
81
|
+
this.queue = queue;
|
|
82
|
+
this.driver = driver;
|
|
83
|
+
}
|
|
84
|
+
get name() {
|
|
85
|
+
return this.queue;
|
|
86
|
+
}
|
|
87
|
+
async add(jobName, data, options = {}) {
|
|
88
|
+
const job = {
|
|
89
|
+
id: crypto.randomUUID(),
|
|
90
|
+
queue: this.queue,
|
|
91
|
+
name: jobName,
|
|
92
|
+
data,
|
|
93
|
+
attempt: 1
|
|
94
|
+
};
|
|
95
|
+
await this.driver.enqueue(job, options);
|
|
96
|
+
return job;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/queue/queue.tokens.ts
|
|
101
|
+
const PROCESSOR_METADATA = "vela:queue:processor";
|
|
102
|
+
const PROCESS_METADATA = "vela:queue:process";
|
|
103
|
+
/** The driver in effect for a `QueueModule` instance. */
|
|
104
|
+
const QUEUE_DRIVER = new InjectionToken("vela:queue:driver");
|
|
105
|
+
const TOKEN_STORE_KEY = Symbol.for("vela:queue:client-tokens:v1");
|
|
106
|
+
function tokenStore() {
|
|
107
|
+
const g = globalThis;
|
|
108
|
+
return g[TOKEN_STORE_KEY] ??= /* @__PURE__ */ new Map();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The injection token for a named queue's `QueueClient`:
|
|
112
|
+
*
|
|
113
|
+
* ```ts
|
|
114
|
+
* constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* Memoized per name (HMR-stable). Deliberately NO `InjectionToken` default
|
|
118
|
+
* factory: the container resolves default-factory tokens from the root bucket
|
|
119
|
+
* BEFORE walking module imports, which would break the exported-provider
|
|
120
|
+
* path — the token description (`vela:queue:client:<name>`) keeps the
|
|
121
|
+
* no-provider error readable instead.
|
|
122
|
+
*/
|
|
123
|
+
function queueToken(name) {
|
|
124
|
+
const store = tokenStore();
|
|
125
|
+
let token = store.get(name);
|
|
126
|
+
if (!token) {
|
|
127
|
+
token = new InjectionToken(`vela:queue:client:${name}`);
|
|
128
|
+
store.set(name, token);
|
|
129
|
+
}
|
|
130
|
+
return token;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/queue/queue.decorators.ts
|
|
134
|
+
const ProcessorMeta = createDiscoverableDecorator(PROCESSOR_METADATA);
|
|
135
|
+
registerEntrypointKind({
|
|
136
|
+
kind: "queue",
|
|
137
|
+
metaKey: PROCESSOR_METADATA,
|
|
138
|
+
level: "class"
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Marks a provider class as a processor for one queue:
|
|
142
|
+
*
|
|
143
|
+
* ```ts
|
|
144
|
+
* @Processor('email')
|
|
145
|
+
* @Injectable()
|
|
146
|
+
* class EmailProcessor {
|
|
147
|
+
* @Process('welcome')
|
|
148
|
+
* async sendWelcome(job: QueueJob<{ userId: string }>) { ... }
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
function Processor(queueName) {
|
|
153
|
+
return ProcessorMeta({ queueName });
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Marks a processor method as the handler for a job name. Omit the name for
|
|
157
|
+
* the wildcard handler (receives every job on the queue that has no named
|
|
158
|
+
* handler). Named handlers win over the wildcard; a duplicate registration
|
|
159
|
+
* for the same name is first-wins with a diagnostics warning at dispatch.
|
|
160
|
+
*/
|
|
161
|
+
function Process(jobName) {
|
|
162
|
+
return (target, propertyKey) => {
|
|
163
|
+
const ctor = target.constructor;
|
|
164
|
+
const existing = getMetadata("vela:queue:process", ctor) ?? [];
|
|
165
|
+
existing.push({
|
|
166
|
+
jobName,
|
|
167
|
+
methodName: propertyKey
|
|
168
|
+
});
|
|
169
|
+
defineMetadata(PROCESS_METADATA, existing, ctor);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/** `@Process` entries declared on a processor class (declaration order). */
|
|
173
|
+
function getProcessHandlers(processorClass) {
|
|
174
|
+
return getMetadata("vela:queue:process", processorClass) ?? [];
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/queue/queue.dispatch.ts
|
|
178
|
+
const warnedDuplicates = /* @__PURE__ */ new WeakSet();
|
|
179
|
+
function selectHandler(container, processorClass, handlers, jobName) {
|
|
180
|
+
const named = handlers.filter((h) => h.jobName === jobName);
|
|
181
|
+
const pool = named.length > 0 ? named : handlers.filter((h) => h.jobName === void 0);
|
|
182
|
+
if (pool.length > 1 && !warnedDuplicates.has(processorClass)) {
|
|
183
|
+
warnedDuplicates.add(processorClass);
|
|
184
|
+
const message = `[vela] duplicate ${named.length > 0 ? `@Process('${jobName}')` : "@Process() (wildcard)"} handlers on ${processorClass.name}; keeping the first ('${String(pool[0].methodName)}').`;
|
|
185
|
+
if (container.getDiagnostics() === "throw") throw new Error(message);
|
|
186
|
+
if (container.getDiagnostics() === "log") console.warn(message);
|
|
187
|
+
}
|
|
188
|
+
return pool[0];
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Deliver one job to every `@Processor` of its queue — the primitive both the
|
|
192
|
+
* in-core `inline()` driver and platform adapters call.
|
|
193
|
+
*
|
|
194
|
+
* Each matching processor runs inside `runInEntrypointScope` (request-scoped
|
|
195
|
+
* dependencies rebuild per job) and is re-resolved BY TOKEN through the async
|
|
196
|
+
* seam, so processors living in `lazy: true` modules materialize cleanly on
|
|
197
|
+
* first dispatch — async providers and lifecycle hooks included. Scoped
|
|
198
|
+
* guards/interceptors/filters run through `PipelineRunner`
|
|
199
|
+
* (`getType() === 'queue'`, `getPayload()` is the job); app-wide `APP_*`
|
|
200
|
+
* components deliberately do NOT apply (cloudflare queue/scheduled parity —
|
|
201
|
+
* documented divergence from the WebSocket dispatcher).
|
|
202
|
+
*
|
|
203
|
+
* Errors no scoped filter claims RETHROW so awaiting platforms keep their
|
|
204
|
+
* retry semantics; fire-and-forget callers (inline `immediate` mode) must
|
|
205
|
+
* catch — `QueueDispatchBinding` routes those to diagnostics.
|
|
206
|
+
*/
|
|
207
|
+
async function dispatchQueueJob(container, entrypoints, job) {
|
|
208
|
+
return dispatchJobToEntries(container, entrypoints.ofKind("queue").map((ep) => ({
|
|
209
|
+
token: ep.token,
|
|
210
|
+
meta: ep.meta
|
|
211
|
+
})), job);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Entry-list core shared by `dispatchQueueJob` (registry) and the in-process
|
|
215
|
+
* driver binding (discovery fallback before the registry exists). Entries are
|
|
216
|
+
* tokens + meta ONLY — every processor is re-resolved by token in its own
|
|
217
|
+
* scope, so request-scoped and lazy-module processors work on both paths.
|
|
218
|
+
*/
|
|
219
|
+
async function dispatchJobToEntries(container, entries, job) {
|
|
220
|
+
const processors = entries.filter((entry) => entry.meta.queueName === job.queue);
|
|
221
|
+
if (processors.length === 0) {
|
|
222
|
+
if (container.getDiagnostics() === "log") console.warn(`[vela] queue job '${job.name}' on '${job.queue}' has no @Processor('${job.queue}') — dropped.`);
|
|
223
|
+
return { handled: 0 };
|
|
224
|
+
}
|
|
225
|
+
return { handled: (await Promise.all(processors.map((entry) => dispatchToProcessor(container, entry.token, job)))).filter(Boolean).length };
|
|
226
|
+
}
|
|
227
|
+
async function dispatchToProcessor(container, processorClass, job) {
|
|
228
|
+
const handler = selectHandler(container, processorClass, getProcessHandlers(processorClass), job.name);
|
|
229
|
+
if (!handler) {
|
|
230
|
+
if (container.getDiagnostics() === "log") console.warn(`[vela] no @Process('${job.name}') (or wildcard) handler on ${processorClass.name} for queue '${job.queue}' — skipped.`);
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return runInEntrypointScope(container, async (scope) => {
|
|
234
|
+
const instance = await scope.resolveAsync(processorClass);
|
|
235
|
+
const context = buildEntrypointExecutionContext("queue", processorClass, handler.methodName, job);
|
|
236
|
+
const guards = resolveScopedComponents("guard", processorClass, handler.methodName, scope);
|
|
237
|
+
const interceptors = resolveScopedComponents("interceptor", processorClass, handler.methodName, scope);
|
|
238
|
+
const filters = resolveScopedComponents("filter", processorClass, handler.methodName, scope).reverse();
|
|
239
|
+
try {
|
|
240
|
+
await PipelineRunner.run({
|
|
241
|
+
context,
|
|
242
|
+
guards,
|
|
243
|
+
interceptors,
|
|
244
|
+
resolveArgs: async () => [job],
|
|
245
|
+
invoke: async (args) => {
|
|
246
|
+
return instance[handler.methodName].apply(instance, args);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
return true;
|
|
250
|
+
} catch (error) {
|
|
251
|
+
resolveErrorReporter(scope).report(error, {
|
|
252
|
+
edge: "queue",
|
|
253
|
+
source: `${processorClass.name}.${String(handler.methodName)}`
|
|
254
|
+
});
|
|
255
|
+
for (const filter of filters) if (shouldFilterCatch(filter, error)) {
|
|
256
|
+
await filter.catch(error, context);
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/queue/queue.binding.ts
|
|
265
|
+
/**
|
|
266
|
+
* Wires a `QueueModule` instance's driver to the app: binds in-process
|
|
267
|
+
* delivery to the dispatch core and validates that no other module instance
|
|
268
|
+
* provides the same queue names.
|
|
269
|
+
*
|
|
270
|
+
* Delivery resolves processors from the per-app `EntrypointRegistry` once it
|
|
271
|
+
* exists (registered into the container at the end of
|
|
272
|
+
* `callOnApplicationBootstrap`); deliveries that arrive earlier (a producer's
|
|
273
|
+
* `onModuleInit` calling `add()`) fall back to `DiscoveryService` with
|
|
274
|
+
* `deferLazy` — identical entries, no buffering, no lost jobs.
|
|
275
|
+
*
|
|
276
|
+
* Every `QueueClient` injects this binding, so the driver is always bound
|
|
277
|
+
* before the first `add()` — including when the module materializes lazily.
|
|
278
|
+
*/
|
|
279
|
+
var QueueDispatchBinding = class {
|
|
280
|
+
container;
|
|
281
|
+
discovery;
|
|
282
|
+
constructor(container, discovery, driver, queues) {
|
|
283
|
+
this.container = container;
|
|
284
|
+
this.discovery = discovery;
|
|
285
|
+
for (const queue of queues) {
|
|
286
|
+
const owners = container.getOwnerModuleIds(queueToken(queue));
|
|
287
|
+
if (owners.length > 1) throw new Error(`Queue '${queue}' is provided by multiple QueueModule instances (${owners.join(", ")}). Queue names must be unique per app — either dedup the forRoot options or rename the queue.`);
|
|
288
|
+
}
|
|
289
|
+
driver.bind?.((job) => this.deliver(job), { onError: (error, job) => this.routeError(error, job) });
|
|
290
|
+
}
|
|
291
|
+
async deliver(job) {
|
|
292
|
+
const entries = this.container.has(EntrypointRegistry) ? this.container.resolve(EntrypointRegistry).ofKind("queue").map((ep) => ({
|
|
293
|
+
token: ep.token,
|
|
294
|
+
meta: ep.meta
|
|
295
|
+
})) : this.discovery.providersWithMeta(PROCESSOR_METADATA, { deferLazy: true }).map((found) => ({
|
|
296
|
+
token: found.token,
|
|
297
|
+
meta: found.meta
|
|
298
|
+
}));
|
|
299
|
+
await dispatchJobToEntries(this.container, entries, job);
|
|
300
|
+
}
|
|
301
|
+
routeError(error, job) {
|
|
302
|
+
const mode = this.container.getDiagnostics();
|
|
303
|
+
if (mode === "silent") return;
|
|
304
|
+
if (mode === "throw") throw error instanceof Error ? error : new Error(String(error));
|
|
305
|
+
resolveErrorReporter(this.container).report(error, {
|
|
306
|
+
edge: "queue",
|
|
307
|
+
source: `${job.queue}/${job.name}`,
|
|
308
|
+
note: "inline driver"
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/queue/queue.module.ts
|
|
314
|
+
/**
|
|
315
|
+
* First-party queue module — authored 100% on vela's public API (the
|
|
316
|
+
* roadmap's "openness proof"). Producers inject a per-queue `QueueClient`
|
|
317
|
+
* via `queueToken(name)`; consumers are `@Processor`/`@Process` classes in
|
|
318
|
+
* ordinary user modules; platforms deliver through `dispatchQueueJob` or the
|
|
319
|
+
* in-core `inline()` driver.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* imports: [QueueModule.forRoot({ queues: ['email'] })]
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* `lazy: true` (dogfoods 1.13): the module materializes when an eager
|
|
326
|
+
* producer injects a client (bootstrap — same structural reality that keeps
|
|
327
|
+
* WebSocketModule eager) or, in consumer-only workers, at the first
|
|
328
|
+
* delivered job.
|
|
329
|
+
*
|
|
330
|
+
* `queues` is STRUCTURAL: clients are options-derived providers, so
|
|
331
|
+
* `forRootAsync` callers pass it alongside the factory —
|
|
332
|
+
* `forRootAsync({ queues: ['email'], useFactory: () => ({ driver }) })`.
|
|
333
|
+
* Note that async options inherit the 1.13 lazy-module contract: the module
|
|
334
|
+
* must first materialize through an async seam (an eager producer's injection
|
|
335
|
+
* during the bootstrap sweep — the common case — or
|
|
336
|
+
* `app.materializeLazyModules()`); a synchronous first touch throws the
|
|
337
|
+
* descriptive sync-seam error.
|
|
338
|
+
*/
|
|
339
|
+
const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = defineModule({
|
|
340
|
+
name: "Queue",
|
|
341
|
+
lazy: true,
|
|
342
|
+
key: (o) => stableHash({
|
|
343
|
+
queues: o.queues ?? [],
|
|
344
|
+
driver: o.driver?.kind ?? "inline"
|
|
345
|
+
}),
|
|
346
|
+
setup: ({ OPTIONS, options }) => {
|
|
347
|
+
const queues = options.queues;
|
|
348
|
+
if (!queues || queues.length === 0) throw new Error("QueueModule requires 'queues' as a structural option: QueueModule.forRoot({ queues: ['email'] }) — for forRootAsync, pass it alongside the factory: forRootAsync({ queues: [...], useFactory }).");
|
|
349
|
+
const clientProviders = queues.map((name) => ({
|
|
350
|
+
provide: queueToken(name),
|
|
351
|
+
useFactory: (driver, _binding) => new QueueClient(name, driver),
|
|
352
|
+
inject: [QUEUE_DRIVER, QueueDispatchBinding]
|
|
353
|
+
}));
|
|
354
|
+
return {
|
|
355
|
+
providers: [
|
|
356
|
+
{
|
|
357
|
+
provide: QUEUE_DRIVER,
|
|
358
|
+
useFactory: (o) => o.driver ?? inline(),
|
|
359
|
+
inject: [OPTIONS]
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
provide: QueueDispatchBinding,
|
|
363
|
+
useFactory: (container, discovery, driver) => new QueueDispatchBinding(container, discovery, driver, queues),
|
|
364
|
+
inject: [
|
|
365
|
+
Container,
|
|
366
|
+
DiscoveryService,
|
|
367
|
+
QUEUE_DRIVER
|
|
368
|
+
]
|
|
369
|
+
},
|
|
370
|
+
...clientProviders
|
|
371
|
+
],
|
|
372
|
+
exports: [
|
|
373
|
+
QUEUE_DRIVER,
|
|
374
|
+
QueueDispatchBinding,
|
|
375
|
+
...queues.map((name) => queueToken(name))
|
|
376
|
+
]
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
var QueueModule = class extends ConfigurableModuleClass {};
|
|
381
|
+
//#endregion
|
|
382
|
+
export { PROCESSOR_METADATA, PROCESS_METADATA, Process, Processor, QUEUE_DRIVER, MODULE_OPTIONS_TOKEN as QUEUE_MODULE_OPTIONS, QueueClient, QueueDispatchBinding, QueueModule, dispatchQueueJob, getProcessHandlers, inline, queueToken };
|
|
383
|
+
|
|
384
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/queue/inline.driver.ts","../../src/queue/queue.client.ts","../../src/queue/queue.tokens.ts","../../src/queue/queue.decorators.ts","../../src/queue/queue.dispatch.ts","../../src/queue/queue.binding.ts","../../src/queue/queue.module.ts"],"sourcesContent":["import type {\n AddJobOptions,\n QueueDispatchFn,\n QueueDriver,\n QueueDriverBindHooks,\n QueueJob,\n} from './queue.types';\n\nexport interface InlineQueueOptions {\n /**\n * `immediate` (default): deliver on a microtask after `enqueue` resolves —\n * `add()` resolving does NOT mean the job was handled. Handler errors are\n * routed to the binding's error hook (container diagnostics), never thrown\n * into the detached microtask.\n *\n * `manual`: buffer until `flush()` — deterministic delivery for tests.\n */\n mode?: 'immediate' | 'manual';\n}\n\nexport interface InlineQueueDriver extends QueueDriver {\n /**\n * Deliver everything buffered (manual mode; also drains jobs enqueued\n * before the driver was bound). Resolves with the delivered count; rejects\n * with an `AggregateError` after attempting ALL buffered jobs if any\n * handler error went unclaimed — the awaiter exists here, so the\n * platform-retry rethrow contract is meaningful.\n */\n flush(): Promise<number>;\n /** Jobs currently buffered (unbound immediate + all manual). */\n readonly size: number;\n}\n\n/**\n * In-process driver for dev, tests, and single-isolate apps. Edge-pure: no\n * timers — `immediate` mode uses `queueMicrotask`. `delayMs` is not\n * supported (warns once through the bound error hook's diagnostics side).\n */\nexport function inline(options: InlineQueueOptions = {}): InlineQueueDriver {\n const mode = options.mode ?? 'immediate';\n const buffer: QueueJob[] = [];\n let dispatch: QueueDispatchFn | undefined;\n let onError: QueueDriverBindHooks['onError'];\n let warnedDelay = false;\n\n const deliverDetached = (job: QueueJob): void => {\n queueMicrotask(() => {\n void dispatch!(job).catch((error) => onError?.(error, job));\n });\n };\n\n return {\n kind: 'inline',\n\n get size(): number {\n return buffer.length;\n },\n\n async enqueue(job: QueueJob, addOptions?: AddJobOptions): Promise<void> {\n if (addOptions?.delayMs !== undefined && !warnedDelay) {\n warnedDelay = true;\n console.warn(\n `[vela] inline() queue driver does not support delayMs — job '${job.name}' delivers without delay.`,\n );\n }\n if (mode === 'manual' || !dispatch) {\n buffer.push(job);\n return;\n }\n deliverDetached(job);\n },\n\n bind(fn: QueueDispatchFn, hooks?: QueueDriverBindHooks): void {\n dispatch = fn;\n onError = hooks?.onError;\n if (mode === 'immediate' && buffer.length > 0) {\n for (const job of buffer.splice(0)) deliverDetached(job);\n }\n },\n\n async flush(): Promise<number> {\n if (!dispatch) return 0;\n const jobs = buffer.splice(0);\n const errors: unknown[] = [];\n let delivered = 0;\n for (const job of jobs) {\n try {\n await dispatch(job);\n delivered++;\n } catch (error) {\n errors.push(error);\n }\n }\n if (errors.length > 0) {\n throw new AggregateError(\n errors,\n `queue flush: ${errors.length} of ${jobs.length} jobs failed (${delivered} delivered)`,\n );\n }\n return delivered;\n },\n };\n}\n","import type { AddJobOptions, QueueDriver, QueueJob } from './queue.types';\n\n/**\n * Producer handle for one named queue — inject via `queueToken(name)`:\n *\n * ```ts\n * constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}\n * await this.email.add('welcome', { userId });\n * ```\n *\n * `add()` resolves when the DRIVER accepted the job, not when a processor\n * handled it (the inline driver's `immediate` mode delivers on a following\n * microtask; platform drivers deliver in another isolate entirely).\n */\nexport class QueueClient {\n constructor(\n private readonly queue: string,\n private readonly driver: QueueDriver,\n ) {}\n\n get name(): string {\n return this.queue;\n }\n\n async add<T>(jobName: string, data: T, options: AddJobOptions = {}): Promise<QueueJob<T>> {\n const job: QueueJob<T> = {\n id: crypto.randomUUID(),\n queue: this.queue,\n name: jobName,\n data,\n attempt: 1,\n };\n await this.driver.enqueue(job, options);\n return job;\n }\n}\n","import { InjectionToken } from '../index';\nimport type { QueueClient } from './queue.client';\nimport type { QueueDriver } from './queue.types';\n\nexport const PROCESSOR_METADATA = 'vela:queue:processor';\nexport const PROCESS_METADATA = 'vela:queue:process';\n\n/** The driver in effect for a `QueueModule` instance. */\nexport const QUEUE_DRIVER = new InjectionToken<QueueDriver>('vela:queue:driver');\n\n// Token identity must survive Vite HMR re-evals (a consumer module that was\n// NOT re-evaluated still holds the token minted by the previous generation),\n// so the name → token map is anchored on globalThis exactly like the\n// entrypoint kind store and MetadataRegistry state.\nconst TOKEN_STORE_KEY = Symbol.for('vela:queue:client-tokens:v1');\n\nfunction tokenStore(): Map<string, InjectionToken<QueueClient>> {\n const g = globalThis as unknown as Record<\n symbol,\n Map<string, InjectionToken<QueueClient>> | undefined\n >;\n return (g[TOKEN_STORE_KEY] ??= new Map());\n}\n\n/**\n * The injection token for a named queue's `QueueClient`:\n *\n * ```ts\n * constructor(@Inject(queueToken('email')) private readonly email: QueueClient) {}\n * ```\n *\n * Memoized per name (HMR-stable). Deliberately NO `InjectionToken` default\n * factory: the container resolves default-factory tokens from the root bucket\n * BEFORE walking module imports, which would break the exported-provider\n * path — the token description (`vela:queue:client:<name>`) keeps the\n * no-provider error readable instead.\n */\nexport function queueToken(name: string): InjectionToken<QueueClient> {\n const store = tokenStore();\n let token = store.get(name);\n if (!token) {\n token = new InjectionToken<QueueClient>(`vela:queue:client:${name}`);\n store.set(name, token);\n }\n return token;\n}\n","import {\n createDiscoverableDecorator,\n defineMetadata,\n getMetadata,\n registerEntrypointKind,\n} from '../index';\nimport { PROCESS_METADATA, PROCESSOR_METADATA } from './queue.tokens';\nimport type { ProcessMetadata, ProcessorMetadata } from './queue.types';\n\nconst ProcessorMeta = createDiscoverableDecorator<ProcessorMetadata>(PROCESSOR_METADATA);\n\n// The open entrypoint kind: adapters enumerate processors via\n// `app.entrypoints.ofKind<ProcessorMetadata>('queue')`. Declared at import\n// time next to the decorator — zero kernel involvement.\nregisterEntrypointKind({ kind: 'queue', metaKey: PROCESSOR_METADATA, level: 'class' });\n\n/**\n * Marks a provider class as a processor for one queue:\n *\n * ```ts\n * @Processor('email')\n * @Injectable()\n * class EmailProcessor {\n * @Process('welcome')\n * async sendWelcome(job: QueueJob<{ userId: string }>) { ... }\n * }\n * ```\n */\nexport function Processor(queueName: string): ClassDecorator {\n return ProcessorMeta({ queueName }) as ClassDecorator;\n}\n\n/**\n * Marks a processor method as the handler for a job name. Omit the name for\n * the wildcard handler (receives every job on the queue that has no named\n * handler). Named handlers win over the wildcard; a duplicate registration\n * for the same name is first-wins with a diagnostics warning at dispatch.\n */\nexport function Process(jobName?: string): MethodDecorator {\n return (target: object, propertyKey: string | symbol) => {\n const ctor = target.constructor;\n const existing = (getMetadata(PROCESS_METADATA, ctor) as ProcessMetadata[] | undefined) ?? [];\n existing.push({ jobName, methodName: propertyKey });\n defineMetadata(PROCESS_METADATA, existing, ctor);\n };\n}\n\n/** `@Process` entries declared on a processor class (declaration order). */\nexport function getProcessHandlers(processorClass: object): ProcessMetadata[] {\n return (getMetadata(PROCESS_METADATA, processorClass) as ProcessMetadata[] | undefined) ?? [];\n}\n","import {\n buildEntrypointExecutionContext,\n PipelineRunner,\n resolveErrorReporter,\n resolveScopedComponents,\n runInEntrypointScope,\n shouldFilterCatch,\n} from '../index';\nimport type { Container, EntrypointRegistry, Token, Type } from '../index';\nimport { getProcessHandlers } from './queue.decorators';\nimport type { ProcessMetadata, ProcessorMetadata, QueueJob } from './queue.types';\n\nexport interface QueueDispatchResult {\n /** Processors that ran a handler for this job. */\n handled: number;\n}\n\n/** One dispatchable processor: its class token + `@Processor` meta. */\nexport interface QueueEntry {\n token: Token;\n meta: ProcessorMetadata;\n}\n\nconst warnedDuplicates = new WeakSet<object>();\n\nfunction selectHandler(\n container: Container,\n processorClass: Type,\n handlers: ProcessMetadata[],\n jobName: string,\n): ProcessMetadata | undefined {\n const named = handlers.filter((h) => h.jobName === jobName);\n const pool = named.length > 0 ? named : handlers.filter((h) => h.jobName === undefined);\n if (pool.length > 1 && !warnedDuplicates.has(processorClass)) {\n warnedDuplicates.add(processorClass);\n const label = named.length > 0 ? `@Process('${jobName}')` : '@Process() (wildcard)';\n const message =\n `[vela] duplicate ${label} handlers on ${processorClass.name}; ` +\n `keeping the first ('${String(pool[0]!.methodName)}').`;\n if (container.getDiagnostics() === 'throw') throw new Error(message);\n if (container.getDiagnostics() === 'log') console.warn(message);\n }\n return pool[0];\n}\n\n/**\n * Deliver one job to every `@Processor` of its queue — the primitive both the\n * in-core `inline()` driver and platform adapters call.\n *\n * Each matching processor runs inside `runInEntrypointScope` (request-scoped\n * dependencies rebuild per job) and is re-resolved BY TOKEN through the async\n * seam, so processors living in `lazy: true` modules materialize cleanly on\n * first dispatch — async providers and lifecycle hooks included. Scoped\n * guards/interceptors/filters run through `PipelineRunner`\n * (`getType() === 'queue'`, `getPayload()` is the job); app-wide `APP_*`\n * components deliberately do NOT apply (cloudflare queue/scheduled parity —\n * documented divergence from the WebSocket dispatcher).\n *\n * Errors no scoped filter claims RETHROW so awaiting platforms keep their\n * retry semantics; fire-and-forget callers (inline `immediate` mode) must\n * catch — `QueueDispatchBinding` routes those to diagnostics.\n */\nexport async function dispatchQueueJob(\n container: Container,\n entrypoints: EntrypointRegistry,\n job: QueueJob,\n): Promise<QueueDispatchResult> {\n const entries = entrypoints\n .ofKind<ProcessorMetadata>('queue')\n .map((ep) => ({ token: ep.token, meta: ep.meta }));\n return dispatchJobToEntries(container, entries, job);\n}\n\n/**\n * Entry-list core shared by `dispatchQueueJob` (registry) and the in-process\n * driver binding (discovery fallback before the registry exists). Entries are\n * tokens + meta ONLY — every processor is re-resolved by token in its own\n * scope, so request-scoped and lazy-module processors work on both paths.\n */\nexport async function dispatchJobToEntries(\n container: Container,\n entries: QueueEntry[],\n job: QueueJob,\n): Promise<QueueDispatchResult> {\n const processors = entries.filter((entry) => entry.meta.queueName === job.queue);\n\n if (processors.length === 0) {\n if (container.getDiagnostics() === 'log') {\n console.warn(\n `[vela] queue job '${job.name}' on '${job.queue}' has no @Processor('${job.queue}') — dropped.`,\n );\n }\n return { handled: 0 };\n }\n\n // All matching processors receive the job; the first unclaimed error\n // rejects the whole dispatch (platform retries the delivery — CF parity).\n const outcomes = await Promise.all(\n processors.map((entry) => dispatchToProcessor(container, entry.token as Type, job)),\n );\n return { handled: outcomes.filter(Boolean).length };\n}\n\nasync function dispatchToProcessor(\n container: Container,\n processorClass: Type,\n job: QueueJob,\n): Promise<boolean> {\n const handler = selectHandler(\n container,\n processorClass,\n getProcessHandlers(processorClass),\n job.name,\n );\n if (!handler) {\n if (container.getDiagnostics() === 'log') {\n console.warn(\n `[vela] no @Process('${job.name}') (or wildcard) handler on ` +\n `${processorClass.name} for queue '${job.queue}' — skipped.`,\n );\n }\n return false;\n }\n\n return runInEntrypointScope(container, async (scope) => {\n // Async seam: materializes lazy processor modules (drainAsync awaits\n // their async providers/hooks) and rebuilds request-scoped processors.\n const instance = (await scope.resolveAsync(processorClass)) as Record<string | symbol, unknown>;\n const context = buildEntrypointExecutionContext(\n 'queue',\n processorClass,\n handler.methodName,\n job,\n );\n\n const guards = resolveScopedComponents('guard', processorClass, handler.methodName, scope);\n const interceptors = resolveScopedComponents(\n 'interceptor',\n processorClass,\n handler.methodName,\n scope,\n );\n // Closest-first: handler/class filters reversed by the caller (WS/CF convention).\n const filters = resolveScopedComponents(\n 'filter',\n processorClass,\n handler.methodName,\n scope,\n ).reverse();\n\n try {\n await PipelineRunner.run({\n context,\n guards,\n interceptors,\n resolveArgs: async () => [job],\n invoke: async (args) => {\n const method = instance[handler.methodName] as (...a: unknown[]) => unknown;\n return method.apply(instance, args);\n },\n });\n return true;\n } catch (error) {\n // Report BEFORE the filter loop and BEFORE any rethrow — every dispatch\n // error reaches the exception handler, whether a scoped filter claims it\n // or it rethrows to preserve platform retry semantics.\n resolveErrorReporter(scope).report(error, {\n edge: 'queue',\n source: `${processorClass.name}.${String(handler.methodName)}`,\n });\n for (const filter of filters) {\n if (shouldFilterCatch(filter, error)) {\n await filter.catch(error, context);\n return true;\n }\n }\n throw error; // unclaimed → platform retry semantics stay intact\n }\n });\n}\n","import { EntrypointRegistry, resolveErrorReporter } from '../index';\nimport type { Container, DiscoveryService } from '../index';\nimport { dispatchJobToEntries } from './queue.dispatch';\nimport type { QueueEntry } from './queue.dispatch';\nimport { PROCESSOR_METADATA, queueToken } from './queue.tokens';\nimport type { ProcessorMetadata, QueueDriver, QueueJob } from './queue.types';\n\n/**\n * Wires a `QueueModule` instance's driver to the app: binds in-process\n * delivery to the dispatch core and validates that no other module instance\n * provides the same queue names.\n *\n * Delivery resolves processors from the per-app `EntrypointRegistry` once it\n * exists (registered into the container at the end of\n * `callOnApplicationBootstrap`); deliveries that arrive earlier (a producer's\n * `onModuleInit` calling `add()`) fall back to `DiscoveryService` with\n * `deferLazy` — identical entries, no buffering, no lost jobs.\n *\n * Every `QueueClient` injects this binding, so the driver is always bound\n * before the first `add()` — including when the module materializes lazily.\n */\nexport class QueueDispatchBinding {\n constructor(\n private readonly container: Container,\n private readonly discovery: DiscoveryService,\n driver: QueueDriver,\n queues: string[],\n ) {\n for (const queue of queues) {\n const owners = container.getOwnerModuleIds(queueToken(queue));\n if (owners.length > 1) {\n throw new Error(\n `Queue '${queue}' is provided by multiple QueueModule instances (${owners.join(', ')}). ` +\n `Queue names must be unique per app — either dedup the forRoot options or rename the queue.`,\n );\n }\n }\n\n driver.bind?.((job) => this.deliver(job), {\n onError: (error, job) => this.routeError(error, job),\n });\n }\n\n private async deliver(job: QueueJob): Promise<void> {\n const entries: QueueEntry[] = this.container.has(EntrypointRegistry)\n ? this.container\n .resolve(EntrypointRegistry)\n .ofKind<ProcessorMetadata>('queue')\n .map((ep) => ({ token: ep.token, meta: ep.meta }))\n : this.discovery\n .providersWithMeta<ProcessorMetadata>(PROCESSOR_METADATA, { deferLazy: true })\n .map((found) => ({ token: found.token, meta: found.meta }));\n\n await dispatchJobToEntries(this.container, entries, job);\n }\n\n private routeError(error: unknown, job: QueueJob): void {\n const mode = this.container.getDiagnostics();\n if (mode === 'silent') return;\n if (mode === 'throw') {\n throw error instanceof Error ? error : new Error(String(error));\n }\n // Fire-and-forget (inline `immediate`) deliveries have no awaiter to rethrow\n // into — route their unclaimed errors to the exception handler instead of a\n // bare console.error.\n resolveErrorReporter(this.container).report(error, {\n edge: 'queue',\n source: `${job.queue}/${job.name}`,\n note: 'inline driver',\n });\n }\n}\n","import { Container, defineModule, DiscoveryService, stableHash } from '../index';\nimport type { ProviderOptions } from '../index';\nimport { inline } from './inline.driver';\nimport { QueueClient } from './queue.client';\nimport { QueueDispatchBinding } from './queue.binding';\nimport { QUEUE_DRIVER, queueToken } from './queue.tokens';\nimport type { QueueDriver, QueueModuleOptions } from './queue.types';\n\n/**\n * First-party queue module — authored 100% on vela's public API (the\n * roadmap's \"openness proof\"). Producers inject a per-queue `QueueClient`\n * via `queueToken(name)`; consumers are `@Processor`/`@Process` classes in\n * ordinary user modules; platforms deliver through `dispatchQueueJob` or the\n * in-core `inline()` driver.\n *\n * ```ts\n * imports: [QueueModule.forRoot({ queues: ['email'] })]\n * ```\n *\n * `lazy: true` (dogfoods 1.13): the module materializes when an eager\n * producer injects a client (bootstrap — same structural reality that keeps\n * WebSocketModule eager) or, in consumer-only workers, at the first\n * delivered job.\n *\n * `queues` is STRUCTURAL: clients are options-derived providers, so\n * `forRootAsync` callers pass it alongside the factory —\n * `forRootAsync({ queues: ['email'], useFactory: () => ({ driver }) })`.\n * Note that async options inherit the 1.13 lazy-module contract: the module\n * must first materialize through an async seam (an eager producer's injection\n * during the bootstrap sweep — the common case — or\n * `app.materializeLazyModules()`); a synchronous first touch throws the\n * descriptive sync-seam error.\n */\nconst { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = defineModule<QueueModuleOptions>({\n name: 'Queue',\n lazy: true,\n key: (o) => stableHash({ queues: o.queues ?? [], driver: o.driver?.kind ?? 'inline' }),\n setup: ({ OPTIONS, options }) => {\n const queues = options.queues;\n if (!queues || queues.length === 0) {\n throw new Error(\n \"QueueModule requires 'queues' as a structural option: \" +\n \"QueueModule.forRoot({ queues: ['email'] }) — for forRootAsync, pass it alongside \" +\n 'the factory: forRootAsync({ queues: [...], useFactory }).',\n );\n }\n\n const clientProviders: ProviderOptions[] = queues.map((name) => ({\n provide: queueToken(name),\n useFactory: (driver: QueueDriver, _binding: QueueDispatchBinding) =>\n new QueueClient(name, driver),\n inject: [QUEUE_DRIVER, QueueDispatchBinding],\n }));\n\n return {\n providers: [\n {\n provide: QUEUE_DRIVER,\n useFactory: (o: QueueModuleOptions) => o.driver ?? inline(),\n inject: [OPTIONS],\n },\n {\n provide: QueueDispatchBinding,\n useFactory: (container: Container, discovery: DiscoveryService, driver: QueueDriver) =>\n new QueueDispatchBinding(container, discovery, driver, queues),\n inject: [Container, DiscoveryService, QUEUE_DRIVER],\n },\n ...clientProviders,\n ],\n exports: [QUEUE_DRIVER, QueueDispatchBinding, ...queues.map((name) => queueToken(name))],\n };\n },\n});\n\nexport class QueueModule extends ConfigurableModuleClass {}\nexport { MODULE_OPTIONS_TOKEN as QUEUE_MODULE_OPTIONS };\n"],"mappings":";;;;;;;;;;;;;;AAsCA,SAAgB,OAAO,UAA8B,CAAC,GAAsB;CAC1E,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,SAAqB,CAAC;CAC5B,IAAI;CACJ,IAAI;CACJ,IAAI,cAAc;CAElB,MAAM,mBAAmB,QAAwB;EAC/C,qBAAqB;GACnB,SAAe,GAAG,CAAC,CAAC,OAAO,UAAU,UAAU,OAAO,GAAG,CAAC;EAC5D,CAAC;CACH;CAEA,OAAO;EACL,MAAM;EAEN,IAAI,OAAe;GACjB,OAAO,OAAO;EAChB;EAEA,MAAM,QAAQ,KAAe,YAA2C;GACtE,IAAI,YAAY,YAAY,KAAA,KAAa,CAAC,aAAa;IACrD,cAAc;IACd,QAAQ,KACN,gEAAgE,IAAI,KAAK,0BAC3E;GACF;GACA,IAAI,SAAS,YAAY,CAAC,UAAU;IAClC,OAAO,KAAK,GAAG;IACf;GACF;GACA,gBAAgB,GAAG;EACrB;EAEA,KAAK,IAAqB,OAAoC;GAC5D,WAAW;GACX,UAAU,OAAO;GACjB,IAAI,SAAS,eAAe,OAAO,SAAS,GAC1C,KAAK,MAAM,OAAO,OAAO,OAAO,CAAC,GAAG,gBAAgB,GAAG;EAE3D;EAEA,MAAM,QAAyB;GAC7B,IAAI,CAAC,UAAU,OAAO;GACtB,MAAM,OAAO,OAAO,OAAO,CAAC;GAC5B,MAAM,SAAoB,C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jD,MAAM;GACN,QAAQ,GAAG,IAAI,MAAM,GAAG,IAAI;GAC5B,MAAM;EACR,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACtCA,MAAM,EAAE,yBAAyB,yBAAyB,aAAiC;CACzF,MAAM;CACN,MAAM;CACN,MAAM,MAAM,WAAW;EAAE,QAAQ,EAAE,UAAU,CAAC;EAAG,QAAQ,EAAE,QAAQ,QAAQ;CAAS,CAAC;CACrF,QAAQ,EAAE,SAAS,cAAc;EAC/B,MAAM,SAAS,QAAQ;EACvB,IAAI,CAAC,UAAU,OAAO,WAAW,GAC/B,MAAM,IAAI,MACR,kMAGF;EAGF,MAAM,kBAAqC,OAAO,KAAK,UAAU;GAC/D,SAAS,WAAW,IAAI;GACxB,aAAa,QAAqB,aAChC,IAAI,YAAY,MAAM,MAAM;GAC9B,QAAQ,CAAC,cAAc,oBAAoB;EAC7C,EAAE;EAEF,OAAO;GACL,WAAW;IACT;KACE,SAAS;KACT,aAAa,MAA0B,EAAE,UAAU,OAAO;KAC1D,QAAQ,CAAC,OAAO;IAClB;IACA;KACE,SAAS;KACT,aAAa,WAAsB,WAA6B,WAC9D,IAAI,qBAAqB,WAAW,WAAW,QAAQ,MAAM;KAC/D,QAAQ;MAAC;MAAW;MAAkB;KAAY;IACpD;IACA,GAAG;GACL;GACA,SAAS;IAAC;IAAc;IAAsB,GAAG,OAAO,KAAK,SAAS,WAAW,IAAI,CAAC;GAAC;EACzF;CACF;AACF,CAAC;AAED,IAAa,cAAb,cAAiC,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { C as InjectionToken } from "./decorate-GcSMAbKn.js";
|
|
2
|
+
//#region src/http/request-context.ts
|
|
3
|
+
const REQUEST_CONTEXT = new InjectionToken("vela.RequestContext");
|
|
4
|
+
function createRequestContext(c) {
|
|
5
|
+
const bag = /* @__PURE__ */ new Map();
|
|
6
|
+
const inboundId = c.req.raw.headers.get("x-request-id");
|
|
7
|
+
return {
|
|
8
|
+
id: inboundId && inboundId.length > 0 ? inboundId : crypto.randomUUID(),
|
|
9
|
+
receivedAt: /* @__PURE__ */ new Date(),
|
|
10
|
+
request: c.req.raw,
|
|
11
|
+
hono: c,
|
|
12
|
+
set(key, value) {
|
|
13
|
+
bag.set(key, value);
|
|
14
|
+
},
|
|
15
|
+
get(key) {
|
|
16
|
+
return bag.get(key);
|
|
17
|
+
},
|
|
18
|
+
has(key) {
|
|
19
|
+
return bag.has(key);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createRequestContext as n, REQUEST_CONTEXT as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=request-context-C3nCGJNd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-context-C3nCGJNd.js","names":[],"sources":["../src/http/request-context.ts"],"sourcesContent":["import type { Context } from 'hono';\nimport { InjectionToken } from '../container/types';\n\n// Per-request injectable populated by RouteManager. Carries a stable\n// request id, the raw Request, the Hono Context (escape hatch), and a\n// free-form bag for cross-cutting metadata that doesn't merit its own\n// injection token (locale, feature flags, trace ids, …). No\n// AsyncLocalStorage — request scope is carried by the per-request child\n// container.\nexport interface RequestContext {\n readonly id: string;\n readonly receivedAt: Date;\n readonly request: Request;\n readonly hono: Context;\n set<T>(key: string | symbol, value: T): void;\n get<T>(key: string | symbol): T | undefined;\n has(key: string | symbol): boolean;\n}\n\nexport const REQUEST_CONTEXT = new InjectionToken<RequestContext>('vela.RequestContext');\n\nexport function createRequestContext(c: Context): RequestContext {\n const bag = new Map<string | symbol, unknown>();\n const inboundId = c.req.raw.headers.get('x-request-id');\n const id = inboundId && inboundId.length > 0 ? inboundId : crypto.randomUUID();\n return {\n id,\n receivedAt: new Date(),\n request: c.req.raw,\n hono: c,\n set(key, value) {\n bag.set(key, value);\n },\n get<T>(key: string | symbol): T | undefined {\n return bag.get(key) as T | undefined;\n },\n has(key) {\n return bag.has(key);\n },\n };\n}\n"],"mappings":";;AAmBA,MAAa,kBAAkB,IAAI,eAA+B,qBAAqB;AAEvF,SAAgB,qBAAqB,GAA4B;CAC/D,MAAM,sBAAM,IAAI,IAA8B;CAC9C,MAAM,YAAY,EAAE,IAAI,IAAI,QAAQ,IAAI,cAAc;CAEtD,OAAO;EACL,IAFS,aAAa,UAAU,SAAS,IAAI,YAAY,OAAO,WAAW;EAG3E,4BAAY,IAAI,KAAK;EACrB,SAAS,EAAE,IAAI;EACf,MAAM;EACN,IAAI,KAAK,OAAO;GACd,IAAI,IAAI,KAAK,KAAK;EACpB;EACA,IAAO,KAAqC;GAC1C,OAAO,IAAI,IAAI,GAAG;EACpB;EACA,IAAI,KAAK;GACP,OAAO,IAAI,IAAI,GAAG;EACpB;CACF;AACF"}
|