@sentry/browser 10.53.1 → 10.54.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.
Files changed (445) hide show
  1. package/build/npm/cjs/dev/client.js +15 -54
  2. package/build/npm/cjs/dev/client.js.map +1 -1
  3. package/build/npm/cjs/dev/debug-build.js +0 -5
  4. package/build/npm/cjs/dev/debug-build.js.map +1 -1
  5. package/build/npm/cjs/dev/diagnose-sdk.js +15 -37
  6. package/build/npm/cjs/dev/diagnose-sdk.js.map +1 -1
  7. package/build/npm/cjs/dev/eventbuilder.js +59 -217
  8. package/build/npm/cjs/dev/eventbuilder.js.map +1 -1
  9. package/build/npm/cjs/dev/feedbackAsync.js +1 -5
  10. package/build/npm/cjs/dev/feedbackAsync.js.map +1 -1
  11. package/build/npm/cjs/dev/feedbackSync.js +1 -2
  12. package/build/npm/cjs/dev/feedbackSync.js.map +1 -1
  13. package/build/npm/cjs/dev/helpers.js +24 -102
  14. package/build/npm/cjs/dev/helpers.js.map +1 -1
  15. package/build/npm/cjs/dev/index.js +2 -0
  16. package/build/npm/cjs/dev/index.js.map +1 -1
  17. package/build/npm/cjs/dev/integrations/breadcrumbs.js +52 -134
  18. package/build/npm/cjs/dev/integrations/breadcrumbs.js.map +1 -1
  19. package/build/npm/cjs/dev/integrations/browserapierrors.js +45 -111
  20. package/build/npm/cjs/dev/integrations/browserapierrors.js.map +1 -1
  21. package/build/npm/cjs/dev/integrations/browsersession.js +7 -35
  22. package/build/npm/cjs/dev/integrations/browsersession.js.map +1 -1
  23. package/build/npm/cjs/dev/integrations/contextlines.js +9 -45
  24. package/build/npm/cjs/dev/integrations/contextlines.js.map +1 -1
  25. package/build/npm/cjs/dev/integrations/culturecontext.js +11 -36
  26. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  27. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js +1 -22
  28. package/build/npm/cjs/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  29. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
  30. package/build/npm/cjs/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  31. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js +6 -12
  32. package/build/npm/cjs/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  33. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js +5 -30
  34. package/build/npm/cjs/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  35. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js +10 -47
  36. package/build/npm/cjs/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  37. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js +60 -0
  38. package/build/npm/cjs/dev/integrations/fetchStreamPerformance.js.map +1 -0
  39. package/build/npm/cjs/dev/integrations/globalhandlers.js +38 -99
  40. package/build/npm/cjs/dev/integrations/globalhandlers.js.map +1 -1
  41. package/build/npm/cjs/dev/integrations/graphqlClient.js +31 -119
  42. package/build/npm/cjs/dev/integrations/graphqlClient.js.map +1 -1
  43. package/build/npm/cjs/dev/integrations/httpclient.js +43 -203
  44. package/build/npm/cjs/dev/integrations/httpclient.js.map +1 -1
  45. package/build/npm/cjs/dev/integrations/httpcontext.js +7 -17
  46. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  47. package/build/npm/cjs/dev/integrations/linkederrors.js +7 -15
  48. package/build/npm/cjs/dev/integrations/linkederrors.js.map +1 -1
  49. package/build/npm/cjs/dev/integrations/reportingobserver.js +19 -44
  50. package/build/npm/cjs/dev/integrations/reportingobserver.js.map +1 -1
  51. package/build/npm/cjs/dev/integrations/spanstreaming.js +11 -29
  52. package/build/npm/cjs/dev/integrations/spanstreaming.js.map +1 -1
  53. package/build/npm/cjs/dev/integrations/spotlight.js +17 -30
  54. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  55. package/build/npm/cjs/dev/integrations/view-hierarchy.js +19 -46
  56. package/build/npm/cjs/dev/integrations/view-hierarchy.js.map +1 -1
  57. package/build/npm/cjs/dev/integrations/webWorker.js +40 -211
  58. package/build/npm/cjs/dev/integrations/webWorker.js.map +1 -1
  59. package/build/npm/cjs/dev/profiling/UIProfiler.js +87 -190
  60. package/build/npm/cjs/dev/profiling/UIProfiler.js.map +1 -1
  61. package/build/npm/cjs/dev/profiling/index.js +9 -30
  62. package/build/npm/cjs/dev/profiling/index.js.map +1 -1
  63. package/build/npm/cjs/dev/profiling/integration.js +30 -64
  64. package/build/npm/cjs/dev/profiling/integration.js.map +1 -1
  65. package/build/npm/cjs/dev/profiling/startProfileForSpan.js +28 -84
  66. package/build/npm/cjs/dev/profiling/startProfileForSpan.js.map +1 -1
  67. package/build/npm/cjs/dev/profiling/utils.js +131 -398
  68. package/build/npm/cjs/dev/profiling/utils.js.map +1 -1
  69. package/build/npm/cjs/dev/report-dialog.js +10 -25
  70. package/build/npm/cjs/dev/report-dialog.js.map +1 -1
  71. package/build/npm/cjs/dev/sdk.js +8 -76
  72. package/build/npm/cjs/dev/sdk.js.map +1 -1
  73. package/build/npm/cjs/dev/stack-parsers.js +42 -126
  74. package/build/npm/cjs/dev/stack-parsers.js.map +1 -1
  75. package/build/npm/cjs/dev/tracing/backgroundtab.js +4 -16
  76. package/build/npm/cjs/dev/tracing/backgroundtab.js.map +1 -1
  77. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js +102 -291
  78. package/build/npm/cjs/dev/tracing/browserTracingIntegration.js.map +1 -1
  79. package/build/npm/cjs/dev/tracing/linkedTraces.js +25 -116
  80. package/build/npm/cjs/dev/tracing/linkedTraces.js.map +1 -1
  81. package/build/npm/cjs/dev/tracing/reportPageLoaded.js +1 -9
  82. package/build/npm/cjs/dev/tracing/reportPageLoaded.js.map +1 -1
  83. package/build/npm/cjs/dev/tracing/request.js +58 -223
  84. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  85. package/build/npm/cjs/dev/tracing/setActiveSpan.js +1 -48
  86. package/build/npm/cjs/dev/tracing/setActiveSpan.js.map +1 -1
  87. package/build/npm/cjs/dev/tracing/utils.js +4 -27
  88. package/build/npm/cjs/dev/tracing/utils.js.map +1 -1
  89. package/build/npm/cjs/dev/transports/fetch.js +10 -23
  90. package/build/npm/cjs/dev/transports/fetch.js.map +1 -1
  91. package/build/npm/cjs/dev/transports/offline.js +27 -84
  92. package/build/npm/cjs/dev/transports/offline.js.map +1 -1
  93. package/build/npm/cjs/dev/userfeedback.js +12 -22
  94. package/build/npm/cjs/dev/userfeedback.js.map +1 -1
  95. package/build/npm/cjs/dev/utils/detectBrowserExtension.js +5 -26
  96. package/build/npm/cjs/dev/utils/detectBrowserExtension.js.map +1 -1
  97. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js +40 -75
  98. package/build/npm/cjs/dev/utils/lazyLoadIntegration.js.map +1 -1
  99. package/build/npm/cjs/prod/client.js +15 -54
  100. package/build/npm/cjs/prod/client.js.map +1 -1
  101. package/build/npm/cjs/prod/debug-build.js +0 -5
  102. package/build/npm/cjs/prod/debug-build.js.map +1 -1
  103. package/build/npm/cjs/prod/diagnose-sdk.js +15 -37
  104. package/build/npm/cjs/prod/diagnose-sdk.js.map +1 -1
  105. package/build/npm/cjs/prod/eventbuilder.js +59 -217
  106. package/build/npm/cjs/prod/eventbuilder.js.map +1 -1
  107. package/build/npm/cjs/prod/feedbackAsync.js +1 -5
  108. package/build/npm/cjs/prod/feedbackAsync.js.map +1 -1
  109. package/build/npm/cjs/prod/feedbackSync.js +1 -2
  110. package/build/npm/cjs/prod/feedbackSync.js.map +1 -1
  111. package/build/npm/cjs/prod/helpers.js +24 -102
  112. package/build/npm/cjs/prod/helpers.js.map +1 -1
  113. package/build/npm/cjs/prod/index.js +2 -0
  114. package/build/npm/cjs/prod/index.js.map +1 -1
  115. package/build/npm/cjs/prod/integrations/breadcrumbs.js +52 -134
  116. package/build/npm/cjs/prod/integrations/breadcrumbs.js.map +1 -1
  117. package/build/npm/cjs/prod/integrations/browserapierrors.js +45 -111
  118. package/build/npm/cjs/prod/integrations/browserapierrors.js.map +1 -1
  119. package/build/npm/cjs/prod/integrations/browsersession.js +7 -35
  120. package/build/npm/cjs/prod/integrations/browsersession.js.map +1 -1
  121. package/build/npm/cjs/prod/integrations/contextlines.js +9 -45
  122. package/build/npm/cjs/prod/integrations/contextlines.js.map +1 -1
  123. package/build/npm/cjs/prod/integrations/culturecontext.js +11 -36
  124. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  125. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js +1 -22
  126. package/build/npm/cjs/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  127. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
  128. package/build/npm/cjs/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  129. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js +6 -12
  130. package/build/npm/cjs/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  131. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js +5 -30
  132. package/build/npm/cjs/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  133. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js +10 -47
  134. package/build/npm/cjs/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  135. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js +60 -0
  136. package/build/npm/cjs/prod/integrations/fetchStreamPerformance.js.map +1 -0
  137. package/build/npm/cjs/prod/integrations/globalhandlers.js +38 -99
  138. package/build/npm/cjs/prod/integrations/globalhandlers.js.map +1 -1
  139. package/build/npm/cjs/prod/integrations/graphqlClient.js +31 -119
  140. package/build/npm/cjs/prod/integrations/graphqlClient.js.map +1 -1
  141. package/build/npm/cjs/prod/integrations/httpclient.js +43 -203
  142. package/build/npm/cjs/prod/integrations/httpclient.js.map +1 -1
  143. package/build/npm/cjs/prod/integrations/httpcontext.js +7 -17
  144. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  145. package/build/npm/cjs/prod/integrations/linkederrors.js +7 -15
  146. package/build/npm/cjs/prod/integrations/linkederrors.js.map +1 -1
  147. package/build/npm/cjs/prod/integrations/reportingobserver.js +19 -44
  148. package/build/npm/cjs/prod/integrations/reportingobserver.js.map +1 -1
  149. package/build/npm/cjs/prod/integrations/spanstreaming.js +11 -29
  150. package/build/npm/cjs/prod/integrations/spanstreaming.js.map +1 -1
  151. package/build/npm/cjs/prod/integrations/spotlight.js +17 -30
  152. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  153. package/build/npm/cjs/prod/integrations/view-hierarchy.js +19 -46
  154. package/build/npm/cjs/prod/integrations/view-hierarchy.js.map +1 -1
  155. package/build/npm/cjs/prod/integrations/webWorker.js +40 -211
  156. package/build/npm/cjs/prod/integrations/webWorker.js.map +1 -1
  157. package/build/npm/cjs/prod/profiling/UIProfiler.js +87 -190
  158. package/build/npm/cjs/prod/profiling/UIProfiler.js.map +1 -1
  159. package/build/npm/cjs/prod/profiling/index.js +9 -30
  160. package/build/npm/cjs/prod/profiling/index.js.map +1 -1
  161. package/build/npm/cjs/prod/profiling/integration.js +30 -64
  162. package/build/npm/cjs/prod/profiling/integration.js.map +1 -1
  163. package/build/npm/cjs/prod/profiling/startProfileForSpan.js +28 -84
  164. package/build/npm/cjs/prod/profiling/startProfileForSpan.js.map +1 -1
  165. package/build/npm/cjs/prod/profiling/utils.js +131 -398
  166. package/build/npm/cjs/prod/profiling/utils.js.map +1 -1
  167. package/build/npm/cjs/prod/report-dialog.js +10 -25
  168. package/build/npm/cjs/prod/report-dialog.js.map +1 -1
  169. package/build/npm/cjs/prod/sdk.js +5 -73
  170. package/build/npm/cjs/prod/sdk.js.map +1 -1
  171. package/build/npm/cjs/prod/stack-parsers.js +42 -126
  172. package/build/npm/cjs/prod/stack-parsers.js.map +1 -1
  173. package/build/npm/cjs/prod/tracing/backgroundtab.js +4 -16
  174. package/build/npm/cjs/prod/tracing/backgroundtab.js.map +1 -1
  175. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js +102 -291
  176. package/build/npm/cjs/prod/tracing/browserTracingIntegration.js.map +1 -1
  177. package/build/npm/cjs/prod/tracing/linkedTraces.js +25 -117
  178. package/build/npm/cjs/prod/tracing/linkedTraces.js.map +1 -1
  179. package/build/npm/cjs/prod/tracing/reportPageLoaded.js +1 -9
  180. package/build/npm/cjs/prod/tracing/reportPageLoaded.js.map +1 -1
  181. package/build/npm/cjs/prod/tracing/request.js +58 -223
  182. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  183. package/build/npm/cjs/prod/tracing/setActiveSpan.js +1 -48
  184. package/build/npm/cjs/prod/tracing/setActiveSpan.js.map +1 -1
  185. package/build/npm/cjs/prod/tracing/utils.js +4 -27
  186. package/build/npm/cjs/prod/tracing/utils.js.map +1 -1
  187. package/build/npm/cjs/prod/transports/fetch.js +10 -23
  188. package/build/npm/cjs/prod/transports/fetch.js.map +1 -1
  189. package/build/npm/cjs/prod/transports/offline.js +27 -84
  190. package/build/npm/cjs/prod/transports/offline.js.map +1 -1
  191. package/build/npm/cjs/prod/userfeedback.js +12 -22
  192. package/build/npm/cjs/prod/userfeedback.js.map +1 -1
  193. package/build/npm/cjs/prod/utils/detectBrowserExtension.js +5 -26
  194. package/build/npm/cjs/prod/utils/detectBrowserExtension.js.map +1 -1
  195. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js +40 -75
  196. package/build/npm/cjs/prod/utils/lazyLoadIntegration.js.map +1 -1
  197. package/build/npm/esm/dev/client.js +15 -54
  198. package/build/npm/esm/dev/client.js.map +1 -1
  199. package/build/npm/esm/dev/debug-build.js +0 -5
  200. package/build/npm/esm/dev/debug-build.js.map +1 -1
  201. package/build/npm/esm/dev/diagnose-sdk.js +15 -37
  202. package/build/npm/esm/dev/diagnose-sdk.js.map +1 -1
  203. package/build/npm/esm/dev/eventbuilder.js +59 -217
  204. package/build/npm/esm/dev/eventbuilder.js.map +1 -1
  205. package/build/npm/esm/dev/feedbackAsync.js +1 -5
  206. package/build/npm/esm/dev/feedbackAsync.js.map +1 -1
  207. package/build/npm/esm/dev/feedbackSync.js +1 -2
  208. package/build/npm/esm/dev/feedbackSync.js.map +1 -1
  209. package/build/npm/esm/dev/helpers.js +24 -102
  210. package/build/npm/esm/dev/helpers.js.map +1 -1
  211. package/build/npm/esm/dev/index.js +1 -0
  212. package/build/npm/esm/dev/index.js.map +1 -1
  213. package/build/npm/esm/dev/integrations/breadcrumbs.js +52 -134
  214. package/build/npm/esm/dev/integrations/breadcrumbs.js.map +1 -1
  215. package/build/npm/esm/dev/integrations/browserapierrors.js +45 -111
  216. package/build/npm/esm/dev/integrations/browserapierrors.js.map +1 -1
  217. package/build/npm/esm/dev/integrations/browsersession.js +7 -35
  218. package/build/npm/esm/dev/integrations/browsersession.js.map +1 -1
  219. package/build/npm/esm/dev/integrations/contextlines.js +9 -45
  220. package/build/npm/esm/dev/integrations/contextlines.js.map +1 -1
  221. package/build/npm/esm/dev/integrations/culturecontext.js +11 -36
  222. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  223. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js +1 -22
  224. package/build/npm/esm/dev/integrations/featureFlags/growthbook/integration.js.map +1 -1
  225. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js +6 -31
  226. package/build/npm/esm/dev/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  227. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js +6 -12
  228. package/build/npm/esm/dev/integrations/featureFlags/openfeature/integration.js.map +1 -1
  229. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js +5 -30
  230. package/build/npm/esm/dev/integrations/featureFlags/statsig/integration.js.map +1 -1
  231. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js +10 -47
  232. package/build/npm/esm/dev/integrations/featureFlags/unleash/integration.js.map +1 -1
  233. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js +58 -0
  234. package/build/npm/esm/dev/integrations/fetchStreamPerformance.js.map +1 -0
  235. package/build/npm/esm/dev/integrations/globalhandlers.js +38 -99
  236. package/build/npm/esm/dev/integrations/globalhandlers.js.map +1 -1
  237. package/build/npm/esm/dev/integrations/graphqlClient.js +31 -119
  238. package/build/npm/esm/dev/integrations/graphqlClient.js.map +1 -1
  239. package/build/npm/esm/dev/integrations/httpclient.js +43 -203
  240. package/build/npm/esm/dev/integrations/httpclient.js.map +1 -1
  241. package/build/npm/esm/dev/integrations/httpcontext.js +7 -17
  242. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  243. package/build/npm/esm/dev/integrations/linkederrors.js +7 -15
  244. package/build/npm/esm/dev/integrations/linkederrors.js.map +1 -1
  245. package/build/npm/esm/dev/integrations/reportingobserver.js +19 -44
  246. package/build/npm/esm/dev/integrations/reportingobserver.js.map +1 -1
  247. package/build/npm/esm/dev/integrations/spanstreaming.js +11 -29
  248. package/build/npm/esm/dev/integrations/spanstreaming.js.map +1 -1
  249. package/build/npm/esm/dev/integrations/spotlight.js +17 -30
  250. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  251. package/build/npm/esm/dev/integrations/view-hierarchy.js +19 -46
  252. package/build/npm/esm/dev/integrations/view-hierarchy.js.map +1 -1
  253. package/build/npm/esm/dev/integrations/webWorker.js +40 -211
  254. package/build/npm/esm/dev/integrations/webWorker.js.map +1 -1
  255. package/build/npm/esm/dev/package.json +1 -1
  256. package/build/npm/esm/dev/profiling/UIProfiler.js +87 -190
  257. package/build/npm/esm/dev/profiling/UIProfiler.js.map +1 -1
  258. package/build/npm/esm/dev/profiling/index.js +9 -30
  259. package/build/npm/esm/dev/profiling/index.js.map +1 -1
  260. package/build/npm/esm/dev/profiling/integration.js +30 -64
  261. package/build/npm/esm/dev/profiling/integration.js.map +1 -1
  262. package/build/npm/esm/dev/profiling/startProfileForSpan.js +28 -84
  263. package/build/npm/esm/dev/profiling/startProfileForSpan.js.map +1 -1
  264. package/build/npm/esm/dev/profiling/utils.js +131 -398
  265. package/build/npm/esm/dev/profiling/utils.js.map +1 -1
  266. package/build/npm/esm/dev/report-dialog.js +10 -25
  267. package/build/npm/esm/dev/report-dialog.js.map +1 -1
  268. package/build/npm/esm/dev/sdk.js +8 -76
  269. package/build/npm/esm/dev/sdk.js.map +1 -1
  270. package/build/npm/esm/dev/stack-parsers.js +42 -126
  271. package/build/npm/esm/dev/stack-parsers.js.map +1 -1
  272. package/build/npm/esm/dev/tracing/backgroundtab.js +4 -16
  273. package/build/npm/esm/dev/tracing/backgroundtab.js.map +1 -1
  274. package/build/npm/esm/dev/tracing/browserTracingIntegration.js +102 -291
  275. package/build/npm/esm/dev/tracing/browserTracingIntegration.js.map +1 -1
  276. package/build/npm/esm/dev/tracing/linkedTraces.js +25 -116
  277. package/build/npm/esm/dev/tracing/linkedTraces.js.map +1 -1
  278. package/build/npm/esm/dev/tracing/reportPageLoaded.js +1 -9
  279. package/build/npm/esm/dev/tracing/reportPageLoaded.js.map +1 -1
  280. package/build/npm/esm/dev/tracing/request.js +59 -224
  281. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  282. package/build/npm/esm/dev/tracing/setActiveSpan.js +1 -48
  283. package/build/npm/esm/dev/tracing/setActiveSpan.js.map +1 -1
  284. package/build/npm/esm/dev/tracing/utils.js +4 -27
  285. package/build/npm/esm/dev/tracing/utils.js.map +1 -1
  286. package/build/npm/esm/dev/transports/fetch.js +10 -23
  287. package/build/npm/esm/dev/transports/fetch.js.map +1 -1
  288. package/build/npm/esm/dev/transports/offline.js +27 -84
  289. package/build/npm/esm/dev/transports/offline.js.map +1 -1
  290. package/build/npm/esm/dev/userfeedback.js +12 -22
  291. package/build/npm/esm/dev/userfeedback.js.map +1 -1
  292. package/build/npm/esm/dev/utils/detectBrowserExtension.js +5 -26
  293. package/build/npm/esm/dev/utils/detectBrowserExtension.js.map +1 -1
  294. package/build/npm/esm/dev/utils/lazyLoadIntegration.js +40 -75
  295. package/build/npm/esm/dev/utils/lazyLoadIntegration.js.map +1 -1
  296. package/build/npm/esm/prod/client.js +15 -54
  297. package/build/npm/esm/prod/client.js.map +1 -1
  298. package/build/npm/esm/prod/debug-build.js +0 -5
  299. package/build/npm/esm/prod/debug-build.js.map +1 -1
  300. package/build/npm/esm/prod/diagnose-sdk.js +15 -37
  301. package/build/npm/esm/prod/diagnose-sdk.js.map +1 -1
  302. package/build/npm/esm/prod/eventbuilder.js +59 -217
  303. package/build/npm/esm/prod/eventbuilder.js.map +1 -1
  304. package/build/npm/esm/prod/feedbackAsync.js +1 -5
  305. package/build/npm/esm/prod/feedbackAsync.js.map +1 -1
  306. package/build/npm/esm/prod/feedbackSync.js +1 -2
  307. package/build/npm/esm/prod/feedbackSync.js.map +1 -1
  308. package/build/npm/esm/prod/helpers.js +24 -102
  309. package/build/npm/esm/prod/helpers.js.map +1 -1
  310. package/build/npm/esm/prod/index.js +1 -0
  311. package/build/npm/esm/prod/index.js.map +1 -1
  312. package/build/npm/esm/prod/integrations/breadcrumbs.js +52 -134
  313. package/build/npm/esm/prod/integrations/breadcrumbs.js.map +1 -1
  314. package/build/npm/esm/prod/integrations/browserapierrors.js +45 -111
  315. package/build/npm/esm/prod/integrations/browserapierrors.js.map +1 -1
  316. package/build/npm/esm/prod/integrations/browsersession.js +7 -35
  317. package/build/npm/esm/prod/integrations/browsersession.js.map +1 -1
  318. package/build/npm/esm/prod/integrations/contextlines.js +9 -45
  319. package/build/npm/esm/prod/integrations/contextlines.js.map +1 -1
  320. package/build/npm/esm/prod/integrations/culturecontext.js +11 -36
  321. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  322. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js +1 -22
  323. package/build/npm/esm/prod/integrations/featureFlags/growthbook/integration.js.map +1 -1
  324. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js +6 -31
  325. package/build/npm/esm/prod/integrations/featureFlags/launchdarkly/integration.js.map +1 -1
  326. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js +6 -12
  327. package/build/npm/esm/prod/integrations/featureFlags/openfeature/integration.js.map +1 -1
  328. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js +5 -30
  329. package/build/npm/esm/prod/integrations/featureFlags/statsig/integration.js.map +1 -1
  330. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js +10 -47
  331. package/build/npm/esm/prod/integrations/featureFlags/unleash/integration.js.map +1 -1
  332. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js +58 -0
  333. package/build/npm/esm/prod/integrations/fetchStreamPerformance.js.map +1 -0
  334. package/build/npm/esm/prod/integrations/globalhandlers.js +38 -99
  335. package/build/npm/esm/prod/integrations/globalhandlers.js.map +1 -1
  336. package/build/npm/esm/prod/integrations/graphqlClient.js +31 -119
  337. package/build/npm/esm/prod/integrations/graphqlClient.js.map +1 -1
  338. package/build/npm/esm/prod/integrations/httpclient.js +43 -203
  339. package/build/npm/esm/prod/integrations/httpclient.js.map +1 -1
  340. package/build/npm/esm/prod/integrations/httpcontext.js +7 -17
  341. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  342. package/build/npm/esm/prod/integrations/linkederrors.js +7 -15
  343. package/build/npm/esm/prod/integrations/linkederrors.js.map +1 -1
  344. package/build/npm/esm/prod/integrations/reportingobserver.js +19 -44
  345. package/build/npm/esm/prod/integrations/reportingobserver.js.map +1 -1
  346. package/build/npm/esm/prod/integrations/spanstreaming.js +11 -29
  347. package/build/npm/esm/prod/integrations/spanstreaming.js.map +1 -1
  348. package/build/npm/esm/prod/integrations/spotlight.js +17 -30
  349. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  350. package/build/npm/esm/prod/integrations/view-hierarchy.js +19 -46
  351. package/build/npm/esm/prod/integrations/view-hierarchy.js.map +1 -1
  352. package/build/npm/esm/prod/integrations/webWorker.js +40 -211
  353. package/build/npm/esm/prod/integrations/webWorker.js.map +1 -1
  354. package/build/npm/esm/prod/package.json +1 -1
  355. package/build/npm/esm/prod/profiling/UIProfiler.js +87 -190
  356. package/build/npm/esm/prod/profiling/UIProfiler.js.map +1 -1
  357. package/build/npm/esm/prod/profiling/index.js +9 -30
  358. package/build/npm/esm/prod/profiling/index.js.map +1 -1
  359. package/build/npm/esm/prod/profiling/integration.js +30 -64
  360. package/build/npm/esm/prod/profiling/integration.js.map +1 -1
  361. package/build/npm/esm/prod/profiling/startProfileForSpan.js +28 -84
  362. package/build/npm/esm/prod/profiling/startProfileForSpan.js.map +1 -1
  363. package/build/npm/esm/prod/profiling/utils.js +131 -398
  364. package/build/npm/esm/prod/profiling/utils.js.map +1 -1
  365. package/build/npm/esm/prod/report-dialog.js +10 -25
  366. package/build/npm/esm/prod/report-dialog.js.map +1 -1
  367. package/build/npm/esm/prod/sdk.js +5 -73
  368. package/build/npm/esm/prod/sdk.js.map +1 -1
  369. package/build/npm/esm/prod/stack-parsers.js +42 -126
  370. package/build/npm/esm/prod/stack-parsers.js.map +1 -1
  371. package/build/npm/esm/prod/tracing/backgroundtab.js +4 -16
  372. package/build/npm/esm/prod/tracing/backgroundtab.js.map +1 -1
  373. package/build/npm/esm/prod/tracing/browserTracingIntegration.js +102 -291
  374. package/build/npm/esm/prod/tracing/browserTracingIntegration.js.map +1 -1
  375. package/build/npm/esm/prod/tracing/linkedTraces.js +25 -117
  376. package/build/npm/esm/prod/tracing/linkedTraces.js.map +1 -1
  377. package/build/npm/esm/prod/tracing/reportPageLoaded.js +1 -9
  378. package/build/npm/esm/prod/tracing/reportPageLoaded.js.map +1 -1
  379. package/build/npm/esm/prod/tracing/request.js +59 -224
  380. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  381. package/build/npm/esm/prod/tracing/setActiveSpan.js +1 -48
  382. package/build/npm/esm/prod/tracing/setActiveSpan.js.map +1 -1
  383. package/build/npm/esm/prod/tracing/utils.js +4 -27
  384. package/build/npm/esm/prod/tracing/utils.js.map +1 -1
  385. package/build/npm/esm/prod/transports/fetch.js +10 -23
  386. package/build/npm/esm/prod/transports/fetch.js.map +1 -1
  387. package/build/npm/esm/prod/transports/offline.js +27 -84
  388. package/build/npm/esm/prod/transports/offline.js.map +1 -1
  389. package/build/npm/esm/prod/userfeedback.js +12 -22
  390. package/build/npm/esm/prod/userfeedback.js.map +1 -1
  391. package/build/npm/esm/prod/utils/detectBrowserExtension.js +5 -26
  392. package/build/npm/esm/prod/utils/detectBrowserExtension.js.map +1 -1
  393. package/build/npm/esm/prod/utils/lazyLoadIntegration.js +40 -75
  394. package/build/npm/esm/prod/utils/lazyLoadIntegration.js.map +1 -1
  395. package/build/npm/types/eventbuilder.d.ts.map +1 -1
  396. package/build/npm/types/helpers.d.ts.map +1 -1
  397. package/build/npm/types/index.bundle.d.ts +2 -2
  398. package/build/npm/types/index.bundle.d.ts.map +1 -1
  399. package/build/npm/types/index.bundle.feedback.d.ts +2 -2
  400. package/build/npm/types/index.bundle.feedback.d.ts.map +1 -1
  401. package/build/npm/types/index.bundle.logs.metrics.d.ts +2 -2
  402. package/build/npm/types/index.bundle.logs.metrics.d.ts.map +1 -1
  403. package/build/npm/types/index.bundle.replay.d.ts +2 -2
  404. package/build/npm/types/index.bundle.replay.d.ts.map +1 -1
  405. package/build/npm/types/index.bundle.replay.feedback.d.ts +2 -2
  406. package/build/npm/types/index.bundle.replay.feedback.d.ts.map +1 -1
  407. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts +2 -2
  408. package/build/npm/types/index.bundle.replay.logs.metrics.d.ts.map +1 -1
  409. package/build/npm/types/index.bundle.tracing.d.ts +1 -0
  410. package/build/npm/types/index.bundle.tracing.d.ts.map +1 -1
  411. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts +1 -0
  412. package/build/npm/types/index.bundle.tracing.logs.metrics.d.ts.map +1 -1
  413. package/build/npm/types/index.bundle.tracing.replay.d.ts +1 -0
  414. package/build/npm/types/index.bundle.tracing.replay.d.ts.map +1 -1
  415. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts +1 -0
  416. package/build/npm/types/index.bundle.tracing.replay.feedback.d.ts.map +1 -1
  417. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
  418. package/build/npm/types/index.bundle.tracing.replay.feedback.logs.metrics.d.ts.map +1 -1
  419. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
  420. package/build/npm/types/index.bundle.tracing.replay.logs.metrics.d.ts.map +1 -1
  421. package/build/npm/types/index.d.ts +1 -0
  422. package/build/npm/types/index.d.ts.map +1 -1
  423. package/build/npm/types/integrations/fetchStreamPerformance.d.ts +14 -0
  424. package/build/npm/types/integrations/fetchStreamPerformance.d.ts.map +1 -0
  425. package/build/npm/types/tracing/browserTracingIntegration.d.ts +3 -0
  426. package/build/npm/types/tracing/browserTracingIntegration.d.ts.map +1 -1
  427. package/build/npm/types/tracing/request.d.ts +3 -0
  428. package/build/npm/types/tracing/request.d.ts.map +1 -1
  429. package/build/npm/types-ts3.8/index.bundle.d.ts +2 -2
  430. package/build/npm/types-ts3.8/index.bundle.feedback.d.ts +2 -2
  431. package/build/npm/types-ts3.8/index.bundle.logs.metrics.d.ts +2 -2
  432. package/build/npm/types-ts3.8/index.bundle.replay.d.ts +2 -2
  433. package/build/npm/types-ts3.8/index.bundle.replay.feedback.d.ts +2 -2
  434. package/build/npm/types-ts3.8/index.bundle.replay.logs.metrics.d.ts +2 -2
  435. package/build/npm/types-ts3.8/index.bundle.tracing.d.ts +1 -0
  436. package/build/npm/types-ts3.8/index.bundle.tracing.logs.metrics.d.ts +1 -0
  437. package/build/npm/types-ts3.8/index.bundle.tracing.replay.d.ts +1 -0
  438. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.d.ts +1 -0
  439. package/build/npm/types-ts3.8/index.bundle.tracing.replay.feedback.logs.metrics.d.ts +1 -0
  440. package/build/npm/types-ts3.8/index.bundle.tracing.replay.logs.metrics.d.ts +1 -0
  441. package/build/npm/types-ts3.8/index.d.ts +1 -0
  442. package/build/npm/types-ts3.8/integrations/fetchStreamPerformance.d.ts +14 -0
  443. package/build/npm/types-ts3.8/tracing/browserTracingIntegration.d.ts +3 -0
  444. package/build/npm/types-ts3.8/tracing/request.d.ts +3 -0
  445. package/package.json +7 -7
@@ -3,15 +3,13 @@ import { DEBUG_BUILD } from '../debug-build.js';
3
3
  import { eventFromUnknownInput } from '../eventbuilder.js';
4
4
  import { shouldIgnoreOnError } from '../helpers.js';
5
5
 
6
- const INTEGRATION_NAME = 'GlobalHandlers';
7
-
6
+ const INTEGRATION_NAME = "GlobalHandlers";
8
7
  const _globalHandlersIntegration = ((options = {}) => {
9
8
  const _options = {
10
9
  onerror: true,
11
10
  onunhandledrejection: true,
12
- ...options,
11
+ ...options
13
12
  };
14
-
15
13
  return {
16
14
  name: INTEGRATION_NAME,
17
15
  setupOnce() {
@@ -20,179 +18,120 @@ const _globalHandlersIntegration = ((options = {}) => {
20
18
  setup(client) {
21
19
  if (_options.onerror) {
22
20
  _installGlobalOnErrorHandler(client);
23
- globalHandlerLog('onerror');
21
+ globalHandlerLog("onerror");
24
22
  }
25
23
  if (_options.onunhandledrejection) {
26
24
  _installGlobalOnUnhandledRejectionHandler(client);
27
- globalHandlerLog('onunhandledrejection');
25
+ globalHandlerLog("onunhandledrejection");
28
26
  }
29
- },
27
+ }
30
28
  };
31
- }) ;
32
-
29
+ });
33
30
  const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);
34
-
35
31
  function _installGlobalOnErrorHandler(client) {
36
- addGlobalErrorInstrumentationHandler(data => {
32
+ addGlobalErrorInstrumentationHandler((data) => {
37
33
  const { stackParser, attachStacktrace } = getOptions();
38
-
39
34
  if (getClient() !== client || shouldIgnoreOnError()) {
40
35
  return;
41
36
  }
42
-
43
37
  const { msg, url, line, column, error } = data;
44
-
45
38
  const event = _enhanceEventWithInitialFrame(
46
- eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),
39
+ eventFromUnknownInput(stackParser, error || msg, void 0, attachStacktrace, false),
47
40
  url,
48
41
  line,
49
- column,
42
+ column
50
43
  );
51
-
52
- event.level = 'error';
53
-
44
+ event.level = "error";
54
45
  captureEvent(event, {
55
46
  originalException: error,
56
47
  mechanism: {
57
48
  handled: false,
58
- type: 'auto.browser.global_handlers.onerror',
59
- },
49
+ type: "auto.browser.global_handlers.onerror"
50
+ }
60
51
  });
61
52
  });
62
53
  }
63
-
64
54
  function _installGlobalOnUnhandledRejectionHandler(client) {
65
- addGlobalUnhandledRejectionInstrumentationHandler(e => {
55
+ addGlobalUnhandledRejectionInstrumentationHandler((e) => {
66
56
  const { stackParser, attachStacktrace } = getOptions();
67
-
68
57
  if (getClient() !== client || shouldIgnoreOnError()) {
69
58
  return;
70
59
  }
71
-
72
60
  const error = _getUnhandledRejectionError(e);
73
-
74
- const event = isPrimitive(error)
75
- ? _eventFromRejectionWithPrimitive(error)
76
- : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);
77
-
78
- event.level = 'error';
79
-
61
+ const event = isPrimitive(error) ? _eventFromRejectionWithPrimitive(error) : eventFromUnknownInput(stackParser, error, void 0, attachStacktrace, true);
62
+ event.level = "error";
80
63
  captureEvent(event, {
81
64
  originalException: error,
82
65
  mechanism: {
83
66
  handled: false,
84
- type: 'auto.browser.global_handlers.onunhandledrejection',
85
- },
67
+ type: "auto.browser.global_handlers.onunhandledrejection"
68
+ }
86
69
  });
87
70
  });
88
71
  }
89
-
90
- /**
91
- *
92
- */
93
72
  function _getUnhandledRejectionError(error) {
94
73
  if (isPrimitive(error)) {
95
74
  return error;
96
75
  }
97
-
98
- // dig the object of the rejection out of known event types
99
76
  try {
100
-
101
- // PromiseRejectionEvents store the object of the rejection under 'reason'
102
- // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
103
- if ('reason' in (error )) {
104
- return (error ).reason;
77
+ if ("reason" in error) {
78
+ return error.reason;
105
79
  }
106
-
107
- // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents
108
- // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into
109
- // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec
110
- // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and
111
- // https://github.com/getsentry/sentry-javascript/issues/2380
112
- if ('detail' in (error ) && 'reason' in (error ).detail) {
113
- return (error ).detail.reason;
80
+ if ("detail" in error && "reason" in error.detail) {
81
+ return error.detail.reason;
114
82
  }
115
- } catch {} // eslint-disable-line no-empty
116
-
83
+ } catch {
84
+ }
117
85
  return error;
118
86
  }
119
-
120
- /**
121
- * Create an event from a promise rejection where the `reason` is a primitive.
122
- *
123
- * @param reason: The `reason` property of the promise rejection
124
- * @returns An Event object with an appropriate `exception` value
125
- */
126
87
  function _eventFromRejectionWithPrimitive(reason) {
127
88
  return {
128
89
  exception: {
129
90
  values: [
130
91
  {
131
- type: 'UnhandledRejection',
92
+ type: "UnhandledRejection",
132
93
  // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)
133
- value: `Non-Error promise rejection captured with value: ${String(reason)}`,
134
- },
135
- ],
136
- },
94
+ value: `Non-Error promise rejection captured with value: ${String(reason)}`
95
+ }
96
+ ]
97
+ }
137
98
  };
138
99
  }
139
-
140
- function _enhanceEventWithInitialFrame(
141
- event,
142
- url,
143
- lineno,
144
- colno,
145
- ) {
146
- // event.exception
147
- const e = (event.exception = event.exception || {});
148
- // event.exception.values
149
- const ev = (e.values = e.values || []);
150
- // event.exception.values[0]
151
- const ev0 = (ev[0] = ev[0] || {});
152
- // event.exception.values[0].stacktrace
153
- const ev0s = (ev0.stacktrace = ev0.stacktrace || {});
154
- // event.exception.values[0].stacktrace.frames
155
- const ev0sf = (ev0s.frames = ev0s.frames || []);
156
-
100
+ function _enhanceEventWithInitialFrame(event, url, lineno, colno) {
101
+ const e = event.exception = event.exception || {};
102
+ const ev = e.values = e.values || [];
103
+ const ev0 = ev[0] = ev[0] || {};
104
+ const ev0s = ev0.stacktrace = ev0.stacktrace || {};
105
+ const ev0sf = ev0s.frames = ev0s.frames || [];
157
106
  if (ev0sf.length === 0) {
158
107
  ev0sf.push({
159
108
  colno,
160
109
  lineno,
161
110
  filename: getFilenameFromUrl(url) ?? getLocationHref(),
162
111
  function: UNKNOWN_FUNCTION,
163
- in_app: true,
112
+ in_app: true
164
113
  });
165
114
  }
166
-
167
115
  return event;
168
116
  }
169
-
170
117
  function globalHandlerLog(type) {
171
118
  DEBUG_BUILD && debug.log(`Global Handler attached: ${type}`);
172
119
  }
173
-
174
120
  function getOptions() {
175
121
  const client = getClient();
176
122
  const options = client?.getOptions() || {
177
123
  stackParser: () => [],
178
- attachStacktrace: false,
124
+ attachStacktrace: false
179
125
  };
180
126
  return options;
181
127
  }
182
-
183
128
  function getFilenameFromUrl(url) {
184
129
  if (!isString(url) || url.length === 0) {
185
- return undefined;
130
+ return void 0;
186
131
  }
187
-
188
- // Strip data URL content to avoid long base64 strings in stack frames
189
- // (e.g. when initializing a Worker with a base64 encoded script)
190
- // Don't include data prefix for filenames as it's not useful for stack traces
191
- // Wrap with < > to indicate it's a placeholder
192
- if (url.startsWith('data:')) {
132
+ if (url.startsWith("data:")) {
193
133
  return `<${stripDataUrlContent(url, false)}>`;
194
134
  }
195
-
196
135
  return url;
197
136
  }
198
137
 
@@ -1 +1 @@
1
- {"version":3,"file":"globalhandlers.js","sources":["../../../../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core/browser';\nimport {\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n stripDataUrlContent,\n UNKNOWN_FUNCTION,\n} from '@sentry/core/browser';\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onunhandledrejection',\n },\n });\n });\n}\n\n/**\n *\n */\nexport function _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nexport function _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\nfunction _enhanceEventWithInitialFrame(\n event: Event,\n url: string | undefined,\n lineno: number | undefined,\n colno: number | undefined,\n): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n lineno,\n filename: getFilenameFromUrl(url) ?? getLocationHref(),\n function: UNKNOWN_FUNCTION,\n in_app: true,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && debug.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = client?.getOptions() || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n\nfunction getFilenameFromUrl(url: string | undefined): string | undefined {\n if (!isString(url) || url.length === 0) {\n return undefined;\n }\n\n // Strip data URL content to avoid long base64 strings in stack frames\n // (e.g. when initializing a Worker with a base64 encoded script)\n // Don't include data prefix for filenames as it's not useful for stack traces\n // Wrap with < > to indicate it's a placeholder\n if (url.startsWith('data:')) {\n return `<${stripDataUrlContent(url, false)}>`;\n }\n\n return url;\n}\n"],"names":[],"mappings":";;;;;AAuBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM,0BAAA,IAA8B,CAAC,OAAO,GAAwC,EAAE,KAAK;AAC3F,EAAE,MAAM,WAAW;AACnB,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,oBAAoB,EAAE,IAAI;AAC9B,IAAI,GAAG,OAAO;AACd,GAAG;;AAEH,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,KAAK,CAAC,eAAA,GAAkB,EAAE;AAChC,IAAI,CAAC;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,4BAA4B,CAAC,MAAM,CAAC;AAC5C,QAAQ,gBAAgB,CAAC,SAAS,CAAC;AACnC,MAAM;AACN,MAAM,IAAI,QAAQ,CAAC,oBAAoB,EAAE;AACzC,QAAQ,yCAAyC,CAAC,MAAM,CAAC;AACzD,QAAQ,gBAAgB,CAAC,sBAAsB,CAAC;AAChD,MAAM;AACN,IAAI,CAAC;AAC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,EAAA,OAAA,OAAA;AACA;;AAEA,SAAA,kBAAA,CAAA,GAAA,EAAA;AACA,EAAA,IAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,GAAA,CAAA,MAAA,KAAA,CAAA,EAAA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;;AAEA;AACA;AACA;AACA;AACA,EAAA,IAAA,GAAA,CAAA,UAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,CAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,GAAA;AACA;;;;"}
1
+ {"version":3,"file":"globalhandlers.js","sources":["../../../../../src/integrations/globalhandlers.ts"],"sourcesContent":["import type { Client, Event, IntegrationFn, Primitive, StackParser } from '@sentry/core/browser';\nimport {\n addGlobalErrorInstrumentationHandler,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureEvent,\n debug,\n defineIntegration,\n getClient,\n getLocationHref,\n isPrimitive,\n isString,\n stripDataUrlContent,\n UNKNOWN_FUNCTION,\n} from '@sentry/core/browser';\nimport type { BrowserClient } from '../client';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { eventFromUnknownInput } from '../eventbuilder';\nimport { shouldIgnoreOnError } from '../helpers';\n\ntype GlobalHandlersIntegrationsOptionKeys = 'onerror' | 'onunhandledrejection';\n\ntype GlobalHandlersIntegrations = Record<GlobalHandlersIntegrationsOptionKeys, boolean>;\n\nconst INTEGRATION_NAME = 'GlobalHandlers';\n\nconst _globalHandlersIntegration = ((options: Partial<GlobalHandlersIntegrations> = {}) => {\n const _options = {\n onerror: true,\n onunhandledrejection: true,\n ...options,\n };\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n Error.stackTraceLimit = 50;\n },\n setup(client) {\n if (_options.onerror) {\n _installGlobalOnErrorHandler(client);\n globalHandlerLog('onerror');\n }\n if (_options.onunhandledrejection) {\n _installGlobalOnUnhandledRejectionHandler(client);\n globalHandlerLog('onunhandledrejection');\n }\n },\n };\n}) satisfies IntegrationFn;\n\nexport const globalHandlersIntegration = defineIntegration(_globalHandlersIntegration);\n\nfunction _installGlobalOnErrorHandler(client: Client): void {\n addGlobalErrorInstrumentationHandler(data => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const { msg, url, line, column, error } = data;\n\n const event = _enhanceEventWithInitialFrame(\n eventFromUnknownInput(stackParser, error || msg, undefined, attachStacktrace, false),\n url,\n line,\n column,\n );\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onerror',\n },\n });\n });\n}\n\nfunction _installGlobalOnUnhandledRejectionHandler(client: Client): void {\n addGlobalUnhandledRejectionInstrumentationHandler(e => {\n const { stackParser, attachStacktrace } = getOptions();\n\n if (getClient() !== client || shouldIgnoreOnError()) {\n return;\n }\n\n const error = _getUnhandledRejectionError(e);\n\n const event = isPrimitive(error)\n ? _eventFromRejectionWithPrimitive(error)\n : eventFromUnknownInput(stackParser, error, undefined, attachStacktrace, true);\n\n event.level = 'error';\n\n captureEvent(event, {\n originalException: error,\n mechanism: {\n handled: false,\n type: 'auto.browser.global_handlers.onunhandledrejection',\n },\n });\n });\n}\n\n/**\n *\n */\nexport function _getUnhandledRejectionError(error: unknown): unknown {\n if (isPrimitive(error)) {\n return error;\n }\n\n // dig the object of the rejection out of known event types\n try {\n type ErrorWithReason = { reason: unknown };\n // PromiseRejectionEvents store the object of the rejection under 'reason'\n // see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n if ('reason' in (error as ErrorWithReason)) {\n return (error as ErrorWithReason).reason;\n }\n\n type CustomEventWithDetail = { detail: { reason: unknown } };\n // something, somewhere, (likely a browser extension) effectively casts PromiseRejectionEvents\n // to CustomEvents, moving the `promise` and `reason` attributes of the PRE into\n // the CustomEvent's `detail` attribute, since they're not part of CustomEvent's spec\n // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent and\n // https://github.com/getsentry/sentry-javascript/issues/2380\n if ('detail' in (error as CustomEventWithDetail) && 'reason' in (error as CustomEventWithDetail).detail) {\n return (error as CustomEventWithDetail).detail.reason;\n }\n } catch {} // eslint-disable-line no-empty\n\n return error;\n}\n\n/**\n * Create an event from a promise rejection where the `reason` is a primitive.\n *\n * @param reason: The `reason` property of the promise rejection\n * @returns An Event object with an appropriate `exception` value\n */\nexport function _eventFromRejectionWithPrimitive(reason: Primitive): Event {\n return {\n exception: {\n values: [\n {\n type: 'UnhandledRejection',\n // String() is needed because the Primitive type includes symbols (which can't be automatically stringified)\n value: `Non-Error promise rejection captured with value: ${String(reason)}`,\n },\n ],\n },\n };\n}\n\nfunction _enhanceEventWithInitialFrame(\n event: Event,\n url: string | undefined,\n lineno: number | undefined,\n colno: number | undefined,\n): Event {\n // event.exception\n const e = (event.exception = event.exception || {});\n // event.exception.values\n const ev = (e.values = e.values || []);\n // event.exception.values[0]\n const ev0 = (ev[0] = ev[0] || {});\n // event.exception.values[0].stacktrace\n const ev0s = (ev0.stacktrace = ev0.stacktrace || {});\n // event.exception.values[0].stacktrace.frames\n const ev0sf = (ev0s.frames = ev0s.frames || []);\n\n if (ev0sf.length === 0) {\n ev0sf.push({\n colno,\n lineno,\n filename: getFilenameFromUrl(url) ?? getLocationHref(),\n function: UNKNOWN_FUNCTION,\n in_app: true,\n });\n }\n\n return event;\n}\n\nfunction globalHandlerLog(type: string): void {\n DEBUG_BUILD && debug.log(`Global Handler attached: ${type}`);\n}\n\nfunction getOptions(): { stackParser: StackParser; attachStacktrace?: boolean } {\n const client = getClient<BrowserClient>();\n const options = client?.getOptions() || {\n stackParser: () => [],\n attachStacktrace: false,\n };\n return options;\n}\n\nfunction getFilenameFromUrl(url: string | undefined): string | undefined {\n if (!isString(url) || url.length === 0) {\n return undefined;\n }\n\n // Strip data URL content to avoid long base64 strings in stack frames\n // (e.g. when initializing a Worker with a base64 encoded script)\n // Don't include data prefix for filenames as it's not useful for stack traces\n // Wrap with < > to indicate it's a placeholder\n if (url.startsWith('data:')) {\n return `<${stripDataUrlContent(url, false)}>`;\n }\n\n return url;\n}\n"],"names":[],"mappings":";;;;;AAuBA,MAAM,gBAAA,GAAmB,gBAAA;AAEzB,MAAM,0BAAA,IAA8B,CAAC,OAAA,GAA+C,EAAC,KAAM;AACzF,EAAA,MAAM,QAAA,GAAW;AAAA,IACf,OAAA,EAAS,IAAA;AAAA,IACT,oBAAA,EAAsB,IAAA;AAAA,IACtB,GAAG;AAAA,GACL;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,KAAA,CAAM,eAAA,GAAkB,EAAA;AAAA,IAC1B,CAAA;AAAA,IACA,MAAM,MAAA,EAAQ;AACZ,MAAA,IAAI,SAAS,OAAA,EAAS;AACpB,QAAA,4BAAA,CAA6B,MAAM,CAAA;AACnC,QAAA,gBAAA,CAAiB,SAAS,CAAA;AAAA,MAC5B;AACA,MAAA,IAAI,SAAS,oBAAA,EAAsB;AACjC,QAAA,yCAAA,CAA0C,MAAM,CAAA;AAChD,QAAA,gBAAA,CAAiB,sBAAsB,CAAA;AAAA,MACzC;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,yBAAA,GAA4B,kBAAkB,0BAA0B;AAErF,SAAS,6BAA6B,MAAA,EAAsB;AAC1D,EAAA,oCAAA,CAAqC,CAAA,IAAA,KAAQ;AAC3C,IAAA,MAAM,EAAE,WAAA,EAAa,gBAAA,EAAiB,GAAI,UAAA,EAAW;AAErD,IAAA,IAAI,SAAA,EAAU,KAAM,MAAA,IAAU,mBAAA,EAAoB,EAAG;AACnD,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,EAAE,GAAA,EAAK,GAAA,EAAK,IAAA,EAAM,MAAA,EAAQ,OAAM,GAAI,IAAA;AAE1C,IAAA,MAAM,KAAA,GAAQ,6BAAA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AAA,EAAQ;AAAA,KACT,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,KAAA;AACT;AAEA,SAAS,iBAAiB,IAAA,EAAoB;AAC5C,EAAA,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,CAAA,yBAAA,EAA4B,IAAI,CAAA,CAAE,CAAA;AAC7D;AAEA,SAAS,UAAA,GAAuE;AAC9E,EAAA,MAAM,SAAS,SAAA,EAAyB;AACxC,EAAA,MAAM,OAAA,GAAU,MAAA,EAAQ,UAAA,EAAW,IAAK;AAAA,IACtC,WAAA,EAAa,MAAM,EAAC;AAAA,IACpB,gBAAA,EAAkB;AAAA,GACpB;AACA,EAAA,OAAO,OAAA;AACT;AAEA,SAAS,mBAAmB,GAAA,EAA6C;AACvE,EAAA,IAAI,CAAC,QAAA,CAAS,GAAG,CAAA,IAAK,GAAA,CAAI,WAAW,CAAA,EAAG;AACtC,IAAA,OAAO,MAAA;AAAA,EACT;AAMA,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,OAAO,CAAA,EAAG;AAC3B,IAAA,OAAO,CAAA,CAAA,EAAI,mBAAA,CAAoB,GAAA,EAAK,KAAK,CAAC,CAAA,CAAA,CAAA;AAAA,EAC5C;AAEA,EAAA,OAAO,GAAA;AACT;;;;"}
@@ -1,135 +1,92 @@
1
1
  import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_URL_FULL, SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD, isString, stringMatchesSomePattern } from '@sentry/core/browser';
2
2
  import { SENTRY_XHR_DATA_KEY, getBodyString, getFetchRequestArgBody } from '@sentry-internal/browser-utils';
3
3
 
4
- const INTEGRATION_NAME = 'GraphQLClient';
5
-
4
+ const INTEGRATION_NAME = "GraphQLClient";
6
5
  const _graphqlClientIntegration = ((options) => {
7
6
  return {
8
7
  name: INTEGRATION_NAME,
9
8
  setup(client) {
10
9
  _updateSpanWithGraphQLData(client, options);
11
10
  _updateBreadcrumbWithGraphQLData(client, options);
12
- },
11
+ }
13
12
  };
14
- }) ;
15
-
13
+ });
16
14
  function _updateSpanWithGraphQLData(client, options) {
17
- client.on('beforeOutgoingRequestSpan', (span, hint) => {
15
+ client.on("beforeOutgoingRequestSpan", (span, hint) => {
18
16
  const spanJSON = spanToJSON(span);
19
-
20
17
  const spanAttributes = spanJSON.data || {};
21
18
  const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];
22
-
23
- const isHttpClientSpan = spanOp === 'http.client';
24
-
19
+ const isHttpClientSpan = spanOp === "http.client";
25
20
  if (!isHttpClientSpan) {
26
21
  return;
27
22
  }
28
-
29
- // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;
30
- // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).
31
- const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];
32
- const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];
33
-
23
+ const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes["http.url"] || spanAttributes["url"];
24
+ const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes["http.method"];
34
25
  if (!isString(httpUrl) || !isString(httpMethod)) {
35
26
  return;
36
27
  }
37
-
38
28
  const { endpoints } = options;
39
29
  const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);
40
- const payload = getRequestPayloadXhrOrFetch(hint );
41
-
30
+ const payload = getRequestPayloadXhrOrFetch(hint);
42
31
  if (isTracedGraphqlEndpoint && payload) {
43
32
  const graphqlBody = getGraphQLRequestPayload(payload);
44
-
45
33
  if (graphqlBody) {
46
34
  const operationInfo = _getGraphQLOperation(graphqlBody);
47
35
  span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);
48
-
49
- // Handle standard requests - always capture the query document
50
36
  if (isStandardRequest(graphqlBody)) {
51
- span.setAttribute('graphql.document', graphqlBody.query);
37
+ span.setAttribute("graphql.document", graphqlBody.query);
52
38
  }
53
-
54
- // Handle persisted operations - capture hash for debugging
55
39
  if (isPersistedRequest(graphqlBody)) {
56
- span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);
57
- span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);
40
+ span.setAttribute("graphql.persisted_query.hash.sha256", graphqlBody.extensions.persistedQuery.sha256Hash);
41
+ span.setAttribute("graphql.persisted_query.version", graphqlBody.extensions.persistedQuery.version);
58
42
  }
59
43
  }
60
44
  }
61
45
  });
62
46
  }
63
-
64
47
  function _updateBreadcrumbWithGraphQLData(client, options) {
65
- client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {
48
+ client.on("beforeOutgoingRequestBreadcrumb", (breadcrumb, handlerData) => {
66
49
  const { category, type, data } = breadcrumb;
67
-
68
- const isFetch = category === 'fetch';
69
- const isXhr = category === 'xhr';
70
- const isHttpBreadcrumb = type === 'http';
71
-
50
+ const isFetch = category === "fetch";
51
+ const isXhr = category === "xhr";
52
+ const isHttpBreadcrumb = type === "http";
72
53
  if (isHttpBreadcrumb && (isFetch || isXhr)) {
73
54
  const httpUrl = data?.url;
74
55
  const { endpoints } = options;
75
-
76
56
  const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);
77
- const payload = getRequestPayloadXhrOrFetch(handlerData );
78
-
57
+ const payload = getRequestPayloadXhrOrFetch(handlerData);
79
58
  if (isTracedGraphqlEndpoint && data && payload) {
80
59
  const graphqlBody = getGraphQLRequestPayload(payload);
81
-
82
60
  if (!data.graphql && graphqlBody) {
83
61
  const operationInfo = _getGraphQLOperation(graphqlBody);
84
-
85
- data['graphql.operation'] = operationInfo;
86
-
62
+ data["graphql.operation"] = operationInfo;
87
63
  if (isStandardRequest(graphqlBody)) {
88
- data['graphql.document'] = graphqlBody.query;
64
+ data["graphql.document"] = graphqlBody.query;
89
65
  }
90
-
91
66
  if (isPersistedRequest(graphqlBody)) {
92
- data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;
93
- data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;
67
+ data["graphql.persisted_query.hash.sha256"] = graphqlBody.extensions.persistedQuery.sha256Hash;
68
+ data["graphql.persisted_query.version"] = graphqlBody.extensions.persistedQuery.version;
94
69
  }
95
70
  }
96
71
  }
97
72
  }
98
73
  });
99
74
  }
100
-
101
- /**
102
- * @param requestBody - GraphQL request
103
- * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'
104
- */
105
75
  function _getGraphQLOperation(requestBody) {
106
- // Handle persisted operations
107
76
  if (isPersistedRequest(requestBody)) {
108
77
  return `persisted ${requestBody.operationName}`;
109
78
  }
110
-
111
- // Handle standard GraphQL requests
112
79
  if (isStandardRequest(requestBody)) {
113
80
  const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;
114
81
  const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);
115
82
  const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;
116
83
  return operationInfo;
117
84
  }
118
-
119
- // Fallback for unknown request types
120
- return 'unknown';
85
+ return "unknown";
121
86
  }
122
-
123
- /**
124
- * Get the request body/payload based on the shape of the hint.
125
- *
126
- * Exported for tests only.
127
- */
128
87
  function getRequestPayloadXhrOrFetch(hint) {
129
- const isXhr = 'xhr' in hint;
130
-
88
+ const isXhr = "xhr" in hint;
131
89
  let body;
132
-
133
90
  if (isXhr) {
134
91
  const sentryXhrData = hint.xhr[SENTRY_XHR_DATA_KEY];
135
92
  body = sentryXhrData && getBodyString(sentryXhrData.body)[0];
@@ -137,95 +94,50 @@ function getRequestPayloadXhrOrFetch(hint) {
137
94
  const sentryFetchData = getFetchRequestArgBody(hint.input);
138
95
  body = getBodyString(sentryFetchData)[0];
139
96
  }
140
-
141
97
  return body;
142
98
  }
143
-
144
- /**
145
- * Extract the name and type of the operation from the GraphQL query.
146
- *
147
- * Exported for tests only.
148
- */
149
99
  function parseGraphQLQuery(query) {
150
100
  const namedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/;
151
101
  const unnamedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/;
152
-
153
102
  const namedMatch = query.match(namedQueryRe);
154
103
  if (namedMatch) {
155
104
  return {
156
105
  operationType: namedMatch[1],
157
- operationName: namedMatch[2],
106
+ operationName: namedMatch[2]
158
107
  };
159
108
  }
160
-
161
109
  const unnamedMatch = query.match(unnamedQueryRe);
162
110
  if (unnamedMatch) {
163
111
  return {
164
112
  operationType: unnamedMatch[1],
165
- operationName: undefined,
113
+ operationName: void 0
166
114
  };
167
115
  }
168
116
  return {
169
- operationType: undefined,
170
- operationName: undefined,
117
+ operationType: void 0,
118
+ operationName: void 0
171
119
  };
172
120
  }
173
-
174
- /**
175
- * Helper to safely check if a value is a non-null object
176
- */
177
121
  function isObject(value) {
178
- return typeof value === 'object' && value !== null;
122
+ return typeof value === "object" && value !== null;
179
123
  }
180
-
181
- /**
182
- * Type guard to check if a request is a standard GraphQL request
183
- */
184
124
  function isStandardRequest(payload) {
185
- return isObject(payload) && typeof payload.query === 'string';
125
+ return isObject(payload) && typeof payload.query === "string";
186
126
  }
187
-
188
- /**
189
- * Type guard to check if a request is a persisted operation request
190
- */
191
127
  function isPersistedRequest(payload) {
192
- return (
193
- isObject(payload) &&
194
- typeof payload.operationName === 'string' &&
195
- isObject(payload.extensions) &&
196
- isObject(payload.extensions.persistedQuery) &&
197
- typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&
198
- typeof payload.extensions.persistedQuery.version === 'number'
199
- );
128
+ return isObject(payload) && typeof payload.operationName === "string" && isObject(payload.extensions) && isObject(payload.extensions.persistedQuery) && typeof payload.extensions.persistedQuery.sha256Hash === "string" && typeof payload.extensions.persistedQuery.version === "number";
200
129
  }
201
-
202
- /**
203
- * Extract the payload of a request if it's GraphQL.
204
- * Exported for tests only.
205
- * @param payload - A valid JSON string
206
- * @returns A POJO or undefined
207
- */
208
130
  function getGraphQLRequestPayload(payload) {
209
131
  try {
210
132
  const requestBody = JSON.parse(payload);
211
-
212
- // Return any valid GraphQL request (standard, persisted, or APQ retry with both)
213
133
  if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {
214
134
  return requestBody;
215
135
  }
216
-
217
- // Not a GraphQL request
218
- return undefined;
136
+ return void 0;
219
137
  } catch {
220
- // Invalid JSON
221
- return undefined;
138
+ return void 0;
222
139
  }
223
140
  }
224
-
225
- /**
226
- * This integration ensures that GraphQL requests made in the browser
227
- * have their GraphQL-specific data captured and attached to spans and breadcrumbs.
228
- */
229
141
  const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);
230
142
 
231
143
  export { _getGraphQLOperation, getGraphQLRequestPayload, getRequestPayloadXhrOrFetch, graphqlClientIntegration, parseGraphQLQuery };
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlClient.js","sources":["../../../../../src/integrations/graphqlClient.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core/browser';\nimport {\n defineIntegration,\n isString,\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core/browser';\nimport type { FetchHint, XhrHint } from '@sentry-internal/browser-utils';\nimport { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';\n\ninterface GraphQLClientOptions {\n endpoints: Array<string | RegExp>;\n}\n\n/** Standard graphql request shape: https://graphql.org/learn/serving-over-http/#post-request-and-body */\ninterface GraphQLStandardRequest {\n query: string;\n operationName?: string;\n variables?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n\n/** Persisted operation request */\ninterface GraphQLPersistedRequest {\n operationName: string;\n variables?: Record<string, unknown>;\n extensions: {\n persistedQuery: {\n version: number;\n sha256Hash: string;\n };\n } & Record<string, unknown>;\n}\n\ntype GraphQLRequestPayload = GraphQLStandardRequest | GraphQLPersistedRequest;\n\ninterface GraphQLOperation {\n operationType?: string;\n operationName?: string;\n}\n\nconst INTEGRATION_NAME = 'GraphQLClient';\n\nconst _graphqlClientIntegration = ((options: GraphQLClientOptions) => {\n return {\n name: INTEGRATION_NAME,\n setup(client: Client) {\n _updateSpanWithGraphQLData(client, options);\n _updateBreadcrumbWithGraphQLData(client, options);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestSpan', (span, hint) => {\n const spanJSON = spanToJSON(span);\n\n const spanAttributes = spanJSON.data || {};\n const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n const isHttpClientSpan = spanOp === 'http.client';\n\n if (!isHttpClientSpan) {\n return;\n }\n\n // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;\n // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).\n const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];\n const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];\n\n if (!isString(httpUrl) || !isString(httpMethod)) {\n return;\n }\n\n const { endpoints } = options;\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(hint as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);\n\n // Handle standard requests - always capture the query document\n if (isStandardRequest(graphqlBody)) {\n span.setAttribute('graphql.document', graphqlBody.query);\n }\n\n // Handle persisted operations - capture hash for debugging\n if (isPersistedRequest(graphqlBody)) {\n span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);\n span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);\n }\n }\n }\n });\n}\n\nfunction _updateBreadcrumbWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {\n const { category, type, data } = breadcrumb;\n\n const isFetch = category === 'fetch';\n const isXhr = category === 'xhr';\n const isHttpBreadcrumb = type === 'http';\n\n if (isHttpBreadcrumb && (isFetch || isXhr)) {\n const httpUrl = data?.url;\n const { endpoints } = options;\n\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(handlerData as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && data && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (!data.graphql && graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n\n data['graphql.operation'] = operationInfo;\n\n if (isStandardRequest(graphqlBody)) {\n data['graphql.document'] = graphqlBody.query;\n }\n\n if (isPersistedRequest(graphqlBody)) {\n data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;\n data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;\n }\n }\n }\n }\n });\n}\n\n/**\n * @param requestBody - GraphQL request\n * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'\n */\nexport function _getGraphQLOperation(requestBody: GraphQLRequestPayload): string {\n // Handle persisted operations\n if (isPersistedRequest(requestBody)) {\n return `persisted ${requestBody.operationName}`;\n }\n\n // Handle standard GraphQL requests\n if (isStandardRequest(requestBody)) {\n const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;\n const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);\n const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n return operationInfo;\n }\n\n // Fallback for unknown request types\n return 'unknown';\n}\n\n/**\n * Get the request body/payload based on the shape of the hint.\n *\n * Exported for tests only.\n */\nexport function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | undefined {\n const isXhr = 'xhr' in hint;\n\n let body: string | undefined;\n\n if (isXhr) {\n const sentryXhrData = hint.xhr[SENTRY_XHR_DATA_KEY];\n body = sentryXhrData && getBodyString(sentryXhrData.body)[0];\n } else {\n const sentryFetchData = getFetchRequestArgBody(hint.input);\n body = getBodyString(sentryFetchData)[0];\n }\n\n return body;\n}\n\n/**\n * Extract the name and type of the operation from the GraphQL query.\n *\n * Exported for tests only.\n */\nexport function parseGraphQLQuery(query: string): GraphQLOperation {\n const namedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]/;\n const unnamedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]/;\n\n const namedMatch = query.match(namedQueryRe);\n if (namedMatch) {\n return {\n operationType: namedMatch[1],\n operationName: namedMatch[2],\n };\n }\n\n const unnamedMatch = query.match(unnamedQueryRe);\n if (unnamedMatch) {\n return {\n operationType: unnamedMatch[1],\n operationName: undefined,\n };\n }\n return {\n operationType: undefined,\n operationName: undefined,\n };\n}\n\n/**\n * Helper to safely check if a value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Type guard to check if a request is a standard GraphQL request\n */\nfunction isStandardRequest(payload: unknown): payload is GraphQLStandardRequest {\n return isObject(payload) && typeof payload.query === 'string';\n}\n\n/**\n * Type guard to check if a request is a persisted operation request\n */\nfunction isPersistedRequest(payload: unknown): payload is GraphQLPersistedRequest {\n return (\n isObject(payload) &&\n typeof payload.operationName === 'string' &&\n isObject(payload.extensions) &&\n isObject(payload.extensions.persistedQuery) &&\n typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&\n typeof payload.extensions.persistedQuery.version === 'number'\n );\n}\n\n/**\n * Extract the payload of a request if it's GraphQL.\n * Exported for tests only.\n * @param payload - A valid JSON string\n * @returns A POJO or undefined\n */\nexport function getGraphQLRequestPayload(payload: string): GraphQLRequestPayload | undefined {\n try {\n const requestBody = JSON.parse(payload);\n\n // Return any valid GraphQL request (standard, persisted, or APQ retry with both)\n if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {\n return requestBody;\n }\n\n // Not a GraphQL request\n return undefined;\n } catch {\n // Invalid JSON\n return undefined;\n }\n}\n\n/**\n * This integration ensures that GraphQL requests made in the browser\n * have their GraphQL-specific data captured and attached to spans and breadcrumbs.\n */\nexport const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);\n"],"names":[],"mappings":";;;AA4CA,MAAM,gBAAA,GAAmB,eAAe;;AAExC,MAAM,6BAA6B,CAAC,OAAO,KAA2B;AACtE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAU;AAC1B,MAAM,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC;AACjD,MAAM,gCAAgC,CAAC,MAAM,EAAE,OAAO,CAAC;AACvD,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED,SAAS,0BAA0B,CAAC,MAAM,EAAU,OAAO,EAA8B;AACzF,EAAE,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK;AACzD,IAAI,MAAM,QAAA,GAAW,UAAU,CAAC,IAAI,CAAC;;AAErC,IAAI,MAAM,iBAAiB,QAAQ,CAAC,IAAA,IAAQ,EAAE;AAC9C,IAAI,MAAM,MAAA,GAAS,cAAc,CAAC,4BAA4B,CAAC;;AAE/D,IAAI,MAAM,gBAA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AACA,IAAA,QAAA,CAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,UAAA,KAAA,QAAA;AACA,IAAA,OAAA,OAAA,CAAA,UAAA,CAAA,cAAA,CAAA,OAAA,KAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA,CAAA,OAAA,EAAA;AACA,EAAA,IAAA;AACA,IAAA,MAAA,WAAA,GAAA,IAAA,CAAA,KAAA,CAAA,OAAA,CAAA;;AAEA;AACA,IAAA,IAAA,iBAAA,CAAA,WAAA,CAAA,IAAA,kBAAA,CAAA,WAAA,CAAA,EAAA;AACA,MAAA,OAAA,WAAA;AACA,IAAA;;AAEA;AACA,IAAA,OAAA,SAAA;AACA,EAAA,CAAA,CAAA,MAAA;AACA;AACA,IAAA,OAAA,SAAA;AACA,EAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAA,wBAAA,GAAA,iBAAA,CAAA,yBAAA;;;;"}
1
+ {"version":3,"file":"graphqlClient.js","sources":["../../../../../src/integrations/graphqlClient.ts"],"sourcesContent":["import type { Client, IntegrationFn } from '@sentry/core/browser';\nimport {\n defineIntegration,\n isString,\n SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n spanToJSON,\n stringMatchesSomePattern,\n} from '@sentry/core/browser';\nimport type { FetchHint, XhrHint } from '@sentry-internal/browser-utils';\nimport { getBodyString, getFetchRequestArgBody, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';\n\ninterface GraphQLClientOptions {\n endpoints: Array<string | RegExp>;\n}\n\n/** Standard graphql request shape: https://graphql.org/learn/serving-over-http/#post-request-and-body */\ninterface GraphQLStandardRequest {\n query: string;\n operationName?: string;\n variables?: Record<string, unknown>;\n extensions?: Record<string, unknown>;\n}\n\n/** Persisted operation request */\ninterface GraphQLPersistedRequest {\n operationName: string;\n variables?: Record<string, unknown>;\n extensions: {\n persistedQuery: {\n version: number;\n sha256Hash: string;\n };\n } & Record<string, unknown>;\n}\n\ntype GraphQLRequestPayload = GraphQLStandardRequest | GraphQLPersistedRequest;\n\ninterface GraphQLOperation {\n operationType?: string;\n operationName?: string;\n}\n\nconst INTEGRATION_NAME = 'GraphQLClient';\n\nconst _graphqlClientIntegration = ((options: GraphQLClientOptions) => {\n return {\n name: INTEGRATION_NAME,\n setup(client: Client) {\n _updateSpanWithGraphQLData(client, options);\n _updateBreadcrumbWithGraphQLData(client, options);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestSpan', (span, hint) => {\n const spanJSON = spanToJSON(span);\n\n const spanAttributes = spanJSON.data || {};\n const spanOp = spanAttributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];\n\n const isHttpClientSpan = spanOp === 'http.client';\n\n if (!isHttpClientSpan) {\n return;\n }\n\n // Fall back to `url` because fetch instrumentation only sets `http.url` for absolute URLs;\n // relative URLs end up only in `url` (see `getFetchSpanAttributes` in packages/core/src/fetch.ts).\n const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'] || spanAttributes['url'];\n const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];\n\n if (!isString(httpUrl) || !isString(httpMethod)) {\n return;\n }\n\n const { endpoints } = options;\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(hint as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n span.updateName(`${httpMethod} ${httpUrl} (${operationInfo})`);\n\n // Handle standard requests - always capture the query document\n if (isStandardRequest(graphqlBody)) {\n span.setAttribute('graphql.document', graphqlBody.query);\n }\n\n // Handle persisted operations - capture hash for debugging\n if (isPersistedRequest(graphqlBody)) {\n span.setAttribute('graphql.persisted_query.hash.sha256', graphqlBody.extensions.persistedQuery.sha256Hash);\n span.setAttribute('graphql.persisted_query.version', graphqlBody.extensions.persistedQuery.version);\n }\n }\n }\n });\n}\n\nfunction _updateBreadcrumbWithGraphQLData(client: Client, options: GraphQLClientOptions): void {\n client.on('beforeOutgoingRequestBreadcrumb', (breadcrumb, handlerData) => {\n const { category, type, data } = breadcrumb;\n\n const isFetch = category === 'fetch';\n const isXhr = category === 'xhr';\n const isHttpBreadcrumb = type === 'http';\n\n if (isHttpBreadcrumb && (isFetch || isXhr)) {\n const httpUrl = data?.url;\n const { endpoints } = options;\n\n const isTracedGraphqlEndpoint = stringMatchesSomePattern(httpUrl, endpoints);\n const payload = getRequestPayloadXhrOrFetch(handlerData as XhrHint | FetchHint);\n\n if (isTracedGraphqlEndpoint && data && payload) {\n const graphqlBody = getGraphQLRequestPayload(payload);\n\n if (!data.graphql && graphqlBody) {\n const operationInfo = _getGraphQLOperation(graphqlBody);\n\n data['graphql.operation'] = operationInfo;\n\n if (isStandardRequest(graphqlBody)) {\n data['graphql.document'] = graphqlBody.query;\n }\n\n if (isPersistedRequest(graphqlBody)) {\n data['graphql.persisted_query.hash.sha256'] = graphqlBody.extensions.persistedQuery.sha256Hash;\n data['graphql.persisted_query.version'] = graphqlBody.extensions.persistedQuery.version;\n }\n }\n }\n }\n });\n}\n\n/**\n * @param requestBody - GraphQL request\n * @returns A formatted version of the request: 'TYPE NAME' or 'TYPE' or 'persisted NAME'\n */\nexport function _getGraphQLOperation(requestBody: GraphQLRequestPayload): string {\n // Handle persisted operations\n if (isPersistedRequest(requestBody)) {\n return `persisted ${requestBody.operationName}`;\n }\n\n // Handle standard GraphQL requests\n if (isStandardRequest(requestBody)) {\n const { query: graphqlQuery, operationName: graphqlOperationName } = requestBody;\n const { operationName = graphqlOperationName, operationType } = parseGraphQLQuery(graphqlQuery);\n const operationInfo = operationName ? `${operationType} ${operationName}` : `${operationType}`;\n return operationInfo;\n }\n\n // Fallback for unknown request types\n return 'unknown';\n}\n\n/**\n * Get the request body/payload based on the shape of the hint.\n *\n * Exported for tests only.\n */\nexport function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | undefined {\n const isXhr = 'xhr' in hint;\n\n let body: string | undefined;\n\n if (isXhr) {\n const sentryXhrData = hint.xhr[SENTRY_XHR_DATA_KEY];\n body = sentryXhrData && getBodyString(sentryXhrData.body)[0];\n } else {\n const sentryFetchData = getFetchRequestArgBody(hint.input);\n body = getBodyString(sentryFetchData)[0];\n }\n\n return body;\n}\n\n/**\n * Extract the name and type of the operation from the GraphQL query.\n *\n * Exported for tests only.\n */\nexport function parseGraphQLQuery(query: string): GraphQLOperation {\n const namedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)(\\w+)(?:\\s*)[{(]/;\n const unnamedQueryRe = /^(?:\\s*)(query|mutation|subscription)(?:\\s*)[{(]/;\n\n const namedMatch = query.match(namedQueryRe);\n if (namedMatch) {\n return {\n operationType: namedMatch[1],\n operationName: namedMatch[2],\n };\n }\n\n const unnamedMatch = query.match(unnamedQueryRe);\n if (unnamedMatch) {\n return {\n operationType: unnamedMatch[1],\n operationName: undefined,\n };\n }\n return {\n operationType: undefined,\n operationName: undefined,\n };\n}\n\n/**\n * Helper to safely check if a value is a non-null object\n */\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * Type guard to check if a request is a standard GraphQL request\n */\nfunction isStandardRequest(payload: unknown): payload is GraphQLStandardRequest {\n return isObject(payload) && typeof payload.query === 'string';\n}\n\n/**\n * Type guard to check if a request is a persisted operation request\n */\nfunction isPersistedRequest(payload: unknown): payload is GraphQLPersistedRequest {\n return (\n isObject(payload) &&\n typeof payload.operationName === 'string' &&\n isObject(payload.extensions) &&\n isObject(payload.extensions.persistedQuery) &&\n typeof payload.extensions.persistedQuery.sha256Hash === 'string' &&\n typeof payload.extensions.persistedQuery.version === 'number'\n );\n}\n\n/**\n * Extract the payload of a request if it's GraphQL.\n * Exported for tests only.\n * @param payload - A valid JSON string\n * @returns A POJO or undefined\n */\nexport function getGraphQLRequestPayload(payload: string): GraphQLRequestPayload | undefined {\n try {\n const requestBody = JSON.parse(payload);\n\n // Return any valid GraphQL request (standard, persisted, or APQ retry with both)\n if (isStandardRequest(requestBody) || isPersistedRequest(requestBody)) {\n return requestBody;\n }\n\n // Not a GraphQL request\n return undefined;\n } catch {\n // Invalid JSON\n return undefined;\n }\n}\n\n/**\n * This integration ensures that GraphQL requests made in the browser\n * have their GraphQL-specific data captured and attached to spans and breadcrumbs.\n */\nexport const graphqlClientIntegration = defineIntegration(_graphqlClientIntegration);\n"],"names":[],"mappings":";;;AA4CA,MAAM,gBAAA,GAAmB,eAAA;AAEzB,MAAM,yBAAA,IAA6B,CAAC,OAAA,KAAkC;AACpE,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,MAAM,MAAA,EAAgB;AACpB,MAAA,0BAAA,CAA2B,QAAQ,OAAO,CAAA;AAC1C,MAAA,gCAAA,CAAiC,QAAQ,OAAO,CAAA;AAAA,IAClD;AAAA,GACF;AACF,CAAA,CAAA;AAEA,SAAS,0BAAA,CAA2B,QAAgB,OAAA,EAAqC;AACvF,EAAA,MAAA,CAAO,EAAA,CAAG,2BAAA,EAA6B,CAAC,IAAA,EAAM,IAAA,KAAS;AACrD,IAAA,MAAM,QAAA,GAAW,WAAW,IAAI,CAAA;AAEhC,IAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,IAAA,IAAQ,EAAC;AACzC,IAAA,MAAM,MAAA,GAAS,eAAe,4BAA4B,CAAA;AAE1D,IAAA,MAAM,mBAAmB,MAAA,KAAW,aAAA;AAEpC,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,M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