@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
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_MIDDLEWARE, APP_PIPE } from "./tokens.js";
|
|
2
|
-
// NestJS-style "APP_*" provider convention: each slot maps a well-known DI
|
|
3
|
-
// token to the RouteManager method that installs providers under it as a
|
|
4
|
-
// global component. Module-level @Provide(APP_*) entries expand into
|
|
5
|
-
// synthetic tokens (collected by ModuleLoader); a single @Inject(APP_*)
|
|
6
|
-
// provider falls back to the bare token.
|
|
7
|
-
const SLOTS = [
|
|
8
|
-
{
|
|
9
|
-
token: APP_GUARD,
|
|
10
|
-
bind: (rm)=>rm.useGlobalGuardTokens.bind(rm)
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
token: APP_PIPE,
|
|
14
|
-
bind: (rm)=>rm.useGlobalPipeTokens.bind(rm)
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
token: APP_INTERCEPTOR,
|
|
18
|
-
bind: (rm)=>rm.useGlobalInterceptorTokens.bind(rm)
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
token: APP_FILTER,
|
|
22
|
-
bind: (rm)=>rm.useGlobalFilterTokens.bind(rm)
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
token: APP_MIDDLEWARE,
|
|
26
|
-
bind: (rm)=>rm.useGlobalMiddlewareTokens.bind(rm)
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Bind every APP_* provider registered in the container as a global
|
|
31
|
-
* component on the RouteManager. The single source of truth for app-level
|
|
32
|
-
* pipeline configuration — used by both VelaFactory.create and
|
|
33
|
-
* @velajs/testing's TestingModuleBuilder.compile.
|
|
34
|
-
*/ export function bindAppProviders(routeManager, container, loader) {
|
|
35
|
-
for (const { token, bind } of SLOTS){
|
|
36
|
-
const collected = loader.getAppProviderTokens(token);
|
|
37
|
-
if (collected.length > 0) {
|
|
38
|
-
bind(routeManager)(...collected);
|
|
39
|
-
} else if (container.has(token)) {
|
|
40
|
-
bind(routeManager)(token);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Container } from '../container/container';
|
|
2
|
-
import type { ComponentType, ComponentTypeMap, Constructor, FilterType, GuardType, InterceptorType, MiddlewareType, PipeType } from '../registry/types';
|
|
3
|
-
import type { ArgumentMetadata, CanActivate, ExceptionFilter, ExecutionContext, NestInterceptor, NestMiddleware, PipeTransform } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Component registration + resolution for the controller/handler tiers.
|
|
6
|
-
* App-wide (global) components have exactly ONE source: the per-app
|
|
7
|
-
* `RouteManager` (`APP_*` provider tokens + `useGlobalX()`) — callers merge
|
|
8
|
-
* `routeManager.getGlobalComponents()` with {@link getScopedComponents}.
|
|
9
|
-
*
|
|
10
|
-
* Stateless by design: no process-global container (two apps in one process
|
|
11
|
-
* never cross-talk) — every `resolve*` takes the resolving container.
|
|
12
|
-
*/
|
|
13
|
-
export declare class ComponentManager {
|
|
14
|
-
static registerController<T extends ComponentType>(type: T, controller: Constructor, ...components: ComponentTypeMap[T][]): void;
|
|
15
|
-
static registerHandler<T extends ComponentType>(type: T, controller: Constructor, handlerName: string | symbol, ...components: ComponentTypeMap[T][]): void;
|
|
16
|
-
static getScopedComponents<T extends ComponentType>(type: T, controller: Constructor, handlerName: string | symbol): ComponentTypeMap[T][];
|
|
17
|
-
private static resolveAll;
|
|
18
|
-
static resolveMiddleware(items: MiddlewareType[], container: Container): NestMiddleware[];
|
|
19
|
-
static resolveGuards(items: GuardType[], container: Container): CanActivate[];
|
|
20
|
-
static resolvePipes(items: PipeType[], container: Container): PipeTransform[];
|
|
21
|
-
static resolveInterceptors(items: InterceptorType[], container: Container): NestInterceptor[];
|
|
22
|
-
static resolveFilters(items: FilterType[], container: Container): ExceptionFilter[];
|
|
23
|
-
static executePipes(value: unknown, metadata: ArgumentMetadata, pipes: PipeTransform[]): Promise<unknown>;
|
|
24
|
-
static runInterceptorChain(interceptors: NestInterceptor[], context: ExecutionContext, coreHandler: () => Promise<unknown>): Promise<unknown>;
|
|
25
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
2
|
-
import { PipelineRunner } from "./pipeline-runner.js";
|
|
3
|
-
function isObject(value) {
|
|
4
|
-
return typeof value === 'object' && value !== null;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Component registration + resolution for the controller/handler tiers.
|
|
8
|
-
* App-wide (global) components have exactly ONE source: the per-app
|
|
9
|
-
* `RouteManager` (`APP_*` provider tokens + `useGlobalX()`) — callers merge
|
|
10
|
-
* `routeManager.getGlobalComponents()` with {@link getScopedComponents}.
|
|
11
|
-
*
|
|
12
|
-
* Stateless by design: no process-global container (two apps in one process
|
|
13
|
-
* never cross-talk) — every `resolve*` takes the resolving container.
|
|
14
|
-
*/ export class ComponentManager {
|
|
15
|
-
// Scoped registration: controller → handler
|
|
16
|
-
static registerController(type, controller, ...components) {
|
|
17
|
-
for (const component of components){
|
|
18
|
-
MetadataRegistry.registerController(type, controller, component);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
static registerHandler(type, controller, handlerName, ...components) {
|
|
22
|
-
for (const component of components){
|
|
23
|
-
MetadataRegistry.registerHandler(type, controller, handlerName, component);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Scoped resolution: controller → handler. App-wide components come from
|
|
27
|
-
// RouteManager (APP_* tokens + useGlobalX()) — merged by the caller.
|
|
28
|
-
static getScopedComponents(type, controller, handlerName) {
|
|
29
|
-
return [
|
|
30
|
-
...MetadataRegistry.getController(type, controller),
|
|
31
|
-
...MetadataRegistry.getHandler(type, controller, handlerName)
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
// Type-specific resolvers — explicit container, always.
|
|
35
|
-
static resolveAll(items, methodKey, container) {
|
|
36
|
-
return items.map((item)=>isObject(item) && methodKey in item ? item : container.resolve(item));
|
|
37
|
-
}
|
|
38
|
-
static resolveMiddleware(items, container) {
|
|
39
|
-
return this.resolveAll(items, 'use', container);
|
|
40
|
-
}
|
|
41
|
-
static resolveGuards(items, container) {
|
|
42
|
-
return this.resolveAll(items, 'canActivate', container);
|
|
43
|
-
}
|
|
44
|
-
static resolvePipes(items, container) {
|
|
45
|
-
return this.resolveAll(items, 'transform', container);
|
|
46
|
-
}
|
|
47
|
-
static resolveInterceptors(items, container) {
|
|
48
|
-
return this.resolveAll(items, 'intercept', container);
|
|
49
|
-
}
|
|
50
|
-
static resolveFilters(items, container) {
|
|
51
|
-
return this.resolveAll(items, 'catch', container);
|
|
52
|
-
}
|
|
53
|
-
// Pipe execution
|
|
54
|
-
static async executePipes(value, metadata, pipes) {
|
|
55
|
-
let transformed = value;
|
|
56
|
-
for (const pipe of pipes){
|
|
57
|
-
transformed = await pipe.transform(transformed, metadata);
|
|
58
|
-
}
|
|
59
|
-
return transformed;
|
|
60
|
-
}
|
|
61
|
-
// Interceptor chain (onion pattern) — canonical implementation lives in
|
|
62
|
-
// PipelineRunner; kept here as a stable alias.
|
|
63
|
-
static async runInterceptorChain(interceptors, context, coreHandler) {
|
|
64
|
-
return PipelineRunner.chainInterceptors(interceptors, context, coreHandler);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Type } from '../container/types';
|
|
2
|
-
import type { ComponentTypeMap } from '../registry/types';
|
|
3
|
-
export declare function UseMiddleware(...middleware: ComponentTypeMap['middleware'][]): (target: object, propertyKey?: string | symbol) => void;
|
|
4
|
-
export declare function UseGuards(...guards: ComponentTypeMap['guard'][]): (target: object, propertyKey?: string | symbol) => void;
|
|
5
|
-
export declare function UsePipes(...pipes: ComponentTypeMap['pipe'][]): (target: object, propertyKey?: string | symbol) => void;
|
|
6
|
-
export declare function UseInterceptors(...interceptors: ComponentTypeMap['interceptor'][]): (target: object, propertyKey?: string | symbol) => void;
|
|
7
|
-
export declare function UseFilters(...filters: ComponentTypeMap['filter'][]): (target: object, propertyKey?: string | symbol) => void;
|
|
8
|
-
export declare function Catch(...exceptions: Type<Error>[]): ClassDecorator;
|
|
9
|
-
export declare function getCatchTypes(filter: unknown): Type<Error>[];
|
|
10
|
-
export declare function shouldFilterCatch(filter: unknown, exception: unknown): boolean;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { ComponentManager } from "./component.manager.js";
|
|
2
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
3
|
-
function UseComponent(type, ...components) {
|
|
4
|
-
return (target, propertyKey)=>{
|
|
5
|
-
if (propertyKey !== undefined) {
|
|
6
|
-
ComponentManager.registerHandler(type, target.constructor, propertyKey, ...components);
|
|
7
|
-
} else {
|
|
8
|
-
ComponentManager.registerController(type, target, ...components);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function UseMiddleware(...middleware) {
|
|
13
|
-
return UseComponent('middleware', ...middleware);
|
|
14
|
-
}
|
|
15
|
-
export function UseGuards(...guards) {
|
|
16
|
-
return UseComponent('guard', ...guards);
|
|
17
|
-
}
|
|
18
|
-
export function UsePipes(...pipes) {
|
|
19
|
-
return UseComponent('pipe', ...pipes);
|
|
20
|
-
}
|
|
21
|
-
export function UseInterceptors(...interceptors) {
|
|
22
|
-
return UseComponent('interceptor', ...interceptors);
|
|
23
|
-
}
|
|
24
|
-
export function UseFilters(...filters) {
|
|
25
|
-
return UseComponent('filter', ...filters);
|
|
26
|
-
}
|
|
27
|
-
export function Catch(...exceptions) {
|
|
28
|
-
return (target)=>{
|
|
29
|
-
MetadataRegistry.setCatchTypes(target, exceptions);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export function getCatchTypes(filter) {
|
|
33
|
-
const filterClass = typeof filter === 'function' ? filter : filter.constructor;
|
|
34
|
-
return MetadataRegistry.getCatchTypes(filterClass) ?? [];
|
|
35
|
-
}
|
|
36
|
-
export function shouldFilterCatch(filter, exception) {
|
|
37
|
-
const catchTypes = getCatchTypes(filter);
|
|
38
|
-
if (catchTypes.length === 0) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
return catchTypes.some((type)=>exception instanceof type);
|
|
42
|
-
}
|
package/dist/pipeline/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { ComponentManager } from './component.manager';
|
|
2
|
-
export { PipelineRunner } from './pipeline-runner';
|
|
3
|
-
export type { PipelineRunOptions } from './pipeline-runner';
|
|
4
|
-
export { resolveScopedComponents } from './scoped-components';
|
|
5
|
-
export type { ResolvedComponentMap } from './scoped-components';
|
|
6
|
-
export { UseMiddleware, UseGuards, UsePipes, UseInterceptors, UseFilters, Catch, getCatchTypes, shouldFilterCatch, } from './decorators';
|
|
7
|
-
export { SetMetadata, Reflector } from './reflector';
|
|
8
|
-
export type { ReflectableDecorator, CreateDecoratorOptions } from './reflector';
|
|
9
|
-
export { APP_GUARD, APP_PIPE, APP_INTERCEPTOR, APP_FILTER, APP_MIDDLEWARE, APP_EXCEPTION_HANDLER, ERROR_CATALOG, } from './tokens';
|
|
10
|
-
export { ParseIntPipe, ParseFloatPipe, ParseBoolPipe, ParseUUIDPipe, ParseEnumPipe, ParseArrayPipe, DefaultValuePipe, RequiredPipe, ZodValidationPipe, } from './pipes';
|
|
11
|
-
export type { ParseUUIDPipeOptions, ParseArrayPipeOptions } from './pipes';
|
|
12
|
-
export type { HttpArgumentsHost, ExecutionContext, CanActivate, CallHandler, NestInterceptor, NestMiddleware, PipeTransform, ExceptionFilter, ArgumentMetadata, } from './types';
|
package/dist/pipeline/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { ComponentManager } from "./component.manager.js";
|
|
2
|
-
export { PipelineRunner } from "./pipeline-runner.js";
|
|
3
|
-
export { resolveScopedComponents } from "./scoped-components.js";
|
|
4
|
-
export { UseMiddleware, UseGuards, UsePipes, UseInterceptors, UseFilters, Catch, getCatchTypes, shouldFilterCatch } from "./decorators.js";
|
|
5
|
-
export { SetMetadata, Reflector } from "./reflector.js";
|
|
6
|
-
export { APP_GUARD, APP_PIPE, APP_INTERCEPTOR, APP_FILTER, APP_MIDDLEWARE, APP_EXCEPTION_HANDLER, ERROR_CATALOG } from "./tokens.js";
|
|
7
|
-
export { ParseIntPipe, ParseFloatPipe, ParseBoolPipe, ParseUUIDPipe, ParseEnumPipe, ParseArrayPipe, DefaultValuePipe, RequiredPipe, ZodValidationPipe } from "./pipes.js";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { CanActivate, ExecutionContext, NestInterceptor } from './types';
|
|
2
|
-
export interface PipelineRunOptions {
|
|
3
|
-
context: ExecutionContext;
|
|
4
|
-
/** Pre-merged (global ++ scoped), pre-instantiated. */
|
|
5
|
-
guards: CanActivate[];
|
|
6
|
-
interceptors: NestInterceptor[];
|
|
7
|
-
/** Extract handler arguments (pipes already bound inside the closure). */
|
|
8
|
-
resolveArgs: () => Promise<unknown[]>;
|
|
9
|
-
/** Call the actual handler. */
|
|
10
|
-
invoke: (args: unknown[]) => Promise<unknown>;
|
|
11
|
-
/**
|
|
12
|
-
* HTTP runs argument extraction + pipes BEFORE guards (a deliberate vela
|
|
13
|
-
* deviation — see handler-executor); WebSocket runs guards first. Default
|
|
14
|
-
* false (guards first).
|
|
15
|
-
*/
|
|
16
|
-
argsBeforeGuards?: boolean;
|
|
17
|
-
/** Error thrown when a guard rejects (default `ForbiddenException`). */
|
|
18
|
-
onGuardReject?: () => Error;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* The transport-agnostic guard → pipe → interceptor execution core shared by
|
|
22
|
-
* the HTTP `HandlerExecutor` and the WebSocket `WsDispatcher` (and any future
|
|
23
|
-
* entrypoint dispatcher: queue consumers, scheduled jobs, …). Exception
|
|
24
|
-
* FILTERS stay with the caller — their terminal behavior is transport-specific
|
|
25
|
-
* (HTTP maps to a Response, WS sends an error frame).
|
|
26
|
-
*/
|
|
27
|
-
export declare class PipelineRunner {
|
|
28
|
-
static run(options: PipelineRunOptions): Promise<unknown>;
|
|
29
|
-
/** Interceptor onion — innermost is the core handler. */
|
|
30
|
-
static chainInterceptors(interceptors: NestInterceptor[], context: ExecutionContext, coreHandler: () => Promise<unknown>): Promise<unknown>;
|
|
31
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ForbiddenException } from "../errors/http-exception.js";
|
|
2
|
-
/**
|
|
3
|
-
* The transport-agnostic guard → pipe → interceptor execution core shared by
|
|
4
|
-
* the HTTP `HandlerExecutor` and the WebSocket `WsDispatcher` (and any future
|
|
5
|
-
* entrypoint dispatcher: queue consumers, scheduled jobs, …). Exception
|
|
6
|
-
* FILTERS stay with the caller — their terminal behavior is transport-specific
|
|
7
|
-
* (HTTP maps to a Response, WS sends an error frame).
|
|
8
|
-
*/ export class PipelineRunner {
|
|
9
|
-
static async run(options) {
|
|
10
|
-
let args;
|
|
11
|
-
if (options.argsBeforeGuards) {
|
|
12
|
-
args = await options.resolveArgs();
|
|
13
|
-
}
|
|
14
|
-
for (const guard of options.guards){
|
|
15
|
-
const canActivate = await guard.canActivate(options.context);
|
|
16
|
-
if (!canActivate) {
|
|
17
|
-
throw options.onGuardReject?.() ?? new ForbiddenException();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
args ??= await options.resolveArgs();
|
|
21
|
-
const resolvedArgs = args;
|
|
22
|
-
return PipelineRunner.chainInterceptors(options.interceptors, options.context, ()=>options.invoke(resolvedArgs));
|
|
23
|
-
}
|
|
24
|
-
/** Interceptor onion — innermost is the core handler. */ static async chainInterceptors(interceptors, context, coreHandler) {
|
|
25
|
-
if (interceptors.length === 0) {
|
|
26
|
-
return coreHandler();
|
|
27
|
-
}
|
|
28
|
-
let next = {
|
|
29
|
-
handle: coreHandler
|
|
30
|
-
};
|
|
31
|
-
for(let i = interceptors.length - 1; i >= 0; i--){
|
|
32
|
-
const interceptor = interceptors[i];
|
|
33
|
-
const currentNext = next;
|
|
34
|
-
next = {
|
|
35
|
-
handle: ()=>interceptor.intercept(context, currentNext)
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
return next.handle();
|
|
39
|
-
}
|
|
40
|
-
}
|
package/dist/pipeline/pipes.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { ArgumentMetadata, PipeTransform } from './types';
|
|
2
|
-
export declare class ParseIntPipe implements PipeTransform<string, number> {
|
|
3
|
-
transform(value: string, metadata: ArgumentMetadata): number;
|
|
4
|
-
}
|
|
5
|
-
export declare class ParseFloatPipe implements PipeTransform<string, number> {
|
|
6
|
-
transform(value: string, metadata: ArgumentMetadata): number;
|
|
7
|
-
}
|
|
8
|
-
export declare class ParseBoolPipe implements PipeTransform<string, boolean> {
|
|
9
|
-
transform(value: string, metadata: ArgumentMetadata): boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare class DefaultValuePipe<T = unknown> implements PipeTransform<T | undefined, T> {
|
|
12
|
-
private readonly defaultValue;
|
|
13
|
-
constructor(defaultValue: T);
|
|
14
|
-
transform(value: T | undefined, _metadata: ArgumentMetadata): T;
|
|
15
|
-
}
|
|
16
|
-
export declare class RequiredPipe implements PipeTransform {
|
|
17
|
-
transform(value: unknown, metadata: ArgumentMetadata): unknown;
|
|
18
|
-
}
|
|
19
|
-
export declare class ZodValidationPipe implements PipeTransform {
|
|
20
|
-
private readonly schema;
|
|
21
|
-
constructor(schema: {
|
|
22
|
-
parse(data: unknown): unknown;
|
|
23
|
-
});
|
|
24
|
-
transform(value: unknown, _metadata: ArgumentMetadata): unknown;
|
|
25
|
-
}
|
|
26
|
-
export interface ParseUUIDPipeOptions {
|
|
27
|
-
version?: '3' | '4' | '5';
|
|
28
|
-
}
|
|
29
|
-
export declare class ParseUUIDPipe implements PipeTransform<string, string> {
|
|
30
|
-
private readonly options?;
|
|
31
|
-
constructor(options?: ParseUUIDPipeOptions | undefined);
|
|
32
|
-
transform(value: string, metadata: ArgumentMetadata): string;
|
|
33
|
-
}
|
|
34
|
-
export declare class ParseEnumPipe<T extends Record<string, string | number>> implements PipeTransform<string, T[keyof T]> {
|
|
35
|
-
private readonly allowedValues;
|
|
36
|
-
private readonly valuesLabel;
|
|
37
|
-
constructor(enumType: T);
|
|
38
|
-
transform(value: string, metadata: ArgumentMetadata): T[keyof T];
|
|
39
|
-
}
|
|
40
|
-
export interface ParseArrayPipeOptions {
|
|
41
|
-
separator?: string;
|
|
42
|
-
optional?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export declare class ParseArrayPipe implements PipeTransform {
|
|
45
|
-
private readonly options?;
|
|
46
|
-
constructor(options?: ParseArrayPipeOptions | undefined);
|
|
47
|
-
transform(value: unknown, metadata: ArgumentMetadata): unknown[];
|
|
48
|
-
}
|
package/dist/pipeline/pipes.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { BadRequestException } from "../errors/http-exception.js";
|
|
2
|
-
export class ParseIntPipe {
|
|
3
|
-
transform(value, metadata) {
|
|
4
|
-
const parsed = parseInt(value, 10);
|
|
5
|
-
if (isNaN(parsed)) {
|
|
6
|
-
throw new BadRequestException(`Validation failed (numeric string expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
7
|
-
}
|
|
8
|
-
return parsed;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export class ParseFloatPipe {
|
|
12
|
-
transform(value, metadata) {
|
|
13
|
-
const parsed = parseFloat(value);
|
|
14
|
-
if (isNaN(parsed)) {
|
|
15
|
-
throw new BadRequestException(`Validation failed (float string expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
16
|
-
}
|
|
17
|
-
return parsed;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export class ParseBoolPipe {
|
|
21
|
-
transform(value, metadata) {
|
|
22
|
-
if (value === 'true') return true;
|
|
23
|
-
if (value === 'false') return false;
|
|
24
|
-
throw new BadRequestException(`Validation failed (boolean string expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export class DefaultValuePipe {
|
|
28
|
-
defaultValue;
|
|
29
|
-
constructor(defaultValue){
|
|
30
|
-
this.defaultValue = defaultValue;
|
|
31
|
-
}
|
|
32
|
-
transform(value, _metadata) {
|
|
33
|
-
return value !== undefined && value !== null ? value : this.defaultValue;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export class RequiredPipe {
|
|
37
|
-
transform(value, metadata) {
|
|
38
|
-
if (value === undefined || value === null || value === '') {
|
|
39
|
-
throw new BadRequestException(`Validation failed (value required)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
40
|
-
}
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export class ZodValidationPipe {
|
|
45
|
-
schema;
|
|
46
|
-
constructor(schema){
|
|
47
|
-
this.schema = schema;
|
|
48
|
-
}
|
|
49
|
-
transform(value, _metadata) {
|
|
50
|
-
return this.schema.parse(value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
54
|
-
const UUID_VERSION_REGEX = {
|
|
55
|
-
'3': /^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
56
|
-
'4': /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
57
|
-
'5': /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
|
58
|
-
};
|
|
59
|
-
export class ParseUUIDPipe {
|
|
60
|
-
options;
|
|
61
|
-
constructor(options){
|
|
62
|
-
this.options = options;
|
|
63
|
-
}
|
|
64
|
-
transform(value, metadata) {
|
|
65
|
-
const regex = this.options?.version ? UUID_VERSION_REGEX[this.options.version] : UUID_REGEX;
|
|
66
|
-
if (!regex.test(value)) {
|
|
67
|
-
throw new BadRequestException(`Validation failed (uuid${this.options?.version ? ` v${this.options.version}` : ''} expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
68
|
-
}
|
|
69
|
-
return value;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export class ParseEnumPipe {
|
|
73
|
-
allowedValues;
|
|
74
|
-
valuesLabel;
|
|
75
|
-
constructor(enumType){
|
|
76
|
-
const values = Object.values(enumType);
|
|
77
|
-
this.allowedValues = new Set(values);
|
|
78
|
-
this.valuesLabel = values.join(', ');
|
|
79
|
-
}
|
|
80
|
-
transform(value, metadata) {
|
|
81
|
-
if (!this.allowedValues.has(value)) {
|
|
82
|
-
throw new BadRequestException(`Validation failed (${this.valuesLabel} expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
83
|
-
}
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
export class ParseArrayPipe {
|
|
88
|
-
options;
|
|
89
|
-
constructor(options){
|
|
90
|
-
this.options = options;
|
|
91
|
-
}
|
|
92
|
-
transform(value, metadata) {
|
|
93
|
-
if (value === undefined || value === null || value === '') {
|
|
94
|
-
if (this.options?.optional) return [];
|
|
95
|
-
throw new BadRequestException(`Validation failed (array expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
96
|
-
}
|
|
97
|
-
if (Array.isArray(value)) return value;
|
|
98
|
-
if (typeof value === 'string') {
|
|
99
|
-
const sep = this.options?.separator ?? ',';
|
|
100
|
-
return value.split(sep).map((v)=>v.trim()).filter((v)=>v.length > 0);
|
|
101
|
-
}
|
|
102
|
-
throw new BadRequestException(`Validation failed (array expected)${metadata.data ? ` for parameter '${metadata.data}'` : ''}`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext } from './types';
|
|
2
|
-
export interface CreateDecoratorOptions {
|
|
3
|
-
key?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ReflectableDecorator<TParam> {
|
|
6
|
-
(value: TParam): ClassDecorator & MethodDecorator;
|
|
7
|
-
KEY: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Decorator that attaches custom metadata to a class or method.
|
|
11
|
-
* Read via Reflector in guards/interceptors.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const Roles = (...roles: string[]) => SetMetadata('roles', roles);
|
|
16
|
-
*
|
|
17
|
-
* @Controller('/admin')
|
|
18
|
-
* @Roles('admin')
|
|
19
|
-
* class AdminController { ... }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function SetMetadata<V = unknown>(key: string, value: V): (target: object, propertyKey?: string | symbol) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Reads custom metadata set by @SetMetadata().
|
|
25
|
-
* Use in guards/interceptors via ExecutionContext.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* class RolesGuard implements CanActivate {
|
|
30
|
-
* private reflector = new Reflector();
|
|
31
|
-
*
|
|
32
|
-
* canActivate(context: ExecutionContext): boolean {
|
|
33
|
-
* const roles = this.reflector.get<string[]>('roles', context);
|
|
34
|
-
* if (!roles) return true;
|
|
35
|
-
* const user = ...; // extract from request
|
|
36
|
-
* return roles.some(r => user.roles.includes(r));
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare class Reflector {
|
|
42
|
-
/**
|
|
43
|
-
* Create a type-safe decorator that sets metadata with a typed key.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* const Roles = Reflector.createDecorator<string[]>();
|
|
48
|
-
* // Roles(['admin']) — class or method decorator
|
|
49
|
-
* // reflector.get(Roles, context) — typed as string[] | undefined
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
static createDecorator<TParam = unknown>(options?: CreateDecoratorOptions): ReflectableDecorator<TParam>;
|
|
53
|
-
private resolveKey;
|
|
54
|
-
/**
|
|
55
|
-
* Get metadata value from handler first, then class.
|
|
56
|
-
* Handler-level metadata takes priority over class-level.
|
|
57
|
-
*/
|
|
58
|
-
get<T = unknown>(key: string | ReflectableDecorator<T>, context: ExecutionContext): T | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Get metadata only from the handler (method) level.
|
|
61
|
-
*/
|
|
62
|
-
getHandler<T = unknown>(key: string | ReflectableDecorator<T>, context: ExecutionContext): T | undefined;
|
|
63
|
-
/**
|
|
64
|
-
* Get metadata only from the class level.
|
|
65
|
-
*/
|
|
66
|
-
getClass<T = unknown>(key: string | ReflectableDecorator<T>, context: Pick<ExecutionContext, "getClass">): T | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Get all metadata values for a key from both handler and class.
|
|
69
|
-
* Returns [handlerValue, classValue] (either may be undefined).
|
|
70
|
-
*/
|
|
71
|
-
getAll<T = unknown>(key: string | ReflectableDecorator<T>, context: ExecutionContext): [T | undefined, T | undefined];
|
|
72
|
-
/**
|
|
73
|
-
* Returns handler value if defined, else class value, else undefined.
|
|
74
|
-
* First defined value wins.
|
|
75
|
-
*/
|
|
76
|
-
getAllAndOverride<T = unknown>(key: string | ReflectableDecorator<T>, context: ExecutionContext): T | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Collects handler + class values, filters undefineds.
|
|
79
|
-
* - 0 values → []
|
|
80
|
-
* - 1 value → return it
|
|
81
|
-
* - Arrays → concatenate
|
|
82
|
-
* - Objects → Object.assign({}, ...values)
|
|
83
|
-
* - Otherwise → wrap in array
|
|
84
|
-
*/
|
|
85
|
-
getAllAndMerge<T = unknown>(key: string | ReflectableDecorator<T>, context: ExecutionContext): T | T[];
|
|
86
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
2
|
-
/**
|
|
3
|
-
* Decorator that attaches custom metadata to a class or method.
|
|
4
|
-
* Read via Reflector in guards/interceptors.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* const Roles = (...roles: string[]) => SetMetadata('roles', roles);
|
|
9
|
-
*
|
|
10
|
-
* @Controller('/admin')
|
|
11
|
-
* @Roles('admin')
|
|
12
|
-
* class AdminController { ... }
|
|
13
|
-
* ```
|
|
14
|
-
*/ export function SetMetadata(key, value) {
|
|
15
|
-
return (target, propertyKey)=>{
|
|
16
|
-
if (propertyKey !== undefined) {
|
|
17
|
-
MetadataRegistry.setCustomHandlerMeta(target.constructor, propertyKey, key, value);
|
|
18
|
-
} else {
|
|
19
|
-
MetadataRegistry.setCustomClassMeta(target, key, value);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Reads custom metadata set by @SetMetadata().
|
|
25
|
-
* Use in guards/interceptors via ExecutionContext.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* class RolesGuard implements CanActivate {
|
|
30
|
-
* private reflector = new Reflector();
|
|
31
|
-
*
|
|
32
|
-
* canActivate(context: ExecutionContext): boolean {
|
|
33
|
-
* const roles = this.reflector.get<string[]>('roles', context);
|
|
34
|
-
* if (!roles) return true;
|
|
35
|
-
* const user = ...; // extract from request
|
|
36
|
-
* return roles.some(r => user.roles.includes(r));
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*/ export class Reflector {
|
|
41
|
-
/**
|
|
42
|
-
* Create a type-safe decorator that sets metadata with a typed key.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```ts
|
|
46
|
-
* const Roles = Reflector.createDecorator<string[]>();
|
|
47
|
-
* // Roles(['admin']) — class or method decorator
|
|
48
|
-
* // reflector.get(Roles, context) — typed as string[] | undefined
|
|
49
|
-
* ```
|
|
50
|
-
*/ static createDecorator(options) {
|
|
51
|
-
const key = options?.key ?? `vela:custom:${crypto.randomUUID()}`;
|
|
52
|
-
const decorator = (value)=>SetMetadata(key, value);
|
|
53
|
-
decorator.KEY = key;
|
|
54
|
-
return decorator;
|
|
55
|
-
}
|
|
56
|
-
resolveKey(keyOrDecorator) {
|
|
57
|
-
return typeof keyOrDecorator === 'string' ? keyOrDecorator : keyOrDecorator.KEY;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get metadata value from handler first, then class.
|
|
61
|
-
* Handler-level metadata takes priority over class-level.
|
|
62
|
-
*/ get(key, context) {
|
|
63
|
-
const resolvedKey = this.resolveKey(key);
|
|
64
|
-
const ctor = context.getClass();
|
|
65
|
-
const handlerValue = MetadataRegistry.getCustomHandlerMeta(ctor, context.getHandler(), resolvedKey);
|
|
66
|
-
if (handlerValue !== undefined) return handlerValue;
|
|
67
|
-
return MetadataRegistry.getCustomClassMeta(ctor, resolvedKey);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get metadata only from the handler (method) level.
|
|
71
|
-
*/ getHandler(key, context) {
|
|
72
|
-
const resolvedKey = this.resolveKey(key);
|
|
73
|
-
return MetadataRegistry.getCustomHandlerMeta(context.getClass(), context.getHandler(), resolvedKey);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Get metadata only from the class level.
|
|
77
|
-
*/ getClass(key, context) {
|
|
78
|
-
const resolvedKey = this.resolveKey(key);
|
|
79
|
-
return MetadataRegistry.getCustomClassMeta(context.getClass(), resolvedKey);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Get all metadata values for a key from both handler and class.
|
|
83
|
-
* Returns [handlerValue, classValue] (either may be undefined).
|
|
84
|
-
*/ getAll(key, context) {
|
|
85
|
-
return [
|
|
86
|
-
this.getHandler(key, context),
|
|
87
|
-
this.getClass(key, context)
|
|
88
|
-
];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Returns handler value if defined, else class value, else undefined.
|
|
92
|
-
* First defined value wins.
|
|
93
|
-
*/ getAllAndOverride(key, context) {
|
|
94
|
-
return this.getHandler(key, context) ?? this.getClass(key, context);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Collects handler + class values, filters undefineds.
|
|
98
|
-
* - 0 values → []
|
|
99
|
-
* - 1 value → return it
|
|
100
|
-
* - Arrays → concatenate
|
|
101
|
-
* - Objects → Object.assign({}, ...values)
|
|
102
|
-
* - Otherwise → wrap in array
|
|
103
|
-
*/ getAllAndMerge(key, context) {
|
|
104
|
-
const [handlerValue, classValue] = this.getAll(key, context);
|
|
105
|
-
const values = [];
|
|
106
|
-
if (handlerValue !== undefined) values.push(handlerValue);
|
|
107
|
-
if (classValue !== undefined) values.push(classValue);
|
|
108
|
-
if (values.length === 0) return [];
|
|
109
|
-
if (values.length === 1) return values[0];
|
|
110
|
-
if (Array.isArray(values[0]) && Array.isArray(values[1])) {
|
|
111
|
-
return [
|
|
112
|
-
...values[0],
|
|
113
|
-
...values[1]
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
if (typeof values[0] === 'object' && values[0] !== null && !Array.isArray(values[0]) && typeof values[1] === 'object' && values[1] !== null && !Array.isArray(values[1])) {
|
|
117
|
-
return Object.assign({}, values[0], values[1]);
|
|
118
|
-
}
|
|
119
|
-
return values;
|
|
120
|
-
}
|
|
121
|
-
}
|