@tsed/di 7.83.3 → 8.0.0-alpha.10
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/lib/browser/di.umd.min.js +1 -1
- package/lib/browser/di.umd.min.js.map +1 -1
- package/lib/esm/common/constants/constants.js +5 -3
- package/lib/esm/common/constants/constants.js.map +1 -1
- package/lib/esm/common/decorators/autoInjectable.js +23 -3
- package/lib/esm/common/decorators/autoInjectable.js.map +1 -1
- package/lib/esm/common/decorators/configuration.js.map +1 -1
- package/lib/esm/common/decorators/constant.js +28 -11
- package/lib/esm/common/decorators/constant.js.map +1 -1
- package/lib/esm/common/decorators/controller.js.map +1 -1
- package/lib/esm/common/decorators/inject.js +63 -73
- package/lib/esm/common/decorators/inject.js.map +1 -1
- package/lib/esm/common/decorators/intercept.js +40 -13
- package/lib/esm/common/decorators/intercept.js.map +1 -1
- package/lib/esm/common/decorators/lazyInject.js +15 -15
- package/lib/esm/common/decorators/lazyInject.js.map +1 -1
- package/lib/esm/common/decorators/module.js +1 -1
- package/lib/esm/common/decorators/module.js.map +1 -1
- package/lib/esm/common/decorators/opts.js +2 -2
- package/lib/esm/common/decorators/opts.js.map +1 -1
- package/lib/esm/common/decorators/overrideProvider.js.map +1 -1
- package/lib/esm/common/decorators/scope.js.map +1 -1
- package/lib/esm/common/decorators/useOpts.js +3 -7
- package/lib/esm/common/decorators/useOpts.js.map +1 -1
- package/lib/esm/common/decorators/value.js +17 -11
- package/lib/esm/common/decorators/value.js.map +1 -1
- package/lib/esm/common/domain/Container.js +3 -3
- package/lib/esm/common/domain/Container.js.map +1 -1
- package/lib/esm/common/domain/LocalsContainer.js.map +1 -1
- package/lib/esm/common/domain/Provider.js +1 -1
- package/lib/esm/common/domain/Provider.js.map +1 -1
- package/lib/esm/common/errors/InjectionError.js.map +1 -1
- package/lib/esm/common/index.js +0 -2
- package/lib/esm/common/index.js.map +1 -1
- package/lib/esm/common/registries/GlobalProviders.js +7 -7
- package/lib/esm/common/registries/GlobalProviders.js.map +1 -1
- package/lib/esm/common/registries/ProviderRegistry.js.map +1 -1
- package/lib/esm/common/services/DIConfiguration.js.map +1 -1
- package/lib/esm/common/services/InjectorService.js +50 -167
- package/lib/esm/common/services/InjectorService.js.map +1 -1
- package/lib/esm/common/utils/createContainer.js.map +1 -1
- package/lib/esm/common/utils/resolveControllers.js +1 -1
- package/lib/esm/common/utils/resolveControllers.js.map +1 -1
- package/lib/esm/node/decorators/injectContext.js +14 -5
- package/lib/esm/node/decorators/injectContext.js.map +1 -1
- package/lib/esm/node/domain/ContextLogger.js +2 -2
- package/lib/esm/node/domain/ContextLogger.js.map +1 -1
- package/lib/esm/node/domain/DIContext.js.map +1 -1
- package/lib/esm/node/services/DILogger.js.map +1 -1
- package/lib/esm/node/services/DITest.js +10 -5
- package/lib/esm/node/services/DITest.js.map +1 -1
- package/lib/esm/node/utils/asyncHookContext.js +3 -2
- package/lib/esm/node/utils/asyncHookContext.js.map +1 -1
- package/lib/esm/node/utils/setLoggerFormat.js.map +1 -1
- package/lib/esm/node/utils/setLoggerLevel.js.map +1 -1
- package/lib/types/common/constants/constants.d.ts +5 -3
- package/lib/types/common/decorators/constant.d.ts +4 -1
- package/lib/types/common/decorators/inject.d.ts +17 -4
- package/lib/types/common/decorators/intercept.d.ts +3 -0
- package/lib/types/common/decorators/module.d.ts +1 -1
- package/lib/types/common/decorators/value.d.ts +2 -1
- package/lib/types/common/domain/Container.d.ts +4 -4
- package/lib/types/common/domain/Provider.d.ts +6 -6
- package/lib/types/common/index.d.ts +0 -2
- package/lib/types/common/interfaces/ImportTokenProviderOpts.d.ts +2 -2
- package/lib/types/common/interfaces/InterceptorContext.d.ts +1 -1
- package/lib/types/common/interfaces/InvokeOptions.d.ts +8 -2
- package/lib/types/common/interfaces/ProviderOpts.d.ts +2 -2
- package/lib/types/common/interfaces/RegistrySettings.d.ts +2 -1
- package/lib/types/common/interfaces/ResolvedInvokeOptions.d.ts +1 -1
- package/lib/types/common/interfaces/TokenProvider.d.ts +2 -6
- package/lib/types/common/registries/GlobalProviders.d.ts +2 -2
- package/lib/types/common/services/InjectorService.d.ts +30 -54
- package/lib/types/node/decorators/injectContext.d.ts +2 -1
- package/lib/types/node/domain/ContextLogger.d.ts +3 -3
- package/lib/types/node/domain/DIContext.d.ts +1 -1
- package/lib/types/node/services/DITest.d.ts +1 -1
- package/lib/types/node/utils/asyncHookContext.d.ts +4 -3
- package/package.json +21 -18
- package/lib/cjs/common/constants/constants.js +0 -7
- package/lib/cjs/common/constants/constants.js.map +0 -1
- package/lib/cjs/common/decorators/autoInjectable.js +0 -18
- package/lib/cjs/common/decorators/autoInjectable.js.map +0 -1
- package/lib/cjs/common/decorators/configuration.js +0 -24
- package/lib/cjs/common/decorators/configuration.js.map +0 -1
- package/lib/cjs/common/decorators/constant.js +0 -55
- package/lib/cjs/common/decorators/constant.js.map +0 -1
- package/lib/cjs/common/decorators/controller.js +0 -53
- package/lib/cjs/common/decorators/controller.js.map +0 -1
- package/lib/cjs/common/decorators/inject.js +0 -93
- package/lib/cjs/common/decorators/inject.js.map +0 -1
- package/lib/cjs/common/decorators/injectable.js +0 -32
- package/lib/cjs/common/decorators/injectable.js.map +0 -1
- package/lib/cjs/common/decorators/intercept.js +0 -36
- package/lib/cjs/common/decorators/intercept.js.map +0 -1
- package/lib/cjs/common/decorators/interceptor.js +0 -21
- package/lib/cjs/common/decorators/interceptor.js.map +0 -1
- package/lib/cjs/common/decorators/lazyInject.js +0 -71
- package/lib/cjs/common/decorators/lazyInject.js.map +0 -1
- package/lib/cjs/common/decorators/module.js +0 -32
- package/lib/cjs/common/decorators/module.js.map +0 -1
- package/lib/cjs/common/decorators/opts.js +0 -54
- package/lib/cjs/common/decorators/opts.js.map +0 -1
- package/lib/cjs/common/decorators/overrideProvider.js +0 -17
- package/lib/cjs/common/decorators/overrideProvider.js.map +0 -1
- package/lib/cjs/common/decorators/scope.js +0 -16
- package/lib/cjs/common/decorators/scope.js.map +0 -1
- package/lib/cjs/common/decorators/service.js +0 -18
- package/lib/cjs/common/decorators/service.js.map +0 -1
- package/lib/cjs/common/decorators/useOpts.js +0 -65
- package/lib/cjs/common/decorators/useOpts.js.map +0 -1
- package/lib/cjs/common/decorators/value.js +0 -55
- package/lib/cjs/common/decorators/value.js.map +0 -1
- package/lib/cjs/common/domain/Container.js +0 -72
- package/lib/cjs/common/domain/Container.js.map +0 -1
- package/lib/cjs/common/domain/ControllerProvider.js +0 -36
- package/lib/cjs/common/domain/ControllerProvider.js.map +0 -1
- package/lib/cjs/common/domain/InjectablePropertyType.js +0 -12
- package/lib/cjs/common/domain/InjectablePropertyType.js.map +0 -1
- package/lib/cjs/common/domain/LocalsContainer.js +0 -15
- package/lib/cjs/common/domain/LocalsContainer.js.map +0 -1
- package/lib/cjs/common/domain/Provider.js +0 -134
- package/lib/cjs/common/domain/Provider.js.map +0 -1
- package/lib/cjs/common/domain/ProviderScope.js +0 -10
- package/lib/cjs/common/domain/ProviderScope.js.map +0 -1
- package/lib/cjs/common/domain/ProviderType.js +0 -15
- package/lib/cjs/common/domain/ProviderType.js.map +0 -1
- package/lib/cjs/common/errors/InjectionError.js +0 -58
- package/lib/cjs/common/errors/InjectionError.js.map +0 -1
- package/lib/cjs/common/errors/InvalidPropertyTokenError.js +0 -12
- package/lib/cjs/common/errors/InvalidPropertyTokenError.js.map +0 -1
- package/lib/cjs/common/errors/UndefinedTokenError.js +0 -11
- package/lib/cjs/common/errors/UndefinedTokenError.js.map +0 -1
- package/lib/cjs/common/index.js +0 -60
- package/lib/cjs/common/index.js.map +0 -1
- package/lib/cjs/common/interfaces/DIConfigurationOptions.js +0 -3
- package/lib/cjs/common/interfaces/DIConfigurationOptions.js.map +0 -1
- package/lib/cjs/common/interfaces/DILogger.js +0 -3
- package/lib/cjs/common/interfaces/DILogger.js.map +0 -1
- package/lib/cjs/common/interfaces/DILoggerOptions.js +0 -3
- package/lib/cjs/common/interfaces/DILoggerOptions.js.map +0 -1
- package/lib/cjs/common/interfaces/DIResolver.js +0 -3
- package/lib/cjs/common/interfaces/DIResolver.js.map +0 -1
- package/lib/cjs/common/interfaces/ImportTokenProviderOpts.js +0 -3
- package/lib/cjs/common/interfaces/ImportTokenProviderOpts.js.map +0 -1
- package/lib/cjs/common/interfaces/InjectableProperties.js +0 -3
- package/lib/cjs/common/interfaces/InjectableProperties.js.map +0 -1
- package/lib/cjs/common/interfaces/InterceptorContext.js +0 -3
- package/lib/cjs/common/interfaces/InterceptorContext.js.map +0 -1
- package/lib/cjs/common/interfaces/InterceptorMethods.js +0 -3
- package/lib/cjs/common/interfaces/InterceptorMethods.js.map +0 -1
- package/lib/cjs/common/interfaces/InvokeOptions.js +0 -3
- package/lib/cjs/common/interfaces/InvokeOptions.js.map +0 -1
- package/lib/cjs/common/interfaces/OnDestroy.js +0 -3
- package/lib/cjs/common/interfaces/OnDestroy.js.map +0 -1
- package/lib/cjs/common/interfaces/OnInit.js +0 -3
- package/lib/cjs/common/interfaces/OnInit.js.map +0 -1
- package/lib/cjs/common/interfaces/ProviderOpts.js +0 -3
- package/lib/cjs/common/interfaces/ProviderOpts.js.map +0 -1
- package/lib/cjs/common/interfaces/RegistrySettings.js +0 -3
- package/lib/cjs/common/interfaces/RegistrySettings.js.map +0 -1
- package/lib/cjs/common/interfaces/ResolvedInvokeOptions.js +0 -3
- package/lib/cjs/common/interfaces/ResolvedInvokeOptions.js.map +0 -1
- package/lib/cjs/common/interfaces/TokenProvider.js +0 -3
- package/lib/cjs/common/interfaces/TokenProvider.js.map +0 -1
- package/lib/cjs/common/interfaces/TokenRoute.js +0 -3
- package/lib/cjs/common/interfaces/TokenRoute.js.map +0 -1
- package/lib/cjs/common/registries/GlobalProviders.js +0 -117
- package/lib/cjs/common/registries/GlobalProviders.js.map +0 -1
- package/lib/cjs/common/registries/ProviderRegistry.js +0 -86
- package/lib/cjs/common/registries/ProviderRegistry.js.map +0 -1
- package/lib/cjs/common/services/DIConfiguration.js +0 -142
- package/lib/cjs/common/services/DIConfiguration.js.map +0 -1
- package/lib/cjs/common/services/DILogger.js +0 -14
- package/lib/cjs/common/services/DILogger.js.map +0 -1
- package/lib/cjs/common/services/InjectorService.js +0 -653
- package/lib/cjs/common/services/InjectorService.js.map +0 -1
- package/lib/cjs/common/utils/colors.js +0 -10
- package/lib/cjs/common/utils/colors.js.map +0 -1
- package/lib/cjs/common/utils/createContainer.js +0 -14
- package/lib/cjs/common/utils/createContainer.js.map +0 -1
- package/lib/cjs/common/utils/getConfiguration.js +0 -23
- package/lib/cjs/common/utils/getConfiguration.js.map +0 -1
- package/lib/cjs/common/utils/getConstructorDependencies.js +0 -13
- package/lib/cjs/common/utils/getConstructorDependencies.js.map +0 -1
- package/lib/cjs/common/utils/resolveControllers.js +0 -47
- package/lib/cjs/common/utils/resolveControllers.js.map +0 -1
- package/lib/cjs/index.js +0 -6
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/node/decorators/injectContext.js +0 -30
- package/lib/cjs/node/decorators/injectContext.js.map +0 -1
- package/lib/cjs/node/domain/ContextLogger.js +0 -99
- package/lib/cjs/node/domain/ContextLogger.js.map +0 -1
- package/lib/cjs/node/domain/DIContext.js +0 -102
- package/lib/cjs/node/domain/DIContext.js.map +0 -1
- package/lib/cjs/node/index.js +0 -18
- package/lib/cjs/node/index.js.map +0 -1
- package/lib/cjs/node/interfaces/AlterRunInContext.js +0 -3
- package/lib/cjs/node/interfaces/AlterRunInContext.js.map +0 -1
- package/lib/cjs/node/services/DILogger.js +0 -12
- package/lib/cjs/node/services/DILogger.js.map +0 -1
- package/lib/cjs/node/services/DITest.js +0 -121
- package/lib/cjs/node/services/DITest.js.map +0 -1
- package/lib/cjs/node/utils/asyncHookContext.js +0 -42
- package/lib/cjs/node/utils/asyncHookContext.js.map +0 -1
- package/lib/cjs/node/utils/attachLogger.js +0 -10
- package/lib/cjs/node/utils/attachLogger.js.map +0 -1
- package/lib/cjs/node/utils/setLoggerConfiguration.js +0 -11
- package/lib/cjs/node/utils/setLoggerConfiguration.js.map +0 -1
- package/lib/cjs/node/utils/setLoggerFormat.js +0 -33
- package/lib/cjs/node/utils/setLoggerFormat.js.map +0 -1
- package/lib/cjs/node/utils/setLoggerLevel.js +0 -15
- package/lib/cjs/node/utils/setLoggerLevel.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/esm/common/errors/UndefinedTokenError.js +0 -7
- package/lib/esm/common/errors/UndefinedTokenError.js.map +0 -1
- package/lib/esm/common/interfaces/InjectableProperties.js +0 -2
- package/lib/esm/common/interfaces/InjectableProperties.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types/common/errors/UndefinedTokenError.d.ts +0 -4
- package/lib/types/common/interfaces/InjectableProperties.d.ts +0 -25
- package/lib/types-esm/common/constants/constants.d.ts +0 -3
- package/lib/types-esm/common/decorators/autoInjectable.d.ts +0 -1
- package/lib/types-esm/common/decorators/configuration.d.ts +0 -8
- package/lib/types-esm/common/decorators/constant.d.ts +0 -36
- package/lib/types-esm/common/decorators/controller.d.ts +0 -42
- package/lib/types-esm/common/decorators/inject.d.ts +0 -22
- package/lib/types-esm/common/decorators/injectable.d.ts +0 -20
- package/lib/types-esm/common/decorators/intercept.d.ts +0 -10
- package/lib/types-esm/common/decorators/interceptor.d.ts +0 -10
- package/lib/types-esm/common/decorators/lazyInject.d.ts +0 -43
- package/lib/types-esm/common/decorators/module.d.ts +0 -37
- package/lib/types-esm/common/decorators/opts.d.ts +0 -41
- package/lib/types-esm/common/decorators/overrideProvider.d.ts +0 -8
- package/lib/types-esm/common/decorators/scope.d.ts +0 -8
- package/lib/types-esm/common/decorators/service.d.ts +0 -10
- package/lib/types-esm/common/decorators/useOpts.d.ts +0 -42
- package/lib/types-esm/common/decorators/value.d.ts +0 -36
- package/lib/types-esm/common/domain/Container.d.ts +0 -43
- package/lib/types-esm/common/domain/ControllerProvider.d.ts +0 -17
- package/lib/types-esm/common/domain/InjectablePropertyType.d.ts +0 -7
- package/lib/types-esm/common/domain/LocalsContainer.d.ts +0 -6
- package/lib/types-esm/common/domain/Provider.d.ts +0 -71
- package/lib/types-esm/common/domain/ProviderScope.d.ts +0 -5
- package/lib/types-esm/common/domain/ProviderType.d.ts +0 -10
- package/lib/types-esm/common/errors/InjectionError.d.ts +0 -8
- package/lib/types-esm/common/errors/InvalidPropertyTokenError.d.ts +0 -4
- package/lib/types-esm/common/errors/UndefinedTokenError.d.ts +0 -4
- package/lib/types-esm/common/index.d.ts +0 -56
- package/lib/types-esm/common/interfaces/DIConfigurationOptions.d.ts +0 -29
- package/lib/types-esm/common/interfaces/DILogger.d.ts +0 -8
- package/lib/types-esm/common/interfaces/DILoggerOptions.d.ts +0 -53
- package/lib/types-esm/common/interfaces/DIResolver.d.ts +0 -5
- package/lib/types-esm/common/interfaces/ImportTokenProviderOpts.d.ts +0 -19
- package/lib/types-esm/common/interfaces/InjectableProperties.d.ts +0 -25
- package/lib/types-esm/common/interfaces/InterceptorContext.d.ts +0 -11
- package/lib/types-esm/common/interfaces/InterceptorMethods.d.ts +0 -4
- package/lib/types-esm/common/interfaces/InvokeOptions.d.ts +0 -24
- package/lib/types-esm/common/interfaces/OnDestroy.d.ts +0 -3
- package/lib/types-esm/common/interfaces/OnInit.d.ts +0 -3
- package/lib/types-esm/common/interfaces/ProviderOpts.d.ts +0 -59
- package/lib/types-esm/common/interfaces/RegistrySettings.d.ts +0 -20
- package/lib/types-esm/common/interfaces/ResolvedInvokeOptions.d.ts +0 -12
- package/lib/types-esm/common/interfaces/TokenProvider.d.ts +0 -6
- package/lib/types-esm/common/interfaces/TokenRoute.d.ts +0 -5
- package/lib/types-esm/common/registries/GlobalProviders.d.ts +0 -58
- package/lib/types-esm/common/registries/ProviderRegistry.d.ts +0 -58
- package/lib/types-esm/common/services/DIConfiguration.d.ts +0 -57
- package/lib/types-esm/common/services/DILogger.d.ts +0 -3
- package/lib/types-esm/common/services/InjectorService.d.ts +0 -227
- package/lib/types-esm/common/utils/colors.d.ts +0 -5
- package/lib/types-esm/common/utils/createContainer.d.ts +0 -3
- package/lib/types-esm/common/utils/getConfiguration.d.ts +0 -3
- package/lib/types-esm/common/utils/getConstructorDependencies.d.ts +0 -2
- package/lib/types-esm/common/utils/resolveControllers.d.ts +0 -12
- package/lib/types-esm/index.d.ts +0 -2
- package/lib/types-esm/node/decorators/injectContext.d.ts +0 -15
- package/lib/types-esm/node/domain/ContextLogger.d.ts +0 -37
- package/lib/types-esm/node/domain/DIContext.d.ts +0 -61
- package/lib/types-esm/node/index.d.ts +0 -14
- package/lib/types-esm/node/interfaces/AlterRunInContext.d.ts +0 -3
- package/lib/types-esm/node/services/DILogger.d.ts +0 -1
- package/lib/types-esm/node/services/DITest.d.ts +0 -37
- package/lib/types-esm/node/utils/asyncHookContext.d.ts +0 -14
- package/lib/types-esm/node/utils/attachLogger.d.ts +0 -2
- package/lib/types-esm/node/utils/setLoggerConfiguration.d.ts +0 -2
- package/lib/types-esm/node/utils/setLoggerFormat.d.ts +0 -6
- package/lib/types-esm/node/utils/setLoggerLevel.d.ts +0 -6
- /package/{webpack.config.js → webpack.config.cjs} +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colors = void 0;
|
|
4
|
-
// istanbul ignore next
|
|
5
|
-
const colorIfAllowed = (colorFn) => (text) => !process.env.NO_COLOR && process.env.NODE_ENV !== "production" ? colorFn(text) : text;
|
|
6
|
-
const red = colorIfAllowed((text) => `\x1B[31m${text}\x1B[39m`);
|
|
7
|
-
const yellow = colorIfAllowed((text) => `\x1B[33m${text}\x1B[39m`);
|
|
8
|
-
const green = colorIfAllowed((text) => `\x1B[32m${text}\x1B[39m`);
|
|
9
|
-
exports.colors = { red, yellow, green };
|
|
10
|
-
//# sourceMappingURL=colors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../../src/common/utils/colors.ts"],"names":[],"mappings":";;;AAEA,uBAAuB;AACvB,MAAM,cAAc,GAAG,CAAC,OAAoB,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE,CAChE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAExF,MAAM,GAAG,GAAG,cAAc,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;AACxE,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;AAC3E,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,WAAW,IAAI,UAAU,CAAC,CAAC;AAE7D,QAAA,MAAM,GAAG,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContainer = void 0;
|
|
4
|
-
const Container_js_1 = require("../domain/Container.js");
|
|
5
|
-
const GlobalProviders_js_1 = require("../registries/GlobalProviders.js");
|
|
6
|
-
function createContainer(rootModule) {
|
|
7
|
-
const container = new Container_js_1.Container(GlobalProviders_js_1.GlobalProviders.entries());
|
|
8
|
-
if (rootModule) {
|
|
9
|
-
container.delete(rootModule);
|
|
10
|
-
}
|
|
11
|
-
return container;
|
|
12
|
-
}
|
|
13
|
-
exports.createContainer = createContainer;
|
|
14
|
-
//# sourceMappingURL=createContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createContainer.js","sourceRoot":"","sources":["../../../../src/common/utils/createContainer.ts"],"names":[],"mappings":";;;AACA,yDAAiD;AACjD,yEAAiE;AAEjE,SAAgB,eAAe,CAAC,UAAsB;IACpD,MAAM,SAAS,GAAG,IAAI,wBAAS,CAAC,oCAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAE3D,IAAI,UAAU,EAAE;QACd,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KAC9B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,0CAQC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getConfiguration = exports.mergeMount = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
function mergeMount(m1 = {}, m2 = {}) {
|
|
6
|
-
return Object.entries(m2).reduce((mount, [key, controllers]) => {
|
|
7
|
-
return {
|
|
8
|
-
...mount,
|
|
9
|
-
[key]: (mount[key] || []).concat(controllers)
|
|
10
|
-
};
|
|
11
|
-
}, m1);
|
|
12
|
-
}
|
|
13
|
-
exports.mergeMount = mergeMount;
|
|
14
|
-
function getConfiguration(module, configuration = {}) {
|
|
15
|
-
const store = core_1.Store.from(module).get("configuration") || {};
|
|
16
|
-
return {
|
|
17
|
-
...store,
|
|
18
|
-
...configuration,
|
|
19
|
-
mount: mergeMount(store.mount, configuration.mount)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
exports.getConfiguration = getConfiguration;
|
|
23
|
-
//# sourceMappingURL=getConfiguration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../../src/common/utils/getConfiguration.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,SAAgB,UAAU,CAAC,KAAU,EAAE,EAAE,KAAU,EAAE;IACnD,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;QAC7D,OAAO;YACL,GAAG,KAAK;YACR,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;SAC9C,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAPD,gCAOC;AAED,SAAgB,gBAAgB,CAAC,MAAiB,EAAE,gBAAqB,EAAE;IACzE,MAAM,KAAK,GAAG,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IAE5D,OAAO;QACL,GAAG,KAAK;QACR,GAAG,aAAa;QAChB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;KACpD,CAAC;AACJ,CAAC;AARD,4CAQC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setConstructorDependencies = exports.getConstructorDependencies = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
function getConstructorDependencies(target, propertyKey) {
|
|
6
|
-
return core_1.Metadata.getOwn("override:ctor:design:paramtypes", target, propertyKey) || [...core_1.Metadata.getParamTypes(target, propertyKey)] || [];
|
|
7
|
-
}
|
|
8
|
-
exports.getConstructorDependencies = getConstructorDependencies;
|
|
9
|
-
function setConstructorDependencies(target, deps) {
|
|
10
|
-
core_1.Metadata.set("override:ctor:design:paramtypes", deps, target);
|
|
11
|
-
}
|
|
12
|
-
exports.setConstructorDependencies = setConstructorDependencies;
|
|
13
|
-
//# sourceMappingURL=getConstructorDependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getConstructorDependencies.js","sourceRoot":"","sources":["../../../../src/common/utils/getConstructorDependencies.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC,SAAgB,0BAA0B,CAAC,MAAW,EAAE,WAAyC;IAC/F,OAAO,eAAQ,CAAC,MAAM,CAAC,iCAAiC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,eAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3I,CAAC;AAFD,gEAEC;AAED,SAAgB,0BAA0B,CAAC,MAAW,EAAE,IAAW;IACjE,eAAQ,CAAC,GAAG,CAAC,iCAAiC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC;AAFD,gEAEC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveControllers = exports.getTokens = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const GlobalProviders_js_1 = require("../registries/GlobalProviders.js");
|
|
6
|
-
const ProviderType_js_1 = require("../domain/ProviderType.js");
|
|
7
|
-
const lookupProperties = ["mount", "imports"];
|
|
8
|
-
function getTokens(config) {
|
|
9
|
-
if (!config) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
if ((0, core_1.isArray)(config)) {
|
|
13
|
-
return config.filter(core_1.isClass).map((value) => {
|
|
14
|
-
return { token: value };
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return Object.keys(config).reduce((list, route) => {
|
|
18
|
-
return [
|
|
19
|
-
...list,
|
|
20
|
-
...[]
|
|
21
|
-
.concat(config[route])
|
|
22
|
-
.filter(core_1.isClass)
|
|
23
|
-
.map((token) => ({
|
|
24
|
-
route,
|
|
25
|
-
token
|
|
26
|
-
}))
|
|
27
|
-
];
|
|
28
|
-
}, []);
|
|
29
|
-
}
|
|
30
|
-
exports.getTokens = getTokens;
|
|
31
|
-
function resolveRecursively(providers) {
|
|
32
|
-
return providers
|
|
33
|
-
.map(({ token }) => GlobalProviders_js_1.GlobalProviders.get(token))
|
|
34
|
-
.filter((provider) => provider?.type === ProviderType_js_1.ProviderType.MODULE && provider.configuration)
|
|
35
|
-
.flatMap((provider) => resolveControllers(provider.configuration));
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Return controllers and is base route according to his configuration in module configuration.
|
|
39
|
-
*
|
|
40
|
-
* @param settings
|
|
41
|
-
*/
|
|
42
|
-
function resolveControllers(settings) {
|
|
43
|
-
const providers = lookupProperties.flatMap((property) => getTokens(settings[property]));
|
|
44
|
-
return [...resolveRecursively(providers), ...providers].filter((provider) => !!provider.route);
|
|
45
|
-
}
|
|
46
|
-
exports.resolveControllers = resolveControllers;
|
|
47
|
-
//# sourceMappingURL=resolveControllers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveControllers.js","sourceRoot":"","sources":["../../../../src/common/utils/resolveControllers.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAE5C,yEAAiE;AACjE,+DAAuD;AAIvD,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE9C,SAAgB,SAAS,CAAC,MAAW;IACnC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAC;KACX;IAED,IAAI,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC,cAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;YAC/C,OAAO,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC;QACxB,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,KAAa,EAAE,EAAE;QAC/D,OAAO;YACL,GAAG,IAAI;YACP,GAAG,EAAE;iBACF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;iBACrB,MAAM,CAAC,cAAO,CAAC;iBACf,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACf,KAAK;gBACL,KAAK;aACN,CAAC,CAAC;SACN,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAvBD,8BAuBC;AAED,SAAS,kBAAkB,CAAC,SAAmD;IAC7E,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,oCAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,8BAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,CAAC;SACtF,OAAO,CAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,QAAqC;IACtE,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExF,OAAO,CAAC,GAAG,kBAAkB,CAAC,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAU,CAAC;AAC1G,CAAC;AAJD,gDAIC"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./common/index.js"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./node/index.js"), exports);
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,0DAAgC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectContext = void 0;
|
|
4
|
-
const index_js_1 = require("../../common/index.js");
|
|
5
|
-
const asyncHookContext_js_1 = require("../utils/asyncHookContext.js");
|
|
6
|
-
/**
|
|
7
|
-
* Inject a context like PlatformContext or any BaseContext.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Injectable()
|
|
11
|
-
* export class MyService {
|
|
12
|
-
* @InjectContext()
|
|
13
|
-
* ctx?: Context;
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @returns {Function}
|
|
18
|
-
* @decorator
|
|
19
|
-
*/
|
|
20
|
-
function InjectContext() {
|
|
21
|
-
return (target, propertyKey) => {
|
|
22
|
-
(0, index_js_1.injectProperty)(target, propertyKey, {
|
|
23
|
-
resolver() {
|
|
24
|
-
return () => (0, asyncHookContext_js_1.getContext)();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
exports.InjectContext = InjectContext;
|
|
30
|
-
//# sourceMappingURL=injectContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injectContext.js","sourceRoot":"","sources":["../../../../src/node/decorators/injectContext.ts"],"names":[],"mappings":";;;AAAA,oDAAqD;AACrD,sEAAwD;AAExD;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa;IAC3B,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAc,EAAE;QACtD,IAAA,yBAAc,EAAC,MAAM,EAAE,WAAW,EAAE;YAClC,QAAQ;gBACN,OAAO,GAAG,EAAE,CAAC,IAAA,gCAAU,GAAE,CAAC;YAC5B,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AARD,sCAQC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextLogger = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const logger_1 = require("@tsed/logger");
|
|
6
|
-
const LEVELS = (0, logger_1.levels)();
|
|
7
|
-
class ContextLogger {
|
|
8
|
-
#additionalProps;
|
|
9
|
-
#hooks;
|
|
10
|
-
#stack;
|
|
11
|
-
#logger;
|
|
12
|
-
constructor({ id, logger, dateStart = new Date(), level = "all", maxStackSize = 30, additionalProps }) {
|
|
13
|
-
this.dateStart = dateStart;
|
|
14
|
-
this.id = id;
|
|
15
|
-
this.#logger = logger;
|
|
16
|
-
this.#additionalProps = additionalProps;
|
|
17
|
-
this.level = (LEVELS[level.toUpperCase()] || LEVELS.ALL);
|
|
18
|
-
this.maxStackSize = maxStackSize;
|
|
19
|
-
}
|
|
20
|
-
get hooks() {
|
|
21
|
-
return (this.#hooks = this.#hooks || new core_1.Hooks());
|
|
22
|
-
}
|
|
23
|
-
get stack() {
|
|
24
|
-
return (this.#stack = this.#stack || []);
|
|
25
|
-
}
|
|
26
|
-
alterLog(cb) {
|
|
27
|
-
return this.hooks.on("log", cb);
|
|
28
|
-
}
|
|
29
|
-
alterIgnoreLog(cb) {
|
|
30
|
-
return this.hooks.on("ignore", cb);
|
|
31
|
-
}
|
|
32
|
-
info(obj) {
|
|
33
|
-
this.run((0, logger_1.levels)().INFO, obj);
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
debug(obj, withRequest = true) {
|
|
37
|
-
this.run((0, logger_1.levels)().DEBUG, obj, withRequest);
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
warn(obj) {
|
|
41
|
-
this.run((0, logger_1.levels)().WARN, obj);
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
error(obj) {
|
|
45
|
-
this.run((0, logger_1.levels)().ERROR, obj);
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
fatal(obj) {
|
|
49
|
-
this.run((0, logger_1.levels)().FATAL, obj);
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
trace(obj) {
|
|
53
|
-
this.run((0, logger_1.levels)().TRACE, obj);
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
flush(stream = false) {
|
|
57
|
-
if (this.stack.length) {
|
|
58
|
-
this.stack.forEach(({ level, data }) => {
|
|
59
|
-
this.#logger[level](data);
|
|
60
|
-
});
|
|
61
|
-
this.#stack = [];
|
|
62
|
-
}
|
|
63
|
-
if (stream) {
|
|
64
|
-
this.maxStackSize = 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
isLevelEnabled(otherLevel) {
|
|
68
|
-
return this.level.isLessThanOrEqualTo(otherLevel);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Return the duration between the time when LogIncomingRequest has handle the request and now.
|
|
72
|
-
* @returns {number}
|
|
73
|
-
*/
|
|
74
|
-
getDuration() {
|
|
75
|
-
return new Date().getTime() - this.dateStart.getTime();
|
|
76
|
-
}
|
|
77
|
-
getData(obj) {
|
|
78
|
-
if (typeof obj === "string") {
|
|
79
|
-
obj = { message: obj };
|
|
80
|
-
}
|
|
81
|
-
return { ...this.#additionalProps, reqId: this.id, time: new Date(), duration: this.getDuration(), ...obj };
|
|
82
|
-
}
|
|
83
|
-
run(level, obj, withRequest) {
|
|
84
|
-
if (!this.isLevelEnabled(level)) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const ignore = this.#hooks?.alter("ignore", false, [obj]);
|
|
88
|
-
if (!ignore) {
|
|
89
|
-
const levelStr = level.levelStr.toLowerCase();
|
|
90
|
-
obj = this.hooks.alter("log", this.getData(obj), [levelStr, withRequest]);
|
|
91
|
-
this.stack.push({ level: levelStr, data: obj });
|
|
92
|
-
}
|
|
93
|
-
if (this.maxStackSize < this.stack.length || [(0, logger_1.levels)().FATAL, (0, logger_1.levels)().ERROR].includes(level)) {
|
|
94
|
-
this.flush();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.ContextLogger = ContextLogger;
|
|
99
|
-
//# sourceMappingURL=ContextLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextLogger.js","sourceRoot":"","sources":["../../../../src/node/domain/ContextLogger.ts"],"names":[],"mappings":";;;AACA,qCAAiC;AACjC,yCAA8C;AAU9C,MAAM,MAAM,GAA6B,IAAA,eAAM,GAAE,CAAC;AAElD,MAAa,aAAa;IAGf,gBAAgB,CAA2B;IAKpD,MAAM,CAAS;IACf,MAAM,CAAS;IACf,OAAO,CAAM;IAEb,YAAY,EAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,IAAI,EAAE,EAAE,KAAK,GAAG,KAAK,EAAE,YAAY,GAAG,EAAE,EAAE,eAAe,EAAuB;QACvH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAa,CAAC;QACrE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,YAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,IAAY,KAAK;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ,CAAC,EAAwG;QAC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K,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;YAE1E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;SAC/C;QAED,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAA,eAAM,GAAE,CAAC,KAAK,EAAE,IAAA,eAAM,GAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;YAC7F,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;CACF;AAxHD,sCAwHC"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DIContext = void 0;
|
|
4
|
-
const index_js_1 = require("../../common/index.js");
|
|
5
|
-
const asyncHookContext_js_1 = require("../utils/asyncHookContext.js");
|
|
6
|
-
const ContextLogger_js_1 = require("./ContextLogger.js");
|
|
7
|
-
class DIContext {
|
|
8
|
-
#container;
|
|
9
|
-
#cache;
|
|
10
|
-
#logger;
|
|
11
|
-
constructor(opts) {
|
|
12
|
-
this.opts = opts;
|
|
13
|
-
this.PLATFORM = "DI";
|
|
14
|
-
this.PLATFORM = opts.platform || this.PLATFORM;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Logger attached to the context request.
|
|
18
|
-
*/
|
|
19
|
-
get logger() {
|
|
20
|
-
this.#logger = this.#logger || new ContextLogger_js_1.ContextLogger(this.opts);
|
|
21
|
-
return this.#logger;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Request id generated by @@contextMiddleware@@.
|
|
25
|
-
*
|
|
26
|
-
* ::: tip
|
|
27
|
-
* By default Ts.ED generate uuid like that `uuidv4().replace(/-/gi, ""))`.
|
|
28
|
-
* Dash are removed to simplify tracking logs in Kibana
|
|
29
|
-
* :::
|
|
30
|
-
*
|
|
31
|
-
* ::: tip
|
|
32
|
-
* Request id can by customized by changing the server configuration.
|
|
33
|
-
*
|
|
34
|
-
* ```typescript
|
|
35
|
-
* @Configuration({
|
|
36
|
-
* logger: {
|
|
37
|
-
* reqIdBuilder: createUniqId // give your own id generator function
|
|
38
|
-
* }
|
|
39
|
-
* })
|
|
40
|
-
* class Server {
|
|
41
|
-
*
|
|
42
|
-
* }
|
|
43
|
-
* ```
|
|
44
|
-
* :::
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
get id() {
|
|
48
|
-
return this.opts.id;
|
|
49
|
-
}
|
|
50
|
-
get dateStart() {
|
|
51
|
-
return this.logger.dateStart;
|
|
52
|
-
}
|
|
53
|
-
get injector() {
|
|
54
|
-
return this.opts.injector;
|
|
55
|
-
}
|
|
56
|
-
get env() {
|
|
57
|
-
return this.injector.settings.get("env");
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The request container used by the Ts.ED DI. It contains all services annotated with `@Scope(ProviderScope.REQUEST)`
|
|
61
|
-
*/
|
|
62
|
-
get container() {
|
|
63
|
-
return (this.#container = this.#container || new index_js_1.LocalsContainer());
|
|
64
|
-
}
|
|
65
|
-
destroy() {
|
|
66
|
-
return Promise.all([this.#container?.destroy(), this.#logger?.flush(true)]);
|
|
67
|
-
}
|
|
68
|
-
emit(eventName, ...args) {
|
|
69
|
-
return this.injector?.emit(eventName, ...args);
|
|
70
|
-
}
|
|
71
|
-
runInContext(next) {
|
|
72
|
-
return (0, asyncHookContext_js_1.runInContext)(this, next);
|
|
73
|
-
}
|
|
74
|
-
cache(key, cb) {
|
|
75
|
-
if (!this.has(key)) {
|
|
76
|
-
this.set(key, cb());
|
|
77
|
-
}
|
|
78
|
-
return this.get(key);
|
|
79
|
-
}
|
|
80
|
-
async cacheAsync(key, cb) {
|
|
81
|
-
if (!this.has(key)) {
|
|
82
|
-
this.set(key, await cb());
|
|
83
|
-
}
|
|
84
|
-
return this.get(key);
|
|
85
|
-
}
|
|
86
|
-
delete(key) {
|
|
87
|
-
return !!this.#cache?.delete(key);
|
|
88
|
-
}
|
|
89
|
-
get(key) {
|
|
90
|
-
return this.#cache?.get(key);
|
|
91
|
-
}
|
|
92
|
-
has(key) {
|
|
93
|
-
return !!this.#cache?.has(key);
|
|
94
|
-
}
|
|
95
|
-
set(key, value) {
|
|
96
|
-
this.#cache = this.#cache || new Map();
|
|
97
|
-
this.#cache.set(key, value);
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.DIContext = DIContext;
|
|
102
|
-
//# sourceMappingURL=DIContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DIContext.js","sourceRoot":"","sources":["../../../../src/node/domain/DIContext.ts"],"names":[],"mappings":";;;AAAA,oDAAuE;AACvE,sEAA0D;AAC1D,yDAAuE;AASvE,MAAa,SAAS;IAGpB,UAAU,CAAmB;IAC7B,MAAM,CAAiB;IACvB,OAAO,CAAiB;IAExB,YAAmB,IAAsB;QAAtB,SAAI,GAAJ,IAAI,CAAkB;QALhC,aAAQ,GAAW,IAAI,CAAC;QAM/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,gCAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IA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AED,MAAM,CAAC,GAAQ;QACb,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAED,GAAG,CAAU,GAAQ;QACnB,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,GAAQ;QACV,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,KAAU;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,EAAY,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/GD,8BA+GC"}
|
package/lib/cjs/node/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* @file Automatically generated by @tsed/barrels.
|
|
6
|
-
*/
|
|
7
|
-
tslib_1.__exportStar(require("./decorators/injectContext.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./domain/ContextLogger.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./domain/DIContext.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./interfaces/AlterRunInContext.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./services/DILogger.js"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./services/DITest.js"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./utils/asyncHookContext.js"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./utils/attachLogger.js"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./utils/setLoggerConfiguration.js"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./utils/setLoggerFormat.js"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./utils/setLoggerLevel.js"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,wEAA8C;AAC9C,oEAA0C;AAC1C,gEAAsC;AACtC,4EAAkD;AAClD,iEAAuC;AACvC,+DAAqC;AACrC,sEAA4C;AAC5C,kEAAwC;AACxC,4EAAkD;AAClD,qEAA2C;AAC3C,oEAA0C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AlterRunInContext.js","sourceRoot":"","sources":["../../../../src/node/interfaces/AlterRunInContext.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const logger_1 = require("@tsed/logger");
|
|
4
|
-
const index_js_1 = require("../../common/index.js");
|
|
5
|
-
(0, index_js_1.registerProvider)({
|
|
6
|
-
provide: logger_1.Logger,
|
|
7
|
-
deps: [index_js_1.InjectorService],
|
|
8
|
-
useFactory(injector) {
|
|
9
|
-
return injector.logger;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=DILogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DILogger.js","sourceRoot":"","sources":["../../../../src/node/services/DILogger.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,oDAAwE;AAExE,IAAA,2BAAgB,EAAC;IACf,OAAO,EAAE,eAAM;IACf,IAAI,EAAE,CAAC,0BAAe,CAAC;IACvB,UAAU,CAAC,QAAyB;QAClC,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DITest = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const logger_1 = require("@tsed/logger");
|
|
6
|
-
const index_js_1 = require("../../common/index.js");
|
|
7
|
-
const DIContext_js_1 = require("../domain/DIContext.js");
|
|
8
|
-
const setLoggerConfiguration_js_1 = require("../utils/setLoggerConfiguration.js");
|
|
9
|
-
/**
|
|
10
|
-
* Tool to run test with lightweight DI sandbox.
|
|
11
|
-
*/
|
|
12
|
-
class DITest {
|
|
13
|
-
static { this.options = {}; }
|
|
14
|
-
static { this._injector = null; }
|
|
15
|
-
static get injector() {
|
|
16
|
-
if (DITest._injector) {
|
|
17
|
-
return DITest._injector;
|
|
18
|
-
}
|
|
19
|
-
/* istanbul ignore next */
|
|
20
|
-
throw new Error("PlatformTest.injector is not initialized. Use PlatformTest.create(): Promise before PlatformTest.invoke() or PlatformTest.injector.\n" +
|
|
21
|
-
"Example:\n" +
|
|
22
|
-
"before(async () => {\n" +
|
|
23
|
-
" await PlatformTest.create()\n" +
|
|
24
|
-
" await PlatformTest.invoke(MyService, [])\n" +
|
|
25
|
-
"})");
|
|
26
|
-
}
|
|
27
|
-
static set injector(injector) {
|
|
28
|
-
DITest._injector = injector;
|
|
29
|
-
}
|
|
30
|
-
static set(key, value) {
|
|
31
|
-
(0, core_1.setValue)(DITest.options, key, value);
|
|
32
|
-
}
|
|
33
|
-
static hasInjector() {
|
|
34
|
-
return !!DITest._injector;
|
|
35
|
-
}
|
|
36
|
-
static async create(settings = {}) {
|
|
37
|
-
settings = {
|
|
38
|
-
...DITest.options,
|
|
39
|
-
...settings
|
|
40
|
-
};
|
|
41
|
-
DITest.injector = DITest.createInjector(settings);
|
|
42
|
-
await DITest.createContainer();
|
|
43
|
-
}
|
|
44
|
-
static async createContainer() {
|
|
45
|
-
await DITest.injector.load((0, index_js_1.createContainer)());
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Create a new injector with the right default services
|
|
49
|
-
*/
|
|
50
|
-
static createInjector(settings = {}) {
|
|
51
|
-
const injector = new index_js_1.InjectorService();
|
|
52
|
-
injector.logger = logger_1.$log;
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
injector.settings.set(DITest.configure(settings));
|
|
55
|
-
(0, setLoggerConfiguration_js_1.setLoggerConfiguration)(injector);
|
|
56
|
-
return injector;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Resets the test injector of the test context, so it won't pollute your next test. Call this in your `tearDown` logic.
|
|
60
|
-
*/
|
|
61
|
-
static async reset() {
|
|
62
|
-
if (DITest.hasInjector()) {
|
|
63
|
-
await DITest.injector.destroy();
|
|
64
|
-
DITest._injector = null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Invoke a provider and return a fresh instance
|
|
69
|
-
* @param target
|
|
70
|
-
* @param providers
|
|
71
|
-
*/
|
|
72
|
-
static async invoke(target, providers = []) {
|
|
73
|
-
const locals = new index_js_1.LocalsContainer();
|
|
74
|
-
providers.forEach((p) => {
|
|
75
|
-
locals.set(p.token, p.use);
|
|
76
|
-
});
|
|
77
|
-
locals.set(index_js_1.InjectorService, DITest.injector);
|
|
78
|
-
const instance = DITest.injector.invoke(target, locals, { rebuild: true });
|
|
79
|
-
if (instance && instance.$onInit) {
|
|
80
|
-
const result = instance.$onInit();
|
|
81
|
-
if (result instanceof Promise) {
|
|
82
|
-
return result
|
|
83
|
-
.then(() => {
|
|
84
|
-
return;
|
|
85
|
-
})
|
|
86
|
-
.then(() => instance);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if ((0, core_1.isClass)(instance)) {
|
|
90
|
-
await Promise.all(Object.values(instance).filter(core_1.isPromise));
|
|
91
|
-
}
|
|
92
|
-
return instance;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Return the instance from injector registry
|
|
96
|
-
* @param target
|
|
97
|
-
* @param options
|
|
98
|
-
*/
|
|
99
|
-
static get(target, options = {}) {
|
|
100
|
-
return DITest.injector.get(target, options);
|
|
101
|
-
}
|
|
102
|
-
static createDIContext() {
|
|
103
|
-
return new DIContext_js_1.DIContext({
|
|
104
|
-
id: "id",
|
|
105
|
-
injector: DITest.injector,
|
|
106
|
-
logger: DITest.injector.logger
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
static configure(settings = {}) {
|
|
110
|
-
return {
|
|
111
|
-
...settings,
|
|
112
|
-
env: (0, core_1.getValue)(settings, "env", core_1.Env.TEST),
|
|
113
|
-
logger: {
|
|
114
|
-
...(0, core_1.getValue)(settings, "logger", {}),
|
|
115
|
-
level: (0, core_1.getValue)(settings, "logger.level", "off")
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.DITest = DITest;
|
|
121
|
-
//# sourceMappingURL=DITest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DITest.js","sourceRoot":"","sources":["../../../../src/node/services/DITest.ts"],"names":[],"mappings":";;;AAAA,qCAAuE;AACvE,yCAAkC;AAClC,oDAO+B;AAC/B,yDAAiD;AACjD,kFAA0E;AAE1E;;GAEG;AACH,MAAa,MAAM;aACV,YAAO,GAAgC,EAAE,CAAC;aAChC,cAAS,GAA2B,IAAI,CAAC;IAE1D,MAAM,KAAK,QAAQ;QACjB,IAAI,MAAM,CAAC,SAAS,EAAE;YACpB,OAAO,MAAM,CAAC,SAAU,CAAC;SAC1B;QAED,0BAA0B;QAC1B,MAAM,IAAI,KAAK,CACb,uIAAuI;YACrI,YAAY;YACZ,wBAAwB;YACxB,kCAAkC;YAClC,+CAA+C;YAC/C,IAAI,CACP,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,QAAQ,CAAC,QAAyB;QAC3C,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,MA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,MAAM;SAC/B,CAAC,CAAC;IACL,CAAC;IAES,MAAM,CAAC,SAAS,CAAC,WAAwC,EAAE;QACnE,OAAO;YACL,GAAG,QAAQ;YACX,GAAG,EAAE,IAAA,eAAQ,EAAC,QAAQ,EAAE,KAAK,EAAE,UAAG,CAAC,IAAI,CAAC;YACxC,MAAM,EAAE;gBACN,GAAG,IAAA,eAAQ,EAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;gBACnC,KAAK,EAAE,IAAA,eAAQ,EAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,CAAC;aACjD;SACF,CAAC;IACJ,CAAC;;AApIH,wBAqIC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.bindContext = exports.setContext = exports.runInContext = exports.getContext = exports.useContextRef = exports.getAsyncStore = void 0;
|
|
4
|
-
const async_hooks_1 = require("async_hooks");
|
|
5
|
-
const storage = new async_hooks_1.AsyncLocalStorage();
|
|
6
|
-
function getAsyncStore() {
|
|
7
|
-
return storage;
|
|
8
|
-
}
|
|
9
|
-
exports.getAsyncStore = getAsyncStore;
|
|
10
|
-
function useContextRef() {
|
|
11
|
-
return getAsyncStore().getStore();
|
|
12
|
-
}
|
|
13
|
-
exports.useContextRef = useContextRef;
|
|
14
|
-
function getContext() {
|
|
15
|
-
return useContextRef()?.current;
|
|
16
|
-
}
|
|
17
|
-
exports.getContext = getContext;
|
|
18
|
-
async function runInContext(ctx, cb, injector) {
|
|
19
|
-
const ref = useContextRef();
|
|
20
|
-
if (ref) {
|
|
21
|
-
ctx && setContext(ctx);
|
|
22
|
-
return cb();
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
injector = ctx?.injector || injector;
|
|
26
|
-
cb = (await injector?.alterAsync("$alterRunInContext", cb)) || cb;
|
|
27
|
-
return storage.run({ current: ctx }, cb);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.runInContext = runInContext;
|
|
31
|
-
function setContext(ctx) {
|
|
32
|
-
const ref = useContextRef();
|
|
33
|
-
if (ref && !ref.current) {
|
|
34
|
-
ref.current = ctx;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.setContext = setContext;
|
|
38
|
-
function bindContext(cb) {
|
|
39
|
-
return async_hooks_1.AsyncResource.bind(cb);
|
|
40
|
-
}
|
|
41
|
-
exports.bindContext = bindContext;
|
|
42
|
-
//# sourceMappingURL=asyncHookContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asyncHookContext.js","sourceRoot":"","sources":["../../../../src/node/utils/asyncHookContext.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAI7D,MAAM,OAAO,GAAwD,IAAI,+BAAiB,EAAE,CAAC;AAE7F,SAAgB,aAAa;IAC3B,OAAO,OAAO,CAAC;AACjB,CAAC;AAFD,sCAEC;AAED,SAAgB,aAAa;IAC3B,OAAO,aAAa,EAAE,CAAC,QAAQ,EAAE,CAAC;AACpC,CAAC;AAFD,sCAEC;AAED,SAAgB,UAAU;IACxB,OAAO,aAAa,EAAE,EAAE,OAAc,CAAC;AACzC,CAAC;AAFD,gCAEC;AAEM,KAAK,UAAU,YAAY,CAAC,GAA0B,EAAE,EAAO,EAAE,QAA0B;IAChG,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAE5B,IAAI,GAAG,EAAE;QACP,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QACvB,OAAO,EAAE,EAAE,CAAC;KACb;SAAM;QACL,QAAQ,GAAG,GAAG,EAAE,QAAQ,IAAI,QAAQ,CAAC;QACrC,EAAE,GAAG,CAAC,MAAM,QAAQ,EAAE,UAAU,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAElE,OAAO,OAAO,CAAC,GAAG,CAAC,EAAC,OAAO,EAAE,GAAG,EAAC,EAAE,EAAE,CAAC,CAAC;KACxC;AACH,CAAC;AAZD,oCAYC;AAED,SAAgB,UAAU,CAAC,GAAc;IACvC,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAE5B,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;QACvB,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC;KACnB;AACH,CAAC;AAND,gCAMC;AAED,SAAgB,WAAW,CAAC,EAAO;IACjC,OAAO,2BAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAFD,kCAEC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.attachLogger = void 0;
|
|
4
|
-
const setLoggerConfiguration_js_1 = require("./setLoggerConfiguration.js");
|
|
5
|
-
function attachLogger(injector, $log) {
|
|
6
|
-
injector.logger = $log;
|
|
7
|
-
(0, setLoggerConfiguration_js_1.setLoggerConfiguration)(injector);
|
|
8
|
-
}
|
|
9
|
-
exports.attachLogger = attachLogger;
|
|
10
|
-
//# sourceMappingURL=attachLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachLogger.js","sourceRoot":"","sources":["../../../../src/node/utils/attachLogger.ts"],"names":[],"mappings":";;;AACA,2EAAmE;AAEnE,SAAgB,YAAY,CAAC,QAAyB,EAAE,IAAc;IACpE,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,IAAA,kDAAsB,EAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAHD,oCAGC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setLoggerConfiguration = void 0;
|
|
4
|
-
const setLoggerFormat_js_1 = require("./setLoggerFormat.js");
|
|
5
|
-
const setLoggerLevel_js_1 = require("./setLoggerLevel.js");
|
|
6
|
-
function setLoggerConfiguration(injector) {
|
|
7
|
-
(0, setLoggerLevel_js_1.setLoggerLevel)(injector);
|
|
8
|
-
(0, setLoggerFormat_js_1.setLoggerFormat)(injector);
|
|
9
|
-
}
|
|
10
|
-
exports.setLoggerConfiguration = setLoggerConfiguration;
|
|
11
|
-
//# sourceMappingURL=setLoggerConfiguration.js.map
|