@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
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { HttpException } from "../errors/http-exception.js";
|
|
2
|
-
import { ComponentManager } from "../pipeline/component.manager.js";
|
|
3
|
-
import { shouldFilterCatch } from "../pipeline/decorators.js";
|
|
4
|
-
import { PipelineRunner } from "../pipeline/pipeline-runner.js";
|
|
5
|
-
import { getHttpCode, getRedirect, getResponseHeaders } from "./decorators.js";
|
|
6
|
-
import { buildExecutionContext } from "./execution-context.js";
|
|
7
|
-
import { instantiateMany } from "./instantiate.js";
|
|
8
|
-
import { applyResponseHeaders, mapRedirect, mapResponse } from "./response-mapper.js";
|
|
9
|
-
// Builds the per-request closure that runs guards, pipes, interceptors, the
|
|
10
|
-
// handler itself, and exception filters. Pure orchestration — Hono route
|
|
11
|
-
// registration stays in RouteManager. Globals are read via a callback so
|
|
12
|
-
// post-create additions (`useGlobalGuards`, etc.) propagate to subsequent
|
|
13
|
-
// requests without rebuilding routes.
|
|
14
|
-
export class HandlerExecutor {
|
|
15
|
-
argumentResolver;
|
|
16
|
-
getGlobals;
|
|
17
|
-
getRequestContainer;
|
|
18
|
-
constructor(argumentResolver, getGlobals, getRequestContainer){
|
|
19
|
-
this.argumentResolver = argumentResolver;
|
|
20
|
-
this.getGlobals = getGlobals;
|
|
21
|
-
this.getRequestContainer = getRequestContainer;
|
|
22
|
-
}
|
|
23
|
-
create(route, controller, allParamMetadata) {
|
|
24
|
-
const paramMetadata = (allParamMetadata.get(route.handlerName) || []).sort((a, b)=>a.index - b.index);
|
|
25
|
-
// Read param types once at build time for metatype population.
|
|
26
|
-
// Routed via Reflect so the polyfill funnels both src-level and dist-level
|
|
27
|
-
// consumers to the same registry (matters in tests that import from dist).
|
|
28
|
-
const paramTypes = Reflect.getMetadata('design:paramtypes', controller.prototype, route.handlerName);
|
|
29
|
-
const methodGuards = ComponentManager.getScopedComponents('guard', controller, route.handlerName);
|
|
30
|
-
const methodPipes = ComponentManager.getScopedComponents('pipe', controller, route.handlerName);
|
|
31
|
-
const methodInterceptors = ComponentManager.getScopedComponents('interceptor', controller, route.handlerName);
|
|
32
|
-
// Filters: reverse order (handler → controller → global) — closest to handler runs first
|
|
33
|
-
const methodFilters = [
|
|
34
|
-
...ComponentManager.getScopedComponents('filter', controller, route.handlerName)
|
|
35
|
-
].reverse();
|
|
36
|
-
const httpCode = getHttpCode(controller, route.handlerName);
|
|
37
|
-
const responseHeaders = getResponseHeaders(controller, route.handlerName);
|
|
38
|
-
const redirect = getRedirect(controller, route.handlerName);
|
|
39
|
-
return async (c)=>{
|
|
40
|
-
// Combine global + method at request time so post-create registrations propagate.
|
|
41
|
-
const requestContainer = this.getRequestContainer(c);
|
|
42
|
-
const globals = this.getGlobals();
|
|
43
|
-
const guards = [
|
|
44
|
-
...instantiateMany(globals.guards, requestContainer),
|
|
45
|
-
...instantiateMany(methodGuards, requestContainer)
|
|
46
|
-
];
|
|
47
|
-
const pipes = [
|
|
48
|
-
...instantiateMany(globals.pipes, requestContainer),
|
|
49
|
-
...instantiateMany(methodPipes, requestContainer)
|
|
50
|
-
];
|
|
51
|
-
const interceptors = [
|
|
52
|
-
...instantiateMany(globals.interceptors, requestContainer),
|
|
53
|
-
...instantiateMany(methodInterceptors, requestContainer)
|
|
54
|
-
];
|
|
55
|
-
const filters = [
|
|
56
|
-
...instantiateMany(methodFilters, requestContainer),
|
|
57
|
-
...instantiateMany(globals.filters, requestContainer)
|
|
58
|
-
];
|
|
59
|
-
const executionContext = buildExecutionContext(c, controller, route.handlerName);
|
|
60
|
-
try {
|
|
61
|
-
const instance = requestContainer.resolve(controller);
|
|
62
|
-
const method = Reflect.get(instance, route.handlerName);
|
|
63
|
-
if (typeof method !== 'function') {
|
|
64
|
-
throw new Error(`Method ${String(route.handlerName)} not found on controller`);
|
|
65
|
-
}
|
|
66
|
-
// Args + pipes → guards → interceptor chain → handler, via the shared
|
|
67
|
-
// runner. `argsBeforeGuards` preserves the deliberate vela HTTP order.
|
|
68
|
-
const result = await PipelineRunner.run({
|
|
69
|
-
context: executionContext,
|
|
70
|
-
guards,
|
|
71
|
-
interceptors,
|
|
72
|
-
argsBeforeGuards: true,
|
|
73
|
-
resolveArgs: ()=>this.argumentResolver.extract(c, paramMetadata, pipes, requestContainer, paramTypes),
|
|
74
|
-
invoke: async (args)=>Reflect.apply(method, instance, args)
|
|
75
|
-
});
|
|
76
|
-
if (redirect) {
|
|
77
|
-
return mapRedirect(c, result, redirect);
|
|
78
|
-
}
|
|
79
|
-
const response = mapResponse(c, result, httpCode);
|
|
80
|
-
applyResponseHeaders(response, responseHeaders);
|
|
81
|
-
return response;
|
|
82
|
-
} catch (error) {
|
|
83
|
-
for (const filter of filters){
|
|
84
|
-
if (shouldFilterCatch(filter, error)) {
|
|
85
|
-
try {
|
|
86
|
-
const filtered = await filter.catch(error, executionContext);
|
|
87
|
-
return mapResponse(c, filtered);
|
|
88
|
-
} catch {
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (error instanceof HttpException) {
|
|
94
|
-
const response = error.getResponse();
|
|
95
|
-
const status = error.getStatus();
|
|
96
|
-
return c.json(response, status);
|
|
97
|
-
}
|
|
98
|
-
// An unknown error reaching here means no filter claimed it — never
|
|
99
|
-
// swallow it silently: the response is a generic 500, but the cause
|
|
100
|
-
// must land in the logs (diagnostics 'silent' opts out).
|
|
101
|
-
if (requestContainer.getDiagnostics() !== 'silent') {
|
|
102
|
-
console.error(`[vela] unhandled error in ${controller.name}.${String(route.handlerName)}:`, error);
|
|
103
|
-
}
|
|
104
|
-
return c.json({
|
|
105
|
-
statusCode: 500,
|
|
106
|
-
message: 'Internal Server Error'
|
|
107
|
-
}, 500);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
}
|
package/dist/http/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { RouteManager } from './route.manager';
|
|
2
|
-
export type { RouteManagerOptions } from './route.manager';
|
|
3
|
-
export { MiddlewareBuilder } from '../module/middleware';
|
|
4
|
-
export type { MiddlewareConsumer, MiddlewareConfigProxy, RouteInfo, NestModule, MiddlewareRouteDefinition } from '../module/middleware';
|
|
5
|
-
export { Controller, Version, Get, Post, Put, Patch, Delete, Options, Head, All, Sse, Param, Query, Body, Headers, Req, Res, Ip, Cookie, Cookies, RawBody, HttpCode, Header, Redirect, createParamDecorator, applyDecorators, isController, } from './decorators';
|
|
6
|
-
export type { RouteOptions } from './decorators';
|
|
7
|
-
export { createLazyParamDecorator } from './lazy-param.decorator';
|
|
8
|
-
export { UrlGeneratorService, SignedUrlGuard, SignedUrl, URL_SIGNING_SECRET, } from './url/index';
|
|
9
|
-
export type { UrlForOptions, SignedUrlGenerateOptions } from './url/index';
|
|
10
|
-
export type { VelaRouteMap, RouteName, RouteParams } from './route-map';
|
|
11
|
-
export { enableAmbientContainer, getCurrentContainer, getCurrentRequestContext, } from './ambient';
|
|
12
|
-
export type { RouteMetadata, ControllerMetadata, ControllerOptions, ParamMetadata, ControllerRegistration, } from './types';
|
package/dist/http/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { RouteManager } from "./route.manager.js";
|
|
2
|
-
export { MiddlewareBuilder } from "../module/middleware.js";
|
|
3
|
-
export { Controller, Version, Get, Post, Put, Patch, Delete, Options, Head, All, Sse, Param, Query, Body, Headers, Req, Res, Ip, Cookie, Cookies, RawBody, HttpCode, Header, Redirect, createParamDecorator, applyDecorators, isController } from "./decorators.js";
|
|
4
|
-
export { createLazyParamDecorator } from "./lazy-param.decorator.js";
|
|
5
|
-
// Named-route URL generation + signed URLs
|
|
6
|
-
export { UrlGeneratorService, SignedUrlGuard, SignedUrl, URL_SIGNING_SECRET } from "./url/index.js";
|
|
7
|
-
export { enableAmbientContainer, getCurrentContainer, getCurrentRequestContext } from "./ambient.js";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Container } from '../container/container';
|
|
2
|
-
import type { Token, Type } from '../container/types';
|
|
3
|
-
export declare function instantiate<T>(classOrInstance: Type<T> | Token<T> | T, container: Container): T;
|
|
4
|
-
export declare function instantiateMany<T>(items: Array<Type<T> | Token<T> | T>, container: Container): T[];
|
package/dist/http/instantiate.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getConstructorDependencies, getInjectMetadata } from "../container/decorators.js";
|
|
2
|
-
// Resolve a class/token through the container if registered, otherwise treat
|
|
3
|
-
// the input as a plain instance. Used by RouteManager and HandlerExecutor to
|
|
4
|
-
// materialize middleware, guards, pipes, interceptors, and filters per request.
|
|
5
|
-
//
|
|
6
|
-
// When the input is a class that is NOT registered in the container, we fall
|
|
7
|
-
// back to `new clazz()` so plain parameterless helper classes (e.g. mixin
|
|
8
|
-
// guards, ad-hoc `@UseGuards(LocalGuard)` references) keep working. That
|
|
9
|
-
// fallback is unsafe for classes whose CONSTRUCTOR EXPECTS DEPENDENCIES,
|
|
10
|
-
// because zero-arg construction would leave every injected slot `undefined`
|
|
11
|
-
// — a silent failure mode that surfaces later as
|
|
12
|
-
// `Cannot read properties of undefined (reading '...')` deep inside the
|
|
13
|
-
// class. For those classes we throw a loud, actionable error instead.
|
|
14
|
-
//
|
|
15
|
-
// We treat "expects dependencies" as: any `@Inject(...)` parameter metadata
|
|
16
|
-
// OR a non-empty `design:paramtypes` (the SWC/TS emit for any constructor
|
|
17
|
-
// parameter). `@Injectable()` alone is NOT sufficient — `mixin()` and many
|
|
18
|
-
// parameterless guards are `@Injectable()` and still safe to `new` directly.
|
|
19
|
-
export function instantiate(classOrInstance, container) {
|
|
20
|
-
if (typeof classOrInstance === 'function') {
|
|
21
|
-
const clazz = classOrInstance;
|
|
22
|
-
if (container.has(clazz)) {
|
|
23
|
-
return container.resolve(clazz);
|
|
24
|
-
}
|
|
25
|
-
if (constructorExpectsDependencies(clazz)) {
|
|
26
|
-
throw new Error(`Cannot instantiate ${clazz.name}: the class declares constructor ` + `dependencies (\`@Inject(...)\` parameters or typed constructor ` + `parameters), but no matching provider is registered in the ` + `container. Add it to a module's providers (and export it if used ` + `outside its declaring module) instead of relying on the bare ` + `\`new\` fallback, which would construct the class without ` + `honouring its dependency-injection metadata and leave every ` + `injected field \`undefined\`.`);
|
|
27
|
-
}
|
|
28
|
-
return new clazz();
|
|
29
|
-
}
|
|
30
|
-
if (container.has(classOrInstance)) {
|
|
31
|
-
return container.resolve(classOrInstance);
|
|
32
|
-
}
|
|
33
|
-
return classOrInstance;
|
|
34
|
-
}
|
|
35
|
-
// True when calling `new clazz()` would leave an injected slot `undefined`:
|
|
36
|
-
// either the class has explicit `@Inject(...)` metadata, or it has any typed
|
|
37
|
-
// constructor parameter (TS/SWC's `design:paramtypes` emit). Parameterless
|
|
38
|
-
// `@Injectable()` classes return false — `new()` is safe for them.
|
|
39
|
-
function constructorExpectsDependencies(clazz) {
|
|
40
|
-
if (getInjectMetadata(clazz).length > 0) return true;
|
|
41
|
-
return getConstructorDependencies(clazz).length > 0;
|
|
42
|
-
}
|
|
43
|
-
export function instantiateMany(items, container) {
|
|
44
|
-
return items.map((item)=>instantiate(item, container));
|
|
45
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { PipeType } from '../registry/types';
|
|
2
|
-
import type { ExecutionContext } from '../pipeline/types';
|
|
3
|
-
/**
|
|
4
|
-
* Factory for parameter decorators whose value materializes lazily — the
|
|
5
|
-
* factory does not run during argument extraction; it runs the first time
|
|
6
|
-
* the handler reads a property on the resolved value.
|
|
7
|
-
*
|
|
8
|
-
* Why this exists: vela's argument resolver runs *before* guards
|
|
9
|
-
* (handler-executor order: extract args → guards → handler). A custom
|
|
10
|
-
* `createParamDecorator` factory that depends on guard-populated state
|
|
11
|
-
* (e.g. a value a guard places into `REQUEST_CONTEXT`) therefore observes
|
|
12
|
-
* an empty slot. `createLazyParamDecorator` defers factory execution to
|
|
13
|
-
* first property access on the proxied result, by which point guards have
|
|
14
|
-
* run and the slot is populated.
|
|
15
|
-
*
|
|
16
|
-
* The proxy explicitly short-circuits `prop === 'then'` so `await value`
|
|
17
|
-
* does not consider the proxy a thenable, which would otherwise trigger
|
|
18
|
-
* eager resolution. This single invariant is what makes the helper safe to
|
|
19
|
-
* pass through `async` boundaries without surprise.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* const CurrentUser = createLazyParamDecorator(
|
|
24
|
-
* (_data: unknown, ctx: ExecutionContext) => {
|
|
25
|
-
* const reqCtx = ctx.getContext().get('container').resolve(REQUEST_CONTEXT);
|
|
26
|
-
* return reqCtx.get('user'); // populated by AuthGuard
|
|
27
|
-
* },
|
|
28
|
-
* );
|
|
29
|
-
*
|
|
30
|
-
* @UseGuards(AuthGuard)
|
|
31
|
-
* @Get('/me')
|
|
32
|
-
* me(@CurrentUser() user: User) {
|
|
33
|
-
* return { id: user.id }; // factory runs here, after AuthGuard
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function createLazyParamDecorator<TData = unknown>(factory: (data: TData, ctx: ExecutionContext) => unknown): (data?: TData, ...pipes: PipeType[]) => ParameterDecorator;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
2
|
-
import { buildExecutionContext } from "./execution-context.js";
|
|
3
|
-
const CUSTOM_PARAM_TYPE = 'custom';
|
|
4
|
-
/**
|
|
5
|
-
* Factory for parameter decorators whose value materializes lazily — the
|
|
6
|
-
* factory does not run during argument extraction; it runs the first time
|
|
7
|
-
* the handler reads a property on the resolved value.
|
|
8
|
-
*
|
|
9
|
-
* Why this exists: vela's argument resolver runs *before* guards
|
|
10
|
-
* (handler-executor order: extract args → guards → handler). A custom
|
|
11
|
-
* `createParamDecorator` factory that depends on guard-populated state
|
|
12
|
-
* (e.g. a value a guard places into `REQUEST_CONTEXT`) therefore observes
|
|
13
|
-
* an empty slot. `createLazyParamDecorator` defers factory execution to
|
|
14
|
-
* first property access on the proxied result, by which point guards have
|
|
15
|
-
* run and the slot is populated.
|
|
16
|
-
*
|
|
17
|
-
* The proxy explicitly short-circuits `prop === 'then'` so `await value`
|
|
18
|
-
* does not consider the proxy a thenable, which would otherwise trigger
|
|
19
|
-
* eager resolution. This single invariant is what makes the helper safe to
|
|
20
|
-
* pass through `async` boundaries without surprise.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* const CurrentUser = createLazyParamDecorator(
|
|
25
|
-
* (_data: unknown, ctx: ExecutionContext) => {
|
|
26
|
-
* const reqCtx = ctx.getContext().get('container').resolve(REQUEST_CONTEXT);
|
|
27
|
-
* return reqCtx.get('user'); // populated by AuthGuard
|
|
28
|
-
* },
|
|
29
|
-
* );
|
|
30
|
-
*
|
|
31
|
-
* @UseGuards(AuthGuard)
|
|
32
|
-
* @Get('/me')
|
|
33
|
-
* me(@CurrentUser() user: User) {
|
|
34
|
-
* return { id: user.id }; // factory runs here, after AuthGuard
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/ export function createLazyParamDecorator(factory) {
|
|
38
|
-
return (data, ...pipes)=>{
|
|
39
|
-
return (target, propertyKey, parameterIndex)=>{
|
|
40
|
-
if (propertyKey === undefined) {
|
|
41
|
-
throw new Error('Parameter decorators can only be used on method parameters');
|
|
42
|
-
}
|
|
43
|
-
MetadataRegistry.addParameter(target.constructor, propertyKey, {
|
|
44
|
-
index: parameterIndex,
|
|
45
|
-
type: CUSTOM_PARAM_TYPE,
|
|
46
|
-
name: undefined,
|
|
47
|
-
factory: (_unused, ctx)=>{
|
|
48
|
-
const honoCtx = ctx;
|
|
49
|
-
const execCtx = buildExecutionContext(honoCtx, target.constructor, propertyKey);
|
|
50
|
-
return createLazyProxy(()=>factory(data, execCtx));
|
|
51
|
-
},
|
|
52
|
-
...pipes.length > 0 ? {
|
|
53
|
-
pipes
|
|
54
|
-
} : {}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
// Single-shot resolution: the factory runs at most once; subsequent reads
|
|
60
|
-
// share the cached real value. The proxy's traps all funnel through
|
|
61
|
-
// `materialize` to keep that invariant in one place.
|
|
62
|
-
function createLazyProxy(produce) {
|
|
63
|
-
let resolved = false;
|
|
64
|
-
let value;
|
|
65
|
-
const materialize = ()=>{
|
|
66
|
-
if (!resolved) {
|
|
67
|
-
value = produce();
|
|
68
|
-
resolved = true;
|
|
69
|
-
}
|
|
70
|
-
return value;
|
|
71
|
-
};
|
|
72
|
-
// Target is an empty null-prototype object — proxies still need a
|
|
73
|
-
// backing target for the runtime to forward to, but using a real object
|
|
74
|
-
// would leak its own properties (`hasOwnProperty`, etc.) into trap
|
|
75
|
-
// results. `Object.create(null)` keeps the namespace clean.
|
|
76
|
-
const target = Object.create(null);
|
|
77
|
-
const handler = {
|
|
78
|
-
get (_t, prop, receiver) {
|
|
79
|
-
// Critical: do NOT report the proxy as thenable. If we let the JS
|
|
80
|
-
// runtime read `then` (during `await proxy`), the engine would
|
|
81
|
-
// observe a function-shaped value, treat the proxy as a promise,
|
|
82
|
-
// call `then(resolve, reject)` and trigger eager resolution before
|
|
83
|
-
// the consumer ever touches a real property. Returning `undefined`
|
|
84
|
-
// here makes `await proxy` return the proxy itself, untouched.
|
|
85
|
-
if (prop === 'then') return undefined;
|
|
86
|
-
const real = materialize();
|
|
87
|
-
if (real === null || real === undefined) return undefined;
|
|
88
|
-
const descriptor = Reflect.get(real, prop, receiver);
|
|
89
|
-
// Bind functions back to the real target so `this` works as the
|
|
90
|
-
// consumer expects on instance methods.
|
|
91
|
-
if (typeof descriptor === 'function') {
|
|
92
|
-
return descriptor.bind(real);
|
|
93
|
-
}
|
|
94
|
-
return descriptor;
|
|
95
|
-
},
|
|
96
|
-
has (_t, prop) {
|
|
97
|
-
const real = materialize();
|
|
98
|
-
return real !== null && real !== undefined && Reflect.has(real, prop);
|
|
99
|
-
},
|
|
100
|
-
ownKeys () {
|
|
101
|
-
const real = materialize();
|
|
102
|
-
if (real === null || real === undefined) return [];
|
|
103
|
-
return Reflect.ownKeys(real);
|
|
104
|
-
},
|
|
105
|
-
getOwnPropertyDescriptor (_t, prop) {
|
|
106
|
-
const real = materialize();
|
|
107
|
-
if (real === null || real === undefined) return undefined;
|
|
108
|
-
const descriptor = Reflect.getOwnPropertyDescriptor(real, prop);
|
|
109
|
-
// Proxy invariants require returned descriptors to be configurable
|
|
110
|
-
// when the underlying target lacks the property, which is always
|
|
111
|
-
// true for our null-prototype empty target.
|
|
112
|
-
if (descriptor) descriptor.configurable = true;
|
|
113
|
-
return descriptor;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
return new Proxy(target, handler);
|
|
117
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Container } from '../container/container';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the request-scoped child container for the current request.
|
|
5
|
-
*
|
|
6
|
-
* `@Inject(Container)` resolves the ROOT container (request children share the
|
|
7
|
-
* provider map and never rebind `Container`), so module authors who need
|
|
8
|
-
* request-scoped resolution from inside a handler, param-decorator factory, or
|
|
9
|
-
* scoped middleware must read the child seeded by RouteManager instead. The
|
|
10
|
-
* child is created before guards, pipes, params, and handlers run, so it is
|
|
11
|
-
* always present on the Vela request path.
|
|
12
|
-
*
|
|
13
|
-
* Throws outside a Vela-managed request rather than materializing an orphan
|
|
14
|
-
* child (mirrors the REQUEST_CONTEXT fail-fast).
|
|
15
|
-
*/
|
|
16
|
-
export declare function getRequestContainer(c: Context): Container;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the request-scoped child container for the current request.
|
|
3
|
-
*
|
|
4
|
-
* `@Inject(Container)` resolves the ROOT container (request children share the
|
|
5
|
-
* provider map and never rebind `Container`), so module authors who need
|
|
6
|
-
* request-scoped resolution from inside a handler, param-decorator factory, or
|
|
7
|
-
* scoped middleware must read the child seeded by RouteManager instead. The
|
|
8
|
-
* child is created before guards, pipes, params, and handlers run, so it is
|
|
9
|
-
* always present on the Vela request path.
|
|
10
|
-
*
|
|
11
|
-
* Throws outside a Vela-managed request rather than materializing an orphan
|
|
12
|
-
* child (mirrors the REQUEST_CONTEXT fail-fast).
|
|
13
|
-
*/ export function getRequestContainer(c) {
|
|
14
|
-
const container = c.get('container');
|
|
15
|
-
if (!container) {
|
|
16
|
-
throw new Error('getRequestContainer(c) can only be called inside a Vela-managed request — ' + 'the request child container is seeded by RouteManager when the request enters the pipeline.');
|
|
17
|
-
}
|
|
18
|
-
return container;
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import { InjectionToken } from '../container/types';
|
|
3
|
-
export interface RequestContext {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly receivedAt: Date;
|
|
6
|
-
readonly request: Request;
|
|
7
|
-
readonly hono: Context;
|
|
8
|
-
set<T>(key: string | symbol, value: T): void;
|
|
9
|
-
get<T>(key: string | symbol): T | undefined;
|
|
10
|
-
has(key: string | symbol): boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const REQUEST_CONTEXT: InjectionToken<RequestContext>;
|
|
13
|
-
export declare function createRequestContext(c: Context): RequestContext;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "../container/types.js";
|
|
2
|
-
export const REQUEST_CONTEXT = new InjectionToken('vela.RequestContext');
|
|
3
|
-
export function createRequestContext(c) {
|
|
4
|
-
const bag = new Map();
|
|
5
|
-
const inboundId = c.req.raw.headers.get('x-request-id');
|
|
6
|
-
const id = inboundId && inboundId.length > 0 ? inboundId : crypto.randomUUID();
|
|
7
|
-
return {
|
|
8
|
-
id,
|
|
9
|
-
receivedAt: 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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
export interface ResponseRedirect {
|
|
3
|
-
url: string;
|
|
4
|
-
statusCode: number;
|
|
5
|
-
}
|
|
6
|
-
export declare function mapResponse(c: Context, result: unknown, statusCode?: number): Response;
|
|
7
|
-
export declare function mapRedirect(c: Context, result: unknown, redirect: ResponseRedirect): Response;
|
|
8
|
-
export declare function applyResponseHeaders(response: Response, headers: Iterable<readonly [string, string]>): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// A handler returning `{ url, statusCode? }` may override the @Redirect-decorator
|
|
2
|
-
// destination — kept identical to the previous inline behavior.
|
|
3
|
-
function parseRedirectResult(result) {
|
|
4
|
-
if (typeof result !== 'object' || result === null) return undefined;
|
|
5
|
-
if (!('url' in result)) return undefined;
|
|
6
|
-
const obj = result;
|
|
7
|
-
if (typeof obj.url !== 'string') return undefined;
|
|
8
|
-
return {
|
|
9
|
-
url: obj.url,
|
|
10
|
-
...typeof obj.statusCode === 'number' ? {
|
|
11
|
-
statusCode: obj.statusCode
|
|
12
|
-
} : {}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
// Maps a controller return value to a Hono Response. `null`/`undefined` → 204
|
|
16
|
-
// (empty body); strings → text; anything else → JSON. A pre-built Response
|
|
17
|
-
// passes through unchanged.
|
|
18
|
-
export function mapResponse(c, result, statusCode) {
|
|
19
|
-
if (result instanceof Response) {
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
if (result === null || result === undefined) {
|
|
23
|
-
return c.body(null, statusCode ?? 204);
|
|
24
|
-
}
|
|
25
|
-
if (typeof result === 'string') {
|
|
26
|
-
return c.text(result, statusCode ?? 200);
|
|
27
|
-
}
|
|
28
|
-
return c.json(result, statusCode ?? 200);
|
|
29
|
-
}
|
|
30
|
-
// Honors @Redirect on the handler. If the handler returned `{ url, statusCode? }`,
|
|
31
|
-
// those override the decorator's defaults; otherwise the decorator wins.
|
|
32
|
-
export function mapRedirect(c, result, redirect) {
|
|
33
|
-
const overrides = parseRedirectResult(result);
|
|
34
|
-
const finalUrl = overrides?.url ?? redirect.url;
|
|
35
|
-
const finalStatus = overrides?.statusCode ?? redirect.statusCode;
|
|
36
|
-
return c.redirect(finalUrl, finalStatus);
|
|
37
|
-
}
|
|
38
|
-
export function applyResponseHeaders(response, headers) {
|
|
39
|
-
for (const [name, value] of headers){
|
|
40
|
-
response.headers.set(name, value);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { Hono } from 'hono';
|
|
2
|
-
import type { Container } from '../container/container';
|
|
3
|
-
import type { Type } from '../container/types';
|
|
4
|
-
import type { OpenApiPathItem } from '../openapi/types';
|
|
5
|
-
import type { CanActivate } from '../pipeline/types';
|
|
6
|
-
/**
|
|
7
|
-
* Context passed to {@link RouteContributor.buildRoutes} for each controller
|
|
8
|
-
* the contributor claims. The contributor receives the framework's resolved
|
|
9
|
-
* view of the world so generated routes behave identically to hand-written
|
|
10
|
-
* ones: same global prefix, same global guard instances, same path joining.
|
|
11
|
-
*/
|
|
12
|
-
export interface RouteContributorContext {
|
|
13
|
-
/** The claimed controller class. */
|
|
14
|
-
controller: Type;
|
|
15
|
-
/** Controller-level prefix as registered with `@Controller(...)`. */
|
|
16
|
-
controllerPrefix: string;
|
|
17
|
-
/** The metadata value (under `claimsMetaKey`) that claimed this controller. */
|
|
18
|
-
meta: unknown;
|
|
19
|
-
/** Application-wide path prefix (e.g. `/api`), already normalized. */
|
|
20
|
-
globalPrefix: string;
|
|
21
|
-
/** Global guard instances, pre-resolved from the root container. */
|
|
22
|
-
globalGuards: CanActivate[];
|
|
23
|
-
/** The app's root container — resolve controller/services from here. */
|
|
24
|
-
container: Container;
|
|
25
|
-
/** Path joiner used by the framework — handles slash normalization. */
|
|
26
|
-
joinPaths: (...parts: string[]) => string;
|
|
27
|
-
}
|
|
28
|
-
/** Context for {@link RouteContributor.buildOpenApiPaths}. */
|
|
29
|
-
export interface RouteContributorOpenApiContext {
|
|
30
|
-
controller: Type;
|
|
31
|
-
meta: unknown;
|
|
32
|
-
/** Application-wide path prefix (e.g. `/api`), already normalized. */
|
|
33
|
-
globalPrefix: string;
|
|
34
|
-
/** Controller-level prefix as registered with `@Controller(...)`. */
|
|
35
|
-
controllerPrefix: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* A route generator that claims controllers by class-level metadata and
|
|
39
|
-
* mounts routes for them — the public extension point behind `@Crud()` (and
|
|
40
|
-
* any future metadata-driven route generator: storage HTTP surfaces, admin
|
|
41
|
-
* panels, RPC bridges).
|
|
42
|
-
*
|
|
43
|
-
* Register once at import time (`registerRouteContributor`); the framework
|
|
44
|
-
* consults contributors during `RouteManager.build` — AFTER all explicit
|
|
45
|
-
* `@Get`/`@Post` routes, so generated `/:id` catch-alls never shadow custom
|
|
46
|
-
* routes — and during OpenAPI document generation.
|
|
47
|
-
*
|
|
48
|
-
* This contract exists instead of dynamic `import()` because esbuild leaves
|
|
49
|
-
* `await import(variable)` as a runtime import Cloudflare Workers cannot
|
|
50
|
-
* resolve.
|
|
51
|
-
*/
|
|
52
|
-
export interface RouteContributor {
|
|
53
|
-
/** Stable identifier; re-registering the same id overwrites (HMR-friendly). */
|
|
54
|
-
id: string;
|
|
55
|
-
/** Class-level metadata key whose presence claims a controller. */
|
|
56
|
-
claimsMetaKey: string;
|
|
57
|
-
buildRoutes(app: Hono, ctx: RouteContributorContext): void | Promise<void>;
|
|
58
|
-
buildOpenApiPaths?(ctx: RouteContributorOpenApiContext): Record<string, OpenApiPathItem>;
|
|
59
|
-
}
|
|
60
|
-
/** Register a contributor. Last registration per `id` wins. */
|
|
61
|
-
export declare function registerRouteContributor(contributor: RouteContributor): void;
|
|
62
|
-
/** All registered contributors (registration order). */
|
|
63
|
-
export declare function getRouteContributors(): RouteContributor[];
|
|
64
|
-
/**
|
|
65
|
-
* Reset all contributor registrations. Test-only.
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
export declare function _resetRouteContributors(): void;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Contributors register at import time (package side effect), so the store is
|
|
2
|
-
// anchored on `globalThis` like MetadataRegistry state: a Vite HMR re-eval
|
|
3
|
-
// reuses the same store instead of minting an empty one.
|
|
4
|
-
const STORE_KEY = Symbol.for('vela:route-contributors:v1');
|
|
5
|
-
function store() {
|
|
6
|
-
const g = globalThis;
|
|
7
|
-
return g[STORE_KEY] ??= new Map();
|
|
8
|
-
}
|
|
9
|
-
/** Register a contributor. Last registration per `id` wins. */ export function registerRouteContributor(contributor) {
|
|
10
|
-
store().set(contributor.id, contributor);
|
|
11
|
-
}
|
|
12
|
-
/** All registered contributors (registration order). */ export function getRouteContributors() {
|
|
13
|
-
return [
|
|
14
|
-
...store().values()
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Reset all contributor registrations. Test-only.
|
|
19
|
-
* @internal
|
|
20
|
-
*/ export function _resetRouteContributors() {
|
|
21
|
-
store().clear();
|
|
22
|
-
}
|
package/dist/http/route-map.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Augmentable map of route name → its path params. Users opt in to type-safe
|
|
3
|
-
* URL generation by augmenting this interface — no build step, no codegen:
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* declare module '@velajs/vela' {
|
|
7
|
-
* interface VelaRouteMap {
|
|
8
|
-
* 'users.index': Record<string, never>;
|
|
9
|
-
* 'users.show': { id: string };
|
|
10
|
-
* }
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* Until augmented it stays empty, so `RouteName` falls back to `string` and
|
|
15
|
-
* `RouteParams<N>` to a loose `Record<string, string> | undefined` — untyped
|
|
16
|
-
* callers keep working unchanged.
|
|
17
|
-
*/
|
|
18
|
-
export interface VelaRouteMap {
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Every valid route name. Falls back to `string` when `VelaRouteMap` has not
|
|
22
|
-
* been augmented, so `urlFor`/`signedUrl` accept any name in an untyped app.
|
|
23
|
-
*/
|
|
24
|
-
export type RouteName = keyof VelaRouteMap extends never ? string : Extract<keyof VelaRouteMap, string>;
|
|
25
|
-
/**
|
|
26
|
-
* The params object required to build a named route's URL. When `VelaRouteMap`
|
|
27
|
-
* is augmented, resolves to the declared params shape for `N`; otherwise a
|
|
28
|
-
* loose `Record<string, string> | undefined`.
|
|
29
|
-
*/
|
|
30
|
-
export type RouteParams<N extends RouteName> = N extends keyof VelaRouteMap ? VelaRouteMap[N] : Record<string, string> | undefined;
|
package/dist/http/route-map.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// Zero-codegen, type-safe route names — mirrors the augmentation pattern from
|
|
2
|
-
// stratal `packages/core/src/router/route-map.ts` (MIT © Temitayo Fadojutimi).
|
|
3
|
-
// Adapted for vela: `VelaRouteMap` maps a route name directly to its params
|
|
4
|
-
// object (stratal wraps params in `{ params: … }`; vela keeps it flat to match
|
|
5
|
-
// the `urlFor(name, params)` call shape).
|
|
6
|
-
/**
|
|
7
|
-
* Augmentable map of route name → its path params. Users opt in to type-safe
|
|
8
|
-
* URL generation by augmenting this interface — no build step, no codegen:
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* declare module '@velajs/vela' {
|
|
12
|
-
* interface VelaRouteMap {
|
|
13
|
-
* 'users.index': Record<string, never>;
|
|
14
|
-
* 'users.show': { id: string };
|
|
15
|
-
* }
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* Until augmented it stays empty, so `RouteName` falls back to `string` and
|
|
20
|
-
* `RouteParams<N>` to a loose `Record<string, string> | undefined` — untyped
|
|
21
|
-
* callers keep working unchanged.
|
|
22
|
-
*/ // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- augmentable interface, intentionally empty until a consumer declares routes
|
|
23
|
-
/**
|
|
24
|
-
* The params object required to build a named route's URL. When `VelaRouteMap`
|
|
25
|
-
* is augmented, resolves to the declared params shape for `N`; otherwise a
|
|
26
|
-
* loose `Record<string, string> | undefined`.
|
|
27
|
-
*/ export { };
|