@rxap/nest-sentry 10.2.0 → 10.3.0-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 CHANGED
@@ -3,6 +3,13 @@
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
+ # [10.3.0-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@10.2.0...@rxap/nest-sentry@10.3.0-dev.0) (2024-05-31)
7
+
8
+ ### Features
9
+
10
+ - add the SentryLoggerModule ([8961f9b](https://gitlab.com/rxap/packages/commit/8961f9b5089480b202de8bcabc9c94f211f1906d))
11
+ - add the SentryLoggerModule ([76039d0](https://gitlab.com/rxap/packages/commit/76039d071726096f65c4c920b667f667b12ac673))
12
+
6
13
  # [10.2.0](https://gitlab.com/rxap/packages/compare/@rxap/nest-sentry@10.0.2-dev.1...@rxap/nest-sentry@10.2.0) (2024-05-30)
7
14
 
8
15
  **Note:** Version bump only for package @rxap/nest-sentry
package/README.md CHANGED
@@ -17,5 +17,5 @@ yarn add @rxap/nest-sentry
17
17
  ```
18
18
  **Install peer dependencies:**
19
19
  ```bash
20
- yarn add @nestjs/common@^10.3.8 @nestjs/config@^3.2.2 @rxap/nest-logger@^10.0.2-dev.1 @rxap/nest-utilities@^10.0.2-dev.1 @sentry/core@^7.56.0 @sentry/node@^7.56.0 @sentry/types@^7.56.0 rxjs@^7.8.1
20
+ yarn add @nestjs/common@^10.3.8 @nestjs/config@^3.2.2 @rxap/nest-logger@^10.2.0 @rxap/nest-utilities@^10.3.0 @rxap/ts-morph@* @rxap/workspace-utilities@* @sentry/core@^7.56.0 @sentry/node@^7.56.0 @sentry/types@^7.56.0 rxjs@^7.8.1
21
21
  ```
@@ -0,0 +1,9 @@
1
+ {
2
+ "generators": {
3
+ "replace-setup-function-with-module-import": {
4
+ "version": "10.3.0-dev.0",
5
+ "description": "Replace the SetupSentryLogger function with an SentryLoggerModule import",
6
+ "implementation": "./src/migrations/10.0.0/replace-setup-function-with-module-import/replace-setup-function-with-module-import"
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
- "version": "10.2.0",
2
+ "version": "10.3.0-dev.0",
3
3
  "name": "@rxap/nest-sentry",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
6
+ "@nx/devkit": "19.1.1",
6
7
  "tslib": "2.6.2"
7
8
  },
8
9
  "peerDependencies": {
9
10
  "@nestjs/common": "^10.3.8",
10
11
  "@nestjs/config": "^3.2.2",
11
- "@rxap/nest-logger": "^10.0.2-dev.1",
12
- "@rxap/nest-utilities": "^10.0.2-dev.1",
12
+ "@rxap/nest-logger": "^10.2.0",
13
+ "@rxap/nest-utilities": "^10.3.0",
14
+ "@rxap/ts-morph": "*",
15
+ "@rxap/workspace-utilities": "*",
13
16
  "@sentry/core": "^7.56.0",
14
17
  "@sentry/node": "^7.56.0",
15
18
  "@sentry/types": "^7.56.0",
@@ -32,6 +35,9 @@
32
35
  "scope:integration",
33
36
  "sentry"
34
37
  ],
38
+ "ng-update": {
39
+ "migrations": "./migrations.json"
40
+ },
35
41
  "nx-migrations": {
36
42
  "packageGroup": [
37
43
  {
@@ -44,11 +50,11 @@
44
50
  },
45
51
  {
46
52
  "package": "@rxap/nest-logger",
47
- "version": "10.0.2-dev.1"
53
+ "version": "10.2.0"
48
54
  },
49
55
  {
50
56
  "package": "@rxap/nest-utilities",
51
- "version": "10.0.2-dev.1"
57
+ "version": "10.3.0"
52
58
  }
53
59
  ]
54
60
  },
@@ -62,6 +68,6 @@
62
68
  "directory": "packages/nest/sentry"
63
69
  },
64
70
  "type": "commonjs",
65
- "gitHead": "60199dc451a63ab04d94892ad1e2e9d5a737c260",
71
+ "gitHead": "41ec24b8d91caeefbf6ad32f39d813cb114a62cc",
66
72
  "main": "./src/index.js"
67
73
  }
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './lib/sentry-logger.module';
1
2
  export * from './lib/sentry-options.factory';
2
3
  export * from './lib/sentry.interceptor';
3
4
  export * from './lib/sentry.interfaces';
package/src/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  // region
5
+ tslib_1.__exportStar(require("./lib/sentry-logger.module"), exports);
5
6
  tslib_1.__exportStar(require("./lib/sentry-options.factory"), exports);
6
7
  tslib_1.__exportStar(require("./lib/sentry.interceptor"), exports);
7
8
  tslib_1.__exportStar(require("./lib/sentry.interfaces"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nest/sentry/src/index.ts"],"names":[],"mappings":";;;AAAA,UAAU;AACV,uEAA6C;AAC7C,mEAAyC;AACzC,kEAAwC;AACxC,8DAAoC;AACpC,8DAAoC;AACpC,+DAAqC;AACrC,oEAA0C;AAC1C,uDAA6B;AAC7B,YAAY"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nest/sentry/src/index.ts"],"names":[],"mappings":";;;AAAA,UAAU;AACV,qEAA2C;AAC3C,uEAA6C;AAC7C,mEAAyC;AACzC,kEAAwC;AACxC,8DAAoC;AACpC,8DAAoC;AACpC,+DAAqC;AACrC,oEAA0C;AAC1C,uDAA6B;AAC7B,YAAY"}
@@ -0,0 +1,2 @@
1
+ export declare class SentryLoggerModule {
2
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SentryLoggerModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const config_1 = require("@nestjs/config");
7
+ const nest_logger_1 = require("@rxap/nest-logger");
8
+ const nest_sentry_1 = require("@rxap/nest-sentry");
9
+ let SentryLoggerModule = class SentryLoggerModule {
10
+ };
11
+ exports.SentryLoggerModule = SentryLoggerModule;
12
+ exports.SentryLoggerModule = SentryLoggerModule = tslib_1.__decorate([
13
+ (0, common_1.Global)(),
14
+ (0, common_1.Module)({
15
+ providers: [
16
+ {
17
+ provide: common_1.Logger,
18
+ useFactory: (config, sentry, rxap) => {
19
+ if (config.get('SENTRY_ENABLED')) {
20
+ return sentry;
21
+ }
22
+ else {
23
+ return rxap;
24
+ }
25
+ },
26
+ inject: [config_1.ConfigService, nest_sentry_1.SentryLogger, nest_logger_1.RxapLogger]
27
+ },
28
+ nest_sentry_1.SentryLogger,
29
+ nest_logger_1.RxapLogger,
30
+ ],
31
+ exports: [common_1.Logger],
32
+ })
33
+ ], SentryLoggerModule);
34
+ //# sourceMappingURL=sentry-logger.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentry-logger.module.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/sentry-logger.module.ts"],"names":[],"mappings":";;;;AAAA,2CAIwB;AACxB,2CAA+C;AAC/C,mDAA+C;AAC/C,mDAAiD;AAqB1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAnB9B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,eAAM;gBACf,UAAU,EAAE,CAAC,MAAqB,EAAE,MAAoB,EAAE,IAAgB,EAAE,EAAE;oBAC5E,IAAI,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;wBACjC,OAAO,MAAM,CAAC;oBAChB,CAAC;yBAAM,CAAC;wBACN,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;gBACD,MAAM,EAAE,CAAE,sBAAa,EAAE,0BAAY,EAAE,wBAAU,CAAE;aACpD;YACD,0BAAY;YACZ,wBAAU;SACX;QACD,OAAO,EAAE,CAAE,eAAM,CAAE;KACpB,CAAC;GACW,kBAAkB,CAAG"}
@@ -1,3 +1,6 @@
1
1
  import { INestApplication } from '@nestjs/common';
2
2
  import { ConfigService } from '@nestjs/config';
3
+ /**
4
+ * @deprecated instead import the module SentryLoggerModule in the AppModule
5
+ */
3
6
  export declare function SetupSentryLogger(): (app: INestApplication, config: ConfigService) => void;
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SetupSentryLogger = void 0;
4
4
  const nest_logger_1 = require("@rxap/nest-logger");
5
5
  const sentry_logger_1 = require("./sentry.logger");
6
+ /**
7
+ * @deprecated instead import the module SentryLoggerModule in the AppModule
8
+ */
6
9
  function SetupSentryLogger() {
7
10
  return (app, config) => {
8
11
  if (config.get('SENTRY_ENABLED')) {
@@ -1 +1 @@
1
- {"version":3,"file":"setup-sentry-logger.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/setup-sentry-logger.ts"],"names":[],"mappings":";;;AAEA,mDAA+C;AAC/C,mDAA+C;AAE/C,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,GAAqB,EAAE,MAAqB,EAAE,EAAE;QACtD,IAAI,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,4BAAY,CAAC,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,SAAS,CAAC,IAAI,wBAAU,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AARD,8CAQC"}
1
+ {"version":3,"file":"setup-sentry-logger.js","sourceRoot":"","sources":["../../../../../../packages/nest/sentry/src/lib/setup-sentry-logger.ts"],"names":[],"mappings":";;;AAEA,mDAA+C;AAC/C,mDAA+C;AAE/C;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,GAAqB,EAAE,MAAqB,EAAE,EAAE;QACtD,IAAI,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,4BAAY,CAAC,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,SAAS,CAAC,IAAI,wBAAU,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AARD,8CAQC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): void;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ts_morph_1 = require("@rxap/ts-morph");
4
+ const workspace_utilities_1 = require("@rxap/workspace-utilities");
5
+ function update(tree) {
6
+ for (const { isFile, path } of (0, workspace_utilities_1.VisitTree)(tree, '/')) {
7
+ if (isFile) {
8
+ let hasSetupSentryLoggerFunction = false;
9
+ if (path.endsWith('main.ts')) {
10
+ let content = tree.read(path, 'utf-8');
11
+ const lineIndex = content.split('\n').findIndex(line => line.includes('server.after(SetupSentryLogger())'));
12
+ if (lineIndex !== -1) {
13
+ hasSetupSentryLoggerFunction = true;
14
+ // remove the line from content
15
+ content = content.split('\n').filter((_, index) => index !== lineIndex).join('\n');
16
+ tree.write(path, content);
17
+ }
18
+ }
19
+ if (hasSetupSentryLoggerFunction && path.endsWith('app.module.ts')) {
20
+ let content = tree.read(path, 'utf-8');
21
+ if (content.includes('@nestjs/common') && content.includes('@Module')) {
22
+ const project = (0, ts_morph_1.CreateProject)();
23
+ const sourceFile = project.createSourceFile('app.module.ts', content);
24
+ (0, ts_morph_1.CoerceNestModuleImport)(sourceFile, {
25
+ moduleName: 'SentryLoggerModule',
26
+ moduleSpecifier: '@rxap/nest-sentry'
27
+ });
28
+ (0, ts_morph_1.RemoveNestModuleImport)(sourceFile, { moduleName: 'LoggerModule' });
29
+ content = sourceFile.getFullText();
30
+ tree.write(path, content);
31
+ }
32
+ }
33
+ if (path.endsWith('module.ts')) {
34
+ let content = tree.read(path, 'utf-8');
35
+ if (content.includes('@nestjs/common') && content.includes('@Module')) {
36
+ const project = (0, ts_morph_1.CreateProject)();
37
+ const sourceFile = project.createSourceFile('app.module.ts', content);
38
+ (0, ts_morph_1.RemoveNestModuleProvider)(sourceFile, { providerObject: 'Logger' });
39
+ content = sourceFile.getFullText();
40
+ tree.write(path, content);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ exports.default = update;
47
+ //# sourceMappingURL=replace-setup-function-with-module-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-setup-function-with-module-import.js","sourceRoot":"","sources":["../../../../../../../../packages/nest/sentry/src/migrations/10.0.0/replace-setup-function-with-module-import/replace-setup-function-with-module-import.ts"],"names":[],"mappings":";;AACA,6CAKwB;AACxB,mEAAsD;AAEtD,SAAwB,MAAM,CAAC,IAAU;IAEvC,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,IAAA,+BAAS,EAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QAEpD,IAAI,MAAM,EAAE,CAAC;YAEX,IAAI,4BAA4B,GAAG,KAAK,CAAC;YAEzC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC7B,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAE,CAAC;gBAExC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,CAAC;gBAE5G,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;oBACrB,4BAA4B,GAAG,IAAI,CAAC;oBACpC,+BAA+B;oBAC/B,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAA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