@nestjs/core 8.4.0 → 8.4.1

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 (62) hide show
  1. package/discovery/discovery-module.js +1 -1
  2. package/discovery/discovery-service.js +3 -3
  3. package/errors/exceptions/invalid-class-module.exception.js +1 -1
  4. package/errors/exceptions/invalid-class-scope.exception.js +2 -2
  5. package/errors/exceptions/invalid-class.exception.js +1 -1
  6. package/errors/exceptions/invalid-middleware.exception.js +1 -1
  7. package/errors/exceptions/invalid-module.exception.js +1 -1
  8. package/errors/exceptions/undefined-dependency.exception.js +1 -1
  9. package/errors/exceptions/undefined-forwardref.exception.js +1 -1
  10. package/errors/exceptions/undefined-module.exception.js +1 -1
  11. package/errors/exceptions/unknown-dependencies.exception.js +1 -1
  12. package/errors/exceptions/unknown-export.exception.js +1 -1
  13. package/errors/messages.js +9 -9
  14. package/exceptions/base-exception-filter-context.js +3 -3
  15. package/exceptions/base-exception-filter.js +4 -4
  16. package/exceptions/exceptions-handler.js +1 -1
  17. package/exceptions/external-exception-filter-context.js +2 -2
  18. package/exceptions/external-exceptions-handler.js +1 -1
  19. package/guards/guards-consumer.js +2 -2
  20. package/guards/guards-context-creator.js +4 -4
  21. package/helpers/context-utils.js +1 -1
  22. package/helpers/external-context-creator.js +3 -3
  23. package/hooks/before-app-shutdown.hook.js +5 -5
  24. package/hooks/on-app-bootstrap.hook.js +5 -5
  25. package/hooks/on-app-shutdown.hook.js +5 -5
  26. package/hooks/on-module-destroy.hook.js +5 -5
  27. package/hooks/on-module-init.hook.js +5 -5
  28. package/injector/helpers/transient-instances.js +2 -2
  29. package/injector/injector.js +16 -15
  30. package/injector/instance-links-host.js +1 -2
  31. package/injector/instance-loader.js +1 -1
  32. package/injector/instance-wrapper.js +6 -6
  33. package/injector/internal-core-module.js +2 -2
  34. package/injector/module-ref.js +1 -1
  35. package/injector/module-token-factory.js +4 -4
  36. package/injector/module.js +21 -24
  37. package/injector/modules-container.js +1 -1
  38. package/interceptors/interceptors-consumer.js +4 -4
  39. package/interceptors/interceptors-context-creator.js +4 -4
  40. package/metadata-scanner.js +4 -4
  41. package/middleware/builder.js +3 -3
  42. package/middleware/container.js +1 -1
  43. package/middleware/middleware-module.js +9 -8
  44. package/middleware/routes-mapper.js +6 -6
  45. package/middleware/utils.js +6 -6
  46. package/nest-application-context.js +9 -10
  47. package/nest-application.js +13 -13
  48. package/nest-factory.js +6 -6
  49. package/package.json +2 -2
  50. package/pipes/pipes-context-creator.js +4 -4
  51. package/router/route-path-factory.js +8 -8
  52. package/router/router-exception-filters.js +2 -2
  53. package/router/router-execution-context.js +4 -4
  54. package/router/router-explorer.js +14 -14
  55. package/router/router-module.js +4 -4
  56. package/router/router-response-controller.js +6 -6
  57. package/router/routes-resolver.js +2 -2
  58. package/router/sse-stream.js +1 -1
  59. package/router/utils/exclude-route.util.js +1 -1
  60. package/router/utils/flatten-route-paths.util.js +2 -2
  61. package/scanner.js +9 -9
  62. package/services/reflector.service.js +2 -2
@@ -15,8 +15,8 @@ const container_1 = require("./middleware/container");
15
15
  const middleware_module_1 = require("./middleware/middleware-module");
16
16
  const nest_application_context_1 = require("./nest-application-context");
17
17
  const routes_resolver_1 = require("./router/routes-resolver");
18
- const { SocketModule } = optional_require_1.optionalRequire('@nestjs/websockets/socket-module', () => require('@nestjs/websockets/socket-module'));
19
- const { MicroservicesModule } = optional_require_1.optionalRequire('@nestjs/microservices/microservices-module', () => require('@nestjs/microservices/microservices-module'));
18
+ const { SocketModule } = (0, optional_require_1.optionalRequire)('@nestjs/websockets/socket-module', () => require('@nestjs/websockets/socket-module'));
19
+ const { MicroservicesModule } = (0, optional_require_1.optionalRequire)('@nestjs/microservices/microservices-module', () => require('@nestjs/microservices/microservices-module'));
20
20
  /**
21
21
  * @publicApi
22
22
  */
@@ -43,7 +43,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
43
43
  this.socketModule && (await this.socketModule.close());
44
44
  this.microservicesModule && (await this.microservicesModule.close());
45
45
  this.httpAdapter && (await this.httpAdapter.close());
46
- await Promise.all(iterare_1.iterate(this.microservices).map(async (microservice) => {
46
+ await Promise.all((0, iterare_1.iterate)(this.microservices).map(async (microservice) => {
47
47
  microservice.setIsTerminated(true);
48
48
  await microservice.close();
49
49
  }));
@@ -61,7 +61,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
61
61
  if (!this.appOptions || !this.appOptions.cors) {
62
62
  return undefined;
63
63
  }
64
- const passCustomOptions = shared_utils_1.isObject(this.appOptions.cors) || shared_utils_1.isFunction(this.appOptions.cors);
64
+ const passCustomOptions = (0, shared_utils_1.isObject)(this.appOptions.cors) || (0, shared_utils_1.isFunction)(this.appOptions.cors);
65
65
  if (!passCustomOptions) {
66
66
  return this.enableCors();
67
67
  }
@@ -106,7 +106,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
106
106
  async registerRouter() {
107
107
  await this.registerMiddleware(this.httpAdapter);
108
108
  const prefix = this.config.getGlobalPrefix();
109
- const basePath = shared_utils_1.addLeadingSlash(prefix);
109
+ const basePath = (0, shared_utils_1.addLeadingSlash)(prefix);
110
110
  this.routesResolver.resolve(this.httpAdapter, basePath);
111
111
  }
112
112
  async registerRouterHooks() {
@@ -114,7 +114,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
114
114
  this.routesResolver.registerExceptionHandler();
115
115
  }
116
116
  connectMicroservice(microserviceOptions, hybridAppOptions = {}) {
117
- const { NestMicroservice } = load_package_util_1.loadPackage('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
117
+ const { NestMicroservice } = (0, load_package_util_1.loadPackage)('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
118
118
  const { inheritAppConfig } = hybridAppOptions;
119
119
  const applicationConfig = inheritAppConfig
120
120
  ? this.config
@@ -160,7 +160,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
160
160
  reject(e);
161
161
  };
162
162
  this.httpServer.once('error', errorHandler);
163
- const isCallbackInOriginalArgs = shared_utils_1.isFunction(args[args.length - 1]);
163
+ const isCallbackInOriginalArgs = (0, shared_utils_1.isFunction)(args[args.length - 1]);
164
164
  const listenFnArgs = isCallbackInOriginalArgs
165
165
  ? args.slice(0, args.length - 1)
166
166
  : args;
@@ -199,8 +199,8 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
199
199
  });
200
200
  }
201
201
  formatAddress(address) {
202
- if (shared_utils_1.isString(address)) {
203
- if (os_1.platform() === 'win32') {
202
+ if ((0, shared_utils_1.isString)(address)) {
203
+ if ((0, os_1.platform)() === 'win32') {
204
204
  return address;
205
205
  }
206
206
  const basePath = encodeURIComponent(address);
@@ -224,15 +224,15 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
224
224
  this.config.setGlobalPrefix(prefix);
225
225
  if (options) {
226
226
  const exclude = options === null || options === void 0 ? void 0 : options.exclude.map((route) => {
227
- if (shared_utils_1.isString(route)) {
227
+ if ((0, shared_utils_1.isString)(route)) {
228
228
  return {
229
229
  requestMethod: common_1.RequestMethod.ALL,
230
- pathRegex: pathToRegexp(shared_utils_1.addLeadingSlash(route)),
230
+ pathRegex: pathToRegexp((0, shared_utils_1.addLeadingSlash)(route)),
231
231
  };
232
232
  }
233
233
  return {
234
234
  requestMethod: route.method,
235
- pathRegex: pathToRegexp(shared_utils_1.addLeadingSlash(route.path)),
235
+ pathRegex: pathToRegexp((0, shared_utils_1.addLeadingSlash)(route.path)),
236
236
  };
237
237
  });
238
238
  this.config.setGlobalPrefixOptions(Object.assign(Object.assign({}, options), { exclude }));
@@ -275,7 +275,7 @@ class NestApplication extends nest_application_context_1.NestApplicationContext
275
275
  }
276
276
  host() {
277
277
  const address = this.httpServer.address();
278
- if (shared_utils_1.isString(address)) {
278
+ if ((0, shared_utils_1.isString)(address)) {
279
279
  return undefined;
280
280
  }
281
281
  return address && address.address;
package/nest-factory.js CHANGED
@@ -49,7 +49,7 @@ class NestFactoryStatic {
49
49
  * contains a reference to the NestMicroservice instance.
50
50
  */
51
51
  async createMicroservice(module, options) {
52
- const { NestMicroservice } = load_package_util_1.loadPackage('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
52
+ const { NestMicroservice } = (0, load_package_util_1.loadPackage)('@nestjs/microservices', 'NestFactory', () => require('@nestjs/microservices'));
53
53
  const applicationConfig = new application_config_1.ApplicationConfig();
54
54
  const container = new container_1.NestContainer(applicationConfig);
55
55
  this.setAbortOnError(options);
@@ -105,7 +105,7 @@ class NestFactoryStatic {
105
105
  if (this.abortOnError) {
106
106
  process.abort();
107
107
  }
108
- rethrow_1.rethrow(err);
108
+ (0, rethrow_1.rethrow)(err);
109
109
  }
110
110
  createProxy(target) {
111
111
  const proxy = this.createExceptionProxy();
@@ -119,7 +119,7 @@ class NestFactoryStatic {
119
119
  if (!(prop in receiver)) {
120
120
  return;
121
121
  }
122
- if (shared_utils_1.isFunction(receiver[prop])) {
122
+ if ((0, shared_utils_1.isFunction)(receiver[prop])) {
123
123
  return this.createExceptionZone(receiver, prop);
124
124
  }
125
125
  return receiver[prop];
@@ -140,7 +140,7 @@ class NestFactoryStatic {
140
140
  return;
141
141
  }
142
142
  const { logger, bufferLogs, autoFlushLogs } = options;
143
- if (logger !== true && !shared_utils_1.isNil(logger)) {
143
+ if (logger !== true && !(0, shared_utils_1.isNil)(logger)) {
144
144
  logger_service_1.Logger.overrideLogger(logger);
145
145
  }
146
146
  if (bufferLogs) {
@@ -149,7 +149,7 @@ class NestFactoryStatic {
149
149
  this.autoFlushLogs = autoFlushLogs !== null && autoFlushLogs !== void 0 ? autoFlushLogs : true;
150
150
  }
151
151
  createHttpAdapter(httpServer) {
152
- const { ExpressAdapter } = load_adapter_1.loadAdapter('@nestjs/platform-express', 'HTTP', () => require('@nestjs/platform-express'));
152
+ const { ExpressAdapter } = (0, load_adapter_1.loadAdapter)('@nestjs/platform-express', 'HTTP', () => require('@nestjs/platform-express'));
153
153
  return new ExpressAdapter(httpServer);
154
154
  }
155
155
  isHttpServer(serverOrOptions) {
@@ -176,7 +176,7 @@ class NestFactoryStatic {
176
176
  return mapToProxy(result);
177
177
  };
178
178
  }
179
- if (shared_utils_1.isFunction(receiver[prop])) {
179
+ if ((0, shared_utils_1.isFunction)(receiver[prop])) {
180
180
  return (...args) => {
181
181
  const result = receiver[prop](...args);
182
182
  return mapToProxy(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -36,7 +36,7 @@
36
36
  "uuid": "8.3.2"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/common": "8.4.0"
39
+ "@nestjs/common": "8.4.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@nestjs/common": "^8.0.0",
@@ -17,13 +17,13 @@ class PipesContextCreator extends context_creator_1.ContextCreator {
17
17
  return this.createContext(instance, callback, constants_1.PIPES_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((pipe) => pipe && (pipe.name || pipe.transform))
25
25
  .map(pipe => this.getPipeInstance(pipe, contextId, inquirerId))
26
- .filter(pipe => pipe && pipe.transform && shared_utils_1.isFunction(pipe.transform))
26
+ .filter(pipe => pipe && pipe.transform && (0, shared_utils_1.isFunction)(pipe.transform))
27
27
  .toArray();
28
28
  }
29
29
  getPipeInstance(pipe, contextId = constants_2.STATIC_CONTEXT, inquirerId) {
@@ -58,7 +58,7 @@ class PipesContextCreator extends context_creator_1.ContextCreator {
58
58
  return globalPipes;
59
59
  }
60
60
  const scopedPipeWrappers = this.config.getGlobalRequestPipes();
61
- const scopedPipes = iterare_1.iterate(scopedPipeWrappers)
61
+ const scopedPipes = (0, iterare_1.iterate)(scopedPipeWrappers)
62
62
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
63
63
  .filter(host => !!host)
64
64
  .map(host => host.instance)
@@ -16,7 +16,7 @@ class RoutePathFactory {
16
16
  ((_a = metadata.versioningOptions) === null || _a === void 0 ? void 0 : _a.type) === common_1.VersioningType.URI) {
17
17
  const versionPrefix = this.getVersionPrefix(metadata.versioningOptions);
18
18
  if (Array.isArray(versionOrVersions)) {
19
- paths = common_1.flatten(paths.map(path => versionOrVersions.map(version =>
19
+ paths = (0, common_1.flatten)(paths.map(path => versionOrVersions.map(version =>
20
20
  // Version Neutral - Do not include version in URL
21
21
  version === common_1.VERSION_NEUTRAL
22
22
  ? path
@@ -37,12 +37,12 @@ class RoutePathFactory {
37
37
  if (this.isExcludedFromGlobalPrefix(path, requestMethod)) {
38
38
  return path;
39
39
  }
40
- return shared_utils_1.stripEndSlash(metadata.globalPrefix || '') + path;
40
+ return (0, shared_utils_1.stripEndSlash)(metadata.globalPrefix || '') + path;
41
41
  });
42
42
  }
43
43
  return paths
44
- .map(path => shared_utils_1.addLeadingSlash(path || '/'))
45
- .map(path => (path !== '/' ? shared_utils_1.stripEndSlash(path) : path));
44
+ .map(path => (0, shared_utils_1.addLeadingSlash)(path || '/'))
45
+ .map(path => (path !== '/' ? (0, shared_utils_1.stripEndSlash)(path) : path));
46
46
  }
47
47
  getVersion(metadata) {
48
48
  // The version will be either the path version or the controller version,
@@ -65,21 +65,21 @@ class RoutePathFactory {
65
65
  if (!fragmentToAppend) {
66
66
  return paths;
67
67
  }
68
- const concatPaths = (a, b) => shared_utils_1.stripEndSlash(a) + shared_utils_1.addLeadingSlash(b);
68
+ const concatPaths = (a, b) => (0, shared_utils_1.stripEndSlash)(a) + (0, shared_utils_1.addLeadingSlash)(b);
69
69
  if (Array.isArray(fragmentToAppend)) {
70
70
  const paths2dArray = paths.map(path => fragmentToAppend.map(fragment => concatPaths(path, fragment)));
71
- return common_1.flatten(paths2dArray);
71
+ return (0, common_1.flatten)(paths2dArray);
72
72
  }
73
73
  return paths.map(path => concatPaths(path, fragmentToAppend));
74
74
  }
75
75
  isExcludedFromGlobalPrefix(path, requestMethod) {
76
- if (shared_utils_1.isUndefined(requestMethod)) {
76
+ if ((0, shared_utils_1.isUndefined)(requestMethod)) {
77
77
  return false;
78
78
  }
79
79
  const options = this.applicationConfig.getGlobalPrefixOptions();
80
80
  const excludedRoutes = options.exclude;
81
81
  return (Array.isArray(excludedRoutes) &&
82
- utils_1.isRouteExcluded(excludedRoutes, path, requestMethod));
82
+ (0, utils_1.isRouteExcluded)(excludedRoutes, path, requestMethod));
83
83
  }
84
84
  }
85
85
  exports.RoutePathFactory = RoutePathFactory;
@@ -17,7 +17,7 @@ class RouterExceptionFilters extends base_exception_filter_context_1.BaseExcepti
17
17
  this.moduleContext = moduleKey;
18
18
  const exceptionHandler = new exceptions_handler_1.ExceptionsHandler(this.applicationRef);
19
19
  const filters = this.createContext(instance, callback, constants_1.EXCEPTION_FILTERS_METADATA, contextId, inquirerId);
20
- if (shared_utils_1.isEmpty(filters)) {
20
+ if ((0, shared_utils_1.isEmpty)(filters)) {
21
21
  return exceptionHandler;
22
22
  }
23
23
  exceptionHandler.setCustomFilters(filters.reverse());
@@ -29,7 +29,7 @@ class RouterExceptionFilters extends base_exception_filter_context_1.BaseExcepti
29
29
  return globalFilters;
30
30
  }
31
31
  const scopedFilterWrappers = this.config.getGlobalRequestFilters();
32
- const scopedFilters = iterare_1.iterate(scopedFilterWrappers)
32
+ const scopedFilters = (0, iterare_1.iterate)(scopedFilterWrappers)
33
33
  .map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
34
34
  .filter(host => !!host)
35
35
  .map(host => host.instance)
@@ -67,7 +67,7 @@ class RouterExecutionContext {
67
67
  ? httpCode
68
68
  : this.responseController.getStatusByMethod(requestMethod);
69
69
  const responseHeaders = this.reflectResponseHeaders(callback);
70
- const hasCustomHeaders = !shared_utils_1.isEmpty(responseHeaders);
70
+ const hasCustomHeaders = !(0, shared_utils_1.isEmpty)(responseHeaders);
71
71
  const handlerMetadata = {
72
72
  argsLength,
73
73
  fnHandleResponse,
@@ -116,7 +116,7 @@ class RouterExecutionContext {
116
116
  });
117
117
  }
118
118
  async getParamValue(value, { metatype, type, data, }, pipes) {
119
- if (!shared_utils_1.isEmpty(pipes)) {
119
+ if (!(0, shared_utils_1.isEmpty)(pipes)) {
120
120
  return this.pipesConsumer.apply(value, { metatype, type, data }, pipes);
121
121
  }
122
122
  return value;
@@ -127,7 +127,7 @@ class RouterExecutionContext {
127
127
  type === route_paramtypes_enum_1.RouteParamtypes.PARAM ||
128
128
  type === route_paramtypes_enum_1.RouteParamtypes.FILE ||
129
129
  type === route_paramtypes_enum_1.RouteParamtypes.FILES ||
130
- shared_utils_1.isString(type));
130
+ (0, shared_utils_1.isString)(type));
131
131
  }
132
132
  createGuardsFn(guards, instance, callback, contextType) {
133
133
  const canActivateFn = async (args) => {
@@ -158,7 +158,7 @@ class RouterExecutionContext {
158
158
  return await this.responseController.render(result, res, renderTemplate);
159
159
  };
160
160
  }
161
- if (redirectResponse && shared_utils_1.isString(redirectResponse.url)) {
161
+ if (redirectResponse && (0, shared_utils_1.isString)(redirectResponse.url)) {
162
162
  return async (result, res) => {
163
163
  await this.responseController.redirect(result, res, redirectResponse);
164
164
  };
@@ -53,16 +53,16 @@ class RouterExplorer {
53
53
  }
54
54
  extractRouterPath(metatype) {
55
55
  const path = Reflect.getMetadata(constants_1.PATH_METADATA, metatype);
56
- if (shared_utils_1.isUndefined(path)) {
56
+ if ((0, shared_utils_1.isUndefined)(path)) {
57
57
  throw new unknown_request_mapping_exception_1.UnknownRequestMappingException();
58
58
  }
59
59
  if (Array.isArray(path)) {
60
- return path.map(p => shared_utils_1.addLeadingSlash(p));
60
+ return path.map(p => (0, shared_utils_1.addLeadingSlash)(p));
61
61
  }
62
- return [shared_utils_1.addLeadingSlash(path)];
62
+ return [(0, shared_utils_1.addLeadingSlash)(path)];
63
63
  }
64
64
  scanForPaths(instance, prototype) {
65
- const instancePrototype = shared_utils_1.isUndefined(prototype)
65
+ const instancePrototype = (0, shared_utils_1.isUndefined)(prototype)
66
66
  ? Object.getPrototypeOf(instance)
67
67
  : prototype;
68
68
  return this.metadataScanner.scanFromPrototype(instance, instancePrototype, method => this.exploreMethodMetadata(instance, instancePrototype, method));
@@ -71,14 +71,14 @@ class RouterExplorer {
71
71
  const instanceCallback = instance[methodName];
72
72
  const prototypeCallback = prototype[methodName];
73
73
  const routePath = Reflect.getMetadata(constants_1.PATH_METADATA, prototypeCallback);
74
- if (shared_utils_1.isUndefined(routePath)) {
74
+ if ((0, shared_utils_1.isUndefined)(routePath)) {
75
75
  return null;
76
76
  }
77
77
  const requestMethod = Reflect.getMetadata(constants_1.METHOD_METADATA, prototypeCallback);
78
78
  const version = Reflect.getMetadata(constants_1.VERSION_METADATA, prototypeCallback);
79
- const path = shared_utils_1.isString(routePath)
80
- ? [shared_utils_1.addLeadingSlash(routePath)]
81
- : routePath.map((p) => shared_utils_1.addLeadingSlash(p));
79
+ const path = (0, shared_utils_1.isString)(routePath)
80
+ ? [(0, shared_utils_1.addLeadingSlash)(routePath)]
81
+ : routePath.map((p) => (0, shared_utils_1.addLeadingSlash)(p));
82
82
  return {
83
83
  path,
84
84
  requestMethod,
@@ -121,10 +121,10 @@ class RouterExplorer {
121
121
  pathsToLog.forEach(path => {
122
122
  if (isVersioned) {
123
123
  const version = this.routePathFactory.getVersion(routePathMetadata);
124
- this.logger.log(messages_1.VERSIONED_ROUTE_MAPPED_MESSAGE(path, requestMethod, version));
124
+ this.logger.log((0, messages_1.VERSIONED_ROUTE_MAPPED_MESSAGE)(path, requestMethod, version));
125
125
  }
126
126
  else {
127
- this.logger.log(messages_1.ROUTE_MAPPED_MESSAGE(path, requestMethod));
127
+ this.logger.log((0, messages_1.ROUTE_MAPPED_MESSAGE)(path, requestMethod));
128
128
  }
129
129
  });
130
130
  });
@@ -186,7 +186,7 @@ class RouterExplorer {
186
186
  version.filter(extractedVersion.includes).length) {
187
187
  return handler(req, res, next);
188
188
  }
189
- else if (shared_utils_1.isString(extractedVersion) &&
189
+ else if ((0, shared_utils_1.isString)(extractedVersion) &&
190
190
  version.includes(extractedVersion)) {
191
191
  return handler(req, res, next);
192
192
  }
@@ -196,7 +196,7 @@ class RouterExplorer {
196
196
  extractedVersion.includes(version)) {
197
197
  return handler(req, res, next);
198
198
  }
199
- else if (shared_utils_1.isString(extractedVersion) &&
199
+ else if ((0, shared_utils_1.isString)(extractedVersion) &&
200
200
  version === extractedVersion) {
201
201
  return handler(req, res, next);
202
202
  }
@@ -217,7 +217,7 @@ class RouterExplorer {
217
217
  return handler(req, res, next);
218
218
  }
219
219
  }
220
- else if (shared_utils_1.isString(version)) {
220
+ else if ((0, shared_utils_1.isString)(version)) {
221
221
  if (version === headerVersion) {
222
222
  return handler(req, res, next);
223
223
  }
@@ -234,7 +234,7 @@ class RouterExplorer {
234
234
  return handler(req, res, next);
235
235
  }
236
236
  }
237
- else if (shared_utils_1.isString(version)) {
237
+ else if ((0, shared_utils_1.isString)(version)) {
238
238
  if (version === customHeaderVersionParameter) {
239
239
  return handler(req, res, next);
240
240
  }
@@ -43,9 +43,9 @@ let RouterModule = RouterModule_1 = class RouterModule {
43
43
  });
44
44
  }
45
45
  initialize() {
46
- const flattenedRoutes = utils_1.flattenRoutePaths(this.routes);
46
+ const flattenedRoutes = (0, utils_1.flattenRoutePaths)(this.routes);
47
47
  flattenedRoutes.forEach(route => {
48
- const modulePath = shared_utils_1.normalizePath(route.path);
48
+ const modulePath = (0, shared_utils_1.normalizePath)(route.path);
49
49
  this.registerModulePathMetadata(route.module, modulePath);
50
50
  this.updateTargetModulesCache(route.module);
51
51
  });
@@ -70,8 +70,8 @@ let RouterModule = RouterModule_1 = class RouterModule {
70
70
  }
71
71
  };
72
72
  RouterModule = RouterModule_1 = tslib_1.__decorate([
73
- common_1.Module({}),
74
- tslib_1.__param(1, common_1.Inject(exports.ROUTES)),
73
+ (0, common_1.Module)({}),
74
+ tslib_1.__param(1, (0, common_1.Inject)(exports.ROUTES)),
75
75
  tslib_1.__metadata("design:paramtypes", [modules_container_1.ModulesContainer, Array])
76
76
  ], RouterModule);
77
77
  exports.RouterModule = RouterModule;
@@ -29,8 +29,8 @@ class RouterResponseController {
29
29
  return this.applicationRef.render(response, template, result);
30
30
  }
31
31
  async transformToResult(resultOrDeferred) {
32
- if (resultOrDeferred && shared_utils_1.isFunction(resultOrDeferred.subscribe)) {
33
- return rxjs_1.lastValueFrom(resultOrDeferred);
32
+ if (resultOrDeferred && (0, shared_utils_1.isFunction)(resultOrDeferred.subscribe)) {
33
+ return (0, rxjs_1.lastValueFrom)(resultOrDeferred);
34
34
  }
35
35
  return resultOrDeferred;
36
36
  }
@@ -57,12 +57,12 @@ class RouterResponseController {
57
57
  const stream = new sse_stream_1.SseStream(request);
58
58
  stream.pipe(response, options);
59
59
  const subscription = result
60
- .pipe(operators_1.map((message) => {
61
- if (shared_utils_1.isObject(message)) {
60
+ .pipe((0, operators_1.map)((message) => {
61
+ if ((0, shared_utils_1.isObject)(message)) {
62
62
  return message;
63
63
  }
64
64
  return { data: message };
65
- }), operators_1.debounce(message => new Promise(resolve => stream.writeMessage(message, () => resolve()))), operators_1.catchError(err => {
65
+ }), (0, operators_1.debounce)(message => new Promise(resolve => stream.writeMessage(message, () => resolve()))), (0, operators_1.catchError)(err => {
66
66
  const data = err instanceof Error ? err.message : err;
67
67
  stream.writeMessage({ type: 'error', data }, writeError => {
68
68
  if (writeError) {
@@ -81,7 +81,7 @@ class RouterResponseController {
81
81
  });
82
82
  }
83
83
  assertObservable(result) {
84
- if (!shared_utils_1.isFunction(result.subscribe)) {
84
+ if (!(0, shared_utils_1.isFunction)(result.subscribe)) {
85
85
  throw new ReferenceError('You must return an Observable stream to use Server-Sent Events (SSE).');
86
86
  }
87
87
  }
@@ -47,13 +47,13 @@ class RoutesResolver {
47
47
  });
48
48
  if (!controllerVersion) {
49
49
  pathsToLog.forEach(path => {
50
- const logMessage = messages_1.CONTROLLER_MAPPING_MESSAGE(controllerName, path);
50
+ const logMessage = (0, messages_1.CONTROLLER_MAPPING_MESSAGE)(controllerName, path);
51
51
  this.logger.log(logMessage);
52
52
  });
53
53
  }
54
54
  else {
55
55
  pathsToLog.forEach(path => {
56
- const logMessage = messages_1.VERSIONED_CONTROLLER_MAPPING_MESSAGE(controllerName, path, controllerVersion);
56
+ const logMessage = (0, messages_1.VERSIONED_CONTROLLER_MAPPING_MESSAGE)(controllerName, path, controllerVersion);
57
57
  this.logger.log(logMessage);
58
58
  });
59
59
  }
@@ -4,7 +4,7 @@ exports.SseStream = void 0;
4
4
  const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
5
5
  const stream_1 = require("stream");
6
6
  function toDataString(data) {
7
- if (shared_utils_1.isObject(data)) {
7
+ if ((0, shared_utils_1.isObject)(data)) {
8
8
  return toDataString(JSON.stringify(data));
9
9
  }
10
10
  return data
@@ -8,7 +8,7 @@ const isRequestMethodAll = (method) => {
8
8
  exports.isRequestMethodAll = isRequestMethodAll;
9
9
  function isRouteExcluded(excludedRoutes, path, requestMethod) {
10
10
  return excludedRoutes.some(route => {
11
- if (exports.isRequestMethodAll(route.requestMethod) ||
11
+ if ((0, exports.isRequestMethodAll)(route.requestMethod) ||
12
12
  route.requestMethod === requestMethod) {
13
13
  return route.pathRegex.exec(path);
14
14
  }
@@ -11,8 +11,8 @@ function flattenRoutePaths(routes) {
11
11
  if (item.children) {
12
12
  const childrenRef = item.children;
13
13
  childrenRef.forEach(child => {
14
- if (!shared_utils_1.isString(child) && child.path) {
15
- child.path = shared_utils_1.normalizePath(shared_utils_1.normalizePath(item.path) + shared_utils_1.normalizePath(child.path));
14
+ if (!(0, shared_utils_1.isString)(child) && child.path) {
15
+ child.path = (0, shared_utils_1.normalizePath)((0, shared_utils_1.normalizePath)(item.path) + (0, shared_utils_1.normalizePath)(child.path));
16
16
  }
17
17
  else {
18
18
  result.push({ path: item.path, module: child });
package/scanner.js CHANGED
@@ -146,8 +146,8 @@ class DependenciesScanner {
146
146
  }
147
147
  reflectParamInjectables(component, token, metadataKey) {
148
148
  const paramsMetadata = this.metadataScanner.scanFromPrototype(null, component.prototype, method => Reflect.getMetadata(metadataKey, component, method));
149
- const paramsInjectables = this.flatten(paramsMetadata).map((param) => common_1.flatten(Object.keys(param).map(k => param[k].pipes)).filter(shared_utils_1.isFunction));
150
- common_1.flatten(paramsInjectables).forEach((injectable) => this.insertInjectable(injectable, token, component));
149
+ const paramsInjectables = this.flatten(paramsMetadata).map((param) => (0, common_1.flatten)(Object.keys(param).map(k => param[k].pipes)).filter(shared_utils_1.isFunction));
150
+ (0, common_1.flatten)(paramsInjectables).forEach((injectable) => this.insertInjectable(injectable, token, component));
151
151
  }
152
152
  reflectKeyMetadata(component, key, method) {
153
153
  let prototype = component.prototype;
@@ -184,7 +184,7 @@ class DependenciesScanner {
184
184
  calculateDistance(rootModule);
185
185
  }
186
186
  async insertImport(related, token, context) {
187
- if (shared_utils_1.isUndefined(related)) {
187
+ if ((0, shared_utils_1.isUndefined)(related)) {
188
188
  throw new circular_dependency_exception_1.CircularDependencyException(context);
189
189
  }
190
190
  if (this.isForwardReference(related)) {
@@ -193,7 +193,7 @@ class DependenciesScanner {
193
193
  await this.container.addImport(related, token);
194
194
  }
195
195
  isCustomProvider(provider) {
196
- return provider && !shared_utils_1.isNil(provider.provide);
196
+ return provider && !(0, shared_utils_1.isNil)(provider.provide);
197
197
  }
198
198
  insertProvider(provider, token) {
199
199
  const isCustomProvider = this.isCustomProvider(provider);
@@ -206,10 +206,10 @@ class DependenciesScanner {
206
206
  if (!providersKeys.includes(type)) {
207
207
  return this.container.addProvider(provider, token);
208
208
  }
209
- const providerToken = `${type} (UUID: ${random_string_generator_util_1.randomStringGenerator()})`;
209
+ const providerToken = `${type} (UUID: ${(0, random_string_generator_util_1.randomStringGenerator)()})`;
210
210
  let scope = provider.scope;
211
- if (shared_utils_1.isNil(scope) && provider.useClass) {
212
- scope = get_class_scope_1.getClassScope(provider.useClass);
211
+ if ((0, shared_utils_1.isNil)(scope) && provider.useClass) {
212
+ scope = (0, get_class_scope_1.getClassScope)(provider.useClass);
213
213
  }
214
214
  this.applicationProvidersApplyMap.push({
215
215
  type,
@@ -246,13 +246,13 @@ class DependenciesScanner {
246
246
  * to all controllers metadata storage
247
247
  */
248
248
  addScopedEnhancersMetadata() {
249
- iterare_1.iterate(this.applicationProvidersApplyMap)
249
+ (0, iterare_1.iterate)(this.applicationProvidersApplyMap)
250
250
  .filter(wrapper => this.isRequestOrTransient(wrapper.scope))
251
251
  .forEach(({ moduleKey, providerKey }) => {
252
252
  const modulesContainer = this.container.getModules();
253
253
  const { injectables } = modulesContainer.get(moduleKey);
254
254
  const instanceWrapper = injectables.get(providerKey);
255
- iterare_1.iterate(modulesContainer.values())
255
+ (0, iterare_1.iterate)(modulesContainer.values())
256
256
  .map(module => module.controllers.values())
257
257
  .flatten()
258
258
  .forEach(controller => controller.addEnhancerMetadata(instanceWrapper));
@@ -42,14 +42,14 @@ class Reflector {
42
42
  */
43
43
  getAllAndMerge(metadataKey, targets) {
44
44
  const metadataCollection = this.getAll(metadataKey, targets).filter(item => item !== undefined);
45
- if (shared_utils_1.isEmpty(metadataCollection)) {
45
+ if ((0, shared_utils_1.isEmpty)(metadataCollection)) {
46
46
  return metadataCollection;
47
47
  }
48
48
  return metadataCollection.reduce((a, b) => {
49
49
  if (Array.isArray(a)) {
50
50
  return a.concat(b);
51
51
  }
52
- if (shared_utils_1.isObject(a) && shared_utils_1.isObject(b)) {
52
+ if ((0, shared_utils_1.isObject)(a) && (0, shared_utils_1.isObject)(b)) {
53
53
  return Object.assign(Object.assign({}, a), b);
54
54
  }
55
55
  return [a, b];