@nestjs/core 9.3.8 → 9.3.9

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.
@@ -20,7 +20,7 @@ const getInstanceName = (instance) => {
20
20
  * Returns the name of the dependency
21
21
  * Tries to get the class name, otherwise the string value
22
22
  * (= injection token). As fallback it returns '+'
23
- * @param dependency The dependency whichs name should get displayed
23
+ * @param dependency The name of the dependency to be displayed
24
24
  */
25
25
  const getDependencyName = (dependency) =>
26
26
  // use class name
@@ -2,11 +2,11 @@ import { InstanceWrapper } from '../instance-wrapper';
2
2
  import { InstanceToken } from '../module';
3
3
  /**
4
4
  * Returns the instances which are transient
5
- * @param instances The instances which should be checked whether they are transcient
5
+ * @param instances The instances which should be checked whether they are transient
6
6
  */
7
7
  export declare function getTransientInstances(instances: [InstanceToken, InstanceWrapper][]): InstanceWrapper[];
8
8
  /**
9
9
  * Returns the instances which are not transient
10
- * @param instances The instances which should be checked whether they are transcient
10
+ * @param instances The instances which should be checked whether they are transient
11
11
  */
12
12
  export declare function getNonTransientInstances(instances: [InstanceToken, InstanceWrapper][]): InstanceWrapper[];
@@ -4,7 +4,7 @@ exports.getNonTransientInstances = exports.getTransientInstances = void 0;
4
4
  const iterare_1 = require("iterare");
5
5
  /**
6
6
  * Returns the instances which are transient
7
- * @param instances The instances which should be checked whether they are transcient
7
+ * @param instances The instances which should be checked whether they are transient
8
8
  */
9
9
  function getTransientInstances(instances) {
10
10
  return (0, iterare_1.iterate)(instances)
@@ -18,7 +18,7 @@ function getTransientInstances(instances) {
18
18
  exports.getTransientInstances = getTransientInstances;
19
19
  /**
20
20
  * Returns the instances which are not transient
21
- * @param instances The instances which should be checked whether they are transcient
21
+ * @param instances The instances which should be checked whether they are transient
22
22
  */
23
23
  function getNonTransientInstances(instances) {
24
24
  return (0, iterare_1.iterate)(instances)
@@ -83,4 +83,5 @@ export declare class Injector {
83
83
  private printFoundInModuleLog;
84
84
  private isDebugMode;
85
85
  private getContextId;
86
+ private getNowTimestamp;
86
87
  }
@@ -6,6 +6,7 @@ const constants_1 = require("@nestjs/common/constants");
6
6
  const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
7
7
  const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
8
8
  const iterare_1 = require("iterare");
9
+ const perf_hooks_1 = require("perf_hooks");
9
10
  const runtime_exception_1 = require("../errors/exceptions/runtime.exception");
10
11
  const undefined_dependency_exception_1 = require("../errors/exceptions/undefined-dependency.exception");
11
12
  const unknown_dependencies_exception_1 = require("../errors/exceptions/unknown-dependencies.exception");
@@ -49,10 +50,12 @@ class Injector {
49
50
  return done();
50
51
  }
51
52
  try {
53
+ const t0 = this.getNowTimestamp();
52
54
  const callback = async (instances) => {
53
55
  const properties = await this.resolveProperties(wrapper, moduleRef, inject, contextId, wrapper, inquirer);
54
56
  const instance = await this.instantiateClass(instances, wrapper, targetWrapper, contextId, inquirer);
55
57
  this.applyProperties(instance, properties);
58
+ wrapper.initTime = this.getNowTimestamp() - t0;
56
59
  done();
57
60
  };
58
61
  await this.resolveConstructorParams(wrapper, moduleRef, inject, callback, contextId, wrapper, inquirer);
@@ -454,5 +457,8 @@ class Injector {
454
457
  })
455
458
  : contextId;
456
459
  }
460
+ getNowTimestamp() {
461
+ return perf_hooks_1.performance.now();
462
+ }
457
463
  }
458
464
  exports.Injector = Injector;
@@ -41,6 +41,7 @@ export declare class InstanceWrapper<T = any> {
41
41
  inject?: FactoryProvider['inject'];
42
42
  forwardRef?: boolean;
43
43
  durable?: boolean;
44
+ initTime?: number;
44
45
  private static logger;
45
46
  private readonly values;
46
47
  private readonly [INSTANCE_METADATA_SYMBOL];
@@ -55,6 +55,7 @@ class GraphInspector {
55
55
  exported: moduleRef.exports.has(wrapper.token),
56
56
  token: wrapper.token,
57
57
  subtype: wrapper.subtype,
58
+ initTime: wrapper.initTime,
58
59
  },
59
60
  });
60
61
  }
@@ -20,6 +20,7 @@ export type ClassNode = {
20
20
  exported: boolean;
21
21
  scope: Scope;
22
22
  token: InjectionToken;
23
+ initTime: number;
23
24
  /**
24
25
  * Enhancers metadata collection
25
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "9.3.8",
3
+ "version": "9.3.9",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "uid": "2.0.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@nestjs/common": "9.3.8"
38
+ "@nestjs/common": "9.3.9"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@nestjs/common": "^9.0.0",
@@ -76,14 +76,14 @@ class ReplContext {
76
76
  const nativeFunction = new NativeFunctionRef(this);
77
77
  const nativeFunctions = [nativeFunction];
78
78
  this.nativeFunctions.set(nativeFunction.fnDefinition.name, nativeFunction);
79
- (_a = nativeFunction.fnDefinition.aliases) === null || _a === void 0 ? void 0 : _a.forEach(aliaseName => {
79
+ (_a = nativeFunction.fnDefinition.aliases) === null || _a === void 0 ? void 0 : _a.forEach(aliasName => {
80
80
  const aliasNativeFunction = Object.create(nativeFunction);
81
81
  aliasNativeFunction.fnDefinition = {
82
- name: aliaseName,
82
+ name: aliasName,
83
83
  description: aliasNativeFunction.fnDefinition.description,
84
84
  signature: aliasNativeFunction.fnDefinition.signature,
85
85
  };
86
- this.nativeFunctions.set(aliaseName, aliasNativeFunction);
86
+ this.nativeFunctions.set(aliasName, aliasNativeFunction);
87
87
  nativeFunctions.push(aliasNativeFunction);
88
88
  });
89
89
  return nativeFunctions;