@rxap/nest-sentry 9.0.3-dev.5 → 9.1.0-dev.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/CHANGELOG.md +19 -34
- package/README.md +9 -8
- package/package.json +37 -29
- package/src/index.js.map +1 -1
- package/src/lib/sentry.interceptor.js +4 -6
- package/src/lib/sentry.interceptor.js.map +1 -1
- package/src/lib/sentry.interfaces.d.ts +3 -3
- package/src/lib/sentry.interfaces.js.map +1 -1
- package/src/lib/sentry.logger.d.ts +2 -4
- package/src/lib/sentry.logger.js +42 -27
- package/src/lib/sentry.logger.js.map +1 -1
- package/src/lib/sentry.module.d.ts +2 -2
- package/src/lib/sentry.module.js +16 -11
- package/src/lib/sentry.module.js.map +1 -1
- package/src/lib/sentry.service.d.ts +3 -4
- package/src/lib/sentry.service.js +24 -24
- package/src/lib/sentry.service.js.map +1 -1
- package/src/lib/tokens.js.map +1 -1
- package/collection.json +0 -4
- package/libs/nest/LICENSE +0 -21
- package/migration.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,80 +3,65 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
# [9.1.0-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@9.1.0-dev.1...@rxap/nest-sentry@9.1.0-dev.2) (2023-07-10)
|
|
8
7
|
|
|
9
8
|
### Bug Fixes
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
- update package dependency versions ([8479f5c](https://gitlab.com/rxap/packages/commit/8479f5c405a885cc0f300cec6156584e4c65d59c))
|
|
11
|
+
- update to nx 16.5.0 ([73f7575](https://gitlab.com/rxap/packages/commit/73f7575ba378b8b03d2a2646f1761c01b16a6e09))
|
|
12
12
|
|
|
13
|
+
# 9.1.0-dev.1 (2023-07-10)
|
|
13
14
|
|
|
15
|
+
### Bug Fixes
|
|
14
16
|
|
|
17
|
+
- restructure and merge mono repos packages, schematics, plugins and nest ([653b4cd](https://gitlab.com/rxap/packages/commit/653b4cd39fc92d322df9b3959651fea0aa6079da))
|
|
15
18
|
|
|
19
|
+
# [9.1.0-dev.0](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.5...@rxap/nest-sentry@9.1.0-dev.0) (2023-05-04)
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
### Features
|
|
18
22
|
|
|
23
|
+
- add RxapLogger to improve performance with large jsonobjects ([c521ba1](https://gitlab.com/rxap/nest/commit/c521ba1215caa693bda1ef2e41a0d69d633fd363))
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
## [9.0.3-dev.5](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.4...@rxap/nest-sentry@9.0.3-dev.5) (2023-04-27)
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
### Bug Fixes
|
|
23
28
|
|
|
29
|
+
- use correct base optionstype ([b5395c7](https://gitlab.com/rxap/nest/commit/b5395c7ff46e2f1b9f7dacd2d6526ccb37f12e7d))
|
|
24
30
|
|
|
31
|
+
## [9.0.3-dev.4](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.3...@rxap/nest-sentry@9.0.3-dev.4) (2023-04-04)
|
|
25
32
|
|
|
33
|
+
### Bug Fixes
|
|
26
34
|
|
|
35
|
+
- **interceptor:** allow exceptions to inject additionallyscopes ([0fd500b](https://gitlab.com/rxap/nest/commit/0fd500ba1eaea4b5d0bcefdb6679be596476331f))
|
|
27
36
|
|
|
28
37
|
## [9.0.3-dev.3](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.2...@rxap/nest-sentry@9.0.3-dev.3) (2023-04-04)
|
|
29
38
|
|
|
30
|
-
|
|
31
39
|
### Bug Fixes
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
- **logger:** mirror the ConsoleLoggerimplementation ([4ce7f2a](https://gitlab.com/rxap/nest/commit/4ce7f2a144d1e1ab3f0b3e6f858c928cc0482587))
|
|
38
42
|
|
|
39
43
|
## [9.0.3-dev.2](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.1...@rxap/nest-sentry@9.0.3-dev.2) (2023-04-04)
|
|
40
44
|
|
|
41
|
-
|
|
42
45
|
### Bug Fixes
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
- **logger:** split options into sentry andconsole ([21e8b59](https://gitlab.com/rxap/nest/commit/21e8b5991b0b30bb30bfc4d11d7b703c2a26904b))
|
|
49
48
|
|
|
50
49
|
## [9.0.3-dev.1](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.3-dev.0...@rxap/nest-sentry@9.0.3-dev.1) (2023-03-13)
|
|
51
50
|
|
|
52
|
-
|
|
53
51
|
### Bug Fixes
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
- add Global decorator toSentryModule ([9777d29](https://gitlab.com/rxap/nest/commit/9777d2911c140291786d81ca892e2eeabb817eff))
|
|
60
54
|
|
|
61
55
|
## [9.0.3-dev.0](https://gitlab.com/rxap/nest/compare/@rxap/nest-sentry@9.0.2...@rxap/nest-sentry@9.0.3-dev.0) (2023-01-23)
|
|
62
56
|
|
|
63
|
-
|
|
64
57
|
### Bug Fixes
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
- **sentry:** support optional sentrydsn ([85688ab](https://gitlab.com/rxap/nest/commit/85688ab8812d782d2074ad6601e85324e25541f5))
|
|
71
60
|
|
|
72
61
|
## 9.0.2 (2022-12-28)
|
|
73
62
|
|
|
74
63
|
**Note:** Version bump only for package @rxap/nest-sentry
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
65
|
## 9.0.1 (2022-12-28)
|
|
81
66
|
|
|
82
67
|
**Note:** Version bump only for package @rxap/sentry
|
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
@rxap/nest-sentry
|
|
2
|
-
======
|
|
1
|
+
# @rxap/nest-sentry
|
|
3
2
|
|
|
4
3
|
[](https://www.npmjs.com/package/@rxap/nest-sentry)
|
|
5
4
|
[](https://commitizen.github.io/cz-cli/)
|
|
@@ -8,13 +7,15 @@
|
|
|
8
7
|

|
|
9
8
|

|
|
10
9
|
|
|
11
|
-
>
|
|
12
|
-
|
|
13
10
|
- [Installation](#installation)
|
|
14
11
|
|
|
15
12
|
# Installation
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
**Add the package to your workspace:**
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @rxap/nest-sentry
|
|
17
|
+
```
|
|
18
|
+
**Install peer dependencies:**
|
|
19
|
+
```bash
|
|
20
|
+
yarn add
|
|
21
|
+
```
|
package/package.json
CHANGED
|
@@ -1,42 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/nest-sentry",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.1.0-dev.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"tslib": "2.5.3"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@nestjs/common": "^10.0.5",
|
|
10
|
+
"@rxap/nest-logger": "^1.0.1-dev.1",
|
|
11
|
+
"@sentry/core": "^7.28.1",
|
|
12
|
+
"@sentry/node": "^7.28.1",
|
|
13
|
+
"@sentry/types": "^7.28.1",
|
|
14
|
+
"rxjs": "^7.8.0"
|
|
11
15
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public",
|
|
18
|
+
"directory": "../../../dist/packages/nest/sentry"
|
|
14
19
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"license": "MIT",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"rxap",
|
|
22
|
+
"nest"
|
|
23
|
+
],
|
|
24
|
+
"homepage": "https:/gitlab.com/rxap/packages/packages/nest/sentry",
|
|
21
25
|
"bugs": {
|
|
22
|
-
"url": "https://gitlab.com/rxap/
|
|
23
|
-
"email": "incoming+rxap-
|
|
26
|
+
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
27
|
+
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
24
28
|
},
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"
|
|
29
|
+
"license": "GPL-3.0-or-later",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://gitlab.com/rxap/packages.git",
|
|
33
|
+
"directory": "packages/nest/sentry"
|
|
28
34
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"@sentry/node": "^7.28.1",
|
|
33
|
-
"rxjs": "^7.5.4",
|
|
34
|
-
"@sentry/types": "7.28.1"
|
|
35
|
+
"author": {
|
|
36
|
+
"name": "Merzough Münker",
|
|
37
|
+
"email": "mmuenker@digitaix.com"
|
|
35
38
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
39
|
+
"nx-migrations": {
|
|
40
|
+
"packageGroup": [
|
|
41
|
+
{
|
|
42
|
+
"package": "@rxap/nest-logger",
|
|
43
|
+
"version": "1.0.1-dev.1"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
38
46
|
},
|
|
39
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "9ad96f2d4db9225ab199d03fc172efff52609d5d",
|
|
40
48
|
"main": "./src/index.js",
|
|
41
49
|
"types": "./src/index.d.ts"
|
|
42
50
|
}
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nest/sentry/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,mEAAyC;AACzC,kEAAwC;AACxC,8DAAoC;AACpC,+DAAqC;AACrC,8DAAoC"}
|
|
@@ -7,7 +7,7 @@ const node_1 = require("@sentry/node");
|
|
|
7
7
|
const operators_1 = require("rxjs/operators");
|
|
8
8
|
const sentry_service_1 = require("./sentry.service");
|
|
9
9
|
const tokens_1 = require("./tokens");
|
|
10
|
-
let SentryInterceptor = class SentryInterceptor {
|
|
10
|
+
let SentryInterceptor = exports.SentryInterceptor = class SentryInterceptor {
|
|
11
11
|
intercept(context, next) {
|
|
12
12
|
if (this.client.hasInstance) {
|
|
13
13
|
// first param would be for events, second is for errors
|
|
@@ -57,12 +57,11 @@ let SentryInterceptor = class SentryInterceptor {
|
|
|
57
57
|
this.client.instance().captureException(exception);
|
|
58
58
|
}
|
|
59
59
|
shouldReport(exception) {
|
|
60
|
-
|
|
61
|
-
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.filters)) {
|
|
60
|
+
if (!this.options?.filters) {
|
|
62
61
|
return true;
|
|
63
62
|
}
|
|
64
63
|
return this.options.filters
|
|
65
|
-
.some(({ type, filter }) => !(exception instanceof type && (!filter || filter(exception))));
|
|
64
|
+
.some(({ type, filter, }) => !(exception instanceof type && (!filter || filter(exception))));
|
|
66
65
|
}
|
|
67
66
|
};
|
|
68
67
|
tslib_1.__decorate([
|
|
@@ -74,8 +73,7 @@ tslib_1.__decorate([
|
|
|
74
73
|
(0, common_1.Inject)(tokens_1.SENTRY_INTERCEPTOR_OPTIONS),
|
|
75
74
|
tslib_1.__metadata("design:type", Object)
|
|
76
75
|
], SentryInterceptor.prototype, "options", void 0);
|
|
77
|
-
SentryInterceptor = tslib_1.__decorate([
|
|
76
|
+
exports.SentryInterceptor = SentryInterceptor = tslib_1.__decorate([
|
|
78
77
|
(0, common_1.Injectable)()
|
|
79
78
|
], SentryInterceptor);
|
|
80
|
-
exports.SentryInterceptor = SentryInterceptor;
|
|
81
79
|
//# sourceMappingURL=sentry.interceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.interceptor.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sentry.interceptor.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/sentry.interceptor.ts"],"names":[],"mappings":";;;;AAAA,2CAQwB;AAQxB,uCAAqD;AAErD,8CAAqC;AAGrC,qDAAiD;AACjD,qCAAsD;AAI/C,IAAM,iBAAiB,+BAAvB,MAAM,iBAAiB;IAS5B,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YAC3B,wDAAwD;YACxD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC;gBACF,KAAK,EAAE,CAAC,SAAwB,EAAE,EAAE;oBAClC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;wBAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;4BACzC,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;wBAC1D,CAAC,CAAC,CAAC;qBACJ;gBACH,CAAC;aACF,CAAC,CACH,CAAC;SACH;QACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IAES,gBAAgB,CAAC,OAAyB,EAAE,KAAY,EAAE,SAAkB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,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAEO,kBAAkB,CACxB,KAAY,EACZ,EAAmB,EACnB,SAAkB;QAElB,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAC5C,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAExC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAEO,YAAY,CAAC,SAAkB;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE;YAC1B,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;aACf,IAAI,CAAC,CAAC,EACE,IAAI,EACJ,MAAM,GACP,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;CACF,CAAA;AAjGoB;IADlB,IAAA,eAAM,EAAC,8BAAa,CAAC;sCACM,8BAAa;iDAAC;AAIvB;IAFlB,IAAA,iBAAQ,GAAE;IACV,IAAA,eAAM,EAAC,mCAA0B,CAAC;;kDACmB;4BAP3C,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;GACA,iBAAiB,CAoG7B"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ConsoleLoggerOptions } from '@nestjs/common';
|
|
2
2
|
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { NodeOptions, SeverityLevel } from '@sentry/node';
|
|
4
4
|
import { AddRequestDataToEventOptions } from '@sentry/node/types/requestdata';
|
|
5
5
|
import { Integration } from '@sentry/types';
|
|
6
6
|
export interface SentryCloseOptions {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
timeout?: number;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type SentryModuleOptions = Omit<NodeOptions, 'integrations'> & {
|
|
11
11
|
integrations?: Integration[];
|
|
12
12
|
close?: SentryCloseOptions;
|
|
13
13
|
} & ConsoleLoggerOptions;
|
|
@@ -27,7 +27,7 @@ export interface SentryInterceptorOptionsFilter {
|
|
|
27
27
|
type: any;
|
|
28
28
|
filter?: SentryFilterFunction;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export type SentryInterceptorOptions = AddRequestDataToEventOptions['include'] & {
|
|
31
31
|
filters?: SentryInterceptorOptionsFilter[];
|
|
32
32
|
tags?: {
|
|
33
33
|
[key: string]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.interfaces.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sentry.interfaces.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/sentry.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ConsoleLogger } from '@nestjs/common';
|
|
2
|
-
import { SentryModuleOptions } from './sentry.interfaces';
|
|
3
1
|
import { ConsoleLoggerOptions } from '@nestjs/common/services/console-logger.service';
|
|
4
|
-
|
|
2
|
+
import { RxapLogger } from '@rxap/nest-logger';
|
|
3
|
+
export declare class SentryLogger extends RxapLogger {
|
|
5
4
|
protected readonly options: ConsoleLoggerOptions;
|
|
6
5
|
private readonly sentryOptions;
|
|
7
|
-
constructor(options: ConsoleLoggerOptions, sentryOptions: SentryModuleOptions);
|
|
8
6
|
log(message: string, ...optionalParams: any[]): void;
|
|
9
7
|
error(message: string, ...optionalParams: any[]): void;
|
|
10
8
|
warn(message: string, ...optionalParams: any[]): void;
|
package/src/lib/sentry.logger.js
CHANGED
|
@@ -6,12 +6,8 @@ const common_1 = require("@nestjs/common");
|
|
|
6
6
|
const Sentry = require("@sentry/node");
|
|
7
7
|
const tokens_1 = require("./tokens");
|
|
8
8
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
super();
|
|
12
|
-
this.options = options;
|
|
13
|
-
this.sentryOptions = sentryOptions;
|
|
14
|
-
}
|
|
9
|
+
const nest_logger_1 = require("@rxap/nest-logger");
|
|
10
|
+
let SentryLogger = exports.SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
15
11
|
log(message, ...optionalParams) {
|
|
16
12
|
let asBreadcrumb = false;
|
|
17
13
|
if (optionalParams.length) {
|
|
@@ -36,8 +32,8 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
36
32
|
message,
|
|
37
33
|
level: 'log',
|
|
38
34
|
data: {
|
|
39
|
-
context
|
|
40
|
-
}
|
|
35
|
+
context,
|
|
36
|
+
},
|
|
41
37
|
}) :
|
|
42
38
|
Sentry.captureMessage(message, {
|
|
43
39
|
level: 'log',
|
|
@@ -49,7 +45,7 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
error(message, ...optionalParams) {
|
|
52
|
-
const { context, stack } = this._getContextAndStackAndMessagesToPrint([
|
|
48
|
+
const { context, stack, } = this._getContextAndStackAndMessagesToPrint([
|
|
53
49
|
message,
|
|
54
50
|
...optionalParams,
|
|
55
51
|
]);
|
|
@@ -63,7 +59,10 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
63
59
|
try {
|
|
64
60
|
Sentry.captureMessage(message, {
|
|
65
61
|
level: 'error',
|
|
66
|
-
extra: {
|
|
62
|
+
extra: {
|
|
63
|
+
context,
|
|
64
|
+
stack,
|
|
65
|
+
},
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
68
|
catch (err) {
|
|
@@ -94,8 +93,8 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
94
93
|
message,
|
|
95
94
|
level: 'warning',
|
|
96
95
|
data: {
|
|
97
|
-
context
|
|
98
|
-
}
|
|
96
|
+
context,
|
|
97
|
+
},
|
|
99
98
|
}) :
|
|
100
99
|
Sentry.captureMessage(message, {
|
|
101
100
|
level: 'warning',
|
|
@@ -130,8 +129,8 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
130
129
|
message,
|
|
131
130
|
level: 'debug',
|
|
132
131
|
data: {
|
|
133
|
-
context
|
|
134
|
-
}
|
|
132
|
+
context,
|
|
133
|
+
},
|
|
135
134
|
}) :
|
|
136
135
|
Sentry.captureMessage(message, {
|
|
137
136
|
level: 'debug',
|
|
@@ -143,13 +142,19 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
_getContextAndMessagesToPrint(args) {
|
|
146
|
-
if (
|
|
147
|
-
return {
|
|
145
|
+
if (args?.length <= 1) {
|
|
146
|
+
return {
|
|
147
|
+
messages: args,
|
|
148
|
+
context: this.context,
|
|
149
|
+
};
|
|
148
150
|
}
|
|
149
151
|
const lastElement = args[args.length - 1];
|
|
150
152
|
const isContext = (0, shared_utils_1.isString)(lastElement);
|
|
151
153
|
if (!isContext) {
|
|
152
|
-
return {
|
|
154
|
+
return {
|
|
155
|
+
messages: args,
|
|
156
|
+
context: this.context,
|
|
157
|
+
};
|
|
153
158
|
}
|
|
154
159
|
return {
|
|
155
160
|
context: lastElement,
|
|
@@ -157,15 +162,21 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
157
162
|
};
|
|
158
163
|
}
|
|
159
164
|
_getContextAndStackAndMessagesToPrint(args) {
|
|
160
|
-
const { messages, context } = this._getContextAndMessagesToPrint(args);
|
|
161
|
-
if (
|
|
162
|
-
return {
|
|
165
|
+
const { messages, context, } = this._getContextAndMessagesToPrint(args);
|
|
166
|
+
if (messages?.length <= 1) {
|
|
167
|
+
return {
|
|
168
|
+
messages,
|
|
169
|
+
context,
|
|
170
|
+
};
|
|
163
171
|
}
|
|
164
172
|
const lastElement = messages[messages.length - 1];
|
|
165
173
|
const isStack = (0, shared_utils_1.isString)(lastElement);
|
|
166
174
|
// https://github.com/nestjs/nest/issues/11074#issuecomment-1421680060
|
|
167
175
|
if (!isStack && !(0, shared_utils_1.isUndefined)(lastElement)) {
|
|
168
|
-
return {
|
|
176
|
+
return {
|
|
177
|
+
messages,
|
|
178
|
+
context,
|
|
179
|
+
};
|
|
169
180
|
}
|
|
170
181
|
return {
|
|
171
182
|
stack: lastElement,
|
|
@@ -174,11 +185,15 @@ let SentryLogger = class SentryLogger extends common_1.ConsoleLogger {
|
|
|
174
185
|
};
|
|
175
186
|
}
|
|
176
187
|
};
|
|
177
|
-
|
|
178
|
-
(0, common_1.
|
|
179
|
-
tslib_1.
|
|
180
|
-
|
|
181
|
-
|
|
188
|
+
tslib_1.__decorate([
|
|
189
|
+
(0, common_1.Inject)(tokens_1.CONSOLE_LOGGER_OPTIONS),
|
|
190
|
+
tslib_1.__metadata("design:type", Object)
|
|
191
|
+
], SentryLogger.prototype, "options", void 0);
|
|
192
|
+
tslib_1.__decorate([
|
|
193
|
+
(0, common_1.Inject)(tokens_1.SENTRY_MODULE_OPTIONS),
|
|
194
|
+
tslib_1.__metadata("design:type", Object)
|
|
195
|
+
], SentryLogger.prototype, "sentryOptions", void 0);
|
|
196
|
+
exports.SentryLogger = SentryLogger = tslib_1.__decorate([
|
|
197
|
+
(0, common_1.Injectable)()
|
|
182
198
|
], SentryLogger);
|
|
183
|
-
exports.SentryLogger = SentryLogger;
|
|
184
199
|
//# sourceMappingURL=sentry.logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.logger.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sentry.logger.js","sourceRoot":"","sources":["../../../../../../packages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D,MAAM,OAAO,GAAG,IAAA,uBAAQ,EAAC,WAAW,CAAC,CAAC;QACtC,sEAAsE;QACtE,IAAI,CAAC,OAAO,IAAI,CAAC,IAAA,0BAAW,EAAC,WAAW,CAAC,EAAE;YACzC,OAAO;gBACL,QAAQ;gBACR,OAAO;aACR,CAAC;SACH;QACD,OAAO;YACL,KAAK,EAAE,WAAqB;YAC5B,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YAChD,OAAO;SACR,CAAC;IACJ,CAAC;CAEF,CAAA;AA7L6B;IAD3B,IAAA,eAAM,EAAC,+BAAsB,CAAC;;6CAC4B;AAG1C;IADhB,IAAA,eAAM,EAAC,8BAAqB,CAAC;;mDACuB;uBAN1C,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAgMxB"}
|
|
@@ -2,8 +2,8 @@ import { DynamicModule } from '@nestjs/common';
|
|
|
2
2
|
import { SentryModuleAsyncOptions, SentryModuleOptions } from './sentry.interfaces';
|
|
3
3
|
import { ConsoleLoggerOptions } from '@nestjs/common/services/console-logger.service';
|
|
4
4
|
export declare class SentryModule {
|
|
5
|
-
static forRoot(options: SentryModuleOptions, { timestamp, logLevels }?: ConsoleLoggerOptions): DynamicModule;
|
|
6
|
-
static forRootAsync(options: SentryModuleAsyncOptions, { timestamp, logLevels }?: ConsoleLoggerOptions): DynamicModule;
|
|
5
|
+
static forRoot(options: SentryModuleOptions, { timestamp, logLevels, }?: ConsoleLoggerOptions): DynamicModule;
|
|
6
|
+
static forRootAsync(options: SentryModuleAsyncOptions, { timestamp, logLevels, }?: ConsoleLoggerOptions): DynamicModule;
|
|
7
7
|
private static createAsyncProviders;
|
|
8
8
|
private static createAsyncOptionsProvider;
|
|
9
9
|
}
|
package/src/lib/sentry.module.js
CHANGED
|
@@ -7,8 +7,8 @@ const common_1 = require("@nestjs/common");
|
|
|
7
7
|
const tokens_1 = require("./tokens");
|
|
8
8
|
const sentry_logger_1 = require("./sentry.logger");
|
|
9
9
|
const sentry_service_1 = require("./sentry.service");
|
|
10
|
-
let SentryModule = SentryModule_1 = class SentryModule {
|
|
11
|
-
static forRoot(options, { timestamp, logLevels } = {}) {
|
|
10
|
+
let SentryModule = exports.SentryModule = SentryModule_1 = class SentryModule {
|
|
11
|
+
static forRoot(options, { timestamp, logLevels, } = {}) {
|
|
12
12
|
return {
|
|
13
13
|
exports: [sentry_service_1.SentryService],
|
|
14
14
|
module: SentryModule_1,
|
|
@@ -19,12 +19,15 @@ let SentryModule = SentryModule_1 = class SentryModule {
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
provide: tokens_1.CONSOLE_LOGGER_OPTIONS,
|
|
22
|
-
useValue: {
|
|
23
|
-
|
|
22
|
+
useValue: {
|
|
23
|
+
timestamp: timestamp ?? true,
|
|
24
|
+
logLevels: logLevels ?? ['log', 'error', 'warn'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
24
27
|
],
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
|
-
static forRootAsync(options, { timestamp, logLevels } = {}) {
|
|
30
|
+
static forRootAsync(options, { timestamp, logLevels, } = {}) {
|
|
28
31
|
return {
|
|
29
32
|
exports: [sentry_service_1.SentryService],
|
|
30
33
|
imports: options.imports,
|
|
@@ -33,8 +36,11 @@ let SentryModule = SentryModule_1 = class SentryModule {
|
|
|
33
36
|
...this.createAsyncProviders(options),
|
|
34
37
|
{
|
|
35
38
|
provide: tokens_1.CONSOLE_LOGGER_OPTIONS,
|
|
36
|
-
useValue: {
|
|
37
|
-
|
|
39
|
+
useValue: {
|
|
40
|
+
timestamp: timestamp ?? true,
|
|
41
|
+
logLevels: logLevels ?? ['log', 'error', 'warn'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
38
44
|
],
|
|
39
45
|
};
|
|
40
46
|
}
|
|
@@ -64,17 +70,16 @@ let SentryModule = SentryModule_1 = class SentryModule {
|
|
|
64
70
|
];
|
|
65
71
|
return {
|
|
66
72
|
provide: tokens_1.SENTRY_MODULE_OPTIONS,
|
|
67
|
-
useFactory: (optionsFactory) =>
|
|
73
|
+
useFactory: async (optionsFactory) => await optionsFactory.createSentryModuleOptions(),
|
|
68
74
|
inject,
|
|
69
75
|
};
|
|
70
76
|
}
|
|
71
77
|
};
|
|
72
|
-
SentryModule = SentryModule_1 = tslib_1.__decorate([
|
|
78
|
+
exports.SentryModule = SentryModule = SentryModule_1 = tslib_1.__decorate([
|
|
73
79
|
(0, common_1.Global)(),
|
|
74
80
|
(0, common_1.Module)({
|
|
75
81
|
providers: [sentry_logger_1.SentryLogger, sentry_service_1.SentryService],
|
|
76
|
-
exports: [sentry_logger_1.SentryLogger, sentry_service_1.SentryService]
|
|
82
|
+
exports: [sentry_logger_1.SentryLogger, sentry_service_1.SentryService],
|
|
77
83
|
})
|
|
78
84
|
], SentryModule);
|
|
79
|
-
exports.SentryModule = SentryModule;
|
|
80
85
|
//# sourceMappingURL=sentry.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/sentry.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAMwB;AACxB,qCAGkB;AAMlB,mDAA+C;AAC/C,qDAAiD;AAQ1C,IAAM,YAAY,2CAAlB,MAAM,YAAY;IAChB,MAAM,CAAC,OAAO,CACnB,OAA4B,EAC5B,EACE,SAAS,EACT,SAAS,MACe,EAAE;QAE5B,OAAO;YACL,OAAO,EAAE,CAAE,8BAAa,CAAE;YAC1B,MAAM,EAAE,cAAY;YACpB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,8BAAqB;oBAC9B,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,+BAAsB;oBAC/B,QAAQ,EAAE;wBACR,SAAS,EAAE,SAAS,IAAI,IAAI;wB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A+B;SACxE,CAAC;QACF,OAAO;YACL,OAAO,EAAE,8BAAqB;YAC9B,UAAU,EAAE,KAAK,EAAE,cAAoC,EAAE,EAAE,CACzD,MAAM,cAAc,CAAC,yBAAyB,EAAE;YAClD,MAAM;SACP,CAAC;IACJ,CAAC;CAEF,CAAA;uBAxFY,YAAY;IALxB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAE,4BAAY,EAAE,8BAAa,CAAE;QAC1C,OAAO,EAAE,CAAE,4BAAY,EAAE,8BAAa,CAAE;KACzC,CAAC;GACW,YAAY,CAwFxB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { OnApplicationShutdown } from '@nestjs/common';
|
|
1
|
+
import { OnApplicationBootstrap, OnApplicationShutdown } from '@nestjs/common';
|
|
2
2
|
import * as Sentry from '@sentry/node';
|
|
3
|
-
|
|
4
|
-
export declare class SentryService implements OnApplicationShutdown {
|
|
3
|
+
export declare class SentryService implements OnApplicationShutdown, OnApplicationBootstrap {
|
|
5
4
|
private readonly options;
|
|
6
5
|
get hasInstance(): boolean;
|
|
7
|
-
|
|
6
|
+
onApplicationBootstrap(): any;
|
|
8
7
|
instance(): typeof Sentry;
|
|
9
8
|
onApplicationShutdown(signal?: string): Promise<void>;
|
|
10
9
|
}
|
|
@@ -5,17 +5,21 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const Sentry = require("@sentry/node");
|
|
7
7
|
const tokens_1 = require("./tokens");
|
|
8
|
-
let SentryService = class SentryService {
|
|
9
|
-
|
|
10
|
-
this.options
|
|
11
|
-
|
|
8
|
+
let SentryService = exports.SentryService = class SentryService {
|
|
9
|
+
get hasInstance() {
|
|
10
|
+
return !!this.options.dsn;
|
|
11
|
+
}
|
|
12
|
+
onApplicationBootstrap() {
|
|
13
|
+
if (!this.options.dsn) {
|
|
12
14
|
console.warn('Could not create SentryService instance. The required option dsn is not defined');
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
15
|
-
const { integrations = []
|
|
16
|
-
Sentry.init(
|
|
17
|
+
const { integrations = [], ...sentryOptions } = this.options;
|
|
18
|
+
Sentry.init({
|
|
19
|
+
...sentryOptions,
|
|
20
|
+
integrations: [
|
|
17
21
|
new Sentry.Integrations.OnUncaughtException({
|
|
18
|
-
onFatalError: (err) =>
|
|
22
|
+
onFatalError: async (err) => {
|
|
19
23
|
// console.error('uncaughtException, not cool!')
|
|
20
24
|
// console.error(err);
|
|
21
25
|
if (err.name === 'SentryError') {
|
|
@@ -25,31 +29,27 @@ let SentryService = class SentryService {
|
|
|
25
29
|
Sentry.getCurrentHub().getClient().captureException(err);
|
|
26
30
|
process.exit(1);
|
|
27
31
|
}
|
|
28
|
-
}
|
|
32
|
+
},
|
|
29
33
|
}),
|
|
30
34
|
new Sentry.Integrations.OnUnhandledRejection({ mode: 'warn' }),
|
|
31
35
|
...integrations,
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
get hasInstance() {
|
|
35
|
-
return !!this.options.dsn;
|
|
36
|
+
],
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
instance() {
|
|
38
40
|
return Sentry;
|
|
39
41
|
}
|
|
40
|
-
onApplicationShutdown(signal) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
yield Sentry.close(this.options.close.timeout);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
42
|
+
async onApplicationShutdown(signal) {
|
|
43
|
+
if (this.hasInstance && this.options.close?.enabled === true) {
|
|
44
|
+
await Sentry.close(this.options.close.timeout);
|
|
45
|
+
}
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
|
-
|
|
50
|
-
(0, common_1.
|
|
51
|
-
tslib_1.
|
|
52
|
-
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, common_1.Inject)(tokens_1.SENTRY_MODULE_OPTIONS),
|
|
50
|
+
tslib_1.__metadata("design:type", Object)
|
|
51
|
+
], SentryService.prototype, "options", void 0);
|
|
52
|
+
exports.SentryService = SentryService = tslib_1.__decorate([
|
|
53
|
+
(0, common_1.Injectable)()
|
|
53
54
|
], SentryService);
|
|
54
|
-
exports.SentryService = SentryService;
|
|
55
55
|
//# sourceMappingURL=sentry.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.service.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"sentry.service.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/sentry.service.ts"],"names":[],"mappings":";;;;AAAA,2CAKwB;AAKxB,uCAAuC;AACvC,qCAAiD;AAI1C,IAAM,aAAa,2BAAnB,MAAM,aAAa;IAKxB,IAAI,WAAW;QACb,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;IAC5B,CAAC;IAED,sBAAsB;QACpB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;YAChG,OAAO;SACR;QACD,MAAM,EACJ,YAAY,GAAG,EAAE,EACjB,GAAG,aAAa,EACjB,GAAG,IAAI,CAAC,OAAO,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,aAAa;YAChB,YAAY,EAAE;gBACZ,IAAI,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC;oBAC1C,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;wBAC1B,gDAAgD;wBAChD,sBAAsB;wBACtB,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa,EAAE;4BAC9B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;yBAClB;6BAAM;4BAEH,MAAM,CAAC,aAAa,EAAE,CAAC,SAAS,EAGjC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;4BACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;yBACjB;oBACH,CAAC;iBACF,CAAC;gBACF,IAAI,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBAC9D,GAAG,YAAY;aAChB;SACF,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,MAAe;QACzC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE;YAC5D,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAChD;IACH,CAAC;CAEF,CAAA;AAlDkB;IADhB,IAAA,eAAM,EAAC,8BAAqB,CAAC;;8CACiB;wBAHpC,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAqDzB"}
|
package/src/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/tokens.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACtD,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAClE,QAAA,sBAAsB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC"}
|
package/collection.json
DELETED
package/libs/nest/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Merzough Münker
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/migration.json
DELETED