@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,52 +0,0 @@
|
|
|
1
|
-
import { RouteManager } from '../route.manager';
|
|
2
|
-
import type { RouteName, RouteParams } from '../route-map';
|
|
3
|
-
/** Value accepted for a path param or query entry. */
|
|
4
|
-
type UrlParamValue = string | number | boolean;
|
|
5
|
-
/** Extra options for {@link UrlGeneratorService.urlFor}. */
|
|
6
|
-
export interface UrlForOptions {
|
|
7
|
-
/** Additional query-string entries merged after any leftover params. */
|
|
8
|
-
query?: Record<string, UrlParamValue>;
|
|
9
|
-
}
|
|
10
|
-
/** Options for {@link UrlGeneratorService.signedUrl}. */
|
|
11
|
-
export interface SignedUrlGenerateOptions {
|
|
12
|
-
/** Time-to-live in seconds; enforced on verification via the `expires` param. */
|
|
13
|
-
expiresIn?: number;
|
|
14
|
-
/** Override the signing secret (else the `URL_SIGNING_SECRET` token / `CONFIG_ENV`). */
|
|
15
|
-
secret?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Builds URLs for named routes (Laravel-flavoured `route()` ergonomics).
|
|
19
|
-
*
|
|
20
|
-
* Route descriptions are read LAZILY from the {@link RouteManager} on first use
|
|
21
|
-
* — post-build, so composition (global prefix + version + controller prefix) is
|
|
22
|
-
* already baked into each path — and it never instantiates controllers, so it
|
|
23
|
-
* plays nicely with lazy modules. Registered as an app-level singleton by
|
|
24
|
-
* `bootstrap`, so it is injectable anywhere.
|
|
25
|
-
*/
|
|
26
|
-
export declare class UrlGeneratorService {
|
|
27
|
-
private readonly routeManager;
|
|
28
|
-
private readonly secretToken?;
|
|
29
|
-
private readonly env;
|
|
30
|
-
private routeMap;
|
|
31
|
-
constructor(routeManager: RouteManager, secretToken?: string | undefined, env?: Record<string, unknown>);
|
|
32
|
-
/**
|
|
33
|
-
* Build the path for a named route, filling `:param` placeholders from
|
|
34
|
-
* `params`. Params that don't match a placeholder become query-string
|
|
35
|
-
* entries; `opts.query` is merged after them.
|
|
36
|
-
*
|
|
37
|
-
* @throws if no route carries `name`, or a required `:param` is missing.
|
|
38
|
-
*/
|
|
39
|
-
urlFor<N extends RouteName>(name: N, params?: RouteParams<N>, opts?: UrlForOptions): string;
|
|
40
|
-
/**
|
|
41
|
-
* Build a named-route URL and HMAC-sign it (path + query). The secret comes
|
|
42
|
-
* from `options.secret`, else the {@link URL_SIGNING_SECRET} token, else
|
|
43
|
-
* `CONFIG_ENV`; a descriptive error is thrown when none is available.
|
|
44
|
-
*/
|
|
45
|
-
signedUrl<N extends RouteName>(name: N, params?: RouteParams<N>, options?: SignedUrlGenerateOptions): Promise<string>;
|
|
46
|
-
/**
|
|
47
|
-
* Lazily index named route descriptions. Rebuilt while empty (routes may not
|
|
48
|
-
* be built yet), cached once populated.
|
|
49
|
-
*/
|
|
50
|
-
private routes;
|
|
51
|
-
}
|
|
52
|
-
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
function _ts_metadata(k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
function _ts_param(paramIndex, decorator) {
|
|
11
|
-
return function(target, key) {
|
|
12
|
-
decorator(target, key, paramIndex);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
import { Injectable, Inject, Optional } from "../../container/decorators.js";
|
|
16
|
-
import { CONFIG_ENV } from "../../config/config.tokens.js";
|
|
17
|
-
import { signUrl } from "../../crypto/signed-url.js";
|
|
18
|
-
import { RouteManager } from "../route.manager.js";
|
|
19
|
-
import { URL_SIGNING_SECRET, resolveSigningSecret } from "./signing-secret.js";
|
|
20
|
-
export class UrlGeneratorService {
|
|
21
|
-
routeManager;
|
|
22
|
-
secretToken;
|
|
23
|
-
env;
|
|
24
|
-
routeMap = null;
|
|
25
|
-
constructor(routeManager, secretToken, env = {}){
|
|
26
|
-
this.routeManager = routeManager;
|
|
27
|
-
this.secretToken = secretToken;
|
|
28
|
-
this.env = env;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Build the path for a named route, filling `:param` placeholders from
|
|
32
|
-
* `params`. Params that don't match a placeholder become query-string
|
|
33
|
-
* entries; `opts.query` is merged after them.
|
|
34
|
-
*
|
|
35
|
-
* @throws if no route carries `name`, or a required `:param` is missing.
|
|
36
|
-
*/ urlFor(name, params, opts) {
|
|
37
|
-
const description = this.routes().get(name);
|
|
38
|
-
if (!description) {
|
|
39
|
-
throw new Error(`No route named "${String(name)}" was found. Give the route a name ` + `via \`@Get(path, { name: '${String(name)}' })\`.`);
|
|
40
|
-
}
|
|
41
|
-
const provided = {
|
|
42
|
-
...params ?? {}
|
|
43
|
-
};
|
|
44
|
-
const consumed = new Set();
|
|
45
|
-
const path = description.path.replace(/:([A-Za-z0-9_]+)/g, (_match, key)=>{
|
|
46
|
-
const value = provided[key];
|
|
47
|
-
if (value === undefined || value === null) {
|
|
48
|
-
throw new Error(`Missing route param "${key}" for route "${String(name)}".`);
|
|
49
|
-
}
|
|
50
|
-
consumed.add(key);
|
|
51
|
-
return encodeURIComponent(String(value));
|
|
52
|
-
});
|
|
53
|
-
const query = new URLSearchParams();
|
|
54
|
-
for (const [key, value] of Object.entries(provided)){
|
|
55
|
-
if (consumed.has(key) || value === undefined || value === null) continue;
|
|
56
|
-
query.set(key, String(value));
|
|
57
|
-
}
|
|
58
|
-
for (const [key, value] of Object.entries(opts?.query ?? {})){
|
|
59
|
-
if (value === undefined || value === null) continue;
|
|
60
|
-
query.set(key, String(value));
|
|
61
|
-
}
|
|
62
|
-
const qs = query.toString();
|
|
63
|
-
return qs ? `${path}?${qs}` : path;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Build a named-route URL and HMAC-sign it (path + query). The secret comes
|
|
67
|
-
* from `options.secret`, else the {@link URL_SIGNING_SECRET} token, else
|
|
68
|
-
* `CONFIG_ENV`; a descriptive error is thrown when none is available.
|
|
69
|
-
*/ async signedUrl(name, params, options = {}) {
|
|
70
|
-
const url = this.urlFor(name, params);
|
|
71
|
-
const secret = resolveSigningSecret(options.secret, this.secretToken, this.env);
|
|
72
|
-
return signUrl(url, secret, options.expiresIn !== undefined ? {
|
|
73
|
-
expiresIn: options.expiresIn
|
|
74
|
-
} : undefined);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Lazily index named route descriptions. Rebuilt while empty (routes may not
|
|
78
|
-
* be built yet), cached once populated.
|
|
79
|
-
*/ routes() {
|
|
80
|
-
if (this.routeMap && this.routeMap.size > 0) return this.routeMap;
|
|
81
|
-
const map = new Map();
|
|
82
|
-
for (const description of this.routeManager.getRouteDescriptions()){
|
|
83
|
-
if (description.name && !map.has(description.name)) {
|
|
84
|
-
map.set(description.name, description);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
this.routeMap = map;
|
|
88
|
-
return map;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
UrlGeneratorService = _ts_decorate([
|
|
92
|
-
Injectable(),
|
|
93
|
-
_ts_param(0, Inject(RouteManager)),
|
|
94
|
-
_ts_param(1, Optional()),
|
|
95
|
-
_ts_param(1, Inject(URL_SIGNING_SECRET)),
|
|
96
|
-
_ts_param(2, Optional()),
|
|
97
|
-
_ts_param(2, Inject(CONFIG_ENV)),
|
|
98
|
-
_ts_metadata("design:type", Function),
|
|
99
|
-
_ts_metadata("design:paramtypes", [
|
|
100
|
-
typeof RouteManager === "undefined" ? Object : RouteManager,
|
|
101
|
-
String,
|
|
102
|
-
typeof Record === "undefined" ? Object : Record
|
|
103
|
-
])
|
|
104
|
-
], UrlGeneratorService);
|
package/dist/i18n/deep-merge.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Deep-merge two message trees; source overrides target at the leaf level. */ export function deepMerge(target, source) {
|
|
2
|
-
const result = {
|
|
3
|
-
...target
|
|
4
|
-
};
|
|
5
|
-
for (const key of Object.keys(source)){
|
|
6
|
-
const targetValue = target[key];
|
|
7
|
-
const sourceValue = source[key];
|
|
8
|
-
if (typeof targetValue === 'object' && targetValue !== null && !Array.isArray(targetValue) && typeof sourceValue === 'object' && sourceValue !== null && !Array.isArray(sourceValue)) {
|
|
9
|
-
result[key] = deepMerge(targetValue, sourceValue);
|
|
10
|
-
} else {
|
|
11
|
-
result[key] = sourceValue;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Context, Next } from 'hono';
|
|
2
|
-
import type { NestMiddleware } from '../pipeline/types';
|
|
3
|
-
import { type I18nModuleOptions } from './i18n.options';
|
|
4
|
-
/**
|
|
5
|
-
* Detects the request locale and stashes it on the per-request RequestContext
|
|
6
|
-
* bag under {@link I18N_LOCALE_KEY}, where {@link I18nService} reads it.
|
|
7
|
-
* Registered globally via APP_MIDDLEWARE by {@link I18nModule}. Holds no
|
|
8
|
-
* per-request state (reads the RequestContext off the request container each
|
|
9
|
-
* call), so a singleton instance is safe.
|
|
10
|
-
*/
|
|
11
|
-
export declare class I18nLocaleMiddleware implements NestMiddleware {
|
|
12
|
-
private readonly resolved;
|
|
13
|
-
constructor(options: I18nModuleOptions);
|
|
14
|
-
use(c: Context, next: Next): Promise<Response | void>;
|
|
15
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
function _ts_metadata(k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
function _ts_param(paramIndex, decorator) {
|
|
11
|
-
return function(target, key) {
|
|
12
|
-
decorator(target, key, paramIndex);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
import { Inject, Injectable } from "../container/decorators.js";
|
|
16
|
-
import { REQUEST_CONTEXT } from "../http/request-context.js";
|
|
17
|
-
import { resolveI18nOptions } from "./i18n.options.js";
|
|
18
|
-
import { I18N_LOCALE_KEY, I18N_OPTIONS } from "./i18n.tokens.js";
|
|
19
|
-
export class I18nLocaleMiddleware {
|
|
20
|
-
resolved;
|
|
21
|
-
constructor(options){
|
|
22
|
-
this.resolved = resolveI18nOptions(options);
|
|
23
|
-
}
|
|
24
|
-
async use(c, next) {
|
|
25
|
-
const container = c.get('container');
|
|
26
|
-
if (container) {
|
|
27
|
-
const ctx = container.resolve(REQUEST_CONTEXT);
|
|
28
|
-
ctx.set(I18N_LOCALE_KEY, detectLocale(c, this.resolved));
|
|
29
|
-
}
|
|
30
|
-
return next();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
I18nLocaleMiddleware = _ts_decorate([
|
|
34
|
-
Injectable(),
|
|
35
|
-
_ts_param(0, Inject(I18N_OPTIONS)),
|
|
36
|
-
_ts_metadata("design:type", Function),
|
|
37
|
-
_ts_metadata("design:paramtypes", [
|
|
38
|
-
typeof I18nModuleOptions === "undefined" ? Object : I18nModuleOptions
|
|
39
|
-
])
|
|
40
|
-
], I18nLocaleMiddleware);
|
|
41
|
-
function detectLocale(c, resolved) {
|
|
42
|
-
if (!resolved.detection.enabled) return resolved.defaultLocale;
|
|
43
|
-
const { strategy, lookupKey } = resolved.detection;
|
|
44
|
-
// Candidate tags in preference order.
|
|
45
|
-
const candidates = strategy === 'query' ? [
|
|
46
|
-
new URL(c.req.url).searchParams.get(lookupKey) ?? ''
|
|
47
|
-
] : strategy === 'cookie' ? [
|
|
48
|
-
readCookie(c.req.raw.headers.get('cookie'), lookupKey) ?? ''
|
|
49
|
-
] : parseAcceptLanguage(c.req.raw.headers.get('accept-language'));
|
|
50
|
-
for (const candidate of candidates){
|
|
51
|
-
const match = matchLocale(candidate, resolved.locales);
|
|
52
|
-
if (match) return match;
|
|
53
|
-
}
|
|
54
|
-
return resolved.defaultLocale;
|
|
55
|
-
}
|
|
56
|
-
/** Case-insensitive locale match with region fallback (en-US -> en); returns the configured casing. */ function matchLocale(candidate, locales) {
|
|
57
|
-
if (!candidate) return undefined;
|
|
58
|
-
const lc = candidate.toLowerCase();
|
|
59
|
-
const exact = locales.find((l)=>l.toLowerCase() === lc);
|
|
60
|
-
if (exact) return exact;
|
|
61
|
-
const base = lc.split('-')[0];
|
|
62
|
-
return locales.find((l)=>l.toLowerCase().split('-')[0] === base);
|
|
63
|
-
}
|
|
64
|
-
/** Parse Accept-Language into tags ordered by descending q-value (RFC 7231). */ function parseAcceptLanguage(header) {
|
|
65
|
-
if (!header) return [];
|
|
66
|
-
return header.split(',').map((part)=>{
|
|
67
|
-
const [tag, ...params] = part.trim().split(';');
|
|
68
|
-
let q = 1;
|
|
69
|
-
for (const p of params){
|
|
70
|
-
const m = p.trim().match(/^q=([\d.]+)$/);
|
|
71
|
-
if (m) q = Number.parseFloat(m[1]);
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
tag: (tag ?? '').trim(),
|
|
75
|
-
q: Number.isNaN(q) ? 0 : q
|
|
76
|
-
};
|
|
77
|
-
}).filter((e)=>e.tag && e.tag !== '*').sort((a, b)=>b.q - a.q).map((e)=>e.tag);
|
|
78
|
-
}
|
|
79
|
-
function readCookie(header, name) {
|
|
80
|
-
if (!header) return undefined;
|
|
81
|
-
for (const part of header.split(';')){
|
|
82
|
-
const [rawKey, ...rest] = part.split('=');
|
|
83
|
-
if (rawKey?.trim() === name) {
|
|
84
|
-
const raw = rest.join('=').trim();
|
|
85
|
-
try {
|
|
86
|
-
return decodeURIComponent(raw);
|
|
87
|
-
} catch {
|
|
88
|
-
// Malformed percent-encoding must not crash locale detection.
|
|
89
|
-
return raw;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DynamicModule } from '../module/types';
|
|
2
|
-
import type { I18nModuleOptions } from './i18n.options';
|
|
3
|
-
declare const ConfigurableModuleClass: import("..").ConfigurableModuleClassType<I18nModuleOptions, "forRoot", "create", {
|
|
4
|
-
isGlobal?: boolean;
|
|
5
|
-
}>;
|
|
6
|
-
export declare class I18nModule extends ConfigurableModuleClass {
|
|
7
|
-
/**
|
|
8
|
-
* forFeature-style: contribute a message tree (`{ [locale]: { ...messages } }`).
|
|
9
|
-
* Contributions are collected statically at module-load and deep-merged.
|
|
10
|
-
*/
|
|
11
|
-
static registerMessages(messages: Record<string, Record<string, unknown>>): DynamicModule;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
package/dist/i18n/i18n.module.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
import { Module } from "../module/decorators.js";
|
|
8
|
-
import { ConfigurableModuleBuilder } from "../module/configurable-module.builder.js";
|
|
9
|
-
import { stableHash } from "../module/stable-hash.js";
|
|
10
|
-
import { APP_MIDDLEWARE } from "../pipeline/tokens.js";
|
|
11
|
-
import { I18nLocaleMiddleware } from "./i18n.middleware.js";
|
|
12
|
-
import { I18nService } from "./i18n.service.js";
|
|
13
|
-
import { I18N_OPTIONS } from "./i18n.tokens.js";
|
|
14
|
-
import { MessageLoaderService } from "./message-loader.service.js";
|
|
15
|
-
import { MessageRegistry } from "./message-registry.js";
|
|
16
|
-
const { ConfigurableModuleClass } = new ConfigurableModuleBuilder({
|
|
17
|
-
moduleName: 'I18n',
|
|
18
|
-
optionsInjectionToken: I18N_OPTIONS
|
|
19
|
-
}).build();
|
|
20
|
-
// Empty marker module for `registerMessages`. The contribution is a side-effect
|
|
21
|
-
// on the global MessageRegistry; this carries NO providers so it never
|
|
22
|
-
// duplicates I18nModule's providers (which would trip vela's multi-instance
|
|
23
|
-
// encapsulation → MultipleProvidersFoundError). New modules whose contribution
|
|
24
|
-
// is providers (not an external registry) should use `sideEffectModule` from
|
|
25
|
-
// the authoring kit; this predates it and keeps a shared-class identity so
|
|
26
|
-
// identical message trees dedup as one module instance.
|
|
27
|
-
let I18nMessagesModule = class I18nMessagesModule {
|
|
28
|
-
};
|
|
29
|
-
I18nMessagesModule = _ts_decorate([
|
|
30
|
-
Module({})
|
|
31
|
-
], I18nMessagesModule);
|
|
32
|
-
export class I18nModule extends ConfigurableModuleClass {
|
|
33
|
-
/**
|
|
34
|
-
* forFeature-style: contribute a message tree (`{ [locale]: { ...messages } }`).
|
|
35
|
-
* Contributions are collected statically at module-load and deep-merged.
|
|
36
|
-
*/ static registerMessages(messages) {
|
|
37
|
-
MessageRegistry.addMessages(messages);
|
|
38
|
-
return {
|
|
39
|
-
module: I18nMessagesModule,
|
|
40
|
-
key: `messages:${stableHash(messages)}`,
|
|
41
|
-
providers: []
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
I18nModule = _ts_decorate([
|
|
46
|
-
Module({
|
|
47
|
-
// Lazy: the merged-message snapshot (MessageLoaderService constructor) and
|
|
48
|
-
// locale middleware materialize on the first request that reaches them —
|
|
49
|
-
// message registration itself is import-time and unaffected. Safe because
|
|
50
|
-
// the route-build priority probe skips lazy-pending APP_MIDDLEWARE tokens.
|
|
51
|
-
lazy: true,
|
|
52
|
-
providers: [
|
|
53
|
-
MessageRegistry,
|
|
54
|
-
MessageLoaderService,
|
|
55
|
-
I18nService,
|
|
56
|
-
I18nLocaleMiddleware,
|
|
57
|
-
// Register the locale middleware globally (NestJS APP_MIDDLEWARE convention).
|
|
58
|
-
{
|
|
59
|
-
provide: APP_MIDDLEWARE,
|
|
60
|
-
useExisting: I18nLocaleMiddleware
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
exports: [
|
|
64
|
-
I18nService,
|
|
65
|
-
MessageLoaderService,
|
|
66
|
-
I18N_OPTIONS
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
], I18nModule);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** How the request locale is detected. */
|
|
2
|
-
export type DetectionStrategy = 'header' | 'query' | 'cookie';
|
|
3
|
-
export interface I18nModuleOptions {
|
|
4
|
-
/** Default locale. @default 'en' */
|
|
5
|
-
defaultLocale?: string;
|
|
6
|
-
/** Fallback when a translation is missing. @default defaultLocale */
|
|
7
|
-
fallbackLocale?: string;
|
|
8
|
-
/** Supported locales; request locales outside this list fall back to default. @default ['en'] */
|
|
9
|
-
locales?: string[];
|
|
10
|
-
/** Locale detection config. */
|
|
11
|
-
detection?: {
|
|
12
|
-
/** Set false to disable detection (always use defaultLocale). @default true */
|
|
13
|
-
enabled?: boolean;
|
|
14
|
-
/** @default 'header' (Accept-Language) */
|
|
15
|
-
strategy?: DetectionStrategy;
|
|
16
|
-
/** Cookie/query parameter name. @default 'locale' */
|
|
17
|
-
lookupKey?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export interface ResolvedI18nOptions {
|
|
21
|
-
defaultLocale: string;
|
|
22
|
-
fallbackLocale: string;
|
|
23
|
-
locales: string[];
|
|
24
|
-
detection: {
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
strategy: DetectionStrategy;
|
|
27
|
-
lookupKey: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export declare function resolveI18nOptions(options?: I18nModuleOptions): ResolvedI18nOptions;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** How the request locale is detected. */ export function resolveI18nOptions(options) {
|
|
2
|
-
const detection = options?.detection;
|
|
3
|
-
const defaultLocale = options?.defaultLocale ?? 'en';
|
|
4
|
-
return {
|
|
5
|
-
defaultLocale,
|
|
6
|
-
fallbackLocale: options?.fallbackLocale ?? defaultLocale,
|
|
7
|
-
locales: options?.locales ?? [
|
|
8
|
-
'en'
|
|
9
|
-
],
|
|
10
|
-
detection: {
|
|
11
|
-
enabled: detection?.enabled !== false,
|
|
12
|
-
strategy: detection?.strategy ?? 'header',
|
|
13
|
-
lookupKey: detection?.lookupKey ?? 'locale'
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type RequestContext } from '../http/request-context';
|
|
2
|
-
import type { I18nModuleOptions } from './i18n.options';
|
|
3
|
-
import type { II18nService } from './i18n.types';
|
|
4
|
-
import { MessageLoaderService } from './message-loader.service';
|
|
5
|
-
/**
|
|
6
|
-
* Request-scoped translation facade. Reads the locale resolved by
|
|
7
|
-
* {@link I18nLocaleMiddleware} from the per-request RequestContext.
|
|
8
|
-
*
|
|
9
|
-
* Injecting it into a controller/service is safe: vela's request-scope bubbling
|
|
10
|
-
* promotes the consumer to request scope automatically, so no captive-dependency
|
|
11
|
-
* hazard and no `ambientContainer` flag required.
|
|
12
|
-
*/
|
|
13
|
-
export declare class I18nService implements II18nService {
|
|
14
|
-
private readonly loader;
|
|
15
|
-
private readonly ctx;
|
|
16
|
-
private readonly options;
|
|
17
|
-
constructor(loader: MessageLoaderService, ctx: RequestContext, options: I18nModuleOptions);
|
|
18
|
-
t(key: string, params?: Record<string, unknown>): string;
|
|
19
|
-
getLocale(): string;
|
|
20
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
function _ts_metadata(k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
function _ts_param(paramIndex, decorator) {
|
|
11
|
-
return function(target, key) {
|
|
12
|
-
decorator(target, key, paramIndex);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
import { Scope } from "../constants.js";
|
|
16
|
-
import { Inject, Injectable } from "../container/decorators.js";
|
|
17
|
-
import { REQUEST_CONTEXT } from "../http/request-context.js";
|
|
18
|
-
import { I18N_LOCALE_KEY, I18N_OPTIONS } from "./i18n.tokens.js";
|
|
19
|
-
import { MessageLoaderService } from "./message-loader.service.js";
|
|
20
|
-
export class I18nService {
|
|
21
|
-
loader;
|
|
22
|
-
ctx;
|
|
23
|
-
options;
|
|
24
|
-
constructor(loader, ctx, options){
|
|
25
|
-
this.loader = loader;
|
|
26
|
-
this.ctx = ctx;
|
|
27
|
-
this.options = options;
|
|
28
|
-
}
|
|
29
|
-
t(key, params) {
|
|
30
|
-
return this.loader.translate(this.getLocale(), key, params);
|
|
31
|
-
}
|
|
32
|
-
getLocale() {
|
|
33
|
-
return this.ctx.get(I18N_LOCALE_KEY) ?? this.options.defaultLocale ?? 'en';
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
I18nService = _ts_decorate([
|
|
37
|
-
Injectable({
|
|
38
|
-
scope: Scope.REQUEST
|
|
39
|
-
}),
|
|
40
|
-
_ts_param(0, Inject(MessageLoaderService)),
|
|
41
|
-
_ts_param(1, Inject(REQUEST_CONTEXT)),
|
|
42
|
-
_ts_param(2, Inject(I18N_OPTIONS)),
|
|
43
|
-
_ts_metadata("design:type", Function),
|
|
44
|
-
_ts_metadata("design:paramtypes", [
|
|
45
|
-
typeof MessageLoaderService === "undefined" ? Object : MessageLoaderService,
|
|
46
|
-
typeof RequestContext === "undefined" ? Object : RequestContext,
|
|
47
|
-
typeof I18nModuleOptions === "undefined" ? Object : I18nModuleOptions
|
|
48
|
-
])
|
|
49
|
-
], I18nService);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '../container/types';
|
|
2
|
-
import type { I18nModuleOptions } from './i18n.options';
|
|
3
|
-
/** Options bag from `I18nModule.forRoot()` (the ConfigurableModuleBuilder options token). */
|
|
4
|
-
export declare const I18N_OPTIONS: InjectionToken<I18nModuleOptions>;
|
|
5
|
-
/** Key under which the resolved locale is stashed on the per-request RequestContext bag. */
|
|
6
|
-
export declare const I18N_LOCALE_KEY: unique symbol;
|
package/dist/i18n/i18n.tokens.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "../container/types.js";
|
|
2
|
-
/** Options bag from `I18nModule.forRoot()` (the ConfigurableModuleBuilder options token). */ export const I18N_OPTIONS = new InjectionToken('I18N_OPTIONS');
|
|
3
|
-
/** Key under which the resolved locale is stashed on the per-request RequestContext bag. */ export const I18N_LOCALE_KEY = Symbol.for('vela:i18n:locale');
|
package/dist/i18n/i18n.types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { I18nModuleOptions } from './i18n.options';
|
|
2
|
-
import { MessageRegistry } from './message-registry';
|
|
3
|
-
/**
|
|
4
|
-
* Compiles and caches ICU messages (via `intl-messageformat`). Singleton: reads
|
|
5
|
-
* the merged registry once at construction (all `registerMessages` calls run at
|
|
6
|
-
* module-load, before providers are instantiated), flattens each locale to
|
|
7
|
-
* dot-paths, and compiles lazily per locale.
|
|
8
|
-
*/
|
|
9
|
-
export declare class MessageLoaderService {
|
|
10
|
-
private readonly cache;
|
|
11
|
-
private readonly compiledCache;
|
|
12
|
-
private readonly defaultLocale;
|
|
13
|
-
private readonly fallbackLocale;
|
|
14
|
-
constructor(registry: MessageRegistry, options: I18nModuleOptions);
|
|
15
|
-
translate(locale: string, key: string, params?: Record<string, unknown>): string;
|
|
16
|
-
getAvailableLocales(): string[];
|
|
17
|
-
isLocaleSupported(locale: string): boolean;
|
|
18
|
-
getDefaultLocale(): string;
|
|
19
|
-
private getCompiledMessages;
|
|
20
|
-
private flattenMessages;
|
|
21
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
function _ts_metadata(k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
function _ts_param(paramIndex, decorator) {
|
|
11
|
-
return function(target, key) {
|
|
12
|
-
decorator(target, key, paramIndex);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
import IntlMessageFormat from "intl-messageformat";
|
|
16
|
-
import { Inject, Injectable } from "../container/decorators.js";
|
|
17
|
-
import { I18N_OPTIONS } from "./i18n.tokens.js";
|
|
18
|
-
import { MessageRegistry } from "./message-registry.js";
|
|
19
|
-
export class MessageLoaderService {
|
|
20
|
-
cache = new Map();
|
|
21
|
-
compiledCache = new Map();
|
|
22
|
-
defaultLocale;
|
|
23
|
-
fallbackLocale;
|
|
24
|
-
constructor(registry, options){
|
|
25
|
-
this.defaultLocale = options?.defaultLocale ?? 'en';
|
|
26
|
-
this.fallbackLocale = options?.fallbackLocale ?? this.defaultLocale;
|
|
27
|
-
const merged = registry.getMergedMessages();
|
|
28
|
-
for (const locale of Object.keys(merged)){
|
|
29
|
-
this.cache.set(locale, merged[locale]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
translate(locale, key, params) {
|
|
33
|
-
const primary = this.getCompiledMessages(locale)[key];
|
|
34
|
-
if (primary) return primary(params);
|
|
35
|
-
// Per-key fallback: a supported locale missing an individual key falls back
|
|
36
|
-
// to fallbackLocale before giving up (returning the raw key).
|
|
37
|
-
if (this.fallbackLocale !== locale) {
|
|
38
|
-
const fallback = this.getCompiledMessages(this.fallbackLocale)[key];
|
|
39
|
-
if (fallback) return fallback(params);
|
|
40
|
-
}
|
|
41
|
-
return key; // missing everywhere → return the key (dev-friendly)
|
|
42
|
-
}
|
|
43
|
-
getAvailableLocales() {
|
|
44
|
-
return [
|
|
45
|
-
...this.cache.keys()
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
isLocaleSupported(locale) {
|
|
49
|
-
return this.cache.has(locale);
|
|
50
|
-
}
|
|
51
|
-
getDefaultLocale() {
|
|
52
|
-
return this.defaultLocale;
|
|
53
|
-
}
|
|
54
|
-
getCompiledMessages(locale) {
|
|
55
|
-
const effectiveLocale = this.cache.has(locale) ? locale : this.defaultLocale;
|
|
56
|
-
const cached = this.compiledCache.get(effectiveLocale);
|
|
57
|
-
if (cached) return cached;
|
|
58
|
-
const flattened = this.flattenMessages(this.cache.get(effectiveLocale) ?? {});
|
|
59
|
-
const compiled = {};
|
|
60
|
-
for (const [key, value] of Object.entries(flattened)){
|
|
61
|
-
const msg = new IntlMessageFormat(value, effectiveLocale);
|
|
62
|
-
compiled[key] = (params)=>String(msg.format(params));
|
|
63
|
-
}
|
|
64
|
-
this.compiledCache.set(effectiveLocale, compiled);
|
|
65
|
-
return compiled;
|
|
66
|
-
}
|
|
67
|
-
flattenMessages(messages, prefix = '') {
|
|
68
|
-
const result = {};
|
|
69
|
-
for (const key of Object.keys(messages)){
|
|
70
|
-
const value = messages[key];
|
|
71
|
-
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
72
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
73
|
-
Object.assign(result, this.flattenMessages(value, newKey));
|
|
74
|
-
} else {
|
|
75
|
-
result[newKey] = String(value);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
MessageLoaderService = _ts_decorate([
|
|
82
|
-
Injectable(),
|
|
83
|
-
_ts_param(0, Inject(MessageRegistry)),
|
|
84
|
-
_ts_param(1, Inject(I18N_OPTIONS)),
|
|
85
|
-
_ts_metadata("design:type", Function),
|
|
86
|
-
_ts_metadata("design:paramtypes", [
|
|
87
|
-
typeof MessageRegistry === "undefined" ? Object : MessageRegistry,
|
|
88
|
-
typeof I18nModuleOptions === "undefined" ? Object : I18nModuleOptions
|
|
89
|
-
])
|
|
90
|
-
], MessageLoaderService);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type Contribution = Record<string, Record<string, unknown>>;
|
|
2
|
-
/**
|
|
3
|
-
* Accumulates i18n messages from multiple `I18nModule.registerMessages()` calls
|
|
4
|
-
* (statically, at module import time), deep-merged on read by
|
|
5
|
-
* {@link MessageLoaderService}. Later registrations override earlier ones at the
|
|
6
|
-
* leaf level.
|
|
7
|
-
*/
|
|
8
|
-
export declare class MessageRegistry {
|
|
9
|
-
/** Called by `I18nModule.registerMessages()`. */
|
|
10
|
-
static addMessages(messages: Contribution): void;
|
|
11
|
-
/** All contributions deep-merged, per locale, in registration order. */
|
|
12
|
-
getMergedMessages(): Record<string, Record<string, unknown>>;
|
|
13
|
-
/** @internal — testing */
|
|
14
|
-
static reset(): void;
|
|
15
|
-
}
|
|
16
|
-
export {};
|