@jubstaa/glitchtip 0.0.0-stage → 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 İlker Balcılar
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/README.md CHANGED
@@ -1,3 +1,85 @@
1
- # Temporary Holding Version
1
+ # glitchtip
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Privacy-first Sentry SDK options for the projects in this account that report
4
+ errors to a self-hosted [GlitchTip](https://glitchtip.com).
5
+
6
+ GlitchTip speaks the Sentry protocol, so every project uses the official Sentry
7
+ SDK for its platform. What GlitchTip does not have is Sentry's server-side data
8
+ scrubbing, so anything the SDK sends is stored as is. This package holds the one
9
+ set of client-side defaults that keeps personal data out of those events, so the
10
+ projects do not each carry their own copy.
11
+
12
+ ## Features
13
+
14
+ - Turns off the `dataCollection` categories that both SDK majors share:
15
+ cookies, headers, bodies, query strings, user info, database query data,
16
+ GraphQL and AI payloads and local variables in stack frames. MCP content
17
+ follows the AI setting. Queue task arguments, which only `@sentry/core` 11
18
+ knows, stay at the SDK default.
19
+ - `scrubEvent` removes request details, the user, the host name and breadcrumbs
20
+ from every event before it leaves the process, and strips the query string and
21
+ fragment from the URL.
22
+ - Drops the session integrations and client reports, which GlitchTip does not
23
+ ingest.
24
+ - Ignores browser-extension frames and a short list of errors that are noise
25
+ rather than bugs, such as `ResizeObserver loop` warnings and aborted requests.
26
+ - Works with `@sentry/core` 10 and 11, so it fits `@sentry/react-native`, which
27
+ is still on 10, as well as the browser, Next.js, Node and Bun SDKs.
28
+
29
+ ## Getting started
30
+
31
+ ```bash
32
+ bun add @jubstaa/glitchtip
33
+ ```
34
+
35
+ The Sentry SDK of the platform is a peer: install it as the project normally
36
+ would, for example `@sentry/nextjs` or `@sentry/react-native`.
37
+
38
+ ## Usage
39
+
40
+ Spread the options into the SDK's own `init` and add what belongs to the
41
+ project:
42
+
43
+ ```ts
44
+ import * as Sentry from '@sentry/nextjs'
45
+ import { glitchtipOptions } from '@jubstaa/glitchtip'
46
+
47
+ Sentry.init({
48
+ ...glitchtipOptions,
49
+ dsn: process.env.NEXT_PUBLIC_GLITCHTIP_DSN,
50
+ environment: process.env.NODE_ENV,
51
+ release: process.env.NEXT_PUBLIC_GIT_SHA,
52
+ })
53
+ ```
54
+
55
+ The parts are exported on their own as well, for an SDK that composes options
56
+ differently:
57
+
58
+ | Export | What it is |
59
+ | ------------------------ | -------------------------------------------------------------- |
60
+ | `glitchtipOptions` | The full set of options above |
61
+ | `scrubEvent` | A `beforeSend` that removes personal data from an event |
62
+ | `withoutSessions` | An `integrations` filter that removes the session integrations |
63
+ | `NOISY_ERRORS` | The `ignoreErrors` list |
64
+ | `BROWSER_EXTENSION_URLS` | The `denyUrls` list |
65
+
66
+ To add a project-specific `beforeSend`, call `scrubEvent` from it so the
67
+ scrubbing still runs.
68
+
69
+ ## Development
70
+
71
+ ```bash
72
+ bun install
73
+ bun run lint
74
+ bun run typecheck
75
+ bun run test
76
+ bun run build
77
+ ```
78
+
79
+ `typecheck` checks the source against `@sentry/core` 11 and, through
80
+ `tsconfig.core-10.json`, against `@sentry/core` 10, so an option that only one
81
+ major knows fails the build.
82
+
83
+ ## License
84
+
85
+ [MIT](LICENSE)
@@ -0,0 +1,30 @@
1
+ import type { ErrorEvent, Integration } from '@sentry/core';
2
+ export declare const NOISY_ERRORS: string[];
3
+ export declare const BROWSER_EXTENSION_URLS: RegExp[];
4
+ export declare function scrubEvent(event: ErrorEvent): ErrorEvent;
5
+ export declare function withoutSessions(integrations: Integration[]): Integration[];
6
+ export declare const glitchtipOptions: {
7
+ beforeSend: typeof scrubEvent;
8
+ dataCollection: {
9
+ cookies: false;
10
+ databaseQueryData: false;
11
+ genAI: {
12
+ inputs: false;
13
+ outputs: false;
14
+ };
15
+ graphQL: {
16
+ document: false;
17
+ variables: false;
18
+ };
19
+ httpBodies: never[];
20
+ httpHeaders: false;
21
+ stackFrameVariables: false;
22
+ urlQueryParams: false;
23
+ userInfo: false;
24
+ };
25
+ denyUrls: RegExp[];
26
+ ignoreErrors: string[];
27
+ integrations: typeof withoutSessions;
28
+ sendClientReports: false;
29
+ };
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAW,MAAM,cAAc,CAAA;AAQpE,eAAO,MAAM,YAAY,UAOxB,CAAA;AAED,eAAO,MAAM,sBAAsB,UAIlC,CAAA;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAaxD;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAE1E;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;CAiBV,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ const SESSION_INTEGRATIONS = new Set([
2
+ 'BrowserSession',
3
+ 'Http.Server',
4
+ 'ProcessSession',
5
+ ]);
6
+ export const NOISY_ERRORS = [
7
+ 'ResizeObserver loop completed with undelivered notifications.',
8
+ 'ResizeObserver loop limit exceeded',
9
+ 'AbortError',
10
+ 'The operation was aborted',
11
+ 'The user aborted a request',
12
+ 'Non-Error promise rejection captured',
13
+ ];
14
+ export const BROWSER_EXTENSION_URLS = [
15
+ /^chrome-extension:\/\//,
16
+ /^moz-extension:\/\//,
17
+ /^safari(-web)?-extension:\/\//,
18
+ ];
19
+ export function scrubEvent(event) {
20
+ const { request } = event;
21
+ if (request) {
22
+ if (request.url)
23
+ request.url = stripQuery(request.url);
24
+ delete request.cookies;
25
+ delete request.headers;
26
+ delete request.query_string;
27
+ delete request.data;
28
+ }
29
+ delete event.user;
30
+ delete event.server_name;
31
+ delete event.breadcrumbs;
32
+ return event;
33
+ }
34
+ export function withoutSessions(integrations) {
35
+ return integrations.filter(({ name }) => !SESSION_INTEGRATIONS.has(name));
36
+ }
37
+ export const glitchtipOptions = {
38
+ beforeSend: scrubEvent,
39
+ dataCollection: {
40
+ cookies: false,
41
+ databaseQueryData: false,
42
+ genAI: { inputs: false, outputs: false },
43
+ graphQL: { document: false, variables: false },
44
+ httpBodies: [],
45
+ httpHeaders: false,
46
+ stackFrameVariables: false,
47
+ urlQueryParams: false,
48
+ userInfo: false,
49
+ },
50
+ denyUrls: BROWSER_EXTENSION_URLS,
51
+ ignoreErrors: NOISY_ERRORS,
52
+ integrations: withoutSessions,
53
+ sendClientReports: false,
54
+ };
55
+ function stripQuery(url) {
56
+ return url.split(/[?#]/, 1)[0] ?? url;
57
+ }
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":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K,EAAE,OAAO,EAAE,KAAK,EAAE;QACxC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;QAC9C,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,KAAK;QAClB,mBAAmB,EAAE,KAAK;QAC1B,cAAc,EAAE,KAAK;QACrB,QAAQ,EAAE,KAAK;KAClB;IACD,QAAQ,EAAE,sBAAsB;IAChC,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,eAAe;IAC7B,iBAAiB,EAAE,KAAK;CACT,CAAA;AAEnB,SAAS,UAAU,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAA;AACzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
- "name": "@jubstaa/glitchtip",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@jubstaa/glitchtip",
3
+ "version": "1.0.0",
4
+ "description": "Privacy-first Sentry SDK defaults for projects that report errors to a self-hosted GlitchTip",
5
+ "keywords": [
6
+ "glitchtip",
7
+ "sentry",
8
+ "error-tracking",
9
+ "privacy"
10
+ ],
11
+ "homepage": "https://github.com/Jubstaaa/glitchtip#readme",
12
+ "bugs": "https://github.com/Jubstaaa/glitchtip/issues",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/Jubstaaa/glitchtip.git"
16
+ },
17
+ "license": "MIT",
18
+ "author": "İlker Balcılar",
19
+ "type": "module",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "scripts": {
30
+ "audit": "bun audit --audit-level=high",
31
+ "build": "tsc -p tsconfig.build.json",
32
+ "format": "prettier . --write",
33
+ "format:check": "prettier . --check",
34
+ "lint": "eslint .",
35
+ "prepack": "tsc -p tsconfig.build.json",
36
+ "pack:check": "publint --strict && attw --pack . --profile esm-only",
37
+ "test": "bun test",
38
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.core-10.json"
39
+ },
40
+ "devDependencies": {
41
+ "@arethetypeswrong/cli": "^0.18.5",
42
+ "@jubstaa/config": "^3.16.0",
43
+ "@sentry/core": "^11.23.0",
44
+ "@types/bun": "^1.4.5",
45
+ "eslint": "^10.16.0",
46
+ "prettier": "^3.10.2",
47
+ "publint": "^0.3.25",
48
+ "sentry-core-10": "npm:@sentry/core@10.78.0",
49
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
50
+ },
51
+ "peerDependencies": {
52
+ "@sentry/core": "^10.78.0 || ^11.0.0"
53
+ },
54
+ "packageManager": "bun@1.4.4",
55
+ "publishConfig": {
56
+ "access": "public"
57
+ }
58
+ }