@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
|
@@ -1,849 +0,0 @@
|
|
|
1
|
-
import { Scope } from "../constants.js";
|
|
2
|
-
import { disposeInstance, isDisposable } from "./disposable.js";
|
|
3
|
-
import { getConstructorDependencies, getInjectMetadata, getScope, isInjectable } from "./decorators.js";
|
|
4
|
-
import { describeToken, ForwardRef, InjectionToken, ModuleVisibilityError, MultipleProvidersFoundError, ROOT_MODULE_ID } from "./types.js";
|
|
5
|
-
const IMPORT_TYPE_HINT = '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.';
|
|
6
|
-
/**
|
|
7
|
-
* Sentinel comparing a token to the bare `Object` class — `design:paramtypes`
|
|
8
|
-
* emits `Object` when TypeScript erases a type-only import, so any token that
|
|
9
|
-
* is `Object` (or nullish) is the fingerprint of a stripped type.
|
|
10
|
-
*/ function isErasedTypeToken(token) {
|
|
11
|
-
return token === Object || token == null;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Per-module provider buckets. Each module instance owns its providers under
|
|
15
|
-
* its `moduleId`; the same logical token can have distinct registrations in
|
|
16
|
-
* different buckets, supporting multi-instance dynamic modules.
|
|
17
|
-
*
|
|
18
|
-
* The `__root__` bucket holds bootstrap-time framework primitives (Container,
|
|
19
|
-
* ModuleRef, REQUEST_CONTEXT, etc.) and any `register()` call that doesn't
|
|
20
|
-
* supply a `declaringModuleId`.
|
|
21
|
-
*/ export class Container {
|
|
22
|
-
providers = new Map();
|
|
23
|
-
exporterIndex = new Map();
|
|
24
|
-
resolutionStack = new Set();
|
|
25
|
-
requestInstances = new Map();
|
|
26
|
-
scopes = new Map();
|
|
27
|
-
globals = new Set();
|
|
28
|
-
diagnostics;
|
|
29
|
-
// The root container that owns shared state; a request child points back here
|
|
30
|
-
// so container-constructed SINGLETONs are tracked (and disposed) at the root,
|
|
31
|
-
// never by the ephemeral child that happened to first resolve them.
|
|
32
|
-
root = this;
|
|
33
|
-
// Container-constructed instances in creation order, for LIFO disposal.
|
|
34
|
-
// useValue providers are never tracked (they return before construction).
|
|
35
|
-
disposables = [];
|
|
36
|
-
// Lazy-module seam (root-owned; children reach it via this.root). A
|
|
37
|
-
// resolution of a deferred registration CLAIMS its module; claimed groups
|
|
38
|
-
// are completed (constructed + hooks replayed) only when the resolution
|
|
39
|
-
// stack has unwound and no resolveAsync cascade is in flight — running the
|
|
40
|
-
// replay mid-construction could force-resolve a class currently on the
|
|
41
|
-
// resolution stack (discovery cascades) and mint a spurious
|
|
42
|
-
// circular-dependency error.
|
|
43
|
-
lazyHook;
|
|
44
|
-
asyncDepth = 0;
|
|
45
|
-
constructor(options = {}){
|
|
46
|
-
this.diagnostics = options.diagnostics ?? 'log';
|
|
47
|
-
}
|
|
48
|
-
/** Install the lazy-module seam (bootstrap-time; root container only). */ setLazyHook(hook) {
|
|
49
|
-
this.root.lazyHook = hook;
|
|
50
|
-
}
|
|
51
|
-
claimLazyModule(declaringModuleId) {
|
|
52
|
-
const hook = this.root.lazyHook;
|
|
53
|
-
if (hook?.isPending(declaringModuleId)) {
|
|
54
|
-
hook.claim(declaringModuleId);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
maybeDrainSync() {
|
|
58
|
-
const root = this.root;
|
|
59
|
-
const hook = root.lazyHook;
|
|
60
|
-
if (!hook?.hasClaimed()) return;
|
|
61
|
-
// Never replay hooks while construction is in flight; an async cascade
|
|
62
|
-
// drains (with await) at its own end instead. A running drain picks
|
|
63
|
-
// pending claims up itself — re-entering it is at best a no-op and on
|
|
64
|
-
// the async path a self-deadlock.
|
|
65
|
-
if (this.resolutionStack.size > 0) return;
|
|
66
|
-
if (root.asyncDepth > 0) return;
|
|
67
|
-
if (hook.isDraining()) return;
|
|
68
|
-
hook.drainSync();
|
|
69
|
-
}
|
|
70
|
-
register(provider, declaringModuleId) {
|
|
71
|
-
const moduleId = declaringModuleId ?? ROOT_MODULE_ID;
|
|
72
|
-
if (typeof provider === 'function') {
|
|
73
|
-
this.registerClass(provider, moduleId);
|
|
74
|
-
} else {
|
|
75
|
-
this.registerOptions(provider, moduleId);
|
|
76
|
-
}
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
registerClass(target, moduleId) {
|
|
80
|
-
if (!isInjectable(target)) {
|
|
81
|
-
console.warn(`Warning: ${target.name} is not decorated with @Injectable(). ` + `It will be registered but dependency resolution may not work correctly.`);
|
|
82
|
-
}
|
|
83
|
-
const scope = getScope(target);
|
|
84
|
-
this.writeRegistration(moduleId, target, {
|
|
85
|
-
provide: target,
|
|
86
|
-
scope,
|
|
87
|
-
declaringModuleId: moduleId,
|
|
88
|
-
useClass: target
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
registerOptions(options, moduleId) {
|
|
92
|
-
const token = options.provide;
|
|
93
|
-
if (!token) {
|
|
94
|
-
throw new Error('Provider registration requires a token');
|
|
95
|
-
}
|
|
96
|
-
const registration = {
|
|
97
|
-
provide: token,
|
|
98
|
-
scope: options.scope ?? Scope.SINGLETON,
|
|
99
|
-
declaringModuleId: moduleId
|
|
100
|
-
};
|
|
101
|
-
if (options.useValue !== undefined) {
|
|
102
|
-
registration.useValue = options.useValue;
|
|
103
|
-
registration.instance = options.useValue;
|
|
104
|
-
} else if (options.useFactory) {
|
|
105
|
-
registration.useFactory = options.useFactory;
|
|
106
|
-
registration.inject = options.inject;
|
|
107
|
-
} else if (options.useClass) {
|
|
108
|
-
registration.useClass = options.useClass;
|
|
109
|
-
} else if (options.useExisting) {
|
|
110
|
-
registration.useExisting = options.useExisting;
|
|
111
|
-
} else if (typeof token === 'function') {
|
|
112
|
-
registration.useClass = token;
|
|
113
|
-
}
|
|
114
|
-
this.writeRegistration(moduleId, token, registration);
|
|
115
|
-
}
|
|
116
|
-
writeRegistration(moduleId, token, registration) {
|
|
117
|
-
let bucket = this.providers.get(moduleId);
|
|
118
|
-
if (!bucket) {
|
|
119
|
-
bucket = new Map();
|
|
120
|
-
this.providers.set(moduleId, bucket);
|
|
121
|
-
}
|
|
122
|
-
bucket.set(token, registration);
|
|
123
|
-
let exporters = this.exporterIndex.get(token);
|
|
124
|
-
if (!exporters) {
|
|
125
|
-
exporters = new Set();
|
|
126
|
-
this.exporterIndex.set(token, exporters);
|
|
127
|
-
}
|
|
128
|
-
exporters.add(moduleId);
|
|
129
|
-
}
|
|
130
|
-
registerScope(scope) {
|
|
131
|
-
this.scopes.set(scope.moduleId, scope);
|
|
132
|
-
if (!this.providers.has(scope.moduleId)) {
|
|
133
|
-
this.providers.set(scope.moduleId, new Map());
|
|
134
|
-
}
|
|
135
|
-
if (scope.isGlobal) {
|
|
136
|
-
// Match NestJS / the loader's existing globalExports semantic: only
|
|
137
|
-
// exported tokens become globally visible. Non-exported providers of
|
|
138
|
-
// a @Global module still need explicit imports.
|
|
139
|
-
for (const token of scope.exportedTokens)this.globals.add(token);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
markGlobalToken(token) {
|
|
143
|
-
this.globals.add(token);
|
|
144
|
-
}
|
|
145
|
-
// Pre-seed the per-request cache. Only meaningful on a child container
|
|
146
|
-
// produced by createChild() — the root's requestInstances map is unused.
|
|
147
|
-
// Used by RouteManager to populate framework-provided request-scope
|
|
148
|
-
// values (REQUEST_CONTEXT) before any handler resolution runs, so the
|
|
149
|
-
// provider's factory never fires on the request path.
|
|
150
|
-
setRequestInstance(token, value) {
|
|
151
|
-
this.requestInstances.set(token, value);
|
|
152
|
-
}
|
|
153
|
-
getDiagnostics() {
|
|
154
|
-
return this.diagnostics;
|
|
155
|
-
}
|
|
156
|
-
resolve(token, requestingModuleId) {
|
|
157
|
-
const registration = this.findRegistration(token, requestingModuleId);
|
|
158
|
-
if (registration) {
|
|
159
|
-
const instance = this.resolveRegistration(registration, requestingModuleId);
|
|
160
|
-
this.maybeDrainSync();
|
|
161
|
-
return instance;
|
|
162
|
-
}
|
|
163
|
-
// Visibility error fires first when the token exists in some bucket but
|
|
164
|
-
// isn't reachable from the requester's scope — the user wants to know
|
|
165
|
-
// their wiring is wrong, not that the token doesn't exist.
|
|
166
|
-
if (requestingModuleId !== undefined && this.scopes.has(requestingModuleId) && this.exporterIndex.has(token)) {
|
|
167
|
-
throw new ModuleVisibilityError(requestingModuleId, token);
|
|
168
|
-
}
|
|
169
|
-
// `Object`/undefined at a token position is the fingerprint of a
|
|
170
|
-
// type-only import that TypeScript stripped — emit the hint before
|
|
171
|
-
// attempting any other recovery.
|
|
172
|
-
if (isErasedTypeToken(token)) {
|
|
173
|
-
throw new Error(`No provider found for token: ${this.tokenToString(token)}. ` + IMPORT_TYPE_HINT);
|
|
174
|
-
}
|
|
175
|
-
if (typeof token === 'function') {
|
|
176
|
-
throw new Error(`No provider found for token: ${this.tokenToString(token)}. ` + `Declare it in a module's providers.`);
|
|
177
|
-
}
|
|
178
|
-
// InjectionToken default factories are explicit user declarations
|
|
179
|
-
// attached to the token at construction — self-providing singletons.
|
|
180
|
-
if (token instanceof InjectionToken && token.options?.factory) {
|
|
181
|
-
this.register({
|
|
182
|
-
provide: token,
|
|
183
|
-
useFactory: token.options.factory
|
|
184
|
-
});
|
|
185
|
-
return this.resolve(token, requestingModuleId);
|
|
186
|
-
}
|
|
187
|
-
throw new Error(`No provider found for token: ${this.tokenToString(token)}`);
|
|
188
|
-
}
|
|
189
|
-
resolveAll(token, requestingModuleId) {
|
|
190
|
-
const registrations = this.findAllRegistrations(token, requestingModuleId);
|
|
191
|
-
const instances = registrations.map((r)=>this.resolveRegistration(r, requestingModuleId));
|
|
192
|
-
this.maybeDrainSync();
|
|
193
|
-
return instances;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Find a single reachable registration for a token, applying the visibility
|
|
197
|
-
* walk: requester's bucket → globals → requester's importedModules
|
|
198
|
-
* (transitively, following re-exports).
|
|
199
|
-
*
|
|
200
|
-
* Returns `undefined` if no candidate exists. Throws
|
|
201
|
-
* `MultipleProvidersFoundError` if the imports walk yields more than one.
|
|
202
|
-
*/ findRegistration(token, requestingModuleId) {
|
|
203
|
-
// No requester OR no scope for this requester: framework-internal /
|
|
204
|
-
// sandbox lookup. Prefer the `__root__` bucket so sandbox-registered
|
|
205
|
-
// transients (ModuleRef.create) and bootstrap primitives win over module
|
|
206
|
-
// buckets that may hold the same token under SINGLETON scope.
|
|
207
|
-
if (requestingModuleId === undefined || !this.scopes.has(requestingModuleId)) {
|
|
208
|
-
const rootHit = this.lookupInBucket(ROOT_MODULE_ID, token);
|
|
209
|
-
if (rootHit) return rootHit;
|
|
210
|
-
const exporters = this.exporterIndex.get(token);
|
|
211
|
-
if (!exporters) return undefined;
|
|
212
|
-
for (const owner of exporters){
|
|
213
|
-
const hit = this.lookupInBucket(owner, token);
|
|
214
|
-
if (hit) return hit;
|
|
215
|
-
}
|
|
216
|
-
return undefined;
|
|
217
|
-
}
|
|
218
|
-
// 1. Local bucket.
|
|
219
|
-
const local = this.lookupInBucket(requestingModuleId, token);
|
|
220
|
-
if (local) return local;
|
|
221
|
-
// 2. Global tokens — registration still lives in some module's bucket.
|
|
222
|
-
if (this.globals.has(token)) {
|
|
223
|
-
const exporters = this.exporterIndex.get(token);
|
|
224
|
-
if (exporters && exporters.size > 0) {
|
|
225
|
-
if (exporters.size > 1) {
|
|
226
|
-
throw new MultipleProvidersFoundError(requestingModuleId, token, [
|
|
227
|
-
...exporters
|
|
228
|
-
]);
|
|
229
|
-
}
|
|
230
|
-
const [owner] = [
|
|
231
|
-
...exporters
|
|
232
|
-
];
|
|
233
|
-
return this.lookupInBucket(owner, token);
|
|
234
|
-
}
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
// 3. InjectionToken with default factory — self-providing from any
|
|
238
|
-
// scope. If already auto-registered (in `__root__`), return that;
|
|
239
|
-
// otherwise let the caller materialize it.
|
|
240
|
-
if (token instanceof InjectionToken && token.options?.factory) {
|
|
241
|
-
return this.lookupInBucket(ROOT_MODULE_ID, token);
|
|
242
|
-
}
|
|
243
|
-
// 4. Imported modules' exports — walk transitively so re-exports work.
|
|
244
|
-
const scope = this.scopes.get(requestingModuleId);
|
|
245
|
-
if (!scope) return undefined;
|
|
246
|
-
const candidates = [];
|
|
247
|
-
const candidateModuleIds = [];
|
|
248
|
-
const visited = new Set([
|
|
249
|
-
requestingModuleId
|
|
250
|
-
]);
|
|
251
|
-
this.collectFromImports(scope, token, visited, candidates, candidateModuleIds);
|
|
252
|
-
if (candidates.length === 0) return undefined;
|
|
253
|
-
if (candidates.length > 1) {
|
|
254
|
-
throw new MultipleProvidersFoundError(requestingModuleId, token, candidateModuleIds);
|
|
255
|
-
}
|
|
256
|
-
return candidates[0];
|
|
257
|
-
}
|
|
258
|
-
/** Typed bucket lookup — single seam where the Map<Token, Registration> erases T. */ lookupInBucket(moduleId, token) {
|
|
259
|
-
return this.providers.get(moduleId)?.get(token);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Walk a scope's imports (and their imports' imports, …) collecting every
|
|
263
|
-
* registration reachable through re-export chains. A child only contributes
|
|
264
|
-
* if it explicitly exports the token — non-exported providers stay private.
|
|
265
|
-
*/ collectFromImports(scope, token, visited, candidates, candidateModuleIds) {
|
|
266
|
-
for (const importedId of scope.importedModules){
|
|
267
|
-
if (visited.has(importedId)) continue;
|
|
268
|
-
visited.add(importedId);
|
|
269
|
-
const imported = this.scopes.get(importedId);
|
|
270
|
-
if (!imported?.exportedTokens.has(token)) continue;
|
|
271
|
-
const direct = this.lookupInBucket(importedId, token);
|
|
272
|
-
if (direct) {
|
|
273
|
-
candidates.push(direct);
|
|
274
|
-
candidateModuleIds.push(importedId);
|
|
275
|
-
continue;
|
|
276
|
-
}
|
|
277
|
-
// Imported module re-exports the token without owning it — recurse
|
|
278
|
-
// into ITS imports.
|
|
279
|
-
this.collectFromImports(imported, token, visited, candidates, candidateModuleIds);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
findAllRegistrations(token, requestingModuleId) {
|
|
283
|
-
if (requestingModuleId === undefined) {
|
|
284
|
-
const exporters = this.exporterIndex.get(token);
|
|
285
|
-
if (!exporters) return [];
|
|
286
|
-
return [
|
|
287
|
-
...exporters
|
|
288
|
-
].map((id)=>this.lookupInBucket(id, token)).filter((r)=>r !== undefined);
|
|
289
|
-
}
|
|
290
|
-
const out = [];
|
|
291
|
-
const seen = new Set();
|
|
292
|
-
const local = this.lookupInBucket(requestingModuleId, token);
|
|
293
|
-
if (local && !seen.has(local)) {
|
|
294
|
-
out.push(local);
|
|
295
|
-
seen.add(local);
|
|
296
|
-
}
|
|
297
|
-
if (this.globals.has(token)) {
|
|
298
|
-
for (const owner of this.exporterIndex.get(token) ?? []){
|
|
299
|
-
const reg = this.lookupInBucket(owner, token);
|
|
300
|
-
if (reg && !seen.has(reg)) {
|
|
301
|
-
out.push(reg);
|
|
302
|
-
seen.add(reg);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
const scope = this.scopes.get(requestingModuleId);
|
|
307
|
-
if (scope) {
|
|
308
|
-
for (const importedId of scope.importedModules){
|
|
309
|
-
const imported = this.scopes.get(importedId);
|
|
310
|
-
if (!imported?.exportedTokens.has(token)) continue;
|
|
311
|
-
const reg = this.lookupInBucket(importedId, token);
|
|
312
|
-
if (reg && !seen.has(reg)) {
|
|
313
|
-
out.push(reg);
|
|
314
|
-
seen.add(reg);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return out;
|
|
319
|
-
}
|
|
320
|
-
/** True if any bucket has a registration for `token`. Sandbox-friendly. */ has(token) {
|
|
321
|
-
return this.exporterIndex.has(token);
|
|
322
|
-
}
|
|
323
|
-
/** True if the specified module's bucket has a registration for `token`. */ hasInScope(token, moduleId) {
|
|
324
|
-
return this.providers.get(moduleId)?.has(token) ?? false;
|
|
325
|
-
}
|
|
326
|
-
/** Module buckets that hold a registration for `token` (registration order). */ getOwnerModuleIds(token) {
|
|
327
|
-
return [
|
|
328
|
-
...this.exporterIndex.get(token) ?? []
|
|
329
|
-
];
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Force-replace a provider across module scopes — the supported form of the
|
|
333
|
-
* override loop test harnesses need (module-scoped resolution consults the
|
|
334
|
-
* module's own bucket first, so a root-only override would never win there).
|
|
335
|
-
*
|
|
336
|
-
* - `'all-existing'` (default): every non-root bucket that already holds the
|
|
337
|
-
* token, plus `__root__` (so framework-internal lookups see it too).
|
|
338
|
-
* - `'root'`: only the `__root__` bucket.
|
|
339
|
-
* - `string[]`: exactly these bucket ids.
|
|
340
|
-
*/ replaceProvider(provider, options = {}) {
|
|
341
|
-
const buckets = options.buckets ?? 'all-existing';
|
|
342
|
-
if (buckets === 'root') {
|
|
343
|
-
return this.register(provider);
|
|
344
|
-
}
|
|
345
|
-
if (Array.isArray(buckets)) {
|
|
346
|
-
for (const moduleId of buckets)this.register(provider, moduleId);
|
|
347
|
-
return this;
|
|
348
|
-
}
|
|
349
|
-
const token = typeof provider === 'function' ? provider : provider.provide;
|
|
350
|
-
if (!token) {
|
|
351
|
-
throw new Error('replaceProvider requires a token (`provide`)');
|
|
352
|
-
}
|
|
353
|
-
for (const [moduleId, bucket] of this.providers){
|
|
354
|
-
if (moduleId === ROOT_MODULE_ID) continue;
|
|
355
|
-
if (bucket.has(token)) this.register(provider, moduleId);
|
|
356
|
-
}
|
|
357
|
-
return this.register(provider);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* True when the token belongs exclusively to lazy modules that have not
|
|
361
|
-
* been materialized yet — resolving it would trigger materialization.
|
|
362
|
-
* Build-time probes (route-manager middleware priority, entrypoint
|
|
363
|
-
* snapshots) use this to defer instead of forcing the group.
|
|
364
|
-
*/ isLazyPending(token) {
|
|
365
|
-
const hook = this.root.lazyHook;
|
|
366
|
-
if (!hook) return false;
|
|
367
|
-
const owners = this.exporterIndex.get(token);
|
|
368
|
-
if (!owners || owners.size === 0) return false;
|
|
369
|
-
for (const owner of owners){
|
|
370
|
-
if (!hook.isPending(owner)) return false;
|
|
371
|
-
}
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* True when any registration of the token holds a constructed instance.
|
|
376
|
-
* Diagnostic helper (cold-start tests): checks WITHOUT resolving, so it
|
|
377
|
-
* never triggers lazy materialization.
|
|
378
|
-
*/ isInstantiated(token) {
|
|
379
|
-
for (const owner of this.exporterIndex.get(token) ?? []){
|
|
380
|
-
const reg = this.providers.get(owner)?.get(token);
|
|
381
|
-
if (reg && reg.instance !== undefined) return true;
|
|
382
|
-
}
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
getProviderScope(token) {
|
|
386
|
-
const exporters = this.exporterIndex.get(token);
|
|
387
|
-
if (!exporters) return undefined;
|
|
388
|
-
for (const owner of exporters){
|
|
389
|
-
const reg = this.providers.get(owner)?.get(token);
|
|
390
|
-
if (reg) return reg.effectiveScope ?? reg.scope;
|
|
391
|
-
}
|
|
392
|
-
return undefined;
|
|
393
|
-
}
|
|
394
|
-
getTokens() {
|
|
395
|
-
const out = new Set();
|
|
396
|
-
for (const bucket of this.providers.values()){
|
|
397
|
-
for (const token of bucket.keys())out.add(token);
|
|
398
|
-
}
|
|
399
|
-
return [
|
|
400
|
-
...out
|
|
401
|
-
];
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Every statically-provided (useValue) instance across ALL module buckets.
|
|
405
|
-
* Unlike resolving a token (which yields only the first bucket's registration),
|
|
406
|
-
* this surfaces per-instance values — e.g. one BindingRef per multi-instance
|
|
407
|
-
* binding module — so framework adapters can initialize all of them.
|
|
408
|
-
*/ getUseValues() {
|
|
409
|
-
const out = [];
|
|
410
|
-
for (const bucket of this.providers.values()){
|
|
411
|
-
for (const reg of bucket.values()){
|
|
412
|
-
if (reg.useValue !== undefined) out.push(reg.useValue);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
return out;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Serializable description of every loaded module instance (load order),
|
|
419
|
-
* plus the `__root__` bucket (bootstrap primitives) when non-empty —
|
|
420
|
-
* the `vela module graph` seam. Reads registration state only: safe pre-
|
|
421
|
-
* and post-bootstrap, never constructs, never claims lazy modules.
|
|
422
|
-
*/ getModuleDescriptions() {
|
|
423
|
-
const out = [];
|
|
424
|
-
for (const scope of this.scopes.values()){
|
|
425
|
-
out.push({
|
|
426
|
-
moduleId: scope.moduleId,
|
|
427
|
-
imports: [
|
|
428
|
-
...scope.importedModules
|
|
429
|
-
],
|
|
430
|
-
isGlobal: scope.isGlobal,
|
|
431
|
-
lazy: scope.lazy === true,
|
|
432
|
-
providers: [
|
|
433
|
-
...this.providers.get(scope.moduleId)?.keys() ?? []
|
|
434
|
-
].map(describeToken),
|
|
435
|
-
exports: [
|
|
436
|
-
...scope.exportedTokens
|
|
437
|
-
].map(describeToken)
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
const rootBucket = this.providers.get(ROOT_MODULE_ID);
|
|
441
|
-
if (rootBucket && rootBucket.size > 0) {
|
|
442
|
-
out.push({
|
|
443
|
-
moduleId: ROOT_MODULE_ID,
|
|
444
|
-
imports: [],
|
|
445
|
-
isGlobal: false,
|
|
446
|
-
lazy: false,
|
|
447
|
-
providers: [
|
|
448
|
-
...rootBucket.keys()
|
|
449
|
-
].map(describeToken),
|
|
450
|
-
exports: []
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return out;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Compute request-scope bubbling for every registration (call once at
|
|
457
|
-
* bootstrap, after all providers are registered). A provider whose declared
|
|
458
|
-
* scope is not REQUEST but which (transitively) depends on a request-scoped
|
|
459
|
-
* provider is marked `effectiveScope = REQUEST`, so it is rebuilt per request
|
|
460
|
-
* instead of capturing the first request's instance — matching NestJS.
|
|
461
|
-
*/ computeEffectiveScopes() {
|
|
462
|
-
// Reverse-propagation worklist: seed with every declared-REQUEST provider,
|
|
463
|
-
// then flood "request-ness" to consumers transitively. This is order- and
|
|
464
|
-
// cycle-independent (a node flips to REQUEST at most once), avoiding the
|
|
465
|
-
// finalize-during-in-progress-cycle hazard of a recursive DFS.
|
|
466
|
-
const regs = [];
|
|
467
|
-
for (const bucket of this.providers.values()){
|
|
468
|
-
for (const reg of bucket.values()){
|
|
469
|
-
reg.effectiveScope = reg.scope;
|
|
470
|
-
regs.push(reg);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
// Build reverse edges: dependency registration -> registrations that consume it.
|
|
474
|
-
const consumers = new Map();
|
|
475
|
-
for (const reg of regs){
|
|
476
|
-
for (const depToken of this.dependencyTokensOf(reg)){
|
|
477
|
-
const depReg = this.tryFindRegistration(depToken, reg.declaringModuleId);
|
|
478
|
-
if (!depReg) continue;
|
|
479
|
-
const list = consumers.get(depReg);
|
|
480
|
-
if (list) list.push(reg);
|
|
481
|
-
else consumers.set(depReg, [
|
|
482
|
-
reg
|
|
483
|
-
]);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
const queue = regs.filter((r)=>r.effectiveScope === Scope.REQUEST);
|
|
487
|
-
while(queue.length > 0){
|
|
488
|
-
const dep = queue.pop();
|
|
489
|
-
for (const consumer of consumers.get(dep) ?? []){
|
|
490
|
-
if (consumer.effectiveScope !== Scope.REQUEST) {
|
|
491
|
-
consumer.effectiveScope = Scope.REQUEST;
|
|
492
|
-
queue.push(consumer);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
/** The dependency tokens a registration would resolve when constructed. */ dependencyTokensOf(reg) {
|
|
498
|
-
if (reg.useExisting) return [
|
|
499
|
-
reg.useExisting
|
|
500
|
-
];
|
|
501
|
-
if (reg.useFactory) {
|
|
502
|
-
return (reg.inject ?? []).map((t)=>t instanceof ForwardRef ? t.factory() : t);
|
|
503
|
-
}
|
|
504
|
-
const cls = reg.useClass ?? (typeof reg.provide === 'function' ? reg.provide : undefined);
|
|
505
|
-
if (!cls) return [];
|
|
506
|
-
const paramTypes = getConstructorDependencies(cls);
|
|
507
|
-
const injectMetadata = getInjectMetadata(cls);
|
|
508
|
-
const injectMap = new Map(injectMetadata.map((m)=>[
|
|
509
|
-
m.index,
|
|
510
|
-
m
|
|
511
|
-
]));
|
|
512
|
-
const arity = Math.max(paramTypes.length, injectMetadata.reduce((max, m)=>Math.max(max, m.index + 1), 0));
|
|
513
|
-
const tokens = [];
|
|
514
|
-
for(let i = 0; i < arity; i++){
|
|
515
|
-
const raw = injectMap.get(i)?.token;
|
|
516
|
-
const token = raw instanceof ForwardRef ? raw.factory() : raw ?? paramTypes[i];
|
|
517
|
-
if (token && !isErasedTypeToken(token)) tokens.push(token);
|
|
518
|
-
}
|
|
519
|
-
return tokens;
|
|
520
|
-
}
|
|
521
|
-
tryFindRegistration(token, requestingModuleId) {
|
|
522
|
-
try {
|
|
523
|
-
return this.findRegistration(token, requestingModuleId);
|
|
524
|
-
} catch {
|
|
525
|
-
// Ambiguous (MultipleProvidersFoundError) or unreachable — treat as
|
|
526
|
-
// unknown for scope computation; real resolution will surface any error.
|
|
527
|
-
return undefined;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* Create a child container for request-scoped resolution.
|
|
532
|
-
* The child shares the parent's providers but caches REQUEST-scoped
|
|
533
|
-
* instances separately per child (per request).
|
|
534
|
-
*/ createChild() {
|
|
535
|
-
const child = new Container({
|
|
536
|
-
diagnostics: this.diagnostics
|
|
537
|
-
});
|
|
538
|
-
// Share state by reference — request-scope children must see the same
|
|
539
|
-
// module graph as the root.
|
|
540
|
-
child.providers = this.providers;
|
|
541
|
-
child.exporterIndex = this.exporterIndex;
|
|
542
|
-
child.scopes = this.scopes;
|
|
543
|
-
child.globals = this.globals;
|
|
544
|
-
// SINGLETON disposal is owned by the root; the child keeps only its own
|
|
545
|
-
// REQUEST-scoped disposables (cleared when the request ends).
|
|
546
|
-
child.root = this.root;
|
|
547
|
-
return child;
|
|
548
|
-
}
|
|
549
|
-
createDetached() {
|
|
550
|
-
const child = new Container({
|
|
551
|
-
diagnostics: this.diagnostics
|
|
552
|
-
});
|
|
553
|
-
// Deep-clone provider buckets so sandbox writes don't leak back to the
|
|
554
|
-
// parent. Inner ProviderRegistration objects are shallow-shared (we only
|
|
555
|
-
// mutate `instance` cache, and per-bucket clones already give per-sandbox
|
|
556
|
-
// singleton isolation when needed).
|
|
557
|
-
const clonedProviders = new Map();
|
|
558
|
-
for (const [moduleId, bucket] of this.providers){
|
|
559
|
-
clonedProviders.set(moduleId, new Map(bucket));
|
|
560
|
-
}
|
|
561
|
-
child.providers = clonedProviders;
|
|
562
|
-
const clonedIndex = new Map();
|
|
563
|
-
for (const [token, owners] of this.exporterIndex){
|
|
564
|
-
clonedIndex.set(token, new Set(owners));
|
|
565
|
-
}
|
|
566
|
-
child.exporterIndex = clonedIndex;
|
|
567
|
-
child.scopes = this.scopes;
|
|
568
|
-
child.globals = this.globals;
|
|
569
|
-
// Registration objects are shallow-shared, so a sandbox resolve of a lazy
|
|
570
|
-
// module's singleton caches onto the SHARED registration. Point the
|
|
571
|
-
// sandbox at the real root so that resolution claims the module and
|
|
572
|
-
// replays its hooks like any other trigger — otherwise ModuleRef.create
|
|
573
|
-
// would leave a hook-less instance poisoning the shared cache (and its
|
|
574
|
-
// disposables tracked on an ephemeral root).
|
|
575
|
-
child.root = this.root;
|
|
576
|
-
return child;
|
|
577
|
-
}
|
|
578
|
-
clear() {
|
|
579
|
-
this.providers.clear();
|
|
580
|
-
this.exporterIndex.clear();
|
|
581
|
-
this.resolutionStack.clear();
|
|
582
|
-
this.requestInstances.clear();
|
|
583
|
-
this.scopes.clear();
|
|
584
|
-
this.globals.clear();
|
|
585
|
-
this.disposables = [];
|
|
586
|
-
}
|
|
587
|
-
/** Whether this container has any tracked disposables (cheap request-path check). */ hasDisposables() {
|
|
588
|
-
return this.disposables.length > 0;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* Dispose container-constructed instances (Symbol.asyncDispose /
|
|
592
|
-
* Symbol.dispose / .dispose()) in reverse creation order (LIFO). Errors are
|
|
593
|
-
* logged and skipped so one bad teardown never blocks the rest.
|
|
594
|
-
*
|
|
595
|
-
* A REQUEST child disposes only its own request-scoped instances; the root
|
|
596
|
-
* disposes shared SINGLETONs and clears their cached instance so a dev HMR
|
|
597
|
-
* generation cannot leak a stale graph. Shared provider maps are left intact
|
|
598
|
-
* for a request child (they belong to the root).
|
|
599
|
-
*/ async dispose() {
|
|
600
|
-
const pending = this.disposables;
|
|
601
|
-
this.disposables = [];
|
|
602
|
-
for(let i = pending.length - 1; i >= 0; i--){
|
|
603
|
-
try {
|
|
604
|
-
await disposeInstance(pending[i]);
|
|
605
|
-
} catch (error) {
|
|
606
|
-
if (this.diagnostics !== 'silent') {
|
|
607
|
-
console.error('Error disposing instance:', error);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
this.requestInstances.clear();
|
|
612
|
-
if (this.root === this) {
|
|
613
|
-
// Drop cached singleton instances (except useValue, which the app owns)
|
|
614
|
-
// so a rebuilt graph starts clean.
|
|
615
|
-
for (const bucket of this.providers.values()){
|
|
616
|
-
for (const registration of bucket.values()){
|
|
617
|
-
if (registration.scope === Scope.SINGLETON && registration.useValue === undefined) {
|
|
618
|
-
registration.instance = undefined;
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
resolveRegistration(registration, requestingModuleId) {
|
|
625
|
-
if (registration.useValue !== undefined) {
|
|
626
|
-
// Deliberately BEFORE the lazy claim: reading a lazy module's useValue
|
|
627
|
-
// (options tokens) has no construction cost to defer and must not
|
|
628
|
-
// materialize the group.
|
|
629
|
-
return registration.useValue;
|
|
630
|
-
}
|
|
631
|
-
this.claimLazyModule(registration.declaringModuleId);
|
|
632
|
-
if (registration.useExisting) {
|
|
633
|
-
// Pass through the original requester to catch alias leaks
|
|
634
|
-
return this.resolve(registration.useExisting, requestingModuleId);
|
|
635
|
-
}
|
|
636
|
-
// Effective scope accounts for request-scope bubbling: a SINGLETON that
|
|
637
|
-
// (transitively) depends on a request-scoped provider is treated as REQUEST
|
|
638
|
-
// so it is rebuilt per request instead of capturing the first one.
|
|
639
|
-
const scope = registration.effectiveScope ?? registration.scope;
|
|
640
|
-
// Singleton: return cached from registration (shared across all containers)
|
|
641
|
-
if (scope === Scope.SINGLETON && registration.instance !== undefined) {
|
|
642
|
-
return registration.instance;
|
|
643
|
-
}
|
|
644
|
-
// Request: return cached from this child's requestInstances
|
|
645
|
-
if (scope === Scope.REQUEST) {
|
|
646
|
-
const cached = this.requestInstances.get(registration.provide);
|
|
647
|
-
if (cached !== undefined) {
|
|
648
|
-
return cached;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (this.resolutionStack.has(registration.provide)) {
|
|
652
|
-
const chain = [
|
|
653
|
-
...this.resolutionStack,
|
|
654
|
-
registration.provide
|
|
655
|
-
].map((t)=>this.tokenToString(t)).join(' -> ');
|
|
656
|
-
throw new Error(`Circular dependency detected: ${chain}`);
|
|
657
|
-
}
|
|
658
|
-
this.resolutionStack.add(registration.provide);
|
|
659
|
-
try {
|
|
660
|
-
let instance;
|
|
661
|
-
if (registration.useFactory) {
|
|
662
|
-
// Factory inject deps resolve from the declaring module's scope first
|
|
663
|
-
// (visibility-correct for forRootAsync), with the legacy no-requester
|
|
664
|
-
// lookup kept as fallback — see resolveFactoryDependency.
|
|
665
|
-
instance = this.resolveFactory(registration);
|
|
666
|
-
} else if (registration.useClass) {
|
|
667
|
-
instance = this.resolveClass(registration.useClass, registration.declaringModuleId);
|
|
668
|
-
} else {
|
|
669
|
-
throw new Error(`Invalid provider registration for: ${this.tokenToString(registration.provide)}`);
|
|
670
|
-
}
|
|
671
|
-
if (scope === Scope.SINGLETON) {
|
|
672
|
-
registration.instance = instance;
|
|
673
|
-
// Track for disposal on the ROOT — a singleton outlives the request
|
|
674
|
-
// child that may have first constructed it.
|
|
675
|
-
if (isDisposable(instance)) this.root.disposables.push(instance);
|
|
676
|
-
} else if (scope === Scope.REQUEST) {
|
|
677
|
-
this.requestInstances.set(registration.provide, instance);
|
|
678
|
-
if (isDisposable(instance)) this.disposables.push(instance);
|
|
679
|
-
}
|
|
680
|
-
return instance;
|
|
681
|
-
} finally{
|
|
682
|
-
this.resolutionStack.delete(registration.provide);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
resolveClass(target, ownerModuleId) {
|
|
686
|
-
const paramTypes = getConstructorDependencies(target);
|
|
687
|
-
const injectMetadata = getInjectMetadata(target);
|
|
688
|
-
const injectMap = new Map(injectMetadata.map((m)=>[
|
|
689
|
-
m.index,
|
|
690
|
-
m
|
|
691
|
-
]));
|
|
692
|
-
// Constructor arity. Normally `design:paramtypes` (emitDecoratorMetadata)
|
|
693
|
-
// gives the count, but some bundlers — notably esbuild (and therefore
|
|
694
|
-
// Wrangler) — do not emit it, leaving `paramTypes` empty even when
|
|
695
|
-
// `@Inject(token)` recorded explicit tokens. Fall back to the highest
|
|
696
|
-
// `@Inject` index so explicit-token constructors still resolve without
|
|
697
|
-
// emitted metadata. Slots with neither a param type nor an `@Inject` token
|
|
698
|
-
// still hit the unresolved-dependency error below.
|
|
699
|
-
const arity = Math.max(paramTypes.length, injectMetadata.reduce((max, m)=>Math.max(max, m.index + 1), 0));
|
|
700
|
-
const dependencies = Array.from({
|
|
701
|
-
length: arity
|
|
702
|
-
}, (_unused, index)=>{
|
|
703
|
-
const paramType = paramTypes[index];
|
|
704
|
-
const meta = injectMap.get(index);
|
|
705
|
-
const rawToken = meta?.token;
|
|
706
|
-
const isForwardRef = rawToken instanceof ForwardRef;
|
|
707
|
-
const token = isForwardRef ? rawToken.factory() : rawToken ?? paramType;
|
|
708
|
-
if (!token || isErasedTypeToken(token)) {
|
|
709
|
-
if (meta?.optional) return undefined;
|
|
710
|
-
throw new Error(`Cannot resolve dependency at index ${index} for ${target.name}. ` + `Parameter type is undefined or Object. ` + IMPORT_TYPE_HINT + ` Alternatively, use \`@Inject()\` to specify the token explicitly.`);
|
|
711
|
-
}
|
|
712
|
-
if (meta?.optional && !this.has(token)) {
|
|
713
|
-
return undefined;
|
|
714
|
-
}
|
|
715
|
-
// forwardRef with circular dep — break the cycle with a lazy Proxy
|
|
716
|
-
if (isForwardRef && this.resolutionStack.has(token)) {
|
|
717
|
-
return this.createLazyProxy(token, ownerModuleId);
|
|
718
|
-
}
|
|
719
|
-
return this.resolve(token, ownerModuleId);
|
|
720
|
-
});
|
|
721
|
-
return new target(...dependencies);
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* Resolve one factory `inject` dependency. Since 1.11 the declaring module's
|
|
725
|
-
* scope is consulted FIRST (proper visibility semantics — a `forRootAsync`
|
|
726
|
-
* factory can inject providers reachable through its module's imports); on
|
|
727
|
-
* any failure the legacy no-requester lookup (root bucket, then first
|
|
728
|
-
* exporter) is kept as fallback, so every previously-resolving graph still
|
|
729
|
-
* resolves.
|
|
730
|
-
*/ resolveFactoryDependency(token, declaringModuleId) {
|
|
731
|
-
if (declaringModuleId !== ROOT_MODULE_ID && this.scopes.has(declaringModuleId)) {
|
|
732
|
-
try {
|
|
733
|
-
return this.resolve(token, declaringModuleId);
|
|
734
|
-
} catch {
|
|
735
|
-
// Fall through to the legacy escape hatch below.
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
return this.resolve(token);
|
|
739
|
-
}
|
|
740
|
-
async resolveFactoryDependencyAsync(token, declaringModuleId) {
|
|
741
|
-
if (declaringModuleId !== ROOT_MODULE_ID && this.scopes.has(declaringModuleId)) {
|
|
742
|
-
try {
|
|
743
|
-
return await this.resolveAsync(token, declaringModuleId);
|
|
744
|
-
} catch {
|
|
745
|
-
// Fall through to the legacy escape hatch below.
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
return this.resolveAsync(token);
|
|
749
|
-
}
|
|
750
|
-
resolveFactory(registration) {
|
|
751
|
-
if (!registration.useFactory) {
|
|
752
|
-
throw new Error('Factory function is missing');
|
|
753
|
-
}
|
|
754
|
-
const dependencies = (registration.inject || []).map((token)=>{
|
|
755
|
-
const resolved = token instanceof ForwardRef ? token.factory() : token;
|
|
756
|
-
return this.resolveFactoryDependency(resolved, registration.declaringModuleId);
|
|
757
|
-
});
|
|
758
|
-
const result = registration.useFactory(...dependencies);
|
|
759
|
-
if (result instanceof Promise) {
|
|
760
|
-
throw new Error(`Async factory for ${this.tokenToString(registration.provide)} returned a Promise. ` + `Use resolveAsync() for async providers.`);
|
|
761
|
-
}
|
|
762
|
-
return result;
|
|
763
|
-
}
|
|
764
|
-
async resolveAsync(token, requestingModuleId) {
|
|
765
|
-
const root = this.root;
|
|
766
|
-
root.asyncDepth++;
|
|
767
|
-
let result;
|
|
768
|
-
try {
|
|
769
|
-
result = await this.resolveAsyncInner(token, requestingModuleId);
|
|
770
|
-
} finally{
|
|
771
|
-
root.asyncDepth--;
|
|
772
|
-
}
|
|
773
|
-
if (root.asyncDepth === 0 && root.lazyHook?.hasClaimed() && !root.lazyHook.isDraining()) {
|
|
774
|
-
await root.lazyHook.drainAsync();
|
|
775
|
-
}
|
|
776
|
-
return result;
|
|
777
|
-
}
|
|
778
|
-
async resolveAsyncInner(token, requestingModuleId) {
|
|
779
|
-
const registration = this.findRegistration(token, requestingModuleId);
|
|
780
|
-
if (!registration) {
|
|
781
|
-
if (requestingModuleId !== undefined && this.scopes.has(requestingModuleId) && this.exporterIndex.has(token)) {
|
|
782
|
-
throw new ModuleVisibilityError(requestingModuleId, token);
|
|
783
|
-
}
|
|
784
|
-
if (typeof token === 'function') {
|
|
785
|
-
throw new Error(`No provider found for token: ${this.tokenToString(token)}. ` + `Declare it in a module's providers.`);
|
|
786
|
-
}
|
|
787
|
-
if (token instanceof InjectionToken && token.options?.factory) {
|
|
788
|
-
this.register({
|
|
789
|
-
provide: token,
|
|
790
|
-
useFactory: token.options.factory
|
|
791
|
-
});
|
|
792
|
-
return this.resolveAsync(token, requestingModuleId);
|
|
793
|
-
}
|
|
794
|
-
throw new Error(`No provider found for token: ${this.tokenToString(token)}`);
|
|
795
|
-
}
|
|
796
|
-
if (registration.useFactory) {
|
|
797
|
-
const scope = registration.effectiveScope ?? registration.scope;
|
|
798
|
-
if (scope === Scope.SINGLETON && registration.instance !== undefined) {
|
|
799
|
-
return registration.instance;
|
|
800
|
-
}
|
|
801
|
-
this.claimLazyModule(registration.declaringModuleId);
|
|
802
|
-
// Module scope first, legacy no-requester fallback — same policy as the
|
|
803
|
-
// sync resolveFactory path.
|
|
804
|
-
const dependencies = await Promise.all((registration.inject || []).map((t)=>{
|
|
805
|
-
const resolved = t instanceof ForwardRef ? t.factory() : t;
|
|
806
|
-
return this.resolveFactoryDependencyAsync(resolved, registration.declaringModuleId);
|
|
807
|
-
}));
|
|
808
|
-
const instance = await registration.useFactory(...dependencies);
|
|
809
|
-
if (scope === Scope.SINGLETON) {
|
|
810
|
-
registration.instance = instance;
|
|
811
|
-
// Track for disposal on the ROOT, matching the sync resolveRegistration path.
|
|
812
|
-
if (isDisposable(instance)) this.root.disposables.push(instance);
|
|
813
|
-
}
|
|
814
|
-
return instance;
|
|
815
|
-
}
|
|
816
|
-
return this.resolve(token, requestingModuleId);
|
|
817
|
-
}
|
|
818
|
-
createLazyProxy(token, requestingModuleId) {
|
|
819
|
-
const container = this;
|
|
820
|
-
const target = Object.create(null);
|
|
821
|
-
return new Proxy(target, {
|
|
822
|
-
get (_target, prop) {
|
|
823
|
-
const instance = container.resolve(token, requestingModuleId);
|
|
824
|
-
// Annotate `unknown` to contain `Reflect.get`'s `any` return so the
|
|
825
|
-
// typeof-narrows-to-Function guard below stays honest.
|
|
826
|
-
const value = Reflect.get(instance, prop, instance);
|
|
827
|
-
return typeof value === 'function' ? value.bind(instance) : value;
|
|
828
|
-
},
|
|
829
|
-
set (_target, prop, value) {
|
|
830
|
-
const instance = container.resolve(token, requestingModuleId);
|
|
831
|
-
// `Reflect.set` returns whether the assignment succeeded — that's the
|
|
832
|
-
// spec-correct Proxy `set` return, vs returning `true` unconditionally.
|
|
833
|
-
return Reflect.set(instance, prop, value);
|
|
834
|
-
}
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
tokenToString(token) {
|
|
838
|
-
if (token instanceof InjectionToken) {
|
|
839
|
-
return token.toString();
|
|
840
|
-
}
|
|
841
|
-
if (typeof token === 'function') {
|
|
842
|
-
return token.name;
|
|
843
|
-
}
|
|
844
|
-
if (typeof token === 'symbol') {
|
|
845
|
-
return token.toString();
|
|
846
|
-
}
|
|
847
|
-
return String(token);
|
|
848
|
-
}
|
|
849
|
-
}
|