@nestjs/common 9.3.11 → 9.4.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.
@@ -1,4 +1,12 @@
1
+ /**
2
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
3
+ * @publicApi
4
+ */
1
5
  export declare const CACHE_MANAGER = "CACHE_MANAGER";
2
6
  export declare const CACHE_KEY_METADATA = "cache_module:cache_key";
3
7
  export declare const CACHE_TTL_METADATA = "cache_module:cache_ttl";
8
+ /**
9
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
10
+ * @publicApi
11
+ */
4
12
  export declare const CACHE_MODULE_OPTIONS: string | symbol;
@@ -2,7 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CACHE_MODULE_OPTIONS = exports.CACHE_TTL_METADATA = exports.CACHE_KEY_METADATA = exports.CACHE_MANAGER = void 0;
4
4
  const cache_module_definition_1 = require("./cache.module-definition");
5
+ /**
6
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
7
+ * @publicApi
8
+ */
5
9
  exports.CACHE_MANAGER = 'CACHE_MANAGER';
6
10
  exports.CACHE_KEY_METADATA = 'cache_module:cache_key';
7
11
  exports.CACHE_TTL_METADATA = 'cache_module:cache_ttl';
12
+ /**
13
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
14
+ * @publicApi
15
+ */
8
16
  exports.CACHE_MODULE_OPTIONS = cache_module_definition_1.MODULE_OPTIONS_TOKEN;
@@ -1,2 +1,2 @@
1
1
  import { CacheModuleOptions } from './interfaces/cache-module.interface';
2
- export declare const ConfigurableModuleClass: import("../module-utils").ConfigurableModuleCls<CacheModuleOptions<Record<string, any>>, "register", "createCacheOptions", {}>, MODULE_OPTIONS_TOKEN: string | symbol;
2
+ export declare const ConfigurableModuleClass: import("../module-utils").ConfigurableModuleCls<CacheModuleOptions, "register", "createCacheOptions", {}>, MODULE_OPTIONS_TOKEN: string | symbol;
@@ -5,7 +5,7 @@ import { CacheModuleAsyncOptions, CacheModuleOptions } from './interfaces/cache-
5
5
  * Module that provides Nest cache-manager.
6
6
  *
7
7
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
8
- *
8
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
9
9
  * @publicApi
10
10
  */
11
11
  export declare class CacheModule extends ConfigurableModuleClass {
@@ -10,7 +10,7 @@ const cache_providers_1 = require("./cache.providers");
10
10
  * Module that provides Nest cache-manager.
11
11
  *
12
12
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
13
- *
13
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
14
14
  * @publicApi
15
15
  */
16
16
  let CacheModule = class CacheModule extends cache_module_definition_1.ConfigurableModuleClass {
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
11
11
  *
12
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
12
13
  * @publicApi
13
14
  */
14
15
  export declare const CacheKey: (key: string) => import("../../decorators").CustomDecorator<string>;
@@ -14,6 +14,7 @@ const cache_constants_1 = require("../cache.constants");
14
14
  *
15
15
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
16
16
  *
17
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
17
18
  * @publicApi
18
19
  */
19
20
  const CacheKey = (key) => (0, decorators_1.SetMetadata)(cache_constants_1.CACHE_KEY_METADATA, key);
@@ -8,6 +8,7 @@ import { ExecutionContext } from '../../interfaces/features/execution-context.in
8
8
  *
9
9
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
10
10
  *
11
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
11
12
  * @publicApi
12
13
  */
13
14
  type CacheTTLFactory = (ctx: ExecutionContext) => Promise<number> | number;
@@ -1,11 +1,13 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { CallHandler, ExecutionContext, HttpServer, NestInterceptor } from '../../interfaces';
3
+ /** @deprecated Import from the "@nestjs/core" instead. */
3
4
  export interface HttpAdapterHost<T extends HttpServer = any> {
4
5
  httpAdapter: T;
5
6
  }
6
7
  /**
7
8
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
8
9
  *
10
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
9
11
  * @publicApi
10
12
  */
11
13
  export declare class CacheInterceptor implements NestInterceptor {
@@ -10,11 +10,14 @@ const logger_service_1 = require("../../services/logger.service");
10
10
  const load_package_util_1 = require("../../utils/load-package.util");
11
11
  const shared_utils_1 = require("../../utils/shared.utils");
12
12
  const cache_constants_1 = require("../cache.constants");
13
+ /** @deprecated */
13
14
  const HTTP_ADAPTER_HOST = 'HttpAdapterHost';
15
+ /** @deprecated */
14
16
  const REFLECTOR = 'Reflector';
15
17
  /**
16
18
  * @see [Caching](https://docs.nestjs.com/techniques/caching)
17
19
  *
20
+ * @deprecated `CacheModule` (from the `@nestjs/common` package) is deprecated and will be removed in the next major release. Please, use the `@nestjs/cache-manager` package instead
18
21
  * @publicApi
19
22
  */
20
23
  let CacheInterceptor = class CacheInterceptor {
@@ -26,6 +29,7 @@ let CacheInterceptor = class CacheInterceptor {
26
29
  // because the set method signature changed in v5
27
30
  const cacheManagerPackage = (0, load_package_util_1.loadPackage)('cache-manager', 'CacheModule', () => require('cache-manager'));
28
31
  this.cacheManagerIsv5OrGreater = 'memoryStore' in cacheManagerPackage;
32
+ logger_service_1.Logger.warn('DEPRECATED! "CacheModule" (from the "@nestjs/common" package) is deprecated and will be removed in the next major release. Please, use the "@nestjs/cache-manager" package instead.');
29
33
  }
30
34
  async intercept(context, next) {
31
35
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/common",
3
- "version": "9.3.11",
3
+ "version": "9.4.0",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@common)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "homepage": "https://nestjs.com",
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "iterare": "1.2.1",
21
21
  "tslib": "2.5.0",
22
- "uid": "2.0.1"
22
+ "uid": "2.0.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "cache-manager": "<=5",
@@ -67,10 +67,10 @@ export declare class ConsoleLogger implements LoggerService {
67
67
  protected formatPid(pid: number): string;
68
68
  protected formatContext(context: string): string;
69
69
  protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
70
- protected stringifyMessage(message: unknown, logLevel: LogLevel): string;
70
+ protected stringifyMessage(message: unknown, logLevel: LogLevel): any;
71
71
  protected colorize(message: string, logLevel: LogLevel): string;
72
72
  protected printStackTrace(stack: string): void;
73
- private updateAndGetTimestampDiff;
73
+ protected updateAndGetTimestampDiff(): string;
74
74
  protected formatTimestampDiff(timestampDiff: number): string;
75
75
  private getContextAndMessagesToPrint;
76
76
  private getContextAndStackAndMessagesToPrint;
@@ -135,9 +135,12 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
135
135
  return `${pidMessage}${this.getTimestamp()} ${formattedLogLevel} ${contextMessage}${output}${timestampDiff}\n`;
136
136
  }
137
137
  stringifyMessage(message, logLevel) {
138
- return (0, shared_utils_1.isPlainObject)(message) || Array.isArray(message)
139
- ? `${this.colorize('Object:', logLevel)}\n${JSON.stringify(message, (key, value) => typeof value === 'bigint' ? value.toString() : value, 2)}\n`
140
- : this.colorize(message, logLevel);
138
+ // If the message is a function, call it and re-resolve its value.
139
+ return (0, shared_utils_1.isFunction)(message)
140
+ ? this.stringifyMessage(message(), logLevel)
141
+ : (0, shared_utils_1.isPlainObject)(message) || Array.isArray(message)
142
+ ? `${this.colorize('Object:', logLevel)}\n${JSON.stringify(message, (key, value) => typeof value === 'bigint' ? value.toString() : value, 2)}\n`
143
+ : this.colorize(message, logLevel);
141
144
  }
142
145
  colorize(message, logLevel) {
143
146
  const color = this.getColorByLogLevel(logLevel);
@@ -120,12 +120,12 @@ export declare class Logger implements LoggerService {
120
120
  static flush(): void;
121
121
  /**
122
122
  * Attach buffer.
123
- * Turns on initialisation logs buffering.
123
+ * Turns on initialization logs buffering.
124
124
  */
125
125
  static attachBuffer(): void;
126
126
  /**
127
127
  * Detach buffer.
128
- * Turns off initialisation logs buffering.
128
+ * Turns off initialization logs buffering.
129
129
  */
130
130
  static detachBuffer(): void;
131
131
  static getTimestamp(): string;
@@ -101,14 +101,14 @@ let Logger = Logger_1 = class Logger {
101
101
  }
102
102
  /**
103
103
  * Attach buffer.
104
- * Turns on initialisation logs buffering.
104
+ * Turns on initialization logs buffering.
105
105
  */
106
106
  static attachBuffer() {
107
107
  this.isBufferAttached = true;
108
108
  }
109
109
  /**
110
110
  * Detach buffer.
111
- * Turns off initialisation logs buffering.
111
+ * Turns off initialization logs buffering.
112
112
  */
113
113
  static detachBuffer() {
114
114
  this.isBufferAttached = false;
@@ -4,7 +4,7 @@ export declare const isPlainObject: (fn: any) => fn is object;
4
4
  export declare const addLeadingSlash: (path?: string) => string;
5
5
  export declare const normalizePath: (path?: string) => string;
6
6
  export declare const stripEndSlash: (path: string) => string;
7
- export declare const isFunction: (val: any) => boolean;
7
+ export declare const isFunction: (val: any) => val is Function;
8
8
  export declare const isString: (val: any) => val is string;
9
9
  export declare const isNumber: (val: any) => val is number;
10
10
  export declare const isConstructor: (val: any) => boolean;