@elysiumjs/plugin-sentry 0.2.0 → 0.2.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 +14 -0
- package/package.json +16 -6
- package/src/index.ts +0 -16
- package/src/plugin.ts +0 -85
- package/src/sentry.module.ts +0 -37
- package/tsconfig.json +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @elysiumjs/plugin-sentry
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`68a0cdd`](https://github.com/na2axl/elysiumjs/commit/68a0cdd8b2e4a003d6e0af2d78985623cae40428), [`2c49acd`](https://github.com/na2axl/elysiumjs/commit/2c49acd3b552aa43765d70339fa216961499e1b5), [`76ba0ff`](https://github.com/na2axl/elysiumjs/commit/76ba0ff18f3c196cebc2189426328f67cb699f46), [`4ebf029`](https://github.com/na2axl/elysiumjs/commit/4ebf029611e6d753a4f1bfdbe247a75d954d9ded), [`bacce71`](https://github.com/na2axl/elysiumjs/commit/bacce7146f667a1a46bf474dc0344fb0111ae12a)]:
|
|
8
|
+
- @elysiumjs/core@0.10.0
|
|
9
|
+
|
|
10
|
+
## 0.2.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`5fef4a7`](https://github.com/na2axl/elysiumjs/commit/5fef4a7199f502fc4fe035299e7670739459a108)]:
|
|
15
|
+
- @elysiumjs/core@0.9.0
|
|
16
|
+
|
|
3
17
|
## 0.2.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysiumjs/plugin-sentry",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Sentry error reporting plugin for the Elysium.js framework.",
|
|
6
6
|
"private": false,
|
|
@@ -10,9 +10,13 @@
|
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/
|
|
13
|
+
"url": "git+https://github.com/na2axl/elysiumjs.git",
|
|
14
|
+
"directory": "@elysiumjs/plugin-sentry"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/na2axl/elysiumjs/tree/main/@elysiumjs/plugin-sentry#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/na2axl/elysiumjs/issues"
|
|
14
19
|
},
|
|
15
|
-
"homepage": "https://github.com/workbud/elysium",
|
|
16
20
|
"scripts": {
|
|
17
21
|
"format": "prettier --write \"./src/**/*.ts\"",
|
|
18
22
|
"clean": "rimraf dist",
|
|
@@ -20,7 +24,9 @@
|
|
|
20
24
|
"build:ts": "tsc",
|
|
21
25
|
"build": "bun run clean && bun run build:js && bun run build:ts",
|
|
22
26
|
"typecheck": "tsc --noEmit",
|
|
23
|
-
"prepublishOnly": "bun run build"
|
|
27
|
+
"prepublishOnly": "bun run build",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"test:coverage": "bun test --coverage"
|
|
24
30
|
},
|
|
25
31
|
"keywords": [
|
|
26
32
|
"elysium",
|
|
@@ -35,11 +41,15 @@
|
|
|
35
41
|
"type": "module",
|
|
36
42
|
"module": "dist/index.js",
|
|
37
43
|
"types": "dist/index.d.ts",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"CHANGELOG.md"
|
|
47
|
+
],
|
|
38
48
|
"devDependencies": {
|
|
39
|
-
"@elysiumjs/core": "0.
|
|
49
|
+
"@elysiumjs/core": "0.10.0"
|
|
40
50
|
},
|
|
41
51
|
"peerDependencies": {
|
|
42
|
-
"@elysiumjs/core": "^0.
|
|
52
|
+
"@elysiumjs/core": "^0.10.0"
|
|
43
53
|
},
|
|
44
54
|
"dependencies": {
|
|
45
55
|
"@elysiajs/opentelemetry": "^1.4.11",
|
package/src/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026-present Workbud Technologies Inc. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
export { plugin } from './plugin';
|
|
16
|
-
export { SentryModule } from './sentry.module';
|
package/src/plugin.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2025-present Workbud Technologies Inc. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
import type { Application, ElysiumPlugin } from '@elysiumjs/core';
|
|
16
|
-
|
|
17
|
-
import { opentelemetry } from '@elysiajs/opentelemetry';
|
|
18
|
-
import { Env } from '@elysiumjs/core';
|
|
19
|
-
import * as Sentry from '@sentry/bun';
|
|
20
|
-
import { Elysia } from 'elysia';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Elysium plugin for Sentry integration.
|
|
24
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
25
|
-
* @param options Plugin options.
|
|
26
|
-
*/
|
|
27
|
-
export const plugin = (options?: Sentry.BunOptions): ElysiumPlugin => {
|
|
28
|
-
return async (_app: Application) => {
|
|
29
|
-
const dsn = options?.dsn ?? Env.get('SENTRY_DSN');
|
|
30
|
-
if (!dsn) {
|
|
31
|
-
throw new Error('Must provide a DSN');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const environment = options?.environment ?? Env.get('SENTRY_ENVIRONMENT');
|
|
35
|
-
|
|
36
|
-
Sentry.init({
|
|
37
|
-
dsn,
|
|
38
|
-
environment,
|
|
39
|
-
tracesSampleRate: 1.0,
|
|
40
|
-
integrations: [
|
|
41
|
-
Sentry.bunServerIntegration(),
|
|
42
|
-
Sentry.onUnhandledRejectionIntegration({
|
|
43
|
-
mode: 'warn'
|
|
44
|
-
}),
|
|
45
|
-
Sentry.onUncaughtExceptionIntegration()
|
|
46
|
-
],
|
|
47
|
-
...options
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
new Elysia({
|
|
52
|
-
name: '@elysiumjs/plugin-sentry'
|
|
53
|
-
})
|
|
54
|
-
.decorate('Sentry', Sentry)
|
|
55
|
-
.use(
|
|
56
|
-
opentelemetry({
|
|
57
|
-
serviceName: options?.serverName
|
|
58
|
-
})
|
|
59
|
-
)
|
|
60
|
-
// Capture exceptions
|
|
61
|
-
.onError({ as: 'global' }, ({ error, Sentry }) => {
|
|
62
|
-
Sentry.captureException(error);
|
|
63
|
-
})
|
|
64
|
-
// Need this to inject attributes into the span
|
|
65
|
-
// https://github.com/elysiajs/opentelemetry/issues/40
|
|
66
|
-
.onAfterResponse(
|
|
67
|
-
{ as: 'global' },
|
|
68
|
-
// @ts-expect-error Unused parameters
|
|
69
|
-
function injectAttributes({
|
|
70
|
-
body,
|
|
71
|
-
cookie,
|
|
72
|
-
params,
|
|
73
|
-
request,
|
|
74
|
-
response,
|
|
75
|
-
route,
|
|
76
|
-
server,
|
|
77
|
-
store,
|
|
78
|
-
headers,
|
|
79
|
-
path,
|
|
80
|
-
query
|
|
81
|
-
}) {}
|
|
82
|
-
)
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
};
|
package/src/sentry.module.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2026-present Workbud Technologies Inc. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
import type * as Sentry from '@sentry/bun';
|
|
16
|
-
|
|
17
|
-
import { Application, Env, MissingModuleConfigError, Module } from '@elysiumjs/core';
|
|
18
|
-
|
|
19
|
-
import { plugin } from './plugin';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Configurable module that installs the Sentry plugin on the root app when serving.
|
|
23
|
-
* `dsn` may come from the config or from `SENTRY_DSN`; boot fails when neither is set.
|
|
24
|
-
* @author Axel Nana <axel.nana@workbud.com>
|
|
25
|
-
*/
|
|
26
|
-
@Module.register({})
|
|
27
|
-
export class SentryModule extends Module.configurable<Sentry.BunOptions>() {
|
|
28
|
-
public override onInit(): void {
|
|
29
|
-
if (!this.config.dsn && !Env.get('SENTRY_DSN')) {
|
|
30
|
-
throw new MissingModuleConfigError(SentryModule.name, ['dsn (or SENTRY_DSN)']);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public override async onServe(app: Parameters<Module['onServe']>[0]): Promise<void> {
|
|
35
|
-
app.use(await plugin(this.config)(Application.instance));
|
|
36
|
-
}
|
|
37
|
-
}
|
package/tsconfig.json
DELETED