@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,60 +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 } from "../container/decorators.js";
|
|
16
|
-
import { Reflector } from "../pipeline/reflector.js";
|
|
17
|
-
import { CACHE_MANAGER, CACHE_MODULE_OPTIONS, CACHE_KEY_METADATA, CACHE_TTL_METADATA } from "./cache.tokens.js";
|
|
18
|
-
export class CacheInterceptor {
|
|
19
|
-
cacheStore;
|
|
20
|
-
options;
|
|
21
|
-
reflector = new Reflector();
|
|
22
|
-
constructor(cacheStore, options){
|
|
23
|
-
this.cacheStore = cacheStore;
|
|
24
|
-
this.options = options;
|
|
25
|
-
}
|
|
26
|
-
async intercept(context, next) {
|
|
27
|
-
const request = context.getRequest();
|
|
28
|
-
// Only cache GET requests
|
|
29
|
-
if (request.method !== 'GET') {
|
|
30
|
-
return next.handle();
|
|
31
|
-
}
|
|
32
|
-
// Determine cache key
|
|
33
|
-
const customKey = this.reflector.getAllAndOverride(CACHE_KEY_METADATA, context);
|
|
34
|
-
const url = new URL(request.url);
|
|
35
|
-
const cacheKey = customKey ?? `cache:GET:${url.pathname}`;
|
|
36
|
-
// Check cache
|
|
37
|
-
const cached = this.cacheStore.get(cacheKey);
|
|
38
|
-
if (cached !== undefined) {
|
|
39
|
-
return cached;
|
|
40
|
-
}
|
|
41
|
-
// Execute handler
|
|
42
|
-
const result = await next.handle();
|
|
43
|
-
// Determine TTL
|
|
44
|
-
const customTtl = this.reflector.getAllAndOverride(CACHE_TTL_METADATA, context);
|
|
45
|
-
const ttl = customTtl ?? this.options.ttl ?? 5;
|
|
46
|
-
// Store in cache
|
|
47
|
-
this.cacheStore.set(cacheKey, result, ttl);
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
CacheInterceptor = _ts_decorate([
|
|
52
|
-
Injectable(),
|
|
53
|
-
_ts_param(0, Inject(CACHE_MANAGER)),
|
|
54
|
-
_ts_param(1, Inject(CACHE_MODULE_OPTIONS)),
|
|
55
|
-
_ts_metadata("design:type", Function),
|
|
56
|
-
_ts_metadata("design:paramtypes", [
|
|
57
|
-
typeof CacheStore === "undefined" ? Object : CacheStore,
|
|
58
|
-
typeof CacheModuleOptions === "undefined" ? Object : CacheModuleOptions
|
|
59
|
-
])
|
|
60
|
-
], CacheInterceptor);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CacheModuleOptions } from './cache.types';
|
|
2
|
-
declare const ConfigurableModuleClass: import("..").ConfigurableModuleClassType<CacheModuleOptions, "forRoot", "create", {
|
|
3
|
-
isGlobal: boolean;
|
|
4
|
-
}>;
|
|
5
|
-
export declare class CacheModule extends ConfigurableModuleClass {
|
|
6
|
-
}
|
|
7
|
-
export {};
|
|
@@ -1,58 +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 { APP_INTERCEPTOR } from "../pipeline/tokens.js";
|
|
10
|
-
import { CacheInterceptor } from "./cache.interceptor.js";
|
|
11
|
-
import { CacheService } from "./cache.service.js";
|
|
12
|
-
import { MemoryCacheStore } from "./cache.store.js";
|
|
13
|
-
import { CACHE_MANAGER, CACHE_MODULE_OPTIONS } from "./cache.tokens.js";
|
|
14
|
-
// Reuse the public CACHE_MODULE_OPTIONS token so its identity (and the
|
|
15
|
-
// index.ts export) is unchanged. `isGlobal` here means "register the interceptor
|
|
16
|
-
// globally as APP_INTERCEPTOR" — NOT `DynamicModule.global` — so the extras
|
|
17
|
-
// transform is customized rather than using the default isGlobal→global.
|
|
18
|
-
const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder({
|
|
19
|
-
moduleName: 'Cache',
|
|
20
|
-
optionsInjectionToken: CACHE_MODULE_OPTIONS
|
|
21
|
-
}).setExtras({
|
|
22
|
-
isGlobal: false
|
|
23
|
-
}, (definition, { isGlobal })=>isGlobal ? {
|
|
24
|
-
...definition,
|
|
25
|
-
providers: [
|
|
26
|
-
...definition.providers ?? [],
|
|
27
|
-
{
|
|
28
|
-
provide: APP_INTERCEPTOR,
|
|
29
|
-
useExisting: CacheInterceptor
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
} : definition).build();
|
|
33
|
-
export class CacheModule extends ConfigurableModuleClass {
|
|
34
|
-
}
|
|
35
|
-
CacheModule = _ts_decorate([
|
|
36
|
-
Module({
|
|
37
|
-
providers: [
|
|
38
|
-
CacheService,
|
|
39
|
-
CacheInterceptor,
|
|
40
|
-
// One options-injecting provider serves BOTH forRoot and forRootAsync.
|
|
41
|
-
// A custom `store` (e.g. TieredCacheStore / KVCacheStore) overrides the
|
|
42
|
-
// default in-memory store.
|
|
43
|
-
{
|
|
44
|
-
provide: CACHE_MANAGER,
|
|
45
|
-
useFactory: (options)=>options.store ?? new MemoryCacheStore(options.ttl ?? 5, options.max ?? 100),
|
|
46
|
-
inject: [
|
|
47
|
-
MODULE_OPTIONS_TOKEN
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
exports: [
|
|
52
|
-
CACHE_MANAGER,
|
|
53
|
-
CACHE_MODULE_OPTIONS,
|
|
54
|
-
CacheService,
|
|
55
|
-
CacheInterceptor
|
|
56
|
-
]
|
|
57
|
-
})
|
|
58
|
-
], CacheModule);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CacheStore } from './cache.types';
|
|
2
|
-
export declare class CacheService {
|
|
3
|
-
private store;
|
|
4
|
-
constructor(store: CacheStore);
|
|
5
|
-
get<T = unknown>(key: string): T | undefined;
|
|
6
|
-
set<T = unknown>(key: string, value: T, ttl?: number): void;
|
|
7
|
-
del(key: string): void;
|
|
8
|
-
clear(): void;
|
|
9
|
-
}
|
|
@@ -1,42 +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 } from "../container/decorators.js";
|
|
16
|
-
import { CACHE_MANAGER } from "./cache.tokens.js";
|
|
17
|
-
export class CacheService {
|
|
18
|
-
store;
|
|
19
|
-
constructor(store){
|
|
20
|
-
this.store = store;
|
|
21
|
-
}
|
|
22
|
-
get(key) {
|
|
23
|
-
return this.store.get(key);
|
|
24
|
-
}
|
|
25
|
-
set(key, value, ttl) {
|
|
26
|
-
this.store.set(key, value, ttl);
|
|
27
|
-
}
|
|
28
|
-
del(key) {
|
|
29
|
-
this.store.del(key);
|
|
30
|
-
}
|
|
31
|
-
clear() {
|
|
32
|
-
this.store.clear();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
CacheService = _ts_decorate([
|
|
36
|
-
Injectable(),
|
|
37
|
-
_ts_param(0, Inject(CACHE_MANAGER)),
|
|
38
|
-
_ts_metadata("design:type", Function),
|
|
39
|
-
_ts_metadata("design:paramtypes", [
|
|
40
|
-
typeof CacheStore === "undefined" ? Object : CacheStore
|
|
41
|
-
])
|
|
42
|
-
], CacheService);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CacheStore } from './cache.types';
|
|
2
|
-
export declare class MemoryCacheStore implements CacheStore {
|
|
3
|
-
private store;
|
|
4
|
-
private defaultTtl;
|
|
5
|
-
private max;
|
|
6
|
-
constructor(ttl?: number, max?: number);
|
|
7
|
-
get<T = unknown>(key: string): T | undefined;
|
|
8
|
-
set<T = unknown>(key: string, value: T, ttl?: number): void;
|
|
9
|
-
del(key: string): void;
|
|
10
|
-
clear(): void;
|
|
11
|
-
private evict;
|
|
12
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export class MemoryCacheStore {
|
|
2
|
-
store = new Map();
|
|
3
|
-
defaultTtl;
|
|
4
|
-
max;
|
|
5
|
-
constructor(ttl = 5, max = 100){
|
|
6
|
-
this.defaultTtl = ttl;
|
|
7
|
-
this.max = max;
|
|
8
|
-
}
|
|
9
|
-
get(key) {
|
|
10
|
-
const entry = this.store.get(key);
|
|
11
|
-
if (!entry) return undefined;
|
|
12
|
-
if (Date.now() > entry.expiresAt) {
|
|
13
|
-
this.store.delete(key);
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
return entry.value;
|
|
17
|
-
}
|
|
18
|
-
set(key, value, ttl) {
|
|
19
|
-
// Evict if at capacity
|
|
20
|
-
if (!this.store.has(key) && this.store.size >= this.max) {
|
|
21
|
-
this.evict();
|
|
22
|
-
}
|
|
23
|
-
const effectiveTtl = ttl ?? this.defaultTtl;
|
|
24
|
-
this.store.set(key, {
|
|
25
|
-
value,
|
|
26
|
-
expiresAt: Date.now() + effectiveTtl * 1000
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
del(key) {
|
|
30
|
-
this.store.delete(key);
|
|
31
|
-
}
|
|
32
|
-
clear() {
|
|
33
|
-
this.store.clear();
|
|
34
|
-
}
|
|
35
|
-
evict() {
|
|
36
|
-
// First remove expired entries
|
|
37
|
-
const now = Date.now();
|
|
38
|
-
for (const [key, entry] of this.store){
|
|
39
|
-
if (now > entry.expiresAt) {
|
|
40
|
-
this.store.delete(key);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// If still at capacity, remove oldest (first inserted)
|
|
44
|
-
if (this.store.size >= this.max) {
|
|
45
|
-
const firstKey = this.store.keys().next().value;
|
|
46
|
-
if (firstKey !== undefined) {
|
|
47
|
-
this.store.delete(firstKey);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '../container/types';
|
|
2
|
-
import type { CacheStore, CacheModuleOptions } from './cache.types';
|
|
3
|
-
export declare const CACHE_MANAGER: InjectionToken<CacheStore>;
|
|
4
|
-
export declare const CACHE_MODULE_OPTIONS: InjectionToken<CacheModuleOptions>;
|
|
5
|
-
export declare const CACHE_KEY_METADATA = "vela:cache-key";
|
|
6
|
-
export declare const CACHE_TTL_METADATA = "vela:cache-ttl";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "../container/types.js";
|
|
2
|
-
export const CACHE_MANAGER = new InjectionToken('CACHE_MANAGER');
|
|
3
|
-
export const CACHE_MODULE_OPTIONS = new InjectionToken('CACHE_MODULE_OPTIONS');
|
|
4
|
-
export const CACHE_KEY_METADATA = 'vela:cache-key';
|
|
5
|
-
export const CACHE_TTL_METADATA = 'vela:cache-ttl';
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/** A value that may be returned synchronously or as a promise. */
|
|
2
|
-
export type Awaitable<T> = T | Promise<T>;
|
|
3
|
-
export interface CacheModuleOptions {
|
|
4
|
-
ttl?: number;
|
|
5
|
-
max?: number;
|
|
6
|
-
isGlobal?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Custom SYNC backing store (replaces the default in-memory store). For async
|
|
9
|
-
* (KV/tiered) caching use {@link AsyncCacheStore} + `TieredCacheStore`
|
|
10
|
-
* programmatically — the interceptor/CacheService path is synchronous.
|
|
11
|
-
*/
|
|
12
|
-
store?: CacheStore;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Synchronous cache backing store. This is the original, stable contract used by
|
|
16
|
-
* `CacheService` and `CacheInterceptor` — unchanged.
|
|
17
|
-
*/
|
|
18
|
-
export interface CacheStore {
|
|
19
|
-
get<T = unknown>(key: string): T | undefined;
|
|
20
|
-
set<T = unknown>(key: string, value: T, ttl?: number): void;
|
|
21
|
-
del(key: string): void;
|
|
22
|
-
clear(): void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Asynchronous cache backing store (additive). Implemented by remote/tiered
|
|
26
|
-
* stores (`TieredCacheStore`, and `KVCacheStore` in `@velajs/cloudflare`) where
|
|
27
|
-
* reads/writes are inherently async. Use it programmatically — inject the store
|
|
28
|
-
* under your own token — rather than as the synchronous `CACHE_MANAGER`.
|
|
29
|
-
*/
|
|
30
|
-
export interface AsyncCacheStore {
|
|
31
|
-
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
32
|
-
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
33
|
-
del(key: string): Promise<void>;
|
|
34
|
-
clear(): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
/** A store that may be sync or async (used to compose tiers). */
|
|
37
|
-
export type AnyCacheStore = CacheStore | AsyncCacheStore;
|
|
38
|
-
export interface CacheEntry<T = unknown> {
|
|
39
|
-
value: T;
|
|
40
|
-
expiresAt: number;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/** A value that may be returned synchronously or as a promise. */ export { };
|
package/dist/cache/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { CacheModule } from './cache.module';
|
|
2
|
-
export { CacheService } from './cache.service';
|
|
3
|
-
export { CacheInterceptor } from './cache.interceptor';
|
|
4
|
-
export { MemoryCacheStore } from './cache.store';
|
|
5
|
-
export { TieredCacheStore } from './tiered-cache.store';
|
|
6
|
-
export { CacheKey, CacheTTL } from './cache.decorators';
|
|
7
|
-
export { CACHE_MANAGER, CACHE_MODULE_OPTIONS, CACHE_KEY_METADATA, CACHE_TTL_METADATA } from './cache.tokens';
|
|
8
|
-
export type { Awaitable, CacheModuleOptions, CacheStore, AsyncCacheStore, AnyCacheStore, CacheEntry, } from './cache.types';
|
package/dist/cache/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { CacheModule } from "./cache.module.js";
|
|
2
|
-
export { CacheService } from "./cache.service.js";
|
|
3
|
-
export { CacheInterceptor } from "./cache.interceptor.js";
|
|
4
|
-
export { MemoryCacheStore } from "./cache.store.js";
|
|
5
|
-
export { TieredCacheStore } from "./tiered-cache.store.js";
|
|
6
|
-
export { CacheKey, CacheTTL } from "./cache.decorators.js";
|
|
7
|
-
export { CACHE_MANAGER, CACHE_MODULE_OPTIONS, CACHE_KEY_METADATA, CACHE_TTL_METADATA } from "./cache.tokens.js";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AnyCacheStore, AsyncCacheStore } from './cache.types';
|
|
2
|
-
/**
|
|
3
|
-
* Composes an ordered list of cache tiers (fastest first, e.g. in-memory L1 →
|
|
4
|
-
* KV L2). Tiers may be sync ({@link CacheStore}) or async ({@link AsyncCacheStore}) —
|
|
5
|
-
* results are awaited uniformly. Reads are read-through: the first tier with a
|
|
6
|
-
* hit wins, and nearer tiers that missed are backfilled. Writes/deletes/clears
|
|
7
|
-
* fan out to all tiers. Always async ({@link AsyncCacheStore}).
|
|
8
|
-
*
|
|
9
|
-
* Runtime-agnostic — the concrete tiers (memory here, KV in `@velajs/cloudflare`)
|
|
10
|
-
* live wherever fits.
|
|
11
|
-
*/
|
|
12
|
-
export declare class TieredCacheStore implements AsyncCacheStore {
|
|
13
|
-
private readonly tiers;
|
|
14
|
-
constructor(tiers: AnyCacheStore[]);
|
|
15
|
-
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
16
|
-
set<T = unknown>(key: string, value: T, ttl?: number): Promise<void>;
|
|
17
|
-
del(key: string): Promise<void>;
|
|
18
|
-
clear(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composes an ordered list of cache tiers (fastest first, e.g. in-memory L1 →
|
|
3
|
-
* KV L2). Tiers may be sync ({@link CacheStore}) or async ({@link AsyncCacheStore}) —
|
|
4
|
-
* results are awaited uniformly. Reads are read-through: the first tier with a
|
|
5
|
-
* hit wins, and nearer tiers that missed are backfilled. Writes/deletes/clears
|
|
6
|
-
* fan out to all tiers. Always async ({@link AsyncCacheStore}).
|
|
7
|
-
*
|
|
8
|
-
* Runtime-agnostic — the concrete tiers (memory here, KV in `@velajs/cloudflare`)
|
|
9
|
-
* live wherever fits.
|
|
10
|
-
*/ export class TieredCacheStore {
|
|
11
|
-
tiers;
|
|
12
|
-
constructor(tiers){
|
|
13
|
-
if (tiers.length === 0) {
|
|
14
|
-
throw new Error('TieredCacheStore requires at least one tier.');
|
|
15
|
-
}
|
|
16
|
-
this.tiers = tiers;
|
|
17
|
-
}
|
|
18
|
-
async get(key) {
|
|
19
|
-
for(let i = 0; i < this.tiers.length; i++){
|
|
20
|
-
const value = await this.tiers[i].get(key);
|
|
21
|
-
if (value !== undefined) {
|
|
22
|
-
// Backfill nearer (faster) tiers that missed.
|
|
23
|
-
for(let j = 0; j < i; j++){
|
|
24
|
-
await this.tiers[j].set(key, value);
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
async set(key, value, ttl) {
|
|
32
|
-
await Promise.all(this.tiers.map((tier)=>tier.set(key, value, ttl)));
|
|
33
|
-
}
|
|
34
|
-
async del(key) {
|
|
35
|
-
await Promise.all(this.tiers.map((tier)=>tier.del(key)));
|
|
36
|
-
}
|
|
37
|
-
async clear() {
|
|
38
|
-
await Promise.all(this.tiers.map((tier)=>tier.clear()));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DynamicModule } from '../module/types';
|
|
2
|
-
import type { ConfigModuleOptions } from './config.types';
|
|
3
|
-
declare const ConfigurableModuleClass: import("..").ConfigurableModuleClassType<ConfigModuleOptions<Record<string, unknown>>, "forRoot", "create", {
|
|
4
|
-
isGlobal?: boolean;
|
|
5
|
-
}>;
|
|
6
|
-
export declare class ConfigModule extends ConfigurableModuleClass {
|
|
7
|
-
/**
|
|
8
|
-
* Preserve (a) per-call generic inference over the flat config record and
|
|
9
|
-
* (b) the eager-validation contract: `validate` runs at call time so bad
|
|
10
|
-
* config fails fast, then is stripped so the derived `CONFIG_OPTIONS`
|
|
11
|
-
* provider is a passthrough (no double validation). `validateSchema` (the
|
|
12
|
-
* merged-config schema) is deferred to first read — its input needs env.
|
|
13
|
-
*/
|
|
14
|
-
static forRoot<T extends Record<string, unknown>>(options?: ConfigModuleOptions<T> & {
|
|
15
|
-
isGlobal?: boolean;
|
|
16
|
-
key?: string;
|
|
17
|
-
}): DynamicModule;
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Container } from "../container/container.js";
|
|
2
|
-
import { defineModule } from "../module/define-module.js";
|
|
3
|
-
import { ConfigService } from "./config.service.js";
|
|
4
|
-
import { ConfigStore } from "./config.store.js";
|
|
5
|
-
import { CONFIG_OPTIONS } from "./config.tokens.js";
|
|
6
|
-
/**
|
|
7
|
-
* Carrier for the namespace `asProvider()` KEY providers ONLY. Split out of
|
|
8
|
-
* ConfigModule and marked `lazy: true` so those factories — which inject
|
|
9
|
-
* `CONFIG_ENV`, live per-request on edge runtimes — never run at bootstrap.
|
|
10
|
-
* ConfigModule itself stays EAGER (see below).
|
|
11
|
-
*/ let ConfigNamespacesModule = class ConfigNamespacesModule {
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Build the lazy sub-module holding one KEY provider per namespace. Its `key`
|
|
15
|
-
* is derived from the owning ConfigModule instance key so multiple ConfigModule
|
|
16
|
-
* instances get distinct sub-module instances (no import-dedup collision).
|
|
17
|
-
*/ function namespacesSubModule(load, key) {
|
|
18
|
-
return {
|
|
19
|
-
module: ConfigNamespacesModule,
|
|
20
|
-
key: `config-ns:${key}`,
|
|
21
|
-
lazy: true,
|
|
22
|
-
providers: load.map((namespace)=>namespace.asProvider()),
|
|
23
|
-
exports: load.map((namespace)=>namespace.KEY)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
// Rebuilt on `defineModule` (the blessed engine — CLAUDE.md: changed modules
|
|
27
|
-
// use it). ConfigModule is EAGER: `ConfigService`, `ConfigStore`, and
|
|
28
|
-
// `CONFIG_OPTIONS` construct at bootstrap, so a `forRootAsync` async
|
|
29
|
-
// `useFactory` resolves in the awaited bootstrap pass and a *synchronous*
|
|
30
|
-
// `app.get(ConfigService)` afterwards returns the cached singleton (no drain).
|
|
31
|
-
//
|
|
32
|
-
// ONLY the namespace `asProvider()` KEY providers are deferred — they move into
|
|
33
|
-
// a LAZY sub-module (`ConfigNamespacesModule`) that ConfigModule imports and
|
|
34
|
-
// re-exports. Their factories inject `CONFIG_ENV` (live per-request on edge
|
|
35
|
-
// runtimes), so construction must not happen at bootstrap. `ConfigStore`
|
|
36
|
-
// resolves each KEY through the container on first `get()`; that first
|
|
37
|
-
// resolution claims + sync-drains the sub-module (namespace factories are
|
|
38
|
-
// synchronous, so the sync seam is safe). `resolveAllInstances` treats the KEY
|
|
39
|
-
// tokens as lazy-only (they belong solely to the lazy sub-module) and skips
|
|
40
|
-
// them at bootstrap.
|
|
41
|
-
const { ConfigurableModuleClass } = defineModule({
|
|
42
|
-
name: 'Config',
|
|
43
|
-
setup: ({ OPTIONS, options, key })=>{
|
|
44
|
-
const load = options.load ?? [];
|
|
45
|
-
const { validateSchema } = options;
|
|
46
|
-
return {
|
|
47
|
-
// Lazy sub-module carries the KEY providers; re-exported below so direct
|
|
48
|
-
// `@Inject(ns.KEY)` and `ConfigStore`'s container lookup both reach them.
|
|
49
|
-
imports: load.length > 0 ? [
|
|
50
|
-
namespacesSubModule(load, key)
|
|
51
|
-
] : [],
|
|
52
|
-
providers: [
|
|
53
|
-
{
|
|
54
|
-
// Flat config record. `validate` is applied here for the async path;
|
|
55
|
-
// `forRoot` pre-validates eagerly and strips it (see the override).
|
|
56
|
-
provide: CONFIG_OPTIONS,
|
|
57
|
-
useFactory: (opts)=>opts.validate ? opts.validate(opts.config ?? {}) : opts.config ?? {},
|
|
58
|
-
inject: [
|
|
59
|
-
OPTIONS
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
// Factory-provided so the store closes over the namespace list +
|
|
64
|
-
// schema; it resolves each namespace's KEY lazily via the container.
|
|
65
|
-
provide: ConfigStore,
|
|
66
|
-
useFactory: (container, config)=>new ConfigStore(container, config, load, validateSchema),
|
|
67
|
-
inject: [
|
|
68
|
-
Container,
|
|
69
|
-
CONFIG_OPTIONS
|
|
70
|
-
]
|
|
71
|
-
},
|
|
72
|
-
ConfigService
|
|
73
|
-
],
|
|
74
|
-
exports: [
|
|
75
|
-
ConfigService,
|
|
76
|
-
ConfigStore,
|
|
77
|
-
CONFIG_OPTIONS,
|
|
78
|
-
...load.map((n)=>n.KEY)
|
|
79
|
-
]
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
export class ConfigModule extends ConfigurableModuleClass {
|
|
84
|
-
/**
|
|
85
|
-
* Preserve (a) per-call generic inference over the flat config record and
|
|
86
|
-
* (b) the eager-validation contract: `validate` runs at call time so bad
|
|
87
|
-
* config fails fast, then is stripped so the derived `CONFIG_OPTIONS`
|
|
88
|
-
* provider is a passthrough (no double validation). `validateSchema` (the
|
|
89
|
-
* merged-config schema) is deferred to first read — its input needs env.
|
|
90
|
-
*/ static forRoot(options = {}) {
|
|
91
|
-
const validatedConfig = options.validate ? options.validate(options.config ?? {}) : options.config;
|
|
92
|
-
const { validate: _validate, ...rest } = options;
|
|
93
|
-
return super.forRoot({
|
|
94
|
-
...rest,
|
|
95
|
-
config: validatedConfig
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ConfigStore } from './config.store';
|
|
2
|
-
import type { ConfigPath, ConfigPathValue } from './config.types';
|
|
3
|
-
/**
|
|
4
|
-
* Typed, dot-notation reads over the merged config. Stays a singleton (NestJS
|
|
5
|
-
* parity); delegates to the {@link ConfigStore}. Pass `ConfigType<[...]>` as the
|
|
6
|
-
* generic to type namespaced paths (`cfg.get('database.url')` → `string`).
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConfigService<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
9
|
-
private readonly store;
|
|
10
|
-
constructor(store: ConfigStore);
|
|
11
|
-
/** Read a config value; `undefined` when absent, or the supplied default. */
|
|
12
|
-
get<P extends ConfigPath<T>>(path: P): ConfigPathValue<T, P> | undefined;
|
|
13
|
-
get<P extends ConfigPath<T>>(path: P, defaultValue: ConfigPathValue<T, P>): ConfigPathValue<T, P>;
|
|
14
|
-
/** Read a config value; throws when the path is absent. */
|
|
15
|
-
getOrThrow<P extends ConfigPath<T>>(path: P): ConfigPathValue<T, P>;
|
|
16
|
-
/** Whether a config path resolves to a defined value. */
|
|
17
|
-
has<P extends ConfigPath<T>>(path: P): boolean;
|
|
18
|
-
/** The full merged config object (flat record + resolved namespaces). */
|
|
19
|
-
getAll(): T;
|
|
20
|
-
}
|
|
@@ -1,43 +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 } from "../container/decorators.js";
|
|
16
|
-
import { ConfigStore } from "./config.store.js";
|
|
17
|
-
export class ConfigService {
|
|
18
|
-
store;
|
|
19
|
-
constructor(store){
|
|
20
|
-
this.store = store;
|
|
21
|
-
}
|
|
22
|
-
get(path, defaultValue) {
|
|
23
|
-
const value = this.store.get(path);
|
|
24
|
-
return value === undefined ? defaultValue : value;
|
|
25
|
-
}
|
|
26
|
-
/** Read a config value; throws when the path is absent. */ getOrThrow(path) {
|
|
27
|
-
return this.store.getOrThrow(path);
|
|
28
|
-
}
|
|
29
|
-
/** Whether a config path resolves to a defined value. */ has(path) {
|
|
30
|
-
return this.store.has(path);
|
|
31
|
-
}
|
|
32
|
-
/** The full merged config object (flat record + resolved namespaces). */ getAll() {
|
|
33
|
-
return this.store.all();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
ConfigService = _ts_decorate([
|
|
37
|
-
Injectable(),
|
|
38
|
-
_ts_param(0, Inject(ConfigStore)),
|
|
39
|
-
_ts_metadata("design:type", Function),
|
|
40
|
-
_ts_metadata("design:paramtypes", [
|
|
41
|
-
typeof ConfigStore === "undefined" ? Object : ConfigStore
|
|
42
|
-
])
|
|
43
|
-
], ConfigService);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Container } from '../container/container';
|
|
2
|
-
import type { ConfigSchema } from './config.types';
|
|
3
|
-
import type { AnyConfigNamespace } from './register-as';
|
|
4
|
-
/**
|
|
5
|
-
* Singleton source of truth for merged configuration.
|
|
6
|
-
*
|
|
7
|
-
* Holds the flat `config` record plus a `namespace → KEY` map. Namespaces are
|
|
8
|
-
* resolved LAZILY — the KEY is pulled from the container on the first read of
|
|
9
|
-
* that namespace and cached — so the store never forces namespace factories to
|
|
10
|
-
* materialize at construction. Resolution uses the synchronous container seam
|
|
11
|
-
* (`resolve`), which stays compatible with lazy modules.
|
|
12
|
-
*
|
|
13
|
-
* The merged shape is `{ ...config, [ns]: value }` — a namespace shadows a flat
|
|
14
|
-
* key of the same name.
|
|
15
|
-
*
|
|
16
|
-
* Constructed via a factory provider in {@link ConfigModule} so it can close
|
|
17
|
-
* over the `load` list and `validateSchema` without extra tokens.
|
|
18
|
-
*/
|
|
19
|
-
export declare class ConfigStore {
|
|
20
|
-
private readonly container;
|
|
21
|
-
private readonly config;
|
|
22
|
-
private readonly validateSchema?;
|
|
23
|
-
private readonly namespaceKeys;
|
|
24
|
-
private readonly cache;
|
|
25
|
-
private validated;
|
|
26
|
-
private validationError;
|
|
27
|
-
constructor(container: Pick<Container, 'resolve'>, config?: Record<string, unknown>, namespaces?: ReadonlyArray<AnyConfigNamespace>, validateSchema?: ConfigSchema | undefined);
|
|
28
|
-
/** Read a value by dot-notation path; `undefined` if absent. */
|
|
29
|
-
get(path: string): unknown;
|
|
30
|
-
/** Read a value by dot-notation path; throws if absent. */
|
|
31
|
-
getOrThrow(path: string): unknown;
|
|
32
|
-
/** Whether a dot-notation path resolves to a defined value. */
|
|
33
|
-
has(path: string): boolean;
|
|
34
|
-
/** The full merged config object (flat record + resolved namespaces). */
|
|
35
|
-
all(): Record<string, unknown>;
|
|
36
|
-
private read;
|
|
37
|
-
/** Resolve a namespace's KEY through the container on first use, then cache. */
|
|
38
|
-
private resolveNamespace;
|
|
39
|
-
private merged;
|
|
40
|
-
/**
|
|
41
|
-
* Validate the merged config once, on first read. Deferred (not at bootstrap)
|
|
42
|
-
* because the merged shape needs namespace factories — and their env — which
|
|
43
|
-
* are only available after bootstrap on edge runtimes.
|
|
44
|
-
*/
|
|
45
|
-
private ensureValidated;
|
|
46
|
-
}
|