@sentry/tanstackstart-react 10.40.0 → 10.41.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.
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const core = require('@sentry/core');
3
4
  const node = require('@sentry/node');
4
5
  const utils = require('./utils.js');
5
6
 
@@ -30,35 +31,39 @@ const utils = require('./utils.js');
30
31
  function wrapFetchWithSentry(serverEntry) {
31
32
  if (serverEntry.fetch) {
32
33
  serverEntry.fetch = new Proxy(serverEntry.fetch, {
33
- apply: (target, thisArg, args) => {
34
- const request = args[0];
35
- const url = new URL(request.url);
36
- const method = request.method || 'GET';
34
+ async apply(target, thisArg, args) {
35
+ try {
36
+ const request = args[0];
37
+ const url = new URL(request.url);
38
+ const method = request.method || 'GET';
37
39
 
38
- // instrument server functions
39
- if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {
40
- const functionSha256 = utils.extractServerFunctionSha256(url.pathname);
41
- const op = 'function.tanstackstart';
40
+ // instrument server functions
41
+ if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {
42
+ const functionSha256 = utils.extractServerFunctionSha256(url.pathname);
43
+ const op = 'function.tanstackstart';
42
44
 
43
- const serverFunctionSpanAttributes = {
44
- [node.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',
45
- [node.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
46
- 'tanstackstart.function.hash.sha256': functionSha256,
47
- };
45
+ const serverFunctionSpanAttributes = {
46
+ [node.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',
47
+ [node.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
48
+ 'tanstackstart.function.hash.sha256': functionSha256,
49
+ };
48
50
 
49
- return node.startSpan(
50
- {
51
- op: op,
52
- name: `${method} ${url.pathname}`,
53
- attributes: serverFunctionSpanAttributes,
54
- },
55
- () => {
56
- return target.apply(thisArg, args);
57
- },
58
- );
59
- }
51
+ return await node.startSpan(
52
+ {
53
+ op: op,
54
+ name: `${method} ${url.pathname}`,
55
+ attributes: serverFunctionSpanAttributes,
56
+ },
57
+ async () => {
58
+ return target.apply(thisArg, args);
59
+ },
60
+ );
61
+ }
60
62
 
61
- return target.apply(thisArg, args);
63
+ return await target.apply(thisArg, args);
64
+ } finally {
65
+ await core.flushIfServerless();
66
+ }
62
67
  },
63
68
  });
64
69
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrapFetchWithSentry.js","sources":["../../../src/server/wrapFetchWithSentry.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node';\nimport { extractServerFunctionSha256 } from './utils';\n\nexport type ServerEntry = {\n fetch: (request: Request, opts?: unknown) => Promise<Response> | Response;\n};\n\n/**\n * This function can be used to wrap the server entry request handler to add tracing to server-side functionality.\n * You must explicitly define a server entry point in your application for this to work. This is done by passing the request handler to the `createServerEntry` function.\n * For more information about the server entry point, see the [TanStack Start documentation](https://tanstack.com/start/docs/server-entry).\n *\n * @example\n * ```ts\n * import { wrapFetchWithSentry } from '@sentry/tanstackstart-react';\n *\n * import handler, { createServerEntry } from '@tanstack/react-start/server-entry';\n * import type { ServerEntry } from '@tanstack/react-start/server-entry';\n *\n * const requestHandler: ServerEntry = wrapFetchWithSentry({\n * fetch(request: Request) {\n * return handler.fetch(request);\n * },\n * });\n *\n * export default serverEntry = createServerEntry(requestHandler);\n * ```\n *\n * @param serverEntry - request handler to wrap\n * @returns - wrapped request handler\n */\nexport function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry {\n if (serverEntry.fetch) {\n serverEntry.fetch = new Proxy<typeof serverEntry.fetch>(serverEntry.fetch, {\n apply: (target, thisArg, args) => {\n const request: Request = args[0];\n const url = new URL(request.url);\n const method = request.method || 'GET';\n\n // instrument server functions\n if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {\n const functionSha256 = extractServerFunctionSha256(url.pathname);\n const op = 'function.tanstackstart';\n\n const serverFunctionSpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,\n 'tanstackstart.function.hash.sha256': functionSha256,\n };\n\n return startSpan(\n {\n op: op,\n name: `${method} ${url.pathname}`,\n attributes: serverFunctionSpanAttributes,\n },\n () => {\n return target.apply(thisArg, args);\n },\n );\n }\n\n return target.apply(thisArg, args);\n },\n });\n }\n return serverEntry;\n}\n"],"names":["extractServerFunctionSha256","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","startSpan"],"mappings":";;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,WAAW,EAA4B;AAC3E,EAAE,IAAI,WAAW,CAAC,KAAK,EAAE;AACzB,IAAI,WAAW,CAAC,KAAA,GAAQ,IAAI,KAAK,CAA2B,WAAW,CAAC,KAAK,EAAE;AAC/E,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK;AACxC,QAAQ,MAAM,OAAO,GAAY,IAAI,CAAC,CAAC,CAAC;AACxC,QAAQ,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;AACxC,QAAQ,MAAM,MAAA,GAAS,OAAO,CAAC,MAAA,IAAU,KAAK;;AAE9C;AACA,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,KAAK,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;AAC3F,UAAU,MAAM,iBAAiBA,iCAA2B,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC1E,UAAU,MAAM,EAAA,GAAK,wBAAwB;;AAE7C,UAAU,MAAM,+BAA+B;AAC/C,YAAY,CAACC,qCAAgC,GAAG,oCAAoC;AACpF,YAAY,CAACC,iCAA4B,GAAG,EAAE;AAC9C,YAAY,oCAAoC,EAAE,cAAc;AAChE,WAAW;;AAEX,UAAU,OAAOC,cAAS;AAC1B,YAAY;AACZ,cAAc,EAAE,EAAE,EAAE;AACpB,cAAc,IAAI,EAAE,CAAC,EAAA,MAAA,CAAA,CAAA,EAAA,GAAA,CAAA,QAAA,CAAA,CAAA;AACA,cAAA,UAAA,EAAA,4BAAA;AACA,aAAA;AACA,YAAA,MAAA;AACA,cAAA,OAAA,MAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA;AACA,YAAA,CAAA;AACA,WAAA;AACA,QAAA;;AAEA,QAAA,OAAA,MAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA;AACA,MAAA,CAAA;AACA,KAAA,CAAA;AACA,EAAA;AACA,EAAA,OAAA,WAAA;AACA;;;;"}
1
+ {"version":3,"file":"wrapFetchWithSentry.js","sources":["../../../src/server/wrapFetchWithSentry.ts"],"sourcesContent":["import { flushIfServerless } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node';\nimport { extractServerFunctionSha256 } from './utils';\n\nexport type ServerEntry = {\n fetch: (request: Request, opts?: unknown) => Promise<Response> | Response;\n};\n\n/**\n * This function can be used to wrap the server entry request handler to add tracing to server-side functionality.\n * You must explicitly define a server entry point in your application for this to work. This is done by passing the request handler to the `createServerEntry` function.\n * For more information about the server entry point, see the [TanStack Start documentation](https://tanstack.com/start/docs/server-entry).\n *\n * @example\n * ```ts\n * import { wrapFetchWithSentry } from '@sentry/tanstackstart-react';\n *\n * import handler, { createServerEntry } from '@tanstack/react-start/server-entry';\n * import type { ServerEntry } from '@tanstack/react-start/server-entry';\n *\n * const requestHandler: ServerEntry = wrapFetchWithSentry({\n * fetch(request: Request) {\n * return handler.fetch(request);\n * },\n * });\n *\n * export default serverEntry = createServerEntry(requestHandler);\n * ```\n *\n * @param serverEntry - request handler to wrap\n * @returns - wrapped request handler\n */\nexport function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry {\n if (serverEntry.fetch) {\n serverEntry.fetch = new Proxy<typeof serverEntry.fetch>(serverEntry.fetch, {\n async apply(target, thisArg, args) {\n try {\n const request: Request = args[0];\n const url = new URL(request.url);\n const method = request.method || 'GET';\n\n // instrument server functions\n if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {\n const functionSha256 = extractServerFunctionSha256(url.pathname);\n const op = 'function.tanstackstart';\n\n const serverFunctionSpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,\n 'tanstackstart.function.hash.sha256': functionSha256,\n };\n\n return await startSpan(\n {\n op: op,\n name: `${method} ${url.pathname}`,\n attributes: serverFunctionSpanAttributes,\n },\n async () => {\n return target.apply(thisArg, args);\n },\n );\n }\n\n return await target.apply(thisArg, args);\n } finally {\n await flushIfServerless();\n }\n },\n });\n }\n return serverEntry;\n}\n"],"names":["extractServerFunctionSha256","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_SENTRY_OP","startSpan","flushIfServerless"],"mappings":";;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,WAAW,EAA4B;AAC3E,EAAE,IAAI,WAAW,CAAC,KAAK,EAAE;AACzB,IAAI,WAAW,CAAC,KAAA,GAAQ,IAAI,KAAK,CAA2B,WAAW,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
@@ -1 +1 @@
1
- {"type":"module","version":"10.40.0","sideEffects":false}
1
+ {"type":"module","version":"10.41.0","sideEffects":false}
@@ -1,4 +1,5 @@
1
- import { startSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/node';
1
+ import { flushIfServerless } from '@sentry/core';
2
+ import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node';
2
3
  import { extractServerFunctionSha256 } from './utils.js';
3
4
 
4
5
  /**
@@ -28,35 +29,39 @@ import { extractServerFunctionSha256 } from './utils.js';
28
29
  function wrapFetchWithSentry(serverEntry) {
29
30
  if (serverEntry.fetch) {
30
31
  serverEntry.fetch = new Proxy(serverEntry.fetch, {
31
- apply: (target, thisArg, args) => {
32
- const request = args[0];
33
- const url = new URL(request.url);
34
- const method = request.method || 'GET';
32
+ async apply(target, thisArg, args) {
33
+ try {
34
+ const request = args[0];
35
+ const url = new URL(request.url);
36
+ const method = request.method || 'GET';
35
37
 
36
- // instrument server functions
37
- if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {
38
- const functionSha256 = extractServerFunctionSha256(url.pathname);
39
- const op = 'function.tanstackstart';
38
+ // instrument server functions
39
+ if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {
40
+ const functionSha256 = extractServerFunctionSha256(url.pathname);
41
+ const op = 'function.tanstackstart';
40
42
 
41
- const serverFunctionSpanAttributes = {
42
- [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',
43
- [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
44
- 'tanstackstart.function.hash.sha256': functionSha256,
45
- };
43
+ const serverFunctionSpanAttributes = {
44
+ [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',
45
+ [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
46
+ 'tanstackstart.function.hash.sha256': functionSha256,
47
+ };
46
48
 
47
- return startSpan(
48
- {
49
- op: op,
50
- name: `${method} ${url.pathname}`,
51
- attributes: serverFunctionSpanAttributes,
52
- },
53
- () => {
54
- return target.apply(thisArg, args);
55
- },
56
- );
57
- }
49
+ return await startSpan(
50
+ {
51
+ op: op,
52
+ name: `${method} ${url.pathname}`,
53
+ attributes: serverFunctionSpanAttributes,
54
+ },
55
+ async () => {
56
+ return target.apply(thisArg, args);
57
+ },
58
+ );
59
+ }
58
60
 
59
- return target.apply(thisArg, args);
61
+ return await target.apply(thisArg, args);
62
+ } finally {
63
+ await flushIfServerless();
64
+ }
60
65
  },
61
66
  });
62
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrapFetchWithSentry.js","sources":["../../../src/server/wrapFetchWithSentry.ts"],"sourcesContent":["import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node';\nimport { extractServerFunctionSha256 } from './utils';\n\nexport type ServerEntry = {\n fetch: (request: Request, opts?: unknown) => Promise<Response> | Response;\n};\n\n/**\n * This function can be used to wrap the server entry request handler to add tracing to server-side functionality.\n * You must explicitly define a server entry point in your application for this to work. This is done by passing the request handler to the `createServerEntry` function.\n * For more information about the server entry point, see the [TanStack Start documentation](https://tanstack.com/start/docs/server-entry).\n *\n * @example\n * ```ts\n * import { wrapFetchWithSentry } from '@sentry/tanstackstart-react';\n *\n * import handler, { createServerEntry } from '@tanstack/react-start/server-entry';\n * import type { ServerEntry } from '@tanstack/react-start/server-entry';\n *\n * const requestHandler: ServerEntry = wrapFetchWithSentry({\n * fetch(request: Request) {\n * return handler.fetch(request);\n * },\n * });\n *\n * export default serverEntry = createServerEntry(requestHandler);\n * ```\n *\n * @param serverEntry - request handler to wrap\n * @returns - wrapped request handler\n */\nexport function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry {\n if (serverEntry.fetch) {\n serverEntry.fetch = new Proxy<typeof serverEntry.fetch>(serverEntry.fetch, {\n apply: (target, thisArg, args) => {\n const request: Request = args[0];\n const url = new URL(request.url);\n const method = request.method || 'GET';\n\n // instrument server functions\n if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {\n const functionSha256 = extractServerFunctionSha256(url.pathname);\n const op = 'function.tanstackstart';\n\n const serverFunctionSpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,\n 'tanstackstart.function.hash.sha256': functionSha256,\n };\n\n return startSpan(\n {\n op: op,\n name: `${method} ${url.pathname}`,\n attributes: serverFunctionSpanAttributes,\n },\n () => {\n return target.apply(thisArg, args);\n },\n );\n }\n\n return target.apply(thisArg, args);\n },\n });\n }\n return serverEntry;\n}\n"],"names":[],"mappings":";;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,WAAW,EAA4B;AAC3E,EAAE,IAAI,WAAW,CAAC,KAAK,EAAE;AACzB,IAAI,WAAW,CAAC,KAAA,GAAQ,IAAI,KAAK,CAA2B,WAAW,CAAC,KAAK,EAAE;AAC/E,MAAM,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK;AACxC,QAAQ,MAAM,OAAO,GAAY,IAAI,CAAC,CAAC,CAAC;AACxC,QAAQ,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC;AACxC,QAAQ,MAAM,MAAA,GAAS,OAAO,CAAC,MAAA,IAAU,KAAK;;AAE9C;AACA,QAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,KAAK,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;AAC3F,UAAU,MAAM,iBAAiB,2BAA2B,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC1E,UAAU,MAAM,EAAA,GAAK,wBAAwB;;AAE7C,UAAU,MAAM,+BAA+B;AAC/C,YAAY,CAAC,gCAAgC,GAAG,oCAAoC;AACpF,YAAY,CAAC,4BAA4B,GAAG,EAAE;AAC9C,YAAY,oCAAoC,EAAE,cAAc;AAChE,WAAW;;AAEX,UAAU,OAAO,SAAS;AAC1B,YAAY;AACZ,cAAc,EAAE,EAAE,EAAE;AACpB,cAAc,IAAI,EAAE,CAAC,EAAA,MAAA,CAAA,CAAA,EAAA,GAAA,CAAA,QAAA,CAAA,CAAA;AACA,cAAA,UAAA,EAAA,4BAAA;AACA,aAAA;AACA,YAAA,MAAA;AACA,cAAA,OAAA,MAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA;AACA,YAAA,CAAA;AACA,WAAA;AACA,QAAA;;AAEA,QAAA,OAAA,MAAA,CAAA,KAAA,CAAA,OAAA,EAAA,IAAA,CAAA;AACA,MAAA,CAAA;AACA,KAAA,CAAA;AACA,EAAA;AACA,EAAA,OAAA,WAAA;AACA;;;;"}
1
+ {"version":3,"file":"wrapFetchWithSentry.js","sources":["../../../src/server/wrapFetchWithSentry.ts"],"sourcesContent":["import { flushIfServerless } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startSpan } from '@sentry/node';\nimport { extractServerFunctionSha256 } from './utils';\n\nexport type ServerEntry = {\n fetch: (request: Request, opts?: unknown) => Promise<Response> | Response;\n};\n\n/**\n * This function can be used to wrap the server entry request handler to add tracing to server-side functionality.\n * You must explicitly define a server entry point in your application for this to work. This is done by passing the request handler to the `createServerEntry` function.\n * For more information about the server entry point, see the [TanStack Start documentation](https://tanstack.com/start/docs/server-entry).\n *\n * @example\n * ```ts\n * import { wrapFetchWithSentry } from '@sentry/tanstackstart-react';\n *\n * import handler, { createServerEntry } from '@tanstack/react-start/server-entry';\n * import type { ServerEntry } from '@tanstack/react-start/server-entry';\n *\n * const requestHandler: ServerEntry = wrapFetchWithSentry({\n * fetch(request: Request) {\n * return handler.fetch(request);\n * },\n * });\n *\n * export default serverEntry = createServerEntry(requestHandler);\n * ```\n *\n * @param serverEntry - request handler to wrap\n * @returns - wrapped request handler\n */\nexport function wrapFetchWithSentry(serverEntry: ServerEntry): ServerEntry {\n if (serverEntry.fetch) {\n serverEntry.fetch = new Proxy<typeof serverEntry.fetch>(serverEntry.fetch, {\n async apply(target, thisArg, args) {\n try {\n const request: Request = args[0];\n const url = new URL(request.url);\n const method = request.method || 'GET';\n\n // instrument server functions\n if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {\n const functionSha256 = extractServerFunctionSha256(url.pathname);\n const op = 'function.tanstackstart';\n\n const serverFunctionSpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.tanstackstart.server',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,\n 'tanstackstart.function.hash.sha256': functionSha256,\n };\n\n return await startSpan(\n {\n op: op,\n name: `${method} ${url.pathname}`,\n attributes: serverFunctionSpanAttributes,\n },\n async () => {\n return target.apply(thisArg, args);\n },\n );\n }\n\n return await target.apply(thisArg, args);\n } finally {\n await flushIfServerless();\n }\n },\n });\n }\n return serverEntry;\n}\n"],"names":[],"mappings":";;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,mBAAmB,CAAC,WAAW,EAA4B;AAC3E,EAAE,IAAI,WAAW,CAAC,KAAK,EAAE;AACzB,IAAI,WAAW,CAAC,KAAA,GAAQ,IAAI,KAAK,CAA2B,WAAW,CAAC,KAAK,EAAE;AAC/E,MAAM,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AACzC,QAAQ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"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;CAC3E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAoCzE"}
1
+ {"version":3,"file":"wrapFetchWithSentry.d.ts","sourceRoot":"","sources":["../../../src/server/wrapFetchWithSentry.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;CAC3E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAwCzE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/tanstackstart-react",
3
- "version": "10.40.0",
3
+ "version": "10.41.0",
4
4
  "description": "Official Sentry SDK for TanStack Start React",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/tanstackstart-react",
@@ -57,10 +57,10 @@
57
57
  "dependencies": {
58
58
  "@opentelemetry/api": "^1.9.0",
59
59
  "@opentelemetry/semantic-conventions": "^1.37.0",
60
- "@sentry-internal/browser-utils": "10.40.0",
61
- "@sentry/core": "10.40.0",
62
- "@sentry/node": "10.40.0",
63
- "@sentry/react": "10.40.0",
60
+ "@sentry-internal/browser-utils": "10.41.0",
61
+ "@sentry/core": "10.41.0",
62
+ "@sentry/node": "10.41.0",
63
+ "@sentry/react": "10.41.0",
64
64
  "@sentry/vite-plugin": "^5.1.0"
65
65
  },
66
66
  "devDependencies": {