@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,484 +0,0 @@
|
|
|
1
|
-
import { Scope } from "../constants.js";
|
|
2
|
-
import { ForwardRef, InjectionToken, ModuleVisibilityError, MultipleProvidersFoundError } from "../container/types.js";
|
|
3
|
-
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_MIDDLEWARE, APP_PIPE } from "../pipeline/tokens.js";
|
|
4
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
5
|
-
import { getOrCreateArray } from "../registry/util.js";
|
|
6
|
-
import { getModuleMetadata, isModule } from "./decorators.js";
|
|
7
|
-
import { LazyModuleManager } from "./lazy-modules.js";
|
|
8
|
-
import { MiddlewareBuilder } from "./middleware.js";
|
|
9
|
-
const APP_TOKENS = new Set([
|
|
10
|
-
APP_GUARD,
|
|
11
|
-
APP_PIPE,
|
|
12
|
-
APP_INTERCEPTOR,
|
|
13
|
-
APP_FILTER,
|
|
14
|
-
APP_MIDDLEWARE
|
|
15
|
-
]);
|
|
16
|
-
const DEFAULT_KEY = "default";
|
|
17
|
-
/**
|
|
18
|
-
* Structural check for `ContributesEntrypoints` on a provider's class —
|
|
19
|
-
* deliberately string-coupled to the interface's method name so the loader
|
|
20
|
-
* does not import from `entrypoint/` (layering).
|
|
21
|
-
*/ function declaresEntrypointContributor(provider) {
|
|
22
|
-
const cls = typeof provider === "function" ? provider : provider.useClass;
|
|
23
|
-
if (typeof cls !== "function") return false;
|
|
24
|
-
const proto = cls.prototype;
|
|
25
|
-
return typeof proto?.collectEntrypoints === "function";
|
|
26
|
-
}
|
|
27
|
-
function isDynamicModule(value) {
|
|
28
|
-
// TS 4.9+ narrows `'module' in value` so `value.module` is typed `unknown`
|
|
29
|
-
// — no cast required for the typeof check below.
|
|
30
|
-
return typeof value === "object" && value !== null && "module" in value && typeof value.module === "function";
|
|
31
|
-
}
|
|
32
|
-
function implementsNestModule(cls) {
|
|
33
|
-
// `Type.prototype` is `any` — direct property access is type-safe enough.
|
|
34
|
-
return typeof cls.prototype?.configure === "function";
|
|
35
|
-
}
|
|
36
|
-
function tokenOfProvider(provider) {
|
|
37
|
-
return typeof provider === "function" ? provider : provider.provide;
|
|
38
|
-
}
|
|
39
|
-
function keyOfImport(entry) {
|
|
40
|
-
return isDynamicModule(entry) ? entry.key ?? DEFAULT_KEY : DEFAULT_KEY;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* `ForwardRef.factory` is typed to return the broader `Token<T>` because the
|
|
44
|
-
* primitive is shared with provider injection. In module-imports position the
|
|
45
|
-
* runtime contract narrows: the factory must yield a module class or a
|
|
46
|
-
* `DynamicModule`. This helper validates the contract AND narrows the type
|
|
47
|
-
* without a structural cast.
|
|
48
|
-
*/ function unwrapModuleForwardRef(ref) {
|
|
49
|
-
const result = ref.factory();
|
|
50
|
-
if (typeof result === 'function') return result;
|
|
51
|
-
if (isDynamicModule(result)) return result;
|
|
52
|
-
throw new Error(`forwardRef in module imports must resolve to a module class or DynamicModule; ` + `got ${typeof result === 'object' ? 'a non-module object' : typeof result}.`);
|
|
53
|
-
}
|
|
54
|
-
export class ModuleLoader {
|
|
55
|
-
container;
|
|
56
|
-
router;
|
|
57
|
-
// class → set of keys already processed (multi-instance dedup is by both)
|
|
58
|
-
processedModules = new Map();
|
|
59
|
-
processingStack = new Set();
|
|
60
|
-
collectedControllers = new Set();
|
|
61
|
-
registeredProviders = [];
|
|
62
|
-
// (class, key) → exported tokens
|
|
63
|
-
moduleExportsCache = new Map();
|
|
64
|
-
globalExports = new Set();
|
|
65
|
-
consumerMiddlewareDefinitions = [];
|
|
66
|
-
appProviderCounter = 0;
|
|
67
|
-
appProviderTokens = new Map([
|
|
68
|
-
[
|
|
69
|
-
APP_GUARD,
|
|
70
|
-
[]
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
APP_PIPE,
|
|
74
|
-
[]
|
|
75
|
-
],
|
|
76
|
-
[
|
|
77
|
-
APP_INTERCEPTOR,
|
|
78
|
-
[]
|
|
79
|
-
],
|
|
80
|
-
[
|
|
81
|
-
APP_FILTER,
|
|
82
|
-
[]
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
APP_MIDDLEWARE,
|
|
86
|
-
[]
|
|
87
|
-
]
|
|
88
|
-
]);
|
|
89
|
-
// (class, key) → composed moduleId (cached for stable identity within a load)
|
|
90
|
-
moduleIdByClassKey = new Map();
|
|
91
|
-
seenModuleIds = new Set();
|
|
92
|
-
// Lazy (deferred-init) module instances: moduleId → its own tokens in
|
|
93
|
-
// registration order. Consumed by LazyModuleManager via getLazyGroups().
|
|
94
|
-
lazyModuleIds = new Set();
|
|
95
|
-
lazyGroups = new Map();
|
|
96
|
-
constructor(container, router){
|
|
97
|
-
this.container = container;
|
|
98
|
-
this.router = router;
|
|
99
|
-
}
|
|
100
|
-
load(rootModule) {
|
|
101
|
-
this.processModule(rootModule);
|
|
102
|
-
for (const controller of this.collectedControllers){
|
|
103
|
-
this.router.registerController(controller);
|
|
104
|
-
}
|
|
105
|
-
// Arm the deferred-init seam HERE — at the end of load(), not in
|
|
106
|
-
// bootstrap() — so every consumer of the loader gets identical lazy
|
|
107
|
-
// semantics, including hand-rolled bootstrap paths that never call
|
|
108
|
-
// bootstrap() (@velajs/testing's TestingModuleBuilder.compile builds its
|
|
109
|
-
// own container). Still after all module-load-time resolutions
|
|
110
|
-
// (NestModule.configure), so load-time resolution never claims a group.
|
|
111
|
-
// Registered as a provider so VelaApplication can drive the phase
|
|
112
|
-
// transitions from any of those paths.
|
|
113
|
-
const lazyManager = new LazyModuleManager(this.container);
|
|
114
|
-
for (const group of this.getLazyGroups()){
|
|
115
|
-
lazyManager.registerGroup(group);
|
|
116
|
-
}
|
|
117
|
-
this.container.setLazyHook(lazyManager);
|
|
118
|
-
this.container.register({
|
|
119
|
-
provide: LazyModuleManager,
|
|
120
|
-
useValue: lazyManager
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
getModuleId(moduleClass, key) {
|
|
124
|
-
let perClass = this.moduleIdByClassKey.get(moduleClass);
|
|
125
|
-
if (perClass) {
|
|
126
|
-
const cached = perClass.get(key);
|
|
127
|
-
if (cached) return cached;
|
|
128
|
-
} else {
|
|
129
|
-
perClass = new Map();
|
|
130
|
-
this.moduleIdByClassKey.set(moduleClass, perClass);
|
|
131
|
-
}
|
|
132
|
-
const baseName = moduleClass.name || "AnonModule";
|
|
133
|
-
let id = `${baseName}#${key}`;
|
|
134
|
-
let counter = 0;
|
|
135
|
-
// Cross-class name collision (rare): two different classes named identically.
|
|
136
|
-
// The (class, key) pair identifies us; bump suffix to keep `id` strings unique
|
|
137
|
-
// in `seenModuleIds` so debug output stays unambiguous.
|
|
138
|
-
while(this.seenModuleIds.has(id)){
|
|
139
|
-
id = `${baseName}#${key}~${++counter}`;
|
|
140
|
-
}
|
|
141
|
-
this.seenModuleIds.add(id);
|
|
142
|
-
perClass.set(key, id);
|
|
143
|
-
return id;
|
|
144
|
-
}
|
|
145
|
-
isProcessed(moduleClass, key) {
|
|
146
|
-
return this.processedModules.get(moduleClass)?.has(key) ?? false;
|
|
147
|
-
}
|
|
148
|
-
markProcessed(moduleClass, key) {
|
|
149
|
-
let keys = this.processedModules.get(moduleClass);
|
|
150
|
-
if (!keys) {
|
|
151
|
-
keys = new Set();
|
|
152
|
-
this.processedModules.set(moduleClass, keys);
|
|
153
|
-
}
|
|
154
|
-
keys.add(key);
|
|
155
|
-
}
|
|
156
|
-
getCachedExports(moduleClass, key) {
|
|
157
|
-
return this.moduleExportsCache.get(moduleClass)?.get(key);
|
|
158
|
-
}
|
|
159
|
-
cacheExports(moduleClass, key, exports) {
|
|
160
|
-
let perClass = this.moduleExportsCache.get(moduleClass);
|
|
161
|
-
if (!perClass) {
|
|
162
|
-
perClass = new Map();
|
|
163
|
-
this.moduleExportsCache.set(moduleClass, perClass);
|
|
164
|
-
}
|
|
165
|
-
perClass.set(key, exports);
|
|
166
|
-
}
|
|
167
|
-
processModule(moduleClassOrDynamic) {
|
|
168
|
-
let moduleClass;
|
|
169
|
-
let extraImports = [];
|
|
170
|
-
let extraControllers = [];
|
|
171
|
-
let extraProviders = [];
|
|
172
|
-
let extraExports = [];
|
|
173
|
-
let key = DEFAULT_KEY;
|
|
174
|
-
if (isDynamicModule(moduleClassOrDynamic)) {
|
|
175
|
-
moduleClass = moduleClassOrDynamic.module;
|
|
176
|
-
extraImports = moduleClassOrDynamic.imports ?? [];
|
|
177
|
-
extraControllers = moduleClassOrDynamic.controllers ?? [];
|
|
178
|
-
extraProviders = moduleClassOrDynamic.providers ?? [];
|
|
179
|
-
extraExports = moduleClassOrDynamic.exports ?? [];
|
|
180
|
-
key = moduleClassOrDynamic.key ?? DEFAULT_KEY;
|
|
181
|
-
} else {
|
|
182
|
-
moduleClass = moduleClassOrDynamic;
|
|
183
|
-
}
|
|
184
|
-
if (this.isProcessed(moduleClass, key)) {
|
|
185
|
-
// Even if already processed, still collect extra controllers from dynamic module
|
|
186
|
-
for (const controller of extraControllers){
|
|
187
|
-
this.collectedControllers.add(controller);
|
|
188
|
-
}
|
|
189
|
-
return this.getCachedExports(moduleClass, key) ?? new Set();
|
|
190
|
-
}
|
|
191
|
-
const stackKey = `${moduleClass.name}#${key}`;
|
|
192
|
-
if (this.processingStack.has(stackKey)) {
|
|
193
|
-
const chain = [
|
|
194
|
-
...this.processingStack,
|
|
195
|
-
stackKey
|
|
196
|
-
].join(" -> ");
|
|
197
|
-
throw new Error(`Circular module dependency detected: ${chain}`);
|
|
198
|
-
}
|
|
199
|
-
if (!isModule(moduleClass)) {
|
|
200
|
-
if (isDynamicModule(moduleClassOrDynamic)) {
|
|
201
|
-
MetadataRegistry.setModuleOptions(moduleClass, {});
|
|
202
|
-
} else {
|
|
203
|
-
throw new Error(`${moduleClass.name} is not a module. Add @Module() decorator to the class.`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
const metadata = getModuleMetadata(moduleClass);
|
|
207
|
-
if (!metadata) {
|
|
208
|
-
throw new Error(`Failed to get module metadata for ${moduleClass.name}`);
|
|
209
|
-
}
|
|
210
|
-
this.processingStack.add(stackKey);
|
|
211
|
-
const moduleId = this.getModuleId(moduleClass, key);
|
|
212
|
-
try {
|
|
213
|
-
const importedProviders = new Set(this.globalExports);
|
|
214
|
-
// Determine importedModuleIds eagerly (before recursing) so child
|
|
215
|
-
// modules can be referenced in our scope's importedModules set.
|
|
216
|
-
const importedModuleIds = new Set();
|
|
217
|
-
// Track per-class keys seen in this imports array — emit a loader-time
|
|
218
|
-
// diagnostic when the same module class appears under both `"default"`
|
|
219
|
-
// and at least one explicit key (almost always user error).
|
|
220
|
-
const keysByClassInImports = new Map();
|
|
221
|
-
const allImports = [
|
|
222
|
-
...metadata.imports,
|
|
223
|
-
...extraImports
|
|
224
|
-
];
|
|
225
|
-
for (const entry of allImports){
|
|
226
|
-
const importedModule = entry instanceof ForwardRef ? unwrapModuleForwardRef(entry) : entry;
|
|
227
|
-
const importedModuleClass = isDynamicModule(importedModule) ? importedModule.module : importedModule;
|
|
228
|
-
const importedKey = keyOfImport(importedModule);
|
|
229
|
-
let keys = keysByClassInImports.get(importedModuleClass);
|
|
230
|
-
if (!keys) {
|
|
231
|
-
keys = new Set();
|
|
232
|
-
keysByClassInImports.set(importedModuleClass, keys);
|
|
233
|
-
}
|
|
234
|
-
keys.add(importedKey);
|
|
235
|
-
const importedId = this.getModuleId(importedModuleClass, importedKey);
|
|
236
|
-
importedModuleIds.add(importedId);
|
|
237
|
-
const importedStackKey = `${importedModuleClass.name}#${importedKey}`;
|
|
238
|
-
if (entry instanceof ForwardRef && this.processingStack.has(importedStackKey)) {
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
const exportedTokens = this.processModule(importedModule);
|
|
242
|
-
for (const token of exportedTokens){
|
|
243
|
-
importedProviders.add(token);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
this.warnOnMixedDefaultAndKeyed(moduleClass.name, keysByClassInImports);
|
|
247
|
-
const allProviders = [
|
|
248
|
-
...metadata.providers,
|
|
249
|
-
...extraProviders
|
|
250
|
-
];
|
|
251
|
-
const allControllers = [
|
|
252
|
-
...metadata.controllers,
|
|
253
|
-
...extraControllers
|
|
254
|
-
];
|
|
255
|
-
const allExports = [
|
|
256
|
-
...metadata.exports,
|
|
257
|
-
...extraExports
|
|
258
|
-
];
|
|
259
|
-
// Build the ModuleScope BEFORE registering providers so the visibility
|
|
260
|
-
// check sees the local-provider set as we register.
|
|
261
|
-
const localProviders = new Set();
|
|
262
|
-
for (const provider of allProviders){
|
|
263
|
-
const tk = tokenOfProvider(provider);
|
|
264
|
-
if (tk !== undefined) localProviders.add(tk);
|
|
265
|
-
}
|
|
266
|
-
for (const controller of allControllers){
|
|
267
|
-
localProviders.add(controller);
|
|
268
|
-
}
|
|
269
|
-
// The module class itself can be DI-resolved (NestModule.configure path);
|
|
270
|
-
// include it in its own scope.
|
|
271
|
-
localProviders.add(moduleClass);
|
|
272
|
-
const isGlobal = metadata.isGlobal || isDynamicModule(moduleClassOrDynamic) && moduleClassOrDynamic.global === true;
|
|
273
|
-
const isLazy = metadata.lazy || isDynamicModule(moduleClassOrDynamic) && moduleClassOrDynamic.lazy === true;
|
|
274
|
-
this.container.registerScope({
|
|
275
|
-
moduleId,
|
|
276
|
-
localProviders,
|
|
277
|
-
importedModules: importedModuleIds,
|
|
278
|
-
exportedTokens: new Set(allExports),
|
|
279
|
-
isGlobal,
|
|
280
|
-
lazy: isLazy
|
|
281
|
-
});
|
|
282
|
-
const lazyTokens = [];
|
|
283
|
-
let hasEntrypointContributor = false;
|
|
284
|
-
for (const provider of allProviders){
|
|
285
|
-
const registered = this.registerProvider(provider, moduleId);
|
|
286
|
-
if (isLazy && registered !== undefined) {
|
|
287
|
-
lazyTokens.push(registered);
|
|
288
|
-
hasEntrypointContributor ||= declaresEntrypointContributor(provider);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
for (const controller of allControllers){
|
|
292
|
-
// Register the controller in its owning module's bucket so its
|
|
293
|
-
// dependencies resolve from the module's POV (vs `__root__`'s).
|
|
294
|
-
this.container.register(controller, moduleId);
|
|
295
|
-
this.collectedControllers.add(controller);
|
|
296
|
-
if (isLazy) lazyTokens.push(controller);
|
|
297
|
-
}
|
|
298
|
-
if (isLazy) {
|
|
299
|
-
this.lazyModuleIds.add(moduleId);
|
|
300
|
-
this.lazyGroups.set(moduleId, {
|
|
301
|
-
moduleId,
|
|
302
|
-
tokens: lazyTokens,
|
|
303
|
-
hasEntrypointContributor
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
// Propagate module-level Use* decorators (@UseGuards, @UseInterceptors, etc.) to each controller
|
|
307
|
-
for (const controller of allControllers){
|
|
308
|
-
MetadataRegistry.propagateControllerComponents(moduleClass, controller);
|
|
309
|
-
}
|
|
310
|
-
this.markProcessed(moduleClass, key);
|
|
311
|
-
const exports = this.buildExportSet(allExports, allProviders, importedProviders);
|
|
312
|
-
this.cacheExports(moduleClass, key, exports);
|
|
313
|
-
if (isGlobal) {
|
|
314
|
-
for (const token of exports){
|
|
315
|
-
this.globalExports.add(token);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
// Call configure() if the module implements NestModule. The module is
|
|
319
|
-
// resolved through the container so it can have its own DI dependencies.
|
|
320
|
-
if (implementsNestModule(moduleClass)) {
|
|
321
|
-
if (!this.container.hasInScope(moduleClass, moduleId)) {
|
|
322
|
-
this.container.register(moduleClass, moduleId);
|
|
323
|
-
}
|
|
324
|
-
const instance = this.container.resolve(moduleClass, moduleId);
|
|
325
|
-
const builder = new MiddlewareBuilder();
|
|
326
|
-
instance.configure(builder);
|
|
327
|
-
this.consumerMiddlewareDefinitions.push(...builder.getDefinitions());
|
|
328
|
-
}
|
|
329
|
-
return exports;
|
|
330
|
-
} finally{
|
|
331
|
-
this.processingStack.delete(stackKey);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
warnOnMixedDefaultAndKeyed(parentName, keysByClass) {
|
|
335
|
-
const mode = this.container.getDiagnostics();
|
|
336
|
-
if (mode === "silent") return;
|
|
337
|
-
for (const [cls, keys] of keysByClass){
|
|
338
|
-
if (keys.size < 2) continue;
|
|
339
|
-
if (!keys.has(DEFAULT_KEY)) continue;
|
|
340
|
-
const message = `[vela] ${cls.name} imported in both bare and keyed form in '${parentName}'. ` + `These resolve to distinct module instances; consumers asking for an exported ` + `token will hit MultipleProvidersFoundError. Use one form consistently.`;
|
|
341
|
-
if (mode === "throw") throw new Error(message);
|
|
342
|
-
console.warn(message);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
/** Registers the provider and returns the token it was registered under. */ registerProvider(provider, moduleId) {
|
|
346
|
-
if (typeof provider === "function") {
|
|
347
|
-
// Per-module bucket: the same class can be registered in multiple
|
|
348
|
-
// modules' buckets simultaneously without collision.
|
|
349
|
-
this.container.register(provider, moduleId);
|
|
350
|
-
this.registeredProviders.push(provider);
|
|
351
|
-
return provider;
|
|
352
|
-
}
|
|
353
|
-
const token = provider.provide;
|
|
354
|
-
if (!token) {
|
|
355
|
-
this.container.register(provider, moduleId);
|
|
356
|
-
return undefined;
|
|
357
|
-
}
|
|
358
|
-
if (this.isAppToken(token)) {
|
|
359
|
-
// Multiple APP_* providers within the same module bucket need
|
|
360
|
-
// distinct tokens so they don't overwrite each other in the bucket
|
|
361
|
-
// Map. Across buckets, `container.resolveAll(APP_GUARD)` walks
|
|
362
|
-
// every bucket — no need to mark synthetic tokens global.
|
|
363
|
-
const syntheticToken = new InjectionToken(`${token.toString()}:${this.appProviderCounter++}`);
|
|
364
|
-
this.container.register({
|
|
365
|
-
...provider,
|
|
366
|
-
provide: syntheticToken
|
|
367
|
-
}, moduleId);
|
|
368
|
-
this.registeredProviders.push(syntheticToken);
|
|
369
|
-
getOrCreateArray(this.appProviderTokens, token).push(syntheticToken);
|
|
370
|
-
return syntheticToken;
|
|
371
|
-
}
|
|
372
|
-
this.container.register(provider, moduleId);
|
|
373
|
-
this.registeredProviders.push(token);
|
|
374
|
-
return token;
|
|
375
|
-
}
|
|
376
|
-
isAppToken(token) {
|
|
377
|
-
return APP_TOKENS.has(token);
|
|
378
|
-
}
|
|
379
|
-
buildExportSet(exports, providers, importedProviders) {
|
|
380
|
-
const exportSet = new Set();
|
|
381
|
-
const providerTokens = new Set();
|
|
382
|
-
for (const p of providers){
|
|
383
|
-
const token = tokenOfProvider(p);
|
|
384
|
-
if (token !== undefined) providerTokens.add(token);
|
|
385
|
-
}
|
|
386
|
-
for (const exported of exports){
|
|
387
|
-
const isLocalProvider = providerTokens.has(exported);
|
|
388
|
-
const isImportedProvider = importedProviders.has(exported);
|
|
389
|
-
if (!isLocalProvider && !isImportedProvider) {
|
|
390
|
-
const name = typeof exported === 'function' ? exported.name : String(exported);
|
|
391
|
-
console.warn(`Warning: Exporting '${name}' which is neither a local provider nor imported from another module.`);
|
|
392
|
-
}
|
|
393
|
-
exportSet.add(exported);
|
|
394
|
-
}
|
|
395
|
-
return exportSet;
|
|
396
|
-
}
|
|
397
|
-
getControllers() {
|
|
398
|
-
return [
|
|
399
|
-
...this.collectedControllers
|
|
400
|
-
];
|
|
401
|
-
}
|
|
402
|
-
getRegisteredProviders() {
|
|
403
|
-
return [
|
|
404
|
-
...this.registeredProviders
|
|
405
|
-
];
|
|
406
|
-
}
|
|
407
|
-
getAppProviderTokens(token) {
|
|
408
|
-
return [
|
|
409
|
-
...this.appProviderTokens.get(token) ?? []
|
|
410
|
-
];
|
|
411
|
-
}
|
|
412
|
-
getConsumerMiddlewareDefinitions() {
|
|
413
|
-
return [
|
|
414
|
-
...this.consumerMiddlewareDefinitions
|
|
415
|
-
];
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Every lazy module instance recorded during load. Handed to the
|
|
419
|
-
* LazyModuleManager at bootstrap; empty when no module opted in.
|
|
420
|
-
*/ getLazyGroups() {
|
|
421
|
-
return [
|
|
422
|
-
...this.lazyGroups.values()
|
|
423
|
-
];
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* A token is deferred iff EVERY module bucket holding it belongs to a lazy
|
|
427
|
-
* module instance — a token also registered by a non-lazy module stays on
|
|
428
|
-
* the eager pass (and resolving it there claims the lazy sibling, which is
|
|
429
|
-
* the "any use = init" semantic, not a bug).
|
|
430
|
-
*/ isLazyOnlyToken(token) {
|
|
431
|
-
if (this.lazyModuleIds.size === 0) return false;
|
|
432
|
-
const owners = this.container.getOwnerModuleIds(token);
|
|
433
|
-
if (owners.length === 0) return false;
|
|
434
|
-
return owners.every((id)=>this.lazyModuleIds.has(id));
|
|
435
|
-
}
|
|
436
|
-
async resolveAllInstances() {
|
|
437
|
-
const instanceSet = new Set();
|
|
438
|
-
for (const token of this.registeredProviders){
|
|
439
|
-
try {
|
|
440
|
-
if (this.container.getProviderScope(token) === Scope.REQUEST) {
|
|
441
|
-
continue;
|
|
442
|
-
}
|
|
443
|
-
if (this.isLazyOnlyToken(token)) {
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
const instance = await this.container.resolveAsync(token);
|
|
447
|
-
instanceSet.add(instance);
|
|
448
|
-
} catch (err) {
|
|
449
|
-
if (err instanceof ModuleVisibilityError || err instanceof MultipleProvidersFoundError) {
|
|
450
|
-
throw err;
|
|
451
|
-
}
|
|
452
|
-
this.routeError(err, `resolve provider`);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
for (const controller of this.collectedControllers){
|
|
456
|
-
try {
|
|
457
|
-
if (this.container.getProviderScope(controller) === Scope.REQUEST) {
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
if (this.isLazyOnlyToken(controller)) {
|
|
461
|
-
continue;
|
|
462
|
-
}
|
|
463
|
-
const instance = await this.container.resolveAsync(controller);
|
|
464
|
-
instanceSet.add(instance);
|
|
465
|
-
} catch (err) {
|
|
466
|
-
if (err instanceof ModuleVisibilityError || err instanceof MultipleProvidersFoundError) {
|
|
467
|
-
throw err;
|
|
468
|
-
}
|
|
469
|
-
this.routeError(err, `resolve controller ${controller.name}`);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return [
|
|
473
|
-
...instanceSet
|
|
474
|
-
];
|
|
475
|
-
}
|
|
476
|
-
routeError(err, context) {
|
|
477
|
-
const mode = this.container.getDiagnostics();
|
|
478
|
-
if (mode === "silent") return;
|
|
479
|
-
if (mode === "throw") {
|
|
480
|
-
throw err instanceof Error ? err : new Error(String(err));
|
|
481
|
-
}
|
|
482
|
-
console.warn(`[vela] ${context} failed:`, err);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic, sync, edge-safe hash for module-instance discrimination.
|
|
3
|
-
*
|
|
4
|
-
* Walks values (objects/arrays/primitives/functions/class instances) into a
|
|
5
|
-
* sorted, source-fingerprinting JSON string, then runs FNV-1a (32-bit) for a
|
|
6
|
-
* compact 8-hex-char output.
|
|
7
|
-
*
|
|
8
|
-
* Functions and class instances are tolerated — they become `__fn:source` or
|
|
9
|
-
* `__cls:ClassName` markers. Two distinct closures with the same source code
|
|
10
|
-
* collide; module authors who care about that should pass an explicit `key`.
|
|
11
|
-
*
|
|
12
|
-
* Not cryptographic. Sufficient for discriminating module instances within
|
|
13
|
-
* an app.
|
|
14
|
-
*/
|
|
15
|
-
export declare function stableHash(value: unknown): string;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic, sync, edge-safe hash for module-instance discrimination.
|
|
3
|
-
*
|
|
4
|
-
* Walks values (objects/arrays/primitives/functions/class instances) into a
|
|
5
|
-
* sorted, source-fingerprinting JSON string, then runs FNV-1a (32-bit) for a
|
|
6
|
-
* compact 8-hex-char output.
|
|
7
|
-
*
|
|
8
|
-
* Functions and class instances are tolerated — they become `__fn:source` or
|
|
9
|
-
* `__cls:ClassName` markers. Two distinct closures with the same source code
|
|
10
|
-
* collide; module authors who care about that should pass an explicit `key`.
|
|
11
|
-
*
|
|
12
|
-
* Not cryptographic. Sufficient for discriminating module instances within
|
|
13
|
-
* an app.
|
|
14
|
-
*/ export function stableHash(value) {
|
|
15
|
-
return fnv1a(stableStringify(value));
|
|
16
|
-
}
|
|
17
|
-
function stableStringify(value) {
|
|
18
|
-
if (value === null || value === undefined) return JSON.stringify(value) ?? 'undefined';
|
|
19
|
-
if (typeof value === 'function') {
|
|
20
|
-
// Source-fingerprint via FNV-1a so we don't bloat the parent hash; this
|
|
21
|
-
// keeps two distinct factory functions distinguishable as long as their
|
|
22
|
-
// source differs (the common case). Names are intentionally excluded —
|
|
23
|
-
// two arrow functions with the same body should dedup.
|
|
24
|
-
return `__fn:${fnv1a(value.toString())}`;
|
|
25
|
-
}
|
|
26
|
-
if (typeof value === 'symbol') {
|
|
27
|
-
return `__sym:${value.description ?? ''}`;
|
|
28
|
-
}
|
|
29
|
-
if (typeof value !== 'object') return JSON.stringify(value);
|
|
30
|
-
if (Array.isArray(value)) {
|
|
31
|
-
return '[' + value.map(stableStringify).join(',') + ']';
|
|
32
|
-
}
|
|
33
|
-
const proto = Object.getPrototypeOf(value);
|
|
34
|
-
if (proto !== null && proto !== Object.prototype) {
|
|
35
|
-
const name = proto?.constructor?.name ?? 'AnonymousClass';
|
|
36
|
-
return `__cls:${name}` + stringifyOwnProps(value);
|
|
37
|
-
}
|
|
38
|
-
return stringifyOwnProps(value);
|
|
39
|
-
}
|
|
40
|
-
function stringifyOwnProps(obj) {
|
|
41
|
-
const keys = Object.keys(obj).sort();
|
|
42
|
-
const parts = keys.map((k)=>JSON.stringify(k) + ':' + stableStringify(obj[k]));
|
|
43
|
-
return '{' + parts.join(',') + '}';
|
|
44
|
-
}
|
|
45
|
-
function fnv1a(s) {
|
|
46
|
-
let h = 0x811c9dc5;
|
|
47
|
-
for(let i = 0; i < s.length; i++){
|
|
48
|
-
h ^= s.charCodeAt(i);
|
|
49
|
-
h = Math.imul(h, 0x01000193);
|
|
50
|
-
}
|
|
51
|
-
return (h >>> 0).toString(16).padStart(8, '0');
|
|
52
|
-
}
|
package/dist/module/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { AsyncModuleOptions, DynamicModule, ModuleImport, ModuleMetadata, ModuleOptions, } from '../registry/types';
|
package/dist/module/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ApiDocMetadata, ApiResponseEntry, ApiResponseOptions } from './types';
|
|
2
|
-
export declare const API_DOC_METADATA = "vela:openapi:doc";
|
|
3
|
-
export declare const API_TAGS_METADATA = "vela:openapi:tags";
|
|
4
|
-
export declare const API_RESPONSES_METADATA = "vela:openapi:responses";
|
|
5
|
-
/**
|
|
6
|
-
* Attach OpenAPI documentation to a route handler (or controller).
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* @Get('/:id')
|
|
10
|
-
* @ApiDoc({ summary: 'Get a user', description: '...', operationId: 'getUser' })
|
|
11
|
-
* findOne(@Param('id') id: string) { ... }
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function ApiDoc(metadata: ApiDocMetadata): MethodDecorator & ClassDecorator;
|
|
15
|
-
/**
|
|
16
|
-
* Attach OpenAPI tags to a controller or handler. Handler-level tags merge
|
|
17
|
-
* with controller-level tags; duplicates are de-duplicated in the output.
|
|
18
|
-
*/
|
|
19
|
-
export declare function ApiTags(...tags: string[]): MethodDecorator & ClassDecorator;
|
|
20
|
-
export declare function getApiDoc(target: object, propertyKey?: string | symbol): ApiDocMetadata | undefined;
|
|
21
|
-
export declare function getApiTags(target: object, propertyKey?: string | symbol): string[] | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Document a response for a given status code. Stackable: apply multiple
|
|
24
|
-
* times on the same handler to declare different statuses.
|
|
25
|
-
*
|
|
26
|
-
* ```ts
|
|
27
|
-
* @Get('/:id')
|
|
28
|
-
* @ApiResponse(200, { description: 'Found', schema: UserDto })
|
|
29
|
-
* @ApiResponse(404, { description: 'Not found', schema: ErrorDto })
|
|
30
|
-
* findOne() { ... }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function ApiResponse(status: number | string, options: ApiResponseOptions): MethodDecorator;
|
|
34
|
-
export declare function getApiResponses(target: object, propertyKey: string | symbol): ApiResponseEntry[] | undefined;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { MetadataRegistry } from "../registry/metadata.registry.js";
|
|
2
|
-
export const API_DOC_METADATA = 'vela:openapi:doc';
|
|
3
|
-
export const API_TAGS_METADATA = 'vela:openapi:tags';
|
|
4
|
-
export const API_RESPONSES_METADATA = 'vela:openapi:responses';
|
|
5
|
-
/**
|
|
6
|
-
* Attach OpenAPI documentation to a route handler (or controller).
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* @Get('/:id')
|
|
10
|
-
* @ApiDoc({ summary: 'Get a user', description: '...', operationId: 'getUser' })
|
|
11
|
-
* findOne(@Param('id') id: string) { ... }
|
|
12
|
-
* ```
|
|
13
|
-
*/ export function ApiDoc(metadata) {
|
|
14
|
-
return (target, propertyKey)=>{
|
|
15
|
-
if (propertyKey !== undefined) {
|
|
16
|
-
MetadataRegistry.setCustomHandlerMeta(target.constructor, propertyKey, API_DOC_METADATA, metadata);
|
|
17
|
-
} else {
|
|
18
|
-
MetadataRegistry.setCustomClassMeta(target, API_DOC_METADATA, metadata);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Attach OpenAPI tags to a controller or handler. Handler-level tags merge
|
|
24
|
-
* with controller-level tags; duplicates are de-duplicated in the output.
|
|
25
|
-
*/ export function ApiTags(...tags) {
|
|
26
|
-
return (target, propertyKey)=>{
|
|
27
|
-
if (propertyKey !== undefined) {
|
|
28
|
-
MetadataRegistry.setCustomHandlerMeta(target.constructor, propertyKey, API_TAGS_METADATA, tags);
|
|
29
|
-
} else {
|
|
30
|
-
MetadataRegistry.setCustomClassMeta(target, API_TAGS_METADATA, tags);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export function getApiDoc(target, propertyKey) {
|
|
35
|
-
if (propertyKey !== undefined) {
|
|
36
|
-
return MetadataRegistry.getCustomHandlerMeta(target, propertyKey, API_DOC_METADATA);
|
|
37
|
-
}
|
|
38
|
-
return MetadataRegistry.getCustomClassMeta(target, API_DOC_METADATA);
|
|
39
|
-
}
|
|
40
|
-
export function getApiTags(target, propertyKey) {
|
|
41
|
-
if (propertyKey !== undefined) {
|
|
42
|
-
return MetadataRegistry.getCustomHandlerMeta(target, propertyKey, API_TAGS_METADATA);
|
|
43
|
-
}
|
|
44
|
-
return MetadataRegistry.getCustomClassMeta(target, API_TAGS_METADATA);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Document a response for a given status code. Stackable: apply multiple
|
|
48
|
-
* times on the same handler to declare different statuses.
|
|
49
|
-
*
|
|
50
|
-
* ```ts
|
|
51
|
-
* @Get('/:id')
|
|
52
|
-
* @ApiResponse(200, { description: 'Found', schema: UserDto })
|
|
53
|
-
* @ApiResponse(404, { description: 'Not found', schema: ErrorDto })
|
|
54
|
-
* findOne() { ... }
|
|
55
|
-
* ```
|
|
56
|
-
*/ export function ApiResponse(status, options) {
|
|
57
|
-
return (target, propertyKey)=>{
|
|
58
|
-
MetadataRegistry.appendCustomHandlerMeta(target.constructor, propertyKey, API_RESPONSES_METADATA, {
|
|
59
|
-
status,
|
|
60
|
-
...options
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
export function getApiResponses(target, propertyKey) {
|
|
65
|
-
return MetadataRegistry.getCustomHandlerMeta(target, propertyKey, API_RESPONSES_METADATA);
|
|
66
|
-
}
|