@nestjs/common 11.1.0 → 11.1.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.
- package/Readme.md +0 -2
- package/module-utils/interfaces/configurable-module-async-options.interface.d.ts +1 -1
- package/package.json +4 -4
- package/services/console-logger.service.d.ts +6 -0
- package/services/console-logger.service.js +5 -2
- package/services/index.d.ts +1 -0
- package/services/index.js +1 -0
- package/services/logger.service.d.ts +2 -1
- package/services/logger.service.js +9 -1
- package/services/utils/filter-log-levels.util.d.ts +5 -0
- package/services/utils/filter-log-levels.util.js +23 -0
- package/services/utils/index.d.ts +2 -0
- package/services/utils/index.js +2 -0
- package/services/utils/is-log-level.util.d.ts +5 -0
- package/services/utils/is-log-level.util.js +10 -0
package/Readme.md
CHANGED
|
@@ -62,9 +62,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
62
62
|
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
|
|
63
63
|
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/logos/microsoft-logo.png" width="180" valign="middle" /></a></td>
|
|
64
64
|
<td><a href="https://mojam.co" target="_blank"><img src="https://nestjs.com/img/logos/mojam-logo.png" width="80" valign="middle" /></a></td>
|
|
65
|
-
<td><a href="https://marblism.com?utm_source=nest" target="_blank"><img src="https://nestjs.com/img/logos/marblism-logo.png" width="180" valign="middle" /></a></td>
|
|
66
65
|
<td><a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td>
|
|
67
|
-
<td><a href="https://amplication.com/" target="_blank"><img src="https://nestjs.com/img/logos/amplication-logo.svg" width="190" valign="middle" /></a></td>
|
|
68
66
|
</tr>
|
|
69
67
|
</table>
|
|
70
68
|
|
|
@@ -26,7 +26,7 @@ export interface ConfigurableModuleAsyncOptions<ModuleOptions, FactoryClassMetho
|
|
|
26
26
|
useClass?: Type<ConfigurableModuleOptionsFactory<ModuleOptions, FactoryClassMethodKey>>;
|
|
27
27
|
/**
|
|
28
28
|
* Function returning options (or a Promise resolving to options) to configure the
|
|
29
|
-
*
|
|
29
|
+
* module.
|
|
30
30
|
*/
|
|
31
31
|
useFactory?: (...args: any[]) => Promise<ModuleOptions> | ModuleOptions;
|
|
32
32
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/common",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"homepage": "https://nestjs.com",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"file-type": "20.
|
|
21
|
+
"file-type": "20.5.0",
|
|
22
22
|
"iterare": "1.2.1",
|
|
23
23
|
"load-esm": "1.0.2",
|
|
24
24
|
"tslib": "2.8.1",
|
|
25
25
|
"uid": "2.0.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"class-transformer": "
|
|
29
|
-
"class-validator": "
|
|
28
|
+
"class-transformer": ">=0.4.1",
|
|
29
|
+
"class-validator": ">=0.13.2",
|
|
30
30
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
31
31
|
"rxjs": "^7.1.0"
|
|
32
32
|
},
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { InspectOptions } from 'util';
|
|
2
2
|
import { LoggerService, LogLevel } from './logger.service';
|
|
3
|
+
/**
|
|
4
|
+
* @publicApi
|
|
5
|
+
*/
|
|
3
6
|
export interface ConsoleLoggerOptions {
|
|
4
7
|
/**
|
|
5
8
|
* Enabled log levels.
|
|
@@ -75,6 +78,9 @@ export interface ConsoleLoggerOptions {
|
|
|
75
78
|
*/
|
|
76
79
|
breakLength?: number;
|
|
77
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* @publicApi
|
|
83
|
+
*/
|
|
78
84
|
export declare class ConsoleLogger implements LoggerService {
|
|
79
85
|
/**
|
|
80
86
|
* The options of the logger.
|
|
@@ -7,7 +7,7 @@ const util_1 = require("util");
|
|
|
7
7
|
const core_1 = require("../decorators/core");
|
|
8
8
|
const cli_colors_util_1 = require("../utils/cli-colors.util");
|
|
9
9
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
10
|
-
const
|
|
10
|
+
const is_log_level_enabled_util_1 = require("./utils/is-log-level-enabled.util");
|
|
11
11
|
const DEFAULT_DEPTH = 5;
|
|
12
12
|
const DEFAULT_LOG_LEVELS = [
|
|
13
13
|
'log',
|
|
@@ -25,6 +25,9 @@ const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
|
25
25
|
day: '2-digit',
|
|
26
26
|
month: '2-digit',
|
|
27
27
|
});
|
|
28
|
+
/**
|
|
29
|
+
* @publicApi
|
|
30
|
+
*/
|
|
28
31
|
let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
29
32
|
constructor(contextOrOptions, options) {
|
|
30
33
|
// eslint-disable-next-line prefer-const
|
|
@@ -127,7 +130,7 @@ let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {
|
|
|
127
130
|
}
|
|
128
131
|
isLevelEnabled(level) {
|
|
129
132
|
const logLevels = this.options?.logLevels;
|
|
130
|
-
return (0,
|
|
133
|
+
return (0, is_log_level_enabled_util_1.isLogLevelEnabled)(level, logLevels);
|
|
131
134
|
}
|
|
132
135
|
getTimestamp() {
|
|
133
136
|
return dateTimeFormatter.format(Date.now());
|
package/services/index.d.ts
CHANGED
package/services/index.js
CHANGED
|
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./console-logger.service"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./logger.service"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./utils/filter-log-levels.util"), exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export declare const LOG_LEVELS: ["verbose", "debug", "log", "warn", "error", "fatal"];
|
|
1
2
|
/**
|
|
2
3
|
* @publicApi
|
|
3
4
|
*/
|
|
4
|
-
export type LogLevel =
|
|
5
|
+
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
5
6
|
/**
|
|
6
7
|
* @publicApi
|
|
7
8
|
*/
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var Logger_1;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Logger = void 0;
|
|
4
|
+
exports.Logger = exports.LOG_LEVELS = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const core_1 = require("../decorators/core");
|
|
7
7
|
const shared_utils_1 = require("../utils/shared.utils");
|
|
8
8
|
const console_logger_service_1 = require("./console-logger.service");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
+
exports.LOG_LEVELS = [
|
|
11
|
+
'verbose',
|
|
12
|
+
'debug',
|
|
13
|
+
'log',
|
|
14
|
+
'warn',
|
|
15
|
+
'error',
|
|
16
|
+
'fatal',
|
|
17
|
+
];
|
|
10
18
|
const DEFAULT_LOGGER = new console_logger_service_1.ConsoleLogger();
|
|
11
19
|
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
|
|
12
20
|
year: 'numeric',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterLogLevels = filterLogLevels;
|
|
4
|
+
const logger_service_1 = require("../logger.service");
|
|
5
|
+
const is_log_level_util_1 = require("./is-log-level.util");
|
|
6
|
+
/**
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
function filterLogLevels(parseableString = '') {
|
|
10
|
+
const sanitizedSring = parseableString.replaceAll(' ', '').toLowerCase();
|
|
11
|
+
if (sanitizedSring[0] === '>') {
|
|
12
|
+
const orEqual = sanitizedSring[1] === '=';
|
|
13
|
+
const logLevelIndex = logger_service_1.LOG_LEVELS.indexOf(sanitizedSring.substring(orEqual ? 2 : 1));
|
|
14
|
+
if (logLevelIndex === -1) {
|
|
15
|
+
throw new Error(`parse error (unknown log level): ${sanitizedSring}`);
|
|
16
|
+
}
|
|
17
|
+
return logger_service_1.LOG_LEVELS.slice(orEqual ? logLevelIndex : logLevelIndex + 1);
|
|
18
|
+
}
|
|
19
|
+
else if (sanitizedSring.includes(',')) {
|
|
20
|
+
return sanitizedSring.split(',').filter(is_log_level_util_1.isLogLevel);
|
|
21
|
+
}
|
|
22
|
+
return (0, is_log_level_util_1.isLogLevel)(sanitizedSring) ? [sanitizedSring] : logger_service_1.LOG_LEVELS;
|
|
23
|
+
}
|
package/services/utils/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./filter-log-levels.util"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./is-log-level-enabled.util"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./is-log-level.util"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLogLevel = isLogLevel;
|
|
4
|
+
const logger_service_1 = require("../logger.service");
|
|
5
|
+
/**
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
function isLogLevel(maybeLogLevel) {
|
|
9
|
+
return logger_service_1.LOG_LEVELS.includes(maybeLogLevel);
|
|
10
|
+
}
|