@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,80 +0,0 @@
|
|
|
1
|
-
import { Scope } from "../constants.js";
|
|
2
|
-
import { Inject } from "../container/decorators.js";
|
|
3
|
-
import { createDiscoverableDecorator } from "../discovery/index.js";
|
|
4
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
5
|
-
import { RESERVED_WS_EVENT_PREFIX, WS_GATEWAY_METADATA, WS_RESERVED_METADATA, WS_SERVER, WS_SUBSCRIBE_METADATA, WsParamType } from "./websocket.tokens.js";
|
|
6
|
-
/**
|
|
7
|
-
* Marks a class as a WebSocket gateway. Mirrors `@Controller` for the socket
|
|
8
|
-
* transport: registers the class as an injectable singleton and stores its
|
|
9
|
-
* routing options (`path`, Cloudflare `binding`).
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* @WebSocketGateway({ path: '/rooms/:id/ws', binding: 'CHAT_ROOM' })
|
|
14
|
-
* class ChatGateway {}
|
|
15
|
-
* ```
|
|
16
|
-
*/ export function WebSocketGateway(options = {}) {
|
|
17
|
-
return (target)=>{
|
|
18
|
-
const ctor = target;
|
|
19
|
-
MetadataRegistry.setCustomClassMeta(ctor, WS_GATEWAY_METADATA, options);
|
|
20
|
-
MetadataRegistry.markInjectable(ctor);
|
|
21
|
-
MetadataRegistry.setScope(ctor, Scope.SINGLETON);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Binds a gateway method to an inbound event. Stackable — one class-level list,
|
|
26
|
-
* exactly like `@OnEvent` (`event-emitter.decorators.ts`).
|
|
27
|
-
*/ export function SubscribeMessage(event) {
|
|
28
|
-
return (target, propertyKey)=>{
|
|
29
|
-
MetadataRegistry.appendCustomClassMeta(target.constructor, WS_SUBSCRIBE_METADATA, {
|
|
30
|
-
event,
|
|
31
|
-
methodName: String(propertyKey)
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const ReservedWsEventMeta = createDiscoverableDecorator(WS_RESERVED_METADATA);
|
|
36
|
-
/**
|
|
37
|
-
* Claims a reserved (`$`-prefixed) envelope event for a framework-module
|
|
38
|
-
* provider (see `ReservedWsEventHandler`). Reserved frames route to the
|
|
39
|
-
* decorated provider across every gateway path — gateways themselves may not
|
|
40
|
-
* subscribe to `$…` events. Stack with `@Injectable()` like `@Processor`.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```ts
|
|
44
|
-
* @ReservedWsEvent('$live')
|
|
45
|
-
* @Injectable()
|
|
46
|
-
* class LiveEngine implements ReservedWsEventHandler { … }
|
|
47
|
-
* ```
|
|
48
|
-
*/ export function ReservedWsEvent(event) {
|
|
49
|
-
if (!event.startsWith(RESERVED_WS_EVENT_PREFIX)) {
|
|
50
|
-
throw new Error(`@ReservedWsEvent('${event}') must claim a '${RESERVED_WS_EVENT_PREFIX}'-prefixed event — ` + 'unprefixed events belong to app gateways (@SubscribeMessage).');
|
|
51
|
-
}
|
|
52
|
-
return ReservedWsEventMeta({
|
|
53
|
-
event
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function wsParamDecorator(type) {
|
|
57
|
-
return ()=>(target, propertyKey, parameterIndex)=>{
|
|
58
|
-
if (propertyKey === undefined) {
|
|
59
|
-
throw new Error('WebSocket parameter decorators can only be used on method parameters');
|
|
60
|
-
}
|
|
61
|
-
MetadataRegistry.addParameter(target.constructor, propertyKey, {
|
|
62
|
-
index: parameterIndex,
|
|
63
|
-
type
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/** Injects the inbound message payload (the envelope's `data`) into a handler parameter. */ export const MessageBody = wsParamDecorator(WsParamType.BODY);
|
|
68
|
-
/** Injects the connected socket (`WsClient`) into a handler parameter. */ export const ConnectedSocket = wsParamDecorator(WsParamType.SOCKET);
|
|
69
|
-
/**
|
|
70
|
-
* Injects the gateway server handle (`WsServer`). Constructor injection only —
|
|
71
|
-
* the container has no property-injection pass, so this is sugar for
|
|
72
|
-
* `@Inject(WS_SERVER)` on a constructor parameter.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* constructor(@WebSocketServer() private server: WsServer) {}
|
|
77
|
-
* ```
|
|
78
|
-
*/ export function WebSocketServer() {
|
|
79
|
-
return Inject(WS_SERVER);
|
|
80
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type RoomRegistry, type SyncDriver } from './ws-sync';
|
|
2
|
-
export interface WebSocketModuleOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Cross-instance sync driver. Defaults to `local()` (single instance). Use
|
|
5
|
-
* `durableObject()` from `@velajs/cloudflare` or `redis()` from
|
|
6
|
-
* `@velajs/vela/websocket-node` for horizontal scale.
|
|
7
|
-
*/
|
|
8
|
-
sync?: SyncDriver;
|
|
9
|
-
/**
|
|
10
|
-
* Local room registry the transport reads/writes. Defaults to the in-memory
|
|
11
|
-
* implementation (node/bun/deno); the Cloudflare transport supplies its own.
|
|
12
|
-
*/
|
|
13
|
-
registry?: RoomRegistry;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Registers the WebSocket gateway machinery: the message dispatcher (discovers
|
|
17
|
-
* `@WebSocketGateway` classes via DiscoveryService at bootstrap), the room
|
|
18
|
-
* registry, the sync driver, and the `@WebSocketServer()`-injected server
|
|
19
|
-
* handle.
|
|
20
|
-
*
|
|
21
|
-
* Construction lives in chained provider factories — registry → driver
|
|
22
|
-
* (bound to THAT registry) → server — so the single shared registry instance
|
|
23
|
-
* is preserved and everything materializes at bootstrap's eager
|
|
24
|
-
* instantiation, before any lifecycle hook or message dispatch.
|
|
25
|
-
*
|
|
26
|
-
* The instance key derives from the sync driver kind: two `forRoot()` calls
|
|
27
|
-
* with the same driver kind dedup (HMR-idempotent); pass an explicit `key`
|
|
28
|
-
* to run multiple same-kind instances side by side.
|
|
29
|
-
*/
|
|
30
|
-
declare const ConfigurableModuleClass: import("..").ConfigurableModuleClassType<WebSocketModuleOptions, "forRoot", "create", {
|
|
31
|
-
isGlobal?: boolean;
|
|
32
|
-
}>;
|
|
33
|
-
export declare class WebSocketModule extends ConfigurableModuleClass {
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { defineModule } from "../module/define-module.js";
|
|
2
|
-
import { WsDispatcher } from "./ws-dispatcher.js";
|
|
3
|
-
import { WsServerImpl } from "./ws-server.js";
|
|
4
|
-
import { InMemoryRoomRegistry, local } from "./ws-sync.js";
|
|
5
|
-
import { WS_MODULE_OPTIONS, WS_ROOM_REGISTRY, WS_SERVER, WS_SYNC_DRIVER } from "./websocket.tokens.js";
|
|
6
|
-
/**
|
|
7
|
-
* Registers the WebSocket gateway machinery: the message dispatcher (discovers
|
|
8
|
-
* `@WebSocketGateway` classes via DiscoveryService at bootstrap), the room
|
|
9
|
-
* registry, the sync driver, and the `@WebSocketServer()`-injected server
|
|
10
|
-
* handle.
|
|
11
|
-
*
|
|
12
|
-
* Construction lives in chained provider factories — registry → driver
|
|
13
|
-
* (bound to THAT registry) → server — so the single shared registry instance
|
|
14
|
-
* is preserved and everything materializes at bootstrap's eager
|
|
15
|
-
* instantiation, before any lifecycle hook or message dispatch.
|
|
16
|
-
*
|
|
17
|
-
* The instance key derives from the sync driver kind: two `forRoot()` calls
|
|
18
|
-
* with the same driver kind dedup (HMR-idempotent); pass an explicit `key`
|
|
19
|
-
* to run multiple same-kind instances side by side.
|
|
20
|
-
*/ const { ConfigurableModuleClass } = defineModule({
|
|
21
|
-
name: 'WebSocket',
|
|
22
|
-
optionsToken: WS_MODULE_OPTIONS,
|
|
23
|
-
key: (options)=>`ws#${options.sync?.kind ?? 'local'}`,
|
|
24
|
-
setup: ({ OPTIONS })=>({
|
|
25
|
-
providers: [
|
|
26
|
-
{
|
|
27
|
-
provide: WS_ROOM_REGISTRY,
|
|
28
|
-
useFactory: (o)=>o.registry ?? new InMemoryRoomRegistry(),
|
|
29
|
-
inject: [
|
|
30
|
-
OPTIONS
|
|
31
|
-
]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
provide: WS_SYNC_DRIVER,
|
|
35
|
-
useFactory: (o, registry)=>{
|
|
36
|
-
const driver = o.sync ?? local();
|
|
37
|
-
driver.bind(registry);
|
|
38
|
-
return driver;
|
|
39
|
-
},
|
|
40
|
-
inject: [
|
|
41
|
-
OPTIONS,
|
|
42
|
-
WS_ROOM_REGISTRY
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
provide: WS_SERVER,
|
|
47
|
-
useFactory: (driver)=>new WsServerImpl(driver),
|
|
48
|
-
inject: [
|
|
49
|
-
WS_SYNC_DRIVER
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
WsDispatcher
|
|
53
|
-
],
|
|
54
|
-
exports: [
|
|
55
|
-
WS_SERVER,
|
|
56
|
-
WS_SYNC_DRIVER,
|
|
57
|
-
WS_ROOM_REGISTRY,
|
|
58
|
-
WsDispatcher
|
|
59
|
-
]
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
export class WebSocketModule extends ConfigurableModuleClass {
|
|
63
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '../container/types';
|
|
2
|
-
import type { WebSocketModuleOptions } from './websocket.module';
|
|
3
|
-
import type { RoomRegistry, SyncDriver } from './ws-sync';
|
|
4
|
-
import type { WsServer } from './websocket.types';
|
|
5
|
-
export declare const WS_GATEWAY_METADATA = "vela:ws-gateway";
|
|
6
|
-
export declare const WS_SUBSCRIBE_METADATA = "vela:ws-subscribe";
|
|
7
|
-
export declare const WS_RESERVED_METADATA = "vela:ws-reserved";
|
|
8
|
-
/**
|
|
9
|
-
* Event names starting with this prefix are RESERVED for framework modules
|
|
10
|
-
* (`$live`, …): app gateways may not subscribe to them, and inbound frames
|
|
11
|
-
* carrying them route to `@ReservedWsEvent` handlers instead of gateways.
|
|
12
|
-
*/
|
|
13
|
-
export declare const RESERVED_WS_EVENT_PREFIX = "$";
|
|
14
|
-
export declare const WsParamType: {
|
|
15
|
-
readonly SOCKET: "ws_socket";
|
|
16
|
-
readonly BODY: "ws_body";
|
|
17
|
-
readonly SERVER: "ws_server";
|
|
18
|
-
};
|
|
19
|
-
export type WsParamType = (typeof WsParamType)[keyof typeof WsParamType];
|
|
20
|
-
/**
|
|
21
|
-
* The connected gateway server handle. Injected into gateways/controllers via
|
|
22
|
-
* `@WebSocketServer()` (constructor injection only — the container has no
|
|
23
|
-
* property-injection pass) or `@Inject(WS_SERVER)`.
|
|
24
|
-
*/
|
|
25
|
-
export declare const WS_SERVER: InjectionToken<WsServer>;
|
|
26
|
-
/** The active cross-instance sync driver (`local()` by default). */
|
|
27
|
-
export declare const WS_SYNC_DRIVER: InjectionToken<SyncDriver>;
|
|
28
|
-
/** The local room-membership registry a transport reads/writes. */
|
|
29
|
-
export declare const WS_ROOM_REGISTRY: InjectionToken<RoomRegistry>;
|
|
30
|
-
export declare const WS_MODULE_OPTIONS: InjectionToken<WebSocketModuleOptions>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "../container/types.js";
|
|
2
|
-
// Free-form metadata keys — same string-token convention as ON_EVENT_METADATA / CRON_METADATA.
|
|
3
|
-
export const WS_GATEWAY_METADATA = 'vela:ws-gateway';
|
|
4
|
-
export const WS_SUBSCRIBE_METADATA = 'vela:ws-subscribe';
|
|
5
|
-
export const WS_RESERVED_METADATA = 'vela:ws-reserved';
|
|
6
|
-
/**
|
|
7
|
-
* Event names starting with this prefix are RESERVED for framework modules
|
|
8
|
-
* (`$live`, …): app gateways may not subscribe to them, and inbound frames
|
|
9
|
-
* carrying them route to `@ReservedWsEvent` handlers instead of gateways.
|
|
10
|
-
*/ export const RESERVED_WS_EVENT_PREFIX = '$';
|
|
11
|
-
// WebSocket parameter-decorator kinds — parallel to `ParamType` for HTTP, keyed
|
|
12
|
-
// by the WS argument resolver rather than the Hono-bound HTTP one.
|
|
13
|
-
export const WsParamType = {
|
|
14
|
-
SOCKET: 'ws_socket',
|
|
15
|
-
BODY: 'ws_body',
|
|
16
|
-
SERVER: 'ws_server'
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The connected gateway server handle. Injected into gateways/controllers via
|
|
20
|
-
* `@WebSocketServer()` (constructor injection only — the container has no
|
|
21
|
-
* property-injection pass) or `@Inject(WS_SERVER)`.
|
|
22
|
-
*/ export const WS_SERVER = new InjectionToken('WS_SERVER');
|
|
23
|
-
/** The active cross-instance sync driver (`local()` by default). */ export const WS_SYNC_DRIVER = new InjectionToken('WS_SYNC_DRIVER');
|
|
24
|
-
/** The local room-membership registry a transport reads/writes. */ export const WS_ROOM_REGISTRY = new InjectionToken('WS_ROOM_REGISTRY');
|
|
25
|
-
// forRoot() options carrier — a typed InjectionToken like every other module
|
|
26
|
-
// options token (the raw-string form was the odd one out).
|
|
27
|
-
export const WS_MODULE_OPTIONS = new InjectionToken('WS_MODULE_OPTIONS');
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { ExecutionContext, WsArgumentsHost } from '../pipeline/types';
|
|
2
|
-
export type { WsArgumentsHost };
|
|
3
|
-
/** The JSON envelope carried over the raw WebSocket. `id` is an optional client correlation id echoed on the reply. */
|
|
4
|
-
export interface WsMessage<T = unknown> {
|
|
5
|
-
id?: string;
|
|
6
|
-
event: string;
|
|
7
|
-
data?: T;
|
|
8
|
-
}
|
|
9
|
-
/** A handler's structured reply. Returning one frames `{ event, data }` back to the sender. */
|
|
10
|
-
export interface WsResponse<T = unknown> {
|
|
11
|
-
event: string;
|
|
12
|
-
data: T;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A single connected socket, normalized across runtimes. Per-connection state
|
|
16
|
-
* lives in `data`; mutations to `data`/room membership are persisted by
|
|
17
|
-
* `commit()` (on Cloudflare this writes the hibernation attachment).
|
|
18
|
-
*/
|
|
19
|
-
export interface WsClient<TData = Record<string, unknown>> {
|
|
20
|
-
readonly id: string;
|
|
21
|
-
readonly rooms: ReadonlySet<string>;
|
|
22
|
-
data: TData;
|
|
23
|
-
/** Frame and send `{ event, data }` (optionally correlated by `id`) to this socket. */
|
|
24
|
-
send(event: string, data?: unknown, id?: string): void;
|
|
25
|
-
/** Send an already-serialized string. Escape hatch for custom framing. */
|
|
26
|
-
sendRaw(payload: string): void;
|
|
27
|
-
join(room: string): void | Promise<void>;
|
|
28
|
-
leave(room: string): void | Promise<void>;
|
|
29
|
-
/** Persist `data`/room mutations made during a handler. */
|
|
30
|
-
commit(): void | Promise<void>;
|
|
31
|
-
close(code?: number, reason?: string): void;
|
|
32
|
-
/** The native socket (`WSContext` on node/bun/deno, `WebSocket` in a Cloudflare DO). */
|
|
33
|
-
readonly raw: unknown;
|
|
34
|
-
}
|
|
35
|
-
/** Fluent broadcast builder. Terminal `.emit()` produces a `BroadcastCommand`. */
|
|
36
|
-
export interface BroadcastOperator {
|
|
37
|
-
to(room: string): BroadcastOperator;
|
|
38
|
-
in(room: string): BroadcastOperator;
|
|
39
|
-
except(room: string): BroadcastOperator;
|
|
40
|
-
emit(event: string, data?: unknown): void | Promise<void>;
|
|
41
|
-
}
|
|
42
|
-
/** The server handle injected via `@WebSocketServer()`. Server-origin broadcasts never exclude anyone. */
|
|
43
|
-
export interface WsServer {
|
|
44
|
-
emit(event: string, data?: unknown): void | Promise<void>;
|
|
45
|
-
to(room: string): BroadcastOperator;
|
|
46
|
-
in(room: string): BroadcastOperator;
|
|
47
|
-
except(room: string): BroadcastOperator;
|
|
48
|
-
}
|
|
49
|
-
/** An `ExecutionContext` whose transport is a WebSocket gateway. `switchToWs()` is guaranteed present. */
|
|
50
|
-
export interface WsExecutionContext extends ExecutionContext {
|
|
51
|
-
switchToWs(): WsArgumentsHost;
|
|
52
|
-
}
|
|
53
|
-
export interface OnGatewayInit {
|
|
54
|
-
afterInit(server: WsServer): void | Promise<void>;
|
|
55
|
-
}
|
|
56
|
-
export interface OnGatewayConnection {
|
|
57
|
-
handleConnection(client: WsClient): void | Promise<void>;
|
|
58
|
-
}
|
|
59
|
-
export interface OnGatewayDisconnect {
|
|
60
|
-
handleDisconnect(client: WsClient): void | Promise<void>;
|
|
61
|
-
}
|
|
62
|
-
export interface WebSocketGatewayOptions {
|
|
63
|
-
/** Route path the upgrade is served on (e.g. `/rooms/:id/ws`). */
|
|
64
|
-
path?: string;
|
|
65
|
-
/** Cloudflare Durable Object binding name that hosts this gateway's sockets. */
|
|
66
|
-
binding?: string;
|
|
67
|
-
}
|
|
68
|
-
/** Stored per `@SubscribeMessage` — a flat class-level list, mirroring `@OnEvent`. */
|
|
69
|
-
export interface SubscribeMessageMetadata {
|
|
70
|
-
event: string;
|
|
71
|
-
methodName: string;
|
|
72
|
-
}
|
|
73
|
-
/** Class-level meta written by `@ReservedWsEvent(event)`. */
|
|
74
|
-
export interface ReservedWsEventMetadata {
|
|
75
|
-
/** The reserved (`$`-prefixed) envelope event this provider handles. */
|
|
76
|
-
event: string;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* A provider claiming a reserved (`$`-prefixed) envelope event across EVERY
|
|
80
|
-
* gateway path. Discovered by `WsDispatcher` at bootstrap via the
|
|
81
|
-
* `@ReservedWsEvent` decorator; inbound frames for the event route here
|
|
82
|
-
* (after app-wide guards), never to gateways. `handleSocketClose` fires for
|
|
83
|
-
* every closing socket so the handler can drop per-connection state.
|
|
84
|
-
*/
|
|
85
|
-
export interface ReservedWsEventHandler {
|
|
86
|
-
handleReservedEvent(path: string, client: WsClient, message: WsMessage): void | Promise<void>;
|
|
87
|
-
handleSocketClose?(path: string, client: WsClient): void | Promise<void>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* A fully serializable broadcast instruction. Crosses isolate / Durable-Object /
|
|
91
|
-
* Redis boundaries as JSON, so every sync driver speaks the same command.
|
|
92
|
-
*/
|
|
93
|
-
export interface BroadcastCommand {
|
|
94
|
-
/** Target rooms. An empty array means GLOBAL (every connection). */
|
|
95
|
-
rooms: string[];
|
|
96
|
-
exceptRooms?: string[];
|
|
97
|
-
exceptIds?: string[];
|
|
98
|
-
/** The exact bytes written to each socket: `JSON.stringify({ event, data })`. */
|
|
99
|
-
frame: string;
|
|
100
|
-
/** Origin instance/DO id — lets pub/sub drivers drop their own echo. */
|
|
101
|
-
origin?: string;
|
|
102
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { PipeTransform } from '../pipeline/types';
|
|
2
|
-
import type { ParameterMetadata } from '../registry/types';
|
|
3
|
-
import type { WsClient } from './websocket.types';
|
|
4
|
-
/**
|
|
5
|
-
* Builds handler arguments for a gateway message. WS sibling of the HTTP
|
|
6
|
-
* `ArgumentResolver`, but sourced from the envelope (`data`) and the socket
|
|
7
|
-
* (`client`) instead of the Hono `Context`.
|
|
8
|
-
*
|
|
9
|
-
* With no parameter decorators the handler receives `(client, data)` — the
|
|
10
|
-
* NestJS gateway convention. Pipes run only over `@MessageBody()` values, where
|
|
11
|
-
* validation/transformation is meaningful.
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveWsArgs(paramMeta: ParameterMetadata[], client: WsClient, data: unknown, pipes: PipeTransform[], paramTypes?: unknown[]): Promise<unknown[]>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { WsParamType } from "./websocket.tokens.js";
|
|
2
|
-
/**
|
|
3
|
-
* Builds handler arguments for a gateway message. WS sibling of the HTTP
|
|
4
|
-
* `ArgumentResolver`, but sourced from the envelope (`data`) and the socket
|
|
5
|
-
* (`client`) instead of the Hono `Context`.
|
|
6
|
-
*
|
|
7
|
-
* With no parameter decorators the handler receives `(client, data)` — the
|
|
8
|
-
* NestJS gateway convention. Pipes run only over `@MessageBody()` values, where
|
|
9
|
-
* validation/transformation is meaningful.
|
|
10
|
-
*/ export async function resolveWsArgs(paramMeta, client, data, pipes, paramTypes) {
|
|
11
|
-
if (paramMeta.length === 0) {
|
|
12
|
-
return [
|
|
13
|
-
client,
|
|
14
|
-
data
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
const maxIndex = paramMeta[paramMeta.length - 1].index;
|
|
18
|
-
const args = new Array(maxIndex + 1).fill(undefined);
|
|
19
|
-
for (const param of paramMeta){
|
|
20
|
-
if (param.type === WsParamType.SOCKET) {
|
|
21
|
-
args[param.index] = client;
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (param.type === WsParamType.BODY) {
|
|
25
|
-
let value = data;
|
|
26
|
-
const metadata = {
|
|
27
|
-
type: param.type,
|
|
28
|
-
data: param.name,
|
|
29
|
-
metatype: paramTypes?.[param.index]
|
|
30
|
-
};
|
|
31
|
-
for (const pipe of pipes){
|
|
32
|
-
value = await pipe.transform(value, metadata);
|
|
33
|
-
}
|
|
34
|
-
args[param.index] = value;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
args[param.index] = undefined;
|
|
38
|
-
}
|
|
39
|
-
return args;
|
|
40
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Container } from '../container/container';
|
|
2
|
-
import { DiscoveryService } from '../discovery/discovery.service';
|
|
3
|
-
import type { ContributesEntrypoints, Entrypoint } from '../entrypoint/entrypoint.types';
|
|
4
|
-
import { RouteManager } from '../http/route.manager';
|
|
5
|
-
import type { OnApplicationBootstrap } from '../lifecycle/index';
|
|
6
|
-
import type { WsClient, WsServer } from './websocket.types';
|
|
7
|
-
/** Metadata carried by each `'websocket'` entrypoint a transport consumes. */
|
|
8
|
-
export interface WsEntrypointMeta {
|
|
9
|
-
/** The gateway's route path (from `@WebSocketGateway({ path })`). */
|
|
10
|
-
path: string;
|
|
11
|
-
/** The dispatcher that routes frames for this gateway. */
|
|
12
|
-
dispatcher: WsDispatcher;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Discovers `@WebSocketGateway` classes at bootstrap (via `DiscoveryService`)
|
|
16
|
-
* and routes inbound messages to `@SubscribeMessage` handlers. Transports read
|
|
17
|
-
* the gateways from `app.entrypoints.ofKind('websocket')` (this dispatcher
|
|
18
|
-
* contributes them) and call `handleOpen`, `dispatchMessage`, `handleClose`,
|
|
19
|
-
* and `handleError`; the guard → pipe → interceptor → filter pipeline
|
|
20
|
-
* (including `APP_*` global components) runs through the shared
|
|
21
|
-
* `PipelineRunner`.
|
|
22
|
-
*/
|
|
23
|
-
export declare class WsDispatcher implements OnApplicationBootstrap, ContributesEntrypoints {
|
|
24
|
-
private readonly container;
|
|
25
|
-
private readonly discovery;
|
|
26
|
-
private readonly server?;
|
|
27
|
-
private readonly routeManager?;
|
|
28
|
-
private readonly gateways;
|
|
29
|
-
private readonly reserved;
|
|
30
|
-
constructor(container: Container, discovery: DiscoveryService, server?: WsServer | undefined, routeManager?: RouteManager | undefined);
|
|
31
|
-
/** Paths of every discovered `@WebSocketGateway` — used by transports to register routes. */
|
|
32
|
-
get gatewayPaths(): string[];
|
|
33
|
-
onApplicationBootstrap(): Promise<void>;
|
|
34
|
-
/** One `'websocket'` entrypoint per discovered gateway (authoritative). */
|
|
35
|
-
collectEntrypoints(): Entrypoint<WsEntrypointMeta>[];
|
|
36
|
-
handleOpen(path: string, client: WsClient): Promise<void>;
|
|
37
|
-
handleClose(path: string, client: WsClient, _code: number, _reason: string): Promise<void>;
|
|
38
|
-
handleError(path: string, _client: WsClient, err: unknown): Promise<void>;
|
|
39
|
-
dispatchMessage(path: string, client: WsClient, raw: string | ArrayBuffer): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Route a reserved (`$…`) frame to its claiming handler. App-wide (`APP_*` /
|
|
42
|
-
* `useGlobalGuards`) guards protect reserved frames exactly like gateway
|
|
43
|
-
* messages — guards-first, WS convention; handler/class-tier components are
|
|
44
|
-
* the claiming module's own concern (e.g. live resolvers run their scoped
|
|
45
|
-
* guards at subscribe).
|
|
46
|
-
*/
|
|
47
|
-
private dispatchReserved;
|
|
48
|
-
private reply;
|
|
49
|
-
private runFilters;
|
|
50
|
-
private trySend;
|
|
51
|
-
private reportBootstrapError;
|
|
52
|
-
private parse;
|
|
53
|
-
private buildGatewayEntry;
|
|
54
|
-
}
|