@nestjs/core 11.1.17 → 11.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export * from './metadata-scanner';
11
11
  export * from './middleware';
12
12
  export * from './nest-application';
13
13
  export * from './nest-application-context';
14
- export { NestFactory } from './nest-factory';
14
+ export { IEntryNestModule, NestFactory } from './nest-factory';
15
15
  export * from './repl';
16
16
  export * from './router';
17
17
  export * from './services';
@@ -210,7 +210,7 @@ class Injector {
210
210
  ];
211
211
  const selfParams = this.reflectSelfParams(type);
212
212
  selfParams.forEach(({ index, param }) => (paramtypes[index] = param));
213
- return paramtypes;
213
+ return Array.from(paramtypes);
214
214
  }
215
215
  reflectOptionalParams(type) {
216
216
  return Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, type) || [];
@@ -5,6 +5,7 @@ const common_1 = require("@nestjs/common");
5
5
  const get_class_scope_1 = require("../helpers/get-class-scope");
6
6
  const is_durable_1 = require("../helpers/is-durable");
7
7
  const abstract_instance_resolver_1 = require("./abstract-instance-resolver");
8
+ const constants_1 = require("./constants");
8
9
  const injector_1 = require("./injector");
9
10
  const instance_links_host_1 = require("./instance-links-host");
10
11
  const instance_wrapper_1 = require("./instance-wrapper");
@@ -46,16 +47,23 @@ class ModuleRef extends abstract_instance_resolver_1.AbstractInstanceResolver {
46
47
  durable: (0, is_durable_1.isDurable)(type),
47
48
  host: moduleRef,
48
49
  });
50
+ if (type?.prototype) {
51
+ wrapper.setInstanceByContextId(contextId ?? constants_1.STATIC_CONTEXT, {
52
+ instance: Object.create(type.prototype),
53
+ isResolved: false,
54
+ isPending: false,
55
+ });
56
+ }
49
57
  /* eslint-disable-next-line no-async-promise-executor */
50
58
  return new Promise(async (resolve, reject) => {
51
59
  try {
52
60
  const callback = async (instances) => {
53
- const properties = await this.injector.resolveProperties(wrapper, moduleRef, undefined, contextId);
61
+ const properties = await this.injector.resolveProperties(wrapper, moduleRef, undefined, contextId, wrapper);
54
62
  const instance = new type(...instances);
55
63
  this.injector.applyProperties(instance, properties);
56
64
  resolve(instance);
57
65
  };
58
- await this.injector.resolveConstructorParams(wrapper, moduleRef, undefined, callback, contextId);
66
+ await this.injector.resolveConstructorParams(wrapper, moduleRef, undefined, callback, contextId, wrapper);
59
67
  }
60
68
  catch (err) {
61
69
  reject(err);
package/nest-factory.d.ts CHANGED
@@ -3,7 +3,12 @@ import { NestMicroserviceOptions } from '@nestjs/common/interfaces/microservices
3
3
  import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface';
4
4
  import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
5
5
  import { AbstractHttpAdapter } from './adapters/http-adapter';
6
- type IEntryNestModule = Type<any> | DynamicModule | ForwardReference | Promise<IEntryNestModule>;
6
+ /**
7
+ * Represents the entry (root) module type accepted by the NestFactory methods.
8
+ *
9
+ * @publicApi
10
+ */
11
+ export type IEntryNestModule = Type<any> | DynamicModule | ForwardReference | Promise<IEntryNestModule>;
7
12
  /**
8
13
  * @publicApi
9
14
  */
@@ -80,4 +85,3 @@ export declare class NestFactoryStatic {
80
85
  * @publicApi
81
86
  */
82
87
  export declare const NestFactory: NestFactoryStatic;
83
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/core",
3
- "version": "11.1.17",
3
+ "version": "11.1.19",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@core)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -34,12 +34,12 @@
34
34
  "@nuxt/opencollective": "0.4.1",
35
35
  "fast-safe-stringify": "2.1.1",
36
36
  "iterare": "1.2.1",
37
- "path-to-regexp": "8.3.0",
37
+ "path-to-regexp": "8.4.2",
38
38
  "tslib": "2.8.1",
39
39
  "uid": "2.0.2"
40
40
  },
41
41
  "devDependencies": {
42
- "@nestjs/common": "11.1.17"
42
+ "@nestjs/common": "11.1.19"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@nestjs/common": "^11.0.0",
@@ -60,5 +60,5 @@
60
60
  "optional": true
61
61
  }
62
62
  },
63
- "gitHead": "447a373ebebd2c58b5b3c8d718f25922a025f2fe"
63
+ "gitHead": "67309956821c0626c050fe6725c90645d2577e3d"
64
64
  }
@@ -56,9 +56,10 @@ class SseStream extends stream_1.Transform {
56
56
  return super.pipe(destination, options);
57
57
  }
58
58
  _transform(message, encoding, callback) {
59
- let data = message.type ? `event: ${message.type}\n` : '';
60
- data += message.id ? `id: ${message.id}\n` : '';
61
- data += message.retry ? `retry: ${message.retry}\n` : '';
59
+ const sanitize = (val) => String(val).replace(/[\r\n]/g, '');
60
+ let data = message.type ? `event: ${sanitize(message.type)}\n` : '';
61
+ data += message.id ? `id: ${sanitize(message.id)}\n` : '';
62
+ data += message.retry ? `retry: ${sanitize(message.retry)}\n` : '';
62
63
  data += message.data ? toDataString(message.data) : '';
63
64
  data += '\n';
64
65
  this.push(data);