@elsikora/cladi 2.0.2 → 2.1.0
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 +598 -211
- package/dist/cjs/application/utility/safe-deep-clone.utility.d.ts.map +1 -1
- package/dist/cjs/application/utility/safe-deep-clone.utility.js +104 -10
- package/dist/cjs/application/utility/safe-deep-clone.utility.js.map +1 -1
- package/dist/cjs/domain/enum/captive-dependency-policy.enum.d.ts +6 -0
- package/dist/cjs/domain/enum/captive-dependency-policy.enum.d.ts.map +1 -0
- package/dist/cjs/domain/enum/captive-dependency-policy.enum.js +9 -0
- package/dist/cjs/domain/enum/captive-dependency-policy.enum.js.map +1 -0
- package/dist/cjs/domain/enum/dependency-lifecycle.enum.d.ts +6 -0
- package/dist/cjs/domain/enum/dependency-lifecycle.enum.d.ts.map +1 -0
- package/dist/cjs/domain/enum/dependency-lifecycle.enum.js +9 -0
- package/dist/cjs/domain/enum/dependency-lifecycle.enum.js.map +1 -0
- package/dist/cjs/domain/enum/di-container-duplicate-provider-policy.enum.d.ts +6 -0
- package/dist/cjs/domain/enum/di-container-duplicate-provider-policy.enum.d.ts.map +1 -0
- package/dist/cjs/domain/enum/di-container-duplicate-provider-policy.enum.js +9 -0
- package/dist/cjs/domain/enum/di-container-duplicate-provider-policy.enum.js.map +1 -0
- package/dist/cjs/domain/enum/index.d.ts +4 -0
- package/dist/cjs/domain/enum/index.d.ts.map +1 -1
- package/dist/cjs/domain/enum/logger-log-level.enum.js.map +1 -1
- package/dist/cjs/domain/enum/provider-type.enum.d.ts +8 -0
- package/dist/cjs/domain/enum/provider-type.enum.d.ts.map +1 -0
- package/dist/cjs/domain/enum/provider-type.enum.js +11 -0
- package/dist/cjs/domain/enum/provider-type.enum.js.map +1 -0
- package/dist/cjs/domain/index.d.ts +1 -0
- package/dist/cjs/domain/index.d.ts.map +1 -1
- package/dist/cjs/domain/interface/di/alias-provider.interface.d.ts +6 -0
- package/dist/cjs/domain/interface/di/alias-provider.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/class-provider.interface.d.ts +9 -0
- package/dist/cjs/domain/interface/di/class-provider.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/container-snapshot.interface.d.ts +19 -0
- package/dist/cjs/domain/interface/di/container-snapshot.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/dependency-graph.interface.d.ts +19 -0
- package/dist/cjs/domain/interface/di/dependency-graph.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/factory-provider.interface.d.ts +9 -0
- package/dist/cjs/domain/interface/di/factory-provider.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/index.d.ts +15 -0
- package/dist/cjs/domain/interface/di/index.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/lazy-provider.interface.d.ts +6 -0
- package/dist/cjs/domain/interface/di/lazy-provider.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/module.interface.d.ts +8 -0
- package/dist/cjs/domain/interface/di/module.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/provider-base.interface.d.ts +11 -0
- package/dist/cjs/domain/interface/di/provider-base.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/resolution-explanation.interface.d.ts +14 -0
- package/dist/cjs/domain/interface/di/resolution-explanation.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/resolve-interceptor.interface.d.ts +26 -0
- package/dist/cjs/domain/interface/di/resolve-interceptor.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/resolver.interface.d.ts +10 -0
- package/dist/cjs/domain/interface/di/resolver.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/scope-create-options.interface.d.ts +9 -0
- package/dist/cjs/domain/interface/di/scope-create-options.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/scope.interface.d.ts +23 -0
- package/dist/cjs/domain/interface/di/scope.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/di/value-provider.interface.d.ts +5 -0
- package/dist/cjs/domain/interface/di/value-provider.interface.d.ts.map +1 -0
- package/dist/cjs/domain/interface/error.interface.d.ts +6 -2
- package/dist/cjs/domain/interface/error.interface.d.ts.map +1 -1
- package/dist/cjs/domain/interface/index.d.ts +1 -3
- package/dist/cjs/domain/interface/index.d.ts.map +1 -1
- package/dist/cjs/domain/interface/logger/index.d.ts +2 -2
- package/dist/cjs/domain/interface/logger/index.d.ts.map +1 -1
- package/dist/cjs/domain/type/di/constructor.type.d.ts +2 -0
- package/dist/cjs/domain/type/di/constructor.type.d.ts.map +1 -0
- package/dist/cjs/domain/type/di/di-container.type.d.ts +3 -0
- package/dist/cjs/domain/type/di/di-container.type.d.ts.map +1 -0
- package/dist/cjs/domain/type/di/index.d.ts +5 -0
- package/dist/cjs/domain/type/di/index.d.ts.map +1 -0
- package/dist/cjs/domain/type/di/provider.type.d.ts +7 -0
- package/dist/cjs/domain/type/di/provider.type.d.ts.map +1 -0
- package/dist/cjs/domain/type/di/token.type.d.ts +4 -0
- package/dist/cjs/domain/type/di/token.type.d.ts.map +1 -0
- package/dist/cjs/domain/type/index.d.ts +2 -0
- package/dist/cjs/domain/type/index.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +60 -12
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/infrastructure/class/base/error.class.d.ts +7 -4
- package/dist/cjs/infrastructure/class/base/error.class.d.ts.map +1 -1
- package/dist/cjs/infrastructure/class/base/error.class.js +13 -3
- package/dist/cjs/infrastructure/class/base/error.class.js.map +1 -1
- package/dist/cjs/infrastructure/class/base/index.d.ts +0 -3
- package/dist/cjs/infrastructure/class/base/index.d.ts.map +1 -1
- package/dist/cjs/infrastructure/class/di/cache/coordinator.class.d.ts +14 -0
- package/dist/cjs/infrastructure/class/di/cache/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/cache/coordinator.class.js +126 -0
- package/dist/cjs/infrastructure/class/di/cache/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/captive/coordinator.class.d.ts +17 -0
- package/dist/cjs/infrastructure/class/di/captive/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/captive/coordinator.class.js +62 -0
- package/dist/cjs/infrastructure/class/di/captive/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/container.class.d.ts +75 -0
- package/dist/cjs/infrastructure/class/di/container.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/container.class.js +632 -0
- package/dist/cjs/infrastructure/class/di/container.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposal/coordinator.class.d.ts +34 -0
- package/dist/cjs/infrastructure/class/di/disposal/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposal/coordinator.class.js +93 -0
- package/dist/cjs/infrastructure/class/di/disposal/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposal/manager.class.d.ts +28 -0
- package/dist/cjs/infrastructure/class/di/disposal/manager.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposal/manager.class.js +104 -0
- package/dist/cjs/infrastructure/class/di/disposal/manager.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposer/coordinator.class.d.ts +41 -0
- package/dist/cjs/infrastructure/class/di/disposer/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/disposer/coordinator.class.js +140 -0
- package/dist/cjs/infrastructure/class/di/disposer/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/engine/resolution.class.d.ts +38 -0
- package/dist/cjs/infrastructure/class/di/engine/resolution.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/engine/resolution.class.js +153 -0
- package/dist/cjs/infrastructure/class/di/engine/resolution.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/graph/coordinator.class.d.ts +42 -0
- package/dist/cjs/infrastructure/class/di/graph/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/graph/coordinator.class.js +121 -0
- package/dist/cjs/infrastructure/class/di/graph/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/index.d.ts +3 -0
- package/dist/cjs/infrastructure/class/di/index.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interceptor/dispatcher.class.d.ts +17 -0
- package/dist/cjs/infrastructure/class/di/interceptor/dispatcher.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interceptor/dispatcher.class.js +91 -0
- package/dist/cjs/infrastructure/class/di/interceptor/dispatcher.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/interface/index.d.ts +3 -0
- package/dist/cjs/infrastructure/class/di/interface/index.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interface/internal-container-options.interface.d.ts +7 -0
- package/dist/cjs/infrastructure/class/di/interface/internal-container-options.interface.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/index.d.ts +3 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/index.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/lookup.interface.d.ts +8 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/lookup.interface.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/registration.interface.d.ts +11 -0
- package/dist/cjs/infrastructure/class/di/interface/provider/registration.interface.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/lookup/coordinator.class.d.ts +10 -0
- package/dist/cjs/infrastructure/class/di/lookup/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/lookup/coordinator.class.js +78 -0
- package/dist/cjs/infrastructure/class/di/lookup/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/registration/coordinator.class.d.ts +41 -0
- package/dist/cjs/infrastructure/class/di/registration/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/registration/coordinator.class.js +251 -0
- package/dist/cjs/infrastructure/class/di/registration/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/class/di/resolution/coordinator.class.d.ts +62 -0
- package/dist/cjs/infrastructure/class/di/resolution/coordinator.class.d.ts.map +1 -0
- package/dist/cjs/infrastructure/class/di/resolution/coordinator.class.js +599 -0
- package/dist/cjs/infrastructure/class/di/resolution/coordinator.class.js.map +1 -0
- package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.js +4 -0
- package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.js.map +1 -1
- package/dist/cjs/infrastructure/factory/core.factory.d.ts +11 -31
- package/dist/cjs/infrastructure/factory/core.factory.d.ts.map +1 -1
- package/dist/cjs/infrastructure/factory/core.factory.js +13 -47
- package/dist/cjs/infrastructure/factory/core.factory.js.map +1 -1
- package/dist/cjs/infrastructure/index.d.ts +1 -0
- package/dist/cjs/infrastructure/index.d.ts.map +1 -1
- package/dist/cjs/infrastructure/interface/base/error-options.interface.d.ts +1 -1
- package/dist/cjs/infrastructure/interface/base/index.d.ts +0 -3
- package/dist/cjs/infrastructure/interface/base/index.d.ts.map +1 -1
- package/dist/cjs/infrastructure/interface/console-logger-options.interface.d.ts +1 -1
- package/dist/cjs/infrastructure/interface/core-factory-options.interface.d.ts +1 -1
- package/dist/cjs/infrastructure/interface/di-container-options.interface.d.ts +12 -0
- package/dist/cjs/infrastructure/interface/di-container-options.interface.d.ts.map +1 -0
- package/dist/cjs/infrastructure/interface/index.d.ts +1 -0
- package/dist/cjs/infrastructure/interface/index.d.ts.map +1 -1
- package/dist/cjs/infrastructure/service/console-logger.service.d.ts.map +1 -1
- package/dist/cjs/infrastructure/service/console-logger.service.js +10 -6
- package/dist/cjs/infrastructure/service/console-logger.service.js.map +1 -1
- package/dist/cjs/infrastructure/utility/to-error.utility.d.ts +7 -0
- package/dist/cjs/infrastructure/utility/to-error.utility.d.ts.map +1 -0
- package/dist/cjs/infrastructure/utility/to-error.utility.js +22 -0
- package/dist/cjs/infrastructure/utility/to-error.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/constant/injectable-metadata-key.constant.d.ts +2 -0
- package/dist/cjs/presentation/ergonomics/constant/injectable-metadata-key.constant.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/constant/injectable-metadata-key.constant.js +6 -0
- package/dist/cjs/presentation/ergonomics/constant/injectable-metadata-key.constant.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/constant/module-metadata-key.constant.d.ts +2 -0
- package/dist/cjs/presentation/ergonomics/constant/module-metadata-key.constant.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/constant/module-metadata-key.constant.js +6 -0
- package/dist/cjs/presentation/ergonomics/constant/module-metadata-key.constant.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/after-resolve.decorator.d.ts +6 -0
- package/dist/cjs/presentation/ergonomics/decorator/after-resolve.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/after-resolve.decorator.js +41 -0
- package/dist/cjs/presentation/ergonomics/decorator/after-resolve.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/index.d.ts +7 -0
- package/dist/cjs/presentation/ergonomics/decorator/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/inject.decorator.d.ts +8 -0
- package/dist/cjs/presentation/ergonomics/decorator/inject.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/inject.decorator.js +35 -0
- package/dist/cjs/presentation/ergonomics/decorator/inject.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/injectable.decorator.d.ts +8 -0
- package/dist/cjs/presentation/ergonomics/decorator/injectable.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/injectable.decorator.js +89 -0
- package/dist/cjs/presentation/ergonomics/decorator/injectable.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/module.decorator.d.ts +8 -0
- package/dist/cjs/presentation/ergonomics/decorator/module.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/module.decorator.js +143 -0
- package/dist/cjs/presentation/ergonomics/decorator/module.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-dispose.decorator.d.ts +6 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-dispose.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-dispose.decorator.js +41 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-dispose.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-init.decorator.d.ts +6 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-init.decorator.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-init.decorator.js +41 -0
- package/dist/cjs/presentation/ergonomics/decorator/on-init.decorator.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/index.d.ts +4 -0
- package/dist/cjs/presentation/ergonomics/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/create/autowire-provider-options.interface.d.ts +12 -0
- package/dist/cjs/presentation/ergonomics/interface/create/autowire-provider-options.interface.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/create/index.d.ts +3 -0
- package/dist/cjs/presentation/ergonomics/interface/create/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/create/module-options.interface.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/interface/create/module-options.interface.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/decorator/index.d.ts +2 -0
- package/dist/cjs/presentation/ergonomics/interface/decorator/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/decorator/module-options.interface.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/interface/decorator/module-options.interface.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/index.d.ts +4 -0
- package/dist/cjs/presentation/ergonomics/interface/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/index.d.ts +3 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/metadata.interface.d.ts +12 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/metadata.interface.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/options.interface.d.ts +4 -0
- package/dist/cjs/presentation/ergonomics/interface/injectable/options.interface.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-decorated-modules.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-decorated-modules.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-decorated-modules.utility.js +63 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-decorated-modules.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-modules.utility.d.ts +10 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-modules.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-modules.utility.js +188 -0
- package/dist/cjs/presentation/ergonomics/utility/compose-modules.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire-provider.utility.d.ts +14 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire-provider.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire-provider.utility.js +110 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire-provider.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire.utility.d.ts +15 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire.utility.js +34 -0
- package/dist/cjs/presentation/ergonomics/utility/create/autowire.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/index.d.ts +5 -0
- package/dist/cjs/presentation/ergonomics/utility/create/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module-from-decorator.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module-from-decorator.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module-from-decorator.utility.js +135 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module-from-decorator.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module.utility.js +19 -0
- package/dist/cjs/presentation/ergonomics/utility/create/module.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/index.d.ts +6 -0
- package/dist/cjs/presentation/ergonomics/utility/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/get.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/get.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/get.utility.js +20 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/get.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/index.d.ts +3 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/set.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/set.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/set.utility.js +15 -0
- package/dist/cjs/presentation/ergonomics/utility/injectable-metadata/set.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/get.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/get.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/get.utility.js +20 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/get.utility.js.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/index.d.ts +3 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/index.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/set.utility.d.ts +9 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/set.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/set.utility.js +15 -0
- package/dist/cjs/presentation/ergonomics/utility/module-metadata/set.utility.js.map +1 -0
- package/dist/cjs/presentation/utility/create/di-container.utility.d.ts +9 -0
- package/dist/cjs/presentation/utility/create/di-container.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/utility/create/di-container.utility.js +15 -0
- package/dist/cjs/presentation/utility/create/di-container.utility.js.map +1 -0
- package/dist/cjs/presentation/utility/create/index.d.ts +3 -3
- package/dist/cjs/presentation/utility/create/index.d.ts.map +1 -1
- package/dist/cjs/presentation/utility/create/lazy-provider.utility.d.ts +24 -0
- package/dist/cjs/presentation/utility/create/lazy-provider.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/utility/create/lazy-provider.utility.js +29 -0
- package/dist/cjs/presentation/utility/create/lazy-provider.utility.js.map +1 -0
- package/dist/cjs/presentation/utility/create/logger.utility.d.ts +1 -1
- package/dist/cjs/presentation/utility/create/logger.utility.js +1 -1
- package/dist/cjs/presentation/utility/create/logger.utility.js.map +1 -1
- package/dist/cjs/presentation/utility/create/token.utility.d.ts +9 -0
- package/dist/cjs/presentation/utility/create/token.utility.d.ts.map +1 -0
- package/dist/cjs/presentation/utility/create/token.utility.js +14 -0
- package/dist/cjs/presentation/utility/create/token.utility.js.map +1 -0
- package/dist/esm/application/utility/safe-deep-clone.utility.d.ts.map +1 -1
- package/dist/esm/application/utility/safe-deep-clone.utility.js +104 -10
- package/dist/esm/application/utility/safe-deep-clone.utility.js.map +1 -1
- package/dist/esm/domain/enum/captive-dependency-policy.enum.d.ts +6 -0
- package/dist/esm/domain/enum/captive-dependency-policy.enum.d.ts.map +1 -0
- package/dist/esm/domain/enum/captive-dependency-policy.enum.js +9 -0
- package/dist/esm/domain/enum/captive-dependency-policy.enum.js.map +1 -0
- package/dist/esm/domain/enum/dependency-lifecycle.enum.d.ts +6 -0
- package/dist/esm/domain/enum/dependency-lifecycle.enum.d.ts.map +1 -0
- package/dist/esm/domain/enum/dependency-lifecycle.enum.js +9 -0
- package/dist/esm/domain/enum/dependency-lifecycle.enum.js.map +1 -0
- package/dist/esm/domain/enum/di-container-duplicate-provider-policy.enum.d.ts +6 -0
- package/dist/esm/domain/enum/di-container-duplicate-provider-policy.enum.d.ts.map +1 -0
- package/dist/esm/domain/enum/di-container-duplicate-provider-policy.enum.js +9 -0
- package/dist/esm/domain/enum/di-container-duplicate-provider-policy.enum.js.map +1 -0
- package/dist/esm/domain/enum/index.d.ts +4 -0
- package/dist/esm/domain/enum/index.d.ts.map +1 -1
- package/dist/esm/domain/enum/logger-log-level.enum.js.map +1 -1
- package/dist/esm/domain/enum/provider-type.enum.d.ts +8 -0
- package/dist/esm/domain/enum/provider-type.enum.d.ts.map +1 -0
- package/dist/esm/domain/enum/provider-type.enum.js +11 -0
- package/dist/esm/domain/enum/provider-type.enum.js.map +1 -0
- package/dist/esm/domain/index.d.ts +1 -0
- package/dist/esm/domain/index.d.ts.map +1 -1
- package/dist/esm/domain/interface/di/alias-provider.interface.d.ts +6 -0
- package/dist/esm/domain/interface/di/alias-provider.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/class-provider.interface.d.ts +9 -0
- package/dist/esm/domain/interface/di/class-provider.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/container-snapshot.interface.d.ts +19 -0
- package/dist/esm/domain/interface/di/container-snapshot.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/dependency-graph.interface.d.ts +19 -0
- package/dist/esm/domain/interface/di/dependency-graph.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/factory-provider.interface.d.ts +9 -0
- package/dist/esm/domain/interface/di/factory-provider.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/index.d.ts +15 -0
- package/dist/esm/domain/interface/di/index.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/lazy-provider.interface.d.ts +6 -0
- package/dist/esm/domain/interface/di/lazy-provider.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/module.interface.d.ts +8 -0
- package/dist/esm/domain/interface/di/module.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/provider-base.interface.d.ts +11 -0
- package/dist/esm/domain/interface/di/provider-base.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/resolution-explanation.interface.d.ts +14 -0
- package/dist/esm/domain/interface/di/resolution-explanation.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/resolve-interceptor.interface.d.ts +26 -0
- package/dist/esm/domain/interface/di/resolve-interceptor.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/resolver.interface.d.ts +10 -0
- package/dist/esm/domain/interface/di/resolver.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/scope-create-options.interface.d.ts +9 -0
- package/dist/esm/domain/interface/di/scope-create-options.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/scope.interface.d.ts +23 -0
- package/dist/esm/domain/interface/di/scope.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/di/value-provider.interface.d.ts +5 -0
- package/dist/esm/domain/interface/di/value-provider.interface.d.ts.map +1 -0
- package/dist/esm/domain/interface/error.interface.d.ts +6 -2
- package/dist/esm/domain/interface/error.interface.d.ts.map +1 -1
- package/dist/esm/domain/interface/index.d.ts +1 -3
- package/dist/esm/domain/interface/index.d.ts.map +1 -1
- package/dist/esm/domain/interface/logger/index.d.ts +2 -2
- package/dist/esm/domain/interface/logger/index.d.ts.map +1 -1
- package/dist/esm/domain/type/di/constructor.type.d.ts +2 -0
- package/dist/esm/domain/type/di/constructor.type.d.ts.map +1 -0
- package/dist/esm/domain/type/di/di-container.type.d.ts +3 -0
- package/dist/esm/domain/type/di/di-container.type.d.ts.map +1 -0
- package/dist/esm/domain/type/di/index.d.ts +5 -0
- package/dist/esm/domain/type/di/index.d.ts.map +1 -0
- package/dist/esm/domain/type/di/provider.type.d.ts +7 -0
- package/dist/esm/domain/type/di/provider.type.d.ts.map +1 -0
- package/dist/esm/domain/type/di/token.type.d.ts +4 -0
- package/dist/esm/domain/type/di/token.type.d.ts.map +1 -0
- package/dist/esm/domain/type/index.d.ts +2 -0
- package/dist/esm/domain/type/index.d.ts.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +24 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/infrastructure/class/base/error.class.d.ts +7 -4
- package/dist/esm/infrastructure/class/base/error.class.d.ts.map +1 -1
- package/dist/esm/infrastructure/class/base/error.class.js +13 -3
- package/dist/esm/infrastructure/class/base/error.class.js.map +1 -1
- package/dist/esm/infrastructure/class/base/index.d.ts +0 -3
- package/dist/esm/infrastructure/class/base/index.d.ts.map +1 -1
- package/dist/esm/infrastructure/class/di/cache/coordinator.class.d.ts +14 -0
- package/dist/esm/infrastructure/class/di/cache/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/cache/coordinator.class.js +124 -0
- package/dist/esm/infrastructure/class/di/cache/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/captive/coordinator.class.d.ts +17 -0
- package/dist/esm/infrastructure/class/di/captive/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/captive/coordinator.class.js +60 -0
- package/dist/esm/infrastructure/class/di/captive/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/container.class.d.ts +75 -0
- package/dist/esm/infrastructure/class/di/container.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/container.class.js +630 -0
- package/dist/esm/infrastructure/class/di/container.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/disposal/coordinator.class.d.ts +34 -0
- package/dist/esm/infrastructure/class/di/disposal/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/disposal/coordinator.class.js +91 -0
- package/dist/esm/infrastructure/class/di/disposal/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/disposal/manager.class.d.ts +28 -0
- package/dist/esm/infrastructure/class/di/disposal/manager.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/disposal/manager.class.js +102 -0
- package/dist/esm/infrastructure/class/di/disposal/manager.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/disposer/coordinator.class.d.ts +41 -0
- package/dist/esm/infrastructure/class/di/disposer/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/disposer/coordinator.class.js +138 -0
- package/dist/esm/infrastructure/class/di/disposer/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/engine/resolution.class.d.ts +38 -0
- package/dist/esm/infrastructure/class/di/engine/resolution.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/engine/resolution.class.js +151 -0
- package/dist/esm/infrastructure/class/di/engine/resolution.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/graph/coordinator.class.d.ts +42 -0
- package/dist/esm/infrastructure/class/di/graph/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/graph/coordinator.class.js +119 -0
- package/dist/esm/infrastructure/class/di/graph/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/index.d.ts +3 -0
- package/dist/esm/infrastructure/class/di/index.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interceptor/dispatcher.class.d.ts +17 -0
- package/dist/esm/infrastructure/class/di/interceptor/dispatcher.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interceptor/dispatcher.class.js +89 -0
- package/dist/esm/infrastructure/class/di/interceptor/dispatcher.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/interface/index.d.ts +3 -0
- package/dist/esm/infrastructure/class/di/interface/index.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interface/internal-container-options.interface.d.ts +7 -0
- package/dist/esm/infrastructure/class/di/interface/internal-container-options.interface.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interface/provider/index.d.ts +3 -0
- package/dist/esm/infrastructure/class/di/interface/provider/index.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interface/provider/lookup.interface.d.ts +8 -0
- package/dist/esm/infrastructure/class/di/interface/provider/lookup.interface.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/interface/provider/registration.interface.d.ts +11 -0
- package/dist/esm/infrastructure/class/di/interface/provider/registration.interface.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/lookup/coordinator.class.d.ts +10 -0
- package/dist/esm/infrastructure/class/di/lookup/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/lookup/coordinator.class.js +76 -0
- package/dist/esm/infrastructure/class/di/lookup/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/registration/coordinator.class.d.ts +41 -0
- package/dist/esm/infrastructure/class/di/registration/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/registration/coordinator.class.js +249 -0
- package/dist/esm/infrastructure/class/di/registration/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/class/di/resolution/coordinator.class.d.ts +62 -0
- package/dist/esm/infrastructure/class/di/resolution/coordinator.class.d.ts.map +1 -0
- package/dist/esm/infrastructure/class/di/resolution/coordinator.class.js +597 -0
- package/dist/esm/infrastructure/class/di/resolution/coordinator.class.js.map +1 -0
- package/dist/esm/infrastructure/constant/console-logger-default-options.constant.js +4 -0
- package/dist/esm/infrastructure/constant/console-logger-default-options.constant.js.map +1 -1
- package/dist/esm/infrastructure/factory/core.factory.d.ts +11 -31
- package/dist/esm/infrastructure/factory/core.factory.d.ts.map +1 -1
- package/dist/esm/infrastructure/factory/core.factory.js +13 -47
- package/dist/esm/infrastructure/factory/core.factory.js.map +1 -1
- package/dist/esm/infrastructure/index.d.ts +1 -0
- package/dist/esm/infrastructure/index.d.ts.map +1 -1
- package/dist/esm/infrastructure/interface/base/error-options.interface.d.ts +1 -1
- package/dist/esm/infrastructure/interface/base/index.d.ts +0 -3
- package/dist/esm/infrastructure/interface/base/index.d.ts.map +1 -1
- package/dist/esm/infrastructure/interface/console-logger-options.interface.d.ts +1 -1
- package/dist/esm/infrastructure/interface/core-factory-options.interface.d.ts +1 -1
- package/dist/esm/infrastructure/interface/di-container-options.interface.d.ts +12 -0
- package/dist/esm/infrastructure/interface/di-container-options.interface.d.ts.map +1 -0
- package/dist/esm/infrastructure/interface/index.d.ts +1 -0
- package/dist/esm/infrastructure/interface/index.d.ts.map +1 -1
- package/dist/esm/infrastructure/service/console-logger.service.d.ts.map +1 -1
- package/dist/esm/infrastructure/service/console-logger.service.js +10 -6
- package/dist/esm/infrastructure/service/console-logger.service.js.map +1 -1
- package/dist/esm/infrastructure/utility/to-error.utility.d.ts +7 -0
- package/dist/esm/infrastructure/utility/to-error.utility.d.ts.map +1 -0
- package/dist/esm/infrastructure/utility/to-error.utility.js +20 -0
- package/dist/esm/infrastructure/utility/to-error.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/constant/injectable-metadata-key.constant.d.ts +2 -0
- package/dist/esm/presentation/ergonomics/constant/injectable-metadata-key.constant.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/constant/injectable-metadata-key.constant.js +4 -0
- package/dist/esm/presentation/ergonomics/constant/injectable-metadata-key.constant.js.map +1 -0
- package/dist/esm/presentation/ergonomics/constant/module-metadata-key.constant.d.ts +2 -0
- package/dist/esm/presentation/ergonomics/constant/module-metadata-key.constant.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/constant/module-metadata-key.constant.js +4 -0
- package/dist/esm/presentation/ergonomics/constant/module-metadata-key.constant.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/after-resolve.decorator.d.ts +6 -0
- package/dist/esm/presentation/ergonomics/decorator/after-resolve.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/after-resolve.decorator.js +39 -0
- package/dist/esm/presentation/ergonomics/decorator/after-resolve.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/index.d.ts +7 -0
- package/dist/esm/presentation/ergonomics/decorator/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/inject.decorator.d.ts +8 -0
- package/dist/esm/presentation/ergonomics/decorator/inject.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/inject.decorator.js +33 -0
- package/dist/esm/presentation/ergonomics/decorator/inject.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/injectable.decorator.d.ts +8 -0
- package/dist/esm/presentation/ergonomics/decorator/injectable.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/injectable.decorator.js +87 -0
- package/dist/esm/presentation/ergonomics/decorator/injectable.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/module.decorator.d.ts +8 -0
- package/dist/esm/presentation/ergonomics/decorator/module.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/module.decorator.js +141 -0
- package/dist/esm/presentation/ergonomics/decorator/module.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/on-dispose.decorator.d.ts +6 -0
- package/dist/esm/presentation/ergonomics/decorator/on-dispose.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/on-dispose.decorator.js +39 -0
- package/dist/esm/presentation/ergonomics/decorator/on-dispose.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/on-init.decorator.d.ts +6 -0
- package/dist/esm/presentation/ergonomics/decorator/on-init.decorator.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/decorator/on-init.decorator.js +39 -0
- package/dist/esm/presentation/ergonomics/decorator/on-init.decorator.js.map +1 -0
- package/dist/esm/presentation/ergonomics/index.d.ts +4 -0
- package/dist/esm/presentation/ergonomics/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/create/autowire-provider-options.interface.d.ts +12 -0
- package/dist/esm/presentation/ergonomics/interface/create/autowire-provider-options.interface.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/create/index.d.ts +3 -0
- package/dist/esm/presentation/ergonomics/interface/create/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/create/module-options.interface.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/interface/create/module-options.interface.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/decorator/index.d.ts +2 -0
- package/dist/esm/presentation/ergonomics/interface/decorator/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/decorator/module-options.interface.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/interface/decorator/module-options.interface.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/index.d.ts +4 -0
- package/dist/esm/presentation/ergonomics/interface/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/index.d.ts +3 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/metadata.interface.d.ts +12 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/metadata.interface.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/options.interface.d.ts +4 -0
- package/dist/esm/presentation/ergonomics/interface/injectable/options.interface.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/compose-decorated-modules.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/compose-decorated-modules.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/compose-decorated-modules.utility.js +61 -0
- package/dist/esm/presentation/ergonomics/utility/compose-decorated-modules.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/compose-modules.utility.d.ts +10 -0
- package/dist/esm/presentation/ergonomics/utility/compose-modules.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/compose-modules.utility.js +186 -0
- package/dist/esm/presentation/ergonomics/utility/compose-modules.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire-provider.utility.d.ts +14 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire-provider.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire-provider.utility.js +108 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire-provider.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire.utility.d.ts +15 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire.utility.js +32 -0
- package/dist/esm/presentation/ergonomics/utility/create/autowire.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/index.d.ts +5 -0
- package/dist/esm/presentation/ergonomics/utility/create/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/module-from-decorator.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/create/module-from-decorator.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/module-from-decorator.utility.js +133 -0
- package/dist/esm/presentation/ergonomics/utility/create/module-from-decorator.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/module.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/create/module.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/create/module.utility.js +17 -0
- package/dist/esm/presentation/ergonomics/utility/create/module.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/index.d.ts +6 -0
- package/dist/esm/presentation/ergonomics/utility/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/get.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/get.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/get.utility.js +18 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/get.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/index.d.ts +3 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/set.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/set.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/set.utility.js +13 -0
- package/dist/esm/presentation/ergonomics/utility/injectable-metadata/set.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/get.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/get.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/get.utility.js +18 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/get.utility.js.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/index.d.ts +3 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/index.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/set.utility.d.ts +9 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/set.utility.d.ts.map +1 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/set.utility.js +13 -0
- package/dist/esm/presentation/ergonomics/utility/module-metadata/set.utility.js.map +1 -0
- package/dist/esm/presentation/utility/create/di-container.utility.d.ts +9 -0
- package/dist/esm/presentation/utility/create/di-container.utility.d.ts.map +1 -0
- package/dist/esm/presentation/utility/create/di-container.utility.js +13 -0
- package/dist/esm/presentation/utility/create/di-container.utility.js.map +1 -0
- package/dist/esm/presentation/utility/create/index.d.ts +3 -3
- package/dist/esm/presentation/utility/create/index.d.ts.map +1 -1
- package/dist/esm/presentation/utility/create/lazy-provider.utility.d.ts +24 -0
- package/dist/esm/presentation/utility/create/lazy-provider.utility.d.ts.map +1 -0
- package/dist/esm/presentation/utility/create/lazy-provider.utility.js +27 -0
- package/dist/esm/presentation/utility/create/lazy-provider.utility.js.map +1 -0
- package/dist/esm/presentation/utility/create/logger.utility.d.ts +1 -1
- package/dist/esm/presentation/utility/create/logger.utility.js +1 -1
- package/dist/esm/presentation/utility/create/logger.utility.js.map +1 -1
- package/dist/esm/presentation/utility/create/token.utility.d.ts +9 -0
- package/dist/esm/presentation/utility/create/token.utility.d.ts.map +1 -0
- package/dist/esm/presentation/utility/create/token.utility.js +12 -0
- package/dist/esm/presentation/utility/create/token.utility.js.map +1 -0
- package/package.json +37 -29
- package/dist/cjs/domain/interface/container.interface.d.ts +0 -56
- package/dist/cjs/domain/interface/container.interface.d.ts.map +0 -1
- package/dist/cjs/domain/interface/factory.interface.d.ts +0 -20
- package/dist/cjs/domain/interface/factory.interface.d.ts.map +0 -1
- package/dist/cjs/domain/interface/registry.interface.d.ts +0 -55
- package/dist/cjs/domain/interface/registry.interface.d.ts.map +0 -1
- package/dist/cjs/infrastructure/class/base/container.class.d.ts +0 -68
- package/dist/cjs/infrastructure/class/base/container.class.d.ts.map +0 -1
- package/dist/cjs/infrastructure/class/base/container.class.js +0 -194
- package/dist/cjs/infrastructure/class/base/container.class.js.map +0 -1
- package/dist/cjs/infrastructure/class/base/factory.class.d.ts +0 -49
- package/dist/cjs/infrastructure/class/base/factory.class.d.ts.map +0 -1
- package/dist/cjs/infrastructure/class/base/factory.class.js +0 -88
- package/dist/cjs/infrastructure/class/base/factory.class.js.map +0 -1
- package/dist/cjs/infrastructure/class/base/registry.class.d.ts +0 -74
- package/dist/cjs/infrastructure/class/base/registry.class.d.ts.map +0 -1
- package/dist/cjs/infrastructure/class/base/registry.class.js +0 -222
- package/dist/cjs/infrastructure/class/base/registry.class.js.map +0 -1
- package/dist/cjs/infrastructure/interface/base/container-options.interface.d.ts +0 -13
- package/dist/cjs/infrastructure/interface/base/container-options.interface.d.ts.map +0 -1
- package/dist/cjs/infrastructure/interface/base/factory-options.interface.d.ts +0 -22
- package/dist/cjs/infrastructure/interface/base/factory-options.interface.d.ts.map +0 -1
- package/dist/cjs/infrastructure/interface/base/registry-options.interface.d.ts +0 -13
- package/dist/cjs/infrastructure/interface/base/registry-options.interface.d.ts.map +0 -1
- package/dist/cjs/presentation/utility/create/container.utility.d.ts +0 -10
- package/dist/cjs/presentation/utility/create/container.utility.d.ts.map +0 -1
- package/dist/cjs/presentation/utility/create/container.utility.js +0 -18
- package/dist/cjs/presentation/utility/create/container.utility.js.map +0 -1
- package/dist/cjs/presentation/utility/create/factory.utility.d.ts +0 -11
- package/dist/cjs/presentation/utility/create/factory.utility.d.ts.map +0 -1
- package/dist/cjs/presentation/utility/create/factory.utility.js +0 -19
- package/dist/cjs/presentation/utility/create/factory.utility.js.map +0 -1
- package/dist/cjs/presentation/utility/create/registry.utility.d.ts +0 -13
- package/dist/cjs/presentation/utility/create/registry.utility.d.ts.map +0 -1
- package/dist/cjs/presentation/utility/create/registry.utility.js +0 -19
- package/dist/cjs/presentation/utility/create/registry.utility.js.map +0 -1
- package/dist/esm/domain/interface/container.interface.d.ts +0 -56
- package/dist/esm/domain/interface/container.interface.d.ts.map +0 -1
- package/dist/esm/domain/interface/factory.interface.d.ts +0 -20
- package/dist/esm/domain/interface/factory.interface.d.ts.map +0 -1
- package/dist/esm/domain/interface/registry.interface.d.ts +0 -55
- package/dist/esm/domain/interface/registry.interface.d.ts.map +0 -1
- package/dist/esm/infrastructure/class/base/container.class.d.ts +0 -68
- package/dist/esm/infrastructure/class/base/container.class.d.ts.map +0 -1
- package/dist/esm/infrastructure/class/base/container.class.js +0 -192
- package/dist/esm/infrastructure/class/base/container.class.js.map +0 -1
- package/dist/esm/infrastructure/class/base/factory.class.d.ts +0 -49
- package/dist/esm/infrastructure/class/base/factory.class.d.ts.map +0 -1
- package/dist/esm/infrastructure/class/base/factory.class.js +0 -86
- package/dist/esm/infrastructure/class/base/factory.class.js.map +0 -1
- package/dist/esm/infrastructure/class/base/registry.class.d.ts +0 -74
- package/dist/esm/infrastructure/class/base/registry.class.d.ts.map +0 -1
- package/dist/esm/infrastructure/class/base/registry.class.js +0 -220
- package/dist/esm/infrastructure/class/base/registry.class.js.map +0 -1
- package/dist/esm/infrastructure/interface/base/container-options.interface.d.ts +0 -13
- package/dist/esm/infrastructure/interface/base/container-options.interface.d.ts.map +0 -1
- package/dist/esm/infrastructure/interface/base/factory-options.interface.d.ts +0 -22
- package/dist/esm/infrastructure/interface/base/factory-options.interface.d.ts.map +0 -1
- package/dist/esm/infrastructure/interface/base/registry-options.interface.d.ts +0 -13
- package/dist/esm/infrastructure/interface/base/registry-options.interface.d.ts.map +0 -1
- package/dist/esm/presentation/utility/create/container.utility.d.ts +0 -10
- package/dist/esm/presentation/utility/create/container.utility.d.ts.map +0 -1
- package/dist/esm/presentation/utility/create/container.utility.js +0 -16
- package/dist/esm/presentation/utility/create/container.utility.js.map +0 -1
- package/dist/esm/presentation/utility/create/factory.utility.d.ts +0 -11
- package/dist/esm/presentation/utility/create/factory.utility.d.ts.map +0 -1
- package/dist/esm/presentation/utility/create/factory.utility.js +0 -17
- package/dist/esm/presentation/utility/create/factory.utility.js.map +0 -1
- package/dist/esm/presentation/utility/create/registry.utility.d.ts +0 -13
- package/dist/esm/presentation/utility/create/registry.utility.d.ts.map +0 -1
- package/dist/esm/presentation/utility/create/registry.utility.js +0 -17
- package/dist/esm/presentation/utility/create/registry.utility.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,42 +1,272 @@
|
|
|
1
|
+
<a id="top"></a>
|
|
2
|
+
|
|
1
3
|
<p align="center">
|
|
2
|
-
<img src="https://6jft62zmy9nx2oea.public.blob.vercel-storage.com/cladi-eBDDJPOc5fj21RO45PzAwrdkkqGCHi.png" width="
|
|
4
|
+
<img src="https://6jft62zmy9nx2oea.public.blob.vercel-storage.com/cladi-eBDDJPOc5fj21RO45PzAwrdkkqGCHi.png" width="700" alt="project-logo">
|
|
3
5
|
</p>
|
|
4
6
|
|
|
5
|
-
<h1 align="center"
|
|
6
|
-
<p align="center"><em>
|
|
7
|
+
<h1 align="center">🏗️ ClaDI</h1>
|
|
8
|
+
<p align="center"><em>A zero-dependency TypeScript dependency injection toolkit for composition-root architecture and clean, modular applications</em></p>
|
|
7
9
|
|
|
8
10
|
<p align="center">
|
|
9
11
|
<a aria-label="ElsiKora logo" href="https://elsikora.com">
|
|
10
12
|
<img src="https://img.shields.io/badge/MADE%20BY%20ElsiKora-333333.svg?style=for-the-badge" alt="ElsiKora">
|
|
11
|
-
</a> <img src="https://img.shields.io/badge/
|
|
13
|
+
</a> <img src="https://img.shields.io/badge/TypeScript-3178C6.svg?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript"> <img src="https://img.shields.io/badge/Node.js-339933.svg?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"> <img src="https://img.shields.io/badge/npm-CB3837.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"> <img src="https://img.shields.io/badge/Rollup-EC4A3F.svg?style=for-the-badge&logo=rollup&logoColor=white" alt="Rollup"> <img src="https://img.shields.io/badge/Vitest-6E9F18.svg?style=for-the-badge&logo=vitest&logoColor=white" alt="Vitest"> <img src="https://img.shields.io/badge/ESLint-4B32C3.svg?style=for-the-badge&logo=eslint&logoColor=white" alt="ESLint"> <img src="https://img.shields.io/badge/Prettier-F7B93E.svg?style=for-the-badge&logo=prettier&logoColor=black" alt="Prettier"> <img src="https://img.shields.io/badge/GitHub%20Actions-2088FF.svg?style=for-the-badge&logo=github-actions&logoColor=white" alt="GitHub Actions">
|
|
12
14
|
</p>
|
|
13
15
|
|
|
16
|
+
## 💡 Highlights
|
|
17
|
+
|
|
18
|
+
- 🪶 Zero runtime dependencies — the entire DI container ships at minimal bundle cost with no transitive dependency risk
|
|
19
|
+
- 🔒 Fully type-safe tokens via `createToken<T>()` — dependency mismatches are caught at compile time, not runtime
|
|
20
|
+
- 🧩 Scope-aware lifecycles with deterministic disposal — singleton, scoped, and transient providers with automatic cleanup in correct order
|
|
21
|
+
- 🏛️ Clean Architecture native — domain and application layers never import DI APIs; only the composition root touches the container
|
|
14
22
|
|
|
15
23
|
## 📚 Table of Contents
|
|
24
|
+
|
|
16
25
|
- [Description](#-description)
|
|
26
|
+
- [Tech Stack](#-tech-stack)
|
|
17
27
|
- [Features](#-features)
|
|
28
|
+
- [Architecture](#-architecture)
|
|
29
|
+
- [Project Structure](#-project-structure)
|
|
30
|
+
- [Prerequisites](#-prerequisites)
|
|
18
31
|
- [Installation](#-installation)
|
|
19
32
|
- [Usage](#-usage)
|
|
33
|
+
- [API Quick Reference](#-api-quick-reference)
|
|
34
|
+
- [Production Bootstrap](#-production-bootstrap)
|
|
35
|
+
- [Common Pitfalls](#-common-pitfalls)
|
|
20
36
|
- [Roadmap](#-roadmap)
|
|
21
37
|
- [FAQ](#-faq)
|
|
22
38
|
- [License](#-license)
|
|
23
|
-
|
|
39
|
+
- [Acknowledgments](#-acknowledgments)
|
|
24
40
|
|
|
25
41
|
## 📖 Description
|
|
26
|
-
|
|
42
|
+
|
|
43
|
+
ClaDI (Class Dependency Injection) is a production-grade, zero-dependency TypeScript library that provides a complete dependency injection container with scope-aware lifecycles, typed tokens, and deterministic cleanup.
|
|
44
|
+
|
|
45
|
+
Unlike heavyweight DI frameworks that rely on decorators, reflection metadata, or runtime magic, ClaDI embraces **explicit composition roots** — giving you full control over how your dependency graph is assembled, resolved, and disposed.
|
|
46
|
+
|
|
47
|
+
### Real-World Use Cases
|
|
48
|
+
|
|
49
|
+
- **Backend Services**: Wire up HTTP handlers, database connections, and middleware with request-scoped isolation. Each incoming request gets its own scope with automatic cleanup.
|
|
50
|
+
- **CLI Tools**: Parse arguments, register them as scoped values, resolve command handlers, and dispose cleanly after execution.
|
|
51
|
+
- **Microservices**: Manage singleton adapters (database pools, message queues) alongside per-job transient workers with lifecycle guarantees.
|
|
52
|
+
- **Modular Monoliths**: Use the module system (`composeModules`) to define bounded contexts with explicit export contracts — no accidental cross-boundary coupling.
|
|
53
|
+
- **Testing**: Swap out any provider at any scope level without touching production code. The typed token system catches mismatches at compile time.
|
|
54
|
+
|
|
55
|
+
ClaDI ships with **5 provider strategies** (`useValue`, `useClass`, `useFactory`, `useExisting`, `useLazy`), **3 lifecycle modes** (`singleton`, `scoped`, `transient`), built-in **circular dependency detection**, **captive dependency warnings**, and full **async resolution** support — all in a package with zero runtime dependencies.
|
|
56
|
+
|
|
57
|
+
## 🛠️ Tech Stack
|
|
58
|
+
|
|
59
|
+
| Category | Technologies |
|
|
60
|
+
| ------------------- | -------------------------------- |
|
|
61
|
+
| **Language** | TypeScript |
|
|
62
|
+
| **Runtime** | Node.js |
|
|
63
|
+
| **Build Tool** | Rollup |
|
|
64
|
+
| **Testing** | Vitest |
|
|
65
|
+
| **Linting** | ESLint, Prettier |
|
|
66
|
+
| **CI/CD** | GitHub Actions, Semantic Release |
|
|
67
|
+
| **Package Manager** | npm |
|
|
68
|
+
| **Documentation** | MDX, Nextra |
|
|
27
69
|
|
|
28
70
|
## 🚀 Features
|
|
29
|
-
|
|
30
|
-
- ✨
|
|
31
|
-
- ✨
|
|
32
|
-
- ✨
|
|
33
|
-
- ✨
|
|
34
|
-
- ✨
|
|
35
|
-
- ✨
|
|
36
|
-
- ✨
|
|
37
|
-
- ✨
|
|
71
|
+
|
|
72
|
+
- ✨ **Typed Token System** — `createToken<T>()` produces branded symbols that carry type information through the entire resolution chain, eliminating `any` casts and runtime type errors
|
|
73
|
+
- ✨ **5 Provider Strategies** — `useValue`, `useClass`, `useFactory`, `useExisting` (alias), and `useLazy` (deferred async) cover common dependency wiring patterns
|
|
74
|
+
- ✨ **Scope-Aware Lifecycles** — Singleton (process-wide), Scoped (per-request/job), and Transient (per-resolve) with deterministic cache semantics
|
|
75
|
+
- ✨ **Hierarchical Scope Tree** — Child scopes inherit parent registrations, can add local overrides, and dispose independently without affecting siblings
|
|
76
|
+
- ✨ **Async Resolution Pipeline** — `resolveAsync()` handles async factories, deduplicates concurrent singleton creation, and tracks in-flight resolutions during disposal
|
|
77
|
+
- ✨ **Lifecycle Hooks** — `onInit`, `afterResolve`, and `onDispose` hooks per provider for warmup, instrumentation, and cleanup
|
|
78
|
+
- ✨ **Multi-Binding Support** — Register multiple implementations for a single token and resolve all with `resolveAll()` / `resolveAllAsync()`
|
|
79
|
+
- ✨ **Circular Dependency Detection** — Detected both at resolution time and proactively via `validate()` at startup
|
|
80
|
+
- ✨ **Captive Dependency Guard** — Warns or errors when a singleton captures a scoped dependency, preventing subtle lifecycle bugs
|
|
81
|
+
- ✨ **Module System** — `createModule()` and `composeModules()` enable declarative, bounded-context module composition with explicit export contracts
|
|
82
|
+
- ✨ **Decorator Support** — Optional `@Injectable()`, `@Inject()`, `@Module()`, `@OnInit()`, `@AfterResolve()`, and `@OnDispose()` without requiring `reflect-metadata`
|
|
83
|
+
- ✨ **Decorator Composition Helpers** — `autowire()`, `createModuleFromDecorator()`, and `composeDecoratedModules()` keep decorator workflows explicit but concise
|
|
84
|
+
- ✨ **Runtime Diagnostics** — `explain(token)`, `snapshot()`, and `exportGraph()` provide operational visibility into provider lookup and dependency edges
|
|
85
|
+
- ✨ **Deterministic Disposal** — `dispose()` waits for in-flight async resolutions, runs disposers in reverse order, and supports `Symbol.dispose` / `Symbol.asyncDispose`
|
|
86
|
+
- ✨ **Resolve Interceptors** — Hook into every resolution with `onStart`, `onSuccess`, and `onError` callbacks for logging, metrics, or tracing
|
|
87
|
+
- ✨ **Safe Deep Clone Utility** — `safeDeepClone()` handles circular references, functions, Maps, Sets, and class instances unlike `structuredClone`
|
|
88
|
+
|
|
89
|
+
## 🏗 Architecture
|
|
90
|
+
|
|
91
|
+
### System Architecture
|
|
92
|
+
|
|
93
|
+
```mermaid
|
|
94
|
+
flowchart TD
|
|
95
|
+
presentation[Presentation Layer]
|
|
96
|
+
application[Application Layer]
|
|
97
|
+
domain[Domain Layer]
|
|
98
|
+
infrastructure[Infrastructure Layer]
|
|
99
|
+
|
|
100
|
+
presentation --> application
|
|
101
|
+
presentation --> infrastructure
|
|
102
|
+
application --> domain
|
|
103
|
+
infrastructure --> domain
|
|
104
|
+
|
|
105
|
+
presentation --- ergonomics[Ergonomics]
|
|
106
|
+
presentation --- utilities[Create Utilities]
|
|
107
|
+
ergonomics --- decorators[Decorators]
|
|
108
|
+
ergonomics --- modules[Module Composer]
|
|
109
|
+
|
|
110
|
+
infrastructure --- diContainer[DI Container]
|
|
111
|
+
infrastructure --- coreFactory[Core Factory]
|
|
112
|
+
infrastructure --- loggerService[Console Logger]
|
|
113
|
+
|
|
114
|
+
diContainer --- cacheCoord[Cache Coordinator]
|
|
115
|
+
diContainer --- resolutionEngine[Resolution Engine]
|
|
116
|
+
diContainer --- registrationCoord[Registration Coordinator]
|
|
117
|
+
diContainer --- disposalCoord[Disposal Coordinator]
|
|
118
|
+
|
|
119
|
+
domain --- tokens[Tokens and Types]
|
|
120
|
+
domain --- enums[Enums]
|
|
121
|
+
domain --- interfaces[Contracts]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Data Flow
|
|
125
|
+
|
|
126
|
+
```mermaid
|
|
127
|
+
sequenceDiagram
|
|
128
|
+
participant App as Application
|
|
129
|
+
participant Container as DI Container
|
|
130
|
+
participant Registry as Registration Coordinator
|
|
131
|
+
participant Engine as Resolution Engine
|
|
132
|
+
participant Cache as Cache Coordinator
|
|
133
|
+
participant Disposal as Disposal Coordinator
|
|
134
|
+
|
|
135
|
+
App->>Container: createDIContainer(options)
|
|
136
|
+
App->>Container: register(provider)
|
|
137
|
+
Container->>Registry: registerProvider(provider)
|
|
138
|
+
Registry->>Registry: validate provider shape
|
|
139
|
+
Registry->>Container: store registration
|
|
140
|
+
|
|
141
|
+
App->>Container: validate()
|
|
142
|
+
Container->>Container: walk dependency graph
|
|
143
|
+
|
|
144
|
+
App->>Container: resolve(token)
|
|
145
|
+
Container->>Engine: resolve(tokenSymbol)
|
|
146
|
+
Engine->>Container: findProvider(scope, key)
|
|
147
|
+
Container->>Cache: getScopedCacheForLifecycle()
|
|
148
|
+
alt Cache Hit
|
|
149
|
+
Cache-->>Engine: cached instance
|
|
150
|
+
else Cache Miss
|
|
151
|
+
Engine->>Engine: instantiate provider
|
|
152
|
+
Engine->>Engine: run onInit hook
|
|
153
|
+
Engine->>Cache: store in cache
|
|
154
|
+
Engine->>Disposal: register disposer
|
|
155
|
+
end
|
|
156
|
+
Engine->>Engine: run afterResolve hook
|
|
157
|
+
Engine-->>App: resolved instance
|
|
158
|
+
|
|
159
|
+
App->>Container: dispose()
|
|
160
|
+
Container->>Disposal: disposeInternal()
|
|
161
|
+
Disposal->>Disposal: wait for in-flight async
|
|
162
|
+
Disposal->>Disposal: dispose child scopes
|
|
163
|
+
Disposal->>Disposal: run disposers in reverse
|
|
164
|
+
Disposal->>Cache: clear all caches
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## 📁 Project Structure
|
|
168
|
+
|
|
169
|
+
<details>
|
|
170
|
+
<summary>Click to expand</summary>
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
ClaDI/
|
|
174
|
+
├── .github/
|
|
175
|
+
│ ├── workflows/
|
|
176
|
+
│ │ ├── mirror-docs-to-docviewer.yml
|
|
177
|
+
│ │ ├── mirror-to-codecommit.yml
|
|
178
|
+
│ │ ├── qodana-quality-scan.yml
|
|
179
|
+
│ │ ├── release.yml
|
|
180
|
+
│ │ ├── snyk-security-scan.yml
|
|
181
|
+
│ │ └── test.yml
|
|
182
|
+
│ └── dependabot.yml
|
|
183
|
+
├── docs/
|
|
184
|
+
│ ├── api-reference/
|
|
185
|
+
│ │ ├── enums/
|
|
186
|
+
│ │ ├── interfaces/
|
|
187
|
+
│ │ ├── _meta.js
|
|
188
|
+
│ │ └── page.mdx
|
|
189
|
+
│ ├── core-concepts/
|
|
190
|
+
│ │ ├── advanced-di/
|
|
191
|
+
│ │ ├── clean-architecture-playbook/
|
|
192
|
+
│ │ ├── container/
|
|
193
|
+
│ │ ├── error-handling/
|
|
194
|
+
│ │ ├── factory/
|
|
195
|
+
│ │ ├── registry/
|
|
196
|
+
│ │ ├── _meta.js
|
|
197
|
+
│ │ └── page.mdx
|
|
198
|
+
│ ├── getting-started/
|
|
199
|
+
│ │ ├── _meta.js
|
|
200
|
+
│ │ ├── composition-root-checklist.mdx
|
|
201
|
+
│ │ └── page.mdx
|
|
202
|
+
│ ├── services/
|
|
203
|
+
│ │ ├── logging/
|
|
204
|
+
│ │ ├── _meta.js
|
|
205
|
+
│ │ └── page.mdx
|
|
206
|
+
│ ├── utilities/
|
|
207
|
+
│ │ ├── creation-helpers/
|
|
208
|
+
│ │ ├── _meta.js
|
|
209
|
+
│ │ └── page.mdx
|
|
210
|
+
│ ├── _meta.js
|
|
211
|
+
│ └── page.mdx
|
|
212
|
+
├── src/
|
|
213
|
+
│ ├── application/
|
|
214
|
+
│ │ └── utility/
|
|
215
|
+
│ ├── domain/
|
|
216
|
+
│ │ ├── enum/
|
|
217
|
+
│ │ ├── interface/
|
|
218
|
+
│ │ ├── type/
|
|
219
|
+
│ │ └── index.ts
|
|
220
|
+
│ ├── infrastructure/
|
|
221
|
+
│ │ ├── class/
|
|
222
|
+
│ │ ├── constant/
|
|
223
|
+
│ │ ├── factory/
|
|
224
|
+
│ │ ├── interface/
|
|
225
|
+
│ │ ├── service/
|
|
226
|
+
│ │ └── index.ts
|
|
227
|
+
│ ├── presentation/
|
|
228
|
+
│ │ ├── ergonomics/
|
|
229
|
+
│ │ └── utility/
|
|
230
|
+
│ └── index.ts
|
|
231
|
+
├── test/
|
|
232
|
+
│ ├── contract/
|
|
233
|
+
│ │ └── di-container.contract.test.ts
|
|
234
|
+
│ ├── e2e/
|
|
235
|
+
│ │ └── core-integration.e2e.test.ts
|
|
236
|
+
│ ├── perf/
|
|
237
|
+
│ │ └── di-container.perf.test.ts
|
|
238
|
+
│ └── unit/
|
|
239
|
+
│ ├── application/
|
|
240
|
+
│ ├── ergonomics/
|
|
241
|
+
│ ├── infrastructure/
|
|
242
|
+
│ └── presentation/
|
|
243
|
+
├── CHANGELOG.md
|
|
244
|
+
├── commitlint.config.js
|
|
245
|
+
├── eslint.config.js
|
|
246
|
+
├── LICENSE
|
|
247
|
+
├── lint-staged.config.js
|
|
248
|
+
├── package-lock.json
|
|
249
|
+
├── package.json
|
|
250
|
+
├── prettier.config.js
|
|
251
|
+
├── release.config.js
|
|
252
|
+
├── rollup.config.js
|
|
253
|
+
├── rollup.test.config.js
|
|
254
|
+
├── tsconfig.build.json
|
|
255
|
+
├── tsconfig.json
|
|
256
|
+
├── vitest.e2e.config.js
|
|
257
|
+
└── vitest.unit.config.js
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
## 📋 Prerequisites
|
|
263
|
+
|
|
264
|
+
- Node.js >= 20.0.0
|
|
265
|
+
- npm >= 9.0.0
|
|
266
|
+
- TypeScript >= 5.0.0 (for development)
|
|
38
267
|
|
|
39
268
|
## 🛠 Installation
|
|
269
|
+
|
|
40
270
|
```bash
|
|
41
271
|
# Using npm
|
|
42
272
|
npm install @elsikora/cladi
|
|
@@ -51,275 +281,432 @@ pnpm add @elsikora/cladi
|
|
|
51
281
|
bun add @elsikora/cladi
|
|
52
282
|
```
|
|
53
283
|
|
|
284
|
+
### Development Setup
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# Clone the repository
|
|
288
|
+
git clone https://github.com/ElsiKora/ClaDI.git
|
|
289
|
+
cd ClaDI
|
|
290
|
+
|
|
291
|
+
# Install dependencies
|
|
292
|
+
npm install
|
|
293
|
+
|
|
294
|
+
# Build the project (ESM + CJS dual output)
|
|
295
|
+
npm run build
|
|
296
|
+
|
|
297
|
+
# Run all tests
|
|
298
|
+
npm run test:all
|
|
299
|
+
|
|
300
|
+
# Run linting
|
|
301
|
+
npm run lint:all
|
|
302
|
+
```
|
|
303
|
+
|
|
54
304
|
## 💡 Usage
|
|
55
|
-
## Basic Usage
|
|
56
305
|
|
|
57
|
-
|
|
306
|
+
### Quick Start — Your First Composition Root
|
|
58
307
|
|
|
59
308
|
```typescript
|
|
60
|
-
import {
|
|
309
|
+
import { createDIContainer, createToken, EDependencyLifecycle } from "@elsikora/cladi";
|
|
61
310
|
|
|
62
|
-
// Define
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
email: string;
|
|
66
|
-
role: string;
|
|
67
|
-
}
|
|
311
|
+
// 1. Define typed tokens
|
|
312
|
+
const ConfigToken = createToken<{ apiUrl: string }>("Config");
|
|
313
|
+
const HttpClientToken = createToken<{ get(path: string): Promise<unknown> }>("HttpClient");
|
|
68
314
|
|
|
69
|
-
// Create
|
|
70
|
-
const
|
|
71
|
-
level: ELoggerLogLevel.DEBUG,
|
|
72
|
-
source: 'UserModule'
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Create a registry to store user templates
|
|
76
|
-
const registry = createRegistry<User>({ logger });
|
|
315
|
+
// 2. Create the container
|
|
316
|
+
const container = createDIContainer({ scopeName: "root" });
|
|
77
317
|
|
|
78
|
-
// Register
|
|
79
|
-
|
|
80
|
-
|
|
318
|
+
// 3. Register providers
|
|
319
|
+
container.register({
|
|
320
|
+
provide: ConfigToken,
|
|
321
|
+
useValue: { apiUrl: "https://api.example.com" },
|
|
322
|
+
});
|
|
81
323
|
|
|
82
|
-
|
|
83
|
-
|
|
324
|
+
container.register({
|
|
325
|
+
provide: HttpClientToken,
|
|
326
|
+
lifecycle: EDependencyLifecycle.SCOPED,
|
|
327
|
+
deps: [ConfigToken],
|
|
328
|
+
useFactory: (config) => ({
|
|
329
|
+
get: async (path: string) => fetch(`${config.apiUrl}${path}`).then((r) => r.json()),
|
|
330
|
+
}),
|
|
331
|
+
});
|
|
84
332
|
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
console.log(adminUser); // { name: 'admin', email: 'admin@example.com', role: 'admin' }
|
|
333
|
+
// 4. Validate at startup
|
|
334
|
+
container.validate();
|
|
88
335
|
|
|
89
|
-
//
|
|
90
|
-
|
|
336
|
+
// 5. Resolve dependencies
|
|
337
|
+
const http = container.resolve(HttpClientToken);
|
|
91
338
|
```
|
|
92
339
|
|
|
93
|
-
|
|
340
|
+
---
|
|
94
341
|
|
|
95
|
-
|
|
342
|
+
### Request-Scoped Resolution
|
|
96
343
|
|
|
97
344
|
```typescript
|
|
98
|
-
|
|
345
|
+
async function handleRequest(requestId: string) {
|
|
346
|
+
const scope = container.createScope("request");
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
// Register request-specific context
|
|
350
|
+
const RequestIdToken = createToken<string>("RequestId");
|
|
351
|
+
scope.register({ provide: RequestIdToken, useValue: requestId });
|
|
352
|
+
|
|
353
|
+
// Resolve scoped services
|
|
354
|
+
const http = scope.resolve(HttpClientToken);
|
|
355
|
+
return await http.get("/data");
|
|
356
|
+
} finally {
|
|
357
|
+
// Always dispose the scope
|
|
358
|
+
await scope.dispose();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
99
362
|
|
|
100
|
-
|
|
101
|
-
const LoggerToken = Symbol('Logger');
|
|
102
|
-
const DatabaseToken = Symbol('Database');
|
|
363
|
+
---
|
|
103
364
|
|
|
104
|
-
|
|
105
|
-
const container = createContainer({});
|
|
365
|
+
### Lazy Providers (Deferred Resolution)
|
|
106
366
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
367
|
+
```typescript
|
|
368
|
+
import { createLazyProvider, createToken } from "@elsikora/cladi";
|
|
369
|
+
|
|
370
|
+
const DbToken = createToken<Database>("Database");
|
|
371
|
+
const LazyDbToken = createToken<() => Promise<Database>>("LazyDatabase");
|
|
112
372
|
|
|
113
|
-
container.register(
|
|
114
|
-
|
|
115
|
-
|
|
373
|
+
container.register({
|
|
374
|
+
provide: DbToken,
|
|
375
|
+
lifecycle: EDependencyLifecycle.SINGLETON,
|
|
376
|
+
useFactory: async () => await connectToDatabase(),
|
|
116
377
|
});
|
|
117
378
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
379
|
+
// Lazy provider defers resolution until invoked
|
|
380
|
+
container.register(createLazyProvider(LazyDbToken, DbToken));
|
|
381
|
+
|
|
382
|
+
// Database connection is NOT created yet
|
|
383
|
+
const getDb = container.resolve(LazyDbToken);
|
|
121
384
|
|
|
122
|
-
|
|
123
|
-
db
|
|
124
|
-
db?.query('SELECT * FROM users');
|
|
385
|
+
// Now it resolves
|
|
386
|
+
const db = await getDb();
|
|
125
387
|
```
|
|
126
388
|
|
|
127
|
-
|
|
389
|
+
---
|
|
128
390
|
|
|
129
|
-
|
|
391
|
+
### Multi-Binding Pattern
|
|
130
392
|
|
|
131
393
|
```typescript
|
|
132
|
-
|
|
394
|
+
const MiddlewareToken = createToken<Middleware>("Middleware");
|
|
133
395
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
396
|
+
container.register({
|
|
397
|
+
provide: MiddlewareToken,
|
|
398
|
+
isMultiBinding: true,
|
|
399
|
+
useFactory: () => createAuthMiddleware(),
|
|
137
400
|
});
|
|
138
401
|
|
|
139
|
-
|
|
140
|
-
|
|
402
|
+
container.register({
|
|
403
|
+
provide: MiddlewareToken,
|
|
404
|
+
isMultiBinding: true,
|
|
405
|
+
useFactory: () => createLoggingMiddleware(),
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// Resolve all implementations
|
|
409
|
+
const middlewares = container.resolveAll(MiddlewareToken);
|
|
410
|
+
// => [authMiddleware, loggingMiddleware]
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
### Module System
|
|
141
416
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
417
|
+
```typescript
|
|
418
|
+
import { createModule, composeModules, createDIContainer } from "@elsikora/cladi";
|
|
419
|
+
|
|
420
|
+
const databaseModule = createModule({
|
|
421
|
+
name: "database",
|
|
422
|
+
exports: [DbConnectionToken],
|
|
423
|
+
providers: [
|
|
424
|
+
{ provide: DbConfigToken, useValue: { host: "localhost" } },
|
|
425
|
+
{
|
|
426
|
+
provide: DbConnectionToken,
|
|
427
|
+
deps: [DbConfigToken],
|
|
428
|
+
lifecycle: EDependencyLifecycle.SINGLETON,
|
|
429
|
+
useFactory: (config) => createConnection(config),
|
|
430
|
+
},
|
|
431
|
+
],
|
|
149
432
|
});
|
|
150
433
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
434
|
+
const appModule = createModule({
|
|
435
|
+
name: "app",
|
|
436
|
+
imports: [databaseModule],
|
|
437
|
+
providers: [
|
|
438
|
+
{
|
|
439
|
+
provide: UserRepoToken,
|
|
440
|
+
deps: [DbConnectionToken],
|
|
441
|
+
useFactory: (db) => new UserRepository(db),
|
|
442
|
+
},
|
|
443
|
+
],
|
|
158
444
|
});
|
|
159
445
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// [2023-07-15T12:34:56.790Z] DEBUG: [PaymentService] Payment details received {"paymentId":"12345","amount":99.99,"currency":"USD"}
|
|
163
|
-
// [2023-07-15T12:34:56.791Z] WARN: [PaymentService → PaymentGateway] Retry attempt required {"attempt":2,"maxAttempts":3}
|
|
446
|
+
const container = createDIContainer();
|
|
447
|
+
composeModules(container, [appModule]);
|
|
164
448
|
```
|
|
165
449
|
|
|
166
|
-
|
|
450
|
+
---
|
|
167
451
|
|
|
168
|
-
|
|
452
|
+
### Decorator Module Composition (Nest-Like Ergonomics)
|
|
169
453
|
|
|
170
454
|
```typescript
|
|
171
|
-
import {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
455
|
+
import { Inject, Injectable, Module, composeDecoratedModules, createDIContainer, createToken, EDependencyLifecycle } from "@elsikora/cladi";
|
|
456
|
+
|
|
457
|
+
const ConfigToken = createToken<{ baseUrl: string }>("Config");
|
|
458
|
+
const ApiToken = createToken<{ ping(): string }>("Api");
|
|
459
|
+
|
|
460
|
+
@Injectable({ token: ApiToken, lifecycle: EDependencyLifecycle.SINGLETON })
|
|
461
|
+
class ApiService {
|
|
462
|
+
constructor(@Inject(ConfigToken) private readonly config: { baseUrl: string }) {}
|
|
180
463
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
price: number;
|
|
185
|
-
inStock: boolean;
|
|
464
|
+
public ping(): string {
|
|
465
|
+
return `pong:${this.config.baseUrl}`;
|
|
466
|
+
}
|
|
186
467
|
}
|
|
187
468
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
469
|
+
@Module({
|
|
470
|
+
exports: [ApiToken],
|
|
471
|
+
providers: [{ provide: ConfigToken, useValue: { baseUrl: "https://api.example.com" } }, ApiService],
|
|
472
|
+
})
|
|
473
|
+
class AppModule {}
|
|
192
474
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
475
|
+
const container = createDIContainer();
|
|
476
|
+
composeDecoratedModules(container, [AppModule]);
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
Use `createModuleFromDecorator()` directly when you need manual conversion to plain `IDIModule` for custom orchestration.
|
|
480
|
+
|
|
481
|
+
---
|
|
482
|
+
|
|
483
|
+
### Lifecycle Hooks
|
|
196
484
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
485
|
+
```typescript
|
|
486
|
+
container.register({
|
|
487
|
+
provide: CacheToken,
|
|
488
|
+
lifecycle: EDependencyLifecycle.SINGLETON,
|
|
489
|
+
useFactory: () => new RedisCache(),
|
|
490
|
+
onInit: (cache) => cache.warmup(),
|
|
491
|
+
afterResolve: (cache) => cache.recordUsage(),
|
|
492
|
+
onDispose: async (cache) => await cache.disconnect(),
|
|
493
|
+
});
|
|
200
494
|
```
|
|
201
495
|
|
|
202
|
-
|
|
496
|
+
---
|
|
203
497
|
|
|
204
|
-
|
|
498
|
+
### Diagnostics
|
|
205
499
|
|
|
206
500
|
```typescript
|
|
207
|
-
|
|
501
|
+
// Explain resolution path for a token
|
|
502
|
+
const explanation = container.explain(HttpClientToken);
|
|
503
|
+
console.log(explanation);
|
|
504
|
+
// { isFound: true, lifecycle: 'scoped', providerType: 'factory',
|
|
505
|
+
// dependencies: ['Symbol(Config)'], lookupPath: ['root'], ... }
|
|
506
|
+
|
|
507
|
+
// Full container snapshot
|
|
508
|
+
const snapshot = container.snapshot();
|
|
509
|
+
console.log(snapshot);
|
|
510
|
+
// { scopeId: 'root', providerCount: 3, singletonCacheSize: 1,
|
|
511
|
+
// tokens: ['Symbol(Config)', 'Symbol(HttpClient)', ...], ... }
|
|
512
|
+
```
|
|
208
513
|
|
|
209
|
-
|
|
210
|
-
name: string;
|
|
211
|
-
basePrice: number;
|
|
212
|
-
discountPercent: number;
|
|
213
|
-
}
|
|
514
|
+
---
|
|
214
515
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
516
|
+
### Lock, Bootstrap, and Graph Export
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
// Eagerly initialize singleton providers (and run onInit hooks)
|
|
520
|
+
await container.bootstrap();
|
|
521
|
+
|
|
522
|
+
// Optionally bootstrap specific tokens only
|
|
523
|
+
await container.bootstrap([DbToken, CacheToken]);
|
|
524
|
+
|
|
525
|
+
// Freeze registration surface for runtime safety
|
|
526
|
+
container.lock();
|
|
527
|
+
console.log(container.isLocked); // true
|
|
528
|
+
|
|
529
|
+
// Export graph for observability or visualization
|
|
530
|
+
const graph = container.exportGraph();
|
|
531
|
+
console.log(graph.nodes);
|
|
532
|
+
console.log(graph.edges);
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
## 🧭 API Quick Reference
|
|
536
|
+
|
|
537
|
+
| Goal | API | Notes |
|
|
538
|
+
| --------------------------------- | -------------------------------------------------------- | --------------------------------------------- | -------------------------------- |
|
|
539
|
+
| Resolve one dependency (sync) | `resolve(token)` | Throws if provider path is async |
|
|
540
|
+
| Resolve one dependency (async) | `resolveAsync(token)` | Works with async factories and async hooks |
|
|
541
|
+
| Resolve many implementations | `resolveAll(token)` / `resolveAllAsync(token)` | For multi-binding registrations |
|
|
542
|
+
| Resolve optional dependency | `resolveOptional(token)` / `resolveOptionalAsync(token)` | Returns `undefined` if not found |
|
|
543
|
+
| Create isolated runtime boundary | `createScope(name?)` | Use for request/job/command context |
|
|
544
|
+
| Register providers | `register(provider | provider[])` | Supports all provider strategies |
|
|
545
|
+
| Validate graph at startup | `validate()` | Checks missing deps, cycles, and policy rules |
|
|
546
|
+
| Pre-warm singleton graph | `bootstrap(tokens?)` | Eager resolve + `onInit` execution |
|
|
547
|
+
| Lock runtime registration surface | `lock()` / `isLocked` | Prevents `register` / `unregister` calls |
|
|
548
|
+
| Inspect runtime path and cache | `explain(token)` / `snapshot()` | Debug lookup path and cache state |
|
|
549
|
+
| Export dependency nodes and edges | `exportGraph()` | Structured graph for diagnostics and tooling |
|
|
550
|
+
| Compose plain modules | `composeModules(container, modules)` | `IDIModule` import/export contract |
|
|
551
|
+
| Compose decorated module classes | `composeDecoratedModules(container, modules)` | Accepts `@Module` classes and plain modules |
|
|
552
|
+
| Release resources | `scope.dispose()` / `container.dispose()` | Always call in `finally` or shutdown flow |
|
|
553
|
+
|
|
554
|
+
## 🧱 Production Bootstrap
|
|
555
|
+
|
|
556
|
+
Use explicit policies and graceful shutdown in your root composition setup:
|
|
557
|
+
|
|
558
|
+
```typescript
|
|
559
|
+
import { createDIContainer, EDiContainerCaptiveDependencyPolicy, EDiContainerDuplicateProviderPolicy, type IResolveInterceptor } from "@elsikora/cladi";
|
|
560
|
+
|
|
561
|
+
const metricsInterceptor: IResolveInterceptor = {
|
|
562
|
+
onError: ({ tokenDescription, error }) => {
|
|
563
|
+
console.error("resolve error", tokenDescription, error.message);
|
|
564
|
+
},
|
|
565
|
+
onStart: ({ tokenDescription }) => {
|
|
566
|
+
console.debug("resolve start", tokenDescription);
|
|
567
|
+
},
|
|
568
|
+
onSuccess: ({ tokenDescription }) => {
|
|
569
|
+
console.debug("resolve success", tokenDescription);
|
|
570
|
+
},
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
const container = createDIContainer({
|
|
574
|
+
captiveDependencyPolicy: EDiContainerCaptiveDependencyPolicy.ERROR,
|
|
575
|
+
duplicateProviderPolicy: EDiContainerDuplicateProviderPolicy.ERROR,
|
|
576
|
+
resolveInterceptors: [metricsInterceptor],
|
|
577
|
+
scopeName: "root",
|
|
226
578
|
});
|
|
227
579
|
|
|
228
|
-
//
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
discount,
|
|
234
|
-
finalPrice: template.basePrice - discount,
|
|
235
|
-
timestamp: new Date().toISOString()
|
|
236
|
-
};
|
|
580
|
+
// register providers...
|
|
581
|
+
container.validate();
|
|
582
|
+
|
|
583
|
+
const shutdown = async (): Promise<void> => {
|
|
584
|
+
await container.dispose();
|
|
237
585
|
};
|
|
238
586
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
registry: orderRegistry as any,
|
|
242
|
-
transformer: orderTransformer
|
|
587
|
+
process.once("SIGINT", () => {
|
|
588
|
+
void shutdown();
|
|
243
589
|
});
|
|
244
590
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
// {
|
|
249
|
-
// name: 'standard',
|
|
250
|
-
// basePrice: 100,
|
|
251
|
-
// discountPercent: 0,
|
|
252
|
-
// discount: 0,
|
|
253
|
-
// finalPrice: 100,
|
|
254
|
-
// timestamp: '2023-07-15T12:34:56.789Z'
|
|
255
|
-
// }
|
|
256
|
-
|
|
257
|
-
const saleOrder = orderFactory.create('sale');
|
|
258
|
-
console.log(saleOrder);
|
|
259
|
-
// {
|
|
260
|
-
// name: 'sale',
|
|
261
|
-
// basePrice: 100,
|
|
262
|
-
// discountPercent: 20,
|
|
263
|
-
// discount: 20,
|
|
264
|
-
// finalPrice: 80,
|
|
265
|
-
// timestamp: '2023-07-15T12:34:56.790Z'
|
|
266
|
-
// }
|
|
591
|
+
process.once("SIGTERM", () => {
|
|
592
|
+
void shutdown();
|
|
593
|
+
});
|
|
267
594
|
```
|
|
268
595
|
|
|
596
|
+
## ⚠️ Common Pitfalls
|
|
597
|
+
|
|
598
|
+
- Using `resolve()` for async providers or async hooks. Use `resolveAsync()` for those tokens.
|
|
599
|
+
- Registering multi-binding providers and calling `resolve()` instead of `resolveAll()` / `resolveAllAsync()`.
|
|
600
|
+
- Skipping `validate()` at startup and finding graph issues only at runtime.
|
|
601
|
+
- Forgetting `scope.dispose()` in request/job flows, causing leaked scoped resources.
|
|
602
|
+
- Treating optional dependencies as required. Use `resolveOptional()` for truly optional contracts.
|
|
603
|
+
|
|
269
604
|
## 🛣 Roadmap
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
|
275
|
-
|
|
|
276
|
-
|
|
|
277
|
-
|
|
|
278
|
-
|
|
|
279
|
-
|
|
|
280
|
-
|
|
|
281
|
-
|
|
|
282
|
-
|
|
|
283
|
-
|
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
605
|
+
|
|
606
|
+
<details>
|
|
607
|
+
<summary>Click to expand</summary>
|
|
608
|
+
|
|
609
|
+
| Task / Feature | Status |
|
|
610
|
+
| ------------------------------------------------- | -------------- |
|
|
611
|
+
| Core DI container with typed tokens | ✅ Done |
|
|
612
|
+
| Singleton, Scoped, and Transient lifecycles | ✅ Done |
|
|
613
|
+
| Async resolution with deduplication | ✅ Done |
|
|
614
|
+
| Lazy provider strategy (`useLazy`) | ✅ Done |
|
|
615
|
+
| Multi-binding support (`resolveAll`) | ✅ Done |
|
|
616
|
+
| Module composition system (`composeModules`) | ✅ Done |
|
|
617
|
+
| Lifecycle hooks (onInit, afterResolve, onDispose) | ✅ Done |
|
|
618
|
+
| Circular dependency detection and validation | ✅ Done |
|
|
619
|
+
| Captive dependency policy (warn/error/disabled) | ✅ Done |
|
|
620
|
+
| Resolve interceptors for observability | ✅ Done |
|
|
621
|
+
| Decorator-based DI (`@Injectable`, `@Inject`) | ✅ Done |
|
|
622
|
+
| Safe deep clone utility | ✅ Done |
|
|
623
|
+
| Comprehensive documentation with MDX | ✅ Done |
|
|
624
|
+
| Hierarchical scope disposal with async drain | ✅ Done |
|
|
625
|
+
| Tagged/conditional provider resolution | 🚧 In Progress |
|
|
626
|
+
| Provider middleware pipeline | 🚧 In Progress |
|
|
627
|
+
| Scope-level event emitter for lifecycle events | 🚧 In Progress |
|
|
628
|
+
| Performance benchmarking suite | 🚧 In Progress |
|
|
629
|
+
|
|
630
|
+
</details>
|
|
291
631
|
|
|
292
632
|
## ❓ FAQ
|
|
293
|
-
## Frequently Asked Questions
|
|
294
633
|
|
|
295
|
-
|
|
296
|
-
|
|
634
|
+
<details>
|
|
635
|
+
<summary>Click to expand</summary>
|
|
297
636
|
|
|
298
|
-
###
|
|
299
|
-
ClaDI is more lightweight and focused, with zero external dependencies. It provides core building blocks rather than a full-featured DI framework. It's suitable for projects that need a clean, extensible foundation with minimal overhead.
|
|
637
|
+
### Does ClaDI require `reflect-metadata` or experimental decorators?
|
|
300
638
|
|
|
301
|
-
|
|
302
|
-
Yes, ClaDI is designed to work in both Node.js and browser environments. It's built with ES modules and also provides CommonJS compatibility.
|
|
639
|
+
No. ClaDI works entirely without reflection metadata. Optional decorators (`@Injectable`, `@Inject`, `@Module`, `@OnInit`, `@AfterResolve`, `@OnDispose`) store metadata directly on class constructors/prototypes using symbol keys — no `reflect-metadata` polyfill needed. You can also skip decorators entirely and use plain providers, `createAutowireProvider()`, and `createModule()`.
|
|
303
640
|
|
|
304
|
-
### How does
|
|
305
|
-
The registry implements an internal cache for `getAll()` and `getMany()` operations. When you register or unregister items, the cache is automatically cleared to ensure you always get fresh data.
|
|
641
|
+
### How does ClaDI compare to InversifyJS or tsyringe?
|
|
306
642
|
|
|
307
|
-
|
|
308
|
-
Yes, ClaDI can be used with any frontend framework. It's framework-agnostic and provides core infrastructure that can be integrated into your component system.
|
|
643
|
+
ClaDI takes a fundamentally different approach: **explicit composition roots** over implicit decorator-driven wiring. There's no global container, no automatic class scanning, and no hidden metadata. Every dependency relationship is visible at the registration site. This makes the DI graph auditable, testable, and refactoring-friendly.
|
|
309
644
|
|
|
310
|
-
###
|
|
311
|
-
Currently, circular dependencies must be managed manually. However, the roadmap includes adding circular dependency detection to help identify and resolve these issues.
|
|
645
|
+
### Can I use ClaDI in the browser?
|
|
312
646
|
|
|
313
|
-
|
|
314
|
-
|
|
647
|
+
ClaDI ships ESM and CJS bundles and is designed to be runtime-agnostic. It is tested in Node.js. Bun, Deno, and browser usage is generally viable when your environment supports standard JavaScript runtime features used by your providers.
|
|
648
|
+
|
|
649
|
+
### How do I handle async initialization (e.g., database connections)?
|
|
650
|
+
|
|
651
|
+
Use `useFactory` with an async function and resolve with `resolveAsync()`:
|
|
652
|
+
|
|
653
|
+
```typescript
|
|
654
|
+
container.register({
|
|
655
|
+
provide: DbToken,
|
|
656
|
+
lifecycle: EDependencyLifecycle.SINGLETON,
|
|
657
|
+
useFactory: async () => await createDatabasePool(),
|
|
658
|
+
onDispose: async (pool) => await pool.end(),
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
const db = await container.resolveAsync(DbToken);
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
Concurrent `resolveAsync()` calls for the same singleton are automatically deduplicated — the factory runs exactly once.
|
|
665
|
+
|
|
666
|
+
### What happens if I forget to dispose a scope?
|
|
667
|
+
|
|
668
|
+
Scoped and singleton instances with `onDispose` hooks or `dispose()` / `close()` methods will not be cleaned up, potentially causing resource leaks. Always wrap scope usage in `try/finally`:
|
|
669
|
+
|
|
670
|
+
```typescript
|
|
671
|
+
const scope = container.createScope("request");
|
|
672
|
+
try {
|
|
673
|
+
// ... use scope
|
|
674
|
+
} finally {
|
|
675
|
+
await scope.dispose();
|
|
676
|
+
}
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Can I override a provider in a child scope for testing?
|
|
680
|
+
|
|
681
|
+
Absolutely. Child scopes can register local overrides that shadow parent registrations:
|
|
682
|
+
|
|
683
|
+
```typescript
|
|
684
|
+
const testScope = container.createScope("test");
|
|
685
|
+
testScope.register({ provide: DbToken, useValue: mockDatabase });
|
|
686
|
+
const service = testScope.resolve(ServiceToken); // uses mockDatabase
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
### Is the module system required?
|
|
690
|
+
|
|
691
|
+
No. The module system (`createModule` / `composeModules`) is entirely optional. You can register all providers directly on the container. Modules are useful for organizing large applications into bounded contexts with explicit export boundaries.
|
|
692
|
+
|
|
693
|
+
</details>
|
|
315
694
|
|
|
316
695
|
## 🔒 License
|
|
317
|
-
This project is licensed under **MIT License
|
|
318
696
|
|
|
319
|
-
|
|
697
|
+
This project is licensed under **MIT**.
|
|
320
698
|
|
|
321
|
-
|
|
699
|
+
## 🙏 Acknowledgments
|
|
322
700
|
|
|
323
|
-
|
|
701
|
+
- Built and maintained by [ElsiKora](https://github.com/ElsiKora)
|
|
702
|
+
- Inspired by the dependency injection patterns from Angular, NestJS, and InversifyJS — adapted for explicit composition-root workflows
|
|
703
|
+
- Thanks to all [contributors](https://github.com/ElsiKora/ClaDI/graphs/contributors) who helped shape the API and test suite
|
|
704
|
+
- Documentation powered by [Nextra](https://nextra.site/) with MDX
|
|
705
|
+
- Release automation via [semantic-release](https://github.com/semantic-release/semantic-release)
|
|
706
|
+
- Code quality enforced by [Qodana](https://www.jetbrains.com/qodana/) and [Snyk](https://snyk.io/)
|
|
324
707
|
|
|
325
|
-
|
|
708
|
+
---
|
|
709
|
+
|
|
710
|
+
<p align="center">
|
|
711
|
+
<a href="#top">Back to Top</a>
|
|
712
|
+
</p>
|