@nathapp/nestjs-logging 4.0.0 → 4.0.2
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/.turbo/turbo-build.log +1 -1
- package/dist/interceptor/logging.interceptor.d.ts +3 -1
- package/dist/interceptor/logging.interceptor.js +27 -7
- package/dist/interceptor/logging.interceptor.js.map +1 -1
- package/dist/module/logging.interface.d.ts +1 -0
- package/dist/provider/pino-logger.service.js +14 -10
- package/dist/provider/pino-logger.service.js.map +1 -1
- package/dist/util/options.util.js +2 -1
- package/dist/util/options.util.js.map +1 -1
- package/package.json +2 -2
- package/.eslintrc.js +0 -24
- package/CHANGELOG.md +0 -397
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ExecutionContext, NestInterceptor } from "@nestjs/common";
|
|
2
2
|
import { LoggingModuleOptions } from "../module";
|
|
3
|
-
import { Logger } from "../provider";
|
|
3
|
+
import { Logger, LoggerHttpMeta } from "../provider";
|
|
4
4
|
import { Reflector } from "@nestjs/core";
|
|
5
|
+
export declare function defaultFormatResponse(metadata: LoggerHttpMeta): string;
|
|
5
6
|
export declare class LoggingInterceptor implements NestInterceptor {
|
|
6
7
|
private readonly options;
|
|
7
8
|
private readonly logger;
|
|
@@ -9,6 +10,7 @@ export declare class LoggingInterceptor implements NestInterceptor {
|
|
|
9
10
|
private readonly loggingOptions;
|
|
10
11
|
private readonly redact;
|
|
11
12
|
constructor(options: LoggingModuleOptions, logger: Logger, reflector: Reflector);
|
|
13
|
+
private safeClone;
|
|
12
14
|
intercept(context: ExecutionContext, next: any): any;
|
|
13
15
|
private log;
|
|
14
16
|
protected isLoggable(context: ExecutionContext): boolean;
|
|
@@ -13,6 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LoggingInterceptor = void 0;
|
|
16
|
+
exports.defaultFormatResponse = defaultFormatResponse;
|
|
16
17
|
const common_1 = require("@nestjs/common");
|
|
17
18
|
const fastRedact = require("fast-redact");
|
|
18
19
|
const module_1 = require("../module");
|
|
@@ -24,6 +25,10 @@ const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
|
24
25
|
const common_2 = require("@nathapp/common");
|
|
25
26
|
const serialize_1 = require("../serialize");
|
|
26
27
|
const constant_1 = require("../constant");
|
|
28
|
+
function defaultFormatResponse(metadata) {
|
|
29
|
+
const urlPath = String(metadata.url || '').split('?')[0];
|
|
30
|
+
return `[RES] ${metadata.method} ${urlPath} ${metadata.statusCode} ${metadata.responseTime}ms - ${metadata.clientIp} - res: ${!(0, common_2.isUndefinedOrNullOrEmpty)(metadata.responseData) ? JSON.stringify(metadata.responseData) : '-'}`;
|
|
31
|
+
}
|
|
27
32
|
let LoggingInterceptor = class LoggingInterceptor {
|
|
28
33
|
constructor(options, logger, reflector) {
|
|
29
34
|
this.options = options;
|
|
@@ -35,6 +40,21 @@ let LoggingInterceptor = class LoggingInterceptor {
|
|
|
35
40
|
serialize: false,
|
|
36
41
|
});
|
|
37
42
|
}
|
|
43
|
+
safeClone(value) {
|
|
44
|
+
var _a;
|
|
45
|
+
const maxBytes = (_a = this.options.maxLogBytes) !== null && _a !== void 0 ? _a : 64 * 1024;
|
|
46
|
+
let serialized;
|
|
47
|
+
try {
|
|
48
|
+
serialized = JSON.stringify(value);
|
|
49
|
+
}
|
|
50
|
+
catch (_b) {
|
|
51
|
+
return { omitted: 'unserializable' };
|
|
52
|
+
}
|
|
53
|
+
if (serialized !== undefined && serialized.length > maxBytes) {
|
|
54
|
+
return { omitted: 'exceeds maxLogBytes' };
|
|
55
|
+
}
|
|
56
|
+
return structuredClone(value);
|
|
57
|
+
}
|
|
38
58
|
intercept(context, next) {
|
|
39
59
|
if (context.getType() !== 'http') {
|
|
40
60
|
return next.handle();
|
|
@@ -61,24 +81,24 @@ let LoggingInterceptor = class LoggingInterceptor {
|
|
|
61
81
|
}
|
|
62
82
|
if (this.loggingOptions.request) {
|
|
63
83
|
if (query && !(0, common_2.isUndefinedOrNullOrEmpty)(query)) {
|
|
64
|
-
metadata.query = this.redact(
|
|
84
|
+
metadata.query = this.redact(this.safeClone(query));
|
|
65
85
|
}
|
|
66
86
|
if (params && !(0, common_2.isUndefinedOrNullOrEmpty)(params)) {
|
|
67
|
-
metadata.params = this.redact(
|
|
87
|
+
metadata.params = this.redact(this.safeClone(params));
|
|
68
88
|
}
|
|
69
89
|
if (body && !(0, common_2.isUndefinedOrNullOrEmpty)(body)) {
|
|
70
|
-
metadata.body = this.redact(
|
|
90
|
+
metadata.body = this.redact(this.safeClone(body));
|
|
71
91
|
}
|
|
72
92
|
}
|
|
73
93
|
if (this.loggingOptions.headers) {
|
|
74
|
-
metadata.headers = this.redact(
|
|
94
|
+
metadata.headers = this.redact(this.safeClone(headers));
|
|
75
95
|
}
|
|
76
96
|
return next.handle().pipe((0, rxjs_1.catchError)((error) => {
|
|
77
97
|
metadata.statusCode = (error === null || error === void 0 ? void 0 : error.status) || 500;
|
|
78
98
|
if (this.loggingOptions.error) {
|
|
79
99
|
const errorResponse = error === null || error === void 0 ? void 0 : error.response;
|
|
80
100
|
metadata.error = typeof errorResponse === 'object' && errorResponse !== null
|
|
81
|
-
? this.redact(
|
|
101
|
+
? this.redact(this.safeClone(errorResponse))
|
|
82
102
|
: errorResponse;
|
|
83
103
|
}
|
|
84
104
|
if (error === null || error === void 0 ? void 0 : error.stack) {
|
|
@@ -92,7 +112,7 @@ let LoggingInterceptor = class LoggingInterceptor {
|
|
|
92
112
|
const isError = statusCode >= 500;
|
|
93
113
|
const level = isError ? 'error' : statusCode >= 400 ? 'warn' : 'info';
|
|
94
114
|
if (this.loggingOptions.response) {
|
|
95
|
-
metadata.responseData = this.redact(
|
|
115
|
+
metadata.responseData = this.redact(this.safeClone(response || {}));
|
|
96
116
|
}
|
|
97
117
|
this.log(metadata, level, startAt, localContext);
|
|
98
118
|
}));
|
|
@@ -102,7 +122,7 @@ let LoggingInterceptor = class LoggingInterceptor {
|
|
|
102
122
|
metadata.responseTime = Number((diff[0] * 1e3 + diff[1] * 1e-6).toFixed(2));
|
|
103
123
|
let message = this.loggingOptions.formatter ?
|
|
104
124
|
(typeof this.loggingOptions.formatter === 'function' ? this.loggingOptions.formatter(metadata) : this.loggingOptions.formatter) :
|
|
105
|
-
|
|
125
|
+
defaultFormatResponse(metadata);
|
|
106
126
|
const serializeFunction = this.loggingOptions.serialize || serialize_1.defaultSerializer;
|
|
107
127
|
this.logger.logWithMeta(level, message, this.loggingOptions.metadata ? serializeFunction(metadata) : undefined, context);
|
|
108
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.interceptor.js","sourceRoot":"","sources":["../../lib/interceptor/logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"logging.interceptor.js","sourceRoot":"","sources":["../../lib/interceptor/logging.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAeA,sDAGC;AAlBD,2CAAuF;AACvF,0CAA0C;AAC1C,sCAA0G;AAC1G,0CAAqD;AACrD,uCAAyC;AACzC,4CAAiD;AACjD,+BAAuC;AACvC,0DAAqD;AACrD,4CAA2D;AAC3D,4CAAiD;AACjD,0CAAoD;AAKpD,SAAgB,qBAAqB,CAAC,QAAwB;IAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,QAAQ,CAAC,MAAM,IAAI,OAAO,IAAI,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,YAAY,QAAQ,QAAQ,CAAC,QAAQ,WAAW,CAAC,IAAA,iCAAwB,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ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,CAAA;6CACN,iBAAM;QACH,gBAAS;GAR5B,kBAAkB,CA0J9B"}
|
|
@@ -5,6 +5,8 @@ const nestjs_common_1 = require("@nathapp/nestjs-common");
|
|
|
5
5
|
const logger_service_1 = require("./logger.service");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const util_1 = require("../util");
|
|
8
|
+
const constant_1 = require("../constant");
|
|
9
|
+
const { streamSym } = (0, nestjs_common_1.loadPackage)('pino', 'LoggingModule', () => require('pino/lib/symbols'));
|
|
8
10
|
const PinoLogLevelMaps = {
|
|
9
11
|
'info': 'info',
|
|
10
12
|
'error': 'error',
|
|
@@ -15,7 +17,7 @@ const PinoLogLevelMaps = {
|
|
|
15
17
|
};
|
|
16
18
|
class PinoLoggerService extends logger_service_1.Logger {
|
|
17
19
|
constructor(options, contextService) {
|
|
18
|
-
var _a, _b, _c;
|
|
20
|
+
var _a, _b, _c, _d;
|
|
19
21
|
super(contextService);
|
|
20
22
|
const pino = (0, nestjs_common_1.loadPackage)('pino', 'LoggingModule', () => require('pino'));
|
|
21
23
|
const level = options.level || 'info';
|
|
@@ -71,7 +73,7 @@ class PinoLoggerService extends logger_service_1.Logger {
|
|
|
71
73
|
}
|
|
72
74
|
const pinoOptions = {
|
|
73
75
|
level,
|
|
74
|
-
redact: options.redact
|
|
76
|
+
redact: (_d = options.redact) !== null && _d !== void 0 ? _d : constant_1.DEFAULT_REDACT,
|
|
75
77
|
transport: {
|
|
76
78
|
targets: transports,
|
|
77
79
|
},
|
|
@@ -120,15 +122,17 @@ class PinoLoggerService extends logger_service_1.Logger {
|
|
|
120
122
|
resolve();
|
|
121
123
|
};
|
|
122
124
|
const timeout = setTimeout(done, 2000);
|
|
123
|
-
this.logger
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
stream.
|
|
125
|
+
const stream = (this.logger)[streamSym];
|
|
126
|
+
if (stream && typeof stream.end === "function") {
|
|
127
|
+
if (typeof stream.once === "function") {
|
|
128
|
+
stream.once("finish", done);
|
|
129
|
+
stream.once("error", done);
|
|
127
130
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
stream.end(() => done());
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
done();
|
|
135
|
+
}
|
|
132
136
|
});
|
|
133
137
|
}
|
|
134
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pino-logger.service.js","sourceRoot":"","sources":["../../lib/provider/pino-logger.service.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AACrD,qDAA0C;AAC1C,6BAA6B;AAC7B,kCAA+C;
|
|
1
|
+
{"version":3,"file":"pino-logger.service.js","sourceRoot":"","sources":["../../lib/provider/pino-logger.service.ts"],"names":[],"mappings":";;;AACA,0DAAqD;AACrD,qDAA0C;AAC1C,6BAA6B;AAC7B,kCAA+C;AAG/C,0CAA6C;AAM7C,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,2BAAW,EAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAA0B,CAAC;AAEvH,MAAM,gBAAgB,GAAgC;IACpD,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,OAAO;CACjB,CAAA;AAGD,MAAa,iBAAkB,SAAQ,uBAAM;IAI3C,YAAY,OAA8B,EAAE,cAAsC;;QAChF,KAAK,CAAC,cAAc,CAAC,CAAC;QACtB,MAAM,IAAI,GAAG,IAAA,2BAAW,EAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACzE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC;QAEtC,MAAM,UAAU,GAAU,EAAE,CAAC;QAE7B,IAAI,MAAA,OAAO,CAAC,OAAO,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M,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;gBAE/C,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBACtC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;oBAC5B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC7B,CAAC;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9ID,8CA8IC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveConsoleOptions = exports.resolveNestLogLevel = exports.resolveDefaultLoggerOptions = exports.resolveWinstonOptions = exports.resolvePinoOptions = exports.resolveCentrilizedOptions = exports.WinstonLogLevelMaps = exports.winstonNestLevel = exports.PinoLokiLogLevelMaps = exports.PinoLogLevelMaps = void 0;
|
|
4
|
+
const constant_1 = require("../constant");
|
|
4
5
|
exports.PinoLogLevelMaps = {
|
|
5
6
|
fatal: 'fatal',
|
|
6
7
|
error: 'error',
|
|
@@ -56,7 +57,7 @@ const resolvePinoOptions = (options) => {
|
|
|
56
57
|
var _a, _b, _c;
|
|
57
58
|
return {
|
|
58
59
|
level: options.level ? exports.PinoLogLevelMaps[options.level] : 'info',
|
|
59
|
-
redact: (_a = options.redact) !== null && _a !== void 0 ? _a :
|
|
60
|
+
redact: (_a = options.redact) !== null && _a !== void 0 ? _a : constant_1.DEFAULT_REDACT,
|
|
60
61
|
console: (_b = options.console) !== null && _b !== void 0 ? _b : { enabled: true, prettyPrint: false },
|
|
61
62
|
file: (_c = options.file) !== null && _c !== void 0 ? _c : { enabled: false },
|
|
62
63
|
centralized: (0, exports.resolveCentrilizedOptions)(options),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.util.js","sourceRoot":"","sources":["../../lib/util/options.util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"options.util.js","sourceRoot":"","sources":["../../lib/util/options.util.ts"],"names":[],"mappings":";;;AAGA,0CAA6C;AAGhC,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;CACjB,CAAA;AAEY,QAAA,oBAAoB,GAAG;IAClC,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,OAAO;CACZ,CAAA;AAGY,QAAA,gBAAgB,GAAG;IAC9B,MAAM,EAAE;QACN,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,CAAC;KACX;CACF,CAAC;AAEW,QAAA,mBAAmB,GAAG;IACjC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACnB,CAAC;AAEK,MAAM,yBAAyB,GAAG,CAAC,OAA6B,EAA6B,EAAE;;IACpG,OAAO;QACL,OAAO,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,OAAO,mCAAI,KAAK;QAC9C,GAAG,EAAE,MAAA,OAAO,CAAC,WAAW,0CAAE,GAAG;QAC7B,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI,EAAE;QACzC,QAAQ,EAA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AK,MAAM;YACP,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7C,KAAK,OAAO;YACR,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACtD,KAAK,OAAO,CAAC;QACb,KAAK,SAAS;YACV,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACjE;YACI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;AACL,CAAC,CAAA;AAlBY,QAAA,mBAAmB,uBAkB/B;AAEM,MAAM,qBAAqB,GAAG,CAAC,OAAqD,EAAwB,EAAE;;IACnH,OAAO;QACL,SAAS,EAAE,IAAA,2BAAmB,EAAC,MAAA,OAAO,CAAC,KAAK,mCAAI,MAAM,CAAC;QACvD,IAAI,EAAE,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,mCAAI,KAAK;KACrC,CAAC;AACJ,CAAC,CAAA;AALY,QAAA,qBAAqB,yBAKjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-logging",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "nestjs-logging",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist/ .turbo/",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"lib": "lib"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@nathapp/nestjs-common": "^4.0.
|
|
60
|
+
"@nathapp/nestjs-common": "^4.0.2",
|
|
61
61
|
"fast-redact": "^3.0.0"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
sourceType: 'module',
|
|
6
|
-
},
|
|
7
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
8
|
-
extends: [
|
|
9
|
-
'plugin:@typescript-eslint/recommended',
|
|
10
|
-
'plugin:prettier/recommended',
|
|
11
|
-
],
|
|
12
|
-
root: true,
|
|
13
|
-
env: {
|
|
14
|
-
node: true,
|
|
15
|
-
jest: true,
|
|
16
|
-
},
|
|
17
|
-
ignorePatterns: ['.eslintrc.js'],
|
|
18
|
-
rules: {
|
|
19
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
20
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
21
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
22
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
23
|
-
},
|
|
24
|
-
};
|
package/CHANGELOG.md
DELETED
|
@@ -1,397 +0,0 @@
|
|
|
1
|
-
# @nathapp/nestjs-logging
|
|
2
|
-
|
|
3
|
-
## 4.0.0
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- 2319e9d: BREAKING: drop NestJS 8/9 peer ranges and require Node ^20.19.0 || >=22.12.0. Support NestJS 12. Peer ranges now cover NestJS 10, 11 and 12 (Node ^20.19.0 || >=22.12.0 is required because NestJS 12 is ESM-only). The configurable module builder no longer deep-imports a directory that is unresolvable on NestJS 12, and TwoFactorGuard / TwoFactorForceGuard redeclare their constructor DI metadata because NestJS 12 no longer inherits @Optional() from base classes.
|
|
8
|
-
|
|
9
|
-
Other consumer-facing changes:
|
|
10
|
-
|
|
11
|
-
- `@nathapp/nestjs-health`: `@nestjs/terminus` moved from `dependencies` to `peerDependencies` (`^11.0.0 || ^12.0.0`) so NestJS 12 apps can use terminus 12. Install `@nestjs/terminus` in your app.
|
|
12
|
-
- Optional-package loading (`loadPackage`) now throws a descriptive `Error` (original error on `cause`) instead of logging and calling `process.exit(1)` when an optional package is missing.
|
|
13
|
-
|
|
14
|
-
### Patch Changes
|
|
15
|
-
|
|
16
|
-
- Updated dependencies [668055b]
|
|
17
|
-
- Updated dependencies [2319e9d]
|
|
18
|
-
- @nathapp/nestjs-common@4.0.0
|
|
19
|
-
|
|
20
|
-
## 4.0.0-rc.0
|
|
21
|
-
|
|
22
|
-
### Major Changes
|
|
23
|
-
|
|
24
|
-
- c3aeb46: BREAKING: drop NestJS 8/9 peer ranges and require Node ^20.19.0 || >=22.12.0. Support NestJS 12. Peer ranges now cover NestJS 10, 11 and 12 (Node ^20.19.0 || >=22.12.0 is required because NestJS 12 is ESM-only). The configurable module builder no longer deep-imports a directory that is unresolvable on NestJS 12, and TwoFactorGuard / TwoFactorForceGuard redeclare their constructor DI metadata because NestJS 12 no longer inherits @Optional() from base classes.
|
|
25
|
-
|
|
26
|
-
Other consumer-facing changes:
|
|
27
|
-
|
|
28
|
-
- `@nathapp/nestjs-health`: `@nestjs/terminus` moved from `dependencies` to `peerDependencies` (`^11.0.0 || ^12.0.0`) so NestJS 12 apps can use terminus 12. Install `@nestjs/terminus` in your app.
|
|
29
|
-
- Optional-package loading (`loadPackage`) now throws a descriptive `Error` (original error on `cause`) instead of logging and calling `process.exit(1)` when an optional package is missing.
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- Updated dependencies [c3aeb46]
|
|
34
|
-
- @nathapp/nestjs-common@4.0.0-rc.0
|
|
35
|
-
|
|
36
|
-
## 3.3.0
|
|
37
|
-
|
|
38
|
-
### Patch Changes
|
|
39
|
-
|
|
40
|
-
- @nathapp/nestjs-common@3.3.0
|
|
41
|
-
|
|
42
|
-
## 3.2.1
|
|
43
|
-
|
|
44
|
-
### Patch Changes
|
|
45
|
-
|
|
46
|
-
- 0610b83: Fix Exception Bug on nestjs-common
|
|
47
|
-
- Updated dependencies [0610b83]
|
|
48
|
-
- @nathapp/nestjs-common@3.2.1
|
|
49
|
-
|
|
50
|
-
## 3.2.0
|
|
51
|
-
|
|
52
|
-
### Minor Changes
|
|
53
|
-
|
|
54
|
-
- 1876b9a: ### nestjs-auth
|
|
55
|
-
|
|
56
|
-
- Add JWKS support via `JwksJwtStrategyProvider` and `createJwksStrategyProvider` factory — enables remote key resolution through `jwks-rsa` (optional peer dep)
|
|
57
|
-
- Add `validateJwksOptions` security guard and `JwksOptions` interface
|
|
58
|
-
- Export `JwksJwtStrategyProvider` and `JwksOptions` from the public API
|
|
59
|
-
- Fix permission guard and JWT module immutability issues from code review
|
|
60
|
-
|
|
61
|
-
### nestjs-typeorm
|
|
62
|
-
|
|
63
|
-
- Add `AbstractTypeOrmRepository<TDomain, TEntity, TId>` — portable `IRepository` implementation decoupled from TypeORM internals
|
|
64
|
-
- Add `TYPEORM_TRANSACTION_ALS` DI token and publish it from `forRoot`/`forRootAsync`
|
|
65
|
-
- `forCustomRepository` now instantiates `AbstractTypeOrmRepository` subclasses with the correct per-DataSource tx manager token
|
|
66
|
-
- Add `getTypeOrmTransactionManagerToken(name?)` helper for multi-DataSource wiring
|
|
67
|
-
- Named DataSource tx tokens no longer collide; default DataSource still aliases the global `TRANSACTION_MANAGER` symbol
|
|
68
|
-
|
|
69
|
-
### nestjs-prisma
|
|
70
|
-
|
|
71
|
-
- Add `getPrismaTransactionManagerToken(name?)` helper for multi-DataSource wiring
|
|
72
|
-
- `forRoot` / `forRootAsync` register named tx manager token + default-only guard to prevent collision
|
|
73
|
-
|
|
74
|
-
### nestjs-data
|
|
75
|
-
|
|
76
|
-
- Add `IRepository<TDomain, TId>` portable repository contract
|
|
77
|
-
- Fix missing `@nathapp/nestjs-common` peer dep for turborepo build resolution
|
|
78
|
-
|
|
79
|
-
### nestjs-common
|
|
80
|
-
|
|
81
|
-
- Add `request-ip` utility for extracting client IP across Express and Fastify adapters
|
|
82
|
-
|
|
83
|
-
### nestjs-cache
|
|
84
|
-
|
|
85
|
-
- Fix cache interceptor, cache manager, and cache tag registry immutability and type issues
|
|
86
|
-
|
|
87
|
-
### nestjs-app
|
|
88
|
-
|
|
89
|
-
- Fix `nathapp.ts` and `app-factory.ts` code review findings (immutability, error handling)
|
|
90
|
-
|
|
91
|
-
### nestjs-queue
|
|
92
|
-
|
|
93
|
-
- Upgrade `uuid` dependency from `^9.0.0` to `^11.1.1` (security)
|
|
94
|
-
- Fix BullMQ health check to use `IRedisClient.info()` (aligned with BullMQ interface)
|
|
95
|
-
|
|
96
|
-
### nestjs-notification
|
|
97
|
-
|
|
98
|
-
- Upgrade `nodemailer` dev dep from `^7` to `^8` — resolves SMTP command injection CVEs (GHSA-c7w3-x93f-qmm8, GHSA-vvjj-xcjg-gr5g)
|
|
99
|
-
|
|
100
|
-
### nestjs-storage
|
|
101
|
-
|
|
102
|
-
- Fix code review findings (immutability, validation)
|
|
103
|
-
|
|
104
|
-
### nestjs-throttler
|
|
105
|
-
|
|
106
|
-
- Fix code review findings
|
|
107
|
-
|
|
108
|
-
### All packages
|
|
109
|
-
|
|
110
|
-
- Upgrade AJV to v8 (removes root override that broke `@fastify/ajv-compiler`)
|
|
111
|
-
- Align all package versions to 3.1.3 as baseline for this minor release
|
|
112
|
-
|
|
113
|
-
### Patch Changes
|
|
114
|
-
|
|
115
|
-
- Updated dependencies [1876b9a]
|
|
116
|
-
- @nathapp/nestjs-common@3.2.0
|
|
117
|
-
|
|
118
|
-
## 3.0.0
|
|
119
|
-
|
|
120
|
-
### Major Changes
|
|
121
|
-
|
|
122
|
-
- 86a36b8: # 🚀 v3.0.0 Monorepo Enterprise Upgrade
|
|
123
|
-
|
|
124
|
-
This release brings significant security hardening, strict typing, improved observability, and comprehensive documentation across the entire Nathapp NestJS ecosystem.
|
|
125
|
-
|
|
126
|
-
## ⚠️ Breaking Changes
|
|
127
|
-
|
|
128
|
-
### nestjs-common
|
|
129
|
-
|
|
130
|
-
- **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments behind a reverse proxy MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, `nginx-local`, etc.). See `docs/trust-proxy-security.md`.
|
|
131
|
-
- **SerializableInterceptor**: Now uses pure transformation — original response objects are no longer mutated. Primitives in arrays are preserved correctly.
|
|
132
|
-
- **AppException**: Now generic `AppException<T>` for strict argument typing.
|
|
133
|
-
|
|
134
|
-
### nestjs-logging
|
|
135
|
-
|
|
136
|
-
- **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
|
|
137
|
-
- **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
|
|
138
|
-
- **Graceful Drain**: Logger now implements `OnModuleDestroy` to flush pending writes on shutdown.
|
|
139
|
-
|
|
140
|
-
### nestjs-typeorm
|
|
141
|
-
|
|
142
|
-
- **Connection Validation**: `TypeOrmExModule.forRoot()` now throws `"Connection Not Supported"` when no valid connection type is provided (previously defaulted silently to MySQL).
|
|
143
|
-
|
|
144
|
-
## 🔒 Security
|
|
145
|
-
|
|
146
|
-
- **nestjs-common**: Trust proxy fail-closed default prevents IP spoofing when misconfigured. Comprehensive security documentation with provider presets.
|
|
147
|
-
- **nestjs-storage**: GDrive refreshToken security best practices documented. Provider capability matrix added.
|
|
148
|
-
- **nestjs-throttler**: Documented that `getTracker()` executes synchronously — no async TOCTOU race condition in rate limiting.
|
|
149
|
-
- **nestjs-typeorm**: Stored procedure name validation with whitelist pattern (`/^[a-zA-Z_][a-zA-Z0-9_.]*$/`) prevents SQL injection.
|
|
150
|
-
- **nestjs-cache**: Tag registry now receives TTL for proper expiration of tag-to-key mappings.
|
|
151
|
-
- **nestjs-microservices**: Fixed gRPC Bearer token extraction whitespace bug. Full test coverage for all guards.
|
|
152
|
-
- **nestjs-auth-2fa**: Timing-safe TOTP verification prevents timing attacks.
|
|
153
|
-
|
|
154
|
-
## ✨ Features & Improvements
|
|
155
|
-
|
|
156
|
-
- **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**. Provider capability matrix documents supported methods per provider.
|
|
157
|
-
- **nestjs-microservices**: Full guard coverage (100%), Service Identity JWT + HMAC authentication, `ServicePermissionRegistry` for fine-grained access control.
|
|
158
|
-
- **nestjs-typeorm**: Automatic mapping of database errors to `AppException` via `TypeOrmExceptionFilter`.
|
|
159
|
-
- **nestjs-auth-2fa**: `BaseTwoFactorGuard` with flexible policy engine. DI-aware provider factory with comprehensive architectural documentation.
|
|
160
|
-
- **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage. Touch fallback avoided for distributed strategies (race condition prevention).
|
|
161
|
-
- **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
|
|
162
|
-
- **nestjs-prisma**: `PrismaExceptionFilter` and transaction helper. Parallel query execution validated.
|
|
163
|
-
- **nestjs-auth**: Comprehensive JSDoc on all public APIs. All TODO comments resolved.
|
|
164
|
-
- **nestjs-common**: `ConfigurableModuleBuilder` with `externallyConfigured()` support.
|
|
165
|
-
- **Global**: 2,500+ tests across all 13 packages. Comprehensive JSDoc for all public APIs.
|
|
166
|
-
|
|
167
|
-
## 📚 Documentation
|
|
168
|
-
|
|
169
|
-
- `nestjs-common/docs/trust-proxy-security.md` — IP spoofing risks, preset configurations, verification steps
|
|
170
|
-
- `nestjs-storage/docs/gdrive-security.md` — refreshToken security best practices
|
|
171
|
-
- `nestjs-storage/docs/provider-capabilities.md` — method support matrix per provider
|
|
172
|
-
- All packages: JSDoc on public APIs, MIGRATION.md guides where applicable
|
|
173
|
-
|
|
174
|
-
### Patch Changes
|
|
175
|
-
|
|
176
|
-
- Updated dependencies [86a36b8]
|
|
177
|
-
- @nathapp/nestjs-common@3.0.0
|
|
178
|
-
|
|
179
|
-
## 3.0.0-rc.0
|
|
180
|
-
|
|
181
|
-
### Major Changes
|
|
182
|
-
|
|
183
|
-
- # 🚀 v3.0.0-rc Monorepo Enterprise Upgrade
|
|
184
|
-
|
|
185
|
-
This release brings significant security, reliability, and observability improvements across the entire Nathapp ecosystem.
|
|
186
|
-
|
|
187
|
-
## ⚠️ [BREAKING CHANGES]
|
|
188
|
-
|
|
189
|
-
### nestjs-common
|
|
190
|
-
|
|
191
|
-
- **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, etc.).
|
|
192
|
-
- **SerializableInterceptor**: Now uses pure transformation. Original response objects are no longer mutated.
|
|
193
|
-
- **AppException**: Now generic `AppException<T>` for strict argument typing.
|
|
194
|
-
|
|
195
|
-
### nestjs-logging
|
|
196
|
-
|
|
197
|
-
- **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
|
|
198
|
-
- **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
|
|
199
|
-
|
|
200
|
-
## ✨ Features & Improvements
|
|
201
|
-
|
|
202
|
-
- **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**.
|
|
203
|
-
- **nestjs-microservices**: Full guard coverage and secured gRPC Bearer token extraction.
|
|
204
|
-
- **nestjs-typeorm**: Automatic mapping of database errors to `AppException`.
|
|
205
|
-
- **nestjs-auth-2fa**: Timing-safe TOTP verification and flexible policy engine.
|
|
206
|
-
- **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage.
|
|
207
|
-
- **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
|
|
208
|
-
- **nestjs-throttler**: Added async trust proxy support.
|
|
209
|
-
- **Global**: Comprehensive JSDoc for all public APIs across all packages.
|
|
210
|
-
|
|
211
|
-
### Patch Changes
|
|
212
|
-
|
|
213
|
-
- Updated dependencies
|
|
214
|
-
- @nathapp/nestjs-common@3.0.0-rc.0
|
|
215
|
-
|
|
216
|
-
## 2.1.5
|
|
217
|
-
|
|
218
|
-
### Patch Changes
|
|
219
|
-
|
|
220
|
-
- # @nathapp/nestjs-notification v2.2.0 - Enterprise-Grade Upgrade
|
|
221
|
-
|
|
222
|
-
Major enterprise enhancements to the notification system with 9 phases of improvements:
|
|
223
|
-
|
|
224
|
-
## New Features
|
|
225
|
-
|
|
226
|
-
### Phase 1: Pluggable Template Engine
|
|
227
|
-
|
|
228
|
-
- `TemplateEngine` interface for custom template rendering
|
|
229
|
-
- `StringFormatEngine` as default (backwards compatible)
|
|
230
|
-
- Apps can now inject Handlebars, EJS, or custom engines
|
|
231
|
-
|
|
232
|
-
### Phase 2: Configurable Strict Mode
|
|
233
|
-
|
|
234
|
-
- `strict: true` (default) throws errors when services aren't configured
|
|
235
|
-
- `strict: false` for graceful degradation (returns `{ success: false }`)
|
|
236
|
-
- Clear error messages via `NotificationConfigError`
|
|
237
|
-
|
|
238
|
-
### Phase 3: Unified `send()` Method
|
|
239
|
-
|
|
240
|
-
- Single method dispatches to multiple channels
|
|
241
|
-
- `NotificationPayload` with `channels: ['email', 'push', 'sms']`
|
|
242
|
-
- Aggregated results across all channels
|
|
243
|
-
|
|
244
|
-
### Phase 4: Platform Alias
|
|
245
|
-
|
|
246
|
-
- Added `platform` field (deprecated `paltform` typo)
|
|
247
|
-
- Backwards compatible with fallback
|
|
248
|
-
|
|
249
|
-
### Phase 5: SMS Integration
|
|
250
|
-
|
|
251
|
-
- `SmsService` wired into `NotificationModule`
|
|
252
|
-
- `sendSms()` with full template support
|
|
253
|
-
- Ready for provider packages (Twilio, SNS)
|
|
254
|
-
|
|
255
|
-
### Phase 6: Interceptors & Hooks
|
|
256
|
-
|
|
257
|
-
- `NotificationInterceptor` interface
|
|
258
|
-
- `beforeSend`, `afterSend`, `onError` hooks
|
|
259
|
-
- Global logging, auditing, message modification
|
|
260
|
-
|
|
261
|
-
### Phase 7: WhatsApp Channel
|
|
262
|
-
|
|
263
|
-
- `WhatsAppService` abstract class
|
|
264
|
-
- `WhatsAppMessage` interface with Meta Business API support
|
|
265
|
-
- Template-based WhatsApp notifications
|
|
266
|
-
|
|
267
|
-
### Phase 8: Channel Fallback
|
|
268
|
-
|
|
269
|
-
- `fallback: ['sms']` on `NotificationPayload`
|
|
270
|
-
- Auto-retry through fallback channels when primary fails
|
|
271
|
-
- Interceptors receive `isFallback` + `failedChannel` context
|
|
272
|
-
|
|
273
|
-
### Phase 9: Unified Provider Registry (⚠️ Breaking)
|
|
274
|
-
|
|
275
|
-
- Replaced per-channel modules with unified `providers` array
|
|
276
|
-
- `NotificationProviderFactory` validates provider ↔ channel match
|
|
277
|
-
- `NotificationModuleOptionsFactory` for async configuration
|
|
278
|
-
- Simplified API: `NotificationModule.forRoot({ providers: [...] })`
|
|
279
|
-
|
|
280
|
-
## Breaking Changes (Phase 9)
|
|
281
|
-
|
|
282
|
-
- `emailOptions` → removed (use `providers` array)
|
|
283
|
-
- `pushNotificationOptions` → removed (use `providers` array)
|
|
284
|
-
- `smsService` → removed (use `providers` array)
|
|
285
|
-
- `whatsAppService` → removed (use `providers` array)
|
|
286
|
-
- `EmailModule`, `PushNotificationModule` no longer exported from main index
|
|
287
|
-
|
|
288
|
-
## Migration Guide
|
|
289
|
-
|
|
290
|
-
### Before
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
NotificationModule.forRoot({
|
|
294
|
-
emailOptions: EmailModule.forRoot({ option: { type: 'smtp', options: {...} } }),
|
|
295
|
-
templateLoader: MyLoader,
|
|
296
|
-
})
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### After
|
|
300
|
-
|
|
301
|
-
```typescript
|
|
302
|
-
NotificationModule.forRoot({
|
|
303
|
-
providers: [
|
|
304
|
-
{
|
|
305
|
-
channel: "email",
|
|
306
|
-
provider: SmtpEmailProvider,
|
|
307
|
-
options: { url: "...", from: "..." },
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
templateLoader: MyLoader,
|
|
311
|
-
});
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Stats
|
|
315
|
-
|
|
316
|
-
- **159 tests** (all passing)
|
|
317
|
-
- **88.5% code coverage**
|
|
318
|
-
- Fully backwards compatible (except Phase 9 breaking changes)
|
|
319
|
-
|
|
320
|
-
- Updated dependencies
|
|
321
|
-
- @nathapp/nestjs-common@2.1.5
|
|
322
|
-
|
|
323
|
-
## 2.1.1
|
|
324
|
-
|
|
325
|
-
### Patch Changes
|
|
326
|
-
|
|
327
|
-
- 1244520: fix: correct main/types paths to dist/ directory
|
|
328
|
-
- Updated dependencies [1244520]
|
|
329
|
-
- @nathapp/nestjs-common@2.1.1
|
|
330
|
-
|
|
331
|
-
## 3.0.0-rc.4
|
|
332
|
-
|
|
333
|
-
### Minor Changes
|
|
334
|
-
|
|
335
|
-
- de7078f: bump version
|
|
336
|
-
|
|
337
|
-
### Patch Changes
|
|
338
|
-
|
|
339
|
-
- Updated dependencies [de7078f]
|
|
340
|
-
- @nathapp/nestjs-common@3.0.0-rc.4
|
|
341
|
-
|
|
342
|
-
## 2.0.4
|
|
343
|
-
|
|
344
|
-
### Patch Changes
|
|
345
|
-
|
|
346
|
-
- 65148c4: security patch
|
|
347
|
-
- Updated dependencies [65148c4]
|
|
348
|
-
- @nathapp/nestjs-common@2.0.4
|
|
349
|
-
|
|
350
|
-
## 2.0.3
|
|
351
|
-
|
|
352
|
-
### Patch Changes
|
|
353
|
-
|
|
354
|
-
- ac0012d: LoggingInterceptor bug fix
|
|
355
|
-
- Updated dependencies [9da9d5a]
|
|
356
|
-
- @nathapp/nestjs-common@2.0.3
|
|
357
|
-
|
|
358
|
-
## 2.0.3-rc.0
|
|
359
|
-
|
|
360
|
-
### Patch Changes
|
|
361
|
-
|
|
362
|
-
- ac0012d: LoggingInterceptor bug fix
|
|
363
|
-
- Updated dependencies [9da9d5a]
|
|
364
|
-
- @nathapp/nestjs-common@2.0.3-rc.0
|
|
365
|
-
|
|
366
|
-
## 2.0.2
|
|
367
|
-
|
|
368
|
-
### Patch Changes
|
|
369
|
-
|
|
370
|
-
- 5b4c986: add @nathapp/nestjs-logging and depreciated @nathapp/nestjs-common logging
|
|
371
|
-
- 184e23b: refactory LoggerFactory and add FlushLogs on nathapp
|
|
372
|
-
- e493769: implement additionalFactoryOptions and bug fix
|
|
373
|
-
- a9cfacb: release nestjs-logging and add logErrorResponse
|
|
374
|
-
|
|
375
|
-
## 2.0.1-rc.5
|
|
376
|
-
|
|
377
|
-
### Patch Changes
|
|
378
|
-
|
|
379
|
-
- e493769: implement additionalFactoryOptions and bug fix
|
|
380
|
-
|
|
381
|
-
## 2.0.1-rc.4
|
|
382
|
-
|
|
383
|
-
### Patch Changes
|
|
384
|
-
|
|
385
|
-
- 5b4c986: add @nathapp/nestjs-logging and depreciated @nathapp/nestjs-common logging
|
|
386
|
-
|
|
387
|
-
## 2.0.1-rc.3
|
|
388
|
-
|
|
389
|
-
### Patch Changes
|
|
390
|
-
|
|
391
|
-
- 184e23b: refactory LoggerFactory and add FlushLogs on nathapp
|
|
392
|
-
|
|
393
|
-
## 2.0.1-rc.2
|
|
394
|
-
|
|
395
|
-
### Patch Changes
|
|
396
|
-
|
|
397
|
-
- a9cfacb: release nestjs-logging and add logErrorResponse
|