dicoshot-nest 0.2.2 → 0.3.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.
- package/README.ko.md +415 -0
- package/README.md +387 -69
- package/dist/app.controller.js.map +1 -1
- package/dist/app.module.js.map +1 -1
- package/dist/decorators/dicoshot-notify.decorator.d.ts +8 -0
- package/dist/decorators/dicoshot-notify.decorator.js +8 -0
- package/dist/decorators/dicoshot-notify.decorator.js.map +1 -0
- package/dist/dicoshot.constants.d.ts +1 -0
- package/dist/dicoshot.constants.js +2 -1
- package/dist/dicoshot.constants.js.map +1 -1
- package/dist/dicoshot.listener.js.map +1 -1
- package/dist/dicoshot.module.js +3 -0
- package/dist/dicoshot.module.js.map +1 -1
- package/dist/dicoshot.service.d.ts +6 -3
- package/dist/dicoshot.service.js +17 -8
- package/dist/dicoshot.service.js.map +1 -1
- package/dist/filters/dicoshot-exception.filter.js +16 -8
- package/dist/filters/dicoshot-exception.filter.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/interceptors/dicoshot-notify.interceptor.d.ts +10 -0
- package/dist/interceptors/dicoshot-notify.interceptor.js +45 -0
- package/dist/interceptors/dicoshot-notify.interceptor.js.map +1 -0
- package/dist/interceptors/dicoshot.interceptor.d.ts +1 -1
- package/dist/interceptors/dicoshot.interceptor.js +37 -24
- package/dist/interceptors/dicoshot.interceptor.js.map +1 -1
- package/dist/main.js.map +1 -1
- package/dist/utils/stack.util.d.ts +3 -0
- package/dist/utils/stack.util.js +20 -0
- package/dist/utils/stack.util.js.map +1 -0
- package/package.json +9 -19
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/dicoshot.service.js
CHANGED
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
+
var DicoshotService_1;
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
16
|
exports.DicoshotService = void 0;
|
|
16
17
|
const common_1 = require("@nestjs/common");
|
|
@@ -22,24 +23,32 @@ const COLOR_MAP = {
|
|
|
22
23
|
warning: 0xfee75c,
|
|
23
24
|
info: 0x5865f2,
|
|
24
25
|
};
|
|
25
|
-
let DicoshotService = class DicoshotService {
|
|
26
|
+
let DicoshotService = DicoshotService_1 = class DicoshotService {
|
|
26
27
|
client;
|
|
28
|
+
logger = new common_1.Logger(DicoshotService_1.name);
|
|
27
29
|
constructor(client) {
|
|
28
30
|
this.client = client;
|
|
29
31
|
}
|
|
30
32
|
async send(message) {
|
|
31
|
-
|
|
33
|
+
try {
|
|
34
|
+
await this.client.send(message);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
this.logger.warn(`Failed to send Discord message: ${err.message}`);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
|
-
async sendCustom({ title, description, color }) {
|
|
42
|
+
async sendCustom({ title, description, color, fields, mention, }) {
|
|
34
43
|
const resolvedColor = typeof color === 'string' ? COLOR_MAP[color] : color;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
const resolvedDescription = [description, mention].filter(Boolean).join('\n') || undefined;
|
|
45
|
+
return this.send({
|
|
46
|
+
embeds: [{ title, description: resolvedDescription, color: resolvedColor, fields }],
|
|
47
|
+
});
|
|
39
48
|
}
|
|
40
49
|
};
|
|
41
50
|
exports.DicoshotService = DicoshotService;
|
|
42
|
-
exports.DicoshotService = DicoshotService = __decorate([
|
|
51
|
+
exports.DicoshotService = DicoshotService = DicoshotService_1 = __decorate([
|
|
43
52
|
(0, common_1.Injectable)(),
|
|
44
53
|
__param(0, (0, common_1.Inject)(dicoshot_constants_1.DICOSHOT_CLIENT)),
|
|
45
54
|
__metadata("design:paramtypes", [dicoshot_core_1.DicoshotClientImpl])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dicoshot.service.js","sourceRoot":"","sources":["../src/dicoshot.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dicoshot.service.js","sourceRoot":"","sources":["../src/dicoshot.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAG5D,iDAAmD;AAEnD,6DAAuD;AAYvD,MAAM,SAAS,GAAgC;IAC7C,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;CACf,CAAC;AAGK,IAAM,eAAe,uBAArB,MAAM,eAAe;IAG4B;IAFrC,MAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAE3D,YAAsD,MAA0B;QAA1B,WAAM,GAAN,MAAM,CAAoB;IAAG,CAAC;IAMpF,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAoC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9E,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EACf,KAAK,EACL,WAAW,EACX,KAAK,EACL,MAAM,EACN,OAAO,GACc;QACrB,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3E,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;QAE3F,OAAO,IAAI,CAAC,IAAI,CAAC;YACf,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;SACpF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjCY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,oCAAe,CAAC,CAAA;qCAA0B,kCAAkB;GAHrE,eAAe,CAiC3B"}
|
|
@@ -17,6 +17,7 @@ exports.DicoshotExceptionFilter = void 0;
|
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const dicoshot_core_1 = require("dicoshot-core");
|
|
19
19
|
const dicoshot_constants_1 = require("../dicoshot.constants");
|
|
20
|
+
const stack_util_1 = require("../utils/stack.util");
|
|
20
21
|
const throttle_util_1 = require("../utils/throttle.util");
|
|
21
22
|
const ERROR_COLOR = 0xed4245;
|
|
22
23
|
let DicoshotExceptionFilter = DicoshotExceptionFilter_1 = class DicoshotExceptionFilter {
|
|
@@ -52,6 +53,8 @@ let DicoshotExceptionFilter = DicoshotExceptionFilter_1 = class DicoshotExceptio
|
|
|
52
53
|
return filter;
|
|
53
54
|
}
|
|
54
55
|
shouldNotify(exception, request, status, opts) {
|
|
56
|
+
if (status < (opts.minStatus ?? 500))
|
|
57
|
+
return false;
|
|
55
58
|
if (opts.ignore?.includes(status))
|
|
56
59
|
return false;
|
|
57
60
|
if (opts.environment) {
|
|
@@ -79,18 +82,23 @@ let DicoshotExceptionFilter = DicoshotExceptionFilter_1 = class DicoshotExceptio
|
|
|
79
82
|
const errorMessage = exception instanceof Error ? exception.message : String(exception);
|
|
80
83
|
const stack = exception instanceof Error ? exception.stack : undefined;
|
|
81
84
|
const now = new Date().toISOString();
|
|
85
|
+
const msg = (0, dicoshot_core_1.getMessages)(this.options.locale);
|
|
82
86
|
const fields = [
|
|
83
|
-
{ name:
|
|
84
|
-
{ name:
|
|
85
|
-
{ name:
|
|
86
|
-
{ name:
|
|
87
|
-
{ name:
|
|
87
|
+
{ name: msg.field.service, value: appName, inline: true },
|
|
88
|
+
{ name: msg.field.environment, value: env, inline: true },
|
|
89
|
+
{ name: msg.field.status, value: String(status), inline: true },
|
|
90
|
+
{ name: msg.field.method, value: request.method, inline: true },
|
|
91
|
+
{ name: msg.field.path, value: request.path, inline: true },
|
|
88
92
|
];
|
|
93
|
+
const location = stack_util_1.StackUtil.extractLocation(stack);
|
|
94
|
+
if (location) {
|
|
95
|
+
fields.push({ name: msg.field.location, value: `\`${location}\``, inline: false });
|
|
96
|
+
}
|
|
89
97
|
if (opts.includeRequest !== false) {
|
|
90
98
|
const body = request.body;
|
|
91
99
|
if (body && typeof body === 'object' && Object.keys(body).length > 0) {
|
|
92
100
|
fields.push({
|
|
93
|
-
name:
|
|
101
|
+
name: msg.field.requestBody,
|
|
94
102
|
value: `\`\`\`json\n${JSON.stringify(body).slice(0, 900)}\n\`\`\``,
|
|
95
103
|
inline: false,
|
|
96
104
|
});
|
|
@@ -98,7 +106,7 @@ let DicoshotExceptionFilter = DicoshotExceptionFilter_1 = class DicoshotExceptio
|
|
|
98
106
|
}
|
|
99
107
|
if (opts.includeStack !== false && stack) {
|
|
100
108
|
fields.push({
|
|
101
|
-
name:
|
|
109
|
+
name: msg.field.stackTrace,
|
|
102
110
|
value: `\`\`\`\n${stack.slice(0, 1000)}\n\`\`\``,
|
|
103
111
|
inline: false,
|
|
104
112
|
});
|
|
@@ -111,7 +119,7 @@ let DicoshotExceptionFilter = DicoshotExceptionFilter_1 = class DicoshotExceptio
|
|
|
111
119
|
fields,
|
|
112
120
|
timestamp: now,
|
|
113
121
|
};
|
|
114
|
-
await this.client.sendTo(webhookUrl, {
|
|
122
|
+
await this.client.sendTo(webhookUrl, { embeds: [embed] });
|
|
115
123
|
}
|
|
116
124
|
};
|
|
117
125
|
exports.DicoshotExceptionFilter = DicoshotExceptionFilter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dicoshot-exception.filter.js","sourceRoot":"","sources":["../../src/filters/dicoshot-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAOwB;AAGxB,
|
|
1
|
+
{"version":3,"file":"dicoshot-exception.filter.js","sourceRoot":"","sources":["../../src/filters/dicoshot-exception.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAOwB;AAGxB,iDAAgE;AAIhE,8DAA0E;AAC1E,oDAAgD;AAChD,0DAAsD;AAEtD,MAAM,WAAW,GAAG,QAAQ,CAAC;AAGtB,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAIU;IACC;IAJ5B,MAAM,GAAG,IAAI,eAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnE,YAC4C,MAA0B,EACzB,OAAwB;QADzB,WAAM,GAAN,MAAM,CAAoB;QACzB,YAAO,GAAP,OAAO,CAAiB;IAClE,CAAC;IAEJ,KAAK,CAAC,SAAkB,EAAE,IAAmB;QAE3C,IAAI,IAAI,CAAC,OAAO,EAAU,KAAK,MAAM;YAAE,OAAO;QAE9C,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,EAAW,CAAC;QAE1C,MAAM,MAAM,GAAG,SAAS,YAAY,sBAAa,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAEhF,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,C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;GAJ3D,uBAAuB,CAiInC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DICOSHOT_OPTIONS } from './dicoshot.constants';
|
|
2
|
+
export type { DicoshotNotifyOptions, DicoshotNotifyResolver } from './decorators/dicoshot-notify.decorator';
|
|
3
|
+
export { DicoshotNotify } from './decorators/dicoshot-notify.decorator';
|
|
2
4
|
export { DicoshotListener } from './dicoshot.listener';
|
|
5
|
+
export { DicoshotModule } from './dicoshot.module';
|
|
6
|
+
export type { ColorPreset, CustomMessageOptions } from './dicoshot.service';
|
|
3
7
|
export { DicoshotService } from './dicoshot.service';
|
|
4
8
|
export { DicoshotExceptionFilter } from './filters/dicoshot-exception.filter';
|
|
9
|
+
export { DicoshotNotifyInterceptor } from './interceptors/dicoshot-notify.interceptor';
|
|
5
10
|
export { DicoshotInterceptor } from './interceptors/dicoshot.interceptor';
|
|
6
|
-
export {
|
|
7
|
-
export type { DicoshotOptions, FilterOptions, InterceptorOptions, DicoshotWebhooks, RetryOptions } from 'dicoshot-core';
|
|
8
|
-
export type { CustomMessageOptions, ColorPreset } from './dicoshot.service';
|
|
11
|
+
export type { DicoshotMessages, DicoshotOptions, DicoshotWebhooks, DiscordEmbed, DiscordField, DiscordMessage, FilterOptions, InterceptorOptions, Locale, RetryOptions, } from 'dicoshot-core';
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.DicoshotInterceptor = exports.DicoshotNotifyInterceptor = exports.DicoshotExceptionFilter = exports.DicoshotService = exports.DicoshotModule = exports.DicoshotListener = exports.DicoshotNotify = exports.DICOSHOT_OPTIONS = void 0;
|
|
4
|
+
var dicoshot_constants_1 = require("./dicoshot.constants");
|
|
5
|
+
Object.defineProperty(exports, "DICOSHOT_OPTIONS", { enumerable: true, get: function () { return dicoshot_constants_1.DICOSHOT_OPTIONS; } });
|
|
6
|
+
var dicoshot_notify_decorator_1 = require("./decorators/dicoshot-notify.decorator");
|
|
7
|
+
Object.defineProperty(exports, "DicoshotNotify", { enumerable: true, get: function () { return dicoshot_notify_decorator_1.DicoshotNotify; } });
|
|
6
8
|
var dicoshot_listener_1 = require("./dicoshot.listener");
|
|
7
9
|
Object.defineProperty(exports, "DicoshotListener", { enumerable: true, get: function () { return dicoshot_listener_1.DicoshotListener; } });
|
|
10
|
+
var dicoshot_module_1 = require("./dicoshot.module");
|
|
11
|
+
Object.defineProperty(exports, "DicoshotModule", { enumerable: true, get: function () { return dicoshot_module_1.DicoshotModule; } });
|
|
8
12
|
var dicoshot_service_1 = require("./dicoshot.service");
|
|
9
13
|
Object.defineProperty(exports, "DicoshotService", { enumerable: true, get: function () { return dicoshot_service_1.DicoshotService; } });
|
|
10
14
|
var dicoshot_exception_filter_1 = require("./filters/dicoshot-exception.filter");
|
|
11
15
|
Object.defineProperty(exports, "DicoshotExceptionFilter", { enumerable: true, get: function () { return dicoshot_exception_filter_1.DicoshotExceptionFilter; } });
|
|
16
|
+
var dicoshot_notify_interceptor_1 = require("./interceptors/dicoshot-notify.interceptor");
|
|
17
|
+
Object.defineProperty(exports, "DicoshotNotifyInterceptor", { enumerable: true, get: function () { return dicoshot_notify_interceptor_1.DicoshotNotifyInterceptor; } });
|
|
12
18
|
var dicoshot_interceptor_1 = require("./interceptors/dicoshot.interceptor");
|
|
13
19
|
Object.defineProperty(exports, "DicoshotInterceptor", { enumerable: true, get: function () { return dicoshot_interceptor_1.DicoshotInterceptor; } });
|
|
14
|
-
var dicoshot_constants_1 = require("./dicoshot.constants");
|
|
15
|
-
Object.defineProperty(exports, "DICOSHOT_OPTIONS", { enumerable: true, get: function () { return dicoshot_constants_1.DICOSHOT_OPTIONS; } });
|
|
16
20
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AAEzB,oFAAwE;AAA/D,2HAAA,cAAc,OAAA;AACvB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAEvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,iFAA8E;AAArE,oIAAA,uBAAuB,OAAA;AAChC,0FAAuF;AAA9E,wIAAA,yBAAyB,OAAA;AAClC,4EAA0E;AAAjE,2HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { DicoshotService } from '../dicoshot.service';
|
|
5
|
+
export declare class DicoshotNotifyInterceptor implements NestInterceptor {
|
|
6
|
+
private readonly reflector;
|
|
7
|
+
private readonly dicoshot;
|
|
8
|
+
constructor(reflector: Reflector, dicoshot: DicoshotService);
|
|
9
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DicoshotNotifyInterceptor = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
15
|
+
const operators_1 = require("rxjs/operators");
|
|
16
|
+
const dicoshot_constants_1 = require("../dicoshot.constants");
|
|
17
|
+
const dicoshot_service_1 = require("../dicoshot.service");
|
|
18
|
+
let DicoshotNotifyInterceptor = class DicoshotNotifyInterceptor {
|
|
19
|
+
reflector;
|
|
20
|
+
dicoshot;
|
|
21
|
+
constructor(reflector, dicoshot) {
|
|
22
|
+
this.reflector = reflector;
|
|
23
|
+
this.dicoshot = dicoshot;
|
|
24
|
+
}
|
|
25
|
+
intercept(context, next) {
|
|
26
|
+
const options = this.reflector.get(dicoshot_constants_1.DICOSHOT_NOTIFY_METADATA, context.getHandler());
|
|
27
|
+
if (!options)
|
|
28
|
+
return next.handle();
|
|
29
|
+
const args = context.getArgs();
|
|
30
|
+
return next.handle().pipe((0, operators_1.tap)((result) => {
|
|
31
|
+
const title = typeof options.title === 'function' ? options.title(args, result) : options.title;
|
|
32
|
+
const description = typeof options.description === 'function'
|
|
33
|
+
? options.description(args, result)
|
|
34
|
+
: options.description;
|
|
35
|
+
void this.dicoshot.sendCustom({ title, description, color: options.color });
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.DicoshotNotifyInterceptor = DicoshotNotifyInterceptor;
|
|
40
|
+
exports.DicoshotNotifyInterceptor = DicoshotNotifyInterceptor = __decorate([
|
|
41
|
+
(0, common_1.Injectable)(),
|
|
42
|
+
__metadata("design:paramtypes", [core_1.Reflector,
|
|
43
|
+
dicoshot_service_1.DicoshotService])
|
|
44
|
+
], DicoshotNotifyInterceptor);
|
|
45
|
+
//# sourceMappingURL=dicoshot-notify.interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dicoshot-notify.interceptor.js","sourceRoot":"","sources":["../../src/interceptors/dicoshot-notify.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4F;AAC5F,uCAAyC;AAGzC,8CAAqC;AAGrC,8DAAiE;AACjE,0DAAsD;AAG/C,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAEjB;IACA;IAFnB,YACmB,SAAoB,EACpB,QAAyB;QADzB,cAAS,GAAT,SAAS,CAAW;QACpB,aAAQ,GAAR,QAAQ,CAAiB;IACzC,CAAC;IAEJ,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAChC,6CAAwB,EACxB,OAAO,CAAC,UAAU,EAAE,CACrB,CAAC;QAEF,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QAE/B,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC,CAAC,MAAM,EAAE,EAAE;YACb,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YAChG,MAAM,WAAW,GACf,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU;gBACvC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC;gBACnC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;YAG1B,KAAK,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9E,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AA7BY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAGmB,gBAAS;QACV,kCAAe;GAHjC,yBAAyB,CA6BrC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
2
|
import type { DicoshotOptions } from 'dicoshot-core';
|
|
4
3
|
import { DicoshotClientImpl } from 'dicoshot-core';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
5
|
export declare class DicoshotInterceptor implements NestInterceptor {
|
|
6
6
|
private readonly client;
|
|
7
7
|
private readonly options;
|
|
@@ -15,10 +15,11 @@ var DicoshotInterceptor_1;
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.DicoshotInterceptor = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
+
const dicoshot_core_1 = require("dicoshot-core");
|
|
18
19
|
const rxjs_1 = require("rxjs");
|
|
19
20
|
const operators_1 = require("rxjs/operators");
|
|
20
|
-
const dicoshot_core_1 = require("dicoshot-core");
|
|
21
21
|
const dicoshot_constants_1 = require("../dicoshot.constants");
|
|
22
|
+
const stack_util_1 = require("../utils/stack.util");
|
|
22
23
|
const SLOW_COLOR = 0xfee75c;
|
|
23
24
|
const ERROR_COLOR = 0xed4245;
|
|
24
25
|
let DicoshotInterceptor = DicoshotInterceptor_1 = class DicoshotInterceptor {
|
|
@@ -48,8 +49,11 @@ let DicoshotInterceptor = DicoshotInterceptor_1 = class DicoshotInterceptor {
|
|
|
48
49
|
}
|
|
49
50
|
}), (0, operators_1.catchError)((err) => {
|
|
50
51
|
if (!this.options.filter) {
|
|
51
|
-
const
|
|
52
|
-
|
|
52
|
+
const status = err instanceof common_1.HttpException ? err.getStatus() : 500;
|
|
53
|
+
if (status >= (opts.minStatus ?? 500)) {
|
|
54
|
+
const duration = Date.now() - start;
|
|
55
|
+
this.notifyError(request, err, duration).catch((e) => this.logger.warn(`Failed to send error notification: ${e.message}`));
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
return (0, rxjs_1.throwError)(() => err);
|
|
55
59
|
}));
|
|
@@ -69,22 +73,20 @@ let DicoshotInterceptor = DicoshotInterceptor_1 = class DicoshotInterceptor {
|
|
|
69
73
|
const env = process.env.NODE_ENV ?? 'development';
|
|
70
74
|
const appName = this.options.applicationName ?? 'Unknown';
|
|
71
75
|
const now = new Date().toISOString();
|
|
76
|
+
const msg = (0, dicoshot_core_1.getMessages)(this.options.locale);
|
|
72
77
|
const embed = {
|
|
73
|
-
title: `🐢 [${env}] ${appName} —
|
|
78
|
+
title: `🐢 [${env}] ${appName} — ${msg.slowResponseLabel}`,
|
|
74
79
|
color: SLOW_COLOR,
|
|
75
80
|
fields: [
|
|
76
|
-
{ name:
|
|
77
|
-
{ name:
|
|
78
|
-
{ name:
|
|
79
|
-
{ name:
|
|
80
|
-
{ name:
|
|
81
|
+
{ name: msg.field.service, value: appName, inline: true },
|
|
82
|
+
{ name: msg.field.environment, value: env, inline: true },
|
|
83
|
+
{ name: msg.field.method, value: request.method, inline: true },
|
|
84
|
+
{ name: msg.field.path, value: request.path, inline: true },
|
|
85
|
+
{ name: msg.field.duration, value: `${duration}ms`, inline: true },
|
|
81
86
|
],
|
|
82
87
|
timestamp: now,
|
|
83
88
|
};
|
|
84
|
-
await this.client.sendTo(webhookUrl, {
|
|
85
|
-
username: this.options.username,
|
|
86
|
-
embeds: [embed],
|
|
87
|
-
});
|
|
89
|
+
await this.client.sendTo(webhookUrl, { embeds: [embed] });
|
|
88
90
|
}
|
|
89
91
|
async notifyError(request, err, duration) {
|
|
90
92
|
const webhookUrl = this.options.webhooks?.error ?? this.options.webhookUrl;
|
|
@@ -96,24 +98,35 @@ let DicoshotInterceptor = DicoshotInterceptor_1 = class DicoshotInterceptor {
|
|
|
96
98
|
const appName = this.options.applicationName ?? 'Unknown';
|
|
97
99
|
const errorName = err instanceof Error ? err.constructor.name : 'UnknownError';
|
|
98
100
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
101
|
+
const stack = err instanceof Error ? err.stack : undefined;
|
|
99
102
|
const now = new Date().toISOString();
|
|
103
|
+
const msg = (0, dicoshot_core_1.getMessages)(this.options.locale);
|
|
104
|
+
const fields = [
|
|
105
|
+
{ name: msg.field.service, value: appName, inline: true },
|
|
106
|
+
{ name: msg.field.environment, value: env, inline: true },
|
|
107
|
+
{ name: msg.field.method, value: request.method, inline: true },
|
|
108
|
+
{ name: msg.field.path, value: request.path, inline: true },
|
|
109
|
+
{ name: msg.field.duration, value: `${duration}ms`, inline: true },
|
|
110
|
+
];
|
|
111
|
+
const location = stack_util_1.StackUtil.extractLocation(stack);
|
|
112
|
+
if (location) {
|
|
113
|
+
fields.push({ name: msg.field.location, value: `\`${location}\``, inline: false });
|
|
114
|
+
}
|
|
115
|
+
if (stack) {
|
|
116
|
+
fields.push({
|
|
117
|
+
name: msg.field.stackTrace,
|
|
118
|
+
value: `\`\`\`\n${stack.slice(0, 1000)}\n\`\`\``,
|
|
119
|
+
inline: false,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
100
122
|
const embed = {
|
|
101
123
|
title: `🚨 [${env}] ${appName} — ${errorName}`,
|
|
102
124
|
description: `\`${errorMessage}\``,
|
|
103
125
|
color: ERROR_COLOR,
|
|
104
|
-
fields
|
|
105
|
-
{ name: 'Service', value: appName, inline: true },
|
|
106
|
-
{ name: 'Environment', value: env, inline: true },
|
|
107
|
-
{ name: 'Method', value: request.method, inline: true },
|
|
108
|
-
{ name: 'Path', value: request.path, inline: true },
|
|
109
|
-
{ name: 'Duration', value: `${duration}ms`, inline: true },
|
|
110
|
-
],
|
|
126
|
+
fields,
|
|
111
127
|
timestamp: now,
|
|
112
128
|
};
|
|
113
|
-
await this.client.sendTo(webhookUrl, {
|
|
114
|
-
username: this.options.username,
|
|
115
|
-
embeds: [embed],
|
|
116
|
-
});
|
|
129
|
+
await this.client.sendTo(webhookUrl, { embeds: [embed] });
|
|
117
130
|
}
|
|
118
131
|
};
|
|
119
132
|
exports.DicoshotInterceptor = DicoshotInterceptor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dicoshot.interceptor.js","sourceRoot":"","sources":["../../src/interceptors/dicoshot.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"dicoshot.interceptor.js","sourceRoot":"","sources":["../../src/interceptors/dicoshot.interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAQwB;AAGxB,iDAAgE;AAGhE,+BAA8C;AAC9C,8CAAiD;AAEjD,8DAA0E;AAC1E,oDAAgD;AAEhD,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC;AAGtB,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAIc;IACC;IAJ5B,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAE/D,YAC4C,MAA0B,EACzB,OAAwB;QADzB,WAAM,GAAN,MAAM,CAAoB;QACzB,YAAO,GAAP,OAAO,CAAiB;IAClE,CAAC;IAEJ,SAAS,CAAC,OAAyB,EAAE,IAAiB;QAEpD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QAEpD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAW,CAAC;QAC7D,MAAM,IAAI,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AAE,KAAK,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU;gBAC1B,KAAK,EAAE,WAAW,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU;gBAChD,MAAM,EAAE,KAAK;aACd,CAAC,CAAC;QACL,CAAC;QAED,MAAM,KAAK,GAAiB;YAC1B,KAAK,EAAE,OAAO,GAAG,KAAK,OAAO,MAAM,SAAS,EAAE;YAC9C,WAAW,EAAE,KAAK,YAAY,IAAI;YAClC,KAAK,EAAE,WAAW;YAClB,MAAM;YACN,SAAS,EAAE,GAAG;SACf,CAAC;QAEF,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF,CAAA;AA/HY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,oCAAe,CAAC,CAAA;IACvB,WAAA,IAAA,eAAM,EAAC,qCAAgB,CAAC,CAAA;qCADyB,kCAAkB;GAJ3D,mBAAmB,CA+H/B"}
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAE3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC7C,CAAC;AACD,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StackUtil = void 0;
|
|
4
|
+
class StackUtil {
|
|
5
|
+
static extractLocation(stack) {
|
|
6
|
+
if (!stack)
|
|
7
|
+
return undefined;
|
|
8
|
+
const frame = stack
|
|
9
|
+
.split('\n')
|
|
10
|
+
.slice(1)
|
|
11
|
+
.map((line) => line.trim())
|
|
12
|
+
.find((line) => line.startsWith('at '));
|
|
13
|
+
if (!frame)
|
|
14
|
+
return undefined;
|
|
15
|
+
const parenMatch = frame.match(/\(([^)]+)\)\s*$/);
|
|
16
|
+
return parenMatch ? parenMatch[1] : frame.replace(/^at\s+/, '');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.StackUtil = StackUtil;
|
|
20
|
+
//# sourceMappingURL=stack.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.util.js","sourceRoot":"","sources":["../../src/utils/stack.util.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAEpB,MAAM,CAAC,eAAe,CAAC,KAAyB;QAC9C,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC;QAE7B,MAAM,KAAK,GAAG,KAAK;aAChB,KAAK,CAAC,IAAI,CAAC;aACX,KAAK,CAAC,CAAC,CAAC;aACR,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC;QAE7B,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAClD,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;CACF;AAfD,8BAeC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dicoshot-nest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"private": false,
|
|
@@ -9,15 +9,13 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "MIT",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "nest build",
|
|
15
|
-
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
16
15
|
"start": "nest start",
|
|
17
16
|
"start:dev": "nest start --watch",
|
|
18
17
|
"start:debug": "nest start --debug --watch",
|
|
19
18
|
"start:prod": "node dist/main",
|
|
20
|
-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
21
19
|
"test": "jest",
|
|
22
20
|
"test:watch": "jest --watch",
|
|
23
21
|
"test:cov": "jest --coverage",
|
|
@@ -25,41 +23,33 @@
|
|
|
25
23
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
26
24
|
},
|
|
27
25
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"@nestjs/core": "^11.0.1",
|
|
30
|
-
"@nestjs/platform-express": "^11.0.1",
|
|
31
|
-
"dicoshot-core": "*",
|
|
26
|
+
"dicoshot-core": "^0.2.0",
|
|
32
27
|
"reflect-metadata": "^0.2.2",
|
|
33
28
|
"rxjs": "^7.8.1"
|
|
34
29
|
},
|
|
35
30
|
"peerDependencies": {
|
|
36
|
-
"@nestjs/common": "^10",
|
|
37
|
-
"@nestjs/core": "^10"
|
|
31
|
+
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
32
|
+
"@nestjs/core": "^10.0.0 || ^11.0.0"
|
|
38
33
|
},
|
|
39
34
|
"devDependencies": {
|
|
40
|
-
"@eslint/eslintrc": "^3.2.0",
|
|
41
|
-
"@eslint/js": "^9.18.0",
|
|
42
35
|
"@nestjs/cli": "^11.0.0",
|
|
36
|
+
"@nestjs/common": "^11.0.1",
|
|
37
|
+
"@nestjs/core": "^11.0.1",
|
|
38
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
43
39
|
"@nestjs/schematics": "^11.0.0",
|
|
44
40
|
"@nestjs/testing": "^11.0.1",
|
|
45
41
|
"@types/express": "^5.0.0",
|
|
46
42
|
"@types/jest": "^30.0.0",
|
|
47
43
|
"@types/node": "^24.0.0",
|
|
48
44
|
"@types/supertest": "^7.0.0",
|
|
49
|
-
"eslint": "^9.18.0",
|
|
50
|
-
"eslint-config-prettier": "^10.0.1",
|
|
51
|
-
"eslint-plugin-prettier": "^5.2.2",
|
|
52
|
-
"globals": "^17.0.0",
|
|
53
45
|
"jest": "^30.0.0",
|
|
54
|
-
"prettier": "^3.4.2",
|
|
55
46
|
"source-map-support": "^0.5.21",
|
|
56
47
|
"supertest": "^7.0.0",
|
|
57
48
|
"ts-jest": "^29.2.5",
|
|
58
49
|
"ts-loader": "^9.5.2",
|
|
59
50
|
"ts-node": "^10.9.2",
|
|
60
51
|
"tsconfig-paths": "^4.2.0",
|
|
61
|
-
"typescript": "^5.7.3"
|
|
62
|
-
"typescript-eslint": "^8.20.0"
|
|
52
|
+
"typescript": "^5.7.3"
|
|
63
53
|
},
|
|
64
54
|
"jest": {
|
|
65
55
|
"moduleFileExtensions": [
|