@nestjs/common 11.1.2 → 11.1.4
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/decorators/core/dependencies.decorator.js +3 -1
- package/file-stream/interfaces/streamable-options.interface.d.ts +1 -1
- package/file-stream/streamable-file.d.ts +1 -1
- package/interfaces/microservices/nest-hybrid-application-options.interface.d.ts +1 -0
- package/interfaces/nest-application-context-options.interface.d.ts +13 -0
- package/package.json +1 -1
- package/services/console-logger.service.d.ts +14 -1
- package/services/console-logger.service.js +8 -4
|
@@ -5,7 +5,9 @@ exports.flatten = flatten;
|
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
6
|
function flatten(arr) {
|
|
7
7
|
const flat = [].concat(...arr);
|
|
8
|
-
return flat.some(Array.isArray)
|
|
8
|
+
return flat.some(Array.isArray)
|
|
9
|
+
? flatten(flat)
|
|
10
|
+
: flat;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
|
|
@@ -14,7 +14,7 @@ export interface StreamableFileOptions {
|
|
|
14
14
|
/**
|
|
15
15
|
* The value that will be used for the `Content-Disposition` response header.
|
|
16
16
|
*/
|
|
17
|
-
disposition?: string;
|
|
17
|
+
disposition?: string | string[];
|
|
18
18
|
/**
|
|
19
19
|
* The value that will be used for the `Content-Length` response header.
|
|
20
20
|
*/
|
|
@@ -17,7 +17,7 @@ export declare class StreamableFile {
|
|
|
17
17
|
getStream(): Readable;
|
|
18
18
|
getHeaders(): {
|
|
19
19
|
type: string;
|
|
20
|
-
disposition: string | undefined;
|
|
20
|
+
disposition: string | string[] | undefined;
|
|
21
21
|
length: number | undefined;
|
|
22
22
|
};
|
|
23
23
|
get errorHandler(): (err: Error, response: StreamableHandlerResponse) => void;
|
|
@@ -46,4 +46,17 @@ export declare class NestApplicationContextOptions {
|
|
|
46
46
|
* @default 'reference'
|
|
47
47
|
*/
|
|
48
48
|
moduleIdGeneratorAlgorithm?: 'deep-hash' | 'reference';
|
|
49
|
+
/**
|
|
50
|
+
* Instrument the application context.
|
|
51
|
+
* This option allows you to add custom instrumentation to the application context.
|
|
52
|
+
*/
|
|
53
|
+
instrument?: {
|
|
54
|
+
/**
|
|
55
|
+
* Function that decorates each instance created by the application context.
|
|
56
|
+
* This function can be used to add custom properties or methods to the instance.
|
|
57
|
+
* @param instance The instance to decorate.
|
|
58
|
+
* @returns The decorated instance.
|
|
59
|
+
*/
|
|
60
|
+
instanceDecorator: (instance: unknown) => unknown;
|
|
61
|
+
};
|
|
49
62
|
}
|
package/package.json
CHANGED
|
@@ -59,7 +59,7 @@ export interface ConsoleLoggerOptions {
|
|
|
59
59
|
*/
|
|
60
60
|
sorted?: boolean | ((a: string, b: string) => number);
|
|
61
61
|
/**
|
|
62
|
-
* Specifies the number of times to recurse while formatting object.
|
|
62
|
+
* Specifies the number of times to recurse while formatting object.
|
|
63
63
|
* This is useful for inspecting large objects. To recurse up to the maximum call stack size pass Infinity or null.
|
|
64
64
|
* Ignored when `json` is enabled, colors are disabled, and `compact` is set to true as it produces a parseable JSON output.
|
|
65
65
|
* @default 5
|
|
@@ -166,6 +166,19 @@ export declare class ConsoleLogger implements LoggerService {
|
|
|
166
166
|
writeStreamType?: 'stdout' | 'stderr';
|
|
167
167
|
errorStack?: unknown;
|
|
168
168
|
}): void;
|
|
169
|
+
protected getJsonLogObject(message: unknown, options: {
|
|
170
|
+
context: string;
|
|
171
|
+
logLevel: LogLevel;
|
|
172
|
+
writeStreamType?: 'stdout' | 'stderr';
|
|
173
|
+
errorStack?: unknown;
|
|
174
|
+
}): {
|
|
175
|
+
level: LogLevel;
|
|
176
|
+
pid: number;
|
|
177
|
+
timestamp: number;
|
|
178
|
+
message: unknown;
|
|
179
|
+
context?: string;
|
|
180
|
+
stack?: unknown;
|
|
181
|
+
};
|
|
169
182
|
protected formatPid(pid: number): string;
|
|
170
183
|
protected formatContext(context: string): string;
|
|
171
184
|
protected formatMessage(logLevel: LogLevel, message: unknown, pidMessage: string, formattedLogLevel: string, contextMessage: string, timestampDiff: string): string;
|
|
@@ -155,6 +155,13 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
printAsJson(message, options) {
|
|
158
|
+
const logObject = this.getJsonLogObject(message, options);
|
|
159
|
+
const formattedMessage = !this.options.colors && this.inspectOptions.compact === true
|
|
160
|
+
? JSON.stringify(logObject, this.stringifyReplacer)
|
|
161
|
+
: (0, util_1.inspect)(logObject, this.inspectOptions);
|
|
162
|
+
process[options.writeStreamType ?? 'stdout'].write(`${formattedMessage}\n`);
|
|
163
|
+
}
|
|
164
|
+
getJsonLogObject(message, options) {
|
|
158
165
|
const logObject = {
|
|
159
166
|
level: options.logLevel,
|
|
160
167
|
pid: process.pid,
|
|
@@ -167,10 +174,7 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
167
174
|
if (options.errorStack) {
|
|
168
175
|
logObject.stack = options.errorStack;
|
|
169
176
|
}
|
|
170
|
-
|
|
171
|
-
? JSON.stringify(logObject, this.stringifyReplacer)
|
|
172
|
-
: (0, util_1.inspect)(logObject, this.inspectOptions);
|
|
173
|
-
process[options.writeStreamType ?? 'stdout'].write(`${formattedMessage}\n`);
|
|
177
|
+
return logObject;
|
|
174
178
|
}
|
|
175
179
|
formatPid(pid) {
|
|
176
180
|
return `[${this.options.prefix}] ${pid} - `;
|