better-ship 0.22.1 → 0.23.1

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.
@@ -7,7 +7,7 @@ export type SentryClientOptions = Sentry.BrowserOptions & {
7
7
  readonly environment: string;
8
8
  readonly enabled: boolean;
9
9
  };
10
- /** Privacy defaults from Porte and browser noise filtering from Typist; explicit SDK options take precedence. */
10
+ /** Filter known DOM errors and use SDK collection defaults; application options take precedence. */
11
11
  export declare function createSentryClientOptions(options: SentryClientOptions): Sentry.BrowserOptions;
12
12
  /** Forward logged browser errors once, excluding TanStack navigation control flow. */
13
13
  export declare function createSentryLoggerErrorHook(): LoggerErrorHook;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/infrastructure/sentry/client.ts"],"mappings":";;;;YAMY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;wBAIK,0BAA0B,SAAS,sBAAsB,OAAO;;wBAehE,+BAA+B;;wBAY/B,iBAAiB,SAAS,sBAAsB,kBAAkB,OAAO;;wBAOzE,uBACd,QAAQ,kBAAkB,OAAO;;qBAOtB,sBAAsB,OAAO"}
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/infrastructure/sentry/client.ts"],"mappings":";;;;YAMY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;wBAIK,0BAA0B,SAAS,sBAAsB,OAAO;;wBAWhE,+BAA+B;;wBAY/B,iBAAiB,SAAS,sBAAsB,kBAAkB,OAAO;;wBAOzE,uBACd,QAAQ,kBAAkB,OAAO;;qBAOtB,sBAAsB,OAAO"}
@@ -3,22 +3,11 @@ import * as Sentry from "@sentry/tanstackstart-react";
3
3
  import { isNotFound, isRedirect } from "@tanstack/react-router";
4
4
 
5
5
  //#region src/infrastructure/sentry/client.ts
6
- /** Privacy defaults from Porte and browser noise filtering from Typist; explicit SDK options take precedence. */
6
+ /** Filter known DOM errors and use SDK collection defaults; application options take precedence. */
7
7
  function createSentryClientOptions(options) {
8
8
  return {
9
- enableLogs: true,
10
- ignoreErrors: [/Failed to execute '(insertBefore|removeChild)' on 'Node'/],
11
- ...options,
12
- dataCollection: {
13
- userInfo: false,
14
- httpBodies: [],
15
- ...options.dataCollection,
16
- genAI: {
17
- inputs: false,
18
- outputs: false,
19
- ...options.dataCollection?.genAI
20
- }
21
- }
9
+ ignoreErrors: [/^NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node\.$/, /^NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node\.$/],
10
+ ...options
22
11
  };
23
12
  }
24
13
  /** Forward logged browser errors once, excluding TanStack navigation control flow. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"sources":["../../src/infrastructure/sentry/client.ts"],"sourcesContent":["import * as Sentry from '@sentry/tanstackstart-react'\nimport { isNotFound, isRedirect } from '@tanstack/react-router'\n\nimport { setLoggerErrorHook, type LoggerErrorHook } from '@/core'\n\n/** Application settings use Sentry's names; enablement and environment belong to the application. */\nexport type SentryClientOptions = Sentry.BrowserOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/** Privacy defaults from Porte and browser noise filtering from Typist; explicit SDK options take precedence. */\nexport function createSentryClientOptions(options: SentryClientOptions): Sentry.BrowserOptions {\n return {\n enableLogs: true,\n ignoreErrors: [/Failed to execute '(insertBefore|removeChild)' on 'Node'/],\n ...options,\n dataCollection: {\n userInfo: false,\n httpBodies: [],\n ...options.dataCollection,\n genAI: { inputs: false, outputs: false, ...options.dataCollection?.genAI },\n },\n }\n}\n\n/** Forward logged browser errors once, excluding TanStack navigation control flow. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (isNotFound(error) || isRedirect(error)) return\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Initialize once in the browser entrypoint before hydration; server imports have no side effects. */\nexport function initializeSentry(options: SentryClientOptions): ReturnType<typeof Sentry.init> {\n const client = Sentry.init(createSentryClientOptions(options))\n setLoggerErrorHook(createSentryLoggerErrorHook())\n return client\n}\n\n/** Attach tracing once after creating the browser router, as Porte does in getRouter. */\nexport function instrumentSentryRouter(\n router: Parameters<typeof Sentry.tanstackRouterBrowserTracingIntegration>[0],\n): void {\n if (router.isServer) return\n Sentry.addIntegration(Sentry.tanstackRouterBrowserTracingIntegration(router))\n}\n\n/** The SDK error boundary; the application supplies its fallback component. */\nexport const ErrorBoundary: typeof Sentry.ErrorBoundary = Sentry.ErrorBoundary\n\nexport { Sentry }\n"],"mappings":";;;;;;AAaA,SAAgB,0BAA0B,SAAqD;CAC7F,OAAO;EACL,YAAY;EACZ,cAAc,CAAC,0DAA0D;EACzE,GAAG;EACH,gBAAgB;GACd,UAAU;GACV,YAAY,CAAC;GACb,GAAG,QAAQ;GACX,OAAO;IAAE,QAAQ;IAAO,SAAS;IAAO,GAAG,QAAQ,gBAAgB;GAAM;EAC3E;CACF;AACF;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,KAAK,KAAK,WAAW,KAAK,GAAG;EAC5C,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,SAAgB,iBAAiB,SAA8D;CAC7F,MAAM,SAAS,OAAO,KAAK,0BAA0B,OAAO,CAAC;CAC7D,mBAAmB,4BAA4B,CAAC;CAChD,OAAO;AACT;;AAGA,SAAgB,uBACd,QACM;CACN,IAAI,OAAO,UAAU;CACrB,OAAO,eAAe,OAAO,wCAAwC,MAAM,CAAC;AAC9E;;AAGA,MAAa,gBAA6C,OAAO"}
1
+ {"version":3,"file":"client.js","names":[],"sources":["../../src/infrastructure/sentry/client.ts"],"sourcesContent":["import * as Sentry from '@sentry/tanstackstart-react'\nimport { isNotFound, isRedirect } from '@tanstack/react-router'\n\nimport { setLoggerErrorHook, type LoggerErrorHook } from '@/core'\n\n/** Application settings use Sentry's names; enablement and environment belong to the application. */\nexport type SentryClientOptions = Sentry.BrowserOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/** Filter known DOM errors and use SDK collection defaults; application options take precedence. */\nexport function createSentryClientOptions(options: SentryClientOptions): Sentry.BrowserOptions {\n return {\n ignoreErrors: [\n /^NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node\\.$/,\n /^NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node\\.$/,\n ],\n ...options,\n }\n}\n\n/** Forward logged browser errors once, excluding TanStack navigation control flow. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (isNotFound(error) || isRedirect(error)) return\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Initialize once in the browser entrypoint before hydration; server imports have no side effects. */\nexport function initializeSentry(options: SentryClientOptions): ReturnType<typeof Sentry.init> {\n const client = Sentry.init(createSentryClientOptions(options))\n setLoggerErrorHook(createSentryLoggerErrorHook())\n return client\n}\n\n/** Attach tracing once after creating the browser router, as Porte does in getRouter. */\nexport function instrumentSentryRouter(\n router: Parameters<typeof Sentry.tanstackRouterBrowserTracingIntegration>[0],\n): void {\n if (router.isServer) return\n Sentry.addIntegration(Sentry.tanstackRouterBrowserTracingIntegration(router))\n}\n\n/** The SDK error boundary; the application supplies its fallback component. */\nexport const ErrorBoundary: typeof Sentry.ErrorBoundary = Sentry.ErrorBoundary\n\nexport { Sentry }\n"],"mappings":";;;;;;AAaA,SAAgB,0BAA0B,SAAqD;CAC7F,OAAO;EACL,cAAc,CACZ,oHACA,iJACF;EACA,GAAG;CACL;AACF;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,KAAK,KAAK,WAAW,KAAK,GAAG;EAC5C,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,SAAgB,iBAAiB,SAA8D;CAC7F,MAAM,SAAS,OAAO,KAAK,0BAA0B,OAAO,CAAC;CAC7D,mBAAmB,4BAA4B,CAAC;CAChD,OAAO;AACT;;AAGA,SAAgB,uBACd,QACM;CACN,IAAI,OAAO,UAAU;CACrB,OAAO,eAAe,OAAO,wCAAwC,MAAM,CAAC;AAC9E;;AAGA,MAAa,gBAA6C,OAAO"}
@@ -8,7 +8,7 @@ export type SentryServerOptions = Sentry.CloudflareOptions & {
8
8
  readonly environment: string;
9
9
  readonly enabled: boolean;
10
10
  };
11
- /** Options for Workers, Durable Objects, and Workflows, ported from Typist and Porte. */
11
+ /** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */
12
12
  export declare function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions;
13
13
  /** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */
14
14
  export declare function createSentryLoggerErrorHook(): LoggerErrorHook;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"mappings":";;;;;YAMY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;wBAIK,oBAAoB,SAAS,sBAAsB,OAAO;;wBAc1D,+BAA+B;;qBAWlC,sCAAsC;;EAEjD,QAAQ,MAAM;;EAKR,mBAAmB,GAAG,WAAW,OAAO,uBAAuB,IAAI,QAAQ,KAAK,QAAQ"}
1
+ {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"mappings":";;;;;YAMY,sBAAsB,OAAO;WAC9B;WACA;WACA;;;wBAIK,oBAAoB,SAAS,sBAAsB,OAAO;;wBAK1D,+BAA+B;;qBAWlC,sCAAsC;;EAEjD,QAAQ,MAAM;;EAKR,mBAAmB,GAAG,WAAW,OAAO,uBAAuB,IAAI,QAAQ,KAAK,QAAQ"}
@@ -1,22 +1,9 @@
1
1
  import * as Sentry from "@sentry/cloudflare";
2
2
 
3
3
  //#region src/infrastructure/sentry/server.ts
4
- /** Options for Workers, Durable Objects, and Workflows, ported from Typist and Porte. */
4
+ /** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */
5
5
  function createSentryOptions(options) {
6
- return {
7
- enableLogs: true,
8
- ...options,
9
- dataCollection: {
10
- userInfo: false,
11
- httpBodies: [],
12
- ...options.dataCollection,
13
- genAI: {
14
- inputs: false,
15
- outputs: false,
16
- ...options.dataCollection?.genAI
17
- }
18
- }
19
- };
6
+ return options;
20
7
  }
21
8
  /** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */
22
9
  function createSentryLoggerErrorHook() {
@@ -35,11 +22,11 @@ function createSentryLoggerErrorHook() {
35
22
  var SentryObservabilityService = class {
36
23
  /** Attribute subsequent reports in the current isolation scope. */
37
24
  setUser(user) {
38
- Sentry.setUser(user);
25
+ Sentry.setUser({ id: user.id });
39
26
  }
40
27
  /** Await work in a separate scope for each queue message or concurrent operation. */
41
28
  async withIsolationScope(callback) {
42
- return await Sentry.withIsolationScope(callback);
29
+ return await Sentry.withIsolationScope((scope) => callback({ setUser: (user) => scope.setUser({ id: user.id }) }));
43
30
  }
44
31
  };
45
32
 
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"sourcesContent":["import * as Sentry from '@sentry/cloudflare'\n\nimport type { ObservabilityScope, ObservabilityService, ObservabilityUser } from '@/application'\nimport type { LoggerErrorHook } from '@/core'\n\n/** Application-owned deployment settings with the full Cloudflare SDK option contract. */\nexport type SentryServerOptions = Sentry.CloudflareOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/** Options for Workers, Durable Objects, and Workflows, ported from Typist and Porte. */\nexport function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions {\n return {\n enableLogs: true,\n ...options,\n dataCollection: {\n userInfo: false,\n httpBodies: [],\n ...options.dataCollection,\n genAI: { inputs: false, outputs: false, ...options.dataCollection?.genAI },\n },\n }\n}\n\n/** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Identity and scope adapter from Typist and Porte; call inside Sentry's instrumented runtime. */\nexport class SentryObservabilityService implements ObservabilityService {\n /** Attribute subsequent reports in the current isolation scope. */\n setUser(user: ObservabilityUser): void {\n Sentry.setUser(user)\n }\n\n /** Await work in a separate scope for each queue message or concurrent operation. */\n async withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T> {\n return await Sentry.withIsolationScope(callback)\n }\n}\n\nexport { Sentry }\n"],"mappings":";;;;AAaA,SAAgB,oBAAoB,SAAwD;CAC1F,OAAO;EACL,YAAY;EACZ,GAAG;EACH,gBAAgB;GACd,UAAU;GACV,YAAY,CAAC;GACb,GAAG,QAAQ;GACX,OAAO;IAAE,QAAQ;IAAO,SAAS;IAAO,GAAG,QAAQ,gBAAgB;GAAM;EAC3E;CACF;AACF;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,IAAa,6BAAb,MAAwE;;CAEtE,QAAQ,MAA+B;EACrC,OAAO,QAAQ,IAAI;CACrB;;CAGA,MAAM,mBAAsB,UAAqE;EAC/F,OAAO,MAAM,OAAO,mBAAmB,QAAQ;CACjD;AACF"}
1
+ {"version":3,"file":"server.js","names":[],"sources":["../../src/infrastructure/sentry/server.ts"],"sourcesContent":["import * as Sentry from '@sentry/cloudflare'\n\nimport type { ObservabilityScope, ObservabilityService, ObservabilityUser } from '@/application'\nimport type { LoggerErrorHook } from '@/core'\n\n/** Application-owned deployment settings with the full Cloudflare SDK option contract. */\nexport type SentryServerOptions = Sentry.CloudflareOptions & {\n readonly dsn: string\n readonly environment: string\n readonly enabled: boolean\n}\n\n/** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */\nexport function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions {\n return options\n}\n\n/** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */\nexport function createSentryLoggerErrorHook(): LoggerErrorHook {\n return ({ error, userId, attributes }) => {\n if (userId !== undefined) {\n Sentry.captureException(error, { extra: attributes, user: { id: userId } })\n return\n }\n Sentry.captureException(error, { extra: attributes })\n }\n}\n\n/** Identity and scope adapter from Typist and Porte; call inside Sentry's instrumented runtime. */\nexport class SentryObservabilityService implements ObservabilityService {\n /** Attribute subsequent reports in the current isolation scope. */\n setUser(user: ObservabilityUser): void {\n Sentry.setUser({ id: user.id })\n }\n\n /** Await work in a separate scope for each queue message or concurrent operation. */\n async withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T> {\n return await Sentry.withIsolationScope((scope) =>\n callback({ setUser: (user) => scope.setUser({ id: user.id }) }),\n )\n }\n}\n\nexport { Sentry }\n"],"mappings":";;;;AAaA,SAAgB,oBAAoB,SAAwD;CAC1F,OAAO;AACT;;AAGA,SAAgB,8BAA+C;CAC7D,QAAQ,EAAE,OAAO,QAAQ,iBAAiB;EACxC,IAAI,WAAW,QAAW;GACxB,OAAO,iBAAiB,OAAO;IAAE,OAAO;IAAY,MAAM,EAAE,IAAI,OAAO;GAAE,CAAC;GAC1E;EACF;EACA,OAAO,iBAAiB,OAAO,EAAE,OAAO,WAAW,CAAC;CACtD;AACF;;AAGA,IAAa,6BAAb,MAAwE;;CAEtE,QAAQ,MAA+B;EACrC,OAAO,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC;CAChC;;CAGA,MAAM,mBAAsB,UAAqE;EAC/F,OAAO,MAAM,OAAO,oBAAoB,UACtC,SAAS,EAAE,UAAU,SAAS,MAAM,QAAQ,EAAE,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC,CAChE;CACF;AACF"}
@@ -0,0 +1,11 @@
1
+ import { ot as ErrorTable } from "../index-DUFS0SJ_.js";
2
+ import { ErrorEvent, EventHint } from "@sentry/cloudflare";
3
+ //#region src/infrastructure/sentry/tanstack.d.ts
4
+ /**
5
+ * Create a Sentry beforeSend filter from the application's error table, as Suparelay does.
6
+ * Drop known payloads and Router control flow after the error middleware reports the original failure.
7
+ * Preserve real errors and unknown failures. Register the logger error hook before using this filter.
8
+ */
9
+ export declare function createSentryErrorFilter<Entries>(errors: ErrorTable<Entries>): (event: ErrorEvent, hint: EventHint) => ErrorEvent | null;
10
+ //#endregion
11
+ //# sourceMappingURL=tanstack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack.d.ts","names":[],"sources":["../../src/infrastructure/sentry/tanstack.ts"],"mappings":";;;;;;;;wBAUgB,wBAAwB,SAAS,QAAQ,WAAW,YAAQ,OACxC,YAAU,MAAQ,cAAY"}
@@ -0,0 +1,20 @@
1
+ import { isNotFound, isRedirect } from "@tanstack/react-router";
2
+
3
+ //#region src/infrastructure/sentry/tanstack.ts
4
+ /**
5
+ * Create a Sentry beforeSend filter from the application's error table, as Suparelay does.
6
+ * Drop known payloads and Router control flow after the error middleware reports the original failure.
7
+ * Preserve real errors and unknown failures. Register the logger error hook before using this filter.
8
+ */
9
+ function createSentryErrorFilter(errors) {
10
+ return function beforeSend(event, hint) {
11
+ const thrown = hint.originalException;
12
+ if (thrown instanceof Error) return event;
13
+ if (isRedirect(thrown) || isNotFound(thrown)) return null;
14
+ return errors.parse(thrown) === null ? event : null;
15
+ };
16
+ }
17
+
18
+ //#endregion
19
+ export { createSentryErrorFilter };
20
+ //# sourceMappingURL=tanstack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack.js","names":[],"sources":["../../src/infrastructure/sentry/tanstack.ts"],"sourcesContent":["import type { ErrorEvent, EventHint } from '@sentry/cloudflare'\nimport { isNotFound, isRedirect } from '@tanstack/react-router'\n\nimport type { ErrorTable } from '@/core'\n\n/**\n * Create a Sentry beforeSend filter from the application's error table, as Suparelay does.\n * Drop known payloads and Router control flow after the error middleware reports the original failure.\n * Preserve real errors and unknown failures. Register the logger error hook before using this filter.\n */\nexport function createSentryErrorFilter<Entries>(errors: ErrorTable<Entries>) {\n return function beforeSend(event: ErrorEvent, hint: EventHint): ErrorEvent | null {\n const thrown = hint.originalException\n if (thrown instanceof Error) return event\n if (isRedirect(thrown) || isNotFound(thrown)) return null\n return errors.parse(thrown) === null ? event : null\n }\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,wBAAiC,QAA6B;CAC5E,OAAO,SAAS,WAAW,OAAmB,MAAoC;EAChF,MAAM,SAAS,KAAK;EACpB,IAAI,kBAAkB,OAAO,OAAO;EACpC,IAAI,WAAW,MAAM,KAAK,WAAW,MAAM,GAAG,OAAO;EACrD,OAAO,OAAO,MAAM,MAAM,MAAM,OAAO,QAAQ;CACjD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"vite.d.ts","names":[],"sources":["../../src/infrastructure/sentry/vite.ts"],"mappings":";;;YAMY,oBAAoB;;;;;wBAMhB,oBACd,UAAS,oBACR,kBAAkB"}
1
+ {"version":3,"file":"vite.d.ts","names":["sentryPlugin"],"sources":["../../src/infrastructure/sentry/vite.ts"],"mappings":";;;YAMY,oBAAoB;;;;;wBAMhB,oBACd,UAAS,oBACR,kBAAkBA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package.json",
3
3
  "name": "better-ship",
4
- "version": "0.22.1",
4
+ "version": "0.23.1",
5
5
  "description": "Foundation for applications on Cloudflare Workers: logger, errors, message bus, infrastructure adapters, and UI primitives",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -43,6 +43,7 @@
43
43
  "./resend": "./dist/resend.js",
44
44
  "./sentry/client": "./dist/sentry/client.js",
45
45
  "./sentry/server": "./dist/sentry/server.js",
46
+ "./sentry/tanstack": "./dist/sentry/tanstack.js",
46
47
  "./sentry/vite": "./dist/sentry/vite.js",
47
48
  "./stripe/client": "./dist/stripe/client.js",
48
49
  "./stripe/event-map": "./dist/stripe/event-map.js",
@@ -65,52 +66,52 @@
65
66
  "better-result": "^3.0.1",
66
67
  "http-status-codes": "^2.3.0",
67
68
  "uuid": "^14.0.2",
68
- "zod": "^4.6.4"
69
+ "zod": "^4.6.5"
69
70
  },
70
71
  "devDependencies": {
71
- "@better-auth/stripe": "^1.7.4",
72
- "@cloudflare/vitest-plugin": "^1.1.8",
73
- "@cloudflare/workers-types": "5.20260911.1",
74
- "@posthog/react": "^1.10.6",
75
- "@sentry/cloudflare": "^10.74.0",
76
- "@sentry/tanstackstart-react": "^10.74.0",
77
- "@tanstack/react-router": "^1.170.35",
78
- "@tanstack/react-start": "^1.168.52",
79
- "@tanstack/start-client-core": "^1.170.29",
80
- "@tanstack/start-storage-context": "^1.167.31",
81
- "@types/node": "^26.5.1",
72
+ "@better-auth/stripe": "^1.7.6",
73
+ "@cloudflare/vitest-plugin": "^1.3.1",
74
+ "@cloudflare/workers-types": "5.20260929.1",
75
+ "@posthog/react": "^1.11.2",
76
+ "@sentry/cloudflare": "^11.1.0",
77
+ "@sentry/tanstackstart-react": "^11.1.0",
78
+ "@tanstack/react-router": "^1.170.40",
79
+ "@tanstack/react-start": "^1.168.59",
80
+ "@tanstack/start-client-core": "^1.170.33",
81
+ "@tanstack/start-storage-context": "^1.167.35",
82
+ "@types/node": "^26.6.3",
82
83
  "@types/react": "^19.3.0",
83
84
  "@vitest/browser-playwright": "^4.1.11",
84
- "auth": "^1.7.4",
85
- "better-auth": "^1.7.4",
86
- "drizzle-kit": "^0.31.10",
87
- "drizzle-orm": "^0.45.2",
85
+ "auth": "^1.7.6",
86
+ "better-auth": "^1.7.6",
87
+ "drizzle-kit": "^0.31.11",
88
+ "drizzle-orm": "^0.45.3",
88
89
  "playwright": "^1.63.0",
89
90
  "postgres": "^3.4.9",
90
- "posthog-js": "^1.430.3",
91
- "posthog-node": "^5.52.1",
91
+ "posthog-js": "^1.434.18",
92
+ "posthog-node": "^5.54.1",
92
93
  "react": "^19.3.0",
93
- "resend": "^6.28.0",
94
+ "resend": "^6.30.0",
94
95
  "standardwebhooks": "^1.1.1",
95
96
  "stripe": "^22.6.2",
96
97
  "tsdown": "^0.23.0",
97
98
  "typescript": "^7.0.2",
98
99
  "vitest": "^4.1.11",
99
- "wrangler": "^4.131.1"
100
+ "wrangler": "^4.143.0"
100
101
  },
101
102
  "peerDependencies": {
102
- "@better-auth/stripe": "^1.7.4",
103
- "@posthog/react": "^1.10.6",
104
- "@sentry/cloudflare": "^10.74.0",
105
- "@sentry/tanstackstart-react": "^10.74.0",
106
- "@tanstack/react-router": "^1.170.35",
107
- "@tanstack/react-start": "^1.168.52",
108
- "better-auth": "^1.7.4",
109
- "drizzle-orm": "^0.45.2",
110
- "posthog-js": "^1.430.3",
111
- "posthog-node": "^5.52.1",
103
+ "@better-auth/stripe": "^1.7.6",
104
+ "@posthog/react": "^1.11.2",
105
+ "@sentry/cloudflare": "^11.1.0",
106
+ "@sentry/tanstackstart-react": "^11.1.0",
107
+ "@tanstack/react-router": "^1.170.40",
108
+ "@tanstack/react-start": "^1.168.59",
109
+ "better-auth": "^1.7.6",
110
+ "drizzle-orm": "^0.45.3",
111
+ "posthog-js": "^1.434.18",
112
+ "posthog-node": "^5.54.1",
112
113
  "react": "^19.3.0",
113
- "resend": "^6.28.0",
114
+ "resend": "^6.30.0",
114
115
  "stripe": "^22.6.2"
115
116
  },
116
117
  "peerDependenciesMeta": {
@@ -10,18 +10,14 @@ export type SentryClientOptions = Sentry.BrowserOptions & {
10
10
  readonly enabled: boolean
11
11
  }
12
12
 
13
- /** Privacy defaults from Porte and browser noise filtering from Typist; explicit SDK options take precedence. */
13
+ /** Filter known DOM errors and use SDK collection defaults; application options take precedence. */
14
14
  export function createSentryClientOptions(options: SentryClientOptions): Sentry.BrowserOptions {
15
15
  return {
16
- enableLogs: true,
17
- ignoreErrors: [/Failed to execute '(insertBefore|removeChild)' on 'Node'/],
16
+ ignoreErrors: [
17
+ /^NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node\.$/,
18
+ /^NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node\.$/,
19
+ ],
18
20
  ...options,
19
- dataCollection: {
20
- userInfo: false,
21
- httpBodies: [],
22
- ...options.dataCollection,
23
- genAI: { inputs: false, outputs: false, ...options.dataCollection?.genAI },
24
- },
25
21
  }
26
22
  }
27
23
 
@@ -10,18 +10,9 @@ export type SentryServerOptions = Sentry.CloudflareOptions & {
10
10
  readonly enabled: boolean
11
11
  }
12
12
 
13
- /** Options for Workers, Durable Objects, and Workflows, ported from Typist and Porte. */
13
+ /** Pass application options to Workers, Durable Objects, and Workflows with the SDK defaults. */
14
14
  export function createSentryOptions(options: SentryServerOptions): Sentry.CloudflareOptions {
15
- return {
16
- enableLogs: true,
17
- ...options,
18
- dataCollection: {
19
- userInfo: false,
20
- httpBodies: [],
21
- ...options.dataCollection,
22
- genAI: { inputs: false, outputs: false, ...options.dataCollection?.genAI },
23
- },
24
- }
15
+ return options
25
16
  }
26
17
 
27
18
  /** Register with setLoggerErrorHook once at startup; an explicit user applies only to this report. */
@@ -39,12 +30,14 @@ export function createSentryLoggerErrorHook(): LoggerErrorHook {
39
30
  export class SentryObservabilityService implements ObservabilityService {
40
31
  /** Attribute subsequent reports in the current isolation scope. */
41
32
  setUser(user: ObservabilityUser): void {
42
- Sentry.setUser(user)
33
+ Sentry.setUser({ id: user.id })
43
34
  }
44
35
 
45
36
  /** Await work in a separate scope for each queue message or concurrent operation. */
46
37
  async withIsolationScope<T>(callback: (scope: ObservabilityScope) => T | Promise<T>): Promise<T> {
47
- return await Sentry.withIsolationScope(callback)
38
+ return await Sentry.withIsolationScope((scope) =>
39
+ callback({ setUser: (user) => scope.setUser({ id: user.id }) }),
40
+ )
48
41
  }
49
42
  }
50
43
 
@@ -0,0 +1,18 @@
1
+ import type { ErrorEvent, EventHint } from '@sentry/cloudflare'
2
+ import { isNotFound, isRedirect } from '@tanstack/react-router'
3
+
4
+ import type { ErrorTable } from '@/core'
5
+
6
+ /**
7
+ * Create a Sentry beforeSend filter from the application's error table, as Suparelay does.
8
+ * Drop known payloads and Router control flow after the error middleware reports the original failure.
9
+ * Preserve real errors and unknown failures. Register the logger error hook before using this filter.
10
+ */
11
+ export function createSentryErrorFilter<Entries>(errors: ErrorTable<Entries>) {
12
+ return function beforeSend(event: ErrorEvent, hint: EventHint): ErrorEvent | null {
13
+ const thrown = hint.originalException
14
+ if (thrown instanceof Error) return event
15
+ if (isRedirect(thrown) || isNotFound(thrown)) return null
16
+ return errors.parse(thrown) === null ? event : null
17
+ }
18
+ }