@nestjs/core 8.3.1 → 8.4.2

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 (67) hide show
  1. package/Readme.md +1 -1
  2. package/discovery/discovery-module.js +1 -1
  3. package/discovery/discovery-service.js +3 -3
  4. package/errors/exceptions/invalid-class-module.exception.js +1 -1
  5. package/errors/exceptions/invalid-class-scope.exception.js +2 -2
  6. package/errors/exceptions/invalid-class.exception.js +1 -1
  7. package/errors/exceptions/invalid-middleware.exception.js +1 -1
  8. package/errors/exceptions/invalid-module.exception.js +1 -1
  9. package/errors/exceptions/undefined-dependency.exception.js +1 -1
  10. package/errors/exceptions/undefined-forwardref.exception.js +1 -1
  11. package/errors/exceptions/undefined-module.exception.js +1 -1
  12. package/errors/exceptions/unknown-dependencies.exception.js +1 -1
  13. package/errors/exceptions/unknown-export.exception.js +1 -1
  14. package/errors/messages.js +9 -9
  15. package/exceptions/base-exception-filter-context.js +3 -3
  16. package/exceptions/base-exception-filter.js +4 -4
  17. package/exceptions/exceptions-handler.js +1 -1
  18. package/exceptions/external-exception-filter-context.js +2 -2
  19. package/exceptions/external-exceptions-handler.js +1 -1
  20. package/guards/guards-consumer.js +2 -2
  21. package/guards/guards-context-creator.js +4 -4
  22. package/helpers/context-utils.js +1 -1
  23. package/helpers/external-context-creator.js +3 -3
  24. package/hooks/before-app-shutdown.hook.js +5 -5
  25. package/hooks/on-app-bootstrap.hook.js +5 -5
  26. package/hooks/on-app-shutdown.hook.js +5 -5
  27. package/hooks/on-module-destroy.hook.js +5 -5
  28. package/hooks/on-module-init.hook.js +5 -5
  29. package/injector/helpers/transient-instances.js +2 -2
  30. package/injector/injector.d.ts +4 -1
  31. package/injector/injector.js +48 -19
  32. package/injector/instance-links-host.js +1 -2
  33. package/injector/instance-loader.js +1 -1
  34. package/injector/instance-wrapper.d.ts +2 -1
  35. package/injector/instance-wrapper.js +6 -6
  36. package/injector/internal-core-module.js +2 -2
  37. package/injector/module-ref.js +1 -1
  38. package/injector/module-token-factory.js +4 -4
  39. package/injector/module.d.ts +12 -8
  40. package/injector/module.js +21 -24
  41. package/injector/modules-container.js +1 -1
  42. package/interceptors/interceptors-consumer.js +4 -4
  43. package/interceptors/interceptors-context-creator.js +4 -4
  44. package/metadata-scanner.js +4 -4
  45. package/middleware/builder.js +3 -3
  46. package/middleware/container.js +1 -1
  47. package/middleware/middleware-module.js +9 -8
  48. package/middleware/routes-mapper.js +6 -6
  49. package/middleware/utils.js +6 -6
  50. package/nest-application-context.js +9 -10
  51. package/nest-application.js +13 -13
  52. package/nest-factory.js +6 -6
  53. package/package.json +3 -3
  54. package/pipes/pipes-context-creator.js +4 -4
  55. package/router/route-path-factory.js +8 -8
  56. package/router/router-exception-filters.js +2 -2
  57. package/router/router-execution-context.js +4 -4
  58. package/router/router-explorer.js +36 -12
  59. package/router/router-module.js +4 -4
  60. package/router/router-response-controller.js +6 -6
  61. package/router/routes-resolver.js +2 -2
  62. package/router/sse-stream.js +1 -1
  63. package/router/utils/exclude-route.util.js +1 -1
  64. package/router/utils/flatten-route-paths.util.js +2 -2
  65. package/scanner.js +10 -10
  66. package/services/reflector.service.js +2 -2
  67. package/CHANGELOG.md +0 -12
package/Readme.md CHANGED
@@ -54,7 +54,7 @@ With official support, you can get expert help straight from Nest core team. We
54
54
 
55
55
  ## Support
56
56
 
57
- Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
57
+ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
58
58
 
59
59
  #### Principal Sponsors
60
60
  <table style="text-align:center;"><tr>
@@ -11,7 +11,7 @@ const discovery_service_1 = require("./discovery-service");
11
11
  let DiscoveryModule = class DiscoveryModule {
12
12
  };
13
13
  DiscoveryModule = tslib_1.__decorate([
14
- common_1.Module({
14
+ (0, common_1.Module)({
15
15
  providers: [metadata_scanner_1.MetadataScanner, discovery_service_1.DiscoveryService],
16
16
  exports: [metadata_scanner_1.MetadataScanner, discovery_service_1.DiscoveryService],
17
17
  })
@@ -13,11 +13,11 @@ let DiscoveryService = class DiscoveryService {
13
13
  }
14
14
  getProviders(options = {}, modules = this.getModules(options)) {
15
15
  const providers = modules.map(item => [...item.providers.values()]);
16
- return common_1.flatten(providers);
16
+ return (0, common_1.flatten)(providers);
17
17
  }
18
18
  getControllers(options = {}, modules = this.getModules(options)) {
19
19
  const controllers = modules.map(item => [...item.controllers.values()]);
20
- return common_1.flatten(controllers);
20
+ return (0, common_1.flatten)(controllers);
21
21
  }
22
22
  getModules(options = {}) {
23
23
  if (!options.include) {
@@ -33,7 +33,7 @@ let DiscoveryService = class DiscoveryService {
33
33
  }
34
34
  };
35
35
  DiscoveryService = tslib_1.__decorate([
36
- common_1.Injectable(),
36
+ (0, common_1.Injectable)(),
37
37
  tslib_1.__metadata("design:paramtypes", [modules_container_1.ModulesContainer])
38
38
  ], DiscoveryService);
39
39
  exports.DiscoveryService = DiscoveryService;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class InvalidClassModuleException extends runtime_exception_1.RuntimeException {
7
7
  constructor(metatypeUsedAsAModule, scope) {
8
- super(messages_1.USING_INVALID_CLASS_AS_A_MODULE_MESSAGE(metatypeUsedAsAModule, scope));
8
+ super((0, messages_1.USING_INVALID_CLASS_AS_A_MODULE_MESSAGE)(metatypeUsedAsAModule, scope));
9
9
  }
10
10
  }
11
11
  exports.InvalidClassModuleException = InvalidClassModuleException;
@@ -6,11 +6,11 @@ const messages_1 = require("../messages");
6
6
  const runtime_exception_1 = require("./runtime.exception");
7
7
  class InvalidClassScopeException extends runtime_exception_1.RuntimeException {
8
8
  constructor(metatypeOrToken) {
9
- let name = shared_utils_1.isFunction(metatypeOrToken)
9
+ let name = (0, shared_utils_1.isFunction)(metatypeOrToken)
10
10
  ? metatypeOrToken.name
11
11
  : metatypeOrToken;
12
12
  name = name && name.toString();
13
- super(messages_1.INVALID_CLASS_SCOPE_MESSAGE `${name}`);
13
+ super((0, messages_1.INVALID_CLASS_SCOPE_MESSAGE) `${name}`);
14
14
  }
15
15
  }
16
16
  exports.InvalidClassScopeException = InvalidClassScopeException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class InvalidClassException extends runtime_exception_1.RuntimeException {
7
7
  constructor(value) {
8
- super(messages_1.INVALID_CLASS_MESSAGE `${value}`);
8
+ super((0, messages_1.INVALID_CLASS_MESSAGE) `${value}`);
9
9
  }
10
10
  }
11
11
  exports.InvalidClassException = InvalidClassException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class InvalidMiddlewareException extends runtime_exception_1.RuntimeException {
7
7
  constructor(name) {
8
- super(messages_1.INVALID_MIDDLEWARE_MESSAGE `${name}`);
8
+ super((0, messages_1.INVALID_MIDDLEWARE_MESSAGE) `${name}`);
9
9
  }
10
10
  }
11
11
  exports.InvalidMiddlewareException = InvalidMiddlewareException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class InvalidModuleException extends runtime_exception_1.RuntimeException {
7
7
  constructor(parentModule, index, scope) {
8
- super(messages_1.INVALID_MODULE_MESSAGE(parentModule, index, scope));
8
+ super((0, messages_1.INVALID_MODULE_MESSAGE)(parentModule, index, scope));
9
9
  }
10
10
  }
11
11
  exports.InvalidModuleException = InvalidModuleException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class UndefinedDependencyException extends runtime_exception_1.RuntimeException {
7
7
  constructor(type, undefinedDependencyContext, module) {
8
- super(messages_1.UNKNOWN_DEPENDENCIES_MESSAGE(type, undefinedDependencyContext, module));
8
+ super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, undefinedDependencyContext, module));
9
9
  }
10
10
  }
11
11
  exports.UndefinedDependencyException = UndefinedDependencyException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class UndefinedForwardRefException extends runtime_exception_1.RuntimeException {
7
7
  constructor(scope) {
8
- super(messages_1.UNDEFINED_FORWARDREF_MESSAGE(scope));
8
+ super((0, messages_1.UNDEFINED_FORWARDREF_MESSAGE)(scope));
9
9
  }
10
10
  }
11
11
  exports.UndefinedForwardRefException = UndefinedForwardRefException;
@@ -5,7 +5,7 @@ const runtime_exception_1 = require("./runtime.exception");
5
5
  const messages_1 = require("../messages");
6
6
  class UndefinedModuleException extends runtime_exception_1.RuntimeException {
7
7
  constructor(parentModule, index, scope) {
8
- super(messages_1.UNDEFINED_MODULE_MESSAGE(parentModule, index, scope));
8
+ super((0, messages_1.UNDEFINED_MODULE_MESSAGE)(parentModule, index, scope));
9
9
  }
10
10
  }
11
11
  exports.UndefinedModuleException = UndefinedModuleException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class UnknownDependenciesException extends runtime_exception_1.RuntimeException {
7
7
  constructor(type, unknownDependencyContext, module) {
8
- super(messages_1.UNKNOWN_DEPENDENCIES_MESSAGE(type, unknownDependencyContext, module));
8
+ super((0, messages_1.UNKNOWN_DEPENDENCIES_MESSAGE)(type, unknownDependencyContext, module));
9
9
  }
10
10
  }
11
11
  exports.UnknownDependenciesException = UnknownDependenciesException;
@@ -5,7 +5,7 @@ const messages_1 = require("../messages");
5
5
  const runtime_exception_1 = require("./runtime.exception");
6
6
  class UnknownExportException extends runtime_exception_1.RuntimeException {
7
7
  constructor(token, moduleName) {
8
- super(messages_1.UNKNOWN_EXPORT_MESSAGE(token, moduleName));
8
+ super((0, messages_1.UNKNOWN_EXPORT_MESSAGE)(token, moduleName));
9
9
  }
10
10
  }
11
11
  exports.UnknownExportException = UnknownExportException;
@@ -7,14 +7,14 @@ const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
7
7
  * @param instance The instance which should get the name from
8
8
  */
9
9
  const getInstanceName = (instance) => {
10
- var _a, _b, _c, _d, _e;
11
- if ((_a = instance) === null || _a === void 0 ? void 0 : _a.forwardRef) {
12
- return (_b = instance.forwardRef()) === null || _b === void 0 ? void 0 : _b.name;
10
+ var _a, _b;
11
+ if (instance === null || instance === void 0 ? void 0 : instance.forwardRef) {
12
+ return (_a = instance.forwardRef()) === null || _a === void 0 ? void 0 : _a.name;
13
13
  }
14
- if ((_c = instance) === null || _c === void 0 ? void 0 : _c.module) {
15
- return (_d = instance.module) === null || _d === void 0 ? void 0 : _d.name;
14
+ if (instance === null || instance === void 0 ? void 0 : instance.module) {
15
+ return (_b = instance.module) === null || _b === void 0 ? void 0 : _b.name;
16
16
  }
17
- return (_e = instance) === null || _e === void 0 ? void 0 : _e.name;
17
+ return instance === null || instance === void 0 ? void 0 : instance.name;
18
18
  };
19
19
  /**
20
20
  * Returns the name of the dependency
@@ -26,7 +26,7 @@ const getDependencyName = (dependency) =>
26
26
  // use class name
27
27
  getInstanceName(dependency) ||
28
28
  // use injection token (symbol)
29
- (shared_utils_1.isSymbol(dependency) && dependency.toString()) ||
29
+ ((0, shared_utils_1.isSymbol)(dependency) && dependency.toString()) ||
30
30
  // use string directly
31
31
  dependency ||
32
32
  // otherwise
@@ -51,7 +51,7 @@ Potential solutions:
51
51
  imports: [ /* the Module containing ${dependencyName} */ ]
52
52
  })
53
53
  `;
54
- if (shared_utils_1.isNil(index)) {
54
+ if ((0, shared_utils_1.isNil)(index)) {
55
55
  message += `. Please make sure that the "${key.toString()}" property is available in the current context.${potentialSolutions}`;
56
56
  return message;
57
57
  }
@@ -103,7 +103,7 @@ Scope [${stringifyScope(scope)}]`;
103
103
  };
104
104
  exports.UNDEFINED_MODULE_MESSAGE = UNDEFINED_MODULE_MESSAGE;
105
105
  const UNKNOWN_EXPORT_MESSAGE = (token = 'item', module) => {
106
- token = shared_utils_1.isSymbol(token) ? token.toString() : token;
106
+ token = (0, shared_utils_1.isSymbol)(token) ? token.toString() : token;
107
107
  return `Nest cannot export a provider/module that is not a part of the currently processed module (${module}). Please verify whether the exported ${token} is available in this particular context.
108
108
 
109
109
  Possible Solutions:
@@ -12,11 +12,11 @@ class BaseExceptionFilterContext extends context_creator_1.ContextCreator {
12
12
  this.container = container;
13
13
  }
14
14
  createConcreteContext(metadata, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
15
- if (shared_utils_1.isEmpty(metadata)) {
15
+ if ((0, shared_utils_1.isEmpty)(metadata)) {
16
16
  return [];
17
17
  }
18
- return iterare_1.iterate(metadata)
19
- .filter(instance => instance && (shared_utils_1.isFunction(instance.catch) || instance.name))
18
+ return (0, iterare_1.iterate)(metadata)
19
+ .filter(instance => instance && ((0, shared_utils_1.isFunction)(instance.catch) || instance.name))
20
20
  .map(filter => this.getFilterInstance(filter, contextId, inquirerId))
21
21
  .filter(item => !!item)
22
22
  .map(instance => ({
@@ -17,7 +17,7 @@ class BaseExceptionFilter {
17
17
  return this.handleUnknownError(exception, host, applicationRef);
18
18
  }
19
19
  const res = exception.getResponse();
20
- const message = shared_utils_1.isObject(res)
20
+ const message = (0, shared_utils_1.isObject)(res)
21
21
  ? res
22
22
  : {
23
23
  statusCode: exception.getStatus(),
@@ -42,7 +42,7 @@ class BaseExceptionFilter {
42
42
  return BaseExceptionFilter.logger.error(exception);
43
43
  }
44
44
  isExceptionObject(err) {
45
- return shared_utils_1.isObject(err) && !!err.message;
45
+ return (0, shared_utils_1.isObject)(err) && !!err.message;
46
46
  }
47
47
  /**
48
48
  * Checks if the thrown error comes from the "http-errors" library.
@@ -54,8 +54,8 @@ class BaseExceptionFilter {
54
54
  }
55
55
  BaseExceptionFilter.logger = new common_1.Logger('ExceptionsHandler');
56
56
  tslib_1.__decorate([
57
- common_1.Optional(),
58
- common_1.Inject(),
57
+ (0, common_1.Optional)(),
58
+ (0, common_1.Inject)(),
59
59
  tslib_1.__metadata("design:type", http_adapter_host_1.HttpAdapterHost)
60
60
  ], BaseExceptionFilter.prototype, "httpAdapterHost", void 0);
61
61
  exports.BaseExceptionFilter = BaseExceptionFilter;
@@ -22,7 +22,7 @@ class ExceptionsHandler extends base_exception_filter_1.BaseExceptionFilter {
22
22
  this.filters = filters;
23
23
  }
24
24
  invokeCustomFilters(exception, ctx) {
25
- if (shared_utils_1.isEmpty(this.filters)) {
25
+ if ((0, shared_utils_1.isEmpty)(this.filters)) {
26
26
  return false;
27
27
  }
28
28
  const isInstanceOf = (metatype) => exception instanceof metatype;
@@ -16,7 +16,7 @@ class ExternalExceptionFilterContext extends base_exception_filter_context_1.Bas
16
16
  this.moduleContext = module;
17
17
  const exceptionHandler = new external_exceptions_handler_1.ExternalExceptionsHandler();
18
18
  const filters = this.createContext(instance, callback, constants_1.EXCEPTION_FILTERS_METADATA, contextId, inquirerId);
19
- if (shared_utils_1.isEmpty(filters)) {
19
+ if ((0, shared_utils_1.isEmpty)(filters)) {
20
20
  return exceptionHandler;
21
21
  }
22
22
  exceptionHandler.setCustomFilters(filters.reverse());
@@ -31,7 +31,7 @@ class ExternalExceptionFilterContext extends base_exception_filter_context_1.Bas
31
31
  return globalFilters;
32
32
  }
33
33
  const scopedFilterWrappers = this.config.getGlobalRequestFilters();
34
- const scopedFilters = iterare_1.iterate(scopedFilterWrappers)
34
+ const scopedFilters = (0, iterare_1.iterate)(scopedFilterWrappers)
35
35
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
36
36
  .filter(host => !!host)
37
37
  .map(host => host.instance)
@@ -23,7 +23,7 @@ class ExternalExceptionsHandler extends external_exception_filter_1.ExternalExce
23
23
  this.filters = filters;
24
24
  }
25
25
  invokeCustomFilters(exception, host) {
26
- if (shared_utils_1.isEmpty(this.filters)) {
26
+ if ((0, shared_utils_1.isEmpty)(this.filters)) {
27
27
  return null;
28
28
  }
29
29
  const isInstanceOf = (metatype) => exception instanceof metatype;
@@ -6,7 +6,7 @@ const rxjs_1 = require("rxjs");
6
6
  const execution_context_host_1 = require("../helpers/execution-context-host");
7
7
  class GuardsConsumer {
8
8
  async tryActivate(guards, args, instance, callback, type) {
9
- if (!guards || shared_utils_1.isEmpty(guards)) {
9
+ if (!guards || (0, shared_utils_1.isEmpty)(guards)) {
10
10
  return true;
11
11
  }
12
12
  const context = this.createContext(args, instance, callback);
@@ -25,7 +25,7 @@ class GuardsConsumer {
25
25
  }
26
26
  async pickResult(result) {
27
27
  if (result instanceof rxjs_1.Observable) {
28
- return rxjs_1.lastValueFrom(result);
28
+ return (0, rxjs_1.lastValueFrom)(result);
29
29
  }
30
30
  return result;
31
31
  }
@@ -17,13 +17,13 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
17
17
  return this.createContext(instance, callback, constants_1.GUARDS_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((guard) => guard && (guard.name || guard.canActivate))
25
25
  .map(guard => this.getGuardInstance(guard, contextId, inquirerId))
26
- .filter((guard) => guard && shared_utils_1.isFunction(guard.canActivate))
26
+ .filter((guard) => guard && (0, shared_utils_1.isFunction)(guard.canActivate))
27
27
  .toArray();
28
28
  }
29
29
  getGuardInstance(metatype, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
@@ -59,7 +59,7 @@ class GuardsContextCreator extends context_creator_1.ContextCreator {
59
59
  return globalGuards;
60
60
  }
61
61
  const scopedGuardWrappers = this.config.getGlobalRequestGuards();
62
- const scopedGuards = iterare_1.iterate(scopedGuardWrappers)
62
+ const scopedGuards = (0, iterare_1.iterate)(scopedGuardWrappers)
63
63
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
64
64
  .filter(host => !!host)
65
65
  .map(host => host.instance)
@@ -36,7 +36,7 @@ class ContextUtils {
36
36
  return paramsProperties.map(param => (Object.assign(Object.assign({}, param), { metatype: paramtypes[param.index] })));
37
37
  }
38
38
  getCustomFactory(factory, data, contextFactory) {
39
- return shared_utils_1.isFunction(factory)
39
+ return (0, shared_utils_1.isFunction)(factory)
40
40
  ? (...args) => factory(data, contextFactory(args))
41
41
  : () => null;
42
42
  }
@@ -143,13 +143,13 @@ class ExternalContextCreator {
143
143
  return paramsOptions.length ? pipesFn : null;
144
144
  }
145
145
  async getParamValue(value, { metatype, type, data }, pipes) {
146
- return shared_utils_1.isEmpty(pipes)
146
+ return (0, shared_utils_1.isEmpty)(pipes)
147
147
  ? value
148
148
  : this.pipesConsumer.apply(value, { metatype, type, data }, pipes);
149
149
  }
150
150
  async transformToResult(resultOrDeferred) {
151
- if (rxjs_1.isObservable(resultOrDeferred)) {
152
- return rxjs_1.lastValueFrom(resultOrDeferred);
151
+ if ((0, rxjs_1.isObservable)(resultOrDeferred)) {
152
+ return (0, rxjs_1.lastValueFrom)(resultOrDeferred);
153
153
  }
154
154
  return resultOrDeferred;
155
155
  }
@@ -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 hasBeforeApplicationShutdownHook(instance) {
13
- return shared_utils_1.isFunction(instance.beforeApplicationShutdown);
13
+ return (0, shared_utils_1.isFunction)(instance.beforeApplicationShutdown);
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(hasBeforeApplicationShutdownHook)
22
22
  .map(async (instance) => instance.beforeApplicationShutdown(signal))
23
23
  .toArray();
@@ -38,9 +38,9 @@ async function callBeforeAppShutdownHook(module, signal) {
38
38
  ...module.injectables,
39
39
  ...module.middlewares,
40
40
  ];
41
- const nonTransientInstances = transient_instances_1.getNonTransientInstances(instances);
41
+ const nonTransientInstances = (0, transient_instances_1.getNonTransientInstances)(instances);
42
42
  await Promise.all(callOperator(nonTransientInstances, signal));
43
- const transientInstances = transient_instances_1.getTransientInstances(instances);
43
+ const transientInstances = (0, transient_instances_1.getTransientInstances)(instances);
44
44
  await Promise.all(callOperator(transientInstances, signal));
45
45
  const moduleClassInstance = moduleClassHost.instance;
46
46
  if (moduleClassInstance &&
@@ -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;
@@ -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();
@@ -1,3 +1,4 @@
1
+ import { InjectionToken } from '@nestjs/common';
1
2
  import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
2
3
  import { Injectable } from '@nestjs/common/interfaces/injectable.interface';
3
4
  import { Type } from '@nestjs/common/interfaces/type.interface';
@@ -6,7 +7,7 @@ import { InstanceToken, Module } from './module';
6
7
  /**
7
8
  * The type of an injectable dependency
8
9
  */
9
- export declare type InjectorDependency = Type<any> | Function | string | symbol;
10
+ export declare type InjectorDependency = InjectionToken;
10
11
  /**
11
12
  * The property-based dependency
12
13
  */
@@ -49,6 +50,8 @@ export declare class Injector {
49
50
  loadProvider(wrapper: InstanceWrapper<Injectable>, moduleRef: Module, contextId?: ContextId, inquirer?: InstanceWrapper): Promise<void>;
50
51
  applyDoneHook<T>(wrapper: InstancePerContext<T>): () => void;
51
52
  resolveConstructorParams<T>(wrapper: InstanceWrapper<T>, moduleRef: Module, inject: InjectorDependency[], callback: (args: unknown[]) => void | Promise<void>, contextId?: ContextId, inquirer?: InstanceWrapper, parentInquirer?: InstanceWrapper): Promise<void>;
53
+ getClassDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
54
+ getFactoryProviderDependencies<T>(wrapper: InstanceWrapper<T>): [InjectorDependency[], number[]];
52
55
  reflectConstructorParams<T>(type: Type<T>): any[];
53
56
  reflectOptionalParams<T>(type: Type<T>): any[];
54
57
  reflectSelfParams<T>(type: Type<T>): any[];