@rxap/nest-sentry 11.0.0-dev.9 → 11.0.1-dev.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/CHANGELOG.md +42 -0
- package/package.json +9 -9
- package/src/lib/sentry-app-config.d.ts +2 -1
- package/src/lib/sentry-app-config.js +2 -1
- package/src/lib/sentry-init-hook.d.ts +2 -1
- package/src/lib/sentry-init-hook.js +6 -3
- package/src/lib/sentry-logger.module.d.ts +7 -3
- package/src/lib/sentry-logger.module.js +13 -7
- package/src/lib/sentry-module-options.factory.js +2 -1
- package/src/lib/sentry.interfaces.d.ts +1 -0
- package/src/lib/sentry.logger.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
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
|
+
## [11.0.1-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0...@rxap/nest-sentry@11.0.1-dev.0) (2026-01-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
9
|
+
|
|
10
|
+
# [11.0.0](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.16...@rxap/nest-sentry@11.0.0) (2026-01-23)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
13
|
+
|
|
14
|
+
# [11.0.0-dev.16](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.15...@rxap/nest-sentry@11.0.0-dev.16) (2026-01-19)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
17
|
+
|
|
18
|
+
# [11.0.0-dev.15](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.14...@rxap/nest-sentry@11.0.0-dev.15) (2026-01-13)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
21
|
+
|
|
22
|
+
# [11.0.0-dev.14](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.13...@rxap/nest-sentry@11.0.0-dev.14) (2025-11-27)
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
- **sentry:** add callback functionality to sentryInitHook ([095cb88](https://gitlab.com/rxap/packages/commit/095cb886de91ba8a179457a3df72b79385ff63ef))
|
|
27
|
+
|
|
28
|
+
# [11.0.0-dev.13](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.12...@rxap/nest-sentry@11.0.0-dev.13) (2025-11-21)
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
- **logger:** support custom logger functions in SentryLogger ([97500ac](https://gitlab.com/rxap/packages/commit/97500acab1d17eb7938f56cbbfc7c27d9785b058))
|
|
33
|
+
|
|
34
|
+
# [11.0.0-dev.12](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.11...@rxap/nest-sentry@11.0.0-dev.12) (2025-09-18)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
37
|
+
|
|
38
|
+
# [11.0.0-dev.11](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.10...@rxap/nest-sentry@11.0.0-dev.11) (2025-09-15)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @rxap/nest-sentry
|
|
41
|
+
|
|
42
|
+
# [11.0.0-dev.10](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.9...@rxap/nest-sentry@11.0.0-dev.10) (2025-09-15)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- **sentry:** replace config checks with `sentryOptions.enabled` ([fe790ed](https://gitlab.com/rxap/packages/commit/fe790ed6c725529ef654a18a3f5810990fec4584))
|
|
47
|
+
|
|
6
48
|
# [11.0.0-dev.9](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@11.0.0-dev.8...@rxap/nest-sentry@11.0.0-dev.9) (2025-09-08)
|
|
7
49
|
|
|
8
50
|
**Note:** Version bump only for package @rxap/nest-sentry
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "11.0.
|
|
2
|
+
"version": "11.0.1-dev.0",
|
|
3
3
|
"name": "@rxap/nest-sentry",
|
|
4
4
|
"description": "This package provides a Sentry integration for NestJS applications. It includes a logger, interceptor, and module to simplify error tracking and performance monitoring with Sentry. It offers configurable options for setting up Sentry in your NestJS application.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nx/devkit": "20.5.0",
|
|
8
|
-
"@rxap/ts-morph": "^1.6.
|
|
9
|
-
"@rxap/workspace-utilities": "^19.
|
|
8
|
+
"@rxap/ts-morph": "^1.6.1-dev.0",
|
|
9
|
+
"@rxap/workspace-utilities": "^19.9.1-dev.0",
|
|
10
10
|
"tslib": "2.6.2"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@nestjs/common": "^11.1.1",
|
|
14
14
|
"@nestjs/config": "^4.0.2",
|
|
15
15
|
"@nestjs/core": "^11.1.1",
|
|
16
|
-
"@rxap/nest-logger": "^11.0.0
|
|
17
|
-
"@rxap/nest-utilities": "^11.0.0
|
|
16
|
+
"@rxap/nest-logger": "^11.0.0",
|
|
17
|
+
"@rxap/nest-utilities": "^11.0.0",
|
|
18
18
|
"@sentry/core": "^8.55.0",
|
|
19
19
|
"@sentry/nestjs": "^8.55.0",
|
|
20
20
|
"@sentry/node": "^8.55.0",
|
|
@@ -81,15 +81,15 @@
|
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
"package": "@rxap/nest-logger",
|
|
84
|
-
"version": "11.0.0
|
|
84
|
+
"version": "11.0.0"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"package": "@rxap/nest-utilities",
|
|
88
|
-
"version": "11.0.0
|
|
88
|
+
"version": "11.0.0"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"package": "@rxap/utilities",
|
|
92
|
-
"version": "16.
|
|
92
|
+
"version": "16.5.0"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"package": "@sentry/core",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
},
|
|
129
129
|
"schematics": "./generators.json",
|
|
130
130
|
"type": "commonjs",
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "c7d69b5331aace8f6e17874db92377b5ab82422b",
|
|
132
132
|
"types": "./src/index.d.ts",
|
|
133
133
|
"main": "./src/index.js"
|
|
134
134
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Environment } from '@rxap/nest-utilities';
|
|
2
2
|
import { LogSeverityLevel } from '@sentry/core';
|
|
3
3
|
import type { SchemaMap } from 'joi';
|
|
4
|
-
export declare function sentryValidationSchema(environment: Environment, { logLevel }?: Partial<{
|
|
4
|
+
export declare function sentryValidationSchema(environment: Environment, { logLevel, enabled, }?: Partial<{
|
|
5
5
|
logLevel: LogSeverityLevel;
|
|
6
|
+
enabled: boolean;
|
|
6
7
|
}>): SchemaMap;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sentryValidationSchema = sentryValidationSchema;
|
|
4
4
|
const Joi = require("joi");
|
|
5
|
-
function sentryValidationSchema(environment, { logLevel = 'warn' } = {}) {
|
|
5
|
+
function sentryValidationSchema(environment, { logLevel = 'warn', enabled = environment.sentry?.enabled ?? false, } = {}) {
|
|
6
6
|
const schema = {};
|
|
7
7
|
schema['SENTRY_LOG_LEVEL'] = Joi.string().allow('trace', 'debug', 'info', 'warn', 'error', 'fatal').default(logLevel);
|
|
8
|
+
schema['SENTRY_ENABLED'] = Joi.boolean().default(enabled);
|
|
8
9
|
return schema;
|
|
9
10
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Environment } from '@rxap/nest-utilities';
|
|
2
|
+
import { NodeClient } from '@sentry/node';
|
|
2
3
|
import type { NodeOptions } from '@sentry/node/build/types/types';
|
|
3
|
-
export declare function sentryInitHook(options?: Partial<NodeOptions
|
|
4
|
+
export declare function sentryInitHook<AppOptions = any>(options?: Partial<NodeOptions>, callback?: (client: NodeClient | undefined, options: AppOptions, environment: Environment) => void): (appOptions: any, environment: Environment) => void;
|
|
@@ -5,13 +5,13 @@ const Sentry = require("@sentry/nestjs");
|
|
|
5
5
|
const profiling_node_1 = require("@sentry/profiling-node");
|
|
6
6
|
const determine_sentry_environment_1 = require("./determine-sentry-environment");
|
|
7
7
|
const determine_sentry_release_1 = require("./determine-sentry-release");
|
|
8
|
-
function sentryInitHook(options = {}) {
|
|
9
|
-
return (
|
|
8
|
+
function sentryInitHook(options = {}, callback) {
|
|
9
|
+
return (appOptions, environment) => {
|
|
10
10
|
const dsn = process.env['SENTRY_DSN'] ?? environment.sentry?.dsn;
|
|
11
11
|
if (!dsn) {
|
|
12
12
|
console.warn('No sentry dsn provided.');
|
|
13
13
|
}
|
|
14
|
-
Sentry.init({
|
|
14
|
+
const client = Sentry.init({
|
|
15
15
|
dsn,
|
|
16
16
|
enabled: process.env['SENTRY_ENABLED'] === 'true' ||
|
|
17
17
|
(environment.sentry?.enabled ?? false),
|
|
@@ -31,5 +31,8 @@ function sentryInitHook(options = {}) {
|
|
|
31
31
|
enableLogs: true,
|
|
32
32
|
...options,
|
|
33
33
|
});
|
|
34
|
+
if (callback) {
|
|
35
|
+
callback(client, appOptions, environment);
|
|
36
|
+
}
|
|
34
37
|
};
|
|
35
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConsoleLoggerOptions, DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { PrintMessagesFunction } from '@rxap/nest-logger';
|
|
2
|
+
import { FormatMessageFunction, PrintMessagesFunction } from '@rxap/nest-logger';
|
|
3
3
|
import { SentryModuleOptions } from './sentry.interfaces';
|
|
4
4
|
export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<SentryModuleOptions, "register", "create", {
|
|
5
5
|
isGlobal: boolean;
|
|
@@ -8,8 +8,12 @@ export declare const ConfigurableModuleClass: import("@nestjs/common").Configura
|
|
|
8
8
|
}>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<SentryModuleOptions, "create"> & Partial<{
|
|
9
9
|
isGlobal: boolean;
|
|
10
10
|
}>;
|
|
11
|
+
export interface LoggerFunctions {
|
|
12
|
+
printMessagesFunction?: PrintMessagesFunction;
|
|
13
|
+
formatMessageFunction?: FormatMessageFunction;
|
|
14
|
+
}
|
|
11
15
|
export declare class SentryLoggerModule extends ConfigurableModuleClass {
|
|
12
|
-
static register(options: typeof OPTIONS_TYPE, consoleLoggerOptions?: ConsoleLoggerOptions | null,
|
|
13
|
-
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE, consoleLoggerOptions?: ConsoleLoggerOptions | null,
|
|
16
|
+
static register(options: typeof OPTIONS_TYPE, consoleLoggerOptions?: ConsoleLoggerOptions | null, loggerFunctions?: LoggerFunctions | null): DynamicModule;
|
|
17
|
+
static registerAsync(options: typeof ASYNC_OPTIONS_TYPE, consoleLoggerOptions?: ConsoleLoggerOptions | null, loggerFunctions?: LoggerFunctions | null): DynamicModule;
|
|
14
18
|
private static updateProviders;
|
|
15
19
|
}
|
|
@@ -15,13 +15,13 @@ _a = new common_1.ConfigurableModuleBuilder()
|
|
|
15
15
|
})
|
|
16
16
|
.build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN, exports.OPTIONS_TYPE = _a.OPTIONS_TYPE, exports.ASYNC_OPTIONS_TYPE = _a.ASYNC_OPTIONS_TYPE;
|
|
17
17
|
let SentryLoggerModule = class SentryLoggerModule extends exports.ConfigurableModuleClass {
|
|
18
|
-
static register(options, consoleLoggerOptions = null,
|
|
19
|
-
return this.updateProviders(super.register(options), consoleLoggerOptions,
|
|
18
|
+
static register(options, consoleLoggerOptions = null, loggerFunctions = null) {
|
|
19
|
+
return this.updateProviders(super.register(options), consoleLoggerOptions, loggerFunctions);
|
|
20
20
|
}
|
|
21
|
-
static registerAsync(options, consoleLoggerOptions = null,
|
|
22
|
-
return this.updateProviders(super.registerAsync(options), consoleLoggerOptions,
|
|
21
|
+
static registerAsync(options, consoleLoggerOptions = null, loggerFunctions = null) {
|
|
22
|
+
return this.updateProviders(super.registerAsync(options), consoleLoggerOptions, loggerFunctions);
|
|
23
23
|
}
|
|
24
|
-
static updateProviders(module, consoleLoggerOptions
|
|
24
|
+
static updateProviders(module, consoleLoggerOptions, loggerFunctions) {
|
|
25
25
|
module.providers ??= [];
|
|
26
26
|
module.providers.push({
|
|
27
27
|
provide: tokens_1.SENTRY_MODULE_OPTIONS,
|
|
@@ -37,10 +37,16 @@ let SentryLoggerModule = class SentryLoggerModule extends exports.ConfigurableMo
|
|
|
37
37
|
}),
|
|
38
38
|
inject: [tokens_1.SENTRY_MODULE_OPTIONS],
|
|
39
39
|
});
|
|
40
|
-
if (printMessagesFunction) {
|
|
40
|
+
if (loggerFunctions?.printMessagesFunction) {
|
|
41
41
|
module.providers.push({
|
|
42
42
|
provide: nest_logger_1.RXAP_LOGGER_PRINT_MESSAGES,
|
|
43
|
-
useValue: printMessagesFunction
|
|
43
|
+
useValue: loggerFunctions?.printMessagesFunction
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (loggerFunctions?.formatMessageFunction) {
|
|
47
|
+
module.providers.push({
|
|
48
|
+
provide: nest_logger_1.RXAP_LOGGER_FORMAT_MESSAGE,
|
|
49
|
+
useValue: loggerFunctions?.formatMessageFunction
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
52
|
return module;
|
package/src/lib/sentry.logger.js
CHANGED
|
@@ -26,7 +26,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
26
26
|
...optionalParams,
|
|
27
27
|
]);
|
|
28
28
|
super.log(message, ...optionalParams);
|
|
29
|
-
if (!this.
|
|
29
|
+
if (!this.sentryOptions.enabled) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
if (this.sentryOptions.logLevels && !['log', 'info'].some(level => this.sentryOptions.logLevels.includes(level))) {
|
|
@@ -52,7 +52,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
52
52
|
...optionalParams,
|
|
53
53
|
]);
|
|
54
54
|
super.error(message, ...optionalParams);
|
|
55
|
-
if (!this.
|
|
55
|
+
if (!this.sentryOptions.enabled) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('error')) {
|
|
@@ -76,7 +76,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
76
76
|
...optionalParams,
|
|
77
77
|
]);
|
|
78
78
|
super.error(message, ...optionalParams);
|
|
79
|
-
if (!this.
|
|
79
|
+
if (!this.sentryOptions.enabled) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('fatal')) {
|
|
@@ -106,7 +106,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
106
106
|
...optionalParams,
|
|
107
107
|
]);
|
|
108
108
|
super.warn(message, ...optionalParams);
|
|
109
|
-
if (!this.
|
|
109
|
+
if (!this.sentryOptions.enabled) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
if (this.sentryOptions.logLevels && !['warn', 'warning'].some(level => this.sentryOptions.logLevels.includes(level))) {
|
|
@@ -141,7 +141,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
141
141
|
...optionalParams,
|
|
142
142
|
]);
|
|
143
143
|
super.debug(message, ...optionalParams);
|
|
144
|
-
if (!this.
|
|
144
|
+
if (!this.sentryOptions.enabled) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
if (this.sentryOptions.logLevels && !this.sentryOptions.logLevels.includes('debug')) {
|
|
@@ -170,7 +170,7 @@ let SentryLogger = class SentryLogger extends nest_logger_1.RxapLogger {
|
|
|
170
170
|
...optionalParams,
|
|
171
171
|
]);
|
|
172
172
|
super.verbose(message, ...optionalParams);
|
|
173
|
-
if (!this.
|
|
173
|
+
if (!this.sentryOptions.enabled) {
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
if (this.sentryOptions.logLevels && !['verbose', 'trace'].some(level => this.sentryOptions.logLevels.includes(level))) {
|