@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,92 +0,0 @@
|
|
|
1
|
-
import { type Context, type MiddlewareHandler, Hono } from 'hono';
|
|
2
|
-
import type { Container } from '../container/container';
|
|
3
|
-
import type { Token, Type } from '../container/types';
|
|
4
|
-
import type { MiddlewareRouteDefinition } from '../module/middleware';
|
|
5
|
-
import type { CanActivate, ExceptionFilter, NestInterceptor, NestMiddleware, PipeTransform } from '../pipeline/types';
|
|
6
|
-
import type { FilterType, GuardType, InterceptorType, MiddlewareType, PipeType } from '../registry/types';
|
|
7
|
-
import type { ControllerRegistration } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* One explicit controller route as the framework registered it — recorded by
|
|
10
|
-
* `build()` with the SAME composed path handed to Hono (global prefix +
|
|
11
|
-
* version segment + controller prefix + route path), so introspection tooling
|
|
12
|
-
* (`vela route list`) never re-derives composition. Contributed routes
|
|
13
|
-
* (`RouteContributor`, e.g. `@velajs/crud`) mount directly on the Hono app
|
|
14
|
-
* and are not described here — diff `app.getHonoApp().routes` for those.
|
|
15
|
-
*/
|
|
16
|
-
export interface RouteDescription {
|
|
17
|
-
/** As declared on the handler — `@Head()` reports HEAD (Hono serves it under GET). */
|
|
18
|
-
method: string;
|
|
19
|
-
/** Fully composed path exactly as registered. */
|
|
20
|
-
path: string;
|
|
21
|
-
controller: string;
|
|
22
|
-
handler: string;
|
|
23
|
-
version?: number;
|
|
24
|
-
/** Route name (`@Get(path, { name })`) — the URL-generation / `operationId` key. */
|
|
25
|
-
name?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface RouteManagerOptions {
|
|
28
|
-
getClientIp?: (c: Context) => string | null;
|
|
29
|
-
middleware?: MiddlewareHandler[];
|
|
30
|
-
globalPrefix?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Opt into ambient request-container access (`getCurrentContainer()` /
|
|
33
|
-
* `getCurrentRequestContext()`). Registers Hono's `contextStorage()` as the
|
|
34
|
-
* first middleware. Off by default — the explicit child container is unchanged.
|
|
35
|
-
*/
|
|
36
|
-
ambientContainer?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export declare class RouteManager {
|
|
39
|
-
private container;
|
|
40
|
-
private static readonly METHOD_REGISTRAR;
|
|
41
|
-
private controllers;
|
|
42
|
-
private globalMiddleware;
|
|
43
|
-
private globalPipes;
|
|
44
|
-
private globalGuards;
|
|
45
|
-
private globalInterceptors;
|
|
46
|
-
private globalFilters;
|
|
47
|
-
private globalPrefix;
|
|
48
|
-
private consumerMiddlewareDefinitions;
|
|
49
|
-
private routeDescriptions;
|
|
50
|
-
private readonly handlerExecutor;
|
|
51
|
-
private readonly ambientContainer;
|
|
52
|
-
constructor(container: Container, options?: RouteManagerOptions);
|
|
53
|
-
/**
|
|
54
|
-
* The global-tier components (`APP_*` provider tokens + imperative
|
|
55
|
-
* `app.useGlobalX()` instances). Exposed so non-HTTP transports (the
|
|
56
|
-
* WebSocket dispatcher) can apply the same app-wide guards/pipes/interceptors/
|
|
57
|
-
* filters as HTTP routes, read live so late registrations propagate.
|
|
58
|
-
*/
|
|
59
|
-
getGlobalComponents(): {
|
|
60
|
-
guards: Array<GuardType | Token<CanActivate>>;
|
|
61
|
-
pipes: Array<PipeType | Token<PipeTransform>>;
|
|
62
|
-
interceptors: Array<InterceptorType | Token<NestInterceptor>>;
|
|
63
|
-
filters: Array<FilterType | Token<ExceptionFilter>>;
|
|
64
|
-
};
|
|
65
|
-
registerConsumerMiddleware(definitions: MiddlewareRouteDefinition[]): this;
|
|
66
|
-
setGlobalPrefix(prefix: string): this;
|
|
67
|
-
useGlobalMiddleware(...middleware: MiddlewareType[]): this;
|
|
68
|
-
useGlobalMiddlewareTokens(...middlewareTokens: Array<Token<NestMiddleware>>): this;
|
|
69
|
-
useGlobalPipes(...pipes: PipeType[]): this;
|
|
70
|
-
useGlobalPipeTokens(...pipeTokens: Array<Token<PipeTransform>>): this;
|
|
71
|
-
useGlobalGuards(...guards: GuardType[]): this;
|
|
72
|
-
useGlobalGuardTokens(...guardTokens: Array<Token<CanActivate>>): this;
|
|
73
|
-
useGlobalInterceptors(...interceptors: InterceptorType[]): this;
|
|
74
|
-
useGlobalInterceptorTokens(...interceptorTokens: Array<Token<NestInterceptor>>): this;
|
|
75
|
-
useGlobalFilters(...filters: FilterType[]): this;
|
|
76
|
-
useGlobalFilterTokens(...filterTokens: Array<Token<ExceptionFilter>>): this;
|
|
77
|
-
private getMiddlewarePriority;
|
|
78
|
-
private getRequestContainer;
|
|
79
|
-
private wrapMiddlewareWithFilters;
|
|
80
|
-
private mapMiddlewareError;
|
|
81
|
-
registerController(controller: Type): this;
|
|
82
|
-
/** The explicit controller routes recorded by the last `build()`. */
|
|
83
|
-
getRouteDescriptions(): RouteDescription[];
|
|
84
|
-
/** The global prefix in effect (set at bootstrap; '' when none). */
|
|
85
|
-
getGlobalPrefix(): string;
|
|
86
|
-
build(): Promise<Hono>;
|
|
87
|
-
private registerRoute;
|
|
88
|
-
private buildVersionedPaths;
|
|
89
|
-
private compilePathMatcher;
|
|
90
|
-
private compileRouteMatcher;
|
|
91
|
-
getControllers(): ControllerRegistration[];
|
|
92
|
-
}
|
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
import { Hono } from "hono";
|
|
2
|
-
import { contextStorage } from "hono/context-storage";
|
|
3
|
-
import { HttpMethod } from "../constants.js";
|
|
4
|
-
import { HttpException } from "../errors/http-exception.js";
|
|
5
|
-
import { getMetadata } from "../metadata.js";
|
|
6
|
-
import { joinPaths } from "../registry/paths.js";
|
|
7
|
-
import { ArgumentResolver } from "./argument-resolver.js";
|
|
8
|
-
import { getRouteContributors } from "./route-contributor.js";
|
|
9
|
-
import { buildMiddlewareExecutionContext } from "./execution-context.js";
|
|
10
|
-
import { HandlerExecutor } from "./handler-executor.js";
|
|
11
|
-
import { instantiate, instantiateMany } from "./instantiate.js";
|
|
12
|
-
import { REQUEST_CONTEXT, createRequestContext } from "./request-context.js";
|
|
13
|
-
import { mapResponse } from "./response-mapper.js";
|
|
14
|
-
import { ComponentManager } from "../pipeline/component.manager.js";
|
|
15
|
-
import { shouldFilterCatch } from "../pipeline/decorators.js";
|
|
16
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
17
|
-
const defaultGetClientIp = (c)=>c.req.raw.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? c.req.raw.headers.get('x-real-ip') ?? null;
|
|
18
|
-
// Mirror a response body stream, invoking `onDone` exactly once when it is fully
|
|
19
|
-
// read, errors, or is cancelled. Lets request-scoped resources be disposed only
|
|
20
|
-
// after the body has drained — never mid-stream.
|
|
21
|
-
function disposeStreamWhenDone(body, onDone) {
|
|
22
|
-
const reader = body.getReader();
|
|
23
|
-
let finished = false;
|
|
24
|
-
const finish = ()=>{
|
|
25
|
-
if (!finished) {
|
|
26
|
-
finished = true;
|
|
27
|
-
onDone();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
return new ReadableStream({
|
|
31
|
-
async pull (controller) {
|
|
32
|
-
try {
|
|
33
|
-
const { done, value } = await reader.read();
|
|
34
|
-
if (done) {
|
|
35
|
-
controller.close();
|
|
36
|
-
finish();
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
controller.enqueue(value);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
controller.error(error);
|
|
42
|
-
finish();
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
cancel (reason) {
|
|
46
|
-
finish();
|
|
47
|
-
return reader.cancel(reason);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
export class RouteManager {
|
|
52
|
-
container;
|
|
53
|
-
static METHOD_REGISTRAR = new Map([
|
|
54
|
-
[
|
|
55
|
-
HttpMethod.GET,
|
|
56
|
-
(app, p, h)=>app.get(p, h)
|
|
57
|
-
],
|
|
58
|
-
[
|
|
59
|
-
HttpMethod.POST,
|
|
60
|
-
(app, p, h)=>app.post(p, h)
|
|
61
|
-
],
|
|
62
|
-
[
|
|
63
|
-
HttpMethod.PUT,
|
|
64
|
-
(app, p, h)=>app.put(p, h)
|
|
65
|
-
],
|
|
66
|
-
[
|
|
67
|
-
HttpMethod.PATCH,
|
|
68
|
-
(app, p, h)=>app.patch(p, h)
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
HttpMethod.DELETE,
|
|
72
|
-
(app, p, h)=>app.delete(p, h)
|
|
73
|
-
],
|
|
74
|
-
[
|
|
75
|
-
HttpMethod.OPTIONS,
|
|
76
|
-
(app, p, h)=>app.options(p, h)
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
HttpMethod.HEAD,
|
|
80
|
-
(app, p, h)=>app.get(p, (c, next)=>c.req.method === 'HEAD' ? h(c) : next())
|
|
81
|
-
],
|
|
82
|
-
[
|
|
83
|
-
HttpMethod.ALL,
|
|
84
|
-
(app, p, h)=>app.all(p, h)
|
|
85
|
-
]
|
|
86
|
-
]);
|
|
87
|
-
controllers = [];
|
|
88
|
-
globalMiddleware = [];
|
|
89
|
-
globalPipes = [];
|
|
90
|
-
globalGuards = [];
|
|
91
|
-
globalInterceptors = [];
|
|
92
|
-
globalFilters = [];
|
|
93
|
-
globalPrefix = '';
|
|
94
|
-
consumerMiddlewareDefinitions = [];
|
|
95
|
-
routeDescriptions = [];
|
|
96
|
-
handlerExecutor;
|
|
97
|
-
ambientContainer;
|
|
98
|
-
constructor(container, options = {}){
|
|
99
|
-
this.container = container;
|
|
100
|
-
this.ambientContainer = options.ambientContainer ?? false;
|
|
101
|
-
const argumentResolver = new ArgumentResolver(options.getClientIp ?? defaultGetClientIp);
|
|
102
|
-
this.handlerExecutor = new HandlerExecutor(argumentResolver, ()=>({
|
|
103
|
-
guards: this.globalGuards,
|
|
104
|
-
pipes: this.globalPipes,
|
|
105
|
-
interceptors: this.globalInterceptors,
|
|
106
|
-
filters: this.globalFilters
|
|
107
|
-
}), (c)=>this.getRequestContainer(c));
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* The global-tier components (`APP_*` provider tokens + imperative
|
|
111
|
-
* `app.useGlobalX()` instances). Exposed so non-HTTP transports (the
|
|
112
|
-
* WebSocket dispatcher) can apply the same app-wide guards/pipes/interceptors/
|
|
113
|
-
* filters as HTTP routes, read live so late registrations propagate.
|
|
114
|
-
*/ getGlobalComponents() {
|
|
115
|
-
return {
|
|
116
|
-
guards: this.globalGuards,
|
|
117
|
-
pipes: this.globalPipes,
|
|
118
|
-
interceptors: this.globalInterceptors,
|
|
119
|
-
filters: this.globalFilters
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
registerConsumerMiddleware(definitions) {
|
|
123
|
-
this.consumerMiddlewareDefinitions.push(...definitions);
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
setGlobalPrefix(prefix) {
|
|
127
|
-
this.globalPrefix = prefix && !prefix.startsWith('/') ? `/${prefix}` : prefix;
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
useGlobalMiddleware(...middleware) {
|
|
131
|
-
this.globalMiddleware.push(...middleware);
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
useGlobalMiddlewareTokens(...middlewareTokens) {
|
|
135
|
-
this.globalMiddleware.push(...middlewareTokens);
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
useGlobalPipes(...pipes) {
|
|
139
|
-
this.globalPipes.push(...pipes);
|
|
140
|
-
return this;
|
|
141
|
-
}
|
|
142
|
-
useGlobalPipeTokens(...pipeTokens) {
|
|
143
|
-
this.globalPipes.push(...pipeTokens);
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
useGlobalGuards(...guards) {
|
|
147
|
-
this.globalGuards.push(...guards);
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
useGlobalGuardTokens(...guardTokens) {
|
|
151
|
-
this.globalGuards.push(...guardTokens);
|
|
152
|
-
return this;
|
|
153
|
-
}
|
|
154
|
-
useGlobalInterceptors(...interceptors) {
|
|
155
|
-
this.globalInterceptors.push(...interceptors);
|
|
156
|
-
return this;
|
|
157
|
-
}
|
|
158
|
-
useGlobalInterceptorTokens(...interceptorTokens) {
|
|
159
|
-
this.globalInterceptors.push(...interceptorTokens);
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
useGlobalFilters(...filters) {
|
|
163
|
-
this.globalFilters.push(...filters);
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
useGlobalFilterTokens(...filterTokens) {
|
|
167
|
-
this.globalFilters.push(...filterTokens);
|
|
168
|
-
return this;
|
|
169
|
-
}
|
|
170
|
-
getMiddlewarePriority(entry) {
|
|
171
|
-
if (entry == null) return 0;
|
|
172
|
-
if (typeof entry === 'function') {
|
|
173
|
-
const p = entry.priority;
|
|
174
|
-
if (typeof p === 'number') return p;
|
|
175
|
-
}
|
|
176
|
-
if (typeof entry === 'object') {
|
|
177
|
-
const inst = entry;
|
|
178
|
-
if (typeof inst.priority === 'number') return inst.priority;
|
|
179
|
-
if (typeof inst.constructor?.priority === 'number') return inst.constructor.priority;
|
|
180
|
-
}
|
|
181
|
-
// A token owned exclusively by unmaterialized lazy modules must not be
|
|
182
|
-
// instantiate-probed here — the probe at route build would defeat the
|
|
183
|
-
// module's deferral (i18n's APP_MIDDLEWARE). Default priority instead;
|
|
184
|
-
// the middleware still materializes on its first request.
|
|
185
|
-
if (this.container.isLazyPending(entry)) return 0;
|
|
186
|
-
try {
|
|
187
|
-
const resolved = instantiate(entry, this.container);
|
|
188
|
-
if (resolved && typeof resolved === 'object') {
|
|
189
|
-
const p = resolved.priority;
|
|
190
|
-
if (typeof p === 'number') return p;
|
|
191
|
-
const cp = resolved.constructor?.priority;
|
|
192
|
-
if (typeof cp === 'number') return cp;
|
|
193
|
-
}
|
|
194
|
-
} catch {
|
|
195
|
-
// Unresolvable at build time (e.g. request-scoped) — default 0
|
|
196
|
-
}
|
|
197
|
-
return 0;
|
|
198
|
-
}
|
|
199
|
-
getRequestContainer(c) {
|
|
200
|
-
const existing = c.get('container');
|
|
201
|
-
if (existing) {
|
|
202
|
-
return existing;
|
|
203
|
-
}
|
|
204
|
-
const child = this.container.createChild();
|
|
205
|
-
child.setRequestInstance(REQUEST_CONTEXT, createRequestContext(c));
|
|
206
|
-
c.set('container', child);
|
|
207
|
-
return child;
|
|
208
|
-
}
|
|
209
|
-
// Wraps an attached middleware so a thrown error flows through the
|
|
210
|
-
// exception-filter chain instead of bypassing it on the way to Hono's
|
|
211
|
-
// outer error handler. Mirrors the catch tail in HandlerExecutor — global
|
|
212
|
-
// filters are the only scope reachable here, since per-handler filters
|
|
213
|
-
// require a controller call frame that the middleware boundary lacks.
|
|
214
|
-
// Non-throwing middleware paths (returning a Response, calling `next()`,
|
|
215
|
-
// resolving a promise) are byte-identical to before — the wrapper only
|
|
216
|
-
// intercepts thrown / rejected values.
|
|
217
|
-
wrapMiddlewareWithFilters(handler) {
|
|
218
|
-
return async (c, next)=>{
|
|
219
|
-
try {
|
|
220
|
-
return await handler(c, next);
|
|
221
|
-
} catch (error) {
|
|
222
|
-
const response = await this.mapMiddlewareError(c, error);
|
|
223
|
-
// Force-replace any handler-set response. A middleware that throws
|
|
224
|
-
// *after* `await next()` has the handler's body already attached
|
|
225
|
-
// to `c.res`; without overwriting it, Hono would emit the
|
|
226
|
-
// pre-throw success response and the filter's render would be
|
|
227
|
-
// dropped.
|
|
228
|
-
c.res = response;
|
|
229
|
-
return response;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
async mapMiddlewareError(c, error) {
|
|
234
|
-
const requestContainer = this.getRequestContainer(c);
|
|
235
|
-
const filters = instantiateMany(this.globalFilters, requestContainer);
|
|
236
|
-
const host = buildMiddlewareExecutionContext(c);
|
|
237
|
-
for (const filter of filters){
|
|
238
|
-
if (shouldFilterCatch(filter, error)) {
|
|
239
|
-
try {
|
|
240
|
-
const filtered = await filter.catch(error, host);
|
|
241
|
-
return mapResponse(c, filtered);
|
|
242
|
-
} catch {
|
|
243
|
-
break;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
if (error instanceof HttpException) {
|
|
248
|
-
const response = error.getResponse();
|
|
249
|
-
const status = error.getStatus();
|
|
250
|
-
return c.json(response, status);
|
|
251
|
-
}
|
|
252
|
-
// Non-HttpException with no catching filter: re-throw so Hono's
|
|
253
|
-
// outer error handler produces the same default-500 response it
|
|
254
|
-
// produced before this wrapping was introduced.
|
|
255
|
-
throw error;
|
|
256
|
-
}
|
|
257
|
-
registerController(controller) {
|
|
258
|
-
const prefix = MetadataRegistry.getControllerPath(controller);
|
|
259
|
-
const options = MetadataRegistry.getControllerOptions(controller);
|
|
260
|
-
const routes = MetadataRegistry.getRoutes(controller);
|
|
261
|
-
// The ModuleLoader registers controllers in their owning module's bucket;
|
|
262
|
-
// fall back to a `__root__` registration only for controllers that arrive
|
|
263
|
-
// here outside the module-loading flow (test harnesses, custom adapters).
|
|
264
|
-
if (!this.container.has(controller)) {
|
|
265
|
-
this.container.register(controller);
|
|
266
|
-
}
|
|
267
|
-
this.controllers.push({
|
|
268
|
-
controller,
|
|
269
|
-
metadata: {
|
|
270
|
-
prefix,
|
|
271
|
-
version: options.version
|
|
272
|
-
},
|
|
273
|
-
routes: routes
|
|
274
|
-
});
|
|
275
|
-
return this;
|
|
276
|
-
}
|
|
277
|
-
/** The explicit controller routes recorded by the last `build()`. */ getRouteDescriptions() {
|
|
278
|
-
return [
|
|
279
|
-
...this.routeDescriptions
|
|
280
|
-
];
|
|
281
|
-
}
|
|
282
|
-
/** The global prefix in effect (set at bootstrap; '' when none). */ getGlobalPrefix() {
|
|
283
|
-
return this.globalPrefix;
|
|
284
|
-
}
|
|
285
|
-
async build() {
|
|
286
|
-
const app = new Hono();
|
|
287
|
-
this.routeDescriptions = [];
|
|
288
|
-
// Outermost: dispose the per-request child container once the request is
|
|
289
|
-
// fully done. Fast-paths out when the child has no request-scoped
|
|
290
|
-
// disposables (the common case → zero overhead / no behavior change).
|
|
291
|
-
// Streaming-safe: when a response body is present, disposal is deferred
|
|
292
|
-
// until the body is fully read (or errors/cancels), never mid-stream.
|
|
293
|
-
app.use('*', async (c, next)=>{
|
|
294
|
-
let threw = false;
|
|
295
|
-
try {
|
|
296
|
-
await next();
|
|
297
|
-
} catch (error) {
|
|
298
|
-
threw = true;
|
|
299
|
-
throw error;
|
|
300
|
-
} finally{
|
|
301
|
-
const child = c.get('container');
|
|
302
|
-
if (child?.hasDisposables()) {
|
|
303
|
-
const body = threw ? null : c.res?.body ?? null;
|
|
304
|
-
if (body) {
|
|
305
|
-
// Defer disposal to when the runtime finishes reading the body.
|
|
306
|
-
c.res = new Response(disposeStreamWhenDone(body, ()=>void child.dispose()), {
|
|
307
|
-
status: c.res.status,
|
|
308
|
-
statusText: c.res.statusText,
|
|
309
|
-
headers: c.res.headers
|
|
310
|
-
});
|
|
311
|
-
} else {
|
|
312
|
-
// No body (or error path) — nothing streaming, dispose now.
|
|
313
|
-
await child.dispose();
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
// Opt-in ambient container: contextStorage() must be an early middleware so
|
|
319
|
-
// getContext() is available to everything downstream.
|
|
320
|
-
if (this.ambientContainer) {
|
|
321
|
-
app.use('*', contextStorage());
|
|
322
|
-
}
|
|
323
|
-
// Sort global middleware by priority (lower runs first) with insertion
|
|
324
|
-
// index as tiebreaker so equal priorities preserve registration order.
|
|
325
|
-
const sortedGlobal = this.globalMiddleware.map((entry, index)=>({
|
|
326
|
-
entry,
|
|
327
|
-
index,
|
|
328
|
-
priority: this.getMiddlewarePriority(entry)
|
|
329
|
-
})).sort((a, b)=>a.priority - b.priority || a.index - b.index);
|
|
330
|
-
for (const { entry } of sortedGlobal){
|
|
331
|
-
app.use('*', this.wrapMiddlewareWithFilters((c, next)=>{
|
|
332
|
-
const requestContainer = this.getRequestContainer(c);
|
|
333
|
-
const resolved = instantiate(entry, requestContainer);
|
|
334
|
-
return resolved.use(c, next);
|
|
335
|
-
}));
|
|
336
|
-
}
|
|
337
|
-
const sortedConsumer = this.consumerMiddlewareDefinitions.map((def, index)=>({
|
|
338
|
-
def,
|
|
339
|
-
index,
|
|
340
|
-
priority: def.priority ?? 0
|
|
341
|
-
})).sort((a, b)=>a.priority - b.priority || a.index - b.index);
|
|
342
|
-
for (const { def } of sortedConsumer){
|
|
343
|
-
const matchRoute = this.compileRouteMatcher(def.routes);
|
|
344
|
-
const matchExclude = this.compileRouteMatcher(def.excludes);
|
|
345
|
-
app.use('*', this.wrapMiddlewareWithFilters((c, next)=>{
|
|
346
|
-
const path = c.req.path;
|
|
347
|
-
const method = c.req.method;
|
|
348
|
-
if (!matchRoute(path, method) || matchExclude(path, method)) return next();
|
|
349
|
-
const requestContainer = this.getRequestContainer(c);
|
|
350
|
-
const runChain = (index)=>{
|
|
351
|
-
if (index >= def.middleware.length) return next();
|
|
352
|
-
const instance = instantiate(def.middleware[index], requestContainer);
|
|
353
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
354
|
-
return instance.use(c, ()=>runChain(index + 1)).then(()=>{});
|
|
355
|
-
};
|
|
356
|
-
return runChain(0);
|
|
357
|
-
}));
|
|
358
|
-
}
|
|
359
|
-
// First pass: register all custom routes (must come before CRUD /:id routes).
|
|
360
|
-
for (const { controller, metadata, routes } of this.controllers){
|
|
361
|
-
if (routes.length > 0) {
|
|
362
|
-
const allParamMetadata = MetadataRegistry.getParameters(controller);
|
|
363
|
-
for (const route of routes){
|
|
364
|
-
const effectiveVersion = route.version ?? metadata.version;
|
|
365
|
-
const versionedPaths = this.buildVersionedPaths(this.globalPrefix, metadata.prefix, route.path, effectiveVersion);
|
|
366
|
-
// Parallel to versionedPaths: buildVersionedPaths maps versions to
|
|
367
|
-
// paths 1:1 in order, so index i of both arrays belongs together.
|
|
368
|
-
const versionsForPaths = effectiveVersion === undefined ? [
|
|
369
|
-
undefined
|
|
370
|
-
] : Array.isArray(effectiveVersion) ? effectiveVersion : [
|
|
371
|
-
effectiveVersion
|
|
372
|
-
];
|
|
373
|
-
// Scoped (controller/handler) middleware only — global middleware is
|
|
374
|
-
// applied once by this manager's own global pass, never re-read here.
|
|
375
|
-
const middlewareItems = ComponentManager.getScopedComponents('middleware', controller, route.handlerName);
|
|
376
|
-
const handler = this.handlerExecutor.create(route, controller, allParamMetadata);
|
|
377
|
-
for (const [pathIndex, fullPath] of versionedPaths.entries()){
|
|
378
|
-
for (const middlewareItem of middlewareItems){
|
|
379
|
-
app.use(fullPath, this.wrapMiddlewareWithFilters((c, next)=>{
|
|
380
|
-
const requestContainer = this.getRequestContainer(c);
|
|
381
|
-
const resolved = instantiate(middlewareItem, requestContainer);
|
|
382
|
-
return resolved.use(c, next);
|
|
383
|
-
}));
|
|
384
|
-
}
|
|
385
|
-
this.registerRoute(app, route.method, fullPath, handler);
|
|
386
|
-
this.routeDescriptions.push({
|
|
387
|
-
method: String(route.method),
|
|
388
|
-
path: fullPath || '/',
|
|
389
|
-
controller: controller.name,
|
|
390
|
-
handler: String(route.handlerName),
|
|
391
|
-
version: versionsForPaths[pathIndex],
|
|
392
|
-
...route.name !== undefined ? {
|
|
393
|
-
name: route.name
|
|
394
|
-
} : {}
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
// Second pass: route contributors (generated routes registered last, so a
|
|
401
|
-
// contributor's `/:id` catch-alls never shadow explicit routes). Each
|
|
402
|
-
// contributor claims controllers by class-level metadata; `@velajs/crud`
|
|
403
|
-
// registers one as an import side effect. The registry contract (instead
|
|
404
|
-
// of dynamic `import()`) exists because esbuild leaves
|
|
405
|
-
// `await import(variable)` as a runtime import Cloudflare Workers cannot
|
|
406
|
-
// resolve.
|
|
407
|
-
const contributors = getRouteContributors();
|
|
408
|
-
for (const { controller, metadata, routes } of this.controllers){
|
|
409
|
-
for (const contributor of contributors){
|
|
410
|
-
const meta = getMetadata(contributor.claimsMetaKey, controller);
|
|
411
|
-
if (meta === undefined) continue;
|
|
412
|
-
await contributor.buildRoutes(app, {
|
|
413
|
-
controller,
|
|
414
|
-
controllerPrefix: metadata.prefix,
|
|
415
|
-
meta,
|
|
416
|
-
globalPrefix: this.globalPrefix,
|
|
417
|
-
globalGuards: instantiateMany(this.globalGuards, this.container),
|
|
418
|
-
container: this.container,
|
|
419
|
-
joinPaths
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
// DX warning for stale setups: @Crud() metadata but nothing produced a
|
|
423
|
-
// route — native @velajs/crud (>=1.18) stamps real routes at decoration
|
|
424
|
-
// time, and legacy bridges register a claiming contributor.
|
|
425
|
-
if (getMetadata('vela:crud', controller) !== undefined && routes.length === 0 && !contributors.some((c)=>c.claimsMetaKey === 'vela:crud')) {
|
|
426
|
-
console.warn(`[vela] ${controller.name} carries @Crud() metadata but produced no routes — ` + "install and import '@velajs/crud' (>=1.18), or remove the decorator.");
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
return app;
|
|
430
|
-
}
|
|
431
|
-
registerRoute(app, method, path, handler) {
|
|
432
|
-
const normalizedPath = path || '/';
|
|
433
|
-
const registrar = RouteManager.METHOD_REGISTRAR.get(method);
|
|
434
|
-
if (registrar) {
|
|
435
|
-
registrar(app, normalizedPath, handler);
|
|
436
|
-
} else {
|
|
437
|
-
app.on(method, normalizedPath, handler);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
buildVersionedPaths(globalPrefix, controllerPrefix, routePath, version) {
|
|
441
|
-
if (version === undefined) {
|
|
442
|
-
return [
|
|
443
|
-
joinPaths(globalPrefix, joinPaths(controllerPrefix, routePath))
|
|
444
|
-
];
|
|
445
|
-
}
|
|
446
|
-
const versions = Array.isArray(version) ? version : [
|
|
447
|
-
version
|
|
448
|
-
];
|
|
449
|
-
return versions.map((v)=>{
|
|
450
|
-
const versionSegment = `/v${v}`;
|
|
451
|
-
return joinPaths(globalPrefix, joinPaths(versionSegment, joinPaths(controllerPrefix, routePath)));
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
compilePathMatcher(routePath) {
|
|
455
|
-
if (routePath === '*') return ()=>true;
|
|
456
|
-
const norm = routePath.startsWith('/') ? routePath : `/${routePath}`;
|
|
457
|
-
if (norm.endsWith('*')) {
|
|
458
|
-
const prefix = norm.slice(0, -1);
|
|
459
|
-
return (p)=>p.startsWith(prefix);
|
|
460
|
-
}
|
|
461
|
-
return (p)=>p === norm || p.startsWith(`${norm}/`);
|
|
462
|
-
}
|
|
463
|
-
compileRouteMatcher(routes) {
|
|
464
|
-
const matchers = routes.map((route)=>{
|
|
465
|
-
const matchPath = this.compilePathMatcher(route.path);
|
|
466
|
-
return (path, method)=>{
|
|
467
|
-
if (!matchPath(path)) return false;
|
|
468
|
-
if (route.method && route.method !== HttpMethod.ALL) return method === route.method;
|
|
469
|
-
return true;
|
|
470
|
-
};
|
|
471
|
-
});
|
|
472
|
-
if (matchers.length === 0) return ()=>false;
|
|
473
|
-
if (matchers.length === 1) return matchers[0];
|
|
474
|
-
return (path, method)=>matchers.some((m)=>m(path, method));
|
|
475
|
-
}
|
|
476
|
-
getControllers() {
|
|
477
|
-
return [
|
|
478
|
-
...this.controllers
|
|
479
|
-
];
|
|
480
|
-
}
|
|
481
|
-
}
|
package/dist/http/types.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { HttpMethod } from '../constants';
|
|
2
|
-
import type { Type } from '../container/types';
|
|
3
|
-
import type { PipeType } from '../registry/types';
|
|
4
|
-
export interface RouteMetadata {
|
|
5
|
-
method: HttpMethod;
|
|
6
|
-
path: string;
|
|
7
|
-
handlerName: string | symbol;
|
|
8
|
-
version?: number | number[];
|
|
9
|
-
/** Route name for URL generation / OpenAPI operationId (`@Get(path, { name })`). */
|
|
10
|
-
name?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ControllerOptions {
|
|
13
|
-
path?: string;
|
|
14
|
-
version?: number | number[];
|
|
15
|
-
}
|
|
16
|
-
export interface ControllerMetadata {
|
|
17
|
-
prefix: string;
|
|
18
|
-
version?: number | number[];
|
|
19
|
-
}
|
|
20
|
-
export interface ParamMetadata {
|
|
21
|
-
index: number;
|
|
22
|
-
type: string;
|
|
23
|
-
name?: string;
|
|
24
|
-
pipes?: PipeType[];
|
|
25
|
-
factory?: (data: unknown, ctx: import('hono').Context) => unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Explicit param type for programmatic routes. Methods synthesized at
|
|
28
|
-
* runtime (e.g. `@Crud()` verb handlers) have no `design:paramtypes`, so
|
|
29
|
-
* ValidationPipe and the OpenAPI walk read this instead when present.
|
|
30
|
-
*/
|
|
31
|
-
metatype?: unknown;
|
|
32
|
-
}
|
|
33
|
-
export interface ControllerRegistration {
|
|
34
|
-
controller: Type;
|
|
35
|
-
metadata: ControllerMetadata;
|
|
36
|
-
routes: RouteMetadata[];
|
|
37
|
-
}
|
package/dist/http/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/http/url/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { UrlGeneratorService } from './url-generator.service';
|
|
2
|
-
export type { UrlForOptions, SignedUrlGenerateOptions } from './url-generator.service';
|
|
3
|
-
export { SignedUrlGuard, SignedUrl } from './signed-url.guard';
|
|
4
|
-
export { URL_SIGNING_SECRET } from './signing-secret';
|
package/dist/http/url/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { applyDecorators } from '../decorators';
|
|
2
|
-
import type { CanActivate, ExecutionContext } from '../../pipeline/types';
|
|
3
|
-
/**
|
|
4
|
-
* Verifies the HMAC signature (and `expires`) of the incoming request URL,
|
|
5
|
-
* using the same secret source as {@link UrlGeneratorService.signedUrl}: the
|
|
6
|
-
* {@link URL_SIGNING_SECRET} token, else `CONFIG_ENV`. Throws
|
|
7
|
-
* `ForbiddenException` (403) when the signature is missing, tampered, or
|
|
8
|
-
* expired. Registered app-wide by `bootstrap`; apply it per-route with
|
|
9
|
-
* {@link SignedUrl}.
|
|
10
|
-
*/
|
|
11
|
-
export declare class SignedUrlGuard implements CanActivate {
|
|
12
|
-
private readonly secretToken?;
|
|
13
|
-
private readonly env;
|
|
14
|
-
constructor(secretToken?: string | undefined, env?: Record<string, unknown>);
|
|
15
|
-
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Guards a route with {@link SignedUrlGuard} — the request must carry a valid,
|
|
19
|
-
* unexpired HMAC signature (produced by `UrlGeneratorService.signedUrl`).
|
|
20
|
-
*
|
|
21
|
-
* ```ts
|
|
22
|
-
* @Get('download', { name: 'file.download' })
|
|
23
|
-
* @SignedUrl()
|
|
24
|
-
* download() { ... }
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare function SignedUrl(): ReturnType<typeof applyDecorators>;
|