@velajs/vela 1.18.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -14
- package/dist/configurable-module.builder-5FGMaXG6.js +91 -0
- package/dist/configurable-module.builder-5FGMaXG6.js.map +1 -0
- package/dist/container-BqUHID4l.js +645 -0
- package/dist/container-BqUHID4l.js.map +1 -0
- package/dist/cron-matcher-C9qv5OUA.js +113 -0
- package/dist/cron-matcher-C9qv5OUA.js.map +1 -0
- package/dist/decorate-GcSMAbKn.js +528 -0
- package/dist/decorate-GcSMAbKn.js.map +1 -0
- package/dist/decorators-C8YBFCIk.js +53 -0
- package/dist/decorators-C8YBFCIk.js.map +1 -0
- package/dist/define-module-NOyOZNXD.js +235 -0
- package/dist/define-module-NOyOZNXD.js.map +1 -0
- package/dist/discovery.service-BYm95SSD.js +368 -0
- package/dist/discovery.service-BYm95SSD.js.map +1 -0
- package/dist/discovery.service-Cpf1QcZ5.d.ts +648 -0
- package/dist/i18n/index.d.ts +138 -10
- package/dist/i18n/index.js +270 -8
- package/dist/i18n/index.js.map +1 -0
- package/dist/index-D72EQfcC.d.ts +430 -0
- package/dist/index-DhShDLCM.d.ts +2310 -0
- package/dist/index.d.ts +6 -66
- package/dist/index.js +14 -71
- package/dist/internal.d.ts +13 -17
- package/dist/internal.js +6 -19
- package/dist/live/index.d.ts +2 -12
- package/dist/live/index.js +826 -16
- package/dist/live/index.js.map +1 -0
- package/dist/metadata.registry-D1od8ZBt.d.ts +842 -0
- package/dist/plugin-ByBlVOve.js +1387 -0
- package/dist/plugin-ByBlVOve.js.map +1 -0
- package/dist/queue/index.d.ts +247 -10
- package/dist/queue/index.js +384 -12
- package/dist/queue/index.js.map +1 -0
- package/dist/request-context-C3nCGJNd.js +26 -0
- package/dist/request-context-C3nCGJNd.js.map +1 -0
- package/dist/route.manager-DRAZ5X04.js +991 -0
- package/dist/route.manager-DRAZ5X04.js.map +1 -0
- package/dist/schedule-node/index.d.ts +32 -3
- package/dist/schedule-node/index.js +97 -3
- package/dist/schedule-node/index.js.map +1 -0
- package/dist/schedule.registry-DVm7Jp5w.d.ts +55 -0
- package/dist/seeder/index.d.ts +75 -5
- package/dist/seeder/index.js +105 -4
- package/dist/seeder/index.js.map +1 -0
- package/dist/signed-url-CMmi0SIb.js +56 -0
- package/dist/signed-url-CMmi0SIb.js.map +1 -0
- package/dist/signed-url-DKhgja4U.d.ts +16 -0
- package/dist/src-eb5CI6Xn.js +2151 -0
- package/dist/src-eb5CI6Xn.js.map +1 -0
- package/dist/storage/index.d.ts +57 -4
- package/dist/storage/index.js +22 -5
- package/dist/storage/index.js.map +1 -0
- package/dist/streaming/index.d.ts +2 -2
- package/dist/streaming/index.js +2 -1
- package/dist/websocket/index.d.ts +3 -12
- package/dist/websocket/index.js +2 -16
- package/dist/websocket-DXmB-MWJ.js +697 -0
- package/dist/websocket-DXmB-MWJ.js.map +1 -0
- package/dist/websocket-node/index.d.ts +108 -6
- package/dist/websocket-node/index.js +228 -6
- package/dist/websocket-node/index.js.map +1 -0
- package/package.json +67 -53
- package/dist/__tests__/workers/entry.d.ts +0 -9
- package/dist/__tests__/workers-als/entry-als.d.ts +0 -9
- package/dist/application.d.ts +0 -91
- package/dist/application.js +0 -308
- package/dist/cache/cache.decorators.d.ts +0 -2
- package/dist/cache/cache.decorators.js +0 -4
- package/dist/cache/cache.interceptor.d.ts +0 -9
- package/dist/cache/cache.interceptor.js +0 -60
- package/dist/cache/cache.module.d.ts +0 -7
- package/dist/cache/cache.module.js +0 -58
- package/dist/cache/cache.service.d.ts +0 -9
- package/dist/cache/cache.service.js +0 -42
- package/dist/cache/cache.store.d.ts +0 -12
- package/dist/cache/cache.store.js +0 -51
- package/dist/cache/cache.tokens.d.ts +0 -6
- package/dist/cache/cache.tokens.js +0 -5
- package/dist/cache/cache.types.d.ts +0 -41
- package/dist/cache/cache.types.js +0 -1
- package/dist/cache/index.d.ts +0 -8
- package/dist/cache/index.js +0 -7
- package/dist/cache/tiered-cache.store.d.ts +0 -19
- package/dist/cache/tiered-cache.store.js +0 -40
- package/dist/config/config.module.d.ts +0 -19
- package/dist/config/config.module.js +0 -98
- package/dist/config/config.service.d.ts +0 -20
- package/dist/config/config.service.js +0 -43
- package/dist/config/config.store.d.ts +0 -46
- package/dist/config/config.store.js +0 -119
- package/dist/config/config.tokens.d.ts +0 -13
- package/dist/config/config.tokens.js +0 -14
- package/dist/config/config.types.d.ts +0 -41
- package/dist/config/config.types.js +0 -4
- package/dist/config/index.d.ts +0 -7
- package/dist/config/index.js +0 -5
- package/dist/config/register-as.d.ts +0 -52
- package/dist/config/register-as.js +0 -39
- package/dist/constants.d.ts +0 -44
- package/dist/constants.js +0 -46
- package/dist/container/container.d.ts +0 -154
- package/dist/container/container.js +0 -849
- package/dist/container/decorators.d.ts +0 -17
- package/dist/container/decorators.js +0 -57
- package/dist/container/disposable.d.ts +0 -5
- package/dist/container/disposable.js +0 -33
- package/dist/container/index.d.ts +0 -6
- package/dist/container/index.js +0 -5
- package/dist/container/mixin.d.ts +0 -24
- package/dist/container/mixin.js +0 -26
- package/dist/container/module-ref.d.ts +0 -21
- package/dist/container/module-ref.js +0 -48
- package/dist/container/types.d.ts +0 -154
- package/dist/container/types.js +0 -49
- package/dist/cors/cors.module.d.ts +0 -7
- package/dist/cors/cors.module.js +0 -37
- package/dist/cors/cors.tokens.d.ts +0 -3
- package/dist/cors/cors.tokens.js +0 -2
- package/dist/cors/cors.types.d.ts +0 -8
- package/dist/cors/cors.types.js +0 -1
- package/dist/cors/index.d.ts +0 -3
- package/dist/cors/index.js +0 -2
- package/dist/crypto/signed-url.d.ts +0 -12
- package/dist/crypto/signed-url.js +0 -60
- package/dist/discovery/discoverable.decorator.d.ts +0 -38
- package/dist/discovery/discoverable.decorator.js +0 -42
- package/dist/discovery/discovery.service.d.ts +0 -102
- package/dist/discovery/discovery.service.js +0 -177
- package/dist/discovery/index.d.ts +0 -2
- package/dist/discovery/index.js +0 -2
- package/dist/entrypoint/entrypoint.registry.d.ts +0 -42
- package/dist/entrypoint/entrypoint.registry.js +0 -112
- package/dist/entrypoint/entrypoint.types.d.ts +0 -41
- package/dist/entrypoint/entrypoint.types.js +0 -3
- package/dist/entrypoint/execution-context.d.ts +0 -15
- package/dist/entrypoint/execution-context.js +0 -21
- package/dist/entrypoint/execution-scope.d.ts +0 -21
- package/dist/entrypoint/execution-scope.js +0 -28
- package/dist/entrypoint/index.d.ts +0 -4
- package/dist/entrypoint/index.js +0 -4
- package/dist/errors/http-exception.d.ts +0 -62
- package/dist/errors/http-exception.js +0 -134
- package/dist/errors/index.d.ts +0 -1
- package/dist/errors/index.js +0 -1
- package/dist/event-emitter/event-emitter.decorators.d.ts +0 -1
- package/dist/event-emitter/event-emitter.decorators.js +0 -10
- package/dist/event-emitter/event-emitter.module.d.ts +0 -2
- package/dist/event-emitter/event-emitter.module.js +0 -23
- package/dist/event-emitter/event-emitter.service.d.ts +0 -13
- package/dist/event-emitter/event-emitter.service.js +0 -127
- package/dist/event-emitter/event-emitter.subscriber.d.ts +0 -9
- package/dist/event-emitter/event-emitter.subscriber.js +0 -45
- package/dist/event-emitter/event-emitter.tokens.d.ts +0 -1
- package/dist/event-emitter/event-emitter.tokens.js +0 -1
- package/dist/event-emitter/event-emitter.types.d.ts +0 -5
- package/dist/event-emitter/event-emitter.types.js +0 -1
- package/dist/event-emitter/index.d.ts +0 -6
- package/dist/event-emitter/index.js +0 -5
- package/dist/factory/adapter.d.ts +0 -36
- package/dist/factory/adapter.js +0 -18
- package/dist/factory/bootstrap.d.ts +0 -23
- package/dist/factory/bootstrap.js +0 -108
- package/dist/factory.d.ts +0 -16
- package/dist/factory.js +0 -36
- package/dist/fetch/fetch.module.d.ts +0 -7
- package/dist/fetch/fetch.module.js +0 -31
- package/dist/fetch/fetch.service.d.ts +0 -24
- package/dist/fetch/fetch.service.js +0 -145
- package/dist/fetch/fetch.types.d.ts +0 -24
- package/dist/fetch/fetch.types.js +0 -1
- package/dist/fetch/index.d.ts +0 -3
- package/dist/fetch/index.js +0 -2
- package/dist/health/health.http.d.ts +0 -14
- package/dist/health/health.http.js +0 -75
- package/dist/health/health.indicator.d.ts +0 -9
- package/dist/health/health.indicator.js +0 -32
- package/dist/health/health.module.d.ts +0 -2
- package/dist/health/health.module.js +0 -26
- package/dist/health/health.service.d.ts +0 -7
- package/dist/health/health.service.js +0 -69
- package/dist/health/health.types.d.ts +0 -15
- package/dist/health/health.types.js +0 -1
- package/dist/health/index.d.ts +0 -6
- package/dist/health/index.js +0 -4
- package/dist/http/ambient.d.ts +0 -17
- package/dist/http/ambient.js +0 -44
- package/dist/http/argument-resolver.d.ts +0 -10
- package/dist/http/argument-resolver.js +0 -89
- package/dist/http/decorators.d.ts +0 -198
- package/dist/http/decorators.js +0 -321
- package/dist/http/execution-context.d.ts +0 -8
- package/dist/http/execution-context.js +0 -35
- package/dist/http/handler-executor.d.ts +0 -20
- package/dist/http/handler-executor.js +0 -111
- package/dist/http/index.d.ts +0 -12
- package/dist/http/index.js +0 -7
- package/dist/http/instantiate.d.ts +0 -4
- package/dist/http/instantiate.js +0 -45
- package/dist/http/lazy-param.decorator.d.ts +0 -37
- package/dist/http/lazy-param.decorator.js +0 -117
- package/dist/http/request-container.d.ts +0 -16
- package/dist/http/request-container.js +0 -19
- package/dist/http/request-context.d.ts +0 -13
- package/dist/http/request-context.js +0 -22
- package/dist/http/response-mapper.d.ts +0 -8
- package/dist/http/response-mapper.js +0 -42
- package/dist/http/route-contributor.d.ts +0 -68
- package/dist/http/route-contributor.js +0 -22
- package/dist/http/route-map.d.ts +0 -30
- package/dist/http/route-map.js +0 -27
- package/dist/http/route.manager.d.ts +0 -92
- package/dist/http/route.manager.js +0 -481
- package/dist/http/types.d.ts +0 -37
- package/dist/http/types.js +0 -1
- package/dist/http/url/index.d.ts +0 -4
- package/dist/http/url/index.js +0 -3
- package/dist/http/url/signed-url.guard.d.ts +0 -27
- package/dist/http/url/signed-url.guard.js +0 -62
- package/dist/http/url/signing-secret.d.ts +0 -20
- package/dist/http/url/signing-secret.js +0 -24
- package/dist/http/url/url-generator.service.d.ts +0 -52
- package/dist/http/url/url-generator.service.js +0 -104
- package/dist/i18n/deep-merge.d.ts +0 -2
- package/dist/i18n/deep-merge.js +0 -15
- package/dist/i18n/i18n.middleware.d.ts +0 -15
- package/dist/i18n/i18n.middleware.js +0 -94
- package/dist/i18n/i18n.module.d.ts +0 -13
- package/dist/i18n/i18n.module.js +0 -69
- package/dist/i18n/i18n.options.d.ts +0 -30
- package/dist/i18n/i18n.options.js +0 -16
- package/dist/i18n/i18n.service.d.ts +0 -20
- package/dist/i18n/i18n.service.js +0 -49
- package/dist/i18n/i18n.tokens.d.ts +0 -6
- package/dist/i18n/i18n.tokens.js +0 -3
- package/dist/i18n/i18n.types.d.ts +0 -6
- package/dist/i18n/i18n.types.js +0 -1
- package/dist/i18n/message-loader.service.d.ts +0 -21
- package/dist/i18n/message-loader.service.js +0 -90
- package/dist/i18n/message-registry.d.ts +0 -16
- package/dist/i18n/message-registry.js +0 -49
- package/dist/lifecycle/index.d.ts +0 -20
- package/dist/lifecycle/index.js +0 -15
- package/dist/live/live.cursor.d.ts +0 -22
- package/dist/live/live.cursor.js +0 -56
- package/dist/live/live.decorators.d.ts +0 -32
- package/dist/live/live.decorators.js +0 -46
- package/dist/live/live.delta.d.ts +0 -15
- package/dist/live/live.delta.js +0 -51
- package/dist/live/live.engine.d.ts +0 -81
- package/dist/live/live.engine.js +0 -448
- package/dist/live/live.invalidation.d.ts +0 -45
- package/dist/live/live.invalidation.js +0 -99
- package/dist/live/live.module.d.ts +0 -28
- package/dist/live/live.module.js +0 -87
- package/dist/live/live.tokens.d.ts +0 -9
- package/dist/live/live.tokens.js +0 -8
- package/dist/live/live.types.d.ts +0 -138
- package/dist/live/live.types.js +0 -1
- package/dist/live/presence.d.ts +0 -44
- package/dist/live/presence.js +0 -130
- package/dist/metadata.d.ts +0 -10
- package/dist/metadata.js +0 -20
- package/dist/module/configurable-module.builder.d.ts +0 -56
- package/dist/module/configurable-module.builder.js +0 -84
- package/dist/module/configurable-module.types.d.ts +0 -93
- package/dist/module/configurable-module.types.js +0 -5
- package/dist/module/decorators.d.ts +0 -10
- package/dist/module/decorators.js +0 -47
- package/dist/module/define-module.d.ts +0 -112
- package/dist/module/define-module.js +0 -232
- package/dist/module/graph.d.ts +0 -10
- package/dist/module/graph.js +0 -35
- package/dist/module/index.d.ts +0 -10
- package/dist/module/index.js +0 -7
- package/dist/module/lazy-modules.d.ts +0 -82
- package/dist/module/lazy-modules.js +0 -231
- package/dist/module/lazy-provider.d.ts +0 -65
- package/dist/module/lazy-provider.js +0 -111
- package/dist/module/middleware.d.ts +0 -30
- package/dist/module/middleware.js +0 -67
- package/dist/module/module-loader.d.ts +0 -58
- package/dist/module/module-loader.js +0 -484
- package/dist/module/stable-hash.d.ts +0 -15
- package/dist/module/stable-hash.js +0 -52
- package/dist/module/types.d.ts +0 -1
- package/dist/module/types.js +0 -1
- package/dist/openapi/decorators.d.ts +0 -34
- package/dist/openapi/decorators.js +0 -66
- package/dist/openapi/document.d.ts +0 -3
- package/dist/openapi/document.js +0 -316
- package/dist/openapi/index.d.ts +0 -7
- package/dist/openapi/index.js +0 -6
- package/dist/openapi/redoc-ui.d.ts +0 -1
- package/dist/openapi/redoc-ui.js +0 -19
- package/dist/openapi/scalar-ui.d.ts +0 -1
- package/dist/openapi/scalar-ui.js +0 -19
- package/dist/openapi/swagger-ui.d.ts +0 -1
- package/dist/openapi/swagger-ui.js +0 -23
- package/dist/openapi/types.d.ts +0 -182
- package/dist/openapi/types.js +0 -4
- package/dist/openapi/zod-to-json-schema.d.ts +0 -4
- package/dist/openapi/zod-to-json-schema.js +0 -57
- package/dist/pipeline/app-providers.d.ts +0 -10
- package/dist/pipeline/app-providers.js +0 -43
- package/dist/pipeline/component.manager.d.ts +0 -25
- package/dist/pipeline/component.manager.js +0 -66
- package/dist/pipeline/decorators.d.ts +0 -10
- package/dist/pipeline/decorators.js +0 -42
- package/dist/pipeline/index.d.ts +0 -12
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/pipeline-runner.d.ts +0 -31
- package/dist/pipeline/pipeline-runner.js +0 -40
- package/dist/pipeline/pipes.d.ts +0 -48
- package/dist/pipeline/pipes.js +0 -104
- package/dist/pipeline/reflector.d.ts +0 -86
- package/dist/pipeline/reflector.js +0 -121
- package/dist/pipeline/scoped-components.d.ts +0 -26
- package/dist/pipeline/scoped-components.js +0 -27
- package/dist/pipeline/tokens.d.ts +0 -33
- package/dist/pipeline/tokens.js +0 -27
- package/dist/pipeline/types.d.ts +0 -64
- package/dist/pipeline/types.js +0 -1
- package/dist/plugin/plugin.d.ts +0 -31
- package/dist/plugin/plugin.js +0 -111
- package/dist/queue/inline.driver.d.ts +0 -30
- package/dist/queue/inline.driver.js +0 -58
- package/dist/queue/queue.binding.d.ts +0 -23
- package/dist/queue/queue.binding.js +0 -53
- package/dist/queue/queue.client.d.ts +0 -20
- package/dist/queue/queue.client.js +0 -33
- package/dist/queue/queue.decorators.d.ts +0 -23
- package/dist/queue/queue.decorators.js +0 -46
- package/dist/queue/queue.dispatch.d.ts +0 -36
- package/dist/queue/queue.dispatch.js +0 -102
- package/dist/queue/queue.module.d.ts +0 -32
- package/dist/queue/queue.module.js +0 -80
- package/dist/queue/queue.tokens.d.ts +0 -21
- package/dist/queue/queue.tokens.js +0 -34
- package/dist/queue/queue.types.d.ts +0 -61
- package/dist/queue/queue.types.js +0 -4
- package/dist/registry/index.d.ts +0 -2
- package/dist/registry/index.js +0 -1
- package/dist/registry/metadata.registry.d.ts +0 -73
- package/dist/registry/metadata.registry.js +0 -357
- package/dist/registry/paths.d.ts +0 -3
- package/dist/registry/paths.js +0 -15
- package/dist/registry/types.d.ts +0 -116
- package/dist/registry/types.js +0 -1
- package/dist/registry/util.d.ts +0 -3
- package/dist/registry/util.js +0 -8
- package/dist/schedule/cron-matcher.d.ts +0 -2
- package/dist/schedule/cron-matcher.js +0 -62
- package/dist/schedule/index.d.ts +0 -8
- package/dist/schedule/index.js +0 -5
- package/dist/schedule/schedule.decorators.d.ts +0 -2
- package/dist/schedule/schedule.decorators.js +0 -18
- package/dist/schedule/schedule.module.d.ts +0 -9
- package/dist/schedule/schedule.module.js +0 -28
- package/dist/schedule/schedule.registry.d.ts +0 -23
- package/dist/schedule/schedule.registry.js +0 -63
- package/dist/schedule/schedule.tokens.d.ts +0 -2
- package/dist/schedule/schedule.tokens.js +0 -2
- package/dist/schedule/schedule.types.d.ts +0 -8
- package/dist/schedule/schedule.types.js +0 -1
- package/dist/schedule-node/schedule-node.module.d.ts +0 -9
- package/dist/schedule-node/schedule-node.module.js +0 -28
- package/dist/schedule-node/schedule.executor.d.ts +0 -19
- package/dist/schedule-node/schedule.executor.js +0 -107
- package/dist/seeder/seeder.decorator.d.ts +0 -7
- package/dist/seeder/seeder.decorator.js +0 -15
- package/dist/seeder/seeder.module.d.ts +0 -16
- package/dist/seeder/seeder.module.js +0 -44
- package/dist/seeder/seeder.registry.d.ts +0 -23
- package/dist/seeder/seeder.registry.js +0 -83
- package/dist/seeder/seeder.tokens.d.ts +0 -2
- package/dist/seeder/seeder.tokens.js +0 -1
- package/dist/seeder/seeder.types.d.ts +0 -20
- package/dist/seeder/seeder.types.js +0 -1
- package/dist/serialization/index.d.ts +0 -2
- package/dist/serialization/index.js +0 -2
- package/dist/serialization/serialize.decorator.d.ts +0 -6
- package/dist/serialization/serialize.decorator.js +0 -7
- package/dist/serialization/serializer.interceptor.d.ts +0 -4
- package/dist/serialization/serializer.interceptor.js +0 -16
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.js +0 -1
- package/dist/services/logger.d.ts +0 -59
- package/dist/services/logger.js +0 -159
- package/dist/storage/path-template.d.ts +0 -9
- package/dist/storage/path-template.js +0 -20
- package/dist/storage/storage.types.d.ts +0 -41
- package/dist/storage/storage.types.js +0 -5
- package/dist/throttler/index.d.ts +0 -6
- package/dist/throttler/index.js +0 -5
- package/dist/throttler/throttler.decorators.d.ts +0 -3
- package/dist/throttler/throttler.decorators.js +0 -4
- package/dist/throttler/throttler.guard.d.ts +0 -9
- package/dist/throttler/throttler.guard.js +0 -72
- package/dist/throttler/throttler.module.d.ts +0 -7
- package/dist/throttler/throttler.module.js +0 -41
- package/dist/throttler/throttler.storage.d.ts +0 -10
- package/dist/throttler/throttler.storage.js +0 -44
- package/dist/throttler/throttler.tokens.d.ts +0 -6
- package/dist/throttler/throttler.tokens.js +0 -5
- package/dist/throttler/throttler.types.d.ts +0 -25
- package/dist/throttler/throttler.types.js +0 -1
- package/dist/validation/create-zod-dto.d.ts +0 -13
- package/dist/validation/create-zod-dto.js +0 -18
- package/dist/validation/index.d.ts +0 -3
- package/dist/validation/index.js +0 -2
- package/dist/validation/validation.pipe.d.ts +0 -4
- package/dist/validation/validation.pipe.js +0 -19
- package/dist/websocket/websocket.decorators.d.ts +0 -47
- package/dist/websocket/websocket.decorators.js +0 -80
- package/dist/websocket/websocket.module.d.ts +0 -35
- package/dist/websocket/websocket.module.js +0 -63
- package/dist/websocket/websocket.tokens.d.ts +0 -30
- package/dist/websocket/websocket.tokens.js +0 -27
- package/dist/websocket/websocket.types.d.ts +0 -102
- package/dist/websocket/websocket.types.js +0 -4
- package/dist/websocket/ws-argument-resolver.d.ts +0 -13
- package/dist/websocket/ws-argument-resolver.js +0 -40
- package/dist/websocket/ws-dispatcher.d.ts +0 -54
- package/dist/websocket/ws-dispatcher.js +0 -322
- package/dist/websocket/ws-exception.d.ts +0 -16
- package/dist/websocket/ws-exception.js +0 -32
- package/dist/websocket/ws-execution-context.d.ts +0 -9
- package/dist/websocket/ws-execution-context.js +0 -24
- package/dist/websocket/ws-server.d.ts +0 -31
- package/dist/websocket/ws-server.js +0 -74
- package/dist/websocket/ws-sync.d.ts +0 -47
- package/dist/websocket/ws-sync.js +0 -74
- package/dist/websocket-node/node-ws-client.d.ts +0 -24
- package/dist/websocket-node/node-ws-client.js +0 -49
- package/dist/websocket-node/redis-live.d.ts +0 -24
- package/dist/websocket-node/redis-live.js +0 -57
- package/dist/websocket-node/redis-sync.d.ts +0 -33
- package/dist/websocket-node/redis-sync.js +0 -56
- package/dist/websocket-node/register-gateways.d.ts +0 -20
- package/dist/websocket-node/register-gateways.js +0 -61
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
import { C as InjectionToken, D as describeToken, E as ROOT_MODULE_ID, S as ForwardRef, T as MultipleProvidersFoundError, c as getInjectMetadata, l as getScope, m as Scope, s as getConstructorDependencies, u as isInjectable, w as ModuleVisibilityError } from "./decorate-GcSMAbKn.js";
|
|
2
|
+
//#region src/container/disposable.ts
|
|
3
|
+
const ASYNC_DISPOSE = Symbol.asyncDispose;
|
|
4
|
+
const SYNC_DISPOSE = Symbol.dispose;
|
|
5
|
+
function asRecord(value) {
|
|
6
|
+
if (value === null) return void 0;
|
|
7
|
+
return typeof value === "object" || typeof value === "function" ? value : void 0;
|
|
8
|
+
}
|
|
9
|
+
function isDisposable(value) {
|
|
10
|
+
const obj = asRecord(value);
|
|
11
|
+
if (!obj) return false;
|
|
12
|
+
if (ASYNC_DISPOSE && typeof obj[ASYNC_DISPOSE] === "function") return true;
|
|
13
|
+
if (SYNC_DISPOSE && typeof obj[SYNC_DISPOSE] === "function") return true;
|
|
14
|
+
return typeof obj.dispose === "function";
|
|
15
|
+
}
|
|
16
|
+
async function disposeInstance(value) {
|
|
17
|
+
const obj = asRecord(value);
|
|
18
|
+
if (!obj) return;
|
|
19
|
+
if (ASYNC_DISPOSE && typeof obj[ASYNC_DISPOSE] === "function") {
|
|
20
|
+
await obj[ASYNC_DISPOSE].call(obj);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (SYNC_DISPOSE && typeof obj[SYNC_DISPOSE] === "function") {
|
|
24
|
+
obj[SYNC_DISPOSE].call(obj);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (typeof obj.dispose === "function") await obj.dispose.call(obj);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/container/container.ts
|
|
31
|
+
/**
|
|
32
|
+
* Sentinel comparing a token to the bare `Object` class — `design:paramtypes`
|
|
33
|
+
* emits `Object` when TypeScript erases a type-only import, so any token that
|
|
34
|
+
* is `Object` (or nullish) is the fingerprint of a stripped type.
|
|
35
|
+
*/
|
|
36
|
+
function isErasedTypeToken(token) {
|
|
37
|
+
return token === Object || token == null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Per-module provider buckets. Each module instance owns its providers under
|
|
41
|
+
* its `moduleId`; the same logical token can have distinct registrations in
|
|
42
|
+
* different buckets, supporting multi-instance dynamic modules.
|
|
43
|
+
*
|
|
44
|
+
* The `__root__` bucket holds bootstrap-time framework primitives (Container,
|
|
45
|
+
* ModuleRef, REQUEST_CONTEXT, etc.) and any `register()` call that doesn't
|
|
46
|
+
* supply a `declaringModuleId`.
|
|
47
|
+
*/
|
|
48
|
+
var Container = class Container {
|
|
49
|
+
providers = /* @__PURE__ */ new Map();
|
|
50
|
+
exporterIndex = /* @__PURE__ */ new Map();
|
|
51
|
+
resolutionStack = /* @__PURE__ */ new Set();
|
|
52
|
+
requestInstances = /* @__PURE__ */ new Map();
|
|
53
|
+
scopes = /* @__PURE__ */ new Map();
|
|
54
|
+
globals = /* @__PURE__ */ new Set();
|
|
55
|
+
diagnostics;
|
|
56
|
+
root = this;
|
|
57
|
+
disposables = [];
|
|
58
|
+
lazyHook;
|
|
59
|
+
asyncDepth = 0;
|
|
60
|
+
constructor(options = {}) {
|
|
61
|
+
this.diagnostics = options.diagnostics ?? "log";
|
|
62
|
+
}
|
|
63
|
+
/** Install the lazy-module seam (bootstrap-time; root container only). */
|
|
64
|
+
setLazyHook(hook) {
|
|
65
|
+
this.root.lazyHook = hook;
|
|
66
|
+
}
|
|
67
|
+
claimLazyModule(declaringModuleId) {
|
|
68
|
+
const hook = this.root.lazyHook;
|
|
69
|
+
if (hook?.isPending(declaringModuleId)) hook.claim(declaringModuleId);
|
|
70
|
+
}
|
|
71
|
+
maybeDrainSync() {
|
|
72
|
+
const root = this.root;
|
|
73
|
+
const hook = root.lazyHook;
|
|
74
|
+
if (!hook?.hasClaimed()) return;
|
|
75
|
+
if (this.resolutionStack.size > 0) return;
|
|
76
|
+
if (root.asyncDepth > 0) return;
|
|
77
|
+
if (hook.isDraining()) return;
|
|
78
|
+
hook.drainSync();
|
|
79
|
+
}
|
|
80
|
+
register(provider, declaringModuleId) {
|
|
81
|
+
const moduleId = declaringModuleId ?? "__root__";
|
|
82
|
+
if (typeof provider === "function") this.registerClass(provider, moduleId);
|
|
83
|
+
else this.registerOptions(provider, moduleId);
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
registerClass(target, moduleId) {
|
|
87
|
+
if (!isInjectable(target)) console.warn(`Warning: ${target.name} is not decorated with @Injectable(). It will be registered but dependency resolution may not work correctly.`);
|
|
88
|
+
const scope = getScope(target);
|
|
89
|
+
this.writeRegistration(moduleId, target, {
|
|
90
|
+
provide: target,
|
|
91
|
+
scope,
|
|
92
|
+
declaringModuleId: moduleId,
|
|
93
|
+
useClass: target
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
registerOptions(options, moduleId) {
|
|
97
|
+
const token = options.provide;
|
|
98
|
+
if (!token) throw new Error("Provider registration requires a token");
|
|
99
|
+
const registration = {
|
|
100
|
+
provide: token,
|
|
101
|
+
scope: options.scope ?? Scope.SINGLETON,
|
|
102
|
+
declaringModuleId: moduleId
|
|
103
|
+
};
|
|
104
|
+
if (options.useValue !== void 0) {
|
|
105
|
+
registration.useValue = options.useValue;
|
|
106
|
+
registration.instance = options.useValue;
|
|
107
|
+
} else if (options.useFactory) {
|
|
108
|
+
registration.useFactory = options.useFactory;
|
|
109
|
+
registration.inject = options.inject;
|
|
110
|
+
} else if (options.useClass) registration.useClass = options.useClass;
|
|
111
|
+
else if (options.useExisting) registration.useExisting = options.useExisting;
|
|
112
|
+
else if (typeof token === "function") registration.useClass = token;
|
|
113
|
+
this.writeRegistration(moduleId, token, registration);
|
|
114
|
+
}
|
|
115
|
+
writeRegistration(moduleId, token, registration) {
|
|
116
|
+
let bucket = this.providers.get(moduleId);
|
|
117
|
+
if (!bucket) {
|
|
118
|
+
bucket = /* @__PURE__ */ new Map();
|
|
119
|
+
this.providers.set(moduleId, bucket);
|
|
120
|
+
}
|
|
121
|
+
bucket.set(token, registration);
|
|
122
|
+
let exporters = this.exporterIndex.get(token);
|
|
123
|
+
if (!exporters) {
|
|
124
|
+
exporters = /* @__PURE__ */ new Set();
|
|
125
|
+
this.exporterIndex.set(token, exporters);
|
|
126
|
+
}
|
|
127
|
+
exporters.add(moduleId);
|
|
128
|
+
}
|
|
129
|
+
registerScope(scope) {
|
|
130
|
+
this.scopes.set(scope.moduleId, scope);
|
|
131
|
+
if (!this.providers.has(scope.moduleId)) this.providers.set(scope.moduleId, /* @__PURE__ */ new Map());
|
|
132
|
+
if (scope.isGlobal) for (const token of scope.exportedTokens) this.globals.add(token);
|
|
133
|
+
}
|
|
134
|
+
markGlobalToken(token) {
|
|
135
|
+
this.globals.add(token);
|
|
136
|
+
}
|
|
137
|
+
setRequestInstance(token, value) {
|
|
138
|
+
this.requestInstances.set(token, value);
|
|
139
|
+
}
|
|
140
|
+
getDiagnostics() {
|
|
141
|
+
return this.diagnostics;
|
|
142
|
+
}
|
|
143
|
+
resolve(token, requestingModuleId) {
|
|
144
|
+
const registration = this.findRegistration(token, requestingModuleId);
|
|
145
|
+
if (registration) {
|
|
146
|
+
const instance = this.resolveRegistration(registration, requestingModuleId);
|
|
147
|
+
this.maybeDrainSync();
|
|
148
|
+
return instance;
|
|
149
|
+
}
|
|
150
|
+
if (requestingModuleId !== void 0 && this.scopes.has(requestingModuleId) && this.exporterIndex.has(token)) throw new ModuleVisibilityError(requestingModuleId, token);
|
|
151
|
+
if (isErasedTypeToken(token)) throw new Error(`No provider found for token: ${this.tokenToString(token)}. Did you use \`import type { X }\`? TypeScript strips type-only imports at runtime and \`design:paramtypes\` emits \`Object\`/\`undefined\` for their positions. Use a runtime \`import { X }\` for DI tokens.`);
|
|
152
|
+
if (typeof token === "function") throw new Error(`No provider found for token: ${this.tokenToString(token)}. Declare it in a module's providers.`);
|
|
153
|
+
if (token instanceof InjectionToken && token.options?.factory) {
|
|
154
|
+
this.register({
|
|
155
|
+
provide: token,
|
|
156
|
+
useFactory: token.options.factory
|
|
157
|
+
});
|
|
158
|
+
return this.resolve(token, requestingModuleId);
|
|
159
|
+
}
|
|
160
|
+
throw new Error(`No provider found for token: ${this.tokenToString(token)}`);
|
|
161
|
+
}
|
|
162
|
+
resolveAll(token, requestingModuleId) {
|
|
163
|
+
const instances = this.findAllRegistrations(token, requestingModuleId).map((r) => this.resolveRegistration(r, requestingModuleId));
|
|
164
|
+
this.maybeDrainSync();
|
|
165
|
+
return instances;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Find a single reachable registration for a token, applying the visibility
|
|
169
|
+
* walk: requester's bucket → globals → requester's importedModules
|
|
170
|
+
* (transitively, following re-exports).
|
|
171
|
+
*
|
|
172
|
+
* Returns `undefined` if no candidate exists. Throws
|
|
173
|
+
* `MultipleProvidersFoundError` if the imports walk yields more than one.
|
|
174
|
+
*/
|
|
175
|
+
findRegistration(token, requestingModuleId) {
|
|
176
|
+
if (requestingModuleId === void 0 || !this.scopes.has(requestingModuleId)) {
|
|
177
|
+
const rootHit = this.lookupInBucket(ROOT_MODULE_ID, token);
|
|
178
|
+
if (rootHit) return rootHit;
|
|
179
|
+
const exporters = this.exporterIndex.get(token);
|
|
180
|
+
if (!exporters) return void 0;
|
|
181
|
+
for (const owner of exporters) {
|
|
182
|
+
const hit = this.lookupInBucket(owner, token);
|
|
183
|
+
if (hit) return hit;
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const local = this.lookupInBucket(requestingModuleId, token);
|
|
188
|
+
if (local) return local;
|
|
189
|
+
if (this.globals.has(token)) {
|
|
190
|
+
const exporters = this.exporterIndex.get(token);
|
|
191
|
+
if (exporters && exporters.size > 0) {
|
|
192
|
+
if (exporters.size > 1) throw new MultipleProvidersFoundError(requestingModuleId, token, [...exporters]);
|
|
193
|
+
const [owner] = [...exporters];
|
|
194
|
+
return this.lookupInBucket(owner, token);
|
|
195
|
+
}
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (token instanceof InjectionToken && token.options?.factory) return this.lookupInBucket(ROOT_MODULE_ID, token);
|
|
199
|
+
const scope = this.scopes.get(requestingModuleId);
|
|
200
|
+
if (!scope) return void 0;
|
|
201
|
+
const candidates = [];
|
|
202
|
+
const candidateModuleIds = [];
|
|
203
|
+
const visited = /* @__PURE__ */ new Set([requestingModuleId]);
|
|
204
|
+
this.collectFromImports(scope, token, visited, candidates, candidateModuleIds);
|
|
205
|
+
if (candidates.length === 0) return void 0;
|
|
206
|
+
if (candidates.length > 1) throw new MultipleProvidersFoundError(requestingModuleId, token, candidateModuleIds);
|
|
207
|
+
return candidates[0];
|
|
208
|
+
}
|
|
209
|
+
/** Typed bucket lookup — single seam where the Map<Token, Registration> erases T. */
|
|
210
|
+
lookupInBucket(moduleId, token) {
|
|
211
|
+
return this.providers.get(moduleId)?.get(token);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Walk a scope's imports (and their imports' imports, …) collecting every
|
|
215
|
+
* registration reachable through re-export chains. A child only contributes
|
|
216
|
+
* if it explicitly exports the token — non-exported providers stay private.
|
|
217
|
+
*/
|
|
218
|
+
collectFromImports(scope, token, visited, candidates, candidateModuleIds) {
|
|
219
|
+
for (const importedId of scope.importedModules) {
|
|
220
|
+
if (visited.has(importedId)) continue;
|
|
221
|
+
visited.add(importedId);
|
|
222
|
+
const imported = this.scopes.get(importedId);
|
|
223
|
+
if (!imported?.exportedTokens.has(token)) continue;
|
|
224
|
+
const direct = this.lookupInBucket(importedId, token);
|
|
225
|
+
if (direct) {
|
|
226
|
+
candidates.push(direct);
|
|
227
|
+
candidateModuleIds.push(importedId);
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
this.collectFromImports(imported, token, visited, candidates, candidateModuleIds);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
findAllRegistrations(token, requestingModuleId) {
|
|
234
|
+
if (requestingModuleId === void 0) {
|
|
235
|
+
const exporters = this.exporterIndex.get(token);
|
|
236
|
+
if (!exporters) return [];
|
|
237
|
+
return [...exporters].map((id) => this.lookupInBucket(id, token)).filter((r) => r !== void 0);
|
|
238
|
+
}
|
|
239
|
+
const out = [];
|
|
240
|
+
const seen = /* @__PURE__ */ new Set();
|
|
241
|
+
const local = this.lookupInBucket(requestingModuleId, token);
|
|
242
|
+
if (local && !seen.has(local)) {
|
|
243
|
+
out.push(local);
|
|
244
|
+
seen.add(local);
|
|
245
|
+
}
|
|
246
|
+
if (this.globals.has(token)) for (const owner of this.exporterIndex.get(token) ?? []) {
|
|
247
|
+
const reg = this.lookupInBucket(owner, token);
|
|
248
|
+
if (reg && !seen.has(reg)) {
|
|
249
|
+
out.push(reg);
|
|
250
|
+
seen.add(reg);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const scope = this.scopes.get(requestingModuleId);
|
|
254
|
+
if (scope) for (const importedId of scope.importedModules) {
|
|
255
|
+
if (!this.scopes.get(importedId)?.exportedTokens.has(token)) continue;
|
|
256
|
+
const reg = this.lookupInBucket(importedId, token);
|
|
257
|
+
if (reg && !seen.has(reg)) {
|
|
258
|
+
out.push(reg);
|
|
259
|
+
seen.add(reg);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
}
|
|
264
|
+
/** True if any bucket has a registration for `token`. Sandbox-friendly. */
|
|
265
|
+
has(token) {
|
|
266
|
+
return this.exporterIndex.has(token);
|
|
267
|
+
}
|
|
268
|
+
/** True if the specified module's bucket has a registration for `token`. */
|
|
269
|
+
hasInScope(token, moduleId) {
|
|
270
|
+
return this.providers.get(moduleId)?.has(token) ?? false;
|
|
271
|
+
}
|
|
272
|
+
/** Module buckets that hold a registration for `token` (registration order). */
|
|
273
|
+
getOwnerModuleIds(token) {
|
|
274
|
+
return [...this.exporterIndex.get(token) ?? []];
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Force-replace a provider across module scopes — the supported form of the
|
|
278
|
+
* override loop test harnesses need (module-scoped resolution consults the
|
|
279
|
+
* module's own bucket first, so a root-only override would never win there).
|
|
280
|
+
*
|
|
281
|
+
* - `'all-existing'` (default): every non-root bucket that already holds the
|
|
282
|
+
* token, plus `__root__` (so framework-internal lookups see it too).
|
|
283
|
+
* - `'root'`: only the `__root__` bucket.
|
|
284
|
+
* - `string[]`: exactly these bucket ids.
|
|
285
|
+
*/
|
|
286
|
+
replaceProvider(provider, options = {}) {
|
|
287
|
+
const buckets = options.buckets ?? "all-existing";
|
|
288
|
+
if (buckets === "root") return this.register(provider);
|
|
289
|
+
if (Array.isArray(buckets)) {
|
|
290
|
+
for (const moduleId of buckets) this.register(provider, moduleId);
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
const token = typeof provider === "function" ? provider : provider.provide;
|
|
294
|
+
if (!token) throw new Error("replaceProvider requires a token (`provide`)");
|
|
295
|
+
for (const [moduleId, bucket] of this.providers) {
|
|
296
|
+
if (moduleId === "__root__") continue;
|
|
297
|
+
if (bucket.has(token)) this.register(provider, moduleId);
|
|
298
|
+
}
|
|
299
|
+
return this.register(provider);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* True when the token belongs exclusively to lazy modules that have not
|
|
303
|
+
* been materialized yet — resolving it would trigger materialization.
|
|
304
|
+
* Build-time probes (route-manager middleware priority, entrypoint
|
|
305
|
+
* snapshots) use this to defer instead of forcing the group.
|
|
306
|
+
*/
|
|
307
|
+
isLazyPending(token) {
|
|
308
|
+
const hook = this.root.lazyHook;
|
|
309
|
+
if (!hook) return false;
|
|
310
|
+
const owners = this.exporterIndex.get(token);
|
|
311
|
+
if (!owners || owners.size === 0) return false;
|
|
312
|
+
for (const owner of owners) if (!hook.isPending(owner)) return false;
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* True when any registration of the token holds a constructed instance.
|
|
317
|
+
* Diagnostic helper (cold-start tests): checks WITHOUT resolving, so it
|
|
318
|
+
* never triggers lazy materialization.
|
|
319
|
+
*/
|
|
320
|
+
isInstantiated(token) {
|
|
321
|
+
for (const owner of this.exporterIndex.get(token) ?? []) {
|
|
322
|
+
const reg = this.providers.get(owner)?.get(token);
|
|
323
|
+
if (reg && reg.instance !== void 0) return true;
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
getProviderScope(token) {
|
|
328
|
+
const exporters = this.exporterIndex.get(token);
|
|
329
|
+
if (!exporters) return void 0;
|
|
330
|
+
for (const owner of exporters) {
|
|
331
|
+
const reg = this.providers.get(owner)?.get(token);
|
|
332
|
+
if (reg) return reg.effectiveScope ?? reg.scope;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
getTokens() {
|
|
336
|
+
const out = /* @__PURE__ */ new Set();
|
|
337
|
+
for (const bucket of this.providers.values()) for (const token of bucket.keys()) out.add(token);
|
|
338
|
+
return [...out];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Every statically-provided (useValue) instance across ALL module buckets.
|
|
342
|
+
* Unlike resolving a token (which yields only the first bucket's registration),
|
|
343
|
+
* this surfaces per-instance values — e.g. one BindingRef per multi-instance
|
|
344
|
+
* binding module — so framework adapters can initialize all of them.
|
|
345
|
+
*/
|
|
346
|
+
getUseValues() {
|
|
347
|
+
const out = [];
|
|
348
|
+
for (const bucket of this.providers.values()) for (const reg of bucket.values()) if (reg.useValue !== void 0) out.push(reg.useValue);
|
|
349
|
+
return out;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Serializable description of every loaded module instance (load order),
|
|
353
|
+
* plus the `__root__` bucket (bootstrap primitives) when non-empty —
|
|
354
|
+
* the `vela module graph` seam. Reads registration state only: safe pre-
|
|
355
|
+
* and post-bootstrap, never constructs, never claims lazy modules.
|
|
356
|
+
*/
|
|
357
|
+
getModuleDescriptions() {
|
|
358
|
+
const out = [];
|
|
359
|
+
for (const scope of this.scopes.values()) out.push({
|
|
360
|
+
moduleId: scope.moduleId,
|
|
361
|
+
imports: [...scope.importedModules],
|
|
362
|
+
isGlobal: scope.isGlobal,
|
|
363
|
+
lazy: scope.lazy === true,
|
|
364
|
+
providers: [...this.providers.get(scope.moduleId)?.keys() ?? []].map(describeToken),
|
|
365
|
+
exports: [...scope.exportedTokens].map(describeToken)
|
|
366
|
+
});
|
|
367
|
+
const rootBucket = this.providers.get(ROOT_MODULE_ID);
|
|
368
|
+
if (rootBucket && rootBucket.size > 0) out.push({
|
|
369
|
+
moduleId: ROOT_MODULE_ID,
|
|
370
|
+
imports: [],
|
|
371
|
+
isGlobal: false,
|
|
372
|
+
lazy: false,
|
|
373
|
+
providers: [...rootBucket.keys()].map(describeToken),
|
|
374
|
+
exports: []
|
|
375
|
+
});
|
|
376
|
+
return out;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Compute request-scope bubbling for every registration (call once at
|
|
380
|
+
* bootstrap, after all providers are registered). A provider whose declared
|
|
381
|
+
* scope is not REQUEST but which (transitively) depends on a request-scoped
|
|
382
|
+
* provider is marked `effectiveScope = REQUEST`, so it is rebuilt per request
|
|
383
|
+
* instead of capturing the first request's instance — matching NestJS.
|
|
384
|
+
*/
|
|
385
|
+
computeEffectiveScopes() {
|
|
386
|
+
const regs = [];
|
|
387
|
+
for (const bucket of this.providers.values()) for (const reg of bucket.values()) {
|
|
388
|
+
reg.effectiveScope = reg.scope;
|
|
389
|
+
regs.push(reg);
|
|
390
|
+
}
|
|
391
|
+
const consumers = /* @__PURE__ */ new Map();
|
|
392
|
+
for (const reg of regs) for (const depToken of this.dependencyTokensOf(reg)) {
|
|
393
|
+
const depReg = this.tryFindRegistration(depToken, reg.declaringModuleId);
|
|
394
|
+
if (!depReg) continue;
|
|
395
|
+
const list = consumers.get(depReg);
|
|
396
|
+
if (list) list.push(reg);
|
|
397
|
+
else consumers.set(depReg, [reg]);
|
|
398
|
+
}
|
|
399
|
+
const queue = regs.filter((r) => r.effectiveScope === Scope.REQUEST);
|
|
400
|
+
while (queue.length > 0) {
|
|
401
|
+
const dep = queue.pop();
|
|
402
|
+
for (const consumer of consumers.get(dep) ?? []) if (consumer.effectiveScope !== Scope.REQUEST) {
|
|
403
|
+
consumer.effectiveScope = Scope.REQUEST;
|
|
404
|
+
queue.push(consumer);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
/** The dependency tokens a registration would resolve when constructed. */
|
|
409
|
+
dependencyTokensOf(reg) {
|
|
410
|
+
if (reg.useExisting) return [reg.useExisting];
|
|
411
|
+
if (reg.useFactory) return (reg.inject ?? []).map((t) => t instanceof ForwardRef ? t.factory() : t);
|
|
412
|
+
const cls = reg.useClass ?? (typeof reg.provide === "function" ? reg.provide : void 0);
|
|
413
|
+
if (!cls) return [];
|
|
414
|
+
const paramTypes = getConstructorDependencies(cls);
|
|
415
|
+
const injectMetadata = getInjectMetadata(cls);
|
|
416
|
+
const injectMap = new Map(injectMetadata.map((m) => [m.index, m]));
|
|
417
|
+
const arity = Math.max(paramTypes.length, injectMetadata.reduce((max, m) => Math.max(max, m.index + 1), 0));
|
|
418
|
+
const tokens = [];
|
|
419
|
+
for (let i = 0; i < arity; i++) {
|
|
420
|
+
const raw = injectMap.get(i)?.token;
|
|
421
|
+
const token = raw instanceof ForwardRef ? raw.factory() : raw ?? paramTypes[i];
|
|
422
|
+
if (token && !isErasedTypeToken(token)) tokens.push(token);
|
|
423
|
+
}
|
|
424
|
+
return tokens;
|
|
425
|
+
}
|
|
426
|
+
tryFindRegistration(token, requestingModuleId) {
|
|
427
|
+
try {
|
|
428
|
+
return this.findRegistration(token, requestingModuleId);
|
|
429
|
+
} catch {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Create a child container for request-scoped resolution.
|
|
435
|
+
* The child shares the parent's providers but caches REQUEST-scoped
|
|
436
|
+
* instances separately per child (per request).
|
|
437
|
+
*/
|
|
438
|
+
createChild() {
|
|
439
|
+
const child = new Container({ diagnostics: this.diagnostics });
|
|
440
|
+
child.providers = this.providers;
|
|
441
|
+
child.exporterIndex = this.exporterIndex;
|
|
442
|
+
child.scopes = this.scopes;
|
|
443
|
+
child.globals = this.globals;
|
|
444
|
+
child.root = this.root;
|
|
445
|
+
return child;
|
|
446
|
+
}
|
|
447
|
+
createDetached() {
|
|
448
|
+
const child = new Container({ diagnostics: this.diagnostics });
|
|
449
|
+
const clonedProviders = /* @__PURE__ */ new Map();
|
|
450
|
+
for (const [moduleId, bucket] of this.providers) clonedProviders.set(moduleId, new Map(bucket));
|
|
451
|
+
child.providers = clonedProviders;
|
|
452
|
+
const clonedIndex = /* @__PURE__ */ new Map();
|
|
453
|
+
for (const [token, owners] of this.exporterIndex) clonedIndex.set(token, new Set(owners));
|
|
454
|
+
child.exporterIndex = clonedIndex;
|
|
455
|
+
child.scopes = this.scopes;
|
|
456
|
+
child.globals = this.globals;
|
|
457
|
+
child.root = this.root;
|
|
458
|
+
return child;
|
|
459
|
+
}
|
|
460
|
+
clear() {
|
|
461
|
+
this.providers.clear();
|
|
462
|
+
this.exporterIndex.clear();
|
|
463
|
+
this.resolutionStack.clear();
|
|
464
|
+
this.requestInstances.clear();
|
|
465
|
+
this.scopes.clear();
|
|
466
|
+
this.globals.clear();
|
|
467
|
+
this.disposables = [];
|
|
468
|
+
}
|
|
469
|
+
/** Whether this container has any tracked disposables (cheap request-path check). */
|
|
470
|
+
hasDisposables() {
|
|
471
|
+
return this.disposables.length > 0;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Dispose container-constructed instances (Symbol.asyncDispose /
|
|
475
|
+
* Symbol.dispose / .dispose()) in reverse creation order (LIFO). Errors are
|
|
476
|
+
* logged and skipped so one bad teardown never blocks the rest.
|
|
477
|
+
*
|
|
478
|
+
* A REQUEST child disposes only its own request-scoped instances; the root
|
|
479
|
+
* disposes shared SINGLETONs and clears their cached instance so a dev HMR
|
|
480
|
+
* generation cannot leak a stale graph. Shared provider maps are left intact
|
|
481
|
+
* for a request child (they belong to the root).
|
|
482
|
+
*/
|
|
483
|
+
async dispose() {
|
|
484
|
+
const pending = this.disposables;
|
|
485
|
+
this.disposables = [];
|
|
486
|
+
for (let i = pending.length - 1; i >= 0; i--) try {
|
|
487
|
+
await disposeInstance(pending[i]);
|
|
488
|
+
} catch (error) {
|
|
489
|
+
if (this.diagnostics !== "silent") console.error("Error disposing instance:", error);
|
|
490
|
+
}
|
|
491
|
+
this.requestInstances.clear();
|
|
492
|
+
if (this.root === this) {
|
|
493
|
+
for (const bucket of this.providers.values()) for (const registration of bucket.values()) if (registration.scope === Scope.SINGLETON && registration.useValue === void 0) registration.instance = void 0;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
resolveRegistration(registration, requestingModuleId) {
|
|
497
|
+
if (registration.useValue !== void 0) return registration.useValue;
|
|
498
|
+
this.claimLazyModule(registration.declaringModuleId);
|
|
499
|
+
if (registration.useExisting) return this.resolve(registration.useExisting, requestingModuleId);
|
|
500
|
+
const scope = registration.effectiveScope ?? registration.scope;
|
|
501
|
+
if (scope === Scope.SINGLETON && registration.instance !== void 0) return registration.instance;
|
|
502
|
+
if (scope === Scope.REQUEST) {
|
|
503
|
+
const cached = this.requestInstances.get(registration.provide);
|
|
504
|
+
if (cached !== void 0) return cached;
|
|
505
|
+
}
|
|
506
|
+
if (this.resolutionStack.has(registration.provide)) {
|
|
507
|
+
const chain = [...this.resolutionStack, registration.provide].map((t) => this.tokenToString(t)).join(" -> ");
|
|
508
|
+
throw new Error(`Circular dependency detected: ${chain}`);
|
|
509
|
+
}
|
|
510
|
+
this.resolutionStack.add(registration.provide);
|
|
511
|
+
try {
|
|
512
|
+
let instance;
|
|
513
|
+
if (registration.useFactory) instance = this.resolveFactory(registration);
|
|
514
|
+
else if (registration.useClass) instance = this.resolveClass(registration.useClass, registration.declaringModuleId);
|
|
515
|
+
else throw new Error(`Invalid provider registration for: ${this.tokenToString(registration.provide)}`);
|
|
516
|
+
if (scope === Scope.SINGLETON) {
|
|
517
|
+
registration.instance = instance;
|
|
518
|
+
if (isDisposable(instance)) this.root.disposables.push(instance);
|
|
519
|
+
} else if (scope === Scope.REQUEST) {
|
|
520
|
+
this.requestInstances.set(registration.provide, instance);
|
|
521
|
+
if (isDisposable(instance)) this.disposables.push(instance);
|
|
522
|
+
}
|
|
523
|
+
return instance;
|
|
524
|
+
} finally {
|
|
525
|
+
this.resolutionStack.delete(registration.provide);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
resolveClass(target, ownerModuleId) {
|
|
529
|
+
const paramTypes = getConstructorDependencies(target);
|
|
530
|
+
const injectMetadata = getInjectMetadata(target);
|
|
531
|
+
const injectMap = new Map(injectMetadata.map((m) => [m.index, m]));
|
|
532
|
+
const arity = Math.max(paramTypes.length, injectMetadata.reduce((max, m) => Math.max(max, m.index + 1), 0));
|
|
533
|
+
return new target(...Array.from({ length: arity }, (_unused, index) => {
|
|
534
|
+
const paramType = paramTypes[index];
|
|
535
|
+
const meta = injectMap.get(index);
|
|
536
|
+
const rawToken = meta?.token;
|
|
537
|
+
const isForwardRef = rawToken instanceof ForwardRef;
|
|
538
|
+
const token = isForwardRef ? rawToken.factory() : rawToken ?? paramType;
|
|
539
|
+
if (!token || isErasedTypeToken(token)) {
|
|
540
|
+
if (meta?.optional) return void 0;
|
|
541
|
+
throw new Error(`Cannot resolve dependency at index ${index} for ${target.name}. Parameter type is undefined or Object. Did you use \`import type { X }\`? TypeScript strips type-only imports at runtime and \`design:paramtypes\` emits \`Object\`/\`undefined\` for their positions. Use a runtime \`import { X }\` for DI tokens. Alternatively, use \`@Inject()\` to specify the token explicitly.`);
|
|
542
|
+
}
|
|
543
|
+
if (meta?.optional && !this.has(token)) return;
|
|
544
|
+
if (isForwardRef && this.resolutionStack.has(token)) return this.createLazyProxy(token, ownerModuleId);
|
|
545
|
+
return this.resolve(token, ownerModuleId);
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Resolve one factory `inject` dependency. Since 1.11 the declaring module's
|
|
550
|
+
* scope is consulted FIRST (proper visibility semantics — a `forRootAsync`
|
|
551
|
+
* factory can inject providers reachable through its module's imports); on
|
|
552
|
+
* any failure the legacy no-requester lookup (root bucket, then first
|
|
553
|
+
* exporter) is kept as fallback, so every previously-resolving graph still
|
|
554
|
+
* resolves.
|
|
555
|
+
*/
|
|
556
|
+
resolveFactoryDependency(token, declaringModuleId) {
|
|
557
|
+
if (declaringModuleId !== "__root__" && this.scopes.has(declaringModuleId)) try {
|
|
558
|
+
return this.resolve(token, declaringModuleId);
|
|
559
|
+
} catch {}
|
|
560
|
+
return this.resolve(token);
|
|
561
|
+
}
|
|
562
|
+
async resolveFactoryDependencyAsync(token, declaringModuleId) {
|
|
563
|
+
if (declaringModuleId !== "__root__" && this.scopes.has(declaringModuleId)) try {
|
|
564
|
+
return await this.resolveAsync(token, declaringModuleId);
|
|
565
|
+
} catch {}
|
|
566
|
+
return this.resolveAsync(token);
|
|
567
|
+
}
|
|
568
|
+
resolveFactory(registration) {
|
|
569
|
+
if (!registration.useFactory) throw new Error("Factory function is missing");
|
|
570
|
+
const dependencies = (registration.inject || []).map((token) => {
|
|
571
|
+
const resolved = token instanceof ForwardRef ? token.factory() : token;
|
|
572
|
+
return this.resolveFactoryDependency(resolved, registration.declaringModuleId);
|
|
573
|
+
});
|
|
574
|
+
const result = registration.useFactory(...dependencies);
|
|
575
|
+
if (result instanceof Promise) throw new Error(`Async factory for ${this.tokenToString(registration.provide)} returned a Promise. Use resolveAsync() for async providers.`);
|
|
576
|
+
return result;
|
|
577
|
+
}
|
|
578
|
+
async resolveAsync(token, requestingModuleId) {
|
|
579
|
+
const root = this.root;
|
|
580
|
+
root.asyncDepth++;
|
|
581
|
+
let result;
|
|
582
|
+
try {
|
|
583
|
+
result = await this.resolveAsyncInner(token, requestingModuleId);
|
|
584
|
+
} finally {
|
|
585
|
+
root.asyncDepth--;
|
|
586
|
+
}
|
|
587
|
+
if (root.asyncDepth === 0 && root.lazyHook?.hasClaimed() && !root.lazyHook.isDraining()) await root.lazyHook.drainAsync();
|
|
588
|
+
return result;
|
|
589
|
+
}
|
|
590
|
+
async resolveAsyncInner(token, requestingModuleId) {
|
|
591
|
+
const registration = this.findRegistration(token, requestingModuleId);
|
|
592
|
+
if (!registration) {
|
|
593
|
+
if (requestingModuleId !== void 0 && this.scopes.has(requestingModuleId) && this.exporterIndex.has(token)) throw new ModuleVisibilityError(requestingModuleId, token);
|
|
594
|
+
if (typeof token === "function") throw new Error(`No provider found for token: ${this.tokenToString(token)}. Declare it in a module's providers.`);
|
|
595
|
+
if (token instanceof InjectionToken && token.options?.factory) {
|
|
596
|
+
this.register({
|
|
597
|
+
provide: token,
|
|
598
|
+
useFactory: token.options.factory
|
|
599
|
+
});
|
|
600
|
+
return this.resolveAsync(token, requestingModuleId);
|
|
601
|
+
}
|
|
602
|
+
throw new Error(`No provider found for token: ${this.tokenToString(token)}`);
|
|
603
|
+
}
|
|
604
|
+
if (registration.useFactory) {
|
|
605
|
+
const scope = registration.effectiveScope ?? registration.scope;
|
|
606
|
+
if (scope === Scope.SINGLETON && registration.instance !== void 0) return registration.instance;
|
|
607
|
+
this.claimLazyModule(registration.declaringModuleId);
|
|
608
|
+
const dependencies = await Promise.all((registration.inject || []).map((t) => {
|
|
609
|
+
const resolved = t instanceof ForwardRef ? t.factory() : t;
|
|
610
|
+
return this.resolveFactoryDependencyAsync(resolved, registration.declaringModuleId);
|
|
611
|
+
}));
|
|
612
|
+
const instance = await registration.useFactory(...dependencies);
|
|
613
|
+
if (scope === Scope.SINGLETON) {
|
|
614
|
+
registration.instance = instance;
|
|
615
|
+
if (isDisposable(instance)) this.root.disposables.push(instance);
|
|
616
|
+
}
|
|
617
|
+
return instance;
|
|
618
|
+
}
|
|
619
|
+
return this.resolve(token, requestingModuleId);
|
|
620
|
+
}
|
|
621
|
+
createLazyProxy(token, requestingModuleId) {
|
|
622
|
+
const container = this;
|
|
623
|
+
return new Proxy(Object.create(null), {
|
|
624
|
+
get(_target, prop) {
|
|
625
|
+
const instance = container.resolve(token, requestingModuleId);
|
|
626
|
+
const value = Reflect.get(instance, prop, instance);
|
|
627
|
+
return typeof value === "function" ? value.bind(instance) : value;
|
|
628
|
+
},
|
|
629
|
+
set(_target, prop, value) {
|
|
630
|
+
const instance = container.resolve(token, requestingModuleId);
|
|
631
|
+
return Reflect.set(instance, prop, value);
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
tokenToString(token) {
|
|
636
|
+
if (token instanceof InjectionToken) return token.toString();
|
|
637
|
+
if (typeof token === "function") return token.name;
|
|
638
|
+
if (typeof token === "symbol") return token.toString();
|
|
639
|
+
return String(token);
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
//#endregion
|
|
643
|
+
export { Container as t };
|
|
644
|
+
|
|
645
|
+
//# sourceMappingURL=container-BqUHID4l.js.map
|