@eienjs/adonisjs-sentry 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -3
- package/build/commands/commands.json +1 -1
- package/build/commands/{verify_sentry_integration.mjs → verify_sentry_integration.js} +2 -4
- package/build/{configure.mjs → configure.js} +4 -6
- package/build/index.d.ts +5 -0
- package/build/index.js +5 -0
- package/build/{sentry_middleware.mjs → middleware/sentry_middleware.js} +2 -4
- package/build/{sentry_provider.mjs → providers/sentry_provider.js} +3 -3
- package/build/src/{define_config.d.mts → define_config.d.ts} +1 -1
- package/build/src/{define_config.mjs → define_config.js} +1 -3
- package/build/src/{sentry.mjs → sentry.js} +1 -2
- package/build/stubs/main.d.ts +4 -0
- package/build/stubs/main.js +4 -0
- package/build/types.js +1 -0
- package/package.json +66 -42
- package/build/index.d.mts +0 -5
- package/build/index.mjs +0 -6
- package/build/stubs/main.d.mts +0 -8
- package/build/stubs/main.mjs +0 -12
- package/build/types.mjs +0 -1
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/build/commands/{verify_sentry_integration.d.mts → verify_sentry_integration.d.ts} +0 -0
- /package/build/{configure.d.mts → configure.d.ts} +0 -0
- /package/build/{sentry_middleware.d.mts → middleware/sentry_middleware.d.ts} +0 -0
- /package/build/{sentry_provider.d.mts → providers/sentry_provider.d.ts} +0 -0
- /package/build/src/{sentry.d.mts → sentry.d.ts} +0 -0
- /package/build/{types.d.mts → types.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,11 +7,48 @@
|
|
|
7
7
|
[![Build Status][badge-build]][build]
|
|
8
8
|
[![Total Downloads][badge-downloads]][downloads]
|
|
9
9
|
|
|
10
|
-
> Sentry service provider for AdonisJS.
|
|
10
|
+
> Sentry service provider for AdonisJS v7 application.
|
|
11
11
|
|
|
12
12
|
## Introduction
|
|
13
13
|
|
|
14
|
-
A simple wrapper around the Sentry SDK to make it easier to use with AdonisJS.
|
|
14
|
+
A simple wrapper around the Sentry SDK to make it easier to use with AdonisJS v7 application.
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Install the package using the following command:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
node ace add @eienjs/adonisjs-sentry
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Automatically the command will register the provider and the command included in the package. Now update the `app/exceptions/handler.ts` file:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
// ... your other imports
|
|
28
|
+
import { Sentry } from '@eienjs/adonisjs-sentry';
|
|
29
|
+
|
|
30
|
+
export default class HttpExceptionHandler extends ExceptionHandler {
|
|
31
|
+
async report(error: unknown, ctx: HttpContext) {
|
|
32
|
+
/**
|
|
33
|
+
* Convert the error to a standardized HTTP error
|
|
34
|
+
* format that includes status code and error code
|
|
35
|
+
*/
|
|
36
|
+
const httpError = this.toHttpError(error);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Only report the error if it passes the shouldReport check,
|
|
40
|
+
* which verifies it's not in ignoreStatuses or ignoreCodes
|
|
41
|
+
*/
|
|
42
|
+
if (this.shouldReport(httpError)) {
|
|
43
|
+
Sentry.captureException(httpError);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
await super.report(error, ctx);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
And not forget to update your `.env` file `SENTRY_DSN` value.
|
|
15
52
|
|
|
16
53
|
## Documentation
|
|
17
54
|
|
|
@@ -30,7 +67,7 @@ The `@eienjs/adonisjs-sentry` library is licensed for use under the MIT License
|
|
|
30
67
|
[source]: https://github.com/eienjs/adonisjs-sentry
|
|
31
68
|
[node-version]: https://www.npmjs.com/package/@eienjs/adonisjs-sentry
|
|
32
69
|
[release]: https://www.npmjs.com/package/@eienjs/adonisjs-sentry
|
|
33
|
-
[license]: https://github.com/eienjs/adonisjs-sentry/blob/main/LICENSE
|
|
70
|
+
[license]: https://github.com/eienjs/adonisjs-sentry/blob/main/LICENSE
|
|
34
71
|
[build]: https://github.com/eienjs/adonisjs-sentry/actions/workflows/build.yml?query=branch:main
|
|
35
72
|
[downloads]: https://www.npmjs.com/package/@eienjs/adonisjs-sentry
|
|
36
73
|
[badge-source]: https://img.shields.io/badge/source-eienjs/adonisjs--sentry-blue.svg?logo=github
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commands":[{"commandName":"sentry:verify","description":"Generate a test event and send it to Sentry","help":"","namespace":"sentry","aliases":[],"flags":[],"args":[],"options":{"startApp":true,"staysAlive":false},"filePath":"verify_sentry_integration.
|
|
1
|
+
{"commands":[{"commandName":"sentry:verify","description":"Generate a test event and send it to Sentry","help":"","namespace":"sentry","aliases":[],"flags":[],"args":[],"options":{"startApp":true,"staysAlive":false},"filePath":"verify_sentry_integration.js"}],"version":1}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseCommand } from "@adonisjs/core/ace";
|
|
2
|
-
|
|
3
2
|
//#region commands/verify_sentry_integration.ts
|
|
4
3
|
var VerifySentryIntegration = class extends BaseCommand {
|
|
5
4
|
static commandName = "sentry:verify";
|
|
@@ -14,7 +13,7 @@ var VerifySentryIntegration = class extends BaseCommand {
|
|
|
14
13
|
this.logger.info("Sentry is disabled");
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
|
-
const { Sentry } = await import("../src/sentry.
|
|
16
|
+
const { Sentry } = await import("../src/sentry.js");
|
|
18
17
|
if (!Sentry.isInitialized()) Sentry.init(sentryConfig);
|
|
19
18
|
try {
|
|
20
19
|
throw new Error("This is a test exception sent from the sentry adonisjs");
|
|
@@ -24,6 +23,5 @@ var VerifySentryIntegration = class extends BaseCommand {
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
|
-
|
|
28
26
|
//#endregion
|
|
29
|
-
export { VerifySentryIntegration as default };
|
|
27
|
+
export { VerifySentryIntegration as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { stubsRoot } from "./stubs/main.
|
|
2
|
-
|
|
1
|
+
import { stubsRoot } from "./stubs/main.js";
|
|
3
2
|
//#region configure.ts
|
|
4
3
|
async function configure(command) {
|
|
5
4
|
const codemods = await command.createCodemods();
|
|
@@ -10,14 +9,13 @@ async function configure(command) {
|
|
|
10
9
|
leadingComment: "Variables for configuring @eienjs/adonisjs-sentry package"
|
|
11
10
|
});
|
|
12
11
|
await codemods.registerMiddleware("router", [{
|
|
13
|
-
path: "@eienjs/adonisjs-sentry/sentry_middleware",
|
|
12
|
+
path: "@eienjs/adonisjs-sentry/middleware/sentry_middleware",
|
|
14
13
|
position: "before"
|
|
15
14
|
}]);
|
|
16
15
|
await codemods.updateRcFile((rcFile) => {
|
|
17
16
|
rcFile.addCommand("@eienjs/adonisjs-sentry/commands");
|
|
18
|
-
rcFile.addProvider("@eienjs/adonisjs-sentry/sentry_provider");
|
|
17
|
+
rcFile.addProvider("@eienjs/adonisjs-sentry/providers/sentry_provider");
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
//#endregion
|
|
23
|
-
export { configure };
|
|
21
|
+
export { configure };
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Sentry } from "
|
|
2
|
-
|
|
1
|
+
import { Sentry } from "../src/sentry.js";
|
|
3
2
|
//#region src/middleware/sentry_middleware.ts
|
|
4
3
|
var SentryMiddleware = class {
|
|
5
4
|
async handle(ctx, next) {
|
|
@@ -9,6 +8,5 @@ var SentryMiddleware = class {
|
|
|
9
8
|
return next();
|
|
10
9
|
}
|
|
11
10
|
};
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
|
-
export { SentryMiddleware as default };
|
|
12
|
+
export { SentryMiddleware as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
//#region providers/sentry_provider.ts
|
|
2
2
|
var SentryProvider = class {
|
|
3
|
+
app;
|
|
3
4
|
constructor(app) {
|
|
4
5
|
this.app = app;
|
|
5
6
|
}
|
|
6
7
|
async boot() {
|
|
7
8
|
const config = this.app.config.get("sentry", {});
|
|
8
9
|
if (config.enabled) {
|
|
9
|
-
const { Sentry } = await import("
|
|
10
|
+
const { Sentry } = await import("../src/sentry.js");
|
|
10
11
|
Sentry.init(config);
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
};
|
|
14
|
-
|
|
15
15
|
//#endregion
|
|
16
|
-
export { SentryProvider as default };
|
|
16
|
+
export { SentryProvider as default };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { RuntimeException } from "@adonisjs/core/exceptions";
|
|
2
|
-
|
|
3
2
|
//#region src/define_config.ts
|
|
4
3
|
function defineConfig(config) {
|
|
5
4
|
if (!config.environment) throw new RuntimeException("Missing \"environment\" property in sentry config");
|
|
6
5
|
return config;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
//#endregion
|
|
10
|
-
export { defineConfig };
|
|
8
|
+
export { defineConfig };
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eienjs/adonisjs-sentry",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "Sentry service provider for AdonisJS",
|
|
6
6
|
"author": "Fernando Isidro <luffynando@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,51 +20,49 @@
|
|
|
20
20
|
"sentry"
|
|
21
21
|
],
|
|
22
22
|
"exports": {
|
|
23
|
-
".": "./build/index.
|
|
24
|
-
"./commands/verify_sentry_integration": "./build/commands/verify_sentry_integration.
|
|
25
|
-
"./sentry_middleware": "./build/sentry_middleware.
|
|
26
|
-
"./sentry_provider": "./build/sentry_provider.
|
|
27
|
-
"./types": "./build/types.
|
|
23
|
+
".": "./build/index.js",
|
|
24
|
+
"./commands/verify_sentry_integration": "./build/commands/verify_sentry_integration.js",
|
|
25
|
+
"./middleware/sentry_middleware": "./build/middleware/sentry_middleware.js",
|
|
26
|
+
"./providers/sentry_provider": "./build/providers/sentry_provider.js",
|
|
27
|
+
"./types": "./build/types.js",
|
|
28
28
|
"./package.json": "./package.json",
|
|
29
29
|
"./commands": "./build/commands/main.js"
|
|
30
30
|
},
|
|
31
|
-
"
|
|
32
|
-
"module": "./build/index.mjs",
|
|
33
|
-
"types": "./build/index.d.mts",
|
|
31
|
+
"types": "build/index.d.ts",
|
|
34
32
|
"files": [
|
|
35
33
|
"build"
|
|
36
34
|
],
|
|
37
35
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
36
|
+
"node": ">=24.0.0"
|
|
39
37
|
},
|
|
40
38
|
"peerDependencies": {
|
|
41
|
-
"@adonisjs/core": "^
|
|
39
|
+
"@adonisjs/core": "^7.3.4"
|
|
42
40
|
},
|
|
43
41
|
"dependencies": {
|
|
44
|
-
"@sentry/node": "^10.
|
|
42
|
+
"@sentry/node": "^10.62.0"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"@adonisjs/assembler": "^
|
|
48
|
-
"@adonisjs/core": "^
|
|
49
|
-
"@adonisjs/
|
|
50
|
-
"@
|
|
51
|
-
"@commitlint/
|
|
52
|
-
"@
|
|
45
|
+
"@adonisjs/assembler": "^8.4.0",
|
|
46
|
+
"@adonisjs/core": "^7.3.4",
|
|
47
|
+
"@adonisjs/eslint-plugin": "^2.2.2",
|
|
48
|
+
"@adonisjs/tsconfig": "^2.0.0",
|
|
49
|
+
"@commitlint/cli": "^21.1.0",
|
|
50
|
+
"@commitlint/config-conventional": "^21.1.0",
|
|
51
|
+
"@eienjs/eslint-config": "^2.1.2",
|
|
53
52
|
"@japa/assert": "^4.2.0",
|
|
54
53
|
"@japa/file-system": "^3.0.0",
|
|
55
|
-
"@japa/runner": "^5.
|
|
56
|
-
"@
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"eslint": "^
|
|
61
|
-
"eslint-plugin-erasable-syntax-only": "^0.4.0",
|
|
54
|
+
"@japa/runner": "^5.3.0",
|
|
55
|
+
"@types/node": "^24.13.2",
|
|
56
|
+
"auto-changelog": "^2.6.0",
|
|
57
|
+
"c8": "^11.0.0",
|
|
58
|
+
"eslint": "^10.6.0",
|
|
59
|
+
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
62
60
|
"husky": "^9.1.7",
|
|
63
61
|
"is-in-ci": "^2.0.0",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"tsdown": "^0.
|
|
67
|
-
"typescript": "^
|
|
62
|
+
"release-it": "^20.2.1",
|
|
63
|
+
"tsdown": "^0.22.3",
|
|
64
|
+
"tsdown-stale-guard": "^0.1.2",
|
|
65
|
+
"typescript": "^6.0.3"
|
|
68
66
|
},
|
|
69
67
|
"c8": {
|
|
70
68
|
"reporter": [
|
|
@@ -72,6 +70,7 @@
|
|
|
72
70
|
"lcov"
|
|
73
71
|
],
|
|
74
72
|
"exclude": [
|
|
73
|
+
"bin/**",
|
|
75
74
|
"tests/**"
|
|
76
75
|
]
|
|
77
76
|
},
|
|
@@ -86,28 +85,53 @@
|
|
|
86
85
|
},
|
|
87
86
|
"auto-changelog": {
|
|
88
87
|
"template": "keepachangelog",
|
|
89
|
-
"hideCredit": true
|
|
88
|
+
"hideCredit": true,
|
|
89
|
+
"commitLimit": false
|
|
90
90
|
},
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
"release-it": {
|
|
92
|
+
"git": {
|
|
93
|
+
"commit": true,
|
|
94
|
+
"tag": true,
|
|
95
|
+
"push": true,
|
|
96
|
+
"requireCleanWorkingDir": true,
|
|
97
|
+
"commitMessage": "chore(release): :tada: v${version}",
|
|
98
|
+
"tagAnnotation": "chore(release): :tada: v${version}"
|
|
99
|
+
},
|
|
100
|
+
"github": {
|
|
101
|
+
"release": true,
|
|
102
|
+
"web": true,
|
|
103
|
+
"releaseName": "Release v${version}"
|
|
104
|
+
},
|
|
105
|
+
"npm": {
|
|
106
|
+
"publish": true,
|
|
107
|
+
"publishPackageManager": "pnpm",
|
|
108
|
+
"publishArgs": [
|
|
109
|
+
"--no-git-checks"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"hooks": {
|
|
113
|
+
"before:init": [
|
|
114
|
+
"pnpm run lint:check",
|
|
115
|
+
"pnpm run typecheck"
|
|
116
|
+
],
|
|
117
|
+
"after:bump": [
|
|
118
|
+
"pnpm run build",
|
|
119
|
+
"pnpm run changelog"
|
|
120
|
+
]
|
|
121
|
+
}
|
|
96
122
|
},
|
|
97
123
|
"scripts": {
|
|
98
|
-
"changelog": "auto-changelog -p
|
|
124
|
+
"changelog": "auto-changelog -u -p",
|
|
125
|
+
"commitlint": "commitlint --edit",
|
|
99
126
|
"index:commands": "adonis-kit index build/commands",
|
|
100
127
|
"lint": "eslint . --fix",
|
|
101
128
|
"lint:check": "eslint .",
|
|
102
129
|
"typecheck": "tsc --noEmit",
|
|
103
|
-
"test": "node --import
|
|
130
|
+
"test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts",
|
|
104
131
|
"test:coverage": "c8 pnpm run test",
|
|
105
132
|
"tool:code": "pnpm run lint:check && pnpm run typecheck",
|
|
106
133
|
"tool:build": "pnpm run tool:code && pnpm run test",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"postbuild": "pnpm run index:commands",
|
|
110
|
-
"release": "np",
|
|
111
|
-
"version": "pnpm run build && pnpm run changelog"
|
|
134
|
+
"build": "tsdown && pnpm run index:commands",
|
|
135
|
+
"release": "release-it"
|
|
112
136
|
}
|
|
113
137
|
}
|
package/build/index.d.mts
DELETED
package/build/index.mjs
DELETED
package/build/stubs/main.d.mts
DELETED
package/build/stubs/main.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
|
|
4
|
-
//#region stubs/main.ts
|
|
5
|
-
/**
|
|
6
|
-
* Path to the root directory where the stubs are stored. We use
|
|
7
|
-
* this path within commands and the configure hook
|
|
8
|
-
*/
|
|
9
|
-
const stubsRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { stubsRoot };
|
package/build/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
/package/{LICENSE.md → LICENSE}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|