@velajs/vela 1.19.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 +22 -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 -70
- package/dist/index.js +14 -76
- 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 +66 -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 -104
- package/dist/application.js +0 -364
- 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 -63
- package/dist/errors/http-exception.js +0 -142
- 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/exceptions/errors.module.d.ts +0 -40
- package/dist/exceptions/errors.module.js +0 -46
- package/dist/exceptions/exception-handler.d.ts +0 -56
- package/dist/exceptions/exception-handler.js +0 -17
- package/dist/exceptions/index.d.ts +0 -6
- package/dist/exceptions/index.js +0 -3
- package/dist/exceptions/reporter.d.ts +0 -21
- package/dist/exceptions/reporter.js +0 -70
- 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 -110
- 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 -133
- 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 -88
- package/dist/live/live.engine.js +0 -471
- 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 -57
- package/dist/pipeline/tokens.js +0 -47
- 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 -60
- 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 -109
- 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 -112
- 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 -343
- package/dist/websocket/ws-exception.d.ts +0 -25
- package/dist/websocket/ws-exception.js +0 -42
- 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/http/decorators.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { HttpMethod, ParamType, Scope } from "../constants.js";
|
|
2
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
3
|
-
import { normalizePath } from "../registry/paths.js";
|
|
4
|
-
import { buildExecutionContext } from "./execution-context.js";
|
|
5
|
-
/**
|
|
6
|
-
* Marks a class as a controller.
|
|
7
|
-
* Accepts a path string or an options object with `path` and `version`.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* @Controller('/users')
|
|
12
|
-
* @Controller({ path: '/users', version: 1 })
|
|
13
|
-
* @Controller({ path: '/users', version: [1, 2] })
|
|
14
|
-
* ```
|
|
15
|
-
*/ export function Controller(pathOrOptions) {
|
|
16
|
-
return (target)=>{
|
|
17
|
-
const ctor = target;
|
|
18
|
-
const path = typeof pathOrOptions === 'string' ? pathOrOptions : pathOrOptions?.path ?? '';
|
|
19
|
-
const version = typeof pathOrOptions === 'object' ? pathOrOptions?.version : undefined;
|
|
20
|
-
MetadataRegistry.setControllerPath(ctor, normalizePath(path));
|
|
21
|
-
if (version !== undefined) {
|
|
22
|
-
MetadataRegistry.setControllerOptions(ctor, {
|
|
23
|
-
version
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
MetadataRegistry.markInjectable(ctor);
|
|
27
|
-
MetadataRegistry.setScope(ctor, Scope.SINGLETON);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Override the version for a specific route method.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* @Controller({ prefix: '/users', version: 1 })
|
|
36
|
-
* class UserController {
|
|
37
|
-
* @Get()
|
|
38
|
-
* listV1() { ... } // GET /v1/users
|
|
39
|
-
*
|
|
40
|
-
* @Version(2)
|
|
41
|
-
* @Get()
|
|
42
|
-
* listV2() { ... } // GET /v2/users
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/ export function Version(version) {
|
|
46
|
-
return (target, propertyKey, _descriptor)=>{
|
|
47
|
-
const ctor = target.constructor;
|
|
48
|
-
MetadataRegistry.setRouteVersion(ctor, propertyKey, version);
|
|
49
|
-
// If route was already registered (decorator ran after @Get), patch it.
|
|
50
|
-
const route = MetadataRegistry.getRoutes(ctor).find((r)=>r.handlerName === propertyKey);
|
|
51
|
-
if (route) {
|
|
52
|
-
route.version = version;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export function getRouteVersion(target, propertyKey) {
|
|
57
|
-
return MetadataRegistry.getRouteVersion(target, propertyKey);
|
|
58
|
-
}
|
|
59
|
-
function createMethodDecorator(method) {
|
|
60
|
-
return (path = '', options)=>{
|
|
61
|
-
return (target, propertyKey, _descriptor)=>{
|
|
62
|
-
const ctor = target.constructor;
|
|
63
|
-
const normalizedPath = normalizePath(path);
|
|
64
|
-
const version = MetadataRegistry.getRouteVersion(ctor, propertyKey);
|
|
65
|
-
MetadataRegistry.addRoute(ctor, {
|
|
66
|
-
method: method,
|
|
67
|
-
path: normalizedPath,
|
|
68
|
-
handlerName: propertyKey,
|
|
69
|
-
...version !== undefined ? {
|
|
70
|
-
version
|
|
71
|
-
} : {},
|
|
72
|
-
...options?.name !== undefined ? {
|
|
73
|
-
name: options.name
|
|
74
|
-
} : {}
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export const Get = createMethodDecorator(HttpMethod.GET);
|
|
80
|
-
export const Post = createMethodDecorator(HttpMethod.POST);
|
|
81
|
-
export const Put = createMethodDecorator(HttpMethod.PUT);
|
|
82
|
-
export const Patch = createMethodDecorator(HttpMethod.PATCH);
|
|
83
|
-
export const Delete = createMethodDecorator(HttpMethod.DELETE);
|
|
84
|
-
export const Options = createMethodDecorator(HttpMethod.OPTIONS);
|
|
85
|
-
export const Head = createMethodDecorator(HttpMethod.HEAD);
|
|
86
|
-
export const All = createMethodDecorator(HttpMethod.ALL);
|
|
87
|
-
export const Sse = createMethodDecorator(HttpMethod.GET);
|
|
88
|
-
// Parameter decorators
|
|
89
|
-
const CUSTOM_PARAM_TYPE = 'custom';
|
|
90
|
-
function createBuiltinParamDecorator(type) {
|
|
91
|
-
return (nameOrPipe, ...pipes)=>{
|
|
92
|
-
return (target, propertyKey, parameterIndex)=>{
|
|
93
|
-
if (propertyKey === undefined) {
|
|
94
|
-
throw new Error('Parameter decorators can only be used on method parameters');
|
|
95
|
-
}
|
|
96
|
-
let name;
|
|
97
|
-
let allPipes;
|
|
98
|
-
if (typeof nameOrPipe === 'string') {
|
|
99
|
-
name = nameOrPipe;
|
|
100
|
-
allPipes = pipes;
|
|
101
|
-
} else if (nameOrPipe !== undefined) {
|
|
102
|
-
name = undefined;
|
|
103
|
-
allPipes = [
|
|
104
|
-
nameOrPipe,
|
|
105
|
-
...pipes
|
|
106
|
-
];
|
|
107
|
-
} else {
|
|
108
|
-
name = undefined;
|
|
109
|
-
allPipes = pipes;
|
|
110
|
-
}
|
|
111
|
-
MetadataRegistry.addParameter(target.constructor, propertyKey, {
|
|
112
|
-
index: parameterIndex,
|
|
113
|
-
type,
|
|
114
|
-
name,
|
|
115
|
-
...allPipes.length > 0 ? {
|
|
116
|
-
pipes: allPipes
|
|
117
|
-
} : {}
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
export const Param = createBuiltinParamDecorator(ParamType.PARAM);
|
|
123
|
-
export const Query = createBuiltinParamDecorator(ParamType.QUERY);
|
|
124
|
-
export const Body = createBuiltinParamDecorator(ParamType.BODY);
|
|
125
|
-
export const Headers = createBuiltinParamDecorator(ParamType.HEADERS);
|
|
126
|
-
export const Req = createBuiltinParamDecorator(ParamType.REQUEST);
|
|
127
|
-
/**
|
|
128
|
-
* Injects the Hono `Context` as the response handle.
|
|
129
|
-
* In Hono, request and response state are unified in the `Context` object,
|
|
130
|
-
* so `@Res()` and `@Req()` both return it.
|
|
131
|
-
*
|
|
132
|
-
* Use `c.header()`, `c.setCookie()`, `c.redirect()`, etc. for response control.
|
|
133
|
-
*
|
|
134
|
-
* @example
|
|
135
|
-
* ```ts
|
|
136
|
-
* @Get('/set-cookie')
|
|
137
|
-
* handle(@Res() c: Context) {
|
|
138
|
-
* c.setCookie('session', 'abc123', { httpOnly: true });
|
|
139
|
-
* return { ok: true };
|
|
140
|
-
* }
|
|
141
|
-
* ```
|
|
142
|
-
*/ export const Res = createBuiltinParamDecorator(ParamType.RESPONSE);
|
|
143
|
-
export const Ip = createBuiltinParamDecorator(ParamType.IP);
|
|
144
|
-
export const Cookie = createBuiltinParamDecorator(ParamType.COOKIE);
|
|
145
|
-
/**
|
|
146
|
-
* Injects all cookies as a `Record<string, string>`, or a single cookie value by name.
|
|
147
|
-
*
|
|
148
|
-
* - `@Cookie()` — all cookies as an object
|
|
149
|
-
* - `@Cookie('token')` — the value of the `token` cookie
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```ts
|
|
153
|
-
* @Get('/me')
|
|
154
|
-
* handle(@Cookie('session') session: string) { ... }
|
|
155
|
-
* ```
|
|
156
|
-
*/ export const Cookies = Cookie;
|
|
157
|
-
/**
|
|
158
|
-
* Injects the raw request body as a `Uint8Array`.
|
|
159
|
-
* Useful for webhook HMAC verification (Stripe, GitHub, etc.) where you
|
|
160
|
-
* need the raw bytes before any JSON parsing.
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```ts
|
|
164
|
-
* @Post('/webhook')
|
|
165
|
-
* async handle(@RawBody() body: Uint8Array) {
|
|
166
|
-
* const sig = new TextDecoder().decode(body);
|
|
167
|
-
* // verify HMAC...
|
|
168
|
-
* }
|
|
169
|
-
* ```
|
|
170
|
-
*/ export function RawBody() {
|
|
171
|
-
return (target, propertyKey, parameterIndex)=>{
|
|
172
|
-
if (propertyKey === undefined) {
|
|
173
|
-
throw new Error('Parameter decorators can only be used on method parameters');
|
|
174
|
-
}
|
|
175
|
-
MetadataRegistry.addParameter(target.constructor, propertyKey, {
|
|
176
|
-
index: parameterIndex,
|
|
177
|
-
type: ParamType.RAW_BODY
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Factory for creating custom parameter decorators.
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```ts
|
|
186
|
-
* const CurrentUser = createParamDecorator(
|
|
187
|
-
* (data: unknown, ctx: ExecutionContext) => {
|
|
188
|
-
* const req = ctx.getRequest();
|
|
189
|
-
* return req.headers.get('x-user-id');
|
|
190
|
-
* }
|
|
191
|
-
* );
|
|
192
|
-
*
|
|
193
|
-
* // Usage:
|
|
194
|
-
* @Get()
|
|
195
|
-
* handle(@CurrentUser() userId: string) { ... }
|
|
196
|
-
*
|
|
197
|
-
* // With data argument:
|
|
198
|
-
* const Header = createParamDecorator(
|
|
199
|
-
* (data: string, ctx: ExecutionContext) => {
|
|
200
|
-
* return ctx.getRequest().headers.get(data);
|
|
201
|
-
* }
|
|
202
|
-
* );
|
|
203
|
-
*
|
|
204
|
-
* @Get()
|
|
205
|
-
* handle(@Header('x-request-id') requestId: string) { ... }
|
|
206
|
-
* ```
|
|
207
|
-
*/ export function createParamDecorator(factory) {
|
|
208
|
-
return (data, ...pipes)=>{
|
|
209
|
-
return (target, propertyKey, parameterIndex)=>{
|
|
210
|
-
if (propertyKey === undefined) {
|
|
211
|
-
throw new Error('Parameter decorators can only be used on method parameters');
|
|
212
|
-
}
|
|
213
|
-
MetadataRegistry.addParameter(target.constructor, propertyKey, {
|
|
214
|
-
index: parameterIndex,
|
|
215
|
-
type: CUSTOM_PARAM_TYPE,
|
|
216
|
-
name: undefined,
|
|
217
|
-
factory: (_unused, ctx)=>{
|
|
218
|
-
const honoCtx = ctx;
|
|
219
|
-
const execCtx = buildExecutionContext(honoCtx, target.constructor, propertyKey);
|
|
220
|
-
return factory(data, execCtx);
|
|
221
|
-
},
|
|
222
|
-
...pipes.length > 0 ? {
|
|
223
|
-
pipes
|
|
224
|
-
} : {}
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
// Response decorators
|
|
230
|
-
/**
|
|
231
|
-
* Override the HTTP status code for a handler's response.
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```ts
|
|
235
|
-
* @Post()
|
|
236
|
-
* @HttpCode(201)
|
|
237
|
-
* create(@Body() data: CreateDto) { return data; }
|
|
238
|
-
* ```
|
|
239
|
-
*/ export function HttpCode(statusCode) {
|
|
240
|
-
return (target, propertyKey, _descriptor)=>{
|
|
241
|
-
MetadataRegistry.setHandlerHttpMeta(target.constructor, propertyKey, {
|
|
242
|
-
httpCode: statusCode
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Set a response header declaratively.
|
|
248
|
-
* Can be applied multiple times to set multiple headers.
|
|
249
|
-
*
|
|
250
|
-
* @example
|
|
251
|
-
* ```ts
|
|
252
|
-
* @Get()
|
|
253
|
-
* @Header('Cache-Control', 'no-cache')
|
|
254
|
-
* @Header('X-Custom', 'value')
|
|
255
|
-
* handle() { return { ok: true }; }
|
|
256
|
-
* ```
|
|
257
|
-
*/ export function Header(name, value) {
|
|
258
|
-
return (target, propertyKey, _descriptor)=>{
|
|
259
|
-
MetadataRegistry.setHandlerHttpMeta(target.constructor, propertyKey, {
|
|
260
|
-
responseHeaders: [
|
|
261
|
-
[
|
|
262
|
-
name,
|
|
263
|
-
value
|
|
264
|
-
]
|
|
265
|
-
]
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Redirect to another URL. The handler's return value can override the URL.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* ```ts
|
|
274
|
-
* @Get('/old')
|
|
275
|
-
* @Redirect('/new', 301)
|
|
276
|
-
* handleOld() {}
|
|
277
|
-
*
|
|
278
|
-
* // Dynamic redirect — return { url, statusCode? } to override
|
|
279
|
-
* @Get('/go')
|
|
280
|
-
* @Redirect('/default')
|
|
281
|
-
* handleGo(@Query('to') to?: string) {
|
|
282
|
-
* if (to) return { url: to };
|
|
283
|
-
* }
|
|
284
|
-
* ```
|
|
285
|
-
*/ export function Redirect(url, statusCode = 302) {
|
|
286
|
-
return (target, propertyKey, _descriptor)=>{
|
|
287
|
-
MetadataRegistry.setHandlerHttpMeta(target.constructor, propertyKey, {
|
|
288
|
-
redirect: {
|
|
289
|
-
url,
|
|
290
|
-
statusCode
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
// Metadata readers (used by RouteManager)
|
|
296
|
-
export function getHttpCode(target, method) {
|
|
297
|
-
return MetadataRegistry.getHandlerHttpMeta(target, method)?.httpCode;
|
|
298
|
-
}
|
|
299
|
-
export function getResponseHeaders(target, method) {
|
|
300
|
-
return MetadataRegistry.getHandlerHttpMeta(target, method)?.responseHeaders ?? [];
|
|
301
|
-
}
|
|
302
|
-
export function getRedirect(target, method) {
|
|
303
|
-
return MetadataRegistry.getHandlerHttpMeta(target, method)?.redirect;
|
|
304
|
-
}
|
|
305
|
-
export function applyDecorators(...decorators) {
|
|
306
|
-
return (target, propertyKey, descriptor)=>{
|
|
307
|
-
for (const decorator of decorators){
|
|
308
|
-
if (propertyKey === undefined && typeof descriptor !== 'number') {
|
|
309
|
-
decorator(target);
|
|
310
|
-
} else if (typeof descriptor === 'number') {
|
|
311
|
-
decorator(target, propertyKey, descriptor);
|
|
312
|
-
} else {
|
|
313
|
-
decorator(target, propertyKey, descriptor);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
// Helpers
|
|
319
|
-
export function isController(target) {
|
|
320
|
-
return MetadataRegistry.getControllerPath(target) !== '' || MetadataRegistry.getRoutes(target).length > 0;
|
|
321
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Type } from '../container/types';
|
|
3
|
-
import type { ExecutionContext } from '../pipeline/types';
|
|
4
|
-
export declare function buildExecutionContext(c: Context, controller: Type, handlerName: string | symbol): ExecutionContext;
|
|
5
|
-
export declare class VelaMiddlewareHost {
|
|
6
|
-
}
|
|
7
|
-
export declare const VELA_MIDDLEWARE_HANDLER: unique symbol;
|
|
8
|
-
export declare function buildMiddlewareExecutionContext(c: Context): ExecutionContext;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Single source of ExecutionContext shape — used by the route pipeline AND
|
|
2
|
-
// by createParamDecorator's deferred factory call.
|
|
3
|
-
export function buildExecutionContext(c, controller, handlerName) {
|
|
4
|
-
return {
|
|
5
|
-
getType: ()=>'http',
|
|
6
|
-
getClass: ()=>controller,
|
|
7
|
-
getHandler: ()=>handlerName,
|
|
8
|
-
getContext: ()=>c,
|
|
9
|
-
getRequest: ()=>c.req.raw,
|
|
10
|
-
switchToHttp: ()=>({
|
|
11
|
-
getRequest: ()=>c.req.raw,
|
|
12
|
-
getResponse: ()=>c
|
|
13
|
-
}),
|
|
14
|
-
switchToWs: ()=>{
|
|
15
|
-
throw new Error('switchToWs() called on an HTTP ExecutionContext. This handler runs over HTTP, not a WebSocket gateway.');
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
// Sentinel marker exposed via `ExecutionContext.getClass()` when the host is a
|
|
20
|
-
// vela-attached middleware rather than a controller handler. Filters that
|
|
21
|
-
// branch on the calling class (rare) can detect the middleware origin without
|
|
22
|
-
// introducing a separate `getType()` value — `getType()` stays `'http'` for
|
|
23
|
-
// NestJS parity.
|
|
24
|
-
export class VelaMiddlewareHost {
|
|
25
|
-
}
|
|
26
|
-
// Synthesizes an ExecutionContext for an exception thrown inside a
|
|
27
|
-
// vela-attached middleware. There is no controller class or handler method
|
|
28
|
-
// on the call stack at that point, so `getClass()` returns the
|
|
29
|
-
// `VelaMiddlewareHost` marker and `getHandler()` returns the
|
|
30
|
-
// `vela.middleware` symbol — both stable, comparable values that filter
|
|
31
|
-
// authors can pattern-match against if needed.
|
|
32
|
-
export const VELA_MIDDLEWARE_HANDLER = Symbol.for('vela.middleware');
|
|
33
|
-
export function buildMiddlewareExecutionContext(c) {
|
|
34
|
-
return buildExecutionContext(c, VelaMiddlewareHost, VELA_MIDDLEWARE_HANDLER);
|
|
35
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Context } from 'hono';
|
|
2
|
-
import type { Container } from '../container/container';
|
|
3
|
-
import type { Token, Type } from '../container/types';
|
|
4
|
-
import type { CanActivate, ExceptionFilter, NestInterceptor, PipeTransform } from '../pipeline/types';
|
|
5
|
-
import type { FilterType, GuardType, InterceptorType, ParameterMetadata, PipeType } from '../registry/types';
|
|
6
|
-
import type { ArgumentResolver } from './argument-resolver';
|
|
7
|
-
import type { RouteMetadata } from './types';
|
|
8
|
-
export interface HandlerGlobals {
|
|
9
|
-
guards: Array<GuardType | Token<CanActivate>>;
|
|
10
|
-
pipes: Array<PipeType | Token<PipeTransform>>;
|
|
11
|
-
interceptors: Array<InterceptorType | Token<NestInterceptor>>;
|
|
12
|
-
filters: Array<FilterType | Token<ExceptionFilter>>;
|
|
13
|
-
}
|
|
14
|
-
export declare class HandlerExecutor {
|
|
15
|
-
private readonly argumentResolver;
|
|
16
|
-
private readonly getGlobals;
|
|
17
|
-
private readonly getRequestContainer;
|
|
18
|
-
constructor(argumentResolver: ArgumentResolver, getGlobals: () => HandlerGlobals, getRequestContainer: (c: Context) => Container);
|
|
19
|
-
create(route: RouteMetadata, controller: Type, allParamMetadata: Map<string | symbol, ParameterMetadata[]>): (c: Context) => Promise<Response>;
|
|
20
|
-
}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { STATUS_TO_CODE, toErrorBody } from "@velajs/errors";
|
|
2
|
-
import { HttpException } from "../errors/http-exception.js";
|
|
3
|
-
import { resolveErrorReporter } from "../exceptions/reporter.js";
|
|
4
|
-
import { ComponentManager } from "../pipeline/component.manager.js";
|
|
5
|
-
import { shouldFilterCatch } from "../pipeline/decorators.js";
|
|
6
|
-
import { PipelineRunner } from "../pipeline/pipeline-runner.js";
|
|
7
|
-
import { getHttpCode, getRedirect, getResponseHeaders } from "./decorators.js";
|
|
8
|
-
import { buildExecutionContext } from "./execution-context.js";
|
|
9
|
-
import { instantiateMany } from "./instantiate.js";
|
|
10
|
-
import { applyResponseHeaders, mapRedirect, mapResponse } from "./response-mapper.js";
|
|
11
|
-
// Builds the per-request closure that runs guards, pipes, interceptors, the
|
|
12
|
-
// handler itself, and exception filters. Pure orchestration — Hono route
|
|
13
|
-
// registration stays in RouteManager. Globals are read via a callback so
|
|
14
|
-
// post-create additions (`useGlobalGuards`, etc.) propagate to subsequent
|
|
15
|
-
// requests without rebuilding routes.
|
|
16
|
-
export class HandlerExecutor {
|
|
17
|
-
argumentResolver;
|
|
18
|
-
getGlobals;
|
|
19
|
-
getRequestContainer;
|
|
20
|
-
constructor(argumentResolver, getGlobals, getRequestContainer){
|
|
21
|
-
this.argumentResolver = argumentResolver;
|
|
22
|
-
this.getGlobals = getGlobals;
|
|
23
|
-
this.getRequestContainer = getRequestContainer;
|
|
24
|
-
}
|
|
25
|
-
create(route, controller, allParamMetadata) {
|
|
26
|
-
const paramMetadata = (allParamMetadata.get(route.handlerName) || []).sort((a, b)=>a.index - b.index);
|
|
27
|
-
// Read param types once at build time for metatype population.
|
|
28
|
-
// Routed via Reflect so the polyfill funnels both src-level and dist-level
|
|
29
|
-
// consumers to the same registry (matters in tests that import from dist).
|
|
30
|
-
const paramTypes = Reflect.getMetadata('design:paramtypes', controller.prototype, route.handlerName);
|
|
31
|
-
const methodGuards = ComponentManager.getScopedComponents('guard', controller, route.handlerName);
|
|
32
|
-
const methodPipes = ComponentManager.getScopedComponents('pipe', controller, route.handlerName);
|
|
33
|
-
const methodInterceptors = ComponentManager.getScopedComponents('interceptor', controller, route.handlerName);
|
|
34
|
-
// Filters: reverse order (handler → controller → global) — closest to handler runs first
|
|
35
|
-
const methodFilters = [
|
|
36
|
-
...ComponentManager.getScopedComponents('filter', controller, route.handlerName)
|
|
37
|
-
].reverse();
|
|
38
|
-
const httpCode = getHttpCode(controller, route.handlerName);
|
|
39
|
-
const responseHeaders = getResponseHeaders(controller, route.handlerName);
|
|
40
|
-
const redirect = getRedirect(controller, route.handlerName);
|
|
41
|
-
return async (c)=>{
|
|
42
|
-
// Combine global + method at request time so post-create registrations propagate.
|
|
43
|
-
const requestContainer = this.getRequestContainer(c);
|
|
44
|
-
const globals = this.getGlobals();
|
|
45
|
-
const guards = [
|
|
46
|
-
...instantiateMany(globals.guards, requestContainer),
|
|
47
|
-
...instantiateMany(methodGuards, requestContainer)
|
|
48
|
-
];
|
|
49
|
-
const pipes = [
|
|
50
|
-
...instantiateMany(globals.pipes, requestContainer),
|
|
51
|
-
...instantiateMany(methodPipes, requestContainer)
|
|
52
|
-
];
|
|
53
|
-
const interceptors = [
|
|
54
|
-
...instantiateMany(globals.interceptors, requestContainer),
|
|
55
|
-
...instantiateMany(methodInterceptors, requestContainer)
|
|
56
|
-
];
|
|
57
|
-
const filters = [
|
|
58
|
-
...instantiateMany(methodFilters, requestContainer),
|
|
59
|
-
...instantiateMany(globals.filters, requestContainer)
|
|
60
|
-
];
|
|
61
|
-
const executionContext = buildExecutionContext(c, controller, route.handlerName);
|
|
62
|
-
try {
|
|
63
|
-
const instance = requestContainer.resolve(controller);
|
|
64
|
-
const method = Reflect.get(instance, route.handlerName);
|
|
65
|
-
if (typeof method !== 'function') {
|
|
66
|
-
throw new Error(`Method ${String(route.handlerName)} not found on controller`);
|
|
67
|
-
}
|
|
68
|
-
// Args + pipes → guards → interceptor chain → handler, via the shared
|
|
69
|
-
// runner. `argsBeforeGuards` preserves the deliberate vela HTTP order.
|
|
70
|
-
const result = await PipelineRunner.run({
|
|
71
|
-
context: executionContext,
|
|
72
|
-
guards,
|
|
73
|
-
interceptors,
|
|
74
|
-
argsBeforeGuards: true,
|
|
75
|
-
resolveArgs: ()=>this.argumentResolver.extract(c, paramMetadata, pipes, requestContainer, paramTypes),
|
|
76
|
-
invoke: async (args)=>Reflect.apply(method, instance, args)
|
|
77
|
-
});
|
|
78
|
-
if (redirect) {
|
|
79
|
-
return mapRedirect(c, result, redirect);
|
|
80
|
-
}
|
|
81
|
-
const response = mapResponse(c, result, httpCode);
|
|
82
|
-
applyResponseHeaders(response, responseHeaders);
|
|
83
|
-
return response;
|
|
84
|
-
} catch (error) {
|
|
85
|
-
const reporter = resolveErrorReporter(requestContainer);
|
|
86
|
-
const source = `${controller.name}.${String(route.handlerName)}`;
|
|
87
|
-
// Report FIRST, always — rendering (filters included) is a separate
|
|
88
|
-
// concern; a filter claiming the error must not make it invisible.
|
|
89
|
-
reporter.report(error, {
|
|
90
|
-
edge: 'http',
|
|
91
|
-
source
|
|
92
|
-
});
|
|
93
|
-
for (const filter of filters){
|
|
94
|
-
if (shouldFilterCatch(filter, error)) {
|
|
95
|
-
try {
|
|
96
|
-
const filtered = await filter.catch(error, executionContext);
|
|
97
|
-
return mapResponse(c, filtered);
|
|
98
|
-
} catch (filterError) {
|
|
99
|
-
// A broken filter is itself a bug worth logs — then fall through
|
|
100
|
-
// to the default render instead of silently dying here.
|
|
101
|
-
reporter.report(filterError, {
|
|
102
|
-
edge: 'http',
|
|
103
|
-
source,
|
|
104
|
-
note: 'exception filter threw'
|
|
105
|
-
});
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
const rendered = reporter.render(error, executionContext);
|
|
111
|
-
if (rendered instanceof Response) return rendered;
|
|
112
|
-
if (rendered) return c.json(rendered.body, rendered.status);
|
|
113
|
-
if (error instanceof HttpException) {
|
|
114
|
-
const status = error.getStatus();
|
|
115
|
-
const raw = error.getRawResponse() ?? error.message;
|
|
116
|
-
if (typeof raw === 'string') {
|
|
117
|
-
return c.json({
|
|
118
|
-
error: {
|
|
119
|
-
code: STATUS_TO_CODE[status] ?? 'internal',
|
|
120
|
-
message: raw
|
|
121
|
-
}
|
|
122
|
-
}, status);
|
|
123
|
-
}
|
|
124
|
-
return c.json(raw, status); // object responses ship verbatim (crud envelope compat)
|
|
125
|
-
}
|
|
126
|
-
const { body, status } = toErrorBody(error, {
|
|
127
|
-
catalog: reporter.catalog
|
|
128
|
-
});
|
|
129
|
-
return c.json(body, status);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
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;
|