@campxdev/server-shared 2.1.38 → 2.1.39
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/dist/common/index.d.ts +0 -1
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +0 -1
- package/dist/common/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sentry/index.d.ts +6 -0
- package/dist/sentry/index.d.ts.map +1 -0
- package/dist/{observability → sentry}/index.js +5 -4
- package/dist/sentry/index.js.map +1 -0
- package/dist/sentry/sentry-http.filter.d.ts +6 -0
- package/dist/sentry/sentry-http.filter.d.ts.map +1 -0
- package/dist/sentry/sentry-http.filter.js +89 -0
- package/dist/sentry/sentry-http.filter.js.map +1 -0
- package/dist/sentry/sentry-rpc.filter.d.ts +5 -0
- package/dist/sentry/sentry-rpc.filter.d.ts.map +1 -0
- package/dist/sentry/sentry-rpc.filter.js +79 -0
- package/dist/sentry/sentry-rpc.filter.js.map +1 -0
- package/dist/sentry/sentry-sqs.util.d.ts +8 -0
- package/dist/sentry/sentry-sqs.util.d.ts.map +1 -0
- package/dist/sentry/sentry-sqs.util.js +67 -0
- package/dist/sentry/sentry-sqs.util.js.map +1 -0
- package/dist/sentry/sentry.module.d.ts +21 -0
- package/dist/sentry/sentry.module.d.ts.map +1 -0
- package/dist/sentry/sentry.module.js +103 -0
- package/dist/sentry/sentry.module.js.map +1 -0
- package/dist/sentry/sentry.service.d.ts +21 -0
- package/dist/sentry/sentry.service.d.ts.map +1 -0
- package/dist/{observability/telemetry.service.js → sentry/sentry.service.js} +45 -26
- package/dist/sentry/sentry.service.js.map +1 -0
- package/package.json +3 -13
- package/dist/common/filters/unhandled-exception.filter.d.ts +0 -12
- package/dist/common/filters/unhandled-exception.filter.d.ts.map +0 -1
- package/dist/common/filters/unhandled-exception.filter.js +0 -46
- package/dist/common/filters/unhandled-exception.filter.js.map +0 -1
- package/dist/observability/index.d.ts +0 -5
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js.map +0 -1
- package/dist/observability/telemetry.module.d.ts +0 -4
- package/dist/observability/telemetry.module.d.ts.map +0 -1
- package/dist/observability/telemetry.module.js +0 -33
- package/dist/observability/telemetry.module.js.map +0 -1
- package/dist/observability/telemetry.service.d.ts +0 -10
- package/dist/observability/telemetry.service.d.ts.map +0 -1
- package/dist/observability/telemetry.service.js.map +0 -1
- package/dist/observability/traced.decorator.d.ts +0 -6
- package/dist/observability/traced.decorator.d.ts.map +0 -1
- package/dist/observability/traced.decorator.js +0 -51
- package/dist/observability/traced.decorator.js.map +0 -1
- package/dist/observability/tracing.interceptor.d.ts +0 -14
- package/dist/observability/tracing.interceptor.d.ts.map +0 -1
- package/dist/observability/tracing.interceptor.js +0 -119
- package/dist/observability/tracing.interceptor.js.map +0 -1
- package/dist/otel-sdk.d.ts +0 -10
- package/dist/otel-sdk.d.ts.map +0 -1
- package/dist/otel-sdk.js +0 -154
- package/dist/otel-sdk.js.map +0 -1
package/dist/common/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './decorators/batch-validation.decorator';
|
|
2
2
|
export * from './decorators/request.decorators';
|
|
3
3
|
export * from './decorators/time-validation.decorator';
|
|
4
|
-
export * from './filters/unhandled-exception.filter';
|
|
5
4
|
export * from './guards/guard';
|
|
6
5
|
export * from './interceptors/request.interceptor';
|
|
7
6
|
export * from './interfaces/context.interface';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
|
package/dist/common/index.js
CHANGED
|
@@ -17,7 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./decorators/batch-validation.decorator"), exports);
|
|
18
18
|
__exportStar(require("./decorators/request.decorators"), exports);
|
|
19
19
|
__exportStar(require("./decorators/time-validation.decorator"), exports);
|
|
20
|
-
__exportStar(require("./filters/unhandled-exception.filter"), exports);
|
|
21
20
|
__exportStar(require("./guards/guard"), exports);
|
|
22
21
|
__exportStar(require("./interceptors/request.interceptor"), exports);
|
|
23
22
|
__exportStar(require("./interfaces/context.interface"), exports);
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0EAAwD;AACxD,kEAAgD;AAChD,yEAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0EAAwD;AACxD,kEAAgD;AAChD,yEAAuD;AACvD,iDAA+B;AAC/B,qEAAmD;AACnD,iEAA+C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './metrics';
|
|
|
10
10
|
export * from './microsoft';
|
|
11
11
|
export * from './modules-handler';
|
|
12
12
|
export * from './oauth-clients';
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './sentry';
|
|
14
14
|
export * from './permissions';
|
|
15
15
|
export * from './production-logger';
|
|
16
16
|
export * from './request-store';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __exportStar(require("./metrics"), exports);
|
|
|
26
26
|
__exportStar(require("./microsoft"), exports);
|
|
27
27
|
__exportStar(require("./modules-handler"), exports);
|
|
28
28
|
__exportStar(require("./oauth-clients"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./sentry"), exports);
|
|
30
30
|
__exportStar(require("./permissions"), exports);
|
|
31
31
|
__exportStar(require("./production-logger"), exports);
|
|
32
32
|
__exportStar(require("./request-store"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,+DAA6C;AAC7C,yDAAuC;AACvC,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,+DAA6C;AAC7C,yDAAuC;AACvC,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B;AAC9B,sDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAC9B,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sentry/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./sentry.module"), exports);
|
|
18
|
+
__exportStar(require("./sentry.service"), exports);
|
|
19
|
+
__exportStar(require("./sentry-http.filter"), exports);
|
|
20
|
+
__exportStar(require("./sentry-rpc.filter"), exports);
|
|
21
|
+
__exportStar(require("./sentry-sqs.util"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sentry/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,uDAAqC;AACrC,sDAAoC;AACpC,oDAAkC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
|
|
2
|
+
import { Response } from 'express';
|
|
3
|
+
export declare class SentryHttpFilter implements ExceptionFilter {
|
|
4
|
+
catch(exception: any, host: ArgumentsHost): Response<any, Record<string, any>>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=sentry-http.filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-http.filter.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry-http.filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,eAAe,EAA6B,MAAM,gBAAgB,CAAC;AAElG,OAAO,EAAW,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C,qBACa,gBAAiB,YAAW,eAAe;IACtD,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa;CA4C1C"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.SentryHttpFilter = void 0;
|
|
43
|
+
const common_1 = require("@nestjs/common");
|
|
44
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
45
|
+
const tenant_context_1 = require("../request-store/contexts/tenant-context");
|
|
46
|
+
const user_context_1 = require("../request-store/contexts/user-context");
|
|
47
|
+
let SentryHttpFilter = class SentryHttpFilter {
|
|
48
|
+
catch(exception, host) {
|
|
49
|
+
const ctx = host.switchToHttp();
|
|
50
|
+
const response = ctx.getResponse();
|
|
51
|
+
const request = ctx.getRequest();
|
|
52
|
+
const status = exception instanceof common_1.HttpException ? exception.getStatus() : common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
53
|
+
/** Only capture 500 errors or actual non-HTTP exceptions in Sentry by default,
|
|
54
|
+
* or everything if you want 4xx as well.
|
|
55
|
+
*/
|
|
56
|
+
Sentry.withScope((scope) => {
|
|
57
|
+
const user = (0, user_context_1.getUserData)();
|
|
58
|
+
const tenant = (0, tenant_context_1.getTenantDetailsIfExists)();
|
|
59
|
+
if (user) {
|
|
60
|
+
scope.setUser({
|
|
61
|
+
id: String(user.userId || user.id),
|
|
62
|
+
email: user.email,
|
|
63
|
+
username: user.fullName || user.username,
|
|
64
|
+
});
|
|
65
|
+
scope.setTag('user_db_id', String(user.id));
|
|
66
|
+
}
|
|
67
|
+
if (tenant) {
|
|
68
|
+
scope.setTag('tenant_id', tenant.id);
|
|
69
|
+
scope.setTag('tenant_name', tenant.name);
|
|
70
|
+
}
|
|
71
|
+
scope.setTag('http.method', request.method);
|
|
72
|
+
scope.setTag('http.url', request.url);
|
|
73
|
+
Sentry.captureException(exception);
|
|
74
|
+
});
|
|
75
|
+
/** Re-throw or send response as Nest would */
|
|
76
|
+
if (exception instanceof common_1.HttpException) {
|
|
77
|
+
return response.status(status).json(exception.getResponse());
|
|
78
|
+
}
|
|
79
|
+
return response.status(common_1.HttpStatus.INTERNAL_SERVER_ERROR).json({
|
|
80
|
+
statusCode: common_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
81
|
+
message: exception.message || 'Internal server error',
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.SentryHttpFilter = SentryHttpFilter;
|
|
86
|
+
exports.SentryHttpFilter = SentryHttpFilter = __decorate([
|
|
87
|
+
(0, common_1.Catch)()
|
|
88
|
+
], SentryHttpFilter);
|
|
89
|
+
//# sourceMappingURL=sentry-http.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-http.filter.js","sourceRoot":"","sources":["../../src/sentry/sentry-http.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAkG;AAClG,uDAAyC;AAEzC,6EAAoF;AACpF,yEAAqE;AAG9D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,KAAK,CAAC,SAAc,EAAE,IAAmB;QACvC,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,mBAAU,CAAC,qBAAqB,CAAC;QAE7G;;WAEG;QACH,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,IAAA,0BAAW,GAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,IAAA,yCAAwB,GAAE,CAAC;YAE1C,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,OAAO,CAAC;oBACZ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;oBAClC,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ;iBACzC,CAAC,CAAC;gBACH,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;gBACrC,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3C,CAAC;YAED,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC5C,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;YAEtC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,8CAA8C;QAC9C,IAAI,SAAS,YAAY,sBAAa,EAAE,CAAC;YACvC,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,QAAQ,CAAC,MAAM,CAAC,mBAAU,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC;YAC5D,UAAU,EAAE,mBAAU,CAAC,qBAAqB;YAC5C,OAAO,EAAE,SAAS,CAAC,OAAO,IAAI,uBAAuB;SACtD,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA7CY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,cAAK,GAAE;GACK,gBAAgB,CA6C5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-rpc.filter.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry-rpc.filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAOvE,qBACa,eAAgB,YAAW,eAAe;IACrD,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,aAAa;CA6B1C"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.SentryRpcFilter = void 0;
|
|
43
|
+
const common_1 = require("@nestjs/common");
|
|
44
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
45
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
46
|
+
const rxjs_1 = require("rxjs");
|
|
47
|
+
const tenant_context_1 = require("../request-store/contexts/tenant-context");
|
|
48
|
+
const user_context_1 = require("../request-store/contexts/user-context");
|
|
49
|
+
let SentryRpcFilter = class SentryRpcFilter {
|
|
50
|
+
catch(exception, host) {
|
|
51
|
+
/** Report to Sentry with context */
|
|
52
|
+
Sentry.withScope((scope) => {
|
|
53
|
+
const user = (0, user_context_1.getUserData)();
|
|
54
|
+
const tenant = (0, tenant_context_1.getTenantDetailsIfExists)();
|
|
55
|
+
if (user) {
|
|
56
|
+
scope.setUser({
|
|
57
|
+
id: String(user.userId || user.id),
|
|
58
|
+
email: user.email,
|
|
59
|
+
});
|
|
60
|
+
scope.setTag('user_db_id', String(user.id));
|
|
61
|
+
}
|
|
62
|
+
if (tenant) {
|
|
63
|
+
scope.setTag('tenant_id', tenant.id);
|
|
64
|
+
}
|
|
65
|
+
scope.setTag('transport', 'microservice');
|
|
66
|
+
Sentry.captureException(exception);
|
|
67
|
+
});
|
|
68
|
+
/** Convert non-RPC exceptions to RpcException for proper RabbitMQ propagation */
|
|
69
|
+
if (!(exception instanceof microservices_1.RpcException)) {
|
|
70
|
+
return (0, rxjs_1.throwError)(() => new microservices_1.RpcException(exception.message || 'Microservice Exception'));
|
|
71
|
+
}
|
|
72
|
+
return (0, rxjs_1.throwError)(() => exception);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.SentryRpcFilter = SentryRpcFilter;
|
|
76
|
+
exports.SentryRpcFilter = SentryRpcFilter = __decorate([
|
|
77
|
+
(0, common_1.Catch)()
|
|
78
|
+
], SentryRpcFilter);
|
|
79
|
+
//# sourceMappingURL=sentry-rpc.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-rpc.filter.js","sourceRoot":"","sources":["../../src/sentry/sentry-rpc.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,yDAAqD;AACrD,uDAAyC;AACzC,+BAAkC;AAClC,6EAAoF;AACpF,yEAAqE;AAG9D,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,KAAK,CAAC,SAAc,EAAE,IAAmB;QACvC,oCAAoC;QACpC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,IAAI,GAAG,IAAA,0BAAW,GAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,IAAA,yCAAwB,GAAE,CAAC;YAE1C,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,OAAO,CAAC;oBACZ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;oBAClC,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAC;gBACH,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9C,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;YACvC,CAAC;YAED,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAC1C,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QAEH,iFAAiF;QACjF,IAAI,CAAC,CAAC,SAAS,YAAY,4BAAY,CAAC,EAAE,CAAC;YACzC,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,IAAI,4BAAY,CAAC,SAAS,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC,CAAC;QAC3F,CAAC;QAED,OAAO,IAAA,iBAAU,EAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AA9BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,cAAK,GAAE;GACK,eAAe,CA8B3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to wrap SQS message handlers with Sentry error capture.
|
|
3
|
+
* @param queueName - The name of the SQS queue.
|
|
4
|
+
* @param handler - The message processing logic.
|
|
5
|
+
* @returns A wrapped handler.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withSentrySqs(queueName: string, handler: (...args: any[]) => Promise<any>): (...args: any[]) => Promise<any>;
|
|
8
|
+
//# sourceMappingURL=sentry-sqs.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-sqs.util.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry-sqs.util.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,IAC1E,GAAG,MAAM,GAAG,EAAE,kBAuB7B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withSentrySqs = withSentrySqs;
|
|
37
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
38
|
+
/**
|
|
39
|
+
* Utility to wrap SQS message handlers with Sentry error capture.
|
|
40
|
+
* @param queueName - The name of the SQS queue.
|
|
41
|
+
* @param handler - The message processing logic.
|
|
42
|
+
* @returns A wrapped handler.
|
|
43
|
+
*/
|
|
44
|
+
function withSentrySqs(queueName, handler) {
|
|
45
|
+
return async (...args) => {
|
|
46
|
+
try {
|
|
47
|
+
Sentry.addBreadcrumb({
|
|
48
|
+
category: 'sqs',
|
|
49
|
+
message: `Processing message from queue: ${queueName}`,
|
|
50
|
+
level: 'info',
|
|
51
|
+
});
|
|
52
|
+
return await handler(...args);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
Sentry.withScope((scope) => {
|
|
56
|
+
scope.setTag('queue.name', queueName);
|
|
57
|
+
scope.setContext('sqs.message', {
|
|
58
|
+
queue: queueName,
|
|
59
|
+
payload: args[0], // Assumes message body is the first argument
|
|
60
|
+
});
|
|
61
|
+
Sentry.captureException(error);
|
|
62
|
+
});
|
|
63
|
+
throw error; // Re-throw so SQS can handle the retry/DLQ
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=sentry-sqs.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-sqs.util.js","sourceRoot":"","sources":["../../src/sentry/sentry-sqs.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,sCAwBC;AAhCD,uDAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,SAAiB,EAAE,OAAyC;IACxF,OAAO,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,CAAC,aAAa,CAAC;gBACnB,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,kCAAkC,SAAS,EAAE;gBACtD,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;YAEH,OAAO,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACtC,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE;oBAC9B,KAAK,EAAE,SAAS;oBAChB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,6CAA6C;iBAChE,CAAC,CAAC;gBAEH,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YAEH,MAAM,KAAK,CAAC,CAAC,2CAA2C;QAC1D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
export interface SentryModuleOptions {
|
|
3
|
+
dsn: string;
|
|
4
|
+
environment: string;
|
|
5
|
+
release?: string;
|
|
6
|
+
tracesSampleRate?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SentryModuleAsyncOptions {
|
|
9
|
+
imports?: any[];
|
|
10
|
+
inject?: any[];
|
|
11
|
+
useFactory: (...args: any[]) => Promise<SentryModuleOptions> | SentryModuleOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Early initialization function to be called in instrument.ts
|
|
15
|
+
*/
|
|
16
|
+
export declare function initSentry(options: SentryModuleOptions): void;
|
|
17
|
+
export declare class SentryModule {
|
|
18
|
+
static forRoot(options: SentryModuleOptions): DynamicModule;
|
|
19
|
+
static forRootAsync(options: SentryModuleAsyncOptions): DynamicModule;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sentry.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.module.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAC;AAKzE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CACpF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,mBAAmB,QAYtD;AAED,qBAKa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IAc3D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;CAiBtE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var SentryModule_1;
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.SentryModule = void 0;
|
|
44
|
+
exports.initSentry = initSentry;
|
|
45
|
+
const common_1 = require("@nestjs/common");
|
|
46
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
47
|
+
const profiling_node_1 = require("@sentry/profiling-node");
|
|
48
|
+
const sentry_service_1 = require("./sentry.service");
|
|
49
|
+
/**
|
|
50
|
+
* Early initialization function to be called in instrument.ts
|
|
51
|
+
*/
|
|
52
|
+
function initSentry(options) {
|
|
53
|
+
console.log(`[Sentry] Initializing with DSN: ${options.dsn ? 'FOUND' : 'MISSING'} in environment: ${options.environment}`);
|
|
54
|
+
if (!options.dsn)
|
|
55
|
+
return;
|
|
56
|
+
Sentry.init({
|
|
57
|
+
dsn: options.dsn,
|
|
58
|
+
environment: options.environment,
|
|
59
|
+
release: options.release,
|
|
60
|
+
tracesSampleRate: options.tracesSampleRate ?? (options.environment === 'production' ? 0.05 : 1.0),
|
|
61
|
+
integrations: [(0, profiling_node_1.nodeProfilingIntegration)()],
|
|
62
|
+
profilesSampleRate: 1.0,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
let SentryModule = SentryModule_1 = class SentryModule {
|
|
66
|
+
static forRoot(options) {
|
|
67
|
+
initSentry(options);
|
|
68
|
+
return {
|
|
69
|
+
module: SentryModule_1,
|
|
70
|
+
providers: [
|
|
71
|
+
{
|
|
72
|
+
provide: 'SENTRY_OPTIONS',
|
|
73
|
+
useValue: options,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static forRootAsync(options) {
|
|
79
|
+
const provider = {
|
|
80
|
+
provide: 'SENTRY_OPTIONS',
|
|
81
|
+
useFactory: async (...args) => {
|
|
82
|
+
const config = await options.useFactory(...args);
|
|
83
|
+
initSentry(config);
|
|
84
|
+
return config;
|
|
85
|
+
},
|
|
86
|
+
inject: options.inject || [],
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
module: SentryModule_1,
|
|
90
|
+
imports: options.imports || [],
|
|
91
|
+
providers: [provider],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.SentryModule = SentryModule;
|
|
96
|
+
exports.SentryModule = SentryModule = SentryModule_1 = __decorate([
|
|
97
|
+
(0, common_1.Global)(),
|
|
98
|
+
(0, common_1.Module)({
|
|
99
|
+
providers: [sentry_service_1.SentryService],
|
|
100
|
+
exports: [sentry_service_1.SentryService],
|
|
101
|
+
})
|
|
102
|
+
], SentryModule);
|
|
103
|
+
//# sourceMappingURL=sentry.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["../../src/sentry/sentry.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,gCAYC;AAjCD,2CAAyE;AACzE,uDAAyC;AACzC,2DAAkE;AAClE,qDAAiD;AAejD;;GAEG;AACH,SAAgB,UAAU,CAAC,OAA4B;IACrD,OAAO,CAAC,GAAG,CAAC,mCAAmC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,oBAAoB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3H,IAAI,CAAC,OAAO,CAAC,GAAG;QAAE,OAAO;IAEzB,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QACjG,YAAY,EAAE,CAAC,IAAA,yCAAwB,GAAE,CAAC;QAC1C,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC;AAOM,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,OAA4B;QACzC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEpB,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,gBAAgB;oBACzB,QAAQ,EAAE,OAAO;iBAClB;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,OAAiC;QACnD,MAAM,QAAQ,GAAa;YACzB,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;gBACnC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;gBACjD,UAAU,CAAC,MAAM,CAAC,CAAC;gBACnB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;SAC7B,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;YAC9B,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC;IACJ,CAAC;CACF,CAAA;AAhCY,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAgCxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/nestjs';
|
|
2
|
+
export declare class SentryService {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
/**
|
|
5
|
+
* Capture an exception to Sentry
|
|
6
|
+
*/
|
|
7
|
+
captureException(exception: any, context?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Add a breadcrumb to the current Sentry scope
|
|
10
|
+
*/
|
|
11
|
+
addBreadcrumb(message: string, data?: Record<string, any>, level?: Sentry.SeverityLevel): void;
|
|
12
|
+
/**
|
|
13
|
+
* Manually set user context for the current scope
|
|
14
|
+
*/
|
|
15
|
+
setUserContext(userId: string | number, tenantId?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Set additional tags for the current scope
|
|
18
|
+
*/
|
|
19
|
+
setTags(tags: Record<string, string>): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sentry.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.service.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,qBACa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEzD;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAWxD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,GAAE,MAAM,CAAC,aAAsB,GAAG,IAAI;IAQtG;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAOhE;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAG5C"}
|
|
@@ -38,36 +38,55 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
|
-
var
|
|
41
|
+
var SentryService_1;
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
43
|
+
exports.SentryService = void 0;
|
|
44
44
|
const common_1 = require("@nestjs/common");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
if (!otelSDK)
|
|
58
|
-
return;
|
|
59
|
-
this.logger.log('Shutting down OpenTelemetry SDK...');
|
|
60
|
-
/** Flush all pending spans before process termination */
|
|
61
|
-
await otelSDK.shutdown();
|
|
62
|
-
this.logger.log('OpenTelemetry SDK shutdown complete');
|
|
45
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
46
|
+
let SentryService = SentryService_1 = class SentryService {
|
|
47
|
+
logger = new common_1.Logger(SentryService_1.name);
|
|
48
|
+
/**
|
|
49
|
+
* Capture an exception to Sentry
|
|
50
|
+
*/
|
|
51
|
+
captureException(exception, context) {
|
|
52
|
+
if (context) {
|
|
53
|
+
Sentry.withScope((scope) => {
|
|
54
|
+
scope.setTag('context', context);
|
|
55
|
+
Sentry.captureException(exception);
|
|
56
|
+
});
|
|
63
57
|
}
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
else {
|
|
59
|
+
Sentry.captureException(exception);
|
|
66
60
|
}
|
|
67
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Add a breadcrumb to the current Sentry scope
|
|
64
|
+
*/
|
|
65
|
+
addBreadcrumb(message, data, level = 'info') {
|
|
66
|
+
Sentry.addBreadcrumb({
|
|
67
|
+
message,
|
|
68
|
+
data,
|
|
69
|
+
level,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Manually set user context for the current scope
|
|
74
|
+
*/
|
|
75
|
+
setUserContext(userId, tenantId) {
|
|
76
|
+
Sentry.setUser({
|
|
77
|
+
id: String(userId),
|
|
78
|
+
tenant: tenantId,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Set additional tags for the current scope
|
|
83
|
+
*/
|
|
84
|
+
setTags(tags) {
|
|
85
|
+
Sentry.setTags(tags);
|
|
86
|
+
}
|
|
68
87
|
};
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
88
|
+
exports.SentryService = SentryService;
|
|
89
|
+
exports.SentryService = SentryService = SentryService_1 = __decorate([
|
|
71
90
|
(0, common_1.Injectable)()
|
|
72
|
-
],
|
|
73
|
-
//# sourceMappingURL=
|
|
91
|
+
], SentryService);
|
|
92
|
+
//# sourceMappingURL=sentry.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.service.js","sourceRoot":"","sources":["../../src/sentry/sentry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uDAAyC;AAGlC,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACP,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,gBAAgB,CAAC,SAAc,EAAE,OAAgB;QAC/C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBACjC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAe,EAAE,IAA0B,EAAE,QAA8B,MAAM;QAC7F,MAAM,CAAC,aAAa,CAAC;YACnB,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,MAAuB,EAAE,QAAiB;QACvD,MAAM,CAAC,OAAO,CAAC;YACb,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC;YAClB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAA4B;QAClC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;CACF,CAAA;AA5CY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA4CzB"}
|