@expressots/core 3.0.0-beta.4 → 4.0.0-preview.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/README.md +43 -95
- package/lib/CHANGELOG.md +40 -14
- package/lib/README.md +43 -95
- package/lib/cjs/application/application-container.js +467 -33
- package/lib/cjs/application/application-factory.js +105 -5
- package/lib/cjs/application/application.types.js +32 -2
- package/lib/cjs/application/bootstrap.js +812 -0
- package/lib/cjs/application/index.js +10 -7
- package/lib/cjs/authorization/authorization-config.interface.js +2 -0
- package/lib/cjs/authorization/decorators/convenience.js +80 -0
- package/lib/cjs/authorization/guard-constants.js +12 -0
- package/lib/cjs/authorization/guard-decorators.js +159 -0
- package/lib/cjs/authorization/guard-executor.js +101 -0
- package/lib/cjs/authorization/guard-registry.js +133 -0
- package/lib/cjs/authorization/guard.interface.js +75 -0
- package/lib/cjs/authorization/guards/attribute-based.guard.js +109 -0
- package/lib/cjs/authorization/guards/authenticated.guard.js +49 -0
- package/lib/cjs/authorization/guards/composition.guard.js +67 -0
- package/lib/cjs/authorization/guards/conditional.guard.js +41 -0
- package/lib/cjs/authorization/guards/index.js +24 -0
- package/lib/cjs/authorization/guards/permission.guard.js +82 -0
- package/lib/cjs/authorization/guards/resource-owner.guard.js +61 -0
- package/lib/cjs/authorization/guards/role.guard.js +64 -0
- package/lib/cjs/authorization/index.js +40 -0
- package/lib/cjs/authorization/services/guard-cache.interface.js +2 -0
- package/lib/cjs/authorization/services/guard-cache.js +56 -0
- package/lib/cjs/authorization/services/permission-hierarchy.interface.js +2 -0
- package/lib/cjs/authorization/services/permission-hierarchy.js +54 -0
- package/lib/cjs/authorization/services/permission-service.interface.js +2 -0
- package/lib/cjs/authorization/services/permission-service.js +58 -0
- package/lib/cjs/authorization/services/security-context.interface.js +2 -0
- package/lib/cjs/authorization/services/security-context.js +75 -0
- package/lib/cjs/authorization/setup.js +141 -0
- package/lib/cjs/config/config-resolver.js +719 -0
- package/lib/cjs/config/config.interfaces.js +14 -0
- package/lib/cjs/config/define-config.js +495 -0
- package/lib/cjs/config/env-field-builders.js +402 -0
- package/lib/cjs/config/index.js +83 -0
- package/lib/cjs/config/secret-value.js +201 -0
- package/lib/cjs/console/color-codes.js +4 -0
- package/lib/cjs/console/console.js +72 -9
- package/lib/cjs/console/index.js +2 -2
- package/lib/cjs/container-module/container-module.js +257 -26
- package/lib/cjs/container-module/index.js +6 -4
- package/lib/cjs/decorator/index.js +1 -1
- package/lib/cjs/decorator/scope-binding.js +307 -16
- package/lib/cjs/di/annotation/decorator_utils.js +4 -4
- package/lib/cjs/di/annotation/inject.js +3 -3
- package/lib/cjs/di/annotation/inject_base.js +5 -5
- package/lib/cjs/di/annotation/injectable.js +2 -2
- package/lib/cjs/di/annotation/multi_inject.js +3 -3
- package/lib/cjs/di/annotation/named.js +4 -4
- package/lib/cjs/di/annotation/optional.js +4 -4
- package/lib/cjs/di/annotation/post_construct.js +4 -4
- package/lib/cjs/di/annotation/pre_destroy.js +4 -4
- package/lib/cjs/di/annotation/property_event_decorator.js +2 -2
- package/lib/cjs/di/annotation/tagged.js +3 -3
- package/lib/cjs/di/annotation/target_name.js +5 -5
- package/lib/cjs/di/annotation/unmanaged.js +5 -5
- package/lib/cjs/di/binding-decorator/constants.js +3 -0
- package/lib/cjs/di/binding-decorator/decorator/fluent_provide.js +7 -7
- package/lib/cjs/di/binding-decorator/decorator/provide.js +7 -7
- package/lib/cjs/di/binding-decorator/factory/module_factory.js +23 -4
- package/lib/cjs/di/binding-decorator/index.js +11 -9
- package/lib/cjs/di/binding-decorator/syntax/provide_done_syntax.js +7 -7
- package/lib/cjs/di/binding-decorator/syntax/provide_in_syntax.js +19 -12
- package/lib/cjs/di/binding-decorator/syntax/provide_in_when_on_syntax.js +3 -0
- package/lib/cjs/di/binding-decorator/syntax/provide_on_syntax.js +4 -4
- package/lib/cjs/di/binding-decorator/syntax/provide_when_syntax.js +30 -30
- package/lib/cjs/di/binding-decorator/utils/auto_wire.js +4 -4
- package/lib/cjs/di/bindings/binding.js +5 -6
- package/lib/cjs/di/constants/error_msgs.js +6 -2
- package/lib/cjs/di/constants/literal_types.js +3 -3
- package/lib/cjs/di/container/container.js +44 -44
- package/lib/cjs/di/container/container_module.js +3 -3
- package/lib/cjs/di/container/lookup.js +3 -3
- package/lib/cjs/di/container/module_activation_store.js +3 -3
- package/lib/cjs/di/container-introspection.js +42 -0
- package/lib/cjs/di/inversify.js +85 -52
- package/lib/cjs/di/planning/context.js +2 -2
- package/lib/cjs/di/planning/metadata.js +1 -1
- package/lib/cjs/di/planning/metadata_reader.js +1 -1
- package/lib/cjs/di/planning/planner.js +37 -37
- package/lib/cjs/di/planning/reflection_utils.js +12 -12
- package/lib/cjs/di/planning/request.js +2 -2
- package/lib/cjs/di/planning/target.js +10 -10
- package/lib/cjs/di/resolution/instantiation.js +13 -13
- package/lib/cjs/di/resolution/resolver.js +22 -22
- package/lib/cjs/di/scope/scope-registry.js +115 -0
- package/lib/cjs/di/scope/scope.js +38 -8
- package/lib/cjs/di/syntax/binding_in_syntax.js +18 -8
- package/lib/cjs/di/syntax/binding_in_when_on_syntax.js +9 -6
- package/lib/cjs/di/syntax/binding_on_syntax.js +3 -3
- package/lib/cjs/di/syntax/binding_to_syntax.js +27 -27
- package/lib/cjs/di/syntax/binding_when_on_syntax.js +4 -4
- package/lib/cjs/di/syntax/binding_when_syntax.js +30 -30
- package/lib/cjs/di/syntax/constraint_helpers.js +3 -3
- package/lib/cjs/di/utils/binding_utils.js +18 -18
- package/lib/cjs/di/utils/exceptions.js +1 -1
- package/lib/cjs/di/utils/serialization.js +1 -1
- package/lib/cjs/error/app-error.js +152 -8
- package/lib/cjs/error/base-exception-filter.js +135 -0
- package/lib/cjs/error/error-handler-middleware.js +7 -7
- package/lib/cjs/error/exception-filter-constants.js +12 -0
- package/lib/cjs/error/exception-filter-decorators.js +161 -0
- package/lib/cjs/error/exception-filter-registry.js +163 -0
- package/lib/cjs/error/exception-filter.interface.js +2 -0
- package/lib/cjs/error/exception-handler-middleware.js +378 -0
- package/lib/cjs/error/filters/app-error.filter.js +31 -0
- package/lib/cjs/error/filters/global-exception.filter.js +39 -0
- package/lib/cjs/error/filters/not-found.filter.js +35 -0
- package/lib/cjs/error/filters/validation-error.filter.js +35 -0
- package/lib/cjs/error/index.js +28 -7
- package/lib/cjs/error/not-found.error.js +17 -0
- package/lib/cjs/error/report.js +104 -9
- package/lib/cjs/error/status-code.js +20 -0
- package/lib/cjs/error/utils.js +247 -33
- package/lib/cjs/error/validation.error.js +18 -0
- package/lib/cjs/event/event-decorators.js +280 -0
- package/lib/cjs/event/event-emitter.js +373 -0
- package/lib/cjs/event/event-flow-tracker.js +236 -0
- package/lib/cjs/event/event-recorder.js +289 -0
- package/lib/cjs/event/event-registry.js +207 -0
- package/lib/cjs/event/event.interfaces.js +54 -0
- package/lib/cjs/event/index.js +80 -0
- package/lib/cjs/index.js +29 -8
- package/lib/cjs/interceptor/conditional-interceptor.js +108 -0
- package/lib/cjs/interceptor/execution-context.js +66 -0
- package/lib/cjs/interceptor/index.js +64 -0
- package/lib/cjs/interceptor/interceptor-composition.js +130 -0
- package/lib/cjs/interceptor/interceptor-constants.js +20 -0
- package/lib/cjs/interceptor/interceptor-decorators.js +155 -0
- package/lib/cjs/interceptor/interceptor-executor.js +140 -0
- package/lib/cjs/interceptor/interceptor-registry.js +159 -0
- package/lib/cjs/interceptor/interceptor.interface.js +20 -0
- package/lib/cjs/interceptor/interceptors/index.js +22 -0
- package/lib/cjs/interceptor/interceptors/logging.interceptor.js +70 -0
- package/lib/cjs/interceptor/interceptors/performance.interceptor.js +251 -0
- package/lib/cjs/interceptor/interceptors/timeout.interceptor.js +66 -0
- package/lib/cjs/lazy-loading/index.js +73 -0
- package/lib/cjs/lazy-loading/lazy-load-metrics.js +355 -0
- package/lib/cjs/lazy-loading/lazy-module-loader.js +311 -0
- package/lib/cjs/lazy-loading/lazy-module-manager.js +244 -0
- package/lib/cjs/lazy-loading/lazy-module-warmup.js +294 -0
- package/lib/cjs/lazy-loading/lazy-module.js +380 -0
- package/lib/cjs/lazy-loading/lazy.interfaces.js +18 -0
- package/lib/cjs/lifecycle/index.js +15 -0
- package/lib/cjs/lifecycle/lifecycle-registry.js +301 -0
- package/lib/cjs/lifecycle/lifecycle.interface.js +37 -0
- package/lib/cjs/middleware/content-negotiation/accept-header-parser.js +110 -0
- package/lib/cjs/middleware/content-negotiation/content-negotiation-service.js +288 -0
- package/lib/cjs/middleware/content-negotiation/formatter-registry.js +168 -0
- package/lib/cjs/middleware/content-negotiation/formatters/csv-formatter.js +114 -0
- package/lib/cjs/middleware/content-negotiation/formatters/index.js +16 -0
- package/lib/cjs/middleware/content-negotiation/formatters/json-formatter.js +34 -0
- package/lib/cjs/middleware/content-negotiation/formatters/plain-text-formatter.js +44 -0
- package/lib/cjs/middleware/content-negotiation/formatters/xml-formatter.js +124 -0
- package/lib/cjs/middleware/content-negotiation/formatters/yaml-formatter.js +134 -0
- package/lib/cjs/middleware/content-negotiation/index.js +27 -0
- package/lib/cjs/middleware/index.js +59 -30
- package/lib/cjs/middleware/interfaces/content-negotiation.interface.js +7 -0
- package/lib/cjs/middleware/middleware-config.js +10 -0
- package/lib/cjs/middleware/middleware-presets.js +294 -0
- package/lib/cjs/middleware/middleware-profiler.js +310 -0
- package/lib/cjs/middleware/middleware-registry.js +160 -0
- package/lib/cjs/middleware/middleware-resolver.js +318 -57
- package/lib/cjs/middleware/middleware-service.js +1636 -308
- package/lib/cjs/middleware/middleware-utils.js +280 -0
- package/lib/cjs/middleware/upload-registry.js +91 -0
- package/lib/cjs/path-resolver/index.js +252 -0
- package/lib/cjs/provider/db-in-memory/adapter/adapter.interface.js +10 -0
- package/lib/cjs/provider/db-in-memory/adapter/in-memory.adapter.js +665 -0
- package/lib/cjs/provider/db-in-memory/adapter/index.js +10 -0
- package/lib/cjs/provider/db-in-memory/base-repo.repository.js +4 -4
- package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +14 -18
- package/lib/cjs/provider/db-in-memory/db.provider.js +402 -0
- package/lib/cjs/provider/db-in-memory/index.js +115 -9
- package/lib/cjs/provider/db-in-memory/query/index.js +24 -0
- package/lib/cjs/provider/db-in-memory/query/query-engine.js +573 -0
- package/lib/cjs/provider/db-in-memory/query/query.types.js +10 -0
- package/lib/cjs/provider/db-in-memory/schema/decorators.js +402 -0
- package/lib/cjs/provider/db-in-memory/schema/entity.interface.js +9 -0
- package/lib/cjs/provider/db-in-memory/schema/index.js +21 -0
- package/lib/cjs/provider/db-in-memory/storage/index.js +14 -0
- package/lib/cjs/provider/db-in-memory/storage/memory-store.js +706 -0
- package/lib/cjs/provider/dto-validator/dto-validator.provider.js +8 -8
- package/lib/cjs/provider/dto-validator/package-resolver.js +2 -2
- package/lib/cjs/provider/index.js +14 -10
- package/lib/cjs/provider/logger/decorators/index.js +17 -0
- package/lib/cjs/provider/logger/decorators/log-performance.decorator.js +178 -0
- package/lib/cjs/provider/logger/index.js +35 -0
- package/lib/cjs/provider/logger/logger.banner.js +473 -0
- package/lib/cjs/provider/logger/logger.config.js +22 -0
- package/lib/cjs/provider/logger/logger.context.js +341 -0
- package/lib/cjs/provider/logger/logger.flow.js +255 -0
- package/lib/cjs/provider/logger/logger.formatter.js +676 -0
- package/lib/cjs/provider/logger/logger.grouping.js +319 -0
- package/lib/cjs/provider/logger/logger.health.js +295 -0
- package/lib/cjs/provider/logger/logger.metrics-collector.js +184 -0
- package/lib/cjs/provider/logger/logger.metrics.js +91 -0
- package/lib/cjs/provider/logger/logger.performance.js +300 -0
- package/lib/cjs/provider/logger/logger.provider.js +698 -75
- package/lib/cjs/provider/logger/logger.query.js +532 -0
- package/lib/cjs/provider/logger/logger.redaction.js +456 -0
- package/lib/cjs/provider/logger/logger.suggestions.js +480 -0
- package/lib/cjs/provider/logger/transports/console.transport.js +78 -0
- package/lib/cjs/provider/logger/transports/file.transport.js +287 -0
- package/lib/cjs/provider/logger/transports/http-server.js +141 -0
- package/lib/cjs/provider/logger/transports/http.transport.js +151 -0
- package/lib/cjs/provider/logger/transports/index.js +21 -0
- package/lib/cjs/provider/logger/transports/transport.interface.js +2 -0
- package/lib/cjs/provider/logger/utils/index.js +18 -0
- package/lib/cjs/provider/logger/utils/log-entry.js +26 -0
- package/lib/cjs/provider/logger/utils/log-levels.js +106 -0
- package/lib/cjs/provider/provider-manager.js +209 -16
- package/lib/cjs/provider/provider-registry.js +414 -0
- package/lib/cjs/provider/provider.interface.js +49 -0
- package/lib/cjs/provider/validation/adapters/class-validator.adapter.js +264 -0
- package/lib/cjs/provider/validation/adapters/index.js +14 -0
- package/lib/cjs/provider/validation/helpful-error-formatter.js +228 -0
- package/lib/cjs/provider/validation/index.js +35 -0
- package/lib/cjs/provider/validation/smart-field-detector.js +543 -0
- package/lib/cjs/provider/validation/type-inference.js +192 -0
- package/lib/cjs/provider/validation/validation-registry.js +220 -0
- package/lib/cjs/provider/validation/validation.interface.js +9 -0
- package/lib/cjs/render/adapters/base-adapter.js +134 -0
- package/lib/cjs/render/adapters/ejs-adapter.js +172 -0
- package/lib/cjs/render/adapters/handlebars-adapter.js +191 -0
- package/lib/cjs/render/adapters/index.js +20 -0
- package/lib/cjs/render/adapters/pug-adapter.js +164 -0
- package/lib/cjs/render/adapters/react-adapter.js +336 -0
- package/lib/cjs/render/features/auto-detection.js +228 -0
- package/lib/cjs/render/features/hot-reload.js +155 -0
- package/lib/cjs/render/features/index.js +20 -0
- package/lib/cjs/render/features/streaming.js +106 -0
- package/lib/cjs/render/features/type-generator.js +221 -0
- package/lib/cjs/render/features/view-debugger.js +174 -0
- package/lib/cjs/render/index.js +80 -0
- package/lib/cjs/render/presets/index.js +216 -0
- package/lib/cjs/render/render-config.js +10 -0
- package/lib/cjs/render/render-interface.js +2 -0
- package/lib/cjs/render/render-registry.js +130 -0
- package/lib/cjs/render/render-service.js +418 -0
- package/lib/cjs/render/utils/cache-manager.js +199 -0
- package/lib/cjs/render/utils/index.js +20 -0
- package/lib/cjs/render/utils/package-resolver.js +121 -0
- package/lib/cjs/render/utils/view-scanner.js +208 -0
- package/lib/cjs/testing/create-test-app.js +366 -0
- package/lib/cjs/testing/create-test-database.js +416 -0
- package/lib/cjs/testing/fluent-request.js +454 -0
- package/lib/cjs/testing/index.js +142 -0
- package/lib/cjs/testing/load-test.js +484 -0
- package/lib/cjs/testing/matchers.js +444 -0
- package/lib/cjs/testing/mock-context.js +406 -0
- package/lib/cjs/testing/mock-provider.js +339 -0
- package/lib/cjs/testing/snapshot-request.js +378 -0
- package/lib/cjs/testing/testing.interfaces.js +10 -0
- package/lib/cjs/types/application/application-container.d.ts +320 -20
- package/lib/cjs/types/application/application-factory.d.ts +99 -3
- package/lib/cjs/types/application/application.types.d.ts +177 -2
- package/lib/cjs/types/application/bootstrap.d.ts +484 -0
- package/lib/cjs/types/application/index.d.ts +4 -3
- package/lib/cjs/types/authorization/authorization-config.interface.d.ts +45 -0
- package/lib/cjs/types/authorization/decorators/convenience.d.ts +64 -0
- package/lib/cjs/types/authorization/guard-constants.d.ts +9 -0
- package/lib/cjs/types/authorization/guard-decorators.d.ts +128 -0
- package/lib/cjs/types/authorization/guard-executor.d.ts +26 -0
- package/lib/cjs/types/authorization/guard-registry.d.ts +35 -0
- package/lib/cjs/types/authorization/guard.interface.d.ts +335 -0
- package/lib/cjs/types/authorization/guards/attribute-based.guard.d.ts +60 -0
- package/lib/cjs/types/authorization/guards/authenticated.guard.d.ts +26 -0
- package/lib/cjs/types/authorization/guards/composition.guard.d.ts +42 -0
- package/lib/cjs/types/authorization/guards/conditional.guard.d.ts +21 -0
- package/lib/cjs/types/authorization/guards/index.d.ts +7 -0
- package/lib/cjs/types/authorization/guards/permission.guard.d.ts +29 -0
- package/lib/cjs/types/authorization/guards/resource-owner.guard.d.ts +29 -0
- package/lib/cjs/types/authorization/guards/role.guard.d.ts +28 -0
- package/lib/cjs/types/authorization/index.d.ts +18 -0
- package/lib/cjs/types/authorization/services/guard-cache.d.ts +26 -0
- package/lib/cjs/types/authorization/services/guard-cache.interface.d.ts +29 -0
- package/lib/cjs/types/authorization/services/permission-hierarchy.d.ts +21 -0
- package/lib/cjs/types/authorization/services/permission-hierarchy.interface.d.ts +22 -0
- package/lib/cjs/types/authorization/services/permission-service.d.ts +21 -0
- package/lib/cjs/types/authorization/services/permission-service.interface.d.ts +19 -0
- package/lib/cjs/types/authorization/services/security-context.d.ts +32 -0
- package/lib/cjs/types/authorization/services/security-context.interface.d.ts +25 -0
- package/lib/cjs/types/authorization/setup.d.ts +84 -0
- package/lib/cjs/types/config/config-resolver.d.ts +40 -0
- package/lib/cjs/types/config/config.interfaces.d.ts +570 -0
- package/lib/cjs/types/config/define-config.d.ts +109 -0
- package/lib/cjs/types/config/env-field-builders.d.ts +288 -0
- package/lib/cjs/types/config/index.d.ts +61 -0
- package/lib/cjs/types/config/secret-value.d.ts +99 -0
- package/lib/cjs/types/console/color-codes.d.ts +1 -1
- package/lib/cjs/types/console/console.d.ts +65 -2
- package/lib/cjs/types/console/index.d.ts +1 -1
- package/lib/cjs/types/container-module/container-module.d.ts +215 -8
- package/lib/cjs/types/container-module/index.d.ts +1 -1
- package/lib/cjs/types/decorator/index.d.ts +1 -1
- package/lib/cjs/types/decorator/scope-binding.d.ts +339 -11
- package/lib/cjs/types/di/annotation/decorator_utils.d.ts +1 -1
- package/lib/cjs/types/di/annotation/inject.d.ts +1 -1
- package/lib/cjs/types/di/annotation/inject_base.d.ts +2 -2
- package/lib/cjs/types/di/annotation/lazy_service_identifier.d.ts +1 -1
- package/lib/cjs/types/di/annotation/multi_inject.d.ts +1 -1
- package/lib/cjs/types/di/annotation/named.d.ts +1 -1
- package/lib/cjs/types/di/annotation/target_name.d.ts +1 -1
- package/lib/cjs/types/di/annotation/unmanaged.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/constants.d.ts +3 -0
- package/lib/cjs/types/di/binding-decorator/decorator/fluent_provide.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/decorator/provide.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/factory/module_factory.d.ts +20 -1
- package/lib/cjs/types/di/binding-decorator/index.d.ts +6 -4
- package/lib/cjs/types/di/binding-decorator/interfaces/interfaces.d.ts +2 -1
- package/lib/cjs/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +1 -1
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +3 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +3 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +2 -2
- package/lib/cjs/types/di/binding-decorator/utils/auto_wire.d.ts +1 -1
- package/lib/cjs/types/di/bindings/binding.d.ts +1 -1
- package/lib/cjs/types/di/constants/literal_types.d.ts +3 -3
- package/lib/cjs/types/di/container/container.d.ts +1 -1
- package/lib/cjs/types/di/container/container_module.d.ts +1 -1
- package/lib/cjs/types/di/container/container_snapshot.d.ts +1 -1
- package/lib/cjs/types/di/container/lookup.d.ts +1 -1
- package/lib/cjs/types/di/container/module_activation_store.d.ts +1 -1
- package/lib/cjs/types/di/container-introspection.d.ts +25 -0
- package/lib/cjs/types/di/interfaces/interfaces.d.ts +4 -3
- package/lib/cjs/types/di/inversify.d.ts +53 -24
- package/lib/cjs/types/di/planning/context.d.ts +1 -1
- package/lib/cjs/types/di/planning/metadata.d.ts +1 -1
- package/lib/cjs/types/di/planning/metadata_reader.d.ts +1 -1
- package/lib/cjs/types/di/planning/plan.d.ts +1 -1
- package/lib/cjs/types/di/planning/planner.d.ts +1 -1
- package/lib/cjs/types/di/planning/queryable_string.d.ts +1 -1
- package/lib/cjs/types/di/planning/reflection_utils.d.ts +2 -2
- package/lib/cjs/types/di/planning/request.d.ts +1 -1
- package/lib/cjs/types/di/planning/target.d.ts +2 -2
- package/lib/cjs/types/di/resolution/instantiation.d.ts +1 -1
- package/lib/cjs/types/di/resolution/resolver.d.ts +1 -1
- package/lib/cjs/types/di/scope/scope-registry.d.ts +91 -0
- package/lib/cjs/types/di/scope/scope.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_in_syntax.d.ts +2 -1
- package/lib/cjs/types/di/syntax/binding_in_when_on_syntax.d.ts +2 -1
- package/lib/cjs/types/di/syntax/binding_on_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_to_syntax.d.ts +2 -2
- package/lib/cjs/types/di/syntax/binding_when_on_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/binding_when_syntax.d.ts +1 -1
- package/lib/cjs/types/di/syntax/constraint_helpers.d.ts +1 -1
- package/lib/cjs/types/di/utils/binding_utils.d.ts +1 -1
- package/lib/cjs/types/di/utils/clonable.d.ts +1 -1
- package/lib/cjs/types/di/utils/serialization.d.ts +1 -1
- package/lib/cjs/types/error/app-error.d.ts +155 -7
- package/lib/cjs/types/error/base-exception-filter.d.ts +73 -0
- package/lib/cjs/types/error/exception-filter-constants.d.ts +9 -0
- package/lib/cjs/types/error/exception-filter-decorators.d.ts +126 -0
- package/lib/cjs/types/error/exception-filter-registry.d.ts +38 -0
- package/lib/cjs/types/error/exception-filter.interface.d.ts +82 -0
- package/lib/cjs/types/error/exception-handler-middleware.d.ts +35 -0
- package/lib/cjs/types/error/filters/app-error.filter.d.ts +10 -0
- package/lib/cjs/types/error/filters/global-exception.filter.d.ts +9 -0
- package/lib/cjs/types/error/filters/not-found.filter.d.ts +10 -0
- package/lib/cjs/types/error/filters/validation-error.filter.d.ts +10 -0
- package/lib/cjs/types/error/index.d.ts +14 -3
- package/lib/cjs/types/error/not-found.error.d.ts +7 -0
- package/lib/cjs/types/error/report.d.ts +84 -6
- package/lib/cjs/types/error/status-code.d.ts +20 -0
- package/lib/cjs/types/error/utils.d.ts +16 -0
- package/lib/cjs/types/error/validation.error.d.ts +8 -0
- package/lib/cjs/types/event/event-decorators.d.ts +199 -0
- package/lib/cjs/types/event/event-emitter.d.ts +109 -0
- package/lib/cjs/types/event/event-flow-tracker.d.ts +88 -0
- package/lib/cjs/types/event/event-recorder.d.ts +121 -0
- package/lib/cjs/types/event/event-registry.d.ts +84 -0
- package/lib/cjs/types/event/event.interfaces.d.ts +528 -0
- package/lib/cjs/types/event/index.d.ts +55 -0
- package/lib/cjs/types/index.d.ts +27 -8
- package/lib/cjs/types/interceptor/conditional-interceptor.d.ts +91 -0
- package/lib/cjs/types/interceptor/execution-context.d.ts +41 -0
- package/lib/cjs/types/interceptor/index.d.ts +41 -0
- package/lib/cjs/types/interceptor/interceptor-composition.d.ts +115 -0
- package/lib/cjs/types/interceptor/interceptor-constants.d.ts +17 -0
- package/lib/cjs/types/interceptor/interceptor-decorators.d.ts +124 -0
- package/lib/cjs/types/interceptor/interceptor-executor.d.ts +46 -0
- package/lib/cjs/types/interceptor/interceptor-registry.d.ts +65 -0
- package/lib/cjs/types/interceptor/interceptor.interface.d.ts +281 -0
- package/lib/cjs/types/interceptor/interceptors/index.d.ts +6 -0
- package/lib/cjs/types/interceptor/interceptors/logging.interceptor.d.ts +28 -0
- package/lib/cjs/types/interceptor/interceptors/performance.interceptor.d.ts +197 -0
- package/lib/cjs/types/interceptor/interceptors/timeout.interceptor.d.ts +42 -0
- package/lib/cjs/types/lazy-loading/index.d.ts +42 -0
- package/lib/cjs/types/lazy-loading/lazy-load-metrics.d.ts +139 -0
- package/lib/cjs/types/lazy-loading/lazy-module-loader.d.ts +169 -0
- package/lib/cjs/types/lazy-loading/lazy-module-manager.d.ts +148 -0
- package/lib/cjs/types/lazy-loading/lazy-module-warmup.d.ts +130 -0
- package/lib/cjs/types/lazy-loading/lazy-module.d.ts +168 -0
- package/lib/cjs/types/lazy-loading/lazy.interfaces.d.ts +480 -0
- package/lib/cjs/types/lifecycle/index.d.ts +9 -0
- package/lib/cjs/types/lifecycle/lifecycle-registry.d.ts +213 -0
- package/lib/cjs/types/lifecycle/lifecycle.interface.d.ts +191 -0
- package/lib/cjs/types/middleware/content-negotiation/accept-header-parser.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/content-negotiation-service.d.ts +64 -0
- package/lib/cjs/types/middleware/content-negotiation/formatter-registry.d.ts +60 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/csv-formatter.d.ts +34 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/index.d.ts +8 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/json-formatter.d.ts +14 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/plain-text-formatter.d.ts +12 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/xml-formatter.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/formatters/yaml-formatter.d.ts +26 -0
- package/lib/cjs/types/middleware/content-negotiation/index.d.ts +7 -0
- package/lib/cjs/types/middleware/index.d.ts +25 -15
- package/lib/cjs/types/middleware/interfaces/content-negotiation.interface.d.ts +142 -0
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +1 -1
- package/lib/cjs/types/middleware/middleware-config.d.ts +574 -0
- package/lib/cjs/types/middleware/middleware-interface.d.ts +594 -88
- package/lib/cjs/types/middleware/middleware-presets.d.ts +90 -0
- package/lib/cjs/types/middleware/middleware-profiler.d.ts +199 -0
- package/lib/cjs/types/middleware/middleware-registry.d.ts +103 -0
- package/lib/cjs/types/middleware/middleware-resolver.d.ts +156 -8
- package/lib/cjs/types/middleware/middleware-service.d.ts +634 -112
- package/lib/cjs/types/middleware/middleware-utils.d.ts +145 -0
- package/lib/cjs/types/middleware/upload-registry.d.ts +50 -0
- package/lib/cjs/types/path-resolver/index.d.ts +80 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/adapter.interface.d.ts +222 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/in-memory.adapter.d.ts +239 -0
- package/lib/cjs/types/provider/db-in-memory/adapter/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/base-repo.repository.d.ts +1 -1
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.interface.d.ts +1 -1
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +8 -2
- package/lib/cjs/types/provider/db-in-memory/db.provider.d.ts +281 -0
- package/lib/cjs/types/provider/db-in-memory/index.d.ts +63 -4
- package/lib/cjs/types/provider/db-in-memory/query/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/query/query-engine.d.ts +101 -0
- package/lib/cjs/types/provider/db-in-memory/query/query.types.d.ts +318 -0
- package/lib/cjs/types/provider/db-in-memory/schema/decorators.d.ts +314 -0
- package/lib/cjs/types/provider/db-in-memory/schema/entity.interface.d.ts +60 -0
- package/lib/cjs/types/provider/db-in-memory/schema/index.d.ts +6 -0
- package/lib/cjs/types/provider/db-in-memory/storage/index.d.ts +5 -0
- package/lib/cjs/types/provider/db-in-memory/storage/memory-store.d.ts +326 -0
- package/lib/cjs/types/provider/index.d.ts +7 -5
- package/lib/cjs/types/provider/logger/decorators/index.d.ts +1 -0
- package/lib/cjs/types/provider/logger/decorators/log-performance.decorator.d.ts +49 -0
- package/lib/cjs/types/provider/logger/index.d.ts +17 -0
- package/lib/cjs/types/provider/logger/logger.banner.d.ts +94 -0
- package/lib/cjs/types/provider/logger/logger.config.d.ts +55 -0
- package/lib/cjs/types/provider/logger/logger.context.d.ts +189 -0
- package/lib/cjs/types/provider/logger/logger.flow.d.ts +165 -0
- package/lib/cjs/types/provider/logger/logger.formatter.d.ts +44 -0
- package/lib/cjs/types/provider/logger/logger.grouping.d.ts +124 -0
- package/lib/cjs/types/provider/logger/logger.health.d.ts +123 -0
- package/lib/cjs/types/provider/logger/logger.metrics-collector.d.ts +44 -0
- package/lib/cjs/types/provider/logger/logger.metrics.d.ts +162 -0
- package/lib/cjs/types/provider/logger/logger.performance.d.ts +179 -0
- package/lib/cjs/types/provider/logger/logger.provider.d.ts +303 -30
- package/lib/cjs/types/provider/logger/logger.query.d.ts +232 -0
- package/lib/cjs/types/provider/logger/logger.redaction.d.ts +169 -0
- package/lib/cjs/types/provider/logger/logger.suggestions.d.ts +124 -0
- package/lib/cjs/types/provider/logger/transports/console.transport.d.ts +49 -0
- package/lib/cjs/types/provider/logger/transports/file.transport.d.ts +87 -0
- package/lib/cjs/types/provider/logger/transports/http-server.d.ts +88 -0
- package/lib/cjs/types/provider/logger/transports/http.transport.d.ts +74 -0
- package/lib/cjs/types/provider/logger/transports/index.d.ts +5 -0
- package/lib/cjs/types/provider/logger/transports/transport.interface.d.ts +31 -0
- package/lib/cjs/types/provider/logger/utils/index.d.ts +2 -0
- package/lib/cjs/types/provider/logger/utils/log-entry.d.ts +82 -0
- package/lib/cjs/types/provider/logger/utils/log-levels.d.ts +53 -0
- package/lib/cjs/types/provider/provider-manager.d.ts +165 -13
- package/lib/cjs/types/provider/provider-registry.d.ts +192 -0
- package/lib/cjs/types/provider/provider.interface.d.ts +337 -0
- package/lib/cjs/types/provider/validation/adapters/class-validator.adapter.d.ts +68 -0
- package/lib/cjs/types/provider/validation/adapters/index.d.ts +10 -0
- package/lib/cjs/types/provider/validation/helpful-error-formatter.d.ts +110 -0
- package/lib/cjs/types/provider/validation/index.d.ts +19 -0
- package/lib/cjs/types/provider/validation/smart-field-detector.d.ts +91 -0
- package/lib/cjs/types/provider/validation/type-inference.d.ts +81 -0
- package/lib/cjs/types/provider/validation/validation-registry.d.ts +105 -0
- package/lib/cjs/types/provider/validation/validation.interface.d.ts +178 -0
- package/lib/cjs/types/render/adapters/base-adapter.d.ts +95 -0
- package/lib/cjs/types/render/adapters/ejs-adapter.d.ts +57 -0
- package/lib/cjs/types/render/adapters/handlebars-adapter.d.ts +74 -0
- package/lib/cjs/types/render/adapters/index.d.ts +12 -0
- package/lib/cjs/types/render/adapters/pug-adapter.d.ts +57 -0
- package/lib/cjs/types/render/adapters/react-adapter.d.ts +99 -0
- package/lib/cjs/types/render/features/auto-detection.d.ts +58 -0
- package/lib/cjs/types/render/features/hot-reload.d.ts +65 -0
- package/lib/cjs/types/render/features/index.d.ts +12 -0
- package/lib/cjs/types/render/features/streaming.d.ts +39 -0
- package/lib/cjs/types/render/features/type-generator.d.ts +64 -0
- package/lib/cjs/types/render/features/view-debugger.d.ts +42 -0
- package/lib/cjs/types/render/index.d.ts +50 -0
- package/lib/cjs/types/render/presets/index.d.ts +119 -0
- package/lib/cjs/types/render/render-config.d.ts +213 -0
- package/lib/cjs/types/render/render-interface.d.ts +126 -0
- package/lib/cjs/types/render/render-registry.d.ts +86 -0
- package/lib/cjs/types/render/render-service.d.ts +157 -0
- package/lib/cjs/types/render/utils/cache-manager.d.ts +106 -0
- package/lib/cjs/types/render/utils/index.d.ts +11 -0
- package/lib/cjs/types/render/utils/package-resolver.d.ts +57 -0
- package/lib/cjs/types/render/utils/view-scanner.d.ts +74 -0
- package/lib/cjs/types/testing/create-test-app.d.ts +71 -0
- package/lib/cjs/types/testing/create-test-database.d.ts +100 -0
- package/lib/cjs/types/testing/fluent-request.d.ts +37 -0
- package/lib/cjs/types/testing/index.d.ts +93 -0
- package/lib/cjs/types/testing/load-test.d.ts +139 -0
- package/lib/cjs/types/testing/matchers.d.ts +184 -0
- package/lib/cjs/types/testing/mock-context.d.ts +117 -0
- package/lib/cjs/types/testing/mock-provider.d.ts +93 -0
- package/lib/cjs/types/testing/snapshot-request.d.ts +46 -0
- package/lib/cjs/types/testing/testing.interfaces.d.ts +948 -0
- package/lib/cjs/types/utils/node-require.d.ts +11 -0
- package/lib/cjs/utils/node-require.js +59 -0
- package/lib/esm/application/application-container.js +526 -0
- package/lib/esm/application/application-factory.js +134 -0
- package/lib/esm/application/application.types.js +41 -0
- package/lib/esm/application/bootstrap.js +805 -0
- package/lib/esm/application/index.js +4 -0
- package/lib/esm/authorization/authorization-config.interface.js +1 -0
- package/lib/esm/authorization/decorators/convenience.js +74 -0
- package/lib/esm/authorization/guard-constants.js +9 -0
- package/lib/esm/authorization/guard-decorators.js +155 -0
- package/lib/esm/authorization/guard-executor.js +101 -0
- package/lib/esm/authorization/guard-registry.js +132 -0
- package/lib/esm/authorization/guard.interface.js +73 -0
- package/lib/esm/authorization/guards/attribute-based.guard.js +106 -0
- package/lib/esm/authorization/guards/authenticated.guard.js +45 -0
- package/lib/esm/authorization/guards/composition.guard.js +63 -0
- package/lib/esm/authorization/guards/conditional.guard.js +38 -0
- package/lib/esm/authorization/guards/index.js +8 -0
- package/lib/esm/authorization/guards/permission.guard.js +80 -0
- package/lib/esm/authorization/guards/resource-owner.guard.js +58 -0
- package/lib/esm/authorization/guards/role.guard.js +61 -0
- package/lib/esm/authorization/index.js +24 -0
- package/lib/esm/authorization/services/guard-cache.interface.js +1 -0
- package/lib/esm/authorization/services/guard-cache.js +51 -0
- package/lib/esm/authorization/services/permission-hierarchy.interface.js +1 -0
- package/lib/esm/authorization/services/permission-hierarchy.js +49 -0
- package/lib/esm/authorization/services/permission-service.interface.js +1 -0
- package/lib/esm/authorization/services/permission-service.js +56 -0
- package/lib/esm/authorization/services/security-context.interface.js +1 -0
- package/lib/esm/authorization/services/security-context.js +74 -0
- package/lib/esm/authorization/setup.js +137 -0
- package/lib/esm/config/config-resolver.js +714 -0
- package/lib/esm/config/config.interfaces.js +13 -0
- package/lib/esm/config/define-config.js +492 -0
- package/lib/esm/config/env-field-builders.js +392 -0
- package/lib/esm/config/index.js +67 -0
- package/lib/esm/config/secret-value.js +175 -0
- package/lib/esm/console/color-codes.js +46 -0
- package/lib/esm/console/console.js +107 -0
- package/lib/esm/console/index.js +1 -0
- package/lib/esm/container-module/container-module.js +322 -0
- package/lib/esm/container-module/index.js +1 -0
- package/lib/esm/decorator/index.js +1 -0
- package/lib/esm/decorator/scope-binding.js +344 -0
- package/lib/esm/di/annotation/decorator_utils.js +93 -0
- package/lib/esm/di/annotation/inject.js +18 -0
- package/lib/esm/di/annotation/inject_base.js +14 -0
- package/lib/esm/di/annotation/injectable.js +19 -0
- package/lib/esm/di/annotation/lazy_service_identifier.js +9 -0
- package/lib/esm/di/annotation/multi_inject.js +4 -0
- package/lib/esm/di/annotation/named.js +9 -0
- package/lib/esm/di/annotation/optional.js +7 -0
- package/lib/esm/di/annotation/post_construct.js +5 -0
- package/lib/esm/di/annotation/pre_destroy.js +5 -0
- package/lib/esm/di/annotation/property_event_decorator.js +13 -0
- package/lib/esm/di/annotation/tagged.js +7 -0
- package/lib/esm/di/annotation/target_name.js +10 -0
- package/lib/esm/di/annotation/unmanaged.js +10 -0
- package/lib/esm/di/binding-decorator/constants.js +7 -0
- package/lib/esm/di/binding-decorator/decorator/fluent_provide.js +15 -0
- package/lib/esm/di/binding-decorator/decorator/provide.js +35 -0
- package/lib/esm/di/binding-decorator/factory/module_factory.js +34 -0
- package/lib/esm/di/binding-decorator/index.js +10 -0
- package/lib/esm/di/binding-decorator/interfaces/interfaces.js +1 -0
- package/lib/esm/di/binding-decorator/syntax/provide_done_syntax.js +41 -0
- package/lib/esm/di/binding-decorator/syntax/provide_in_syntax.js +37 -0
- package/lib/esm/di/binding-decorator/syntax/provide_in_when_on_syntax.js +68 -0
- package/lib/esm/di/binding-decorator/syntax/provide_on_syntax.js +19 -0
- package/lib/esm/di/binding-decorator/syntax/provide_when_on_syntax.js +57 -0
- package/lib/esm/di/binding-decorator/syntax/provide_when_syntax.js +86 -0
- package/lib/esm/di/binding-decorator/utils/auto_wire.js +13 -0
- package/lib/esm/di/bindings/binding.js +64 -0
- package/lib/esm/di/bindings/binding_count.js +5 -0
- package/lib/esm/di/constants/error_msgs.js +54 -0
- package/lib/esm/di/constants/literal_types.js +21 -0
- package/lib/esm/di/constants/metadata_keys.js +35 -0
- package/lib/esm/di/container/container.js +505 -0
- package/lib/esm/di/container/container_module.js +17 -0
- package/lib/esm/di/container/container_snapshot.js +17 -0
- package/lib/esm/di/container/lookup.js +108 -0
- package/lib/esm/di/container/module_activation_store.js +43 -0
- package/lib/esm/di/container-introspection.js +38 -0
- package/lib/esm/di/interfaces/interfaces.js +1 -0
- package/lib/esm/di/inversify.js +53 -0
- package/lib/esm/di/planning/context.js +18 -0
- package/lib/esm/di/planning/metadata.js +18 -0
- package/lib/esm/di/planning/metadata_reader.js +19 -0
- package/lib/esm/di/planning/plan.js +9 -0
- package/lib/esm/di/planning/planner.js +159 -0
- package/lib/esm/di/planning/queryable_string.js +25 -0
- package/lib/esm/di/planning/reflection_utils.js +150 -0
- package/lib/esm/di/planning/request.js +28 -0
- package/lib/esm/di/planning/target.js +89 -0
- package/lib/esm/di/resolution/instantiation.js +125 -0
- package/lib/esm/di/resolution/resolver.js +163 -0
- package/lib/esm/di/scope/scope-registry.js +109 -0
- package/lib/esm/di/scope/scope.js +75 -0
- package/lib/esm/di/syntax/binding_in_syntax.js +31 -0
- package/lib/esm/di/syntax/binding_in_when_on_syntax.js +79 -0
- package/lib/esm/di/syntax/binding_on_syntax.js +16 -0
- package/lib/esm/di/syntax/binding_to_syntax.js +89 -0
- package/lib/esm/di/syntax/binding_when_on_syntax.js +64 -0
- package/lib/esm/di/syntax/binding_when_syntax.js +82 -0
- package/lib/esm/di/syntax/constraint_helpers.js +39 -0
- package/lib/esm/di/utils/async.js +12 -0
- package/lib/esm/di/utils/binding_utils.js +48 -0
- package/lib/esm/di/utils/clonable.js +7 -0
- package/lib/esm/di/utils/exceptions.js +18 -0
- package/lib/esm/di/utils/factory_type.js +6 -0
- package/lib/esm/di/utils/id.js +5 -0
- package/lib/esm/di/utils/js.js +12 -0
- package/lib/esm/di/utils/serialization.js +102 -0
- package/lib/esm/error/app-error.js +209 -0
- package/lib/esm/error/base-exception-filter.js +134 -0
- package/lib/esm/error/error-handler-middleware.js +34 -0
- package/lib/esm/error/exception-filter-constants.js +9 -0
- package/lib/esm/error/exception-filter-decorators.js +157 -0
- package/lib/esm/error/exception-filter-registry.js +162 -0
- package/lib/esm/error/exception-filter.interface.js +1 -0
- package/lib/esm/error/exception-handler-middleware.js +378 -0
- package/lib/esm/error/filters/app-error.filter.js +28 -0
- package/lib/esm/error/filters/global-exception.filter.js +36 -0
- package/lib/esm/error/filters/not-found.filter.js +32 -0
- package/lib/esm/error/filters/validation-error.filter.js +32 -0
- package/lib/esm/error/index.js +13 -0
- package/lib/esm/error/not-found.error.js +13 -0
- package/lib/esm/error/report.js +153 -0
- package/lib/esm/error/status-code.js +106 -0
- package/lib/esm/error/utils.js +252 -0
- package/lib/esm/error/validation.error.js +15 -0
- package/lib/esm/event/event-decorators.js +268 -0
- package/lib/esm/event/event-emitter.js +376 -0
- package/lib/esm/event/event-flow-tracker.js +230 -0
- package/lib/esm/event/event-recorder.js +286 -0
- package/lib/esm/event/event-registry.js +201 -0
- package/lib/esm/event/event.interfaces.js +51 -0
- package/lib/esm/event/index.js +58 -0
- package/lib/esm/index.mjs +27 -0
- package/lib/esm/interceptor/conditional-interceptor.js +104 -0
- package/lib/esm/interceptor/execution-context.js +66 -0
- package/lib/esm/interceptor/index.js +48 -0
- package/lib/esm/interceptor/interceptor-composition.js +126 -0
- package/lib/esm/interceptor/interceptor-constants.js +17 -0
- package/lib/esm/interceptor/interceptor-decorators.js +151 -0
- package/lib/esm/interceptor/interceptor-executor.js +139 -0
- package/lib/esm/interceptor/interceptor-registry.js +158 -0
- package/lib/esm/interceptor/interceptor.interface.js +16 -0
- package/lib/esm/interceptor/interceptors/index.js +6 -0
- package/lib/esm/interceptor/interceptors/logging.interceptor.js +68 -0
- package/lib/esm/interceptor/interceptors/performance.interceptor.js +253 -0
- package/lib/esm/interceptor/interceptors/timeout.interceptor.js +65 -0
- package/lib/esm/lazy-loading/index.js +56 -0
- package/lib/esm/lazy-loading/lazy-load-metrics.js +352 -0
- package/lib/esm/lazy-loading/lazy-module-loader.js +305 -0
- package/lib/esm/lazy-loading/lazy-module-manager.js +241 -0
- package/lib/esm/lazy-loading/lazy-module-warmup.js +291 -0
- package/lib/esm/lazy-loading/lazy-module.js +352 -0
- package/lib/esm/lazy-loading/lazy.interfaces.js +17 -0
- package/lib/esm/lifecycle/index.js +9 -0
- package/lib/esm/lifecycle/lifecycle-registry.js +298 -0
- package/lib/esm/lifecycle/lifecycle.interface.js +33 -0
- package/lib/esm/middleware/content-negotiation/accept-header-parser.js +106 -0
- package/lib/esm/middleware/content-negotiation/content-negotiation-service.js +286 -0
- package/lib/esm/middleware/content-negotiation/formatter-registry.js +165 -0
- package/lib/esm/middleware/content-negotiation/formatters/csv-formatter.js +111 -0
- package/lib/esm/middleware/content-negotiation/formatters/index.js +8 -0
- package/lib/esm/middleware/content-negotiation/formatters/json-formatter.js +30 -0
- package/lib/esm/middleware/content-negotiation/formatters/plain-text-formatter.js +40 -0
- package/lib/esm/middleware/content-negotiation/formatters/xml-formatter.js +121 -0
- package/lib/esm/middleware/content-negotiation/formatters/yaml-formatter.js +131 -0
- package/lib/esm/middleware/content-negotiation/index.js +7 -0
- package/lib/esm/middleware/index.js +19 -0
- package/lib/esm/middleware/interfaces/body-parser.interface.js +1 -0
- package/lib/esm/middleware/interfaces/compression.interface.js +1 -0
- package/lib/esm/middleware/interfaces/content-negotiation.interface.js +6 -0
- package/lib/esm/middleware/interfaces/cookie-parser.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cookie-session/cookie-session.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cookie-session/keygrip.interface.js +1 -0
- package/lib/esm/middleware/interfaces/cors.interface.js +1 -0
- package/lib/esm/middleware/interfaces/express-rate-limit.interface.js +1 -0
- package/lib/esm/middleware/interfaces/express-session.interface.js +1 -0
- package/lib/esm/middleware/interfaces/helmet.interface.js +1 -0
- package/lib/esm/middleware/interfaces/morgan.interface.js +1 -0
- package/lib/esm/middleware/interfaces/multer.interface.js +1 -0
- package/lib/esm/middleware/interfaces/serve-favicon.interface.js +1 -0
- package/lib/esm/middleware/interfaces/serve-static.interface.js +1 -0
- package/lib/esm/middleware/interfaces/url-encoded.interface.js +1 -0
- package/lib/esm/middleware/middleware-config.js +9 -0
- package/lib/esm/middleware/middleware-interface.js +1 -0
- package/lib/esm/middleware/middleware-presets.js +286 -0
- package/lib/esm/middleware/middleware-profiler.js +307 -0
- package/lib/esm/middleware/middleware-registry.js +152 -0
- package/lib/esm/middleware/middleware-resolver.js +320 -0
- package/lib/esm/middleware/middleware-service.js +1797 -0
- package/lib/esm/middleware/middleware-utils.js +273 -0
- package/lib/esm/middleware/upload-registry.js +84 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/path-resolver/index.js +224 -0
- package/lib/esm/provider/db-in-memory/adapter/adapter.interface.js +9 -0
- package/lib/esm/provider/db-in-memory/adapter/in-memory.adapter.js +667 -0
- package/lib/esm/provider/db-in-memory/adapter/index.js +5 -0
- package/lib/esm/provider/db-in-memory/base-repo.repository.js +54 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.interface.js +1 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.provider.js +104 -0
- package/lib/esm/provider/db-in-memory/db-in-memory.types.js +20 -0
- package/lib/esm/provider/db-in-memory/db.provider.js +405 -0
- package/lib/esm/provider/db-in-memory/index.js +90 -0
- package/lib/esm/provider/db-in-memory/query/index.js +6 -0
- package/lib/esm/provider/db-in-memory/query/query-engine.js +570 -0
- package/lib/esm/provider/db-in-memory/query/query.types.js +9 -0
- package/lib/esm/provider/db-in-memory/schema/decorators.js +387 -0
- package/lib/esm/provider/db-in-memory/schema/entity.interface.js +8 -0
- package/lib/esm/provider/db-in-memory/schema/index.js +5 -0
- package/lib/esm/provider/db-in-memory/storage/index.js +5 -0
- package/lib/esm/provider/db-in-memory/storage/memory-store.js +709 -0
- package/lib/esm/provider/dto-validator/dto-validator.provider.js +49 -0
- package/lib/esm/provider/dto-validator/package-resolver.js +30 -0
- package/lib/esm/provider/index.js +7 -0
- package/lib/esm/provider/logger/decorators/index.js +1 -0
- package/lib/esm/provider/logger/decorators/log-performance.decorator.js +175 -0
- package/lib/esm/provider/logger/index.js +17 -0
- package/lib/esm/provider/logger/logger.banner.js +471 -0
- package/lib/esm/provider/logger/logger.config.js +19 -0
- package/lib/esm/provider/logger/logger.context.js +334 -0
- package/lib/esm/provider/logger/logger.flow.js +248 -0
- package/lib/esm/provider/logger/logger.formatter.js +670 -0
- package/lib/esm/provider/logger/logger.grouping.js +314 -0
- package/lib/esm/provider/logger/logger.health.js +291 -0
- package/lib/esm/provider/logger/logger.metrics-collector.js +180 -0
- package/lib/esm/provider/logger/logger.metrics.js +85 -0
- package/lib/esm/provider/logger/logger.performance.js +299 -0
- package/lib/esm/provider/logger/logger.provider.js +746 -0
- package/lib/esm/provider/logger/logger.query.js +529 -0
- package/lib/esm/provider/logger/logger.redaction.js +450 -0
- package/lib/esm/provider/logger/logger.suggestions.js +471 -0
- package/lib/esm/provider/logger/transports/console.transport.js +81 -0
- package/lib/esm/provider/logger/transports/file.transport.js +291 -0
- package/lib/esm/provider/logger/transports/http-server.js +141 -0
- package/lib/esm/provider/logger/transports/http.transport.js +157 -0
- package/lib/esm/provider/logger/transports/index.js +5 -0
- package/lib/esm/provider/logger/transports/transport.interface.js +1 -0
- package/lib/esm/provider/logger/utils/index.js +2 -0
- package/lib/esm/provider/logger/utils/log-entry.js +23 -0
- package/lib/esm/provider/logger/utils/log-levels.js +100 -0
- package/lib/esm/provider/provider-manager.js +283 -0
- package/lib/esm/provider/provider-registry.js +411 -0
- package/lib/esm/provider/provider.interface.js +44 -0
- package/lib/esm/provider/validation/adapters/class-validator.adapter.js +258 -0
- package/lib/esm/provider/validation/adapters/index.js +10 -0
- package/lib/esm/provider/validation/helpful-error-formatter.js +225 -0
- package/lib/esm/provider/validation/index.js +21 -0
- package/lib/esm/provider/validation/smart-field-detector.js +539 -0
- package/lib/esm/provider/validation/type-inference.js +183 -0
- package/lib/esm/provider/validation/validation-registry.js +214 -0
- package/lib/esm/provider/validation/validation.interface.js +8 -0
- package/lib/esm/render/adapters/base-adapter.js +131 -0
- package/lib/esm/render/adapters/ejs-adapter.js +142 -0
- package/lib/esm/render/adapters/handlebars-adapter.js +161 -0
- package/lib/esm/render/adapters/index.js +12 -0
- package/lib/esm/render/adapters/pug-adapter.js +134 -0
- package/lib/esm/render/adapters/react-adapter.js +303 -0
- package/lib/esm/render/features/auto-detection.js +202 -0
- package/lib/esm/render/features/hot-reload.js +153 -0
- package/lib/esm/render/features/index.js +12 -0
- package/lib/esm/render/features/streaming.js +103 -0
- package/lib/esm/render/features/type-generator.js +195 -0
- package/lib/esm/render/features/view-debugger.js +172 -0
- package/lib/esm/render/index.js +54 -0
- package/lib/esm/render/presets/index.js +207 -0
- package/lib/esm/render/render-config.js +9 -0
- package/lib/esm/render/render-interface.js +1 -0
- package/lib/esm/render/render-registry.js +124 -0
- package/lib/esm/render/render-service.js +394 -0
- package/lib/esm/render/utils/cache-manager.js +196 -0
- package/lib/esm/render/utils/index.js +10 -0
- package/lib/esm/render/utils/package-resolver.js +118 -0
- package/lib/esm/render/utils/view-scanner.js +178 -0
- package/lib/esm/testing/create-test-app.js +365 -0
- package/lib/esm/testing/create-test-database.js +411 -0
- package/lib/esm/testing/fluent-request.js +452 -0
- package/lib/esm/testing/index.js +102 -0
- package/lib/esm/testing/load-test.js +479 -0
- package/lib/esm/testing/matchers.js +440 -0
- package/lib/esm/testing/mock-context.js +400 -0
- package/lib/esm/testing/mock-provider.js +333 -0
- package/lib/esm/testing/snapshot-request.js +356 -0
- package/lib/esm/testing/testing.interfaces.js +9 -0
- package/lib/esm/types/application/application-container.d.ts +352 -0
- package/lib/esm/types/application/application-factory.d.ts +118 -0
- package/lib/esm/types/application/application.types.d.ts +185 -0
- package/lib/esm/types/application/bootstrap.d.ts +484 -0
- package/lib/esm/types/application/index.d.ts +4 -0
- package/lib/esm/types/authorization/authorization-config.interface.d.ts +45 -0
- package/lib/esm/types/authorization/decorators/convenience.d.ts +64 -0
- package/lib/esm/types/authorization/guard-constants.d.ts +9 -0
- package/lib/esm/types/authorization/guard-decorators.d.ts +128 -0
- package/lib/esm/types/authorization/guard-executor.d.ts +26 -0
- package/lib/esm/types/authorization/guard-registry.d.ts +35 -0
- package/lib/esm/types/authorization/guard.interface.d.ts +335 -0
- package/lib/esm/types/authorization/guards/attribute-based.guard.d.ts +60 -0
- package/lib/esm/types/authorization/guards/authenticated.guard.d.ts +26 -0
- package/lib/esm/types/authorization/guards/composition.guard.d.ts +42 -0
- package/lib/esm/types/authorization/guards/conditional.guard.d.ts +21 -0
- package/lib/esm/types/authorization/guards/index.d.ts +7 -0
- package/lib/esm/types/authorization/guards/permission.guard.d.ts +29 -0
- package/lib/esm/types/authorization/guards/resource-owner.guard.d.ts +29 -0
- package/lib/esm/types/authorization/guards/role.guard.d.ts +28 -0
- package/lib/esm/types/authorization/index.d.ts +18 -0
- package/lib/esm/types/authorization/services/guard-cache.d.ts +26 -0
- package/lib/esm/types/authorization/services/guard-cache.interface.d.ts +29 -0
- package/lib/esm/types/authorization/services/permission-hierarchy.d.ts +21 -0
- package/lib/esm/types/authorization/services/permission-hierarchy.interface.d.ts +22 -0
- package/lib/esm/types/authorization/services/permission-service.d.ts +21 -0
- package/lib/esm/types/authorization/services/permission-service.interface.d.ts +19 -0
- package/lib/esm/types/authorization/services/security-context.d.ts +32 -0
- package/lib/esm/types/authorization/services/security-context.interface.d.ts +25 -0
- package/lib/esm/types/authorization/setup.d.ts +84 -0
- package/lib/esm/types/config/config-resolver.d.ts +40 -0
- package/lib/esm/types/config/config.interfaces.d.ts +570 -0
- package/lib/esm/types/config/define-config.d.ts +109 -0
- package/lib/esm/types/config/env-field-builders.d.ts +288 -0
- package/lib/esm/types/config/index.d.ts +61 -0
- package/lib/esm/types/config/secret-value.d.ts +99 -0
- package/lib/esm/types/console/color-codes.d.ts +29 -0
- package/lib/esm/types/console/console.d.ts +83 -0
- package/lib/esm/types/console/index.d.ts +2 -0
- package/lib/esm/types/container-module/container-module.d.ts +242 -0
- package/lib/esm/types/container-module/index.d.ts +1 -0
- package/lib/esm/types/decorator/index.d.ts +1 -0
- package/lib/esm/types/decorator/scope-binding.d.ts +374 -0
- package/lib/esm/types/di/annotation/decorator_utils.d.ts +16 -0
- package/lib/esm/types/di/annotation/inject.d.ts +16 -0
- package/lib/esm/types/di/annotation/inject_base.d.ts +3 -0
- package/lib/esm/types/di/annotation/injectable.d.ts +7 -0
- package/lib/esm/types/di/annotation/lazy_service_identifier.d.ts +7 -0
- package/lib/esm/types/di/annotation/multi_inject.d.ts +2 -0
- package/lib/esm/types/di/annotation/named.d.ts +2 -0
- package/lib/esm/types/di/annotation/optional.d.ts +2 -0
- package/lib/esm/types/di/annotation/post_construct.d.ts +4 -0
- package/lib/esm/types/di/annotation/pre_destroy.d.ts +4 -0
- package/lib/esm/types/di/annotation/property_event_decorator.d.ts +4 -0
- package/lib/esm/types/di/annotation/tagged.d.ts +2 -0
- package/lib/esm/types/di/annotation/target_name.d.ts +3 -0
- package/lib/esm/types/di/annotation/unmanaged.d.ts +3 -0
- package/lib/esm/types/di/binding-decorator/constants.d.ts +7 -0
- package/lib/esm/types/di/binding-decorator/decorator/fluent_provide.d.ts +4 -0
- package/lib/esm/types/di/binding-decorator/decorator/provide.d.ts +4 -0
- package/lib/esm/types/di/binding-decorator/factory/module_factory.d.ts +23 -0
- package/lib/esm/types/di/binding-decorator/index.d.ts +10 -0
- package/lib/esm/types/di/binding-decorator/interfaces/interfaces.d.ts +40 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_done_syntax.d.ts +7 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_in_syntax.d.ts +12 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_in_when_on_syntax.d.ts +28 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_on_syntax.d.ts +10 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_when_on_syntax.d.ts +24 -0
- package/lib/esm/types/di/binding-decorator/syntax/provide_when_syntax.d.ts +23 -0
- package/lib/esm/types/di/binding-decorator/utils/auto_wire.d.ts +3 -0
- package/lib/esm/types/di/bindings/binding.d.ts +20 -0
- package/lib/esm/types/di/bindings/binding_count.d.ts +5 -0
- package/lib/esm/types/di/constants/error_msgs.d.ts +32 -0
- package/lib/esm/types/di/constants/literal_types.d.ts +5 -0
- package/lib/esm/types/di/constants/metadata_keys.d.ts +13 -0
- package/lib/esm/types/di/container/container.d.ts +73 -0
- package/lib/esm/types/di/container/container_module.d.ts +11 -0
- package/lib/esm/types/di/container/container_snapshot.d.ts +10 -0
- package/lib/esm/types/di/container/lookup.d.ts +16 -0
- package/lib/esm/types/di/container/module_activation_store.d.ts +10 -0
- package/lib/esm/types/di/container-introspection.d.ts +25 -0
- package/lib/esm/types/di/interfaces/interfaces.d.ts +300 -0
- package/lib/esm/types/di/inversify.d.ts +54 -0
- package/lib/esm/types/di/planning/context.d.ts +11 -0
- package/lib/esm/types/di/planning/metadata.d.ts +8 -0
- package/lib/esm/types/di/planning/metadata_reader.d.ts +6 -0
- package/lib/esm/types/di/planning/plan.d.ts +7 -0
- package/lib/esm/types/di/planning/planner.d.ts +5 -0
- package/lib/esm/types/di/planning/queryable_string.d.ts +11 -0
- package/lib/esm/types/di/planning/reflection_utils.d.ts +5 -0
- package/lib/esm/types/di/planning/request.d.ts +14 -0
- package/lib/esm/types/di/planning/target.d.ts +23 -0
- package/lib/esm/types/di/resolution/instantiation.d.ts +3 -0
- package/lib/esm/types/di/resolution/resolver.d.ts +3 -0
- package/lib/esm/types/di/scope/scope-registry.d.ts +91 -0
- package/lib/esm/types/di/scope/scope.d.ts +3 -0
- package/lib/esm/types/di/syntax/binding_in_syntax.d.ts +10 -0
- package/lib/esm/types/di/syntax/binding_in_when_on_syntax.d.ts +30 -0
- package/lib/esm/types/di/syntax/binding_on_syntax.d.ts +8 -0
- package/lib/esm/types/di/syntax/binding_to_syntax.d.ts +18 -0
- package/lib/esm/types/di/syntax/binding_when_on_syntax.d.ts +25 -0
- package/lib/esm/types/di/syntax/binding_when_syntax.d.ts +21 -0
- package/lib/esm/types/di/syntax/constraint_helpers.d.ts +6 -0
- package/lib/esm/types/di/utils/async.d.ts +3 -0
- package/lib/esm/types/di/utils/binding_utils.d.ts +4 -0
- package/lib/esm/types/di/utils/clonable.d.ts +3 -0
- package/lib/esm/types/di/utils/exceptions.d.ts +2 -0
- package/lib/esm/types/di/utils/factory_type.d.ts +5 -0
- package/lib/esm/types/di/utils/id.d.ts +2 -0
- package/lib/esm/types/di/utils/js.d.ts +1 -0
- package/lib/esm/types/di/utils/serialization.d.ts +10 -0
- package/lib/esm/types/error/app-error.d.ts +177 -0
- package/lib/esm/types/error/base-exception-filter.d.ts +73 -0
- package/lib/esm/types/error/error-handler-middleware.d.ts +11 -0
- package/lib/esm/types/error/exception-filter-constants.d.ts +9 -0
- package/lib/esm/types/error/exception-filter-decorators.d.ts +126 -0
- package/lib/esm/types/error/exception-filter-registry.d.ts +38 -0
- package/lib/esm/types/error/exception-filter.interface.d.ts +82 -0
- package/lib/esm/types/error/exception-handler-middleware.d.ts +35 -0
- package/lib/esm/types/error/filters/app-error.filter.d.ts +10 -0
- package/lib/esm/types/error/filters/global-exception.filter.d.ts +9 -0
- package/lib/esm/types/error/filters/not-found.filter.d.ts +10 -0
- package/lib/esm/types/error/filters/validation-error.filter.d.ts +10 -0
- package/lib/esm/types/error/index.d.ts +14 -0
- package/lib/esm/types/error/not-found.error.d.ts +7 -0
- package/lib/esm/types/error/report.d.ts +105 -0
- package/lib/esm/types/error/status-code.d.ts +156 -0
- package/lib/esm/types/error/utils.d.ts +17 -0
- package/lib/esm/types/error/validation.error.d.ts +8 -0
- package/lib/esm/types/event/event-decorators.d.ts +199 -0
- package/lib/esm/types/event/event-emitter.d.ts +109 -0
- package/lib/esm/types/event/event-flow-tracker.d.ts +88 -0
- package/lib/esm/types/event/event-recorder.d.ts +121 -0
- package/lib/esm/types/event/event-registry.d.ts +84 -0
- package/lib/esm/types/event/event.interfaces.d.ts +528 -0
- package/lib/esm/types/event/index.d.ts +55 -0
- package/lib/esm/types/index.d.ts +27 -0
- package/lib/esm/types/interceptor/conditional-interceptor.d.ts +91 -0
- package/lib/esm/types/interceptor/execution-context.d.ts +41 -0
- package/lib/esm/types/interceptor/index.d.ts +41 -0
- package/lib/esm/types/interceptor/interceptor-composition.d.ts +115 -0
- package/lib/esm/types/interceptor/interceptor-constants.d.ts +17 -0
- package/lib/esm/types/interceptor/interceptor-decorators.d.ts +124 -0
- package/lib/esm/types/interceptor/interceptor-executor.d.ts +46 -0
- package/lib/esm/types/interceptor/interceptor-registry.d.ts +65 -0
- package/lib/esm/types/interceptor/interceptor.interface.d.ts +281 -0
- package/lib/esm/types/interceptor/interceptors/index.d.ts +6 -0
- package/lib/esm/types/interceptor/interceptors/logging.interceptor.d.ts +28 -0
- package/lib/esm/types/interceptor/interceptors/performance.interceptor.d.ts +197 -0
- package/lib/esm/types/interceptor/interceptors/timeout.interceptor.d.ts +42 -0
- package/lib/esm/types/lazy-loading/index.d.ts +42 -0
- package/lib/esm/types/lazy-loading/lazy-load-metrics.d.ts +139 -0
- package/lib/esm/types/lazy-loading/lazy-module-loader.d.ts +169 -0
- package/lib/esm/types/lazy-loading/lazy-module-manager.d.ts +148 -0
- package/lib/esm/types/lazy-loading/lazy-module-warmup.d.ts +130 -0
- package/lib/esm/types/lazy-loading/lazy-module.d.ts +168 -0
- package/lib/esm/types/lazy-loading/lazy.interfaces.d.ts +480 -0
- package/lib/esm/types/lifecycle/index.d.ts +9 -0
- package/lib/esm/types/lifecycle/lifecycle-registry.d.ts +213 -0
- package/lib/esm/types/lifecycle/lifecycle.interface.d.ts +191 -0
- package/lib/esm/types/middleware/content-negotiation/accept-header-parser.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/content-negotiation-service.d.ts +64 -0
- package/lib/esm/types/middleware/content-negotiation/formatter-registry.d.ts +60 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/csv-formatter.d.ts +34 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/index.d.ts +8 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/json-formatter.d.ts +14 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/plain-text-formatter.d.ts +12 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/xml-formatter.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/formatters/yaml-formatter.d.ts +26 -0
- package/lib/esm/types/middleware/content-negotiation/index.d.ts +7 -0
- package/lib/esm/types/middleware/index.d.ts +25 -0
- package/lib/esm/types/middleware/interfaces/body-parser.interface.d.ts +31 -0
- package/lib/esm/types/middleware/interfaces/compression.interface.d.ts +98 -0
- package/lib/esm/types/middleware/interfaces/content-negotiation.interface.d.ts +142 -0
- package/lib/esm/types/middleware/interfaces/cookie-parser.interface.d.ts +9 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +57 -0
- package/lib/esm/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +27 -0
- package/lib/esm/types/middleware/interfaces/cors.interface.d.ts +57 -0
- package/lib/esm/types/middleware/interfaces/express-rate-limit.interface.d.ts +292 -0
- package/lib/esm/types/middleware/interfaces/express-session.interface.d.ts +207 -0
- package/lib/esm/types/middleware/interfaces/helmet.interface.d.ts +210 -0
- package/lib/esm/types/middleware/interfaces/morgan.interface.d.ts +39 -0
- package/lib/esm/types/middleware/interfaces/multer.interface.d.ts +253 -0
- package/lib/esm/types/middleware/interfaces/serve-favicon.interface.d.ts +11 -0
- package/lib/esm/types/middleware/interfaces/serve-static.interface.d.ts +69 -0
- package/lib/esm/types/middleware/interfaces/url-encoded.interface.d.ts +37 -0
- package/lib/esm/types/middleware/middleware-config.d.ts +574 -0
- package/lib/esm/types/middleware/middleware-interface.d.ts +691 -0
- package/lib/esm/types/middleware/middleware-presets.d.ts +90 -0
- package/lib/esm/types/middleware/middleware-profiler.d.ts +199 -0
- package/lib/esm/types/middleware/middleware-registry.d.ts +103 -0
- package/lib/esm/types/middleware/middleware-resolver.d.ts +159 -0
- package/lib/esm/types/middleware/middleware-service.d.ts +767 -0
- package/lib/esm/types/middleware/middleware-utils.d.ts +145 -0
- package/lib/esm/types/middleware/upload-registry.d.ts +50 -0
- package/lib/esm/types/path-resolver/index.d.ts +80 -0
- package/lib/esm/types/provider/db-in-memory/adapter/adapter.interface.d.ts +222 -0
- package/lib/esm/types/provider/db-in-memory/adapter/in-memory.adapter.d.ts +239 -0
- package/lib/esm/types/provider/db-in-memory/adapter/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/base-repo.repository.d.ts +18 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.interface.d.ts +43 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.provider.d.ts +39 -0
- package/lib/esm/types/provider/db-in-memory/db-in-memory.types.d.ts +14 -0
- package/lib/esm/types/provider/db-in-memory/db.provider.d.ts +281 -0
- package/lib/esm/types/provider/db-in-memory/index.d.ts +63 -0
- package/lib/esm/types/provider/db-in-memory/query/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/query/query-engine.d.ts +101 -0
- package/lib/esm/types/provider/db-in-memory/query/query.types.d.ts +318 -0
- package/lib/esm/types/provider/db-in-memory/schema/decorators.d.ts +314 -0
- package/lib/esm/types/provider/db-in-memory/schema/entity.interface.d.ts +60 -0
- package/lib/esm/types/provider/db-in-memory/schema/index.d.ts +6 -0
- package/lib/esm/types/provider/db-in-memory/storage/index.d.ts +5 -0
- package/lib/esm/types/provider/db-in-memory/storage/memory-store.d.ts +326 -0
- package/lib/esm/types/provider/dto-validator/dto-validator.provider.d.ts +10 -0
- package/lib/esm/types/provider/dto-validator/package-resolver.d.ts +7 -0
- package/lib/esm/types/provider/index.d.ts +7 -0
- package/lib/esm/types/provider/logger/decorators/index.d.ts +1 -0
- package/lib/esm/types/provider/logger/decorators/log-performance.decorator.d.ts +49 -0
- package/lib/esm/types/provider/logger/index.d.ts +17 -0
- package/lib/esm/types/provider/logger/logger.banner.d.ts +94 -0
- package/lib/esm/types/provider/logger/logger.config.d.ts +55 -0
- package/lib/esm/types/provider/logger/logger.context.d.ts +189 -0
- package/lib/esm/types/provider/logger/logger.flow.d.ts +165 -0
- package/lib/esm/types/provider/logger/logger.formatter.d.ts +44 -0
- package/lib/esm/types/provider/logger/logger.grouping.d.ts +124 -0
- package/lib/esm/types/provider/logger/logger.health.d.ts +123 -0
- package/lib/esm/types/provider/logger/logger.metrics-collector.d.ts +44 -0
- package/lib/esm/types/provider/logger/logger.metrics.d.ts +162 -0
- package/lib/esm/types/provider/logger/logger.performance.d.ts +179 -0
- package/lib/esm/types/provider/logger/logger.provider.d.ts +332 -0
- package/lib/esm/types/provider/logger/logger.query.d.ts +232 -0
- package/lib/esm/types/provider/logger/logger.redaction.d.ts +169 -0
- package/lib/esm/types/provider/logger/logger.suggestions.d.ts +124 -0
- package/lib/esm/types/provider/logger/transports/console.transport.d.ts +49 -0
- package/lib/esm/types/provider/logger/transports/file.transport.d.ts +87 -0
- package/lib/esm/types/provider/logger/transports/http-server.d.ts +88 -0
- package/lib/esm/types/provider/logger/transports/http.transport.d.ts +74 -0
- package/lib/esm/types/provider/logger/transports/index.d.ts +5 -0
- package/lib/esm/types/provider/logger/transports/transport.interface.d.ts +31 -0
- package/lib/esm/types/provider/logger/utils/index.d.ts +2 -0
- package/lib/esm/types/provider/logger/utils/log-entry.d.ts +82 -0
- package/lib/esm/types/provider/logger/utils/log-levels.d.ts +53 -0
- package/lib/esm/types/provider/provider-manager.d.ts +208 -0
- package/lib/esm/types/provider/provider-registry.d.ts +192 -0
- package/lib/esm/types/provider/provider.interface.d.ts +337 -0
- package/lib/esm/types/provider/validation/adapters/class-validator.adapter.d.ts +68 -0
- package/lib/esm/types/provider/validation/adapters/index.d.ts +10 -0
- package/lib/esm/types/provider/validation/helpful-error-formatter.d.ts +110 -0
- package/lib/esm/types/provider/validation/index.d.ts +19 -0
- package/lib/esm/types/provider/validation/smart-field-detector.d.ts +91 -0
- package/lib/esm/types/provider/validation/type-inference.d.ts +81 -0
- package/lib/esm/types/provider/validation/validation-registry.d.ts +105 -0
- package/lib/esm/types/provider/validation/validation.interface.d.ts +178 -0
- package/lib/esm/types/render/adapters/base-adapter.d.ts +95 -0
- package/lib/esm/types/render/adapters/ejs-adapter.d.ts +57 -0
- package/lib/esm/types/render/adapters/handlebars-adapter.d.ts +74 -0
- package/lib/esm/types/render/adapters/index.d.ts +12 -0
- package/lib/esm/types/render/adapters/pug-adapter.d.ts +57 -0
- package/lib/esm/types/render/adapters/react-adapter.d.ts +99 -0
- package/lib/esm/types/render/features/auto-detection.d.ts +58 -0
- package/lib/esm/types/render/features/hot-reload.d.ts +65 -0
- package/lib/esm/types/render/features/index.d.ts +12 -0
- package/lib/esm/types/render/features/streaming.d.ts +39 -0
- package/lib/esm/types/render/features/type-generator.d.ts +64 -0
- package/lib/esm/types/render/features/view-debugger.d.ts +42 -0
- package/lib/esm/types/render/index.d.ts +50 -0
- package/lib/esm/types/render/presets/index.d.ts +119 -0
- package/lib/esm/types/render/render-config.d.ts +213 -0
- package/lib/esm/types/render/render-interface.d.ts +126 -0
- package/lib/esm/types/render/render-registry.d.ts +86 -0
- package/lib/esm/types/render/render-service.d.ts +157 -0
- package/lib/esm/types/render/utils/cache-manager.d.ts +106 -0
- package/lib/esm/types/render/utils/index.d.ts +11 -0
- package/lib/esm/types/render/utils/package-resolver.d.ts +57 -0
- package/lib/esm/types/render/utils/view-scanner.d.ts +74 -0
- package/lib/esm/types/testing/create-test-app.d.ts +71 -0
- package/lib/esm/types/testing/create-test-database.d.ts +100 -0
- package/lib/esm/types/testing/fluent-request.d.ts +37 -0
- package/lib/esm/types/testing/index.d.ts +93 -0
- package/lib/esm/types/testing/load-test.d.ts +139 -0
- package/lib/esm/types/testing/matchers.d.ts +184 -0
- package/lib/esm/types/testing/mock-context.d.ts +117 -0
- package/lib/esm/types/testing/mock-provider.d.ts +93 -0
- package/lib/esm/types/testing/snapshot-request.d.ts +46 -0
- package/lib/esm/types/testing/testing.interfaces.d.ts +948 -0
- package/lib/esm/types/utils/node-require.d.ts +11 -0
- package/lib/esm/utils/node-require.js +56 -0
- package/lib/package.json +152 -151
- package/package.json +152 -151
- package/lib/cjs/provider/environment/env-validator.provider.js +0 -100
- package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +0 -39
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import { Binding } from "../bindings/binding.js";
|
|
2
|
+
import * as ERROR_MSGS from "../constants/error_msgs.js";
|
|
3
|
+
import { Scope, TargetTypeEnum } from "../constants/literal_types.js";
|
|
4
|
+
import * as METADATA_KEY from "../constants/metadata_keys.js";
|
|
5
|
+
import { MetadataReader } from "../planning/metadata_reader.js";
|
|
6
|
+
import { createMockRequest, getBindingDictionary, plan, } from "../planning/planner.js";
|
|
7
|
+
import { resolve } from "../resolution/resolver.js";
|
|
8
|
+
import { BindingToSyntax } from "../syntax/binding_to_syntax.js";
|
|
9
|
+
import { isPromise, isPromiseOrContainsPromise } from "../utils/async.js";
|
|
10
|
+
import { id } from "../utils/id.js";
|
|
11
|
+
import { getServiceIdentifierAsString } from "../utils/serialization.js";
|
|
12
|
+
import { ContainerSnapshot } from "./container_snapshot.js";
|
|
13
|
+
import { Lookup } from "./lookup.js";
|
|
14
|
+
import { ModuleActivationStore } from "./module_activation_store.js";
|
|
15
|
+
class Container {
|
|
16
|
+
id;
|
|
17
|
+
parent;
|
|
18
|
+
options;
|
|
19
|
+
_middleware;
|
|
20
|
+
_bindingDictionary;
|
|
21
|
+
_activations;
|
|
22
|
+
_deactivations;
|
|
23
|
+
_snapshots;
|
|
24
|
+
_metadataReader;
|
|
25
|
+
_moduleActivationStore;
|
|
26
|
+
static merge(container1, container2, ...containers) {
|
|
27
|
+
const container = new Container();
|
|
28
|
+
const targetContainers = [container1, container2, ...containers].map((targetContainer) => getBindingDictionary(targetContainer));
|
|
29
|
+
const bindingDictionary = getBindingDictionary(container);
|
|
30
|
+
function copyDictionary(origin, destination) {
|
|
31
|
+
origin.traverse((_key, value) => {
|
|
32
|
+
value.forEach((binding) => {
|
|
33
|
+
destination.add(binding.serviceIdentifier, binding.clone());
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
targetContainers.forEach((targetBindingDictionary) => {
|
|
38
|
+
copyDictionary(targetBindingDictionary, bindingDictionary);
|
|
39
|
+
});
|
|
40
|
+
return container;
|
|
41
|
+
}
|
|
42
|
+
constructor(containerOptions) {
|
|
43
|
+
const options = containerOptions || {};
|
|
44
|
+
if (typeof options !== "object") {
|
|
45
|
+
throw new Error(`${ERROR_MSGS.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT}`);
|
|
46
|
+
}
|
|
47
|
+
if (options.defaultScope === undefined) {
|
|
48
|
+
options.defaultScope = Scope.Transient;
|
|
49
|
+
}
|
|
50
|
+
else if (options.defaultScope !== Scope.Singleton &&
|
|
51
|
+
options.defaultScope !== Scope.Transient &&
|
|
52
|
+
options.defaultScope !== Scope.Request) {
|
|
53
|
+
throw new Error(`${ERROR_MSGS.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE}`);
|
|
54
|
+
}
|
|
55
|
+
if (options.autoBindInjectable === undefined) {
|
|
56
|
+
options.autoBindInjectable = false;
|
|
57
|
+
}
|
|
58
|
+
else if (typeof options.autoBindInjectable !== "boolean") {
|
|
59
|
+
throw new Error(`${ERROR_MSGS.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE}`);
|
|
60
|
+
}
|
|
61
|
+
if (options.skipBaseClassChecks === undefined) {
|
|
62
|
+
options.skipBaseClassChecks = false;
|
|
63
|
+
}
|
|
64
|
+
else if (typeof options.skipBaseClassChecks !== "boolean") {
|
|
65
|
+
throw new Error(`${ERROR_MSGS.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK}`);
|
|
66
|
+
}
|
|
67
|
+
this.options = {
|
|
68
|
+
autoBindInjectable: options.autoBindInjectable,
|
|
69
|
+
defaultScope: options.defaultScope,
|
|
70
|
+
skipBaseClassChecks: options.skipBaseClassChecks,
|
|
71
|
+
};
|
|
72
|
+
this.id = id();
|
|
73
|
+
this._bindingDictionary = new Lookup();
|
|
74
|
+
this._snapshots = [];
|
|
75
|
+
this._middleware = null;
|
|
76
|
+
this._activations = new Lookup();
|
|
77
|
+
this._deactivations = new Lookup();
|
|
78
|
+
this.parent = null;
|
|
79
|
+
this._metadataReader = new MetadataReader();
|
|
80
|
+
this._moduleActivationStore = new ModuleActivationStore();
|
|
81
|
+
}
|
|
82
|
+
load(...modules) {
|
|
83
|
+
const getHelpers = this._getContainerModuleHelpersFactory();
|
|
84
|
+
for (const currentModule of modules) {
|
|
85
|
+
const containerModuleHelpers = getHelpers(currentModule.id);
|
|
86
|
+
currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction, containerModuleHelpers.unbindAsyncFunction, containerModuleHelpers.onActivationFunction, containerModuleHelpers.onDeactivationFunction);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async loadAsync(...modules) {
|
|
90
|
+
const getHelpers = this._getContainerModuleHelpersFactory();
|
|
91
|
+
for (const currentModule of modules) {
|
|
92
|
+
const containerModuleHelpers = getHelpers(currentModule.id);
|
|
93
|
+
await currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction, containerModuleHelpers.unbindAsyncFunction, containerModuleHelpers.onActivationFunction, containerModuleHelpers.onDeactivationFunction);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
unload(...modules) {
|
|
97
|
+
modules.forEach((module) => {
|
|
98
|
+
const deactivations = this._removeModuleBindings(module.id);
|
|
99
|
+
this._deactivateSingletons(deactivations);
|
|
100
|
+
this._removeModuleHandlers(module.id);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async unloadAsync(...modules) {
|
|
104
|
+
for (const module of modules) {
|
|
105
|
+
const deactivations = this._removeModuleBindings(module.id);
|
|
106
|
+
await this._deactivateSingletonsAsync(deactivations);
|
|
107
|
+
this._removeModuleHandlers(module.id);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Registers a type binding
|
|
111
|
+
bind(serviceIdentifier) {
|
|
112
|
+
const scope = this.options.defaultScope || Scope.Transient;
|
|
113
|
+
const binding = new Binding(serviceIdentifier, scope);
|
|
114
|
+
this._bindingDictionary.add(serviceIdentifier, binding);
|
|
115
|
+
return new BindingToSyntax(binding);
|
|
116
|
+
}
|
|
117
|
+
rebind(serviceIdentifier) {
|
|
118
|
+
this.unbind(serviceIdentifier);
|
|
119
|
+
return this.bind(serviceIdentifier);
|
|
120
|
+
}
|
|
121
|
+
async rebindAsync(serviceIdentifier) {
|
|
122
|
+
await this.unbindAsync(serviceIdentifier);
|
|
123
|
+
return this.bind(serviceIdentifier);
|
|
124
|
+
}
|
|
125
|
+
// Removes a type binding from the registry by its key
|
|
126
|
+
unbind(serviceIdentifier) {
|
|
127
|
+
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
128
|
+
const bindings = this._bindingDictionary.get(serviceIdentifier);
|
|
129
|
+
this._deactivateSingletons(bindings);
|
|
130
|
+
}
|
|
131
|
+
this._removeServiceFromDictionary(serviceIdentifier);
|
|
132
|
+
}
|
|
133
|
+
async unbindAsync(serviceIdentifier) {
|
|
134
|
+
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
135
|
+
const bindings = this._bindingDictionary.get(serviceIdentifier);
|
|
136
|
+
await this._deactivateSingletonsAsync(bindings);
|
|
137
|
+
}
|
|
138
|
+
this._removeServiceFromDictionary(serviceIdentifier);
|
|
139
|
+
}
|
|
140
|
+
// Removes all the type bindings from the registry
|
|
141
|
+
unbindAll() {
|
|
142
|
+
this._bindingDictionary.traverse((_key, value) => {
|
|
143
|
+
this._deactivateSingletons(value);
|
|
144
|
+
});
|
|
145
|
+
this._bindingDictionary = new Lookup();
|
|
146
|
+
}
|
|
147
|
+
async unbindAllAsync() {
|
|
148
|
+
const promises = [];
|
|
149
|
+
this._bindingDictionary.traverse((_key, value) => {
|
|
150
|
+
promises.push(this._deactivateSingletonsAsync(value));
|
|
151
|
+
});
|
|
152
|
+
await Promise.all(promises);
|
|
153
|
+
this._bindingDictionary = new Lookup();
|
|
154
|
+
}
|
|
155
|
+
onActivation(serviceIdentifier, onActivation) {
|
|
156
|
+
this._activations.add(serviceIdentifier, onActivation);
|
|
157
|
+
}
|
|
158
|
+
onDeactivation(serviceIdentifier, onDeactivation) {
|
|
159
|
+
this._deactivations.add(serviceIdentifier, onDeactivation);
|
|
160
|
+
}
|
|
161
|
+
// Allows to check if there are bindings available for serviceIdentifier
|
|
162
|
+
isBound(serviceIdentifier) {
|
|
163
|
+
let bound = this._bindingDictionary.hasKey(serviceIdentifier);
|
|
164
|
+
if (!bound && this.parent) {
|
|
165
|
+
bound = this.parent.isBound(serviceIdentifier);
|
|
166
|
+
}
|
|
167
|
+
return bound;
|
|
168
|
+
}
|
|
169
|
+
// check binding dependency only in current container
|
|
170
|
+
isCurrentBound(serviceIdentifier) {
|
|
171
|
+
return this._bindingDictionary.hasKey(serviceIdentifier);
|
|
172
|
+
}
|
|
173
|
+
isBoundNamed(serviceIdentifier, named) {
|
|
174
|
+
return this.isBoundTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
175
|
+
}
|
|
176
|
+
// Check if a binding with a complex constraint is available without throwing a error. Ancestors are also verified.
|
|
177
|
+
isBoundTagged(serviceIdentifier, key, value) {
|
|
178
|
+
let bound = false;
|
|
179
|
+
// verify if there are bindings available for serviceIdentifier on current binding dictionary
|
|
180
|
+
if (this._bindingDictionary.hasKey(serviceIdentifier)) {
|
|
181
|
+
const bindings = this._bindingDictionary.get(serviceIdentifier);
|
|
182
|
+
const request = createMockRequest(this, serviceIdentifier, key, value);
|
|
183
|
+
bound = bindings.some((b) => b.constraint(request));
|
|
184
|
+
}
|
|
185
|
+
// verify if there is a parent container that could solve the request
|
|
186
|
+
if (!bound && this.parent) {
|
|
187
|
+
bound = this.parent.isBoundTagged(serviceIdentifier, key, value);
|
|
188
|
+
}
|
|
189
|
+
return bound;
|
|
190
|
+
}
|
|
191
|
+
snapshot() {
|
|
192
|
+
this._snapshots.push(ContainerSnapshot.of(this._bindingDictionary.clone(), this._middleware, this._activations.clone(), this._deactivations.clone(), this._moduleActivationStore.clone()));
|
|
193
|
+
}
|
|
194
|
+
restore() {
|
|
195
|
+
const snapshot = this._snapshots.pop();
|
|
196
|
+
if (snapshot === undefined) {
|
|
197
|
+
throw new Error(ERROR_MSGS.NO_MORE_SNAPSHOTS_AVAILABLE);
|
|
198
|
+
}
|
|
199
|
+
this._bindingDictionary = snapshot.bindings;
|
|
200
|
+
this._activations = snapshot.activations;
|
|
201
|
+
this._deactivations = snapshot.deactivations;
|
|
202
|
+
this._middleware = snapshot.middleware;
|
|
203
|
+
this._moduleActivationStore = snapshot.moduleActivationStore;
|
|
204
|
+
}
|
|
205
|
+
createChild(containerOptions) {
|
|
206
|
+
const child = new Container(containerOptions || this.options);
|
|
207
|
+
child.parent = this;
|
|
208
|
+
return child;
|
|
209
|
+
}
|
|
210
|
+
applyMiddleware(...middlewares) {
|
|
211
|
+
const initial = this._middleware
|
|
212
|
+
? this._middleware
|
|
213
|
+
: this._planAndResolve();
|
|
214
|
+
this._middleware = middlewares.reduce((prev, curr) => curr(prev), initial);
|
|
215
|
+
}
|
|
216
|
+
applyCustomMetadataReader(metadataReader) {
|
|
217
|
+
this._metadataReader = metadataReader;
|
|
218
|
+
}
|
|
219
|
+
// Resolves a dependency by its runtime identifier
|
|
220
|
+
// The runtime identifier must be associated with only one binding
|
|
221
|
+
// use getAll when the runtime identifier is associated with multiple bindings
|
|
222
|
+
get(serviceIdentifier) {
|
|
223
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, false);
|
|
224
|
+
return this._getButThrowIfAsync(getArgs);
|
|
225
|
+
}
|
|
226
|
+
async getAsync(serviceIdentifier) {
|
|
227
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, false);
|
|
228
|
+
return this._get(getArgs);
|
|
229
|
+
}
|
|
230
|
+
getTagged(serviceIdentifier, key, value) {
|
|
231
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, false, key, value);
|
|
232
|
+
return this._getButThrowIfAsync(getArgs);
|
|
233
|
+
}
|
|
234
|
+
async getTaggedAsync(serviceIdentifier, key, value) {
|
|
235
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, false, key, value);
|
|
236
|
+
return this._get(getArgs);
|
|
237
|
+
}
|
|
238
|
+
getNamed(serviceIdentifier, named) {
|
|
239
|
+
return this.getTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
240
|
+
}
|
|
241
|
+
getNamedAsync(serviceIdentifier, named) {
|
|
242
|
+
return this.getTaggedAsync(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
243
|
+
}
|
|
244
|
+
// Resolves a dependency by its runtime identifier
|
|
245
|
+
// The runtime identifier can be associated with one or multiple bindings
|
|
246
|
+
getAll(serviceIdentifier) {
|
|
247
|
+
const getArgs = this._getAllArgs(serviceIdentifier);
|
|
248
|
+
return this._getButThrowIfAsync(getArgs);
|
|
249
|
+
}
|
|
250
|
+
getAllAsync(serviceIdentifier) {
|
|
251
|
+
const getArgs = this._getAllArgs(serviceIdentifier);
|
|
252
|
+
return this._getAll(getArgs);
|
|
253
|
+
}
|
|
254
|
+
getAllTagged(serviceIdentifier, key, value) {
|
|
255
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, true, key, value);
|
|
256
|
+
return this._getButThrowIfAsync(getArgs);
|
|
257
|
+
}
|
|
258
|
+
getAllTaggedAsync(serviceIdentifier, key, value) {
|
|
259
|
+
const getArgs = this._getNotAllArgs(serviceIdentifier, true, key, value);
|
|
260
|
+
return this._getAll(getArgs);
|
|
261
|
+
}
|
|
262
|
+
getAllNamed(serviceIdentifier, named) {
|
|
263
|
+
return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
264
|
+
}
|
|
265
|
+
getAllNamedAsync(serviceIdentifier, named) {
|
|
266
|
+
return this.getAllTaggedAsync(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
|
|
267
|
+
}
|
|
268
|
+
resolve(constructorFunction) {
|
|
269
|
+
const isBound = this.isBound(constructorFunction);
|
|
270
|
+
if (!isBound) {
|
|
271
|
+
this.bind(constructorFunction).toSelf();
|
|
272
|
+
}
|
|
273
|
+
const resolved = this.get(constructorFunction);
|
|
274
|
+
if (!isBound) {
|
|
275
|
+
this.unbind(constructorFunction);
|
|
276
|
+
}
|
|
277
|
+
return resolved;
|
|
278
|
+
}
|
|
279
|
+
_preDestroy(constructor, instance) {
|
|
280
|
+
if (Reflect.hasMetadata(METADATA_KEY.PRE_DESTROY, constructor)) {
|
|
281
|
+
const data = Reflect.getMetadata(METADATA_KEY.PRE_DESTROY, constructor);
|
|
282
|
+
return instance[data.value]?.();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
_removeModuleHandlers(moduleId) {
|
|
286
|
+
const moduleActivationsHandlers = this._moduleActivationStore.remove(moduleId);
|
|
287
|
+
this._activations.removeIntersection(moduleActivationsHandlers.onActivations);
|
|
288
|
+
this._deactivations.removeIntersection(moduleActivationsHandlers.onDeactivations);
|
|
289
|
+
}
|
|
290
|
+
_removeModuleBindings(moduleId) {
|
|
291
|
+
return this._bindingDictionary.removeByCondition((binding) => binding.moduleId === moduleId);
|
|
292
|
+
}
|
|
293
|
+
_deactivate(binding, instance) {
|
|
294
|
+
const constructor = Object.getPrototypeOf(instance).constructor;
|
|
295
|
+
try {
|
|
296
|
+
if (this._deactivations.hasKey(binding.serviceIdentifier)) {
|
|
297
|
+
const result = this._deactivateContainer(instance, this._deactivations.get(binding.serviceIdentifier).values());
|
|
298
|
+
if (isPromise(result)) {
|
|
299
|
+
return this._handleDeactivationError(result.then(() => this._propagateContainerDeactivationThenBindingAndPreDestroyAsync(binding, instance, constructor)), constructor);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const propagateDeactivationResult = this._propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor);
|
|
303
|
+
if (isPromise(propagateDeactivationResult)) {
|
|
304
|
+
return this._handleDeactivationError(propagateDeactivationResult, constructor);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
catch (ex) {
|
|
308
|
+
if (ex instanceof Error) {
|
|
309
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(constructor.name, ex.message));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
async _handleDeactivationError(asyncResult, constructor) {
|
|
314
|
+
try {
|
|
315
|
+
await asyncResult;
|
|
316
|
+
}
|
|
317
|
+
catch (ex) {
|
|
318
|
+
if (ex instanceof Error) {
|
|
319
|
+
throw new Error(ERROR_MSGS.ON_DEACTIVATION_ERROR(constructor.name, ex.message));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
_deactivateContainer(instance, deactivationsIterator) {
|
|
324
|
+
let deactivation = deactivationsIterator.next();
|
|
325
|
+
while (deactivation.value) {
|
|
326
|
+
const result = deactivation.value(instance);
|
|
327
|
+
if (isPromise(result)) {
|
|
328
|
+
return result.then(() => this._deactivateContainerAsync(instance, deactivationsIterator));
|
|
329
|
+
}
|
|
330
|
+
deactivation = deactivationsIterator.next();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
async _deactivateContainerAsync(instance, deactivationsIterator) {
|
|
334
|
+
let deactivation = deactivationsIterator.next();
|
|
335
|
+
while (deactivation.value) {
|
|
336
|
+
await deactivation.value(instance);
|
|
337
|
+
deactivation = deactivationsIterator.next();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
_getContainerModuleHelpersFactory() {
|
|
341
|
+
const setModuleId = (bindingToSyntax, moduleId) => {
|
|
342
|
+
// TODO: Implement an internal type `_BindingToSyntax<T>` wherein this member
|
|
343
|
+
// can be public. Let `BindingToSyntax<T>` be the presentational type that
|
|
344
|
+
// depends on it, and does not expose this member as public.
|
|
345
|
+
bindingToSyntax._binding.moduleId = moduleId;
|
|
346
|
+
};
|
|
347
|
+
const getBindFunction = (moduleId) => (serviceIdentifier) => {
|
|
348
|
+
const bindingToSyntax = this.bind(serviceIdentifier);
|
|
349
|
+
setModuleId(bindingToSyntax, moduleId);
|
|
350
|
+
return bindingToSyntax;
|
|
351
|
+
};
|
|
352
|
+
const getUnbindFunction = () => (serviceIdentifier) => {
|
|
353
|
+
return this.unbind(serviceIdentifier);
|
|
354
|
+
};
|
|
355
|
+
const getUnbindAsyncFunction = () => (serviceIdentifier) => {
|
|
356
|
+
return this.unbindAsync(serviceIdentifier);
|
|
357
|
+
};
|
|
358
|
+
const getIsboundFunction = () => (serviceIdentifier) => {
|
|
359
|
+
return this.isBound(serviceIdentifier);
|
|
360
|
+
};
|
|
361
|
+
const getRebindFunction = (moduleId) => (serviceIdentifier) => {
|
|
362
|
+
const bindingToSyntax = this.rebind(serviceIdentifier);
|
|
363
|
+
setModuleId(bindingToSyntax, moduleId);
|
|
364
|
+
return bindingToSyntax;
|
|
365
|
+
};
|
|
366
|
+
const getOnActivationFunction = (moduleId) => (serviceIdentifier, onActivation) => {
|
|
367
|
+
this._moduleActivationStore.addActivation(moduleId, serviceIdentifier, onActivation);
|
|
368
|
+
this.onActivation(serviceIdentifier, onActivation);
|
|
369
|
+
};
|
|
370
|
+
const getOnDeactivationFunction = (moduleId) => (serviceIdentifier, onDeactivation) => {
|
|
371
|
+
this._moduleActivationStore.addDeactivation(moduleId, serviceIdentifier, onDeactivation);
|
|
372
|
+
this.onDeactivation(serviceIdentifier, onDeactivation);
|
|
373
|
+
};
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
375
|
+
return (mId) => ({
|
|
376
|
+
bindFunction: getBindFunction(mId),
|
|
377
|
+
isboundFunction: getIsboundFunction(),
|
|
378
|
+
onActivationFunction: getOnActivationFunction(mId),
|
|
379
|
+
onDeactivationFunction: getOnDeactivationFunction(mId),
|
|
380
|
+
rebindFunction: getRebindFunction(mId),
|
|
381
|
+
unbindFunction: getUnbindFunction(),
|
|
382
|
+
unbindAsyncFunction: getUnbindAsyncFunction(),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
_getAll(getArgs) {
|
|
386
|
+
return Promise.all(this._get(getArgs));
|
|
387
|
+
}
|
|
388
|
+
// Prepares arguments required for resolution and
|
|
389
|
+
// delegates resolution to _middleware if available
|
|
390
|
+
// otherwise it delegates resolution to _planAndResolve
|
|
391
|
+
_get(getArgs) {
|
|
392
|
+
const planAndResolveArgs = {
|
|
393
|
+
...getArgs,
|
|
394
|
+
contextInterceptor: (context) => context,
|
|
395
|
+
targetType: TargetTypeEnum.Variable,
|
|
396
|
+
};
|
|
397
|
+
if (this._middleware) {
|
|
398
|
+
const middlewareResult = this._middleware(planAndResolveArgs);
|
|
399
|
+
if (middlewareResult === undefined || middlewareResult === null) {
|
|
400
|
+
throw new Error(ERROR_MSGS.INVALID_MIDDLEWARE_RETURN);
|
|
401
|
+
}
|
|
402
|
+
return middlewareResult;
|
|
403
|
+
}
|
|
404
|
+
return this._planAndResolve()(planAndResolveArgs);
|
|
405
|
+
}
|
|
406
|
+
_getButThrowIfAsync(getArgs) {
|
|
407
|
+
const result = this._get(getArgs);
|
|
408
|
+
if (isPromiseOrContainsPromise(result)) {
|
|
409
|
+
throw new Error(ERROR_MSGS.LAZY_IN_SYNC(getArgs.serviceIdentifier));
|
|
410
|
+
}
|
|
411
|
+
return result;
|
|
412
|
+
}
|
|
413
|
+
_getAllArgs(serviceIdentifier) {
|
|
414
|
+
const getAllArgs = {
|
|
415
|
+
avoidConstraints: true,
|
|
416
|
+
isMultiInject: true,
|
|
417
|
+
serviceIdentifier,
|
|
418
|
+
};
|
|
419
|
+
return getAllArgs;
|
|
420
|
+
}
|
|
421
|
+
_getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
|
|
422
|
+
const getNotAllArgs = {
|
|
423
|
+
avoidConstraints: false,
|
|
424
|
+
isMultiInject,
|
|
425
|
+
serviceIdentifier,
|
|
426
|
+
key,
|
|
427
|
+
value,
|
|
428
|
+
};
|
|
429
|
+
return getNotAllArgs;
|
|
430
|
+
}
|
|
431
|
+
// Planner creates a plan and Resolver resolves a plan
|
|
432
|
+
// one of the jobs of the Container is to links the Planner
|
|
433
|
+
// with the Resolver and that is what this function is about
|
|
434
|
+
_planAndResolve() {
|
|
435
|
+
return (args) => {
|
|
436
|
+
// create a plan
|
|
437
|
+
let context = plan(this._metadataReader, this, args.isMultiInject, args.targetType, args.serviceIdentifier, args.key, args.value, args.avoidConstraints);
|
|
438
|
+
// apply context interceptor
|
|
439
|
+
context = args.contextInterceptor(context);
|
|
440
|
+
// resolve plan
|
|
441
|
+
const result = resolve(context);
|
|
442
|
+
return result;
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
_deactivateIfSingleton(binding) {
|
|
446
|
+
if (!binding.activated) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (isPromise(binding.cache)) {
|
|
450
|
+
return binding.cache.then((resolved) => this._deactivate(binding, resolved));
|
|
451
|
+
}
|
|
452
|
+
return this._deactivate(binding, binding.cache);
|
|
453
|
+
}
|
|
454
|
+
_deactivateSingletons(bindings) {
|
|
455
|
+
for (const binding of bindings) {
|
|
456
|
+
const result = this._deactivateIfSingleton(binding);
|
|
457
|
+
if (isPromise(result)) {
|
|
458
|
+
throw new Error(ERROR_MSGS.ASYNC_UNBIND_REQUIRED);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
async _deactivateSingletonsAsync(bindings) {
|
|
463
|
+
await Promise.all(bindings.map((b) => this._deactivateIfSingleton(b)));
|
|
464
|
+
}
|
|
465
|
+
_propagateContainerDeactivationThenBindingAndPreDestroy(binding, instance, constructor) {
|
|
466
|
+
if (this.parent) {
|
|
467
|
+
return this._deactivate.bind(this.parent)(binding, instance);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
return this._bindingDeactivationAndPreDestroy(binding, instance, constructor);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
async _propagateContainerDeactivationThenBindingAndPreDestroyAsync(binding, instance, constructor) {
|
|
474
|
+
if (this.parent) {
|
|
475
|
+
await this._deactivate.bind(this.parent)(binding, instance);
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
await this._bindingDeactivationAndPreDestroyAsync(binding, instance, constructor);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
_removeServiceFromDictionary(serviceIdentifier) {
|
|
482
|
+
try {
|
|
483
|
+
this._bindingDictionary.remove(serviceIdentifier);
|
|
484
|
+
}
|
|
485
|
+
catch (e) {
|
|
486
|
+
throw new Error(`${ERROR_MSGS.CANNOT_UNBIND} ${getServiceIdentifierAsString(serviceIdentifier)}`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
_bindingDeactivationAndPreDestroy(binding, instance, constructor) {
|
|
490
|
+
if (typeof binding.onDeactivation === "function") {
|
|
491
|
+
const result = binding.onDeactivation(instance);
|
|
492
|
+
if (isPromise(result)) {
|
|
493
|
+
return result.then(() => this._preDestroy(constructor, instance));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return this._preDestroy(constructor, instance);
|
|
497
|
+
}
|
|
498
|
+
async _bindingDeactivationAndPreDestroyAsync(binding, instance, constructor) {
|
|
499
|
+
if (typeof binding.onDeactivation === "function") {
|
|
500
|
+
await binding.onDeactivation(instance);
|
|
501
|
+
}
|
|
502
|
+
await this._preDestroy(constructor, instance);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
export { Container };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { id } from "../utils/id.js";
|
|
2
|
+
export class ContainerModule {
|
|
3
|
+
id;
|
|
4
|
+
registry;
|
|
5
|
+
constructor(registry) {
|
|
6
|
+
this.id = id();
|
|
7
|
+
this.registry = registry;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class AsyncContainerModule {
|
|
11
|
+
id;
|
|
12
|
+
registry;
|
|
13
|
+
constructor(registry) {
|
|
14
|
+
this.id = id();
|
|
15
|
+
this.registry = registry;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class ContainerSnapshot {
|
|
2
|
+
bindings;
|
|
3
|
+
activations;
|
|
4
|
+
deactivations;
|
|
5
|
+
middleware;
|
|
6
|
+
moduleActivationStore;
|
|
7
|
+
static of(bindings, middleware, activations, deactivations, moduleActivationStore) {
|
|
8
|
+
const snapshot = new ContainerSnapshot();
|
|
9
|
+
snapshot.bindings = bindings;
|
|
10
|
+
snapshot.middleware = middleware;
|
|
11
|
+
snapshot.deactivations = deactivations;
|
|
12
|
+
snapshot.activations = activations;
|
|
13
|
+
snapshot.moduleActivationStore = moduleActivationStore;
|
|
14
|
+
return snapshot;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { ContainerSnapshot };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as ERROR_MSGS from "../constants/error_msgs.js";
|
|
2
|
+
import { isClonable } from "../utils/clonable.js";
|
|
3
|
+
class Lookup {
|
|
4
|
+
// dictionary used store multiple values for each key <key>
|
|
5
|
+
_map;
|
|
6
|
+
constructor() {
|
|
7
|
+
this._map = new Map();
|
|
8
|
+
}
|
|
9
|
+
getMap() {
|
|
10
|
+
return this._map;
|
|
11
|
+
}
|
|
12
|
+
// adds a new entry to _map
|
|
13
|
+
add(serviceIdentifier, value) {
|
|
14
|
+
if (serviceIdentifier === null || serviceIdentifier === undefined) {
|
|
15
|
+
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
16
|
+
}
|
|
17
|
+
if (value === null || value === undefined) {
|
|
18
|
+
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
19
|
+
}
|
|
20
|
+
const entry = this._map.get(serviceIdentifier);
|
|
21
|
+
if (entry !== undefined) {
|
|
22
|
+
entry.push(value);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this._map.set(serviceIdentifier, [value]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// gets the value of a entry by its key (serviceIdentifier)
|
|
29
|
+
get(serviceIdentifier) {
|
|
30
|
+
if (serviceIdentifier === null || serviceIdentifier === undefined) {
|
|
31
|
+
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
32
|
+
}
|
|
33
|
+
const entry = this._map.get(serviceIdentifier);
|
|
34
|
+
if (entry !== undefined) {
|
|
35
|
+
return entry;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// removes a entry from _map by its key (serviceIdentifier)
|
|
42
|
+
remove(serviceIdentifier) {
|
|
43
|
+
if (serviceIdentifier === null || serviceIdentifier === undefined) {
|
|
44
|
+
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
45
|
+
}
|
|
46
|
+
if (!this._map.delete(serviceIdentifier)) {
|
|
47
|
+
throw new Error(ERROR_MSGS.KEY_NOT_FOUND);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
removeIntersection(lookup) {
|
|
51
|
+
this.traverse((serviceIdentifier, value) => {
|
|
52
|
+
const lookupActivations = lookup.hasKey(serviceIdentifier)
|
|
53
|
+
? lookup.get(serviceIdentifier)
|
|
54
|
+
: undefined;
|
|
55
|
+
if (lookupActivations !== undefined) {
|
|
56
|
+
const filteredValues = value.filter((lookupValue) => !lookupActivations.some((moduleActivation) => lookupValue === moduleActivation));
|
|
57
|
+
this._setValue(serviceIdentifier, filteredValues);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
removeByCondition(condition) {
|
|
62
|
+
const removals = [];
|
|
63
|
+
this._map.forEach((entries, key) => {
|
|
64
|
+
const updatedEntries = [];
|
|
65
|
+
for (const entry of entries) {
|
|
66
|
+
const remove = condition(entry);
|
|
67
|
+
if (remove) {
|
|
68
|
+
removals.push(entry);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
updatedEntries.push(entry);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this._setValue(key, updatedEntries);
|
|
75
|
+
});
|
|
76
|
+
return removals;
|
|
77
|
+
}
|
|
78
|
+
// returns true if _map contains a key (serviceIdentifier)
|
|
79
|
+
hasKey(serviceIdentifier) {
|
|
80
|
+
if (serviceIdentifier === null || serviceIdentifier === undefined) {
|
|
81
|
+
throw new Error(ERROR_MSGS.NULL_ARGUMENT);
|
|
82
|
+
}
|
|
83
|
+
return this._map.has(serviceIdentifier);
|
|
84
|
+
}
|
|
85
|
+
// returns a new Lookup instance; note: this is not a deep clone, only Lookup related data structure (dictionary) is
|
|
86
|
+
// cloned, content remains the same
|
|
87
|
+
clone() {
|
|
88
|
+
const copy = new Lookup();
|
|
89
|
+
this._map.forEach((value, key) => {
|
|
90
|
+
value.forEach((b) => copy.add(key, isClonable(b) ? b.clone() : b));
|
|
91
|
+
});
|
|
92
|
+
return copy;
|
|
93
|
+
}
|
|
94
|
+
traverse(func) {
|
|
95
|
+
this._map.forEach((value, key) => {
|
|
96
|
+
func(key, value);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
_setValue(serviceIdentifier, value) {
|
|
100
|
+
if (value.length > 0) {
|
|
101
|
+
this._map.set(serviceIdentifier, value);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this._map.delete(serviceIdentifier);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export { Lookup };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Lookup } from "./lookup.js";
|
|
2
|
+
export class ModuleActivationStore {
|
|
3
|
+
_map = new Map();
|
|
4
|
+
remove(moduleId) {
|
|
5
|
+
if (this._map.has(moduleId)) {
|
|
6
|
+
const handlers = this._map.get(moduleId);
|
|
7
|
+
this._map.delete(moduleId);
|
|
8
|
+
return handlers;
|
|
9
|
+
}
|
|
10
|
+
return this._getEmptyHandlersStore();
|
|
11
|
+
}
|
|
12
|
+
addDeactivation(moduleId, serviceIdentifier, onDeactivation) {
|
|
13
|
+
this._getModuleActivationHandlers(moduleId).onDeactivations.add(serviceIdentifier, onDeactivation);
|
|
14
|
+
}
|
|
15
|
+
addActivation(moduleId, serviceIdentifier, onActivation) {
|
|
16
|
+
this._getModuleActivationHandlers(moduleId).onActivations.add(serviceIdentifier, onActivation);
|
|
17
|
+
}
|
|
18
|
+
clone() {
|
|
19
|
+
const clone = new ModuleActivationStore();
|
|
20
|
+
this._map.forEach((handlersStore, moduleId) => {
|
|
21
|
+
clone._map.set(moduleId, {
|
|
22
|
+
onActivations: handlersStore.onActivations.clone(),
|
|
23
|
+
onDeactivations: handlersStore.onDeactivations.clone(),
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return clone;
|
|
27
|
+
}
|
|
28
|
+
_getModuleActivationHandlers(moduleId) {
|
|
29
|
+
let moduleActivationHandlers = this._map.get(moduleId);
|
|
30
|
+
if (moduleActivationHandlers === undefined) {
|
|
31
|
+
moduleActivationHandlers = this._getEmptyHandlersStore();
|
|
32
|
+
this._map.set(moduleId, moduleActivationHandlers);
|
|
33
|
+
}
|
|
34
|
+
return moduleActivationHandlers;
|
|
35
|
+
}
|
|
36
|
+
_getEmptyHandlersStore() {
|
|
37
|
+
const handlersStore = {
|
|
38
|
+
onActivations: new Lookup(),
|
|
39
|
+
onDeactivations: new Lookup(),
|
|
40
|
+
};
|
|
41
|
+
return handlersStore;
|
|
42
|
+
}
|
|
43
|
+
}
|