@nestjs/core 8.2.3 → 8.3.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.
Files changed (88) hide show
  1. package/LICENSE +1 -1
  2. package/Readme.md +8 -2
  3. package/adapters/index.js +1 -1
  4. package/application-config.js +4 -0
  5. package/discovery/discovery-module.js +2 -2
  6. package/discovery/discovery-service.js +5 -5
  7. package/discovery/index.js +2 -2
  8. package/errors/exceptions/invalid-class-module.exception.d.ts +4 -0
  9. package/errors/exceptions/invalid-class-module.exception.js +11 -0
  10. package/errors/exceptions/invalid-class-scope.exception.js +2 -2
  11. package/errors/exceptions/invalid-class.exception.js +1 -1
  12. package/errors/exceptions/invalid-middleware.exception.js +1 -1
  13. package/errors/exceptions/invalid-module.exception.js +1 -1
  14. package/errors/exceptions/undefined-dependency.exception.js +1 -1
  15. package/errors/exceptions/undefined-forwardref.exception.js +1 -1
  16. package/errors/exceptions/undefined-module.exception.js +1 -1
  17. package/errors/exceptions/unknown-dependencies.exception.js +1 -1
  18. package/errors/exceptions/unknown-export.exception.js +1 -1
  19. package/errors/messages.d.ts +2 -1
  20. package/errors/messages.js +22 -9
  21. package/exceptions/base-exception-filter-context.js +3 -3
  22. package/exceptions/base-exception-filter.js +6 -6
  23. package/exceptions/exceptions-handler.js +1 -1
  24. package/exceptions/external-exception-filter-context.js +2 -2
  25. package/exceptions/external-exceptions-handler.js +1 -1
  26. package/exceptions/index.js +1 -1
  27. package/guards/guards-consumer.js +2 -2
  28. package/guards/guards-context-creator.js +4 -4
  29. package/helpers/context-utils.js +8 -4
  30. package/helpers/external-context-creator.js +3 -3
  31. package/helpers/index.js +2 -2
  32. package/helpers/interfaces/index.js +2 -2
  33. package/helpers/messages.js +10 -8
  34. package/hooks/before-app-shutdown.hook.js +5 -5
  35. package/hooks/index.js +5 -5
  36. package/hooks/on-app-bootstrap.hook.js +5 -5
  37. package/hooks/on-app-shutdown.hook.js +5 -5
  38. package/hooks/on-module-destroy.hook.js +5 -5
  39. package/hooks/on-module-init.hook.js +5 -5
  40. package/index.js +12 -12
  41. package/injector/compiler.js +1 -1
  42. package/injector/helpers/transient-instances.js +2 -2
  43. package/injector/index.js +5 -5
  44. package/injector/injector.js +13 -13
  45. package/injector/inquirer/index.js +1 -1
  46. package/injector/instance-links-host.js +1 -1
  47. package/injector/instance-loader.js +1 -1
  48. package/injector/instance-wrapper.js +7 -7
  49. package/injector/internal-core-module.js +3 -3
  50. package/injector/module-ref.js +1 -1
  51. package/injector/module-token-factory.js +5 -4
  52. package/injector/module.js +18 -18
  53. package/injector/modules-container.js +1 -1
  54. package/interceptors/interceptors-consumer.js +4 -4
  55. package/interceptors/interceptors-context-creator.js +4 -4
  56. package/metadata-scanner.js +4 -4
  57. package/middleware/builder.js +3 -3
  58. package/middleware/container.d.ts +0 -1
  59. package/middleware/container.js +2 -6
  60. package/middleware/index.js +1 -1
  61. package/middleware/middleware-module.js +6 -6
  62. package/middleware/routes-mapper.js +6 -6
  63. package/middleware/utils.js +6 -6
  64. package/nest-application-context.d.ts +5 -0
  65. package/nest-application-context.js +18 -8
  66. package/nest-application.js +13 -14
  67. package/nest-factory.js +9 -6
  68. package/package.json +2 -2
  69. package/pipes/pipes-context-creator.js +4 -4
  70. package/router/index.js +2 -2
  71. package/router/interfaces/index.js +1 -1
  72. package/router/route-path-factory.js +21 -16
  73. package/router/router-exception-filters.js +2 -2
  74. package/router/router-execution-context.js +7 -6
  75. package/router/router-explorer.js +12 -12
  76. package/router/router-module.js +6 -6
  77. package/router/router-response-controller.d.ts +5 -2
  78. package/router/router-response-controller.js +19 -10
  79. package/router/routes-resolver.js +6 -3
  80. package/router/sse-stream.d.ts +8 -2
  81. package/router/sse-stream.js +7 -10
  82. package/router/utils/exclude-route.util.js +1 -1
  83. package/router/utils/flatten-route-paths.util.js +2 -2
  84. package/router/utils/index.js +2 -2
  85. package/scanner.d.ts +18 -2
  86. package/scanner.js +43 -14
  87. package/services/index.js +1 -1
  88. package/services/reflector.service.js +2 -2
@@ -10,14 +10,14 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnAppBootstrapHook(instance) {
13
- return shared_utils_1.isFunction(instance.onApplicationBootstrap);
13
+ return (0, shared_utils_1.isFunction)(instance.onApplicationBootstrap);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
17
17
  */
18
18
  function callOperator(instances) {
19
- return iterare_1.iterate(instances)
20
- .filter(instance => !shared_utils_1.isNil(instance))
19
+ return (0, iterare_1.iterate)(instances)
20
+ .filter(instance => !(0, shared_utils_1.isNil)(instance))
21
21
  .filter(hasOnAppBootstrapHook)
22
22
  .map(async (instance) => instance.onApplicationBootstrap())
23
23
  .toArray();
@@ -39,9 +39,9 @@ async function callModuleBootstrapHook(module) {
39
39
  ...module.injectables,
40
40
  ...module.middlewares,
41
41
  ];
42
- const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
42
+ const nonTransientInstances = (0, transient_instances_1.getNonTransientInstances)(instances);
43
43
  await Promise.all(callOperator(nonTransientInstances));
44
- const transientInstances = transient_instances_1.getTransientInstances(instances);
44
+ const transientInstances = (0, transient_instances_1.getTransientInstances)(instances);
45
45
  await Promise.all(callOperator(transientInstances));
46
46
  // Call the instance itself
47
47
  const moduleClassInstance = moduleClassHost.instance;
@@ -10,14 +10,14 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnAppShutdownHook(instance) {
13
- return shared_utils_1.isFunction(instance.onApplicationShutdown);
13
+ return (0, shared_utils_1.isFunction)(instance.onApplicationShutdown);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
17
17
  */
18
18
  function callOperator(instances, signal) {
19
- return iterare_1.iterate(instances)
20
- .filter(instance => !shared_utils_1.isNil(instance))
19
+ return (0, iterare_1.iterate)(instances)
20
+ .filter(instance => !(0, shared_utils_1.isNil)(instance))
21
21
  .filter(hasOnAppShutdownHook)
22
22
  .map(async (instance) => instance.onApplicationShutdown(signal))
23
23
  .toArray();
@@ -39,9 +39,9 @@ async function callAppShutdownHook(module, signal) {
39
39
  ...module.injectables,
40
40
  ...module.middlewares,
41
41
  ];
42
- const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
42
+ const nonTransientInstances = (0, transient_instances_1.getNonTransientInstances)(instances);
43
43
  await Promise.all(callOperator(nonTransientInstances, signal));
44
- const transientInstances = transient_instances_1.getTransientInstances(instances);
44
+ const transientInstances = (0, transient_instances_1.getTransientInstances)(instances);
45
45
  await Promise.all(callOperator(transientInstances, signal));
46
46
  // Call the instance itself
47
47
  const moduleClassInstance = moduleClassHost.instance;
@@ -10,14 +10,14 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnModuleDestroyHook(instance) {
13
- return shared_utils_1.isFunction(instance.onModuleDestroy);
13
+ return (0, shared_utils_1.isFunction)(instance.onModuleDestroy);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances onModuleDestroy hook
17
17
  */
18
18
  function callOperator(instances) {
19
- return iterare_1.iterate(instances)
20
- .filter(instance => !shared_utils_1.isNil(instance))
19
+ return (0, iterare_1.iterate)(instances)
20
+ .filter(instance => !(0, shared_utils_1.isNil)(instance))
21
21
  .filter(hasOnModuleDestroyHook)
22
22
  .map(async (instance) => instance.onModuleDestroy())
23
23
  .toArray();
@@ -39,9 +39,9 @@ async function callModuleDestroyHook(module) {
39
39
  ...module.injectables,
40
40
  ...module.middlewares,
41
41
  ];
42
- const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
42
+ const nonTransientInstances = (0, transient_instances_1.getNonTransientInstances)(instances);
43
43
  await Promise.all(callOperator(nonTransientInstances));
44
- const transientInstances = transient_instances_1.getTransientInstances(instances);
44
+ const transientInstances = (0, transient_instances_1.getTransientInstances)(instances);
45
45
  await Promise.all(callOperator(transientInstances));
46
46
  // Call the module instance itself
47
47
  const moduleClassInstance = moduleClassHost.instance;
@@ -10,14 +10,14 @@ const transient_instances_1 = require("../injector/helpers/transient-instances")
10
10
  * @param instance The instance which should be checked
11
11
  */
12
12
  function hasOnModuleInitHook(instance) {
13
- return shared_utils_1.isFunction(instance.onModuleInit);
13
+ return (0, shared_utils_1.isFunction)(instance.onModuleInit);
14
14
  }
15
15
  /**
16
16
  * Calls the given instances
17
17
  */
18
18
  function callOperator(instances) {
19
- return iterare_1.iterate(instances)
20
- .filter(instance => !shared_utils_1.isNil(instance))
19
+ return (0, iterare_1.iterate)(instances)
20
+ .filter(instance => !(0, shared_utils_1.isNil)(instance))
21
21
  .filter(hasOnModuleInitHook)
22
22
  .map(async (instance) => instance.onModuleInit())
23
23
  .toArray();
@@ -39,9 +39,9 @@ async function callModuleInitHook(module) {
39
39
  ...module.injectables,
40
40
  ...module.middlewares,
41
41
  ];
42
- const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
42
+ const nonTransientInstances = (0, transient_instances_1.getNonTransientInstances)(instances);
43
43
  await Promise.all(callOperator(nonTransientInstances));
44
- const transientInstances = transient_instances_1.getTransientInstances(instances);
44
+ const transientInstances = (0, transient_instances_1.getTransientInstances)(instances);
45
45
  await Promise.all(callOperator(transientInstances));
46
46
  // Call the instance itself
47
47
  const moduleClassInstance = moduleClassHost.instance;
package/index.js CHANGED
@@ -9,22 +9,22 @@ const tslib_1 = require("tslib");
9
9
  * MIT Licensed
10
10
  */
11
11
  require("reflect-metadata");
12
- tslib_1.__exportStar(require("./adapters"), exports);
13
- tslib_1.__exportStar(require("./application-config"), exports);
12
+ (0, tslib_1.__exportStar)(require("./adapters"), exports);
13
+ (0, tslib_1.__exportStar)(require("./application-config"), exports);
14
14
  var constants_1 = require("./constants");
15
15
  Object.defineProperty(exports, "APP_FILTER", { enumerable: true, get: function () { return constants_1.APP_FILTER; } });
16
16
  Object.defineProperty(exports, "APP_GUARD", { enumerable: true, get: function () { return constants_1.APP_GUARD; } });
17
17
  Object.defineProperty(exports, "APP_INTERCEPTOR", { enumerable: true, get: function () { return constants_1.APP_INTERCEPTOR; } });
18
18
  Object.defineProperty(exports, "APP_PIPE", { enumerable: true, get: function () { return constants_1.APP_PIPE; } });
19
- tslib_1.__exportStar(require("./discovery"), exports);
20
- tslib_1.__exportStar(require("./exceptions"), exports);
21
- tslib_1.__exportStar(require("./helpers"), exports);
22
- tslib_1.__exportStar(require("./injector"), exports);
23
- tslib_1.__exportStar(require("./metadata-scanner"), exports);
24
- tslib_1.__exportStar(require("./middleware"), exports);
25
- tslib_1.__exportStar(require("./nest-application"), exports);
26
- tslib_1.__exportStar(require("./nest-application-context"), exports);
19
+ (0, tslib_1.__exportStar)(require("./discovery"), exports);
20
+ (0, tslib_1.__exportStar)(require("./exceptions"), exports);
21
+ (0, tslib_1.__exportStar)(require("./helpers"), exports);
22
+ (0, tslib_1.__exportStar)(require("./injector"), exports);
23
+ (0, tslib_1.__exportStar)(require("./metadata-scanner"), exports);
24
+ (0, tslib_1.__exportStar)(require("./middleware"), exports);
25
+ (0, tslib_1.__exportStar)(require("./nest-application"), exports);
26
+ (0, tslib_1.__exportStar)(require("./nest-application-context"), exports);
27
27
  var nest_factory_1 = require("./nest-factory");
28
28
  Object.defineProperty(exports, "NestFactory", { enumerable: true, get: function () { return nest_factory_1.NestFactory; } });
29
- tslib_1.__exportStar(require("./router"), exports);
30
- tslib_1.__exportStar(require("./services"), exports);
29
+ (0, tslib_1.__exportStar)(require("./router"), exports);
30
+ (0, tslib_1.__exportStar)(require("./services"), exports);
@@ -16,7 +16,7 @@ class ModuleCompiler {
16
16
  if (!this.isDynamicModule(metatype)) {
17
17
  return { type: metatype };
18
18
  }
19
- const { module: type } = metatype, dynamicMetadata = tslib_1.__rest(metatype, ["module"]);
19
+ const { module: type } = metatype, dynamicMetadata = (0, tslib_1.__rest)(metatype, ["module"]);
20
20
  return { type, dynamicMetadata };
21
21
  }
22
22
  isDynamicModule(module) {
@@ -7,7 +7,7 @@ const iterare_1 = require("iterare");
7
7
  * @param instances The instances which should be checked whether they are transcient
8
8
  */
9
9
  function getTransientInstances(instances) {
10
- return iterare_1.iterate(instances)
10
+ return (0, iterare_1.iterate)(instances)
11
11
  .filter(([_, wrapper]) => wrapper.isDependencyTreeStatic())
12
12
  .map(([_, wrapper]) => wrapper.getStaticTransientInstances())
13
13
  .flatten()
@@ -21,7 +21,7 @@ exports.getTransientInstances = getTransientInstances;
21
21
  * @param instances The instances which should be checked whether they are transcient
22
22
  */
23
23
  function getNonTransientInstances(instances) {
24
- return iterare_1.iterate(instances)
24
+ return (0, iterare_1.iterate)(instances)
25
25
  .filter(([key, wrapper]) => wrapper.isDependencyTreeStatic() && !wrapper.isTransient)
26
26
  .map(([key, { instance }]) => instance)
27
27
  .toArray();
package/injector/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./container"), exports);
5
- tslib_1.__exportStar(require("./inquirer"), exports);
6
- tslib_1.__exportStar(require("./lazy-module-loader"), exports);
7
- tslib_1.__exportStar(require("./module-ref"), exports);
8
- tslib_1.__exportStar(require("./modules-container"), exports);
4
+ (0, tslib_1.__exportStar)(require("./container"), exports);
5
+ (0, tslib_1.__exportStar)(require("./inquirer"), exports);
6
+ (0, tslib_1.__exportStar)(require("./lazy-module-loader"), exports);
7
+ (0, tslib_1.__exportStar)(require("./module-ref"), exports);
8
+ (0, tslib_1.__exportStar)(require("./modules-container"), exports);
@@ -37,7 +37,7 @@ class Injector {
37
37
  const token = wrapper.token || wrapper.name;
38
38
  const { inject } = wrapper;
39
39
  const targetWrapper = collection.get(token);
40
- if (shared_utils_1.isUndefined(targetWrapper)) {
40
+ if ((0, shared_utils_1.isUndefined)(targetWrapper)) {
41
41
  throw new runtime_exception_1.RuntimeException();
42
42
  }
43
43
  if (instanceHost.isResolved) {
@@ -54,7 +54,7 @@ class Injector {
54
54
  async loadMiddleware(wrapper, collection, moduleRef, contextId = constants_2.STATIC_CONTEXT, inquirer) {
55
55
  const { metatype, token } = wrapper;
56
56
  const targetWrapper = collection.get(token);
57
- if (!shared_utils_1.isUndefined(targetWrapper.instance)) {
57
+ if (!(0, shared_utils_1.isUndefined)(targetWrapper.instance)) {
58
58
  return;
59
59
  }
60
60
  targetWrapper.instance = Object.create(metatype.prototype);
@@ -89,10 +89,10 @@ class Injector {
89
89
  const deps = await this.loadCtorMetadata(metadata, contextId, inquirer, parentInquirer);
90
90
  return callback(deps);
91
91
  }
92
- const dependencies = shared_utils_1.isNil(inject)
92
+ const dependencies = (0, shared_utils_1.isNil)(inject)
93
93
  ? this.reflectConstructorParams(wrapper.metatype)
94
94
  : inject;
95
- const optionalDependenciesIds = shared_utils_1.isNil(inject)
95
+ const optionalDependenciesIds = (0, shared_utils_1.isNil)(inject)
96
96
  ? this.reflectOptionalParams(wrapper.metatype)
97
97
  : [];
98
98
  let isResolved = true;
@@ -136,7 +136,7 @@ class Injector {
136
136
  return Reflect.getMetadata(constants_1.SELF_DECLARED_DEPS_METADATA, type) || [];
137
137
  }
138
138
  async resolveSingleParam(wrapper, param, dependencyContext, moduleRef, contextId = constants_2.STATIC_CONTEXT, inquirer, keyOrIndex) {
139
- if (shared_utils_1.isUndefined(param)) {
139
+ if ((0, shared_utils_1.isUndefined)(param)) {
140
140
  this.logger.log('Nest encountered an undefined dependency. This may be due to a circular import or a missing dependency declaration.');
141
141
  throw new undefined_dependency_exception_1.UndefinedDependencyException(wrapper.name, dependencyContext, moduleRef);
142
142
  }
@@ -198,7 +198,7 @@ class Injector {
198
198
  }
199
199
  async lookupComponentInParentModules(dependencyContext, moduleRef, wrapper, contextId = constants_2.STATIC_CONTEXT, inquirer, keyOrIndex) {
200
200
  const instanceWrapper = await this.lookupComponentInImports(moduleRef, dependencyContext.name, wrapper, [], contextId, inquirer, keyOrIndex);
201
- if (shared_utils_1.isNil(instanceWrapper)) {
201
+ if ((0, shared_utils_1.isNil)(instanceWrapper)) {
202
202
  throw new unknown_dependencies_exception_1.UnknownDependenciesException(wrapper.name, dependencyContext, moduleRef);
203
203
  }
204
204
  return instanceWrapper;
@@ -240,7 +240,7 @@ class Injector {
240
240
  return instanceWrapperRef;
241
241
  }
242
242
  async resolveProperties(wrapper, moduleRef, inject, contextId = constants_2.STATIC_CONTEXT, inquirer, parentInquirer) {
243
- if (!shared_utils_1.isNil(inject)) {
243
+ if (!(0, shared_utils_1.isNil)(inject)) {
244
244
  return [];
245
245
  }
246
246
  const metadata = wrapper.getPropertiesMetadata();
@@ -280,11 +280,11 @@ class Injector {
280
280
  return properties.map((item) => (Object.assign(Object.assign({}, item), { name: item.type, isOptional: optionalKeys.includes(item.key) })));
281
281
  }
282
282
  applyProperties(instance, properties) {
283
- if (!shared_utils_1.isObject(instance)) {
283
+ if (!(0, shared_utils_1.isObject)(instance)) {
284
284
  return undefined;
285
285
  }
286
- iterare_1.iterate(properties)
287
- .filter(item => !shared_utils_1.isNil(item.instance))
286
+ (0, iterare_1.iterate)(properties)
287
+ .filter(item => !(0, shared_utils_1.isNil)(item.instance))
288
288
  .forEach(item => (instance[item.key] = item.instance));
289
289
  }
290
290
  async instantiateClass(instances, wrapper, targetMetatype, contextId = constants_2.STATIC_CONTEXT, inquirer) {
@@ -295,7 +295,7 @@ class Injector {
295
295
  wrapper.isInRequestScope(contextId, inquirer) ||
296
296
  wrapper.isLazyTransient(contextId, inquirer) ||
297
297
  wrapper.isExplicitlyRequested(contextId, inquirer);
298
- if (shared_utils_1.isNil(inject) && isInContext) {
298
+ if ((0, shared_utils_1.isNil)(inject) && isInContext) {
299
299
  instanceHost.instance = wrapper.forwardRef
300
300
  ? Object.assign(instanceHost.instance, new metatype(...instances))
301
301
  : new metatype(...instances);
@@ -357,12 +357,12 @@ class Injector {
357
357
  return param === inquirer_1.INQUIRER && parentInquirer;
358
358
  }
359
359
  addDependencyMetadata(keyOrIndex, hostWrapper, instanceWrapper) {
360
- shared_utils_1.isString(keyOrIndex)
360
+ (0, shared_utils_1.isString)(keyOrIndex)
361
361
  ? hostWrapper.addPropertiesMetadata(keyOrIndex, instanceWrapper)
362
362
  : hostWrapper.addCtorMetadata(keyOrIndex, instanceWrapper);
363
363
  }
364
364
  getTokenName(token) {
365
- return shared_utils_1.isFunction(token) ? token.name : token.toString();
365
+ return (0, shared_utils_1.isFunction)(token) ? token.name : token.toString();
366
366
  }
367
367
  printResolvingDependenciesLog(token, inquirer) {
368
368
  var _a, _b, _c;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./inquirer-constants"), exports);
4
+ (0, tslib_1.__exportStar)(require("./inquirer-constants"), exports);
@@ -48,7 +48,7 @@ class InstanceLinksHost {
48
48
  }
49
49
  getInstanceNameByToken(token) {
50
50
  var _a;
51
- return shared_utils_1.isFunction(token) ? (_a = token) === null || _a === void 0 ? void 0 : _a.name : token;
51
+ return (0, shared_utils_1.isFunction)(token) ? (_a = token) === null || _a === void 0 ? void 0 : _a.name : token;
52
52
  }
53
53
  }
54
54
  exports.InstanceLinksHost = InstanceLinksHost;
@@ -31,7 +31,7 @@ class InstanceLoader {
31
31
  await this.createInstancesOfControllers(moduleRef);
32
32
  const { name } = moduleRef.metatype;
33
33
  this.isModuleWhitelisted(name) &&
34
- this.logger.log(messages_1.MODULE_INIT_MESSAGE `${name}`);
34
+ this.logger.log((0, messages_1.MODULE_INIT_MESSAGE) `${name}`);
35
35
  }));
36
36
  }
37
37
  createPrototypesOfProviders(moduleRef) {
@@ -16,7 +16,7 @@ class InstanceWrapper {
16
16
  this.scope = common_1.Scope.DEFAULT;
17
17
  this.values = new WeakMap();
18
18
  this[_a] = {};
19
- this[exports.INSTANCE_ID_SYMBOL] = random_string_generator_util_1.randomStringGenerator();
19
+ this[exports.INSTANCE_ID_SYMBOL] = (0, random_string_generator_util_1.randomStringGenerator)();
20
20
  this.initialize(metadata);
21
21
  }
22
22
  get id() {
@@ -30,7 +30,7 @@ class InstanceWrapper {
30
30
  return instancePerContext.instance;
31
31
  }
32
32
  get isNotMetatype() {
33
- const isFactory = this.metatype && !shared_utils_1.isNil(this.inject);
33
+ const isFactory = this.metatype && !(0, shared_utils_1.isNil)(this.inject);
34
34
  return !this.metatype || isFactory;
35
35
  }
36
36
  get isTransient() {
@@ -101,7 +101,7 @@ class InstanceWrapper {
101
101
  return this[exports.INSTANCE_METADATA_SYMBOL].enhancers;
102
102
  }
103
103
  isDependencyTreeStatic(lookupRegistry = []) {
104
- if (!shared_utils_1.isUndefined(this.isTreeStatic)) {
104
+ if (!(0, shared_utils_1.isUndefined)(this.isTreeStatic)) {
105
105
  return this.isTreeStatic;
106
106
  }
107
107
  if (this.scope === common_1.Scope.REQUEST) {
@@ -190,13 +190,13 @@ class InstanceWrapper {
190
190
  return [];
191
191
  }
192
192
  const instances = [...this.transientMap.values()];
193
- return iterare_1.iterate(instances)
193
+ return (0, iterare_1.iterate)(instances)
194
194
  .map(item => item.get(constants_1.STATIC_CONTEXT))
195
195
  .filter(item => !!item)
196
196
  .toArray();
197
197
  }
198
198
  mergeWith(provider) {
199
- if (!shared_utils_1.isUndefined(provider.useValue)) {
199
+ if (!(0, shared_utils_1.isUndefined)(provider.useValue)) {
200
200
  this.metatype = null;
201
201
  this.inject = null;
202
202
  this.scope = common_1.Scope.DEFAULT;
@@ -216,13 +216,13 @@ class InstanceWrapper {
216
216
  }
217
217
  }
218
218
  isNewable() {
219
- return shared_utils_1.isNil(this.inject) && this.metatype && this.metatype.prototype;
219
+ return (0, shared_utils_1.isNil)(this.inject) && this.metatype && this.metatype.prototype;
220
220
  }
221
221
  isWrapperListStatic(tree, lookupRegistry) {
222
222
  return tree.every((item) => item.isDependencyTreeStatic(lookupRegistry));
223
223
  }
224
224
  initialize(metadata) {
225
- const { instance, isResolved } = metadata, wrapperPartial = tslib_1.__rest(metadata, ["instance", "isResolved"]);
225
+ const { instance, isResolved } = metadata, wrapperPartial = (0, tslib_1.__rest)(metadata, ["instance", "isResolved"]);
226
226
  Object.assign(this, wrapperPartial);
227
227
  this.setInstanceByContextId(constants_1.STATIC_CONTEXT, {
228
228
  instance,
@@ -20,9 +20,9 @@ let InternalCoreModule = InternalCoreModule_1 = class InternalCoreModule {
20
20
  };
21
21
  }
22
22
  };
23
- InternalCoreModule = InternalCoreModule_1 = tslib_1.__decorate([
24
- common_1.Global(),
25
- common_1.Module({
23
+ InternalCoreModule = InternalCoreModule_1 = (0, tslib_1.__decorate)([
24
+ (0, common_1.Global)(),
25
+ (0, common_1.Module)({
26
26
  providers: [
27
27
  services_1.Reflector,
28
28
  ReflectorAliasProvider,
@@ -63,7 +63,7 @@ class ModuleRef {
63
63
  name: type && type.name,
64
64
  metatype: type,
65
65
  isResolved: false,
66
- scope: get_class_scope_1.getClassScope(type),
66
+ scope: (0, get_class_scope_1.getClassScope)(type),
67
67
  host: moduleRef,
68
68
  });
69
69
  return new Promise(async (resolve, reject) => {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModuleTokenFactory = void 0;
4
4
  const random_string_generator_util_1 = require("@nestjs/common/utils/random-string-generator.util");
5
+ const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
5
6
  const fast_safe_stringify_1 = require("fast-safe-stringify");
6
7
  const hash = require("object-hash");
7
8
  class ModuleTokenFactory {
@@ -22,7 +23,7 @@ class ModuleTokenFactory {
22
23
  // The replacer function is also required in order to obtain real class names
23
24
  // instead of the unified "Function" key
24
25
  return dynamicModuleMetadata
25
- ? fast_safe_stringify_1.default(dynamicModuleMetadata, this.replacer)
26
+ ? (0, fast_safe_stringify_1.default)(dynamicModuleMetadata, this.replacer)
26
27
  : '';
27
28
  }
28
29
  getModuleId(metatype) {
@@ -30,7 +31,7 @@ class ModuleTokenFactory {
30
31
  if (moduleId) {
31
32
  return moduleId;
32
33
  }
33
- moduleId = random_string_generator_util_1.randomStringGenerator();
34
+ moduleId = (0, random_string_generator_util_1.randomStringGenerator)();
34
35
  this.moduleIdsCache.set(metatype, moduleId);
35
36
  return moduleId;
36
37
  }
@@ -38,7 +39,7 @@ class ModuleTokenFactory {
38
39
  return metatype.name;
39
40
  }
40
41
  replacer(key, value) {
41
- if (typeof value === 'function') {
42
+ if ((0, shared_utils_1.isFunction)(value)) {
42
43
  const funcAsString = value.toString();
43
44
  const isClass = /^class\s/.test(funcAsString);
44
45
  if (isClass) {
@@ -46,7 +47,7 @@ class ModuleTokenFactory {
46
47
  }
47
48
  return hash(funcAsString, { ignoreUnknown: true });
48
49
  }
49
- if (typeof value === 'symbol') {
50
+ if ((0, shared_utils_1.isSymbol)(value)) {
50
51
  return value.toString();
51
52
  }
52
53
  return value;
@@ -25,7 +25,7 @@ class Module {
25
25
  this._exports = new Set();
26
26
  this._distance = 0;
27
27
  this.addCoreProviders();
28
- this._id = random_string_generator_util_1.randomStringGenerator();
28
+ this._id = (0, random_string_generator_util_1.randomStringGenerator)();
29
29
  }
30
30
  get id() {
31
31
  return this._id;
@@ -135,7 +135,7 @@ class Module {
135
135
  metatype: injectable,
136
136
  instance: null,
137
137
  isResolved: false,
138
- scope: get_class_scope_1.getClassScope(injectable),
138
+ scope: (0, get_class_scope_1.getClassScope)(injectable),
139
139
  host: this,
140
140
  });
141
141
  this._injectables.set(injectable, instanceWrapper);
@@ -155,13 +155,13 @@ class Module {
155
155
  metatype: provider,
156
156
  instance: null,
157
157
  isResolved: false,
158
- scope: get_class_scope_1.getClassScope(provider),
158
+ scope: (0, get_class_scope_1.getClassScope)(provider),
159
159
  host: this,
160
160
  }));
161
161
  return provider;
162
162
  }
163
163
  isCustomProvider(provider) {
164
- return !shared_utils_1.isNil(provider.provide);
164
+ return !(0, shared_utils_1.isNil)(provider.provide);
165
165
  }
166
166
  addCustomProvider(provider, collection) {
167
167
  if (this.isCustomClass(provider)) {
@@ -179,16 +179,16 @@ class Module {
179
179
  return provider.provide;
180
180
  }
181
181
  isCustomClass(provider) {
182
- return !shared_utils_1.isUndefined(provider.useClass);
182
+ return !(0, shared_utils_1.isUndefined)(provider.useClass);
183
183
  }
184
184
  isCustomValue(provider) {
185
- return !shared_utils_1.isUndefined(provider.useValue);
185
+ return !(0, shared_utils_1.isUndefined)(provider.useValue);
186
186
  }
187
187
  isCustomFactory(provider) {
188
- return !shared_utils_1.isUndefined(provider.useFactory);
188
+ return !(0, shared_utils_1.isUndefined)(provider.useFactory);
189
189
  }
190
190
  isCustomUseExisting(provider) {
191
- return !shared_utils_1.isUndefined(provider.useExisting);
191
+ return !(0, shared_utils_1.isUndefined)(provider.useExisting);
192
192
  }
193
193
  isDynamicModule(exported) {
194
194
  return exported && exported.module;
@@ -196,8 +196,8 @@ class Module {
196
196
  addCustomClass(provider, collection) {
197
197
  let { scope } = provider;
198
198
  const { useClass } = provider;
199
- if (shared_utils_1.isUndefined(scope)) {
200
- scope = get_class_scope_1.getClassScope(useClass);
199
+ if ((0, shared_utils_1.isUndefined)(scope)) {
200
+ scope = (0, get_class_scope_1.getClassScope)(useClass);
201
201
  }
202
202
  collection.set(provider.provide, new instance_wrapper_1.InstanceWrapper({
203
203
  token: provider.provide,
@@ -255,7 +255,7 @@ class Module {
255
255
  if (this.isCustomProvider(provider)) {
256
256
  return this.addCustomExportedProvider(provider);
257
257
  }
258
- else if (shared_utils_1.isString(provider) || shared_utils_1.isSymbol(provider)) {
258
+ else if ((0, shared_utils_1.isString)(provider) || (0, shared_utils_1.isSymbol)(provider)) {
259
259
  return addExportedUnit(provider);
260
260
  }
261
261
  else if (this.isDynamicModule(provider)) {
@@ -266,7 +266,7 @@ class Module {
266
266
  }
267
267
  addCustomExportedProvider(provider) {
268
268
  const provide = provider.provide;
269
- if (shared_utils_1.isString(provide) || shared_utils_1.isSymbol(provide)) {
269
+ if ((0, shared_utils_1.isString)(provide) || (0, shared_utils_1.isSymbol)(provide)) {
270
270
  return this._exports.add(this.validateExportedProvider(provide));
271
271
  }
272
272
  this._exports.add(this.validateExportedProvider(provide));
@@ -275,14 +275,14 @@ class Module {
275
275
  if (this._providers.has(token)) {
276
276
  return token;
277
277
  }
278
- const imports = iterare_1.iterate(this._imports.values())
278
+ const imports = (0, iterare_1.iterate)(this._imports.values())
279
279
  .filter(item => !!item)
280
280
  .map(({ metatype }) => metatype)
281
281
  .filter(metatype => !!metatype)
282
282
  .toArray();
283
283
  if (!imports.includes(token)) {
284
284
  const { name } = this.metatype;
285
- const providerName = shared_utils_1.isFunction(token) ? token.name : token;
285
+ const providerName = (0, shared_utils_1.isFunction)(token) ? token.name : token;
286
286
  throw new unknown_export_exception_1.UnknownExportException(providerName, name);
287
287
  }
288
288
  return token;
@@ -294,7 +294,7 @@ class Module {
294
294
  metatype: controller,
295
295
  instance: null,
296
296
  isResolved: false,
297
- scope: get_class_scope_1.getClassScope(controller),
297
+ scope: (0, get_class_scope_1.getClassScope)(controller),
298
298
  host: this,
299
299
  }));
300
300
  this.assignControllerUniqueId(controller);
@@ -304,7 +304,7 @@ class Module {
304
304
  enumerable: false,
305
305
  writable: false,
306
306
  configurable: true,
307
- value: random_string_generator_util_1.randomStringGenerator(),
307
+ value: (0, random_string_generator_util_1.randomStringGenerator)(),
308
308
  });
309
309
  }
310
310
  addRelatedModule(module) {
@@ -344,11 +344,11 @@ class Module {
344
344
  ? this.find(typeOrToken)
345
345
  : this.find(typeOrToken, self);
346
346
  }
347
- resolve(typeOrToken, contextId = context_id_factory_1.createContextId(), options = { strict: true }) {
347
+ resolve(typeOrToken, contextId = (0, context_id_factory_1.createContextId)(), options = { strict: true }) {
348
348
  return this.resolvePerContext(typeOrToken, self, contextId, options);
349
349
  }
350
350
  async create(type) {
351
- if (!(type && shared_utils_1.isFunction(type) && type.prototype)) {
351
+ if (!(type && (0, shared_utils_1.isFunction)(type) && type.prototype)) {
352
352
  throw new invalid_class_exception_1.InvalidClassException(type);
353
353
  }
354
354
  return this.instantiateClass(type, self);
@@ -5,7 +5,7 @@ const uuid_1 = require("uuid");
5
5
  class ModulesContainer extends Map {
6
6
  constructor() {
7
7
  super(...arguments);
8
- this._applicationId = uuid_1.v4();
8
+ this._applicationId = (0, uuid_1.v4)();
9
9
  }
10
10
  get applicationId() {
11
11
  return this._applicationId;
@@ -7,18 +7,18 @@ const operators_1 = require("rxjs/operators");
7
7
  const execution_context_host_1 = require("../helpers/execution-context-host");
8
8
  class InterceptorsConsumer {
9
9
  async intercept(interceptors, args, instance, callback, next, type) {
10
- if (shared_utils_1.isEmpty(interceptors)) {
10
+ if ((0, shared_utils_1.isEmpty)(interceptors)) {
11
11
  return next();
12
12
  }
13
13
  const context = this.createContext(args, instance, callback);
14
14
  context.setType(type);
15
- const start$ = rxjs_1.defer(() => this.transformDeferred(next));
15
+ const start$ = (0, rxjs_1.defer)(() => this.transformDeferred(next));
16
16
  const nextFn = (i = 0) => async () => {
17
17
  if (i >= interceptors.length) {
18
18
  return start$;
19
19
  }
20
20
  const handler = {
21
- handle: () => rxjs_1.from(nextFn(i + 1)()).pipe(operators_1.mergeAll()),
21
+ handle: () => (0, rxjs_1.from)(nextFn(i + 1)()).pipe((0, operators_1.mergeAll)()),
22
22
  };
23
23
  return interceptors[i].intercept(context, handler);
24
24
  };
@@ -28,7 +28,7 @@ class InterceptorsConsumer {
28
28
  return new execution_context_host_1.ExecutionContextHost(args, instance.constructor, callback);
29
29
  }
30
30
  transformDeferred(next) {
31
- return rxjs_1.from(next()).pipe(operators_1.switchMap(res => {
31
+ return (0, rxjs_1.from)(next()).pipe((0, operators_1.switchMap)(res => {
32
32
  const isDeferred = res instanceof Promise || res instanceof rxjs_1.Observable;
33
33
  return isDeferred ? res : Promise.resolve(res);
34
34
  }));
@@ -17,13 +17,13 @@ class InterceptorsContextCreator extends context_creator_1.ContextCreator {
17
17
  return this.createContext(instance, callback, constants_1.INTERCEPTORS_METADATA, contextId, inquirerId);
18
18
  }
19
19
  createConcreteContext(metadata, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
20
- if (shared_utils_1.isEmpty(metadata)) {
20
+ if ((0, shared_utils_1.isEmpty)(metadata)) {
21
21
  return [];
22
22
  }
23
- return iterare_1.iterate(metadata)
23
+ return (0, iterare_1.iterate)(metadata)
24
24
  .filter(interceptor => interceptor && (interceptor.name || interceptor.intercept))
25
25
  .map(interceptor => this.getInterceptorInstance(interceptor, contextId, inquirerId))
26
- .filter((interceptor) => interceptor && shared_utils_1.isFunction(interceptor.intercept))
26
+ .filter((interceptor) => interceptor && (0, shared_utils_1.isFunction)(interceptor.intercept))
27
27
  .toArray();
28
28
  }
29
29
  getInterceptorInstance(metatype, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
@@ -58,7 +58,7 @@ class InterceptorsContextCreator extends context_creator_1.ContextCreator {
58
58
  return globalInterceptors;
59
59
  }
60
60
  const scopedInterceptorWrappers = this.config.getGlobalRequestInterceptors();
61
- const scopedInterceptors = iterare_1.iterate(scopedInterceptorWrappers)
61
+ const scopedInterceptors = (0, iterare_1.iterate)(scopedInterceptorWrappers)
62
62
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
63
63
  .filter(host => !!host)
64
64
  .map(host => host.instance)