@venok/core 1.0.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/application/config.d.ts +35 -0
- package/application/config.js +85 -0
- package/application/context.d.ts +198 -0
- package/application/context.js +325 -0
- package/application/factory.d.ts +43 -0
- package/application/factory.js +147 -0
- package/constants.d.ts +46 -0
- package/constants.js +53 -0
- package/context/creator.d.ts +9 -0
- package/context/creator.js +32 -0
- package/context/execution-host.d.ts +16 -0
- package/context/execution-host.js +30 -0
- package/context/external/creator.d.ts +63 -0
- package/context/external/creator.js +159 -0
- package/context/external/proxy.d.ts +5 -0
- package/context/external/proxy.js +19 -0
- package/decorators/apply.decorator.d.ts +10 -0
- package/decorators/apply.decorator.js +24 -0
- package/decorators/bind.decorator.d.ts +11 -0
- package/decorators/bind.decorator.js +20 -0
- package/decorators/catch.decorator.d.ts +17 -0
- package/decorators/catch.decorator.js +26 -0
- package/decorators/create-param.decorator.d.ts +29 -0
- package/decorators/create-param.decorator.js +51 -0
- package/decorators/dependencies.decorator.d.ts +6 -0
- package/decorators/dependencies.decorator.js +17 -0
- package/decorators/exception-filters.decorator.d.ts +21 -0
- package/decorators/exception-filters.decorator.js +41 -0
- package/decorators/global.decorator.d.ts +10 -0
- package/decorators/global.decorator.js +19 -0
- package/decorators/index.d.ts +15 -0
- package/decorators/index.js +31 -0
- package/decorators/inject.decorator.d.ts +26 -0
- package/decorators/inject.decorator.js +45 -0
- package/decorators/injectable.decorator.d.ts +40 -0
- package/decorators/injectable.decorator.js +51 -0
- package/decorators/module.decorator.d.ts +14 -0
- package/decorators/module.decorator.js +38 -0
- package/decorators/optional.decorator.d.ts +14 -0
- package/decorators/optional.decorator.js +30 -0
- package/decorators/set-metadata.decorator.d.ts +18 -0
- package/decorators/set-metadata.decorator.js +30 -0
- package/decorators/use-guards.decorator.d.ts +21 -0
- package/decorators/use-guards.decorator.js +40 -0
- package/decorators/use-interceptors.decorator.d.ts +21 -0
- package/decorators/use-interceptors.decorator.js +40 -0
- package/decorators/use-pipes.decorator.d.ts +21 -0
- package/decorators/use-pipes.decorator.js +39 -0
- package/discovery/meta-host-collection.d.ts +32 -0
- package/discovery/meta-host-collection.js +79 -0
- package/discovery/module.d.ts +5 -0
- package/discovery/module.js +24 -0
- package/discovery/service.d.ts +68 -0
- package/discovery/service.js +90 -0
- package/errors/exceptions/circular-dependency.exception.d.ts +4 -0
- package/errors/exceptions/circular-dependency.exception.js +11 -0
- package/errors/exceptions/index.d.ts +8 -0
- package/errors/exceptions/index.js +24 -0
- package/errors/exceptions/invalid-class-module.exception.d.ts +4 -0
- package/errors/exceptions/invalid-class-module.exception.js +11 -0
- package/errors/exceptions/invalid-class-scope.exception.d.ts +5 -0
- package/errors/exceptions/invalid-class-scope.exception.js +14 -0
- package/errors/exceptions/invalid-class.exception.d.ts +4 -0
- package/errors/exceptions/invalid-class.exception.js +11 -0
- package/errors/exceptions/invalid-exception-filter.exception.d.ts +4 -0
- package/errors/exceptions/invalid-exception-filter.exception.js +11 -0
- package/errors/exceptions/invalid-module.exception.d.ts +4 -0
- package/errors/exceptions/invalid-module.exception.js +11 -0
- package/errors/exceptions/runtime.exception.d.ts +4 -0
- package/errors/exceptions/runtime.exception.js +12 -0
- package/errors/exceptions/undefined-dependency.exception.d.ts +6 -0
- package/errors/exceptions/undefined-dependency.exception.js +11 -0
- package/errors/exceptions/undefined-forwardref.exception.d.ts +5 -0
- package/errors/exceptions/undefined-forwardref.exception.js +11 -0
- package/errors/exceptions/undefined-module.exception.d.ts +4 -0
- package/errors/exceptions/undefined-module.exception.js +11 -0
- package/errors/exceptions/unknown-dependencies.exception.d.ts +16 -0
- package/errors/exceptions/unknown-dependencies.exception.js +15 -0
- package/errors/exceptions/unknown-element.exception.d.ts +4 -0
- package/errors/exceptions/unknown-element.exception.js +12 -0
- package/errors/exceptions/unknown-export.exception.d.ts +4 -0
- package/errors/exceptions/unknown-export.exception.js +11 -0
- package/errors/exceptions/unknown-module.exception.d.ts +4 -0
- package/errors/exceptions/unknown-module.exception.js +10 -0
- package/errors/messages.d.ts +15 -0
- package/errors/messages.js +126 -0
- package/exceptions/external/filter-context.d.ts +10 -0
- package/exceptions/external/filter-context.js +37 -0
- package/exceptions/external/filter.d.ts +5 -0
- package/exceptions/external/filter.js +16 -0
- package/exceptions/external/handler.d.ts +9 -0
- package/exceptions/external/handler.js +31 -0
- package/exceptions/filter-context.d.ts +14 -0
- package/exceptions/filter-context.js +55 -0
- package/exceptions/select-exception-filter-metadata.d.ts +2 -0
- package/exceptions/select-exception-filter-metadata.js +6 -0
- package/exceptions/zone/handler.d.ts +5 -0
- package/exceptions/zone/handler.js +15 -0
- package/exceptions/zone/zone.d.ts +5 -0
- package/exceptions/zone/zone.js +32 -0
- package/guards/consumer.d.ts +9 -0
- package/guards/consumer.js +33 -0
- package/guards/context-creator.d.ts +17 -0
- package/guards/context-creator.js +69 -0
- package/guards/index.d.ts +2 -0
- package/guards/index.js +18 -0
- package/helpers/color.helper.d.ts +9 -0
- package/helpers/color.helper.js +14 -0
- package/helpers/context-id-factory.helper.d.ts +2 -0
- package/helpers/context-id-factory.helper.js +15 -0
- package/helpers/context.helper.d.ts +23 -0
- package/helpers/context.helper.js +49 -0
- package/helpers/extends-metadata.helper.d.ts +1 -0
- package/helpers/extends-metadata.helper.js +9 -0
- package/helpers/flatten.helper.d.ts +1 -0
- package/helpers/flatten.helper.js +9 -0
- package/helpers/messages.helper.d.ts +2 -0
- package/helpers/messages.helper.js +7 -0
- package/helpers/noop.helper.d.ts +1 -0
- package/helpers/noop.helper.js +5 -0
- package/helpers/random-string-generator.helper.d.ts +1 -0
- package/helpers/random-string-generator.helper.js +6 -0
- package/helpers/rethrow.helper.d.ts +1 -0
- package/helpers/rethrow.helper.js +7 -0
- package/helpers/shared.helper.d.ts +10 -0
- package/helpers/shared.helper.js +33 -0
- package/helpers/silent.helper.d.ts +10 -0
- package/helpers/silent.helper.js +18 -0
- package/helpers/transient.helper.d.ts +12 -0
- package/helpers/transient.helper.js +26 -0
- package/helpers/uuid.helper.d.ts +15 -0
- package/helpers/uuid.helper.js +54 -0
- package/helpers/validate-each.helper.d.ts +8 -0
- package/helpers/validate-each.helper.js +25 -0
- package/hooks/before-app-shutdown.hook.d.ts +9 -0
- package/hooks/before-app-shutdown.hook.js +45 -0
- package/hooks/index.d.ts +5 -0
- package/hooks/index.js +21 -0
- package/hooks/on-app-bootstrap.hook.d.ts +8 -0
- package/hooks/on-app-bootstrap.hook.js +45 -0
- package/hooks/on-app-shutdown.hook.d.ts +9 -0
- package/hooks/on-app-shutdown.hook.js +46 -0
- package/hooks/on-module-destroy.hook.d.ts +8 -0
- package/hooks/on-module-destroy.hook.js +45 -0
- package/hooks/on-module-init.hook.d.ts +8 -0
- package/hooks/on-module-init.hook.js +45 -0
- package/index.d.ts +10 -0
- package/index.js +32 -0
- package/injector/constants.d.ts +2 -0
- package/injector/constants.js +7 -0
- package/injector/container.d.ts +61 -0
- package/injector/container.js +194 -0
- package/injector/helpers/class-scope.helper.d.ts +2 -0
- package/injector/helpers/class-scope.helper.js +9 -0
- package/injector/helpers/classifier.helper.d.ts +4 -0
- package/injector/helpers/classifier.helper.js +17 -0
- package/injector/helpers/is-durable.helper.d.ts +2 -0
- package/injector/helpers/is-durable.helper.js +9 -0
- package/injector/index.d.ts +5 -0
- package/injector/index.js +20 -0
- package/injector/injector.d.ts +87 -0
- package/injector/injector.js +452 -0
- package/injector/instance/links-host.d.ts +22 -0
- package/injector/instance/links-host.js +50 -0
- package/injector/instance/loader.d.ts +21 -0
- package/injector/instance/loader.js +73 -0
- package/injector/instance/resolver.d.ts +16 -0
- package/injector/instance/resolver.js +43 -0
- package/injector/instance/wrapper.d.ts +90 -0
- package/injector/instance/wrapper.js +272 -0
- package/injector/internal-core-module/core-providers.d.ts +4 -0
- package/injector/internal-core-module/core-providers.js +21 -0
- package/injector/internal-core-module/internal-core-module-factory.d.ts +8 -0
- package/injector/internal-core-module/internal-core-module-factory.js +42 -0
- package/injector/internal-core-module/internal-core-module.d.ts +4 -0
- package/injector/internal-core-module/internal-core-module.js +31 -0
- package/injector/module/compiler.d.ts +19 -0
- package/injector/module/compiler.js +27 -0
- package/injector/module/container.d.ts +6 -0
- package/injector/module/container.js +24 -0
- package/injector/module/lazy/loader.d.ts +21 -0
- package/injector/module/lazy/loader.js +49 -0
- package/injector/module/lazy/options.d.ts +6 -0
- package/injector/module/lazy/options.js +2 -0
- package/injector/module/module.d.ts +74 -0
- package/injector/module/module.js +383 -0
- package/injector/module/ref.d.ts +106 -0
- package/injector/module/ref.js +62 -0
- package/injector/module/token-factory.d.ts +13 -0
- package/injector/module/token-factory.js +71 -0
- package/injector/settlement-signal.d.ts +37 -0
- package/injector/settlement-signal.js +55 -0
- package/inspector/graph-inspector.d.ts +26 -0
- package/inspector/graph-inspector.js +163 -0
- package/inspector/initialize-on-preview.allowlist.d.ts +6 -0
- package/inspector/initialize-on-preview.allowlist.js +13 -0
- package/inspector/interfaces/edge.interface.d.ts +28 -0
- package/inspector/interfaces/edge.interface.js +2 -0
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.d.ts +12 -0
- package/inspector/interfaces/enhancer-metadata-cache-entry.interface.js +2 -0
- package/inspector/interfaces/entrypoint.interface.d.ts +10 -0
- package/inspector/interfaces/entrypoint.interface.js +2 -0
- package/inspector/interfaces/extras.interface.d.ts +18 -0
- package/inspector/interfaces/extras.interface.js +2 -0
- package/inspector/interfaces/node.interface.d.ts +49 -0
- package/inspector/interfaces/node.interface.js +2 -0
- package/inspector/interfaces/serialized-graph-json.interface.d.ts +14 -0
- package/inspector/interfaces/serialized-graph-json.interface.js +2 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.d.ts +10 -0
- package/inspector/interfaces/serialized-graph-metadata.interface.js +2 -0
- package/inspector/noop-graph-inspector.d.ts +2 -0
- package/inspector/noop-graph-inspector.js +8 -0
- package/inspector/partial-graph.host.d.ts +7 -0
- package/inspector/partial-graph.host.js +15 -0
- package/inspector/serialized-graph.d.ts +52 -0
- package/inspector/serialized-graph.js +121 -0
- package/interceptors/consumer.d.ts +9 -0
- package/interceptors/consumer.js +37 -0
- package/interceptors/context-creator.d.ts +17 -0
- package/interceptors/context-creator.js +67 -0
- package/interceptors/index.d.ts +2 -0
- package/interceptors/index.js +18 -0
- package/interfaces/abstract.interface.d.ts +3 -0
- package/interfaces/abstract.interface.js +2 -0
- package/interfaces/application/context-options.interface.d.ts +41 -0
- package/interfaces/application/context-options.interface.js +9 -0
- package/interfaces/application/context.interface.d.ts +162 -0
- package/interfaces/application/context.interface.js +2 -0
- package/interfaces/application/index.d.ts +1 -0
- package/interfaces/application/index.js +17 -0
- package/interfaces/context/arguments-host.interface.d.ts +22 -0
- package/interfaces/context/arguments-host.interface.js +2 -0
- package/interfaces/context/execution.interface.d.ts +18 -0
- package/interfaces/context/execution.interface.js +2 -0
- package/interfaces/features/exception-filter.interface.d.ts +21 -0
- package/interfaces/features/exception-filter.interface.js +2 -0
- package/interfaces/features/guards.interface.d.ts +20 -0
- package/interfaces/features/guards.interface.js +2 -0
- package/interfaces/features/interceptor.interface.d.ts +30 -0
- package/interfaces/features/interceptor.interface.js +2 -0
- package/interfaces/features/pipes.interface.d.ts +37 -0
- package/interfaces/features/pipes.interface.js +2 -0
- package/interfaces/helper.interface.d.ts +3 -0
- package/interfaces/helper.interface.js +2 -0
- package/interfaces/hooks/before-application-shutdown.interface.d.ts +3 -0
- package/interfaces/hooks/before-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/index.d.ts +5 -0
- package/interfaces/hooks/index.js +21 -0
- package/interfaces/hooks/on-application-bootstrap.interface.d.ts +9 -0
- package/interfaces/hooks/on-application-bootstrap.interface.js +2 -0
- package/interfaces/hooks/on-application-shutdown.interface.d.ts +9 -0
- package/interfaces/hooks/on-application-shutdown.interface.js +2 -0
- package/interfaces/hooks/on-destroy.interface.d.ts +10 -0
- package/interfaces/hooks/on-destroy.interface.js +2 -0
- package/interfaces/hooks/on-init.interface.d.ts +8 -0
- package/interfaces/hooks/on-init.interface.js +2 -0
- package/interfaces/index.d.ts +6 -0
- package/interfaces/index.js +22 -0
- package/interfaces/injectable.interface.d.ts +1 -0
- package/interfaces/injectable.interface.js +2 -0
- package/interfaces/modules/configurable/async-options.interface.d.ts +42 -0
- package/interfaces/modules/configurable/async-options.interface.js +2 -0
- package/interfaces/modules/configurable/cls.interface.d.ts +13 -0
- package/interfaces/modules/configurable/cls.interface.js +2 -0
- package/interfaces/modules/configurable/host.interface.d.ts +62 -0
- package/interfaces/modules/configurable/host.interface.js +2 -0
- package/interfaces/modules/configurable/index.d.ts +3 -0
- package/interfaces/modules/configurable/index.js +19 -0
- package/interfaces/modules/definition.interface.d.ts +4 -0
- package/interfaces/modules/definition.interface.js +2 -0
- package/interfaces/modules/dynamic-module.interface.d.ts +23 -0
- package/interfaces/modules/dynamic-module.interface.js +2 -0
- package/interfaces/modules/forward-reference.interface.d.ts +3 -0
- package/interfaces/modules/forward-reference.interface.js +2 -0
- package/interfaces/modules/index.d.ts +9 -0
- package/interfaces/modules/index.js +25 -0
- package/interfaces/modules/injection-token.interface.d.ts +5 -0
- package/interfaces/modules/injection-token.interface.js +2 -0
- package/interfaces/modules/introspection-result.interface.d.ts +10 -0
- package/interfaces/modules/introspection-result.interface.js +2 -0
- package/interfaces/modules/module-metadata.interface.d.ts +24 -0
- package/interfaces/modules/module-metadata.interface.js +2 -0
- package/interfaces/modules/module.interface.d.ts +2 -0
- package/interfaces/modules/module.interface.js +2 -0
- package/interfaces/modules/optional-factory-dependency.interface.d.ts +8 -0
- package/interfaces/modules/optional-factory-dependency.interface.js +2 -0
- package/interfaces/modules/override.interface.d.ts +5 -0
- package/interfaces/modules/override.interface.js +2 -0
- package/interfaces/modules/provider.interface.d.ts +142 -0
- package/interfaces/modules/provider.interface.js +2 -0
- package/interfaces/scope.interface.d.ts +35 -0
- package/interfaces/scope.interface.js +23 -0
- package/interfaces/type.interface.d.ts +3 -0
- package/interfaces/type.interface.js +2 -0
- package/metadata-scanner.d.ts +4 -0
- package/metadata-scanner.js +34 -0
- package/module/configurable-module.builder.d.ts +93 -0
- package/module/configurable-module.builder.js +204 -0
- package/module/constants.d.ts +4 -0
- package/module/constants.js +7 -0
- package/module/helpers/generate-options-injection-token.helper.d.ts +1 -0
- package/module/helpers/generate-options-injection-token.helper.js +9 -0
- package/module/helpers/get-injection-providers.helper.d.ts +8 -0
- package/module/helpers/get-injection-providers.helper.js +36 -0
- package/module/helpers/index.d.ts +2 -0
- package/module/helpers/index.js +18 -0
- package/module/index.d.ts +2 -0
- package/module/index.js +18 -0
- package/package.json +35 -0
- package/pipes/consumer.d.ts +9 -0
- package/pipes/consumer.js +15 -0
- package/pipes/context-creator.d.ts +18 -0
- package/pipes/context-creator.js +70 -0
- package/pipes/index.d.ts +2 -0
- package/pipes/index.js +18 -0
- package/scanner.d.ts +81 -0
- package/scanner.js +374 -0
- package/services/console.service.d.ts +86 -0
- package/services/console.service.js +233 -0
- package/services/index.d.ts +1 -0
- package/services/index.js +17 -0
- package/services/logger.service.d.ts +157 -0
- package/services/logger.service.js +269 -0
- package/services/reflector.service.d.ts +110 -0
- package/services/reflector.service.js +87 -0
- package/test/context/execution-host.spec.d.ts +1 -0
- package/test/context/execution-host.spec.js +31 -0
- package/test/context/external/creator.spec.d.ts +1 -0
- package/test/context/external/creator.spec.js +149 -0
- package/test/context/external/proxy.spec.d.ts +1 -0
- package/test/context/external/proxy.spec.js +45 -0
- package/test/exceptions/external/handler.spec.d.ts +1 -0
- package/test/exceptions/external/handler.spec.js +89 -0
- package/test/exceptions/filter-context.spec.d.ts +2 -0
- package/test/exceptions/filter-context.spec.js +91 -0
- package/test/exceptions/messages.spec.d.ts +0 -0
- package/test/exceptions/messages.spec.js +201 -0
- package/test/exceptions/zona/handler.spec.d.ts +1 -0
- package/test/exceptions/zona/handler.spec.js +51 -0
- package/test/exceptions/zona/zone.spec.d.ts +1 -0
- package/test/exceptions/zona/zone.spec.js +66 -0
- package/test/guards/consumer.spec.d.ts +1 -0
- package/test/guards/consumer.spec.js +47 -0
- package/test/guards/context-creator.spec.d.ts +1 -0
- package/test/guards/context-creator.spec.js +138 -0
- package/test/helpers/context-id-factory.spec.d.ts +1 -0
- package/test/helpers/context-id-factory.spec.js +9 -0
- package/test/helpers/shared.spec.d.ts +1 -0
- package/test/helpers/shared.spec.js +122 -0
- package/test/hooks/before-app-shutdown.hook.spec.d.ts +1 -0
- package/test/hooks/before-app-shutdown.hook.spec.js +44 -0
- package/test/hooks/on-app-bootstrap.hook.spec.d.ts +1 -0
- package/test/hooks/on-app-bootstrap.hook.spec.js +43 -0
- package/test/hooks/on-app-shutdown.hook.spec.d.ts +1 -0
- package/test/hooks/on-app-shutdown.hook.spec.js +43 -0
- package/test/hooks/on-module-destroy.hook.spec.d.ts +1 -0
- package/test/hooks/on-module-destroy.hook.spec.js +43 -0
- package/test/hooks/on-module-init.hook.spec.d.ts +1 -0
- package/test/hooks/on-module-init.hook.spec.js +43 -0
- package/test/injector/compiler.spec.d.ts +1 -0
- package/test/injector/compiler.spec.js +42 -0
- package/test/injector/container.spec.d.ts +1 -0
- package/test/injector/container.spec.js +203 -0
- package/test/injector/helpers/classifier.spec.d.ts +1 -0
- package/test/injector/helpers/classifier.spec.js +102 -0
- package/test/injector/injector.spec.d.ts +1 -0
- package/test/injector/injector.spec.js +678 -0
- package/test/injector/instance/loader.spec.d.ts +1 -0
- package/test/injector/instance/loader.spec.js +108 -0
- package/test/injector/instance/wrapper.spec.d.ts +1 -0
- package/test/injector/instance/wrapper.spec.js +772 -0
- package/test/injector/internal-core-module/internal-core-module-factory.spec.d.ts +1 -0
- package/test/injector/internal-core-module/internal-core-module-factory.spec.js +27 -0
- package/test/injector/module/lazy/loader.spec.d.ts +1 -0
- package/test/injector/module/lazy/loader.spec.js +71 -0
- package/test/injector/module/module.spec.d.ts +1 -0
- package/test/injector/module/module.spec.js +410 -0
- package/test/injector/module/token-factory.spec.d.ts +1 -0
- package/test/injector/module/token-factory.spec.js +84 -0
- package/test/interceptors/consumer.spec.d.ts +1 -0
- package/test/interceptors/consumer.spec.js +136 -0
- package/test/interceptors/context-creator.spec.d.ts +1 -0
- package/test/interceptors/context-creator.spec.js +139 -0
- package/test/metadata-scanner.spec.d.ts +1 -0
- package/test/metadata-scanner.spec.js +41 -0
- package/test/module/configurable-module.builder.spec.d.ts +1 -0
- package/test/module/configurable-module.builder.spec.js +102 -0
- package/test/module/helpers/get-injection-providers.helper.spec.d.ts +1 -0
- package/test/module/helpers/get-injection-providers.helper.spec.js +49 -0
- package/test/pipes/consumer.spec.d.ts +1 -0
- package/test/pipes/consumer.spec.js +42 -0
- package/test/pipes/context-creator.spec.d.ts +1 -0
- package/test/pipes/context-creator.spec.js +108 -0
- package/test/scanner.spec.d.ts +1 -0
- package/test/scanner.spec.js +620 -0
- package/test/services/logger.service.spec.d.ts +1 -0
- package/test/services/logger.service.spec.js +487 -0
- package/test/services/reflector.service.spec.d.ts +1 -0
- package/test/services/reflector.service.spec.js +105 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
require("reflect-metadata");
|
|
13
|
+
const chai_1 = require("chai");
|
|
14
|
+
const sinon_1 = __importDefault(require("sinon"));
|
|
15
|
+
const container_1 = require("@venok/core/injector/container");
|
|
16
|
+
const module_decorator_1 = require("@venok/core/decorators/module.decorator");
|
|
17
|
+
const global_decorator_1 = require("@venok/core/decorators/global.decorator");
|
|
18
|
+
const exceptions_1 = require("@venok/core/errors/exceptions");
|
|
19
|
+
describe("VenokContainer", () => {
|
|
20
|
+
let container;
|
|
21
|
+
let TestModule = class TestModule {
|
|
22
|
+
};
|
|
23
|
+
TestModule = __decorate([
|
|
24
|
+
(0, module_decorator_1.Module)({})
|
|
25
|
+
], TestModule);
|
|
26
|
+
let GlobalTestModule = class GlobalTestModule {
|
|
27
|
+
};
|
|
28
|
+
GlobalTestModule = __decorate([
|
|
29
|
+
(0, global_decorator_1.Global)(),
|
|
30
|
+
(0, module_decorator_1.Module)({})
|
|
31
|
+
], GlobalTestModule);
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
container = new container_1.VenokContainer();
|
|
34
|
+
});
|
|
35
|
+
it('should "addProvider" throw "UnknownModuleException" when module is not stored in collection', () => {
|
|
36
|
+
(0, chai_1.expect)(() => container.addProvider({}, "TestModule")).throw(exceptions_1.UnknownModuleException);
|
|
37
|
+
});
|
|
38
|
+
it('should "addProvider" throw "CircularDependencyException" when provider is nil', () => {
|
|
39
|
+
(0, chai_1.expect)(() => container.addProvider(null, "TestModule")).throw(exceptions_1.CircularDependencyException);
|
|
40
|
+
});
|
|
41
|
+
it('should "addExportedProvider" throw "UnknownModuleException" when module is not stored in collection', () => {
|
|
42
|
+
(0, chai_1.expect)(() => container.addExportedProvider(null, "TestModule")).throw(exceptions_1.UnknownModuleException);
|
|
43
|
+
});
|
|
44
|
+
it('should "addInjectable" throw "UnknownModuleException" when module is not stored in collection', () => {
|
|
45
|
+
(0, chai_1.expect)(() => container.addInjectable(null, "TestModule", null)).throw(exceptions_1.UnknownModuleException);
|
|
46
|
+
});
|
|
47
|
+
describe("clear", () => {
|
|
48
|
+
it("should call `clear` on modules collection", () => {
|
|
49
|
+
const clearSpy = sinon_1.default.spy(container.modules, "clear");
|
|
50
|
+
container.clear();
|
|
51
|
+
(0, chai_1.expect)(clearSpy.called).to.be.true;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("addModule", () => {
|
|
55
|
+
it("should not add module if already exists in collection", async () => {
|
|
56
|
+
const modules = new Map();
|
|
57
|
+
const setSpy = sinon_1.default.spy(modules, "set");
|
|
58
|
+
container.modules = modules;
|
|
59
|
+
await container.addModule(TestModule, []);
|
|
60
|
+
await container.addModule(TestModule, []);
|
|
61
|
+
(0, chai_1.expect)(setSpy.calledOnce).to.be.true;
|
|
62
|
+
});
|
|
63
|
+
it("should throw an exception when metatype is not defined", () => {
|
|
64
|
+
(0, chai_1.expect)(container.addModule(undefined, [])).to.eventually.throws();
|
|
65
|
+
});
|
|
66
|
+
it("should add global module when module is global", async () => {
|
|
67
|
+
const addGlobalModuleSpy = sinon_1.default.spy(container, "addGlobalModule");
|
|
68
|
+
await container.addModule(GlobalTestModule, []);
|
|
69
|
+
(0, chai_1.expect)(addGlobalModuleSpy.calledOnce).to.be.true;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe("replaceModule", () => {
|
|
73
|
+
it("should replace module if already exists in collection", async () => {
|
|
74
|
+
let ReplaceTestModule = class ReplaceTestModule {
|
|
75
|
+
};
|
|
76
|
+
ReplaceTestModule = __decorate([
|
|
77
|
+
(0, module_decorator_1.Module)({})
|
|
78
|
+
], ReplaceTestModule);
|
|
79
|
+
const modules = new Map();
|
|
80
|
+
const setSpy = sinon_1.default.spy(modules, "set");
|
|
81
|
+
container.modules = modules;
|
|
82
|
+
await container.addModule(TestModule, []);
|
|
83
|
+
await container.replaceModule(TestModule, ReplaceTestModule, []);
|
|
84
|
+
(0, chai_1.expect)(setSpy.calledTwice).to.be.true;
|
|
85
|
+
});
|
|
86
|
+
it("should throw an exception when metatype is not defined", () => {
|
|
87
|
+
(0, chai_1.expect)(container.addModule(undefined, [])).to.eventually.throws();
|
|
88
|
+
});
|
|
89
|
+
it("should add global module when module is global", async () => {
|
|
90
|
+
const addGlobalModuleSpy = sinon_1.default.spy(container, "addGlobalModule");
|
|
91
|
+
await container.addModule(GlobalTestModule, []);
|
|
92
|
+
(0, chai_1.expect)(addGlobalModuleSpy.calledOnce).to.be.true;
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("isGlobalModule", () => {
|
|
96
|
+
describe("when module is not globally scoped", () => {
|
|
97
|
+
it("should return false", () => {
|
|
98
|
+
(0, chai_1.expect)(container.isGlobalModule(TestModule)).to.be.false;
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
describe("when module is globally scoped", () => {
|
|
102
|
+
it("should return true", () => {
|
|
103
|
+
(0, chai_1.expect)(container.isGlobalModule(GlobalTestModule)).to.be.true;
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe("when dynamic module is globally scoped", () => {
|
|
107
|
+
it("should return true", () => {
|
|
108
|
+
(0, chai_1.expect)(container.isGlobalModule(TestModule, { global: true })).to.be.true;
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
describe("bindGlobalsToImports", () => {
|
|
113
|
+
it('should call "bindGlobalModuleToModule" for every global module', () => {
|
|
114
|
+
const global1 = { test: 1 };
|
|
115
|
+
const global2 = { test: 2 };
|
|
116
|
+
container.addGlobalModule(global1);
|
|
117
|
+
container.addGlobalModule(global2);
|
|
118
|
+
const bindGlobalModuleToModuleSpy = sinon_1.default.spy(container, "bindGlobalModuleToModule");
|
|
119
|
+
container.bindGlobalsToImports({
|
|
120
|
+
addImport: sinon_1.default.spy(),
|
|
121
|
+
});
|
|
122
|
+
(0, chai_1.expect)(bindGlobalModuleToModuleSpy.calledTwice).to.be.true;
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe("bindGlobalModuleToModule", () => {
|
|
126
|
+
describe('when "module" is not "globalModule"', () => {
|
|
127
|
+
it('should call "addImport"', () => {
|
|
128
|
+
const module = { addImport: sinon_1.default.spy() };
|
|
129
|
+
container.bindGlobalModuleToModule(module, null);
|
|
130
|
+
(0, chai_1.expect)(module.addImport.calledOnce).to.be.true;
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
describe('when "module" is "globalModule"', () => {
|
|
134
|
+
it('should not call "addImport"', () => {
|
|
135
|
+
const module = { addImport: sinon_1.default.spy() };
|
|
136
|
+
container.bindGlobalModuleToModule(module, module);
|
|
137
|
+
(0, chai_1.expect)(module.addImport.calledOnce).to.be.false;
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
describe("addDynamicMetadata", () => {
|
|
142
|
+
let token;
|
|
143
|
+
let collection;
|
|
144
|
+
beforeEach(() => {
|
|
145
|
+
token = "token";
|
|
146
|
+
collection = new Map();
|
|
147
|
+
container.dynamicModulesMetadata = collection;
|
|
148
|
+
});
|
|
149
|
+
describe("when dynamic metadata exists", () => {
|
|
150
|
+
it("should add to the dynamic metadata collection", () => {
|
|
151
|
+
const addSpy = sinon_1.default.spy(collection, "set");
|
|
152
|
+
const dynamicMetadata = { module: null };
|
|
153
|
+
container.addDynamicMetadata(token, dynamicMetadata, []);
|
|
154
|
+
(0, chai_1.expect)(addSpy.calledWith(token, dynamicMetadata)).to.be.true;
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
describe("when dynamic metadata does not exists", () => {
|
|
158
|
+
it("should not add to the dynamic metadata collection", () => {
|
|
159
|
+
const addSpy = sinon_1.default.spy(collection, "set");
|
|
160
|
+
container.addDynamicMetadata(token, null, []);
|
|
161
|
+
(0, chai_1.expect)(addSpy.called).to.be.false;
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
class Test {
|
|
166
|
+
}
|
|
167
|
+
describe("addDynamicModules", () => {
|
|
168
|
+
describe("when array is empty/undefined", () => {
|
|
169
|
+
it('should not call "addModule"', () => {
|
|
170
|
+
const addModuleSpy = sinon_1.default.spy(container, "addModule");
|
|
171
|
+
container.addDynamicModules(undefined, []);
|
|
172
|
+
(0, chai_1.expect)(addModuleSpy.called).to.be.false;
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
describe("when array is not empty/undefined", () => {
|
|
176
|
+
it('should call "addModule"', () => {
|
|
177
|
+
const addModuleSpy = sinon_1.default.spy(container, "addModule");
|
|
178
|
+
container.addDynamicModules([Test], []);
|
|
179
|
+
(0, chai_1.expect)(addModuleSpy.called).to.be.true;
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
describe("get applicationConfig", () => {
|
|
184
|
+
it("should return ApplicationConfig instance", () => {
|
|
185
|
+
(0, chai_1.expect)(container.applicationConfig).to.be.eql(container._applicationConfig);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
describe("getModuleByKey", () => {
|
|
189
|
+
it("should return module by passed key", () => {
|
|
190
|
+
const key = "test";
|
|
191
|
+
const value = {};
|
|
192
|
+
container.getModules().set(key, value);
|
|
193
|
+
(0, chai_1.expect)(container.getModuleByKey(key)).to.be.eql(value);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
describe("registerCoreModuleRef", () => {
|
|
197
|
+
it("should register core module ref", () => {
|
|
198
|
+
const ref = {};
|
|
199
|
+
container.registerCoreModuleRef(ref);
|
|
200
|
+
(0, chai_1.expect)(container.internalCoreModule).to.be.eql(ref);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const classifier_helper_1 = require("@venok/core/injector/helpers/classifier.helper");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
describe("provider classifier", () => {
|
|
6
|
+
describe("isClassProvider", () => {
|
|
7
|
+
it("should return true if useClass is present", () => {
|
|
8
|
+
const classProvider = {
|
|
9
|
+
useClass: class TestClass {
|
|
10
|
+
},
|
|
11
|
+
provide: "token",
|
|
12
|
+
};
|
|
13
|
+
(0, chai_1.expect)((0, classifier_helper_1.isClassProvider)(classProvider)).to.be.true;
|
|
14
|
+
});
|
|
15
|
+
it("should return false if useClass is undefined", () => {
|
|
16
|
+
const classProvider = {
|
|
17
|
+
useClass: undefined,
|
|
18
|
+
provide: "token",
|
|
19
|
+
};
|
|
20
|
+
(0, chai_1.expect)((0, classifier_helper_1.isClassProvider)(classProvider)).to.be.false;
|
|
21
|
+
});
|
|
22
|
+
it("should return false if useClass is not present", () => {
|
|
23
|
+
const classProvider = {
|
|
24
|
+
provide: "token",
|
|
25
|
+
};
|
|
26
|
+
(0, chai_1.expect)((0, classifier_helper_1.isClassProvider)(classProvider)).to.be.false;
|
|
27
|
+
});
|
|
28
|
+
it("should return false if provider is undefined", () => {
|
|
29
|
+
const classProvider = undefined;
|
|
30
|
+
(0, chai_1.expect)((0, classifier_helper_1.isClassProvider)(classProvider)).to.be.false;
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe("isValueProvider", () => {
|
|
34
|
+
it("should return true if useValue is not undefined", () => {
|
|
35
|
+
const valueProvider = {
|
|
36
|
+
useValue: "value",
|
|
37
|
+
provide: "token",
|
|
38
|
+
};
|
|
39
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.true;
|
|
40
|
+
});
|
|
41
|
+
it('should return true if useValue is "false"', () => {
|
|
42
|
+
const valueProvider = {
|
|
43
|
+
useValue: false,
|
|
44
|
+
provide: "token",
|
|
45
|
+
};
|
|
46
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.true;
|
|
47
|
+
});
|
|
48
|
+
it('should return true if useValue is "null"', () => {
|
|
49
|
+
const valueProvider = {
|
|
50
|
+
useValue: null,
|
|
51
|
+
provide: "token",
|
|
52
|
+
};
|
|
53
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.true;
|
|
54
|
+
});
|
|
55
|
+
it("should return true if useValue is an empty string", () => {
|
|
56
|
+
const valueProvider = {
|
|
57
|
+
useValue: null,
|
|
58
|
+
provide: "",
|
|
59
|
+
};
|
|
60
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.true;
|
|
61
|
+
});
|
|
62
|
+
it("should return false if useValue is undefined", () => {
|
|
63
|
+
const valueProvider = {
|
|
64
|
+
useValue: undefined,
|
|
65
|
+
provide: "token",
|
|
66
|
+
};
|
|
67
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.false;
|
|
68
|
+
});
|
|
69
|
+
it("should return false if useValue is not present", () => {
|
|
70
|
+
const valueProvider = {
|
|
71
|
+
provide: "token",
|
|
72
|
+
};
|
|
73
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.false;
|
|
74
|
+
});
|
|
75
|
+
it("should return false if provider is undefined", () => {
|
|
76
|
+
const valueProvider = undefined;
|
|
77
|
+
(0, chai_1.expect)((0, classifier_helper_1.isValueProvider)(valueProvider)).to.be.false;
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe("isFactoryProvider", () => {
|
|
81
|
+
it("should return true if useFactory is present", () => {
|
|
82
|
+
const factoryProvider = {
|
|
83
|
+
provide: "token",
|
|
84
|
+
useFactory: () => { },
|
|
85
|
+
};
|
|
86
|
+
(0, chai_1.expect)((0, classifier_helper_1.isFactoryProvider)(factoryProvider)).to.be.true;
|
|
87
|
+
});
|
|
88
|
+
it("should return false if useFactory is not present", () => {
|
|
89
|
+
const factoryProvider = {
|
|
90
|
+
provide: "token",
|
|
91
|
+
};
|
|
92
|
+
(0, chai_1.expect)((0, classifier_helper_1.isFactoryProvider)(factoryProvider)).to.be.false;
|
|
93
|
+
});
|
|
94
|
+
it("should return false if useFactory is undefined", () => {
|
|
95
|
+
const factoryProvider = {
|
|
96
|
+
provide: "token",
|
|
97
|
+
useFactory: undefined,
|
|
98
|
+
};
|
|
99
|
+
(0, chai_1.expect)((0, classifier_helper_1.isFactoryProvider)(factoryProvider)).to.be.false;
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "reflect-metadata";
|