@sentry/core 10.47.0 → 10.49.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 (413) hide show
  1. package/build/cjs/attributes.js +43 -0
  2. package/build/cjs/attributes.js.map +1 -1
  3. package/build/cjs/client.js +13 -6
  4. package/build/cjs/client.js.map +1 -1
  5. package/build/cjs/envelope.js +4 -3
  6. package/build/cjs/envelope.js.map +1 -1
  7. package/build/cjs/fetch.js +36 -17
  8. package/build/cjs/fetch.js.map +1 -1
  9. package/build/cjs/index.js +53 -18
  10. package/build/cjs/index.js.map +1 -1
  11. package/build/cjs/integration.js +6 -0
  12. package/build/cjs/integration.js.map +1 -1
  13. package/build/cjs/integrations/conversationId.js +11 -0
  14. package/build/cjs/integrations/conversationId.js.map +1 -1
  15. package/build/cjs/integrations/express/index.js +243 -0
  16. package/build/cjs/integrations/express/index.js.map +1 -0
  17. package/build/cjs/integrations/express/patch-layer.js +257 -0
  18. package/build/cjs/integrations/express/patch-layer.js.map +1 -0
  19. package/build/cjs/integrations/express/request-layer-store.js +25 -0
  20. package/build/cjs/integrations/express/request-layer-store.js.map +1 -0
  21. package/build/cjs/integrations/express/set-sdk-processing-metadata.js +17 -0
  22. package/build/cjs/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  23. package/build/cjs/integrations/express/types.js +17 -0
  24. package/build/cjs/integrations/express/types.js.map +1 -0
  25. package/build/cjs/integrations/express/utils.js +238 -0
  26. package/build/cjs/integrations/express/utils.js.map +1 -0
  27. package/build/cjs/integrations/mcp-server/correlation.js +5 -1
  28. package/build/cjs/integrations/mcp-server/correlation.js.map +1 -1
  29. package/build/cjs/integrations/mcp-server/handlers.js +18 -10
  30. package/build/cjs/integrations/mcp-server/handlers.js.map +1 -1
  31. package/build/cjs/integrations/mcp-server/index.js +2 -1
  32. package/build/cjs/integrations/mcp-server/index.js.map +1 -1
  33. package/build/cjs/integrations/mcp-server/transport.js +1 -1
  34. package/build/cjs/integrations/mcp-server/transport.js.map +1 -1
  35. package/build/cjs/integrations/mcp-server/validation.js +7 -5
  36. package/build/cjs/integrations/mcp-server/validation.js.map +1 -1
  37. package/build/cjs/integrations/requestdata.js.map +1 -1
  38. package/build/cjs/integrations/spanStreaming.js +48 -0
  39. package/build/cjs/integrations/spanStreaming.js.map +1 -0
  40. package/build/cjs/semanticAttributes.js +35 -3
  41. package/build/cjs/semanticAttributes.js.map +1 -1
  42. package/build/cjs/tracing/ai/gen-ai-attributes.js +3 -89
  43. package/build/cjs/tracing/ai/gen-ai-attributes.js.map +1 -1
  44. package/build/cjs/tracing/ai/utils.js +74 -0
  45. package/build/cjs/tracing/ai/utils.js.map +1 -1
  46. package/build/cjs/tracing/anthropic-ai/index.js +6 -17
  47. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  48. package/build/cjs/tracing/anthropic-ai/streaming.js +2 -100
  49. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  50. package/build/cjs/tracing/anthropic-ai/utils.js +4 -2
  51. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  52. package/build/cjs/tracing/dynamicSamplingContext.js +2 -1
  53. package/build/cjs/tracing/dynamicSamplingContext.js.map +1 -1
  54. package/build/cjs/tracing/google-genai/constants.js +1 -6
  55. package/build/cjs/tracing/google-genai/constants.js.map +1 -1
  56. package/build/cjs/tracing/google-genai/index.js +40 -35
  57. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  58. package/build/cjs/tracing/google-genai/streaming.js +2 -23
  59. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  60. package/build/cjs/tracing/langchain/embeddings.js +132 -0
  61. package/build/cjs/tracing/langchain/embeddings.js.map +1 -0
  62. package/build/cjs/tracing/langchain/index.js +3 -0
  63. package/build/cjs/tracing/langchain/index.js.map +1 -1
  64. package/build/cjs/tracing/langchain/utils.js +12 -4
  65. package/build/cjs/tracing/langchain/utils.js.map +1 -1
  66. package/build/cjs/tracing/langgraph/index.js +4 -3
  67. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  68. package/build/cjs/tracing/openai/index.js +14 -34
  69. package/build/cjs/tracing/openai/index.js.map +1 -1
  70. package/build/cjs/tracing/openai/streaming.js +3 -34
  71. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  72. package/build/cjs/tracing/openai/utils.js +78 -204
  73. package/build/cjs/tracing/openai/utils.js.map +1 -1
  74. package/build/cjs/tracing/sentryNonRecordingSpan.js +7 -0
  75. package/build/cjs/tracing/sentryNonRecordingSpan.js.map +1 -1
  76. package/build/cjs/tracing/sentrySpan.js +39 -0
  77. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  78. package/build/cjs/tracing/spans/beforeSendSpan.js +43 -0
  79. package/build/cjs/tracing/spans/beforeSendSpan.js.map +1 -0
  80. package/build/cjs/tracing/spans/captureSpan.js +126 -0
  81. package/build/cjs/tracing/spans/captureSpan.js.map +1 -0
  82. package/build/cjs/tracing/spans/envelope.js +38 -0
  83. package/build/cjs/tracing/spans/envelope.js.map +1 -0
  84. package/build/cjs/tracing/spans/estimateSize.js +41 -0
  85. package/build/cjs/tracing/spans/estimateSize.js.map +1 -0
  86. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js +11 -0
  87. package/build/cjs/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  88. package/build/cjs/tracing/spans/spanBuffer.js +158 -0
  89. package/build/cjs/tracing/spans/spanBuffer.js.map +1 -0
  90. package/build/cjs/tracing/trace.js +83 -13
  91. package/build/cjs/tracing/trace.js.map +1 -1
  92. package/build/cjs/tracing/utils.js +3 -37
  93. package/build/cjs/tracing/utils.js.map +1 -1
  94. package/build/cjs/tracing/vercel-ai/constants.js +15 -23
  95. package/build/cjs/tracing/vercel-ai/constants.js.map +1 -1
  96. package/build/cjs/tracing/vercel-ai/index.js +32 -45
  97. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  98. package/build/cjs/tracing/vercel-ai/utils.js +11 -42
  99. package/build/cjs/tracing/vercel-ai/utils.js.map +1 -1
  100. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  101. package/build/cjs/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  102. package/build/cjs/utils/browser.js +2 -3
  103. package/build/cjs/utils/browser.js.map +1 -1
  104. package/build/cjs/utils/featureFlags.js +6 -0
  105. package/build/cjs/utils/featureFlags.js.map +1 -1
  106. package/build/cjs/utils/object.js +33 -0
  107. package/build/cjs/utils/object.js.map +1 -1
  108. package/build/cjs/utils/spanUtils.js +116 -13
  109. package/build/cjs/utils/spanUtils.js.map +1 -1
  110. package/build/cjs/utils/stacktrace.js +3 -1
  111. package/build/cjs/utils/stacktrace.js.map +1 -1
  112. package/build/cjs/utils/string.js +3 -0
  113. package/build/cjs/utils/string.js.map +1 -1
  114. package/build/cjs/utils/version.js +1 -1
  115. package/build/cjs/utils/weakRef.js +62 -0
  116. package/build/cjs/utils/weakRef.js.map +1 -0
  117. package/build/esm/attributes.js +43 -1
  118. package/build/esm/attributes.js.map +1 -1
  119. package/build/esm/client.js +8 -1
  120. package/build/esm/client.js.map +1 -1
  121. package/build/esm/envelope.js +2 -1
  122. package/build/esm/envelope.js.map +1 -1
  123. package/build/esm/fetch.js +36 -17
  124. package/build/esm/fetch.js.map +1 -1
  125. package/build/esm/index.js +12 -3
  126. package/build/esm/index.js.map +1 -1
  127. package/build/esm/integration.js +6 -0
  128. package/build/esm/integration.js.map +1 -1
  129. package/build/esm/integrations/conversationId.js +11 -0
  130. package/build/esm/integrations/conversationId.js.map +1 -1
  131. package/build/esm/integrations/express/index.js +239 -0
  132. package/build/esm/integrations/express/index.js.map +1 -0
  133. package/build/esm/integrations/express/patch-layer.js +255 -0
  134. package/build/esm/integrations/express/patch-layer.js.map +1 -0
  135. package/build/esm/integrations/express/request-layer-store.js +22 -0
  136. package/build/esm/integrations/express/request-layer-store.js.map +1 -0
  137. package/build/esm/integrations/express/set-sdk-processing-metadata.js +15 -0
  138. package/build/esm/integrations/express/set-sdk-processing-metadata.js.map +1 -0
  139. package/build/esm/integrations/express/types.js +10 -0
  140. package/build/esm/integrations/express/types.js.map +1 -0
  141. package/build/esm/integrations/express/utils.js +225 -0
  142. package/build/esm/integrations/express/utils.js.map +1 -0
  143. package/build/esm/integrations/mcp-server/correlation.js +5 -1
  144. package/build/esm/integrations/mcp-server/correlation.js.map +1 -1
  145. package/build/esm/integrations/mcp-server/handlers.js +18 -10
  146. package/build/esm/integrations/mcp-server/handlers.js.map +1 -1
  147. package/build/esm/integrations/mcp-server/index.js +2 -1
  148. package/build/esm/integrations/mcp-server/index.js.map +1 -1
  149. package/build/esm/integrations/mcp-server/transport.js +1 -1
  150. package/build/esm/integrations/mcp-server/transport.js.map +1 -1
  151. package/build/esm/integrations/mcp-server/validation.js +7 -5
  152. package/build/esm/integrations/mcp-server/validation.js.map +1 -1
  153. package/build/esm/integrations/requestdata.js.map +1 -1
  154. package/build/esm/integrations/spanStreaming.js +46 -0
  155. package/build/esm/integrations/spanStreaming.js.map +1 -0
  156. package/build/esm/package.json +1 -1
  157. package/build/esm/semanticAttributes.js +26 -4
  158. package/build/esm/semanticAttributes.js.map +1 -1
  159. package/build/esm/tracing/ai/gen-ai-attributes.js +3 -76
  160. package/build/esm/tracing/ai/gen-ai-attributes.js.map +1 -1
  161. package/build/esm/tracing/ai/utils.js +73 -2
  162. package/build/esm/tracing/ai/utils.js.map +1 -1
  163. package/build/esm/tracing/anthropic-ai/index.js +8 -19
  164. package/build/esm/tracing/anthropic-ai/index.js.map +1 -1
  165. package/build/esm/tracing/anthropic-ai/streaming.js +3 -101
  166. package/build/esm/tracing/anthropic-ai/streaming.js.map +1 -1
  167. package/build/esm/tracing/anthropic-ai/utils.js +5 -3
  168. package/build/esm/tracing/anthropic-ai/utils.js.map +1 -1
  169. package/build/esm/tracing/dynamicSamplingContext.js +2 -1
  170. package/build/esm/tracing/dynamicSamplingContext.js.map +1 -1
  171. package/build/esm/tracing/google-genai/constants.js +2 -5
  172. package/build/esm/tracing/google-genai/constants.js.map +1 -1
  173. package/build/esm/tracing/google-genai/index.js +42 -37
  174. package/build/esm/tracing/google-genai/index.js.map +1 -1
  175. package/build/esm/tracing/google-genai/streaming.js +2 -23
  176. package/build/esm/tracing/google-genai/streaming.js.map +1 -1
  177. package/build/esm/tracing/langchain/embeddings.js +129 -0
  178. package/build/esm/tracing/langchain/embeddings.js.map +1 -0
  179. package/build/esm/tracing/langchain/index.js +4 -1
  180. package/build/esm/tracing/langchain/index.js.map +1 -1
  181. package/build/esm/tracing/langchain/utils.js +13 -5
  182. package/build/esm/tracing/langchain/utils.js.map +1 -1
  183. package/build/esm/tracing/langgraph/index.js +5 -4
  184. package/build/esm/tracing/langgraph/index.js.map +1 -1
  185. package/build/esm/tracing/openai/index.js +16 -36
  186. package/build/esm/tracing/openai/index.js.map +1 -1
  187. package/build/esm/tracing/openai/streaming.js +4 -35
  188. package/build/esm/tracing/openai/streaming.js.map +1 -1
  189. package/build/esm/tracing/openai/utils.js +79 -196
  190. package/build/esm/tracing/openai/utils.js.map +1 -1
  191. package/build/esm/tracing/sentryNonRecordingSpan.js +7 -0
  192. package/build/esm/tracing/sentryNonRecordingSpan.js.map +1 -1
  193. package/build/esm/tracing/sentrySpan.js +40 -1
  194. package/build/esm/tracing/sentrySpan.js.map +1 -1
  195. package/build/esm/tracing/spans/beforeSendSpan.js +40 -0
  196. package/build/esm/tracing/spans/beforeSendSpan.js.map +1 -0
  197. package/build/esm/tracing/spans/captureSpan.js +122 -0
  198. package/build/esm/tracing/spans/captureSpan.js.map +1 -0
  199. package/build/esm/tracing/spans/envelope.js +36 -0
  200. package/build/esm/tracing/spans/envelope.js.map +1 -0
  201. package/build/esm/tracing/spans/estimateSize.js +39 -0
  202. package/build/esm/tracing/spans/estimateSize.js.map +1 -0
  203. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js +9 -0
  204. package/build/esm/tracing/spans/hasSpanStreamingEnabled.js.map +1 -0
  205. package/build/esm/tracing/spans/spanBuffer.js +156 -0
  206. package/build/esm/tracing/spans/spanBuffer.js.map +1 -0
  207. package/build/esm/tracing/trace.js +84 -14
  208. package/build/esm/tracing/trace.js.map +1 -1
  209. package/build/esm/tracing/utils.js +3 -37
  210. package/build/esm/tracing/utils.js.map +1 -1
  211. package/build/esm/tracing/vercel-ai/constants.js +15 -19
  212. package/build/esm/tracing/vercel-ai/constants.js.map +1 -1
  213. package/build/esm/tracing/vercel-ai/index.js +29 -42
  214. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  215. package/build/esm/tracing/vercel-ai/utils.js +14 -44
  216. package/build/esm/tracing/vercel-ai/utils.js.map +1 -1
  217. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js +4 -1
  218. package/build/esm/tracing/vercel-ai/vercel-ai-attributes.js.map +1 -1
  219. package/build/esm/utils/browser.js +2 -3
  220. package/build/esm/utils/browser.js.map +1 -1
  221. package/build/esm/utils/featureFlags.js +6 -0
  222. package/build/esm/utils/featureFlags.js.map +1 -1
  223. package/build/esm/utils/object.js +33 -1
  224. package/build/esm/utils/object.js.map +1 -1
  225. package/build/esm/utils/spanUtils.js +112 -14
  226. package/build/esm/utils/spanUtils.js.map +1 -1
  227. package/build/esm/utils/stacktrace.js +3 -1
  228. package/build/esm/utils/stacktrace.js.map +1 -1
  229. package/build/esm/utils/string.js +3 -0
  230. package/build/esm/utils/string.js.map +1 -1
  231. package/build/esm/utils/version.js +1 -1
  232. package/build/esm/utils/weakRef.js +59 -0
  233. package/build/esm/utils/weakRef.js.map +1 -0
  234. package/build/types/attributes.d.ts +5 -0
  235. package/build/types/attributes.d.ts.map +1 -1
  236. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  237. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts.map +1 -1
  238. package/build/types/client.d.ts +35 -1
  239. package/build/types/client.d.ts.map +1 -1
  240. package/build/types/envelope.d.ts.map +1 -1
  241. package/build/types/fetch.d.ts +12 -8
  242. package/build/types/fetch.d.ts.map +1 -1
  243. package/build/types/index.d.ts +16 -5
  244. package/build/types/index.d.ts.map +1 -1
  245. package/build/types/integration.d.ts.map +1 -1
  246. package/build/types/integrations/conversationId.d.ts.map +1 -1
  247. package/build/types/integrations/express/index.d.ts +82 -0
  248. package/build/types/integrations/express/index.d.ts.map +1 -0
  249. package/build/types/integrations/express/patch-layer.d.ts +32 -0
  250. package/build/types/integrations/express/patch-layer.d.ts.map +1 -0
  251. package/build/types/integrations/express/request-layer-store.d.ts +32 -0
  252. package/build/types/integrations/express/request-layer-store.d.ts.map +1 -0
  253. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  254. package/build/types/integrations/express/set-sdk-processing-metadata.d.ts.map +1 -0
  255. package/build/types/integrations/express/types.d.ts +158 -0
  256. package/build/types/integrations/express/types.d.ts.map +1 -0
  257. package/build/types/integrations/express/utils.d.ts +93 -0
  258. package/build/types/integrations/express/utils.d.ts.map +1 -0
  259. package/build/types/integrations/mcp-server/correlation.d.ts +2 -1
  260. package/build/types/integrations/mcp-server/correlation.d.ts.map +1 -1
  261. package/build/types/integrations/mcp-server/handlers.d.ts +9 -4
  262. package/build/types/integrations/mcp-server/handlers.d.ts.map +1 -1
  263. package/build/types/integrations/mcp-server/index.d.ts +2 -1
  264. package/build/types/integrations/mcp-server/index.d.ts.map +1 -1
  265. package/build/types/integrations/mcp-server/types.d.ts +40 -7
  266. package/build/types/integrations/mcp-server/types.d.ts.map +1 -1
  267. package/build/types/integrations/mcp-server/validation.d.ts +4 -1
  268. package/build/types/integrations/mcp-server/validation.d.ts.map +1 -1
  269. package/build/types/integrations/requestdata.d.ts.map +1 -1
  270. package/build/types/integrations/spanStreaming.d.ts +2 -0
  271. package/build/types/integrations/spanStreaming.d.ts.map +1 -0
  272. package/build/types/semanticAttributes.d.ts +23 -3
  273. package/build/types/semanticAttributes.d.ts.map +1 -1
  274. package/build/types/tracing/ai/gen-ai-attributes.d.ts +4 -44
  275. package/build/types/tracing/ai/gen-ai-attributes.d.ts.map +1 -1
  276. package/build/types/tracing/ai/utils.d.ts +32 -2
  277. package/build/types/tracing/ai/utils.d.ts.map +1 -1
  278. package/build/types/tracing/anthropic-ai/index.d.ts.map +1 -1
  279. package/build/types/tracing/anthropic-ai/streaming.d.ts.map +1 -1
  280. package/build/types/tracing/anthropic-ai/types.d.ts +5 -0
  281. package/build/types/tracing/anthropic-ai/types.d.ts.map +1 -1
  282. package/build/types/tracing/anthropic-ai/utils.d.ts +1 -1
  283. package/build/types/tracing/anthropic-ai/utils.d.ts.map +1 -1
  284. package/build/types/tracing/dynamicSamplingContext.d.ts.map +1 -1
  285. package/build/types/tracing/google-genai/constants.d.ts +1 -3
  286. package/build/types/tracing/google-genai/constants.d.ts.map +1 -1
  287. package/build/types/tracing/google-genai/index.d.ts.map +1 -1
  288. package/build/types/tracing/google-genai/streaming.d.ts.map +1 -1
  289. package/build/types/tracing/google-genai/types.d.ts +5 -0
  290. package/build/types/tracing/google-genai/types.d.ts.map +1 -1
  291. package/build/types/tracing/index.d.ts +1 -0
  292. package/build/types/tracing/index.d.ts.map +1 -1
  293. package/build/types/tracing/langchain/embeddings.d.ts +27 -0
  294. package/build/types/tracing/langchain/embeddings.d.ts.map +1 -0
  295. package/build/types/tracing/langchain/index.d.ts +1 -0
  296. package/build/types/tracing/langchain/index.d.ts.map +1 -1
  297. package/build/types/tracing/langchain/types.d.ts +5 -0
  298. package/build/types/tracing/langchain/types.d.ts.map +1 -1
  299. package/build/types/tracing/langchain/utils.d.ts +2 -2
  300. package/build/types/tracing/langchain/utils.d.ts.map +1 -1
  301. package/build/types/tracing/langgraph/index.d.ts.map +1 -1
  302. package/build/types/tracing/langgraph/types.d.ts +5 -0
  303. package/build/types/tracing/langgraph/types.d.ts.map +1 -1
  304. package/build/types/tracing/openai/index.d.ts.map +1 -1
  305. package/build/types/tracing/openai/streaming.d.ts.map +1 -1
  306. package/build/types/tracing/openai/types.d.ts +5 -0
  307. package/build/types/tracing/openai/types.d.ts.map +1 -1
  308. package/build/types/tracing/openai/utils.d.ts +4 -49
  309. package/build/types/tracing/openai/utils.d.ts.map +1 -1
  310. package/build/types/tracing/sentryNonRecordingSpan.d.ts +12 -1
  311. package/build/types/tracing/sentryNonRecordingSpan.d.ts.map +1 -1
  312. package/build/types/tracing/sentrySpan.d.ts +10 -1
  313. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  314. package/build/types/tracing/spans/beforeSendSpan.d.ts +35 -0
  315. package/build/types/tracing/spans/beforeSendSpan.d.ts.map +1 -0
  316. package/build/types/tracing/spans/captureSpan.d.ts +26 -0
  317. package/build/types/tracing/spans/captureSpan.d.ts.map +1 -0
  318. package/build/types/tracing/spans/envelope.d.ts +8 -0
  319. package/build/types/tracing/spans/envelope.d.ts.map +1 -0
  320. package/build/types/tracing/spans/estimateSize.d.ts +12 -0
  321. package/build/types/tracing/spans/estimateSize.d.ts.map +1 -0
  322. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  323. package/build/types/tracing/spans/hasSpanStreamingEnabled.d.ts.map +1 -0
  324. package/build/types/tracing/spans/spanBuffer.d.ts +60 -0
  325. package/build/types/tracing/spans/spanBuffer.d.ts.map +1 -0
  326. package/build/types/tracing/trace.d.ts.map +1 -1
  327. package/build/types/tracing/utils.d.ts.map +1 -1
  328. package/build/types/tracing/vercel-ai/constants.d.ts +2 -5
  329. package/build/types/tracing/vercel-ai/constants.d.ts.map +1 -1
  330. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  331. package/build/types/tracing/vercel-ai/utils.d.ts +1 -5
  332. package/build/types/tracing/vercel-ai/utils.d.ts.map +1 -1
  333. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  334. package/build/types/tracing/vercel-ai/vercel-ai-attributes.d.ts.map +1 -1
  335. package/build/types/types-hoist/envelope.d.ts +22 -2
  336. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  337. package/build/types/types-hoist/integration.d.ts +8 -0
  338. package/build/types/types-hoist/integration.d.ts.map +1 -1
  339. package/build/types/types-hoist/link.d.ts +2 -2
  340. package/build/types/types-hoist/link.d.ts.map +1 -1
  341. package/build/types/types-hoist/options.d.ts +26 -2
  342. package/build/types/types-hoist/options.d.ts.map +1 -1
  343. package/build/types/types-hoist/span.d.ts +35 -0
  344. package/build/types/types-hoist/span.d.ts.map +1 -1
  345. package/build/types/types-hoist/view-hierarchy.d.ts +1 -0
  346. package/build/types/types-hoist/view-hierarchy.d.ts.map +1 -1
  347. package/build/types/utils/browser.d.ts +1 -1
  348. package/build/types/utils/browser.d.ts.map +1 -1
  349. package/build/types/utils/featureFlags.d.ts.map +1 -1
  350. package/build/types/utils/object.d.ts +10 -0
  351. package/build/types/utils/object.d.ts.map +1 -1
  352. package/build/types/utils/spanUtils.d.ts +27 -2
  353. package/build/types/utils/spanUtils.d.ts.map +1 -1
  354. package/build/types/utils/stacktrace.d.ts.map +1 -1
  355. package/build/types/utils/string.d.ts +2 -2
  356. package/build/types/utils/string.d.ts.map +1 -1
  357. package/build/types/utils/weakRef.d.ts +34 -0
  358. package/build/types/utils/weakRef.d.ts.map +1 -0
  359. package/build/types-ts3.8/attributes.d.ts +5 -0
  360. package/build/types-ts3.8/build-time-plugins/buildTimeOptionsBase.d.ts +13 -0
  361. package/build/types-ts3.8/client.d.ts +35 -1
  362. package/build/types-ts3.8/fetch.d.ts +14 -10
  363. package/build/types-ts3.8/index.d.ts +16 -5
  364. package/build/types-ts3.8/integrations/express/index.d.ts +82 -0
  365. package/build/types-ts3.8/integrations/express/patch-layer.d.ts +32 -0
  366. package/build/types-ts3.8/integrations/express/request-layer-store.d.ts +32 -0
  367. package/build/types-ts3.8/integrations/express/set-sdk-processing-metadata.d.ts +35 -0
  368. package/build/types-ts3.8/integrations/express/types.d.ts +158 -0
  369. package/build/types-ts3.8/integrations/express/utils.d.ts +96 -0
  370. package/build/types-ts3.8/integrations/mcp-server/correlation.d.ts +2 -1
  371. package/build/types-ts3.8/integrations/mcp-server/handlers.d.ts +9 -4
  372. package/build/types-ts3.8/integrations/mcp-server/index.d.ts +2 -1
  373. package/build/types-ts3.8/integrations/mcp-server/types.d.ts +40 -7
  374. package/build/types-ts3.8/integrations/mcp-server/validation.d.ts +4 -1
  375. package/build/types-ts3.8/integrations/spanStreaming.d.ts +2 -0
  376. package/build/types-ts3.8/semanticAttributes.d.ts +23 -3
  377. package/build/types-ts3.8/tracing/ai/gen-ai-attributes.d.ts +4 -44
  378. package/build/types-ts3.8/tracing/ai/utils.d.ts +32 -2
  379. package/build/types-ts3.8/tracing/anthropic-ai/types.d.ts +5 -0
  380. package/build/types-ts3.8/tracing/anthropic-ai/utils.d.ts +1 -1
  381. package/build/types-ts3.8/tracing/google-genai/constants.d.ts +1 -3
  382. package/build/types-ts3.8/tracing/google-genai/types.d.ts +5 -0
  383. package/build/types-ts3.8/tracing/index.d.ts +1 -0
  384. package/build/types-ts3.8/tracing/langchain/embeddings.d.ts +27 -0
  385. package/build/types-ts3.8/tracing/langchain/index.d.ts +1 -0
  386. package/build/types-ts3.8/tracing/langchain/types.d.ts +5 -0
  387. package/build/types-ts3.8/tracing/langchain/utils.d.ts +2 -2
  388. package/build/types-ts3.8/tracing/langgraph/types.d.ts +5 -0
  389. package/build/types-ts3.8/tracing/openai/types.d.ts +5 -0
  390. package/build/types-ts3.8/tracing/openai/utils.d.ts +4 -49
  391. package/build/types-ts3.8/tracing/sentryNonRecordingSpan.d.ts +12 -1
  392. package/build/types-ts3.8/tracing/sentrySpan.d.ts +10 -1
  393. package/build/types-ts3.8/tracing/spans/beforeSendSpan.d.ts +35 -0
  394. package/build/types-ts3.8/tracing/spans/captureSpan.d.ts +26 -0
  395. package/build/types-ts3.8/tracing/spans/envelope.d.ts +8 -0
  396. package/build/types-ts3.8/tracing/spans/estimateSize.d.ts +12 -0
  397. package/build/types-ts3.8/tracing/spans/hasSpanStreamingEnabled.d.ts +6 -0
  398. package/build/types-ts3.8/tracing/spans/spanBuffer.d.ts +60 -0
  399. package/build/types-ts3.8/tracing/vercel-ai/constants.d.ts +2 -5
  400. package/build/types-ts3.8/tracing/vercel-ai/utils.d.ts +1 -5
  401. package/build/types-ts3.8/tracing/vercel-ai/vercel-ai-attributes.d.ts +0 -480
  402. package/build/types-ts3.8/types-hoist/envelope.d.ts +22 -2
  403. package/build/types-ts3.8/types-hoist/integration.d.ts +8 -0
  404. package/build/types-ts3.8/types-hoist/link.d.ts +2 -2
  405. package/build/types-ts3.8/types-hoist/options.d.ts +26 -2
  406. package/build/types-ts3.8/types-hoist/span.d.ts +35 -0
  407. package/build/types-ts3.8/types-hoist/view-hierarchy.d.ts +1 -0
  408. package/build/types-ts3.8/utils/browser.d.ts +1 -1
  409. package/build/types-ts3.8/utils/object.d.ts +10 -0
  410. package/build/types-ts3.8/utils/spanUtils.d.ts +27 -2
  411. package/build/types-ts3.8/utils/string.d.ts +2 -2
  412. package/build/types-ts3.8/utils/weakRef.d.ts +34 -0
  413. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"featureFlags.js","sources":["../../../src/utils/featureFlags.ts"],"sourcesContent":["import { getCurrentScope } from '../currentScopes';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { type Event } from '../types-hoist/event';\nimport { debug } from './debug-logger';\nimport { getActiveSpan, spanToJSON } from './spanUtils';\n\n/**\n * Ordered LRU cache for storing feature flags in the scope context. The name\n * of each flag in the buffer is unique, and the output of getAll() is ordered\n * from oldest to newest.\n */\n\nexport type FeatureFlag = { readonly flag: string; readonly result: boolean };\n\n/**\n * Max size of the LRU flag buffer stored in Sentry scope and event contexts.\n */\nexport const _INTERNAL_FLAG_BUFFER_SIZE = 100;\n\n/**\n * Max number of flag evaluations to record per span.\n */\nexport const _INTERNAL_MAX_FLAGS_PER_SPAN = 10;\n\nconst SPAN_FLAG_ATTRIBUTE_PREFIX = 'flag.evaluation.';\n\n/**\n * Copies feature flags that are in current scope context to the event context\n */\nexport function _INTERNAL_copyFlagsFromScopeToEvent(event: Event): Event {\n const scope = getCurrentScope();\n const flagContext = scope.getScopeData().contexts.flags;\n const flagBuffer = flagContext ? flagContext.values : [];\n\n if (!flagBuffer.length) {\n return event;\n }\n\n if (event.contexts === undefined) {\n event.contexts = {};\n }\n event.contexts.flags = { values: [...flagBuffer] };\n return event;\n}\n\n/**\n * Inserts a flag into the current scope's context while maintaining ordered LRU properties.\n * Not thread-safe. After inserting:\n * - The flag buffer is sorted in order of recency, with the newest evaluation at the end.\n * - The names in the buffer are always unique.\n * - The length of the buffer never exceeds `maxSize`.\n *\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_insertFlagToScope(\n name: string,\n value: unknown,\n maxSize: number = _INTERNAL_FLAG_BUFFER_SIZE,\n): void {\n const scopeContexts = getCurrentScope().getScopeData().contexts;\n if (!scopeContexts.flags) {\n scopeContexts.flags = { values: [] };\n }\n const flags = scopeContexts.flags.values;\n _INTERNAL_insertToFlagBuffer(flags, name, value, maxSize);\n}\n\n/**\n * Exported for tests only. Currently only accepts boolean values (otherwise no-op).\n * Inserts a flag into a FeatureFlag array while maintaining the following properties:\n * - Flags are sorted in order of recency, with the newest evaluation at the end.\n * - The flag names are always unique.\n * - The length of the array never exceeds `maxSize`.\n *\n * @param flags The buffer to insert the flag into.\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_insertToFlagBuffer(\n flags: FeatureFlag[],\n name: string,\n value: unknown,\n maxSize: number,\n): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n if (flags.length > maxSize) {\n DEBUG_BUILD && debug.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);\n return;\n }\n\n // Check if the flag is already in the buffer - O(n)\n const index = flags.findIndex(f => f.flag === name);\n\n if (index !== -1) {\n // The flag was found, remove it from its current position - O(n)\n flags.splice(index, 1);\n }\n\n if (flags.length === maxSize) {\n // If at capacity, pop the earliest flag - O(n)\n flags.shift();\n }\n\n // Push the flag to the end - O(1)\n flags.push({\n flag: name,\n result: value,\n });\n}\n\n/**\n * Records a feature flag evaluation for the active span. This is a no-op for non-boolean values.\n * The flag and its value is stored in span attributes with the `flag.evaluation` prefix. Once the\n * unique flags for a span reaches maxFlagsPerSpan, subsequent flags are dropped.\n *\n * @param name Name of the feature flag.\n * @param value Value of the feature flag. Non-boolean values are ignored.\n * @param maxFlagsPerSpan Max number of flags a buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_addFeatureFlagToActiveSpan(\n name: string,\n value: unknown,\n maxFlagsPerSpan: number = _INTERNAL_MAX_FLAGS_PER_SPAN,\n): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n const span = getActiveSpan();\n if (!span) {\n return;\n }\n\n const attributes = spanToJSON(span).data;\n\n // If the flag already exists, always update it\n if (`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}` in attributes) {\n span.setAttribute(`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}`, value);\n return;\n }\n\n // Else, add the flag to the span if we have not reached the max number of flags\n const numOfAddedFlags = Object.keys(attributes).filter(key => key.startsWith(SPAN_FLAG_ATTRIBUTE_PREFIX)).length;\n if (numOfAddedFlags < maxFlagsPerSpan) {\n span.setAttribute(`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}`, value);\n }\n}\n"],"names":["getCurrentScope","DEBUG_BUILD","debug","getActiveSpan","spanToJSON"],"mappings":";;;;;;;AAMA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAM,0BAAA,GAA6B;;AAE1C;AACA;AACA;AACO,MAAM,4BAAA,GAA+B;;AAE5C,MAAM,0BAAA,GAA6B,kBAAkB;;AAErD;AACA;AACA;AACO,SAAS,mCAAmC,CAAC,KAAK,EAAgB;AACzE,EAAE,MAAM,KAAA,GAAQA,6BAAe,EAAE;AACjC,EAAE,MAAM,WAAA,GAAc,KA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AAA,CAAA,MAAA,CAAA,GAAA,IAAA,GAAA,CAAA,UAAA,CAAA,0BAAA,CAAA,CAAA,CAAA,MAAA;AACA,EAAA,IAAA,eAAA,GAAA,eAAA,EAAA;AACA,IAAA,IAAA,CAAA,YAAA,CAAA,CAAA,EAAA,0BAAA,CAAA,EAAA,IAAA,CAAA,CAAA,EAAA,KAAA,CAAA;AACA,EAAA;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"featureFlags.js","sources":["../../../src/utils/featureFlags.ts"],"sourcesContent":["import { getCurrentScope } from '../currentScopes';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { type Event } from '../types-hoist/event';\nimport { debug } from './debug-logger';\nimport { getActiveSpan, spanToJSON } from './spanUtils';\n\n/**\n * Ordered LRU cache for storing feature flags in the scope context. The name\n * of each flag in the buffer is unique, and the output of getAll() is ordered\n * from oldest to newest.\n */\n\nexport type FeatureFlag = { readonly flag: string; readonly result: boolean };\n\n/**\n * Max size of the LRU flag buffer stored in Sentry scope and event contexts.\n */\nexport const _INTERNAL_FLAG_BUFFER_SIZE = 100;\n\n/**\n * Max number of flag evaluations to record per span.\n */\nexport const _INTERNAL_MAX_FLAGS_PER_SPAN = 10;\n\nconst SPAN_FLAG_ATTRIBUTE_PREFIX = 'flag.evaluation.';\n\n/**\n * Copies feature flags that are in current scope context to the event context\n */\nexport function _INTERNAL_copyFlagsFromScopeToEvent(event: Event): Event {\n if (event.type) {\n // No need to add the flags context to transaction events.\n // Spans already get the flag.evaluation attributes.\n return event;\n }\n\n const scope = getCurrentScope();\n const flagContext = scope.getScopeData().contexts.flags;\n const flagBuffer = flagContext ? flagContext.values : [];\n\n if (!flagBuffer.length) {\n return event;\n }\n\n if (event.contexts === undefined) {\n event.contexts = {};\n }\n event.contexts.flags = { values: [...flagBuffer] };\n return event;\n}\n\n/**\n * Inserts a flag into the current scope's context while maintaining ordered LRU properties.\n * Not thread-safe. After inserting:\n * - The flag buffer is sorted in order of recency, with the newest evaluation at the end.\n * - The names in the buffer are always unique.\n * - The length of the buffer never exceeds `maxSize`.\n *\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_insertFlagToScope(\n name: string,\n value: unknown,\n maxSize: number = _INTERNAL_FLAG_BUFFER_SIZE,\n): void {\n const scopeContexts = getCurrentScope().getScopeData().contexts;\n if (!scopeContexts.flags) {\n scopeContexts.flags = { values: [] };\n }\n const flags = scopeContexts.flags.values;\n _INTERNAL_insertToFlagBuffer(flags, name, value, maxSize);\n}\n\n/**\n * Exported for tests only. Currently only accepts boolean values (otherwise no-op).\n * Inserts a flag into a FeatureFlag array while maintaining the following properties:\n * - Flags are sorted in order of recency, with the newest evaluation at the end.\n * - The flag names are always unique.\n * - The length of the array never exceeds `maxSize`.\n *\n * @param flags The buffer to insert the flag into.\n * @param name Name of the feature flag to insert.\n * @param value Value of the feature flag.\n * @param maxSize Max number of flags the buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_insertToFlagBuffer(\n flags: FeatureFlag[],\n name: string,\n value: unknown,\n maxSize: number,\n): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n if (flags.length > maxSize) {\n DEBUG_BUILD && debug.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${maxSize}`);\n return;\n }\n\n // Check if the flag is already in the buffer - O(n)\n const index = flags.findIndex(f => f.flag === name);\n\n if (index !== -1) {\n // The flag was found, remove it from its current position - O(n)\n flags.splice(index, 1);\n }\n\n if (flags.length === maxSize) {\n // If at capacity, pop the earliest flag - O(n)\n flags.shift();\n }\n\n // Push the flag to the end - O(1)\n flags.push({\n flag: name,\n result: value,\n });\n}\n\n/**\n * Records a feature flag evaluation for the active span. This is a no-op for non-boolean values.\n * The flag and its value is stored in span attributes with the `flag.evaluation` prefix. Once the\n * unique flags for a span reaches maxFlagsPerSpan, subsequent flags are dropped.\n *\n * @param name Name of the feature flag.\n * @param value Value of the feature flag. Non-boolean values are ignored.\n * @param maxFlagsPerSpan Max number of flags a buffer should store. Default value should always be used in production.\n */\nexport function _INTERNAL_addFeatureFlagToActiveSpan(\n name: string,\n value: unknown,\n maxFlagsPerSpan: number = _INTERNAL_MAX_FLAGS_PER_SPAN,\n): void {\n if (typeof value !== 'boolean') {\n return;\n }\n\n const span = getActiveSpan();\n if (!span) {\n return;\n }\n\n const attributes = spanToJSON(span).data;\n\n // If the flag already exists, always update it\n if (`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}` in attributes) {\n span.setAttribute(`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}`, value);\n return;\n }\n\n // Else, add the flag to the span if we have not reached the max number of flags\n const numOfAddedFlags = Object.keys(attributes).filter(key => key.startsWith(SPAN_FLAG_ATTRIBUTE_PREFIX)).length;\n if (numOfAddedFlags < maxFlagsPerSpan) {\n span.setAttribute(`${SPAN_FLAG_ATTRIBUTE_PREFIX}${name}`, value);\n }\n}\n"],"names":["getCurrentScope","DEBUG_BUILD","debug","getActiveSpan","spanToJSON"],"mappings":";;;;;;;AAMA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACO,MAAM,0BAAA,GAA6B;;AAE1C;AACA;AACA;AACO,MAAM,4BAAA,GAA+B;;AAE5C,MAAM,0BAAA,GAA6B,kBAAkB;;AAErD;AACA;AACA;AACO,SAAS,mCAAmC,CAAC,KAAK,EAAgB;AACzE,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE;AAClB;AACA;AACA,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,MAAM,KAAA,GAAQA,6BAAe,EAAE;AACjC,EAAE,MAAM,WAAA,GAAc,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,KAAK;AACzD,EAAE,MAAM,UAAA,GAAa,WAAA,GAAc,WAAW,CAAC,MAAA,GAAS,EAAE;;AAE1D,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;AAC1B,IAAI,OAAO,KAAK;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A,IAAA,CAAA,CAAA,EAAA,KAAA,CAAA;AACA,EAAA;AACA;;;;;;;;;"}
@@ -20,6 +20,7 @@ const is = require('./is.js');
20
20
  * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.
21
21
  * @returns void
22
22
  */
23
+
23
24
  function fill(source, name, replacementFactory) {
24
25
  if (!(name in source)) {
25
26
  return;
@@ -82,6 +83,37 @@ function markFunctionWrapped(wrapped, original) {
82
83
  } catch {} // eslint-disable-line no-empty
83
84
  }
84
85
 
86
+ /**
87
+ * Wrap a method on an object by name, only if it is not already wrapped.
88
+ *
89
+ * Note: to set the wrapped method as a non-enumerable property, pass
90
+ * false as the `enumerable` argument. This could be detected, but only
91
+ * by either walking up the prototype chain, or iterating over all fields
92
+ * in a `for(in)` loop. Neither are an acceptable performance impact for
93
+ * the rare case where we might patch a non-enumerable method.
94
+ */
95
+ function wrapMethod(
96
+ obj,
97
+ field,
98
+ wrapped,
99
+ enumerable = true,
100
+ ) {
101
+ const original = obj[field];
102
+ if (typeof original !== 'function') {
103
+ throw new Error(`Cannot wrap method: ${field} is not a function`);
104
+ }
105
+ if (getOriginalFunction(original)) {
106
+ throw new Error(`Attempting to wrap method ${field} multiple times`);
107
+ }
108
+ markFunctionWrapped(wrapped, original);
109
+ Object.defineProperty(obj, field, {
110
+ writable: true,
111
+ configurable: true,
112
+ enumerable,
113
+ value: wrapped,
114
+ });
115
+ }
116
+
85
117
  /**
86
118
  * This extracts the original function if available. See
87
119
  * `markFunctionWrapped` for more information.
@@ -277,4 +309,5 @@ exports.fill = fill;
277
309
  exports.getOriginalFunction = getOriginalFunction;
278
310
  exports.markFunctionWrapped = markFunctionWrapped;
279
311
  exports.objectify = objectify;
312
+ exports.wrapMethod = wrapMethod;
280
313
  //# sourceMappingURL=object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","sources":["../../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WrappedFunction } from '../types-hoist/wrappedfunction';\nimport { htmlTreeAsString } from './browser';\nimport { debug } from './debug-logger';\nimport { isElement, isError, isEvent, isInstanceOf, isPrimitive } from './is';\n\n/**\n * Replace a method in an object with a wrapped version of itself.\n *\n * If the method on the passed object is not a function, the wrapper will not be applied.\n *\n * @param source An object that contains a method to be wrapped.\n * @param name The name of the method to be wrapped.\n * @param replacementFactory A higher-order function that takes the original version of the given method and returns a\n * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to\n * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other\n * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.\n * @returns void\n */\nexport function fill(source: { [key: string]: any }, name: string, replacementFactory: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n // explicitly casting to unknown because we don't know the type of the method initially at all\n const original = source[name] as unknown;\n\n if (typeof original !== 'function') {\n return;\n }\n\n const wrapped = replacementFactory(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n markFunctionWrapped(wrapped, original);\n }\n\n try {\n source[name] = wrapped;\n } catch {\n DEBUG_BUILD && debug.log(`Failed to replace method \"${name}\" in object`, source);\n }\n}\n\n/**\n * Defines a non-enumerable property on the given object.\n *\n * @param obj The object on which to set the property\n * @param name The name of the property to be set\n * @param value The value to which to set the property\n */\nexport function addNonEnumerableProperty(obj: object, name: string, value: unknown): void {\n try {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value,\n writable: true,\n configurable: true,\n });\n } catch {\n DEBUG_BUILD && debug.log(`Failed to add non-enumerable property \"${name}\" to object`, obj);\n }\n}\n\n/**\n * Remembers the original function on the wrapped function and\n * patches up the prototype.\n *\n * @param wrapped the wrapper function\n * @param original the original function that gets wrapped\n */\nexport function markFunctionWrapped(wrapped: WrappedFunction, original: WrappedFunction): void {\n try {\n const proto = original.prototype || {};\n wrapped.prototype = original.prototype = proto;\n addNonEnumerableProperty(wrapped, '__sentry_original__', original);\n } catch {} // eslint-disable-line no-empty\n}\n\n/**\n * This extracts the original function if available. See\n * `markFunctionWrapped` for more information.\n *\n * @param func the function to unwrap\n * @returns the unwrapped version of the function if available.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getOriginalFunction<T extends Function>(func: WrappedFunction<T>): T | undefined {\n return func.__sentry_original__;\n}\n\n/**\n * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their\n * non-enumerable properties attached.\n *\n * @param value Initial source that we have to transform in order for it to be usable by the serializer\n * @returns An Event or Error turned into an object - or the value argument itself, when value is neither an Event nor\n * an Error.\n */\nexport function convertToPlainObject<V>(value: V):\n | {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n }\n | {\n [ownProps: string]: unknown;\n message: string;\n name: string;\n stack?: string;\n }\n | V {\n if (isError(value)) {\n return {\n message: value.message,\n name: value.name,\n stack: value.stack,\n ...getOwnProperties(value),\n };\n } else if (isEvent(value)) {\n const newObj: {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n } = {\n type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value),\n };\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\n }\n\n return newObj;\n } else {\n return value;\n }\n}\n\n/** Creates a string representation of the target of an `Event` object */\nfunction serializeEventTarget(target: unknown): string {\n try {\n return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);\n } catch {\n return '<unknown>';\n }\n}\n\n/** Filters out all but an object's own properties */\nfunction getOwnProperties(obj: unknown): { [key: string]: unknown } {\n if (typeof obj === 'object' && obj !== null) {\n return Object.fromEntries(Object.entries(obj));\n }\n return {};\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nexport function extractExceptionKeysForMessage(exception: Record<string, unknown>): string {\n const keys = Object.keys(convertToPlainObject(exception));\n keys.sort();\n\n return !keys[0] ? '[object has no keys]' : keys.join(', ');\n}\n\n/**\n * Given any object, return a new object having removed all fields whose value was `undefined`.\n * Works recursively on objects and arrays.\n *\n * Attention: This function keeps circular references in the returned object.\n *\n * @deprecated This function is no longer used by the SDK and will be removed in a future major version.\n */\nexport function dropUndefinedKeys<T>(inputValue: T): T {\n // This map keeps track of what already visited nodes map to.\n // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular\n // references as the input object.\n const memoizationMap = new Map<unknown, unknown>();\n\n // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API\n return _dropUndefinedKeys(inputValue, memoizationMap);\n}\n\nfunction _dropUndefinedKeys<T>(inputValue: T, memoizationMap: Map<unknown, unknown>): T {\n // Early return for primitive values\n if (inputValue === null || typeof inputValue !== 'object') {\n return inputValue;\n }\n\n // Check memo map first for all object types\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n // handle arrays\n if (Array.isArray(inputValue)) {\n const returnValue: unknown[] = [];\n // Store mapping to handle circular references\n memoizationMap.set(inputValue, returnValue);\n\n inputValue.forEach(value => {\n returnValue.push(_dropUndefinedKeys(value, memoizationMap));\n });\n\n return returnValue as unknown as T;\n }\n\n if (isPojo(inputValue)) {\n const returnValue: { [key: string]: unknown } = {};\n // Store mapping to handle circular references\n memoizationMap.set(inputValue, returnValue);\n\n const keys = Object.keys(inputValue);\n\n keys.forEach(key => {\n const val = inputValue[key];\n if (val !== undefined) {\n returnValue[key] = _dropUndefinedKeys(val, memoizationMap);\n }\n });\n\n return returnValue as T;\n }\n\n // For other object types, return as is\n return inputValue;\n}\n\nfunction isPojo(input: unknown): input is Record<string, unknown> {\n // Plain objects have Object as constructor or no constructor\n const constructor = (input as object).constructor;\n return constructor === Object || constructor === undefined;\n}\n\n/**\n * Ensure that something is an object.\n *\n * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper\n * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.\n *\n * @param wat The subject of the objectification\n * @returns A version of `wat` which can safely be used with `Object` class methods\n */\nexport function objectify(wat: unknown): typeof Object {\n let objectified;\n switch (true) {\n // this will catch both undefined and null\n case wat == undefined:\n objectified = new String(wat);\n break;\n\n // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason\n // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as\n // an object in order to wrap it.\n case typeof wat === 'symbol' || typeof wat === 'bigint':\n objectified = Object(wat);\n break;\n\n // this will catch the remaining primitives: `String`, `Number`, and `Boolean`\n case isPrimitive(wat):\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n objectified = new (wat as any).constructor(wat);\n break;\n\n // by process of elimination, at this point we know that `wat` must already be an object\n default:\n objectified = wat;\n break;\n }\n return objectified;\n}\n"],"names":["DEBUG_BUILD","debug","isError","isEvent","isInstanceOf","isElement","htmlTreeAsString","isPrimitive"],"mappings":";;;;;;;AAAA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,IAAI,CAAC,MAAM,EAA0B,IAAI,EAAU,kBAAkB,EAAiC;AACtH,EAAE,IAAI,EAAE,QAAQ,MAAM,CAAC,EAAE;AACzB,IAAI;AACJ,EAAE;;AAEF;AACA,EAAE,MAAM,QAAA,GAAW,MAAM,CAAC,IAAI,CAAA;;AAE9B,EAAE,IAAI,OAAO,QAAA,KAAa,UAAU,EAAE;AACtC,IAAI;AACJ,EAAE;;AAEF,EAAE,MAAM,OAAA,GAAU,kBAAkB,CAAC,QAAQ,CAAA;;AAE7C;AACA;AACA,EAAE,IAAI,OA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AAG,CAAC;AACzB;AACA,MAAM,WAAA,GAAc,IAAI,CAAC,GAAA,GAAY,WAAW,CAAC,GAAG,CAAC;AACrD,MAAM;;AAEN;AACA,IAAI;AACJ,MAAM,WAAA,GAAc,GAAG;AACvB,MAAM;AACN;AACA,EAAE,OAAO,WAAW;AACpB;;;;;;;;;;;"}
1
+ {"version":3,"file":"object.js","sources":["../../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WrappedFunction } from '../types-hoist/wrappedfunction';\nimport { htmlTreeAsString } from './browser';\nimport { debug } from './debug-logger';\nimport { isElement, isError, isEvent, isInstanceOf, isPrimitive } from './is';\n\n/**\n * Replace a method in an object with a wrapped version of itself.\n *\n * If the method on the passed object is not a function, the wrapper will not be applied.\n *\n * @param source An object that contains a method to be wrapped.\n * @param name The name of the method to be wrapped.\n * @param replacementFactory A higher-order function that takes the original version of the given method and returns a\n * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to\n * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, <other\n * args>)` or `origMethod.apply(this, [<other args>])` (rather than being called directly), again to preserve `this`.\n * @returns void\n */\n\nexport function fill(source: { [key: string]: any }, name: string, replacementFactory: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n // explicitly casting to unknown because we don't know the type of the method initially at all\n const original = source[name] as unknown;\n\n if (typeof original !== 'function') {\n return;\n }\n\n const wrapped = replacementFactory(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n markFunctionWrapped(wrapped, original);\n }\n\n try {\n source[name] = wrapped;\n } catch {\n DEBUG_BUILD && debug.log(`Failed to replace method \"${name}\" in object`, source);\n }\n}\n\n/**\n * Defines a non-enumerable property on the given object.\n *\n * @param obj The object on which to set the property\n * @param name The name of the property to be set\n * @param value The value to which to set the property\n */\nexport function addNonEnumerableProperty(obj: object, name: string, value: unknown): void {\n try {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value,\n writable: true,\n configurable: true,\n });\n } catch {\n DEBUG_BUILD && debug.log(`Failed to add non-enumerable property \"${name}\" to object`, obj);\n }\n}\n\n/**\n * Remembers the original function on the wrapped function and\n * patches up the prototype.\n *\n * @param wrapped the wrapper function\n * @param original the original function that gets wrapped\n */\nexport function markFunctionWrapped(wrapped: WrappedFunction, original: WrappedFunction): void {\n try {\n const proto = original.prototype || {};\n wrapped.prototype = original.prototype = proto;\n addNonEnumerableProperty(wrapped, '__sentry_original__', original);\n } catch {} // eslint-disable-line no-empty\n}\n\n/**\n * Wrap a method on an object by name, only if it is not already wrapped.\n *\n * Note: to set the wrapped method as a non-enumerable property, pass\n * false as the `enumerable` argument. This could be detected, but only\n * by either walking up the prototype chain, or iterating over all fields\n * in a `for(in)` loop. Neither are an acceptable performance impact for\n * the rare case where we might patch a non-enumerable method.\n */\nexport function wrapMethod<O extends {}, T extends string & keyof O>(\n obj: O,\n field: T,\n wrapped: WrappedFunction,\n enumerable: boolean = true,\n): void {\n const original = obj[field];\n if (typeof original !== 'function') {\n throw new Error(`Cannot wrap method: ${field} is not a function`);\n }\n if (getOriginalFunction(original)) {\n throw new Error(`Attempting to wrap method ${field} multiple times`);\n }\n markFunctionWrapped(wrapped, original);\n Object.defineProperty(obj, field, {\n writable: true,\n configurable: true,\n enumerable,\n value: wrapped,\n });\n}\n\n/**\n * This extracts the original function if available. See\n * `markFunctionWrapped` for more information.\n *\n * @param func the function to unwrap\n * @returns the unwrapped version of the function if available.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function getOriginalFunction<T extends Function>(func: WrappedFunction<T>): T | undefined {\n return func.__sentry_original__;\n}\n\n/**\n * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their\n * non-enumerable properties attached.\n *\n * @param value Initial source that we have to transform in order for it to be usable by the serializer\n * @returns An Event or Error turned into an object - or the value argument itself, when value is neither an Event nor\n * an Error.\n */\nexport function convertToPlainObject<V>(value: V):\n | {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n }\n | {\n [ownProps: string]: unknown;\n message: string;\n name: string;\n stack?: string;\n }\n | V {\n if (isError(value)) {\n return {\n message: value.message,\n name: value.name,\n stack: value.stack,\n ...getOwnProperties(value),\n };\n } else if (isEvent(value)) {\n const newObj: {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n } = {\n type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value),\n };\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\n }\n\n return newObj;\n } else {\n return value;\n }\n}\n\n/** Creates a string representation of the target of an `Event` object */\nfunction serializeEventTarget(target: unknown): string {\n try {\n return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);\n } catch {\n return '<unknown>';\n }\n}\n\n/** Filters out all but an object's own properties */\nfunction getOwnProperties(obj: unknown): { [key: string]: unknown } {\n if (typeof obj === 'object' && obj !== null) {\n return Object.fromEntries(Object.entries(obj));\n }\n return {};\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nexport function extractExceptionKeysForMessage(exception: Record<string, unknown>): string {\n const keys = Object.keys(convertToPlainObject(exception));\n keys.sort();\n\n return !keys[0] ? '[object has no keys]' : keys.join(', ');\n}\n\n/**\n * Given any object, return a new object having removed all fields whose value was `undefined`.\n * Works recursively on objects and arrays.\n *\n * Attention: This function keeps circular references in the returned object.\n *\n * @deprecated This function is no longer used by the SDK and will be removed in a future major version.\n */\nexport function dropUndefinedKeys<T>(inputValue: T): T {\n // This map keeps track of what already visited nodes map to.\n // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular\n // references as the input object.\n const memoizationMap = new Map<unknown, unknown>();\n\n // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API\n return _dropUndefinedKeys(inputValue, memoizationMap);\n}\n\nfunction _dropUndefinedKeys<T>(inputValue: T, memoizationMap: Map<unknown, unknown>): T {\n // Early return for primitive values\n if (inputValue === null || typeof inputValue !== 'object') {\n return inputValue;\n }\n\n // Check memo map first for all object types\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n // handle arrays\n if (Array.isArray(inputValue)) {\n const returnValue: unknown[] = [];\n // Store mapping to handle circular references\n memoizationMap.set(inputValue, returnValue);\n\n inputValue.forEach(value => {\n returnValue.push(_dropUndefinedKeys(value, memoizationMap));\n });\n\n return returnValue as unknown as T;\n }\n\n if (isPojo(inputValue)) {\n const returnValue: { [key: string]: unknown } = {};\n // Store mapping to handle circular references\n memoizationMap.set(inputValue, returnValue);\n\n const keys = Object.keys(inputValue);\n\n keys.forEach(key => {\n const val = inputValue[key];\n if (val !== undefined) {\n returnValue[key] = _dropUndefinedKeys(val, memoizationMap);\n }\n });\n\n return returnValue as T;\n }\n\n // For other object types, return as is\n return inputValue;\n}\n\nfunction isPojo(input: unknown): input is Record<string, unknown> {\n // Plain objects have Object as constructor or no constructor\n const constructor = (input as object).constructor;\n return constructor === Object || constructor === undefined;\n}\n\n/**\n * Ensure that something is an object.\n *\n * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper\n * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.\n *\n * @param wat The subject of the objectification\n * @returns A version of `wat` which can safely be used with `Object` class methods\n */\nexport function objectify(wat: unknown): typeof Object {\n let objectified;\n switch (true) {\n // this will catch both undefined and null\n case wat == undefined:\n objectified = new String(wat);\n break;\n\n // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason\n // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as\n // an object in order to wrap it.\n case typeof wat === 'symbol' || typeof wat === 'bigint':\n objectified = Object(wat);\n break;\n\n // this will catch the remaining primitives: `String`, `Number`, and `Boolean`\n case isPrimitive(wat):\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n objectified = new (wat as any).constructor(wat);\n break;\n\n // by process of elimination, at this point we know that `wat` must already be an object\n default:\n objectified = wat;\n break;\n }\n return objectified;\n}\n"],"names":["DEBUG_BUILD","debug","isError","isEvent","isInstanceOf","isElement","htmlTreeAsString","isPrimitive"],"mappings":";;;;;;;AAAA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,IAAI,CAAC,MAAM,EAA0B,IAAI,EAAU,kBAAkB,EAAiC;AACtH,EAAE,IAAI,EAAE,QAAQ,MAAM,CAAC,EAAE;AACzB,IAAI;AACJ,EAAE;;AAEF;AACA,EAAE,MAAM,QAAA,GAAW,MAAM,CAAC,IAAI,CAAA;;AAE9B,EAAE,IAAI,OAAO,QAAA,KAAa,UAAU,EAAE;AACtC,IAAI;AACJ,EAAE;;AAEF,EAAE,MAAM,OAAA,GAAU,kBAAkB,CAAC,QAAQ,CAAA;;AAE7C;AACA;AACA,EAAE,IAAI,OAAO,OAAA,KAAY,UAAU,EAAE;AACrC,IAAI,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC1C,EAAE;;AAEF,EAAE,IAAI;AACN,IAAI,MAAM,CAAC,IAAI,CAAA,GAAI,OAAO;AAC1B,EAAE,EAAE,MAAM;AACV,IAAIA,sBAAA,IAAeC,iBAAK,CAAC,GAAG,CAAC,CAAC,0BAA0B,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;AACpF,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,wBAAwB,CAAC,GAAG,EAAU,IAAI,EAAU,KAAK,EAAiB;AAC1F,EAA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EAAE,IAAI,WAAW;AACjB,EAAE,QAAQ,IAAI;AACd;AACA,IAAI,KAAK,GAAA,IAAO,SAAS;AACzB,MAAM,cAAc,IAAI,MAAM,CAAC,GAAG,CAAC;AACnC,MAAM;;AAEN;AACA;AACA;AACA,IAAI,KAAK,OAAO,GAAA,KAAQ,YAAY,OAAO,GAAA,KAAQ,QAAQ;AAC3D,MAAM,WAAA,GAAc,MAAM,CAAC,GAAG,CAAC;AAC/B,MAAM;;AAEN;AACA,IAAI,KAAKC,cAAW,CAAC,GAAG,CAAC;AACzB;AACA,MAAM,WAAA,GAAc,IAAI,CAAC,GAAA,GAAY,WAAW,CAAC,GAAG,CAAC;AACrD,MAAM;;AAEN;AACA,IAAI;AACJ,MAAM,WAAA,GAAc,GAAG;AACvB,MAAM;AACN;AACA,EAAE,OAAO,WAAW;AACpB;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const index = require('../asyncContext/index.js');
4
+ const attributes = require('../attributes.js');
4
5
  const carrier = require('../carrier.js');
5
6
  const currentScopes = require('../currentScopes.js');
6
7
  const semanticAttributes = require('../semanticAttributes.js');
@@ -97,6 +98,26 @@ function convertSpanLinksForEnvelope(links) {
97
98
  }
98
99
  }
99
100
 
101
+ /**
102
+ * Converts the span links array to a flattened version with serialized attributes for V2 spans.
103
+ *
104
+ * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.
105
+ */
106
+ function getStreamedSpanLinks(
107
+ links,
108
+ ) {
109
+ if (links?.length) {
110
+ return links.map(({ context: { spanId, traceId, traceFlags }, attributes }) => ({
111
+ span_id: spanId,
112
+ trace_id: traceId,
113
+ sampled: traceFlags === TRACE_FLAG_SAMPLED,
114
+ attributes,
115
+ }));
116
+ } else {
117
+ return undefined;
118
+ }
119
+ }
120
+
100
121
  /**
101
122
  * Convert a span time input into a timestamp in seconds.
102
123
  */
@@ -142,23 +163,12 @@ function spanToJSON(span) {
142
163
  if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {
143
164
  const { attributes, startTime, name, endTime, status, links } = span;
144
165
 
145
- // In preparation for the next major of OpenTelemetry, we want to support
146
- // looking up the parent span id according to the new API
147
- // In OTel v1, the parent span id is accessed as `parentSpanId`
148
- // In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
149
- const parentSpanId =
150
- 'parentSpanId' in span
151
- ? span.parentSpanId
152
- : 'parentSpanContext' in span
153
- ? (span.parentSpanContext )?.spanId
154
- : undefined;
155
-
156
166
  return {
157
167
  span_id,
158
168
  trace_id,
159
169
  data: attributes,
160
170
  description: name,
161
- parent_span_id: parentSpanId,
171
+ parent_span_id: getOtelParentSpanId(span),
162
172
  start_timestamp: spanTimeInputToSeconds(startTime),
163
173
  // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
164
174
  timestamp: spanTimeInputToSeconds(endTime) || undefined,
@@ -179,6 +189,77 @@ function spanToJSON(span) {
179
189
  };
180
190
  }
181
191
 
192
+ /**
193
+ * Convert a span to the intermediate {@link StreamedSpanJSON} representation.
194
+ */
195
+ function spanToStreamedSpanJSON(span) {
196
+ if (spanIsSentrySpan(span)) {
197
+ return span.getStreamedSpanJSON();
198
+ }
199
+
200
+ const { spanId: span_id, traceId: trace_id } = span.spanContext();
201
+
202
+ // Handle a span from @opentelemetry/sdk-base-trace's `Span` class
203
+ if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {
204
+ const { attributes, startTime, name, endTime, status, links } = span;
205
+
206
+ return {
207
+ name,
208
+ span_id,
209
+ trace_id,
210
+ parent_span_id: getOtelParentSpanId(span),
211
+ start_timestamp: spanTimeInputToSeconds(startTime),
212
+ end_timestamp: spanTimeInputToSeconds(endTime),
213
+ is_segment: span === INTERNAL_getSegmentSpan(span),
214
+ status: getSimpleStatusMessage(status),
215
+ attributes,
216
+ links: getStreamedSpanLinks(links),
217
+ };
218
+ }
219
+
220
+ // Finally, as a fallback, at least we have `spanContext()`....
221
+ // This should not actually happen in reality, but we need to handle it for type safety.
222
+ return {
223
+ span_id,
224
+ trace_id,
225
+ start_timestamp: 0,
226
+ name: '',
227
+ end_timestamp: 0,
228
+ status: 'ok',
229
+ is_segment: span === INTERNAL_getSegmentSpan(span),
230
+ };
231
+ }
232
+
233
+ /**
234
+ * In preparation for the next major of OpenTelemetry, we want to support
235
+ * looking up the parent span id according to the new API
236
+ * In OTel v1, the parent span id is accessed as `parentSpanId`
237
+ * In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`
238
+ */
239
+ function getOtelParentSpanId(span) {
240
+ return 'parentSpanId' in span
241
+ ? span.parentSpanId
242
+ : 'parentSpanContext' in span
243
+ ? (span.parentSpanContext )?.spanId
244
+ : undefined;
245
+ }
246
+
247
+ /**
248
+ * Converts a {@link StreamedSpanJSON} to a {@link SerializedSpan}.
249
+ * This is the final serialized span format that is sent to Sentry.
250
+ * The returned serilaized spans must not be consumed by users or SDK integrations.
251
+ */
252
+ function streamedSpanJsonToSerializedSpan(spanJson) {
253
+ return {
254
+ ...spanJson,
255
+ attributes: attributes.serializeAttributes(spanJson.attributes),
256
+ links: spanJson.links?.map(link => ({
257
+ ...link,
258
+ attributes: attributes.serializeAttributes(link.attributes),
259
+ })),
260
+ };
261
+ }
262
+
182
263
  function spanIsOpenTelemetrySdkTraceBaseSpan(span) {
183
264
  const castSpan = span ;
184
265
  return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status;
@@ -220,6 +301,18 @@ function getStatusMessage(status) {
220
301
  return status.message || 'internal_error';
221
302
  }
222
303
 
304
+ /**
305
+ * Convert the various statuses to the simple onces expected by Sentry for steamed spans ('ok' is default).
306
+ */
307
+ function getSimpleStatusMessage(status) {
308
+ return !status ||
309
+ status.code === spanstatus.SPAN_STATUS_OK ||
310
+ status.code === spanstatus.SPAN_STATUS_UNSET ||
311
+ status.message === 'cancelled'
312
+ ? 'ok'
313
+ : 'error';
314
+ }
315
+
223
316
  const CHILD_SPANS_FIELD = '_sentryChildSpans';
224
317
  const ROOT_SPAN_FIELD = '_sentryRootSpan';
225
318
 
@@ -276,7 +369,12 @@ function getSpanDescendants(span) {
276
369
  /**
277
370
  * Returns the root span of a given span.
278
371
  */
279
- function getRootSpan(span) {
372
+ const getRootSpan = INTERNAL_getSegmentSpan;
373
+
374
+ /**
375
+ * Returns the segment span of a given span.
376
+ */
377
+ function INTERNAL_getSegmentSpan(span) {
280
378
  return span[ROOT_SPAN_FIELD] || span;
281
379
  }
282
380
 
@@ -332,22 +430,27 @@ function updateSpanName(span, name) {
332
430
  });
333
431
  }
334
432
 
433
+ exports.INTERNAL_getSegmentSpan = INTERNAL_getSegmentSpan;
335
434
  exports.TRACE_FLAG_NONE = TRACE_FLAG_NONE;
336
435
  exports.TRACE_FLAG_SAMPLED = TRACE_FLAG_SAMPLED;
337
436
  exports.addChildSpanToSpan = addChildSpanToSpan;
338
437
  exports.convertSpanLinksForEnvelope = convertSpanLinksForEnvelope;
339
438
  exports.getActiveSpan = getActiveSpan;
340
439
  exports.getRootSpan = getRootSpan;
440
+ exports.getSimpleStatusMessage = getSimpleStatusMessage;
341
441
  exports.getSpanDescendants = getSpanDescendants;
342
442
  exports.getStatusMessage = getStatusMessage;
443
+ exports.getStreamedSpanLinks = getStreamedSpanLinks;
343
444
  exports.removeChildSpanFromSpan = removeChildSpanFromSpan;
344
445
  exports.showSpanDropWarning = showSpanDropWarning;
345
446
  exports.spanIsSampled = spanIsSampled;
346
447
  exports.spanTimeInputToSeconds = spanTimeInputToSeconds;
347
448
  exports.spanToJSON = spanToJSON;
449
+ exports.spanToStreamedSpanJSON = spanToStreamedSpanJSON;
348
450
  exports.spanToTraceContext = spanToTraceContext;
349
451
  exports.spanToTraceHeader = spanToTraceHeader;
350
452
  exports.spanToTraceparentHeader = spanToTraceparentHeader;
351
453
  exports.spanToTransactionTraceContext = spanToTransactionTraceContext;
454
+ exports.streamedSpanJsonToSerializedSpan = streamedSpanJsonToSerializedSpan;
352
455
  exports.updateSpanName = updateSpanName;
353
456
  //# sourceMappingURL=spanUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spanUtils.js","sources":["../../../src/utils/spanUtils.ts"],"sourcesContent":["import { getAsyncContextStrategy } from '../asyncContext';\nimport { getMainCarrier } from '../carrier';\nimport { getCurrentScope } from '../currentScopes';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../semanticAttributes';\nimport type { SentrySpan } from '../tracing/sentrySpan';\nimport { SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '../tracing/spanstatus';\nimport { getCapturedScopesOnSpan } from '../tracing/utils';\nimport type { TraceContext } from '../types-hoist/context';\nimport type { SpanLink, SpanLinkJSON } from '../types-hoist/link';\nimport type { Span, SpanAttributes, SpanJSON, SpanOrigin, SpanTimeInput } from '../types-hoist/span';\nimport type { SpanStatus } from '../types-hoist/spanStatus';\nimport { addNonEnumerableProperty } from '../utils/object';\nimport { generateSpanId } from '../utils/propagationContext';\nimport { timestampInSeconds } from '../utils/time';\nimport { generateSentryTraceHeader, generateTraceparentHeader } from '../utils/tracing';\nimport { consoleSandbox } from './debug-logger';\nimport { _getSpanForScope } from './spanOnScope';\n\n// These are aligned with OpenTelemetry trace flags\nexport const TRACE_FLAG_NONE = 0x0;\nexport const TRACE_FLAG_SAMPLED = 0x1;\n\nlet hasShownSpanDropWarning = false;\n\n/**\n * Convert a span to a trace context, which can be sent as the `trace` context in an event.\n * By default, this will only include trace_id, span_id & parent_span_id.\n * If `includeAllData` is true, it will also include data, op, status & origin.\n */\nexport function spanToTransactionTraceContext(span: Span): TraceContext {\n const { spanId: span_id, traceId: trace_id } = span.spanContext();\n const { data, op, parent_span_id, status, origin, links } = spanToJSON(span);\n\n return {\n parent_span_id,\n span_id,\n trace_id,\n data,\n op,\n status,\n origin,\n links,\n };\n}\n\n/**\n * Convert a span to a trace context, which can be sent as the `trace` context in a non-transaction event.\n */\nexport function spanToTraceContext(span: Span): TraceContext {\n const { spanId, traceId: trace_id, isRemote } = span.spanContext();\n\n // If the span is remote, we use a random/virtual span as span_id to the trace context,\n // and the remote span as parent_span_id\n const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id;\n const scope = getCapturedScopesOnSpan(span).scope;\n\n const span_id = isRemote ? scope?.getPropagationContext().propagationSpanId || generateSpanId() : spanId;\n\n return {\n parent_span_id,\n span_id,\n trace_id,\n };\n}\n\n/**\n * Convert a Span to a Sentry trace header.\n */\nexport function spanToTraceHeader(span: Span): string {\n const { traceId, spanId } = span.spanContext();\n const sampled = spanIsSampled(span);\n return generateSentryTraceHeader(traceId, spanId, sampled);\n}\n\n/**\n * Convert a Span to a W3C traceparent header.\n */\nexport function spanToTraceparentHeader(span: Span): string {\n const { traceId, spanId } = span.spanContext();\n const sampled = spanIsSampled(span);\n return generateTraceparentHeader(traceId, spanId, sampled);\n}\n\n/**\n * Converts the span links array to a flattened version to be sent within an envelope.\n *\n * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.\n */\nexport function convertSpanLinksForEnvelope(links?: SpanLink[]): SpanLinkJSON[] | undefined {\n if (links && links.length > 0) {\n return links.map(({ context: { spanId, traceId, traceFlags, ...restContext }, attributes }) => ({\n span_id: spanId,\n trace_id: traceId,\n sampled: traceFlags === TRACE_FLAG_SAMPLED,\n attributes,\n ...restContext,\n }));\n } else {\n return undefined;\n }\n}\n\n/**\n * Convert a span time input into a timestamp in seconds.\n */\nexport function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number {\n if (typeof input === 'number') {\n return ensureTimestampInSeconds(input);\n }\n\n if (Array.isArray(input)) {\n // See {@link HrTime} for the array-based time format\n return input[0] + input[1] / 1e9;\n }\n\n if (input instanceof Date) {\n return ensureTimestampInSeconds(input.getTime());\n }\n\n return timestampInSeconds();\n}\n\n/**\n * Converts a timestamp to second, if it was in milliseconds, or keeps it as second.\n */\nfunction ensureTimestampInSeconds(timestamp: number): number {\n const isMs = timestamp > 9999999999;\n return isMs ? timestamp / 1000 : timestamp;\n}\n\n/**\n * Convert a span to a JSON representation.\n */\n// Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).\n// This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.\n// And `spanToJSON` needs the Span class from `span.ts` to check here.\nexport function spanToJSON(span: Span): SpanJSON {\n if (spanIsSentrySpan(span)) {\n return span.getSpanJSON();\n }\n\n const { spanId: span_id, traceId: trace_id } = span.spanContext();\n\n // Handle a span from @opentelemetry/sdk-base-trace's `Span` class\n if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {\n const { attributes, startTime, name, endTime, status, links } = span;\n\n // In preparation for the next major of OpenTelemetry, we want to support\n // looking up the parent span id according to the new API\n // In OTel v1, the parent span id is accessed as `parentSpanId`\n // In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`\n const parentSpanId =\n 'parentSpanId' in span\n ? span.parentSpanId\n : 'parentSpanContext' in span\n ? (span.parentSpanContext as { spanId?: string } | undefined)?.spanId\n : undefined;\n\n return {\n span_id,\n trace_id,\n data: attributes,\n description: name,\n parent_span_id: parentSpanId,\n start_timestamp: spanTimeInputToSeconds(startTime),\n // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time\n timestamp: spanTimeInputToSeconds(endTime) || undefined,\n status: getStatusMessage(status),\n op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP],\n origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,\n links: convertSpanLinksForEnvelope(links),\n };\n }\n\n // Finally, at least we have `spanContext()`....\n // This should not actually happen in reality, but we need to handle it for type safety.\n return {\n span_id,\n trace_id,\n start_timestamp: 0,\n data: {},\n };\n}\n\nfunction spanIsOpenTelemetrySdkTraceBaseSpan(span: Span): span is OpenTelemetrySdkTraceBaseSpan {\n const castSpan = span as Partial<OpenTelemetrySdkTraceBaseSpan>;\n return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status;\n}\n\n/** Exported only for tests. */\nexport interface OpenTelemetrySdkTraceBaseSpan extends Span {\n attributes: SpanAttributes;\n startTime: SpanTimeInput;\n name: string;\n status: SpanStatus;\n endTime: SpanTimeInput;\n parentSpanId?: string;\n links?: SpanLink[];\n}\n\n/**\n * Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.\n * :( So instead we approximate this by checking if it has the `getSpanJSON` method.\n */\nfunction spanIsSentrySpan(span: Span): span is SentrySpan {\n return typeof (span as SentrySpan).getSpanJSON === 'function';\n}\n\n/**\n * Returns true if a span is sampled.\n * In most cases, you should just use `span.isRecording()` instead.\n * However, this has a slightly different semantic, as it also returns false if the span is finished.\n * So in the case where this distinction is important, use this method.\n */\nexport function spanIsSampled(span: Span): boolean {\n // We align our trace flags with the ones OpenTelemetry use\n // So we also check for sampled the same way they do.\n const { traceFlags } = span.spanContext();\n return traceFlags === TRACE_FLAG_SAMPLED;\n}\n\n/** Get the status message to use for a JSON representation of a span. */\nexport function getStatusMessage(status: SpanStatus | undefined): string | undefined {\n if (!status || status.code === SPAN_STATUS_UNSET) {\n return undefined;\n }\n\n if (status.code === SPAN_STATUS_OK) {\n return 'ok';\n }\n\n return status.message || 'internal_error';\n}\n\nconst CHILD_SPANS_FIELD = '_sentryChildSpans';\nconst ROOT_SPAN_FIELD = '_sentryRootSpan';\n\ntype SpanWithPotentialChildren = Span & {\n [CHILD_SPANS_FIELD]?: Set<Span>;\n [ROOT_SPAN_FIELD]?: Span;\n};\n\n/**\n * Adds an opaque child span reference to a span.\n */\nexport function addChildSpanToSpan(span: SpanWithPotentialChildren, childSpan: Span): void {\n // We store the root span reference on the child span\n // We need this for `getRootSpan()` to work\n const rootSpan = span[ROOT_SPAN_FIELD] || span;\n addNonEnumerableProperty(childSpan as SpanWithPotentialChildren, ROOT_SPAN_FIELD, rootSpan);\n\n // We store a list of child spans on the parent span\n // We need this for `getSpanDescendants()` to work\n if (span[CHILD_SPANS_FIELD]) {\n span[CHILD_SPANS_FIELD].add(childSpan);\n } else {\n addNonEnumerableProperty(span, CHILD_SPANS_FIELD, new Set([childSpan]));\n }\n}\n\n/** This is only used internally by Idle Spans. */\nexport function removeChildSpanFromSpan(span: SpanWithPotentialChildren, childSpan: Span): void {\n if (span[CHILD_SPANS_FIELD]) {\n span[CHILD_SPANS_FIELD].delete(childSpan);\n }\n}\n\n/**\n * Returns an array of the given span and all of its descendants.\n */\nexport function getSpanDescendants(span: SpanWithPotentialChildren): Span[] {\n const resultSet = new Set<Span>();\n\n function addSpanChildren(span: SpanWithPotentialChildren): void {\n // This exit condition is required to not infinitely loop in case of a circular dependency.\n if (resultSet.has(span)) {\n return;\n // We want to ignore unsampled spans (e.g. non recording spans)\n } else if (spanIsSampled(span)) {\n resultSet.add(span);\n const childSpans = span[CHILD_SPANS_FIELD] ? Array.from(span[CHILD_SPANS_FIELD]) : [];\n for (const childSpan of childSpans) {\n addSpanChildren(childSpan);\n }\n }\n }\n\n addSpanChildren(span);\n\n return Array.from(resultSet);\n}\n\n/**\n * Returns the root span of a given span.\n */\nexport function getRootSpan(span: SpanWithPotentialChildren): Span {\n return span[ROOT_SPAN_FIELD] || span;\n}\n\n/**\n * Returns the currently active span.\n */\nexport function getActiveSpan(): Span | undefined {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n if (acs.getActiveSpan) {\n return acs.getActiveSpan();\n }\n\n return _getSpanForScope(getCurrentScope());\n}\n\n/**\n * Logs a warning once if `beforeSendSpan` is used to drop spans.\n */\nexport function showSpanDropWarning(): void {\n if (!hasShownSpanDropWarning) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.',\n );\n });\n hasShownSpanDropWarning = true;\n }\n}\n\n/**\n * Updates the name of the given span and ensures that the span name is not\n * overwritten by the Sentry SDK.\n *\n * Use this function instead of `span.updateName()` if you want to make sure that\n * your name is kept. For some spans, for example root `http.server` spans the\n * Sentry SDK would otherwise overwrite the span name with a high-quality name\n * it infers when the span ends.\n *\n * Use this function in server code or when your span is started on the server\n * and on the client (browser). If you only update a span name on the client,\n * you can also use `span.updateName()` the SDK does not overwrite the name.\n *\n * @param span - The span to update the name of.\n * @param name - The name to set on the span.\n */\nexport function updateSpanName(span: Span, name: string): void {\n span.updateName(name);\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom',\n [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name,\n });\n}\n"],"names":["getCapturedScopesOnSpan","generateSpanId","generateSentryTraceHeader","generateTraceparentHeader","timestampInSeconds","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SPAN_STATUS_UNSET","SPAN_STATUS_OK","addNonEnumerableProperty","carrier","getMainCarrier","getAsyncContextStrategy","_getSpanForScope","getCurrentScope","consoleSandbox","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME"],"mappings":";;;;;;;;;;;;;;;AAuBA;AACO,MAAM,eAAA,GAAkB;AACxB,MAAM,kBAAA,GAAqB;;AAElC,IAAI,uBAAA,GAA0B,KAAK;;AAEnC;AACA;AACA;AACA;AACA;AACO,SAAS,6BAA6B,CAAC,IAAI,EAAsB;AACxE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAA,KAAa,IAAI,CAAC,WAAW,EAAE;AACnE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,KAAA,EAAM,GAAI,UAAU,CA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AAClD,EAAE,MAAMC,SAAA,GAAUC,sBAAc,EAAE;AAClC,EAAE,MAAM,GAAA,GAAMC,6BAAuB,CAACF,SAAO,CAAC;AAC9C,EAAE,IAAI,GAAG,CAAC,aAAa,EAAE;AACzB,IAAI,OAAO,GAAG,CAAC,aAAa,EAAE;AAC9B,EAAE;;AAEF,EAAE,OAAOG,4BAAgB,CAACC,6BAAe,EAAE,CAAC;AAC5C;;AAEA;AACA;AACA;AACO,SAAS,mBAAmB,GAAS;AAC5C,EAAE,IAAI,CAAC,uBAAuB,EAAE;AAChC,IAAIC,0BAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,IAAI;AAClB,QAAQ,0JAA0J;AAClK,OAAO;AACP,IAAI,CAAC,CAAC;AACN,IAAI,uBAAA,GAA0B,IAAI;AAClC,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,IAAI,EAAQ,IAAI,EAAgB;AAC/D,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AACvB,EAAE,IAAI,CAAC,aAAa,CAAC;AACrB,IAAI,CAACC,mDAAgC,GAAG,QAAQ;AAChD,IAAI,CAACC,6DAA0C,GAAG,IAAI;AACtD,GAAG,CAAC;AACJ;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"spanUtils.js","sources":["../../../src/utils/spanUtils.ts"],"sourcesContent":["import { getAsyncContextStrategy } from '../asyncContext';\nimport type { RawAttributes } from '../attributes';\nimport { serializeAttributes } from '../attributes';\nimport { getMainCarrier } from '../carrier';\nimport { getCurrentScope } from '../currentScopes';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,\n} from '../semanticAttributes';\nimport type { SentrySpan } from '../tracing/sentrySpan';\nimport { SPAN_STATUS_OK, SPAN_STATUS_UNSET } from '../tracing/spanstatus';\nimport { getCapturedScopesOnSpan } from '../tracing/utils';\nimport type { TraceContext } from '../types-hoist/context';\nimport type { SpanLink, SpanLinkJSON } from '../types-hoist/link';\nimport type {\n SerializedStreamedSpan,\n Span,\n SpanAttributes,\n SpanJSON,\n SpanOrigin,\n SpanTimeInput,\n StreamedSpanJSON,\n} from '../types-hoist/span';\nimport type { SpanStatus } from '../types-hoist/spanStatus';\nimport { addNonEnumerableProperty } from '../utils/object';\nimport { generateSpanId } from '../utils/propagationContext';\nimport { timestampInSeconds } from '../utils/time';\nimport { generateSentryTraceHeader, generateTraceparentHeader } from '../utils/tracing';\nimport { consoleSandbox } from './debug-logger';\nimport { _getSpanForScope } from './spanOnScope';\n\n// These are aligned with OpenTelemetry trace flags\nexport const TRACE_FLAG_NONE = 0x0;\nexport const TRACE_FLAG_SAMPLED = 0x1;\n\nlet hasShownSpanDropWarning = false;\n\n/**\n * Convert a span to a trace context, which can be sent as the `trace` context in an event.\n * By default, this will only include trace_id, span_id & parent_span_id.\n * If `includeAllData` is true, it will also include data, op, status & origin.\n */\nexport function spanToTransactionTraceContext(span: Span): TraceContext {\n const { spanId: span_id, traceId: trace_id } = span.spanContext();\n const { data, op, parent_span_id, status, origin, links } = spanToJSON(span);\n\n return {\n parent_span_id,\n span_id,\n trace_id,\n data,\n op,\n status,\n origin,\n links,\n };\n}\n\n/**\n * Convert a span to a trace context, which can be sent as the `trace` context in a non-transaction event.\n */\nexport function spanToTraceContext(span: Span): TraceContext {\n const { spanId, traceId: trace_id, isRemote } = span.spanContext();\n\n // If the span is remote, we use a random/virtual span as span_id to the trace context,\n // and the remote span as parent_span_id\n const parent_span_id = isRemote ? spanId : spanToJSON(span).parent_span_id;\n const scope = getCapturedScopesOnSpan(span).scope;\n\n const span_id = isRemote ? scope?.getPropagationContext().propagationSpanId || generateSpanId() : spanId;\n\n return {\n parent_span_id,\n span_id,\n trace_id,\n };\n}\n\n/**\n * Convert a Span to a Sentry trace header.\n */\nexport function spanToTraceHeader(span: Span): string {\n const { traceId, spanId } = span.spanContext();\n const sampled = spanIsSampled(span);\n return generateSentryTraceHeader(traceId, spanId, sampled);\n}\n\n/**\n * Convert a Span to a W3C traceparent header.\n */\nexport function spanToTraceparentHeader(span: Span): string {\n const { traceId, spanId } = span.spanContext();\n const sampled = spanIsSampled(span);\n return generateTraceparentHeader(traceId, spanId, sampled);\n}\n\n/**\n * Converts the span links array to a flattened version to be sent within an envelope.\n *\n * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.\n */\nexport function convertSpanLinksForEnvelope(links?: SpanLink[]): SpanLinkJSON[] | undefined {\n if (links && links.length > 0) {\n return links.map(({ context: { spanId, traceId, traceFlags, ...restContext }, attributes }) => ({\n span_id: spanId,\n trace_id: traceId,\n sampled: traceFlags === TRACE_FLAG_SAMPLED,\n attributes,\n ...restContext,\n }));\n } else {\n return undefined;\n }\n}\n\n/**\n * Converts the span links array to a flattened version with serialized attributes for V2 spans.\n *\n * If the links array is empty, it returns `undefined` so the empty value can be dropped before it's sent.\n */\nexport function getStreamedSpanLinks(\n links?: SpanLink[],\n): SpanLinkJSON<RawAttributes<Record<string, unknown>>>[] | undefined {\n if (links?.length) {\n return links.map(({ context: { spanId, traceId, traceFlags }, attributes }) => ({\n span_id: spanId,\n trace_id: traceId,\n sampled: traceFlags === TRACE_FLAG_SAMPLED,\n attributes,\n }));\n } else {\n return undefined;\n }\n}\n\n/**\n * Convert a span time input into a timestamp in seconds.\n */\nexport function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number {\n if (typeof input === 'number') {\n return ensureTimestampInSeconds(input);\n }\n\n if (Array.isArray(input)) {\n // See {@link HrTime} for the array-based time format\n return input[0] + input[1] / 1e9;\n }\n\n if (input instanceof Date) {\n return ensureTimestampInSeconds(input.getTime());\n }\n\n return timestampInSeconds();\n}\n\n/**\n * Converts a timestamp to second, if it was in milliseconds, or keeps it as second.\n */\nfunction ensureTimestampInSeconds(timestamp: number): number {\n const isMs = timestamp > 9999999999;\n return isMs ? timestamp / 1000 : timestamp;\n}\n\n/**\n * Convert a span to a JSON representation.\n */\n// Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).\n// This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.\n// And `spanToJSON` needs the Span class from `span.ts` to check here.\nexport function spanToJSON(span: Span): SpanJSON {\n if (spanIsSentrySpan(span)) {\n return span.getSpanJSON();\n }\n\n const { spanId: span_id, traceId: trace_id } = span.spanContext();\n\n // Handle a span from @opentelemetry/sdk-base-trace's `Span` class\n if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {\n const { attributes, startTime, name, endTime, status, links } = span;\n\n return {\n span_id,\n trace_id,\n data: attributes,\n description: name,\n parent_span_id: getOtelParentSpanId(span),\n start_timestamp: spanTimeInputToSeconds(startTime),\n // This is [0,0] by default in OTEL, in which case we want to interpret this as no end time\n timestamp: spanTimeInputToSeconds(endTime) || undefined,\n status: getStatusMessage(status),\n op: attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP],\n origin: attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] as SpanOrigin | undefined,\n links: convertSpanLinksForEnvelope(links),\n };\n }\n\n // Finally, at least we have `spanContext()`....\n // This should not actually happen in reality, but we need to handle it for type safety.\n return {\n span_id,\n trace_id,\n start_timestamp: 0,\n data: {},\n };\n}\n\n/**\n * Convert a span to the intermediate {@link StreamedSpanJSON} representation.\n */\nexport function spanToStreamedSpanJSON(span: Span): StreamedSpanJSON {\n if (spanIsSentrySpan(span)) {\n return span.getStreamedSpanJSON();\n }\n\n const { spanId: span_id, traceId: trace_id } = span.spanContext();\n\n // Handle a span from @opentelemetry/sdk-base-trace's `Span` class\n if (spanIsOpenTelemetrySdkTraceBaseSpan(span)) {\n const { attributes, startTime, name, endTime, status, links } = span;\n\n return {\n name,\n span_id,\n trace_id,\n parent_span_id: getOtelParentSpanId(span),\n start_timestamp: spanTimeInputToSeconds(startTime),\n end_timestamp: spanTimeInputToSeconds(endTime),\n is_segment: span === INTERNAL_getSegmentSpan(span),\n status: getSimpleStatusMessage(status),\n attributes,\n links: getStreamedSpanLinks(links),\n };\n }\n\n // Finally, as a fallback, at least we have `spanContext()`....\n // This should not actually happen in reality, but we need to handle it for type safety.\n return {\n span_id,\n trace_id,\n start_timestamp: 0,\n name: '',\n end_timestamp: 0,\n status: 'ok',\n is_segment: span === INTERNAL_getSegmentSpan(span),\n };\n}\n\n/**\n * In preparation for the next major of OpenTelemetry, we want to support\n * looking up the parent span id according to the new API\n * In OTel v1, the parent span id is accessed as `parentSpanId`\n * In OTel v2, the parent span id is accessed as `spanId` on the `parentSpanContext`\n */\nfunction getOtelParentSpanId(span: OpenTelemetrySdkTraceBaseSpan): string | undefined {\n return 'parentSpanId' in span\n ? span.parentSpanId\n : 'parentSpanContext' in span\n ? (span.parentSpanContext as { spanId?: string } | undefined)?.spanId\n : undefined;\n}\n\n/**\n * Converts a {@link StreamedSpanJSON} to a {@link SerializedSpan}.\n * This is the final serialized span format that is sent to Sentry.\n * The returned serilaized spans must not be consumed by users or SDK integrations.\n */\nexport function streamedSpanJsonToSerializedSpan(spanJson: StreamedSpanJSON): SerializedStreamedSpan {\n return {\n ...spanJson,\n attributes: serializeAttributes(spanJson.attributes),\n links: spanJson.links?.map(link => ({\n ...link,\n attributes: serializeAttributes(link.attributes),\n })),\n };\n}\n\nfunction spanIsOpenTelemetrySdkTraceBaseSpan(span: Span): span is OpenTelemetrySdkTraceBaseSpan {\n const castSpan = span as Partial<OpenTelemetrySdkTraceBaseSpan>;\n return !!castSpan.attributes && !!castSpan.startTime && !!castSpan.name && !!castSpan.endTime && !!castSpan.status;\n}\n\n/** Exported only for tests. */\nexport interface OpenTelemetrySdkTraceBaseSpan extends Span {\n attributes: SpanAttributes;\n startTime: SpanTimeInput;\n name: string;\n status: SpanStatus;\n endTime: SpanTimeInput;\n parentSpanId?: string;\n links?: SpanLink[];\n}\n\n/**\n * Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.\n * :( So instead we approximate this by checking if it has the `getSpanJSON` method.\n */\nfunction spanIsSentrySpan(span: Span): span is SentrySpan {\n return typeof (span as SentrySpan).getSpanJSON === 'function';\n}\n\n/**\n * Returns true if a span is sampled.\n * In most cases, you should just use `span.isRecording()` instead.\n * However, this has a slightly different semantic, as it also returns false if the span is finished.\n * So in the case where this distinction is important, use this method.\n */\nexport function spanIsSampled(span: Span): boolean {\n // We align our trace flags with the ones OpenTelemetry use\n // So we also check for sampled the same way they do.\n const { traceFlags } = span.spanContext();\n return traceFlags === TRACE_FLAG_SAMPLED;\n}\n\n/** Get the status message to use for a JSON representation of a span. */\nexport function getStatusMessage(status: SpanStatus | undefined): string | undefined {\n if (!status || status.code === SPAN_STATUS_UNSET) {\n return undefined;\n }\n\n if (status.code === SPAN_STATUS_OK) {\n return 'ok';\n }\n\n return status.message || 'internal_error';\n}\n\n/**\n * Convert the various statuses to the simple onces expected by Sentry for steamed spans ('ok' is default).\n */\nexport function getSimpleStatusMessage(status: SpanStatus | undefined): 'ok' | 'error' {\n return !status ||\n status.code === SPAN_STATUS_OK ||\n status.code === SPAN_STATUS_UNSET ||\n status.message === 'cancelled'\n ? 'ok'\n : 'error';\n}\n\nconst CHILD_SPANS_FIELD = '_sentryChildSpans';\nconst ROOT_SPAN_FIELD = '_sentryRootSpan';\n\ntype SpanWithPotentialChildren = Span & {\n [CHILD_SPANS_FIELD]?: Set<Span>;\n [ROOT_SPAN_FIELD]?: Span;\n};\n\n/**\n * Adds an opaque child span reference to a span.\n */\nexport function addChildSpanToSpan(span: SpanWithPotentialChildren, childSpan: Span): void {\n // We store the root span reference on the child span\n // We need this for `getRootSpan()` to work\n const rootSpan = span[ROOT_SPAN_FIELD] || span;\n addNonEnumerableProperty(childSpan as SpanWithPotentialChildren, ROOT_SPAN_FIELD, rootSpan);\n\n // We store a list of child spans on the parent span\n // We need this for `getSpanDescendants()` to work\n if (span[CHILD_SPANS_FIELD]) {\n span[CHILD_SPANS_FIELD].add(childSpan);\n } else {\n addNonEnumerableProperty(span, CHILD_SPANS_FIELD, new Set([childSpan]));\n }\n}\n\n/** This is only used internally by Idle Spans. */\nexport function removeChildSpanFromSpan(span: SpanWithPotentialChildren, childSpan: Span): void {\n if (span[CHILD_SPANS_FIELD]) {\n span[CHILD_SPANS_FIELD].delete(childSpan);\n }\n}\n\n/**\n * Returns an array of the given span and all of its descendants.\n */\nexport function getSpanDescendants(span: SpanWithPotentialChildren): Span[] {\n const resultSet = new Set<Span>();\n\n function addSpanChildren(span: SpanWithPotentialChildren): void {\n // This exit condition is required to not infinitely loop in case of a circular dependency.\n if (resultSet.has(span)) {\n return;\n // We want to ignore unsampled spans (e.g. non recording spans)\n } else if (spanIsSampled(span)) {\n resultSet.add(span);\n const childSpans = span[CHILD_SPANS_FIELD] ? Array.from(span[CHILD_SPANS_FIELD]) : [];\n for (const childSpan of childSpans) {\n addSpanChildren(childSpan);\n }\n }\n }\n\n addSpanChildren(span);\n\n return Array.from(resultSet);\n}\n\n/**\n * Returns the root span of a given span.\n */\nexport const getRootSpan = INTERNAL_getSegmentSpan;\n\n/**\n * Returns the segment span of a given span.\n */\nexport function INTERNAL_getSegmentSpan(span: SpanWithPotentialChildren): Span {\n return span[ROOT_SPAN_FIELD] || span;\n}\n\n/**\n * Returns the currently active span.\n */\nexport function getActiveSpan(): Span | undefined {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n if (acs.getActiveSpan) {\n return acs.getActiveSpan();\n }\n\n return _getSpanForScope(getCurrentScope());\n}\n\n/**\n * Logs a warning once if `beforeSendSpan` is used to drop spans.\n */\nexport function showSpanDropWarning(): void {\n if (!hasShownSpanDropWarning) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.',\n );\n });\n hasShownSpanDropWarning = true;\n }\n}\n\n/**\n * Updates the name of the given span and ensures that the span name is not\n * overwritten by the Sentry SDK.\n *\n * Use this function instead of `span.updateName()` if you want to make sure that\n * your name is kept. For some spans, for example root `http.server` spans the\n * Sentry SDK would otherwise overwrite the span name with a high-quality name\n * it infers when the span ends.\n *\n * Use this function in server code or when your span is started on the server\n * and on the client (browser). If you only update a span name on the client,\n * you can also use `span.updateName()` the SDK does not overwrite the name.\n *\n * @param span - The span to update the name of.\n * @param name - The name to set on the span.\n */\nexport function updateSpanName(span: Span, name: string): void {\n span.updateName(name);\n span.setAttributes({\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom',\n [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: name,\n });\n}\n"],"names":["getCapturedScopesOnSpan","generateSpanId","generateSentryTraceHeader","generateTraceparentHeader","timestampInSeconds","SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","serializeAttributes","SPAN_STATUS_UNSET","SPAN_STATUS_OK","addNonEnumerableProperty","carrier","getMainCarrier","getAsyncContextStrategy","_getSpanForScope","getCurrentScope","consoleSandbox","SEMANTIC_ATTRIBUTE_SENTRY_SOURCE","SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME"],"mappings":";;;;;;;;;;;;;;;;AAiCA;AACO,MAAM,eAAA,GAAkB;AACxB,MAAM,kBAAA,GAAqB;;AAElC,IAAI,uBAAA,GAA0B,KAAK;;AAEnC;AACA;AACA;AACA;AACA;AACO,SAAS,6BAA6B,CAAC,IAAI,EAAsB;AACxE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAA,KAAa,IAAI,CAAC,WAAW,EAAE;AACnE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,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AAE;AACzB,IAAI,OAAO,GAAG,CAAC,aAAa,EAAE;AAC9B,EAAE;;AAEF,EAAE,OAAOG,4BAAgB,CAACC,6BAAe,EAAE,CAAC;AAC5C;;AAEA;AACA;AACA;AACO,SAAS,mBAAmB,GAAS;AAC5C,EAAE,IAAI,CAAC,uBAAuB,EAAE;AAChC,IAAIC,0BAAc,CAAC,MAAM;AACzB;AACA,MAAM,OAAO,CAAC,IAAI;AAClB,QAAQ,0JAA0J;AAClK,OAAO;AACP,IAAI,CAAC,CAAC;AACN,IAAI,uBAAA,GAA0B,IAAI;AAClC,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,CAAC,IAAI,EAAQ,IAAI,EAAgB;AAC/D,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;AACvB,EAAE,IAAI,CAAC,aAAa,CAAC;AACrB,IAAI,CAACC,mDAAgC,GAAG,QAAQ;AAChD,IAAI,CAACC,6DAA0C,GAAG,IAAI;AACtD,GAAG,CAAC;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -36,7 +36,9 @@ function createStackParser(...parsers) {
36
36
 
37
37
  // https://github.com/getsentry/sentry-javascript/issues/7813
38
38
  // Skip Error: lines
39
- if (cleanedLine.match(/\S*Error: /)) {
39
+ // Using includes() instead of a regex to avoid O() backtracking on long lines
40
+ // https://github.com/getsentry/sentry-javascript/issues/20052
41
+ if (cleanedLine.includes('Error: ')) {
40
42
  continue;
41
43
  }
42
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"stacktrace.js","sources":["../../../src/utils/stacktrace.ts"],"sourcesContent":["import type { Event } from '../types-hoist/event';\nimport type { StackFrame } from '../types-hoist/stackframe';\nimport type { StackLineParser, StackParser } from '../types-hoist/stacktrace';\nimport type { VNode, VueViewModel } from '../types-hoist/vue';\n\nconst STACKTRACE_FRAME_LIMIT = 50;\nexport const UNKNOWN_FUNCTION = '?';\n// Used to sanitize webpack (error: *) wrapped stack errors\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STRIP_FRAME_REGEXP = /captureMessage|captureException/;\n\n/**\n * Creates a stack parser with the supplied line parsers\n *\n * StackFrames are returned in the correct order for Sentry Exception\n * frames and with Sentry SDK internal frames removed from the top and bottom\n *\n */\nexport function createStackParser(...parsers: StackLineParser[]): StackParser {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);\n\n return (stack: string, skipFirstLines: number = 0, framesToPop: number = 0): StackFrame[] => {\n const frames: StackFrame[] = [];\n const lines = stack.split('\\n');\n\n for (let i = skipFirstLines; i < lines.length; i++) {\n let line = lines[i] as string;\n // Truncate lines over 1kb because many of the regular expressions use\n // backtracking which results in run time that increases exponentially\n // with input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n line = line.slice(0, 1024);\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n if (cleanedLine.match(/\\S*Error: /)) {\n continue;\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) {\n break;\n }\n }\n\n return stripSentryFramesAndReverse(frames.slice(framesToPop));\n };\n}\n\n/**\n * Gets a stack parser implementation from Options.stackParser\n * @see Options\n *\n * If options contains an array of line parsers, it is converted into a parser\n */\nexport function stackParserFromStackParserOptions(stackParser: StackParser | StackLineParser[]): StackParser {\n if (Array.isArray(stackParser)) {\n return createStackParser(...stackParser);\n }\n return stackParser;\n}\n\n/**\n * Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.\n * Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the\n * function that caused the crash is the last frame in the array.\n * @hidden\n */\nexport function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): StackFrame[] {\n if (!stack.length) {\n return [];\n }\n\n const localStack = Array.from(stack);\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (/sentryWrapped/.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n\n // Reversing in the middle of the procedure allows us to just pop the values off the stack\n localStack.reverse();\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n\n // When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`\n // is produced within the scope itself, making it:\n //\n // Sentry.captureException()\n // scope.captureException()\n //\n // instead of just the top `Sentry` call itself.\n // This forces us to possibly strip an additional frame in the exact same was as above.\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n }\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION,\n }));\n}\n\nfunction getLastStackFrame(arr: StackFrame[]): StackFrame {\n return arr[arr.length - 1] || {};\n}\n\nconst defaultFunctionName = '<anonymous>';\n\n/**\n * Safely extract function name from itself\n */\nexport function getFunctionName(fn: unknown): string {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n\n/**\n * Get's stack frames from an event without needing to check for undefined properties.\n */\nexport function getFramesFromEvent(event: Event): StackFrame[] | undefined {\n const exception = event.exception;\n\n if (exception) {\n const frames: StackFrame[] = [];\n try {\n // @ts-expect-error Object could be undefined\n exception.values.forEach(value => {\n // @ts-expect-error Value could be undefined\n if (value.stacktrace.frames) {\n // @ts-expect-error Value could be undefined\n frames.push(...value.stacktrace.frames);\n }\n });\n return frames;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\n/**\n * Get the internal name of an internal Vue value, to represent it in a stacktrace.\n *\n * @param value The value to get the internal name of.\n */\nexport function getVueInternalName(value: VueViewModel | VNode): string {\n // Check if it's a VNode (has __v_isVNode) or a component instance (has _isVue/__isVue)\n const isVNode = '__v_isVNode' in value && value.__v_isVNode;\n\n return isVNode ? '[VueVNode]' : '[VueViewModel]';\n}\n\n/**\n * Normalizes stack line paths by removing file:// prefix and leading slashes for Windows paths\n */\nexport function normalizeStackTracePath(path: string | undefined): string | undefined {\n let filename = path?.startsWith('file://') ? path.slice(7) : path;\n // If it's a Windows path, trim the leading slash so that `/C:/foo` becomes `C:/foo`\n if (filename?.match(/\\/[A-Z]:/)) {\n filename = filename.slice(1);\n }\n return filename;\n}\n"],"names":[],"mappings":";;AAKA,MAAM,sBAAA,GAAyB,EAAE;AAC1B,MAAM,gBAAA,GAAmB;AAChC;AACA,MAAM,oBAAA,GAAuB,iBAAiB;AAC9C,MAAM,kBAAA,GAAqB,iCAAiC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,GAAG,OAAO,EAAkC;AAC9E,EAAE,MAAM,aAAA,GAAgB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA,IAAK,CAAC,CAAC,CAAC,CAAC,CAAC;;AAE1E,EAAE,OAAO,CAAC,KAAK,EAAU,cAAc,GAAW,CAAC,EAAE,WAAW,GAAW,CAAC,KAAmB;AAC/F,IAAI,MAAM,MAAM,GAAiB,EAAE;AACnC,IAAI,MAA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CAAC,CAAC,CAAA,GAAI,IAAI;AACnE;AACA,EAAE,IAAI,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE;AACnC,IAAI,WAAW,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAChC,EAAE;AACF,EAAE,OAAO,QAAQ;AACjB;;;;;;;;;;;"}
1
+ {"version":3,"file":"stacktrace.js","sources":["../../../src/utils/stacktrace.ts"],"sourcesContent":["import type { Event } from '../types-hoist/event';\nimport type { StackFrame } from '../types-hoist/stackframe';\nimport type { StackLineParser, StackParser } from '../types-hoist/stacktrace';\nimport type { VNode, VueViewModel } from '../types-hoist/vue';\n\nconst STACKTRACE_FRAME_LIMIT = 50;\nexport const UNKNOWN_FUNCTION = '?';\n// Used to sanitize webpack (error: *) wrapped stack errors\nconst WEBPACK_ERROR_REGEXP = /\\(error: (.*)\\)/;\nconst STRIP_FRAME_REGEXP = /captureMessage|captureException/;\n\n/**\n * Creates a stack parser with the supplied line parsers\n *\n * StackFrames are returned in the correct order for Sentry Exception\n * frames and with Sentry SDK internal frames removed from the top and bottom\n *\n */\nexport function createStackParser(...parsers: StackLineParser[]): StackParser {\n const sortedParsers = parsers.sort((a, b) => a[0] - b[0]).map(p => p[1]);\n\n return (stack: string, skipFirstLines: number = 0, framesToPop: number = 0): StackFrame[] => {\n const frames: StackFrame[] = [];\n const lines = stack.split('\\n');\n\n for (let i = skipFirstLines; i < lines.length; i++) {\n let line = lines[i] as string;\n // Truncate lines over 1kb because many of the regular expressions use\n // backtracking which results in run time that increases exponentially\n // with input size. Huge strings can result in hangs/Denial of Service:\n // https://github.com/getsentry/sentry-javascript/issues/2286\n if (line.length > 1024) {\n line = line.slice(0, 1024);\n }\n\n // https://github.com/getsentry/sentry-javascript/issues/5459\n // Remove webpack (error: *) wrappers\n const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, '$1') : line;\n\n // https://github.com/getsentry/sentry-javascript/issues/7813\n // Skip Error: lines\n // Using includes() instead of a regex to avoid O(n²) backtracking on long lines\n // https://github.com/getsentry/sentry-javascript/issues/20052\n if (cleanedLine.includes('Error: ')) {\n continue;\n }\n\n for (const parser of sortedParsers) {\n const frame = parser(cleanedLine);\n\n if (frame) {\n frames.push(frame);\n break;\n }\n }\n\n if (frames.length >= STACKTRACE_FRAME_LIMIT + framesToPop) {\n break;\n }\n }\n\n return stripSentryFramesAndReverse(frames.slice(framesToPop));\n };\n}\n\n/**\n * Gets a stack parser implementation from Options.stackParser\n * @see Options\n *\n * If options contains an array of line parsers, it is converted into a parser\n */\nexport function stackParserFromStackParserOptions(stackParser: StackParser | StackLineParser[]): StackParser {\n if (Array.isArray(stackParser)) {\n return createStackParser(...stackParser);\n }\n return stackParser;\n}\n\n/**\n * Removes Sentry frames from the top and bottom of the stack if present and enforces a limit of max number of frames.\n * Assumes stack input is ordered from top to bottom and returns the reverse representation so call site of the\n * function that caused the crash is the last frame in the array.\n * @hidden\n */\nexport function stripSentryFramesAndReverse(stack: ReadonlyArray<StackFrame>): StackFrame[] {\n if (!stack.length) {\n return [];\n }\n\n const localStack = Array.from(stack);\n\n // If stack starts with one of our API calls, remove it (starts, meaning it's the top of the stack - aka last call)\n if (/sentryWrapped/.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n\n // Reversing in the middle of the procedure allows us to just pop the values off the stack\n localStack.reverse();\n\n // If stack ends with one of our internal API calls, remove it (ends, meaning it's the bottom of the stack - aka top-most call)\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n\n // When using synthetic events, we will have a 2 levels deep stack, as `new Error('Sentry syntheticException')`\n // is produced within the scope itself, making it:\n //\n // Sentry.captureException()\n // scope.captureException()\n //\n // instead of just the top `Sentry` call itself.\n // This forces us to possibly strip an additional frame in the exact same was as above.\n if (STRIP_FRAME_REGEXP.test(getLastStackFrame(localStack).function || '')) {\n localStack.pop();\n }\n }\n\n return localStack.slice(0, STACKTRACE_FRAME_LIMIT).map(frame => ({\n ...frame,\n filename: frame.filename || getLastStackFrame(localStack).filename,\n function: frame.function || UNKNOWN_FUNCTION,\n }));\n}\n\nfunction getLastStackFrame(arr: StackFrame[]): StackFrame {\n return arr[arr.length - 1] || {};\n}\n\nconst defaultFunctionName = '<anonymous>';\n\n/**\n * Safely extract function name from itself\n */\nexport function getFunctionName(fn: unknown): string {\n try {\n if (!fn || typeof fn !== 'function') {\n return defaultFunctionName;\n }\n return fn.name || defaultFunctionName;\n } catch {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see raven-js#495).\n return defaultFunctionName;\n }\n}\n\n/**\n * Get's stack frames from an event without needing to check for undefined properties.\n */\nexport function getFramesFromEvent(event: Event): StackFrame[] | undefined {\n const exception = event.exception;\n\n if (exception) {\n const frames: StackFrame[] = [];\n try {\n // @ts-expect-error Object could be undefined\n exception.values.forEach(value => {\n // @ts-expect-error Value could be undefined\n if (value.stacktrace.frames) {\n // @ts-expect-error Value could be undefined\n frames.push(...value.stacktrace.frames);\n }\n });\n return frames;\n } catch {\n return undefined;\n }\n }\n return undefined;\n}\n\n/**\n * Get the internal name of an internal Vue value, to represent it in a stacktrace.\n *\n * @param value The value to get the internal name of.\n */\nexport function getVueInternalName(value: VueViewModel | VNode): string {\n // Check if it's a VNode (has __v_isVNode) or a component instance (has _isVue/__isVue)\n const isVNode = '__v_isVNode' in value && value.__v_isVNode;\n\n return isVNode ? '[VueVNode]' : '[VueViewModel]';\n}\n\n/**\n * Normalizes stack line paths by removing file:// prefix and leading slashes for Windows paths\n */\nexport function normalizeStackTracePath(path: string | undefined): string | undefined {\n let filename = path?.startsWith('file://') ? path.slice(7) : path;\n // If it's a Windows path, trim the leading slash so that `/C:/foo` becomes `C:/foo`\n if (filename?.match(/\\/[A-Z]:/)) {\n filename = filename.slice(1);\n }\n return filename;\n}\n"],"names":[],"mappings":";;AAKA,MAAM,sBAAA,GAAyB,EAAE;AAC1B,MAAM,gBAAA,GAAm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CAAC,MAAM,CAAC;AACjD,QAAQ;AACR,MAAM,CAAC,CAAC;AACR,MAAM,OAAO,MAAM;AACnB,IAAI,EAAE,MAAM;AACZ,MAAM,OAAO,SAAS;AACtB,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,KAAK,EAAgC;AACxE;AACA,EAAE,MAAM,UAAU,aAAA,IAAiB,KAAA,IAAS,KAAK,CAAC,WAAW;;AAE7D,EAAE,OAAO,OAAA,GAAU,YAAA,GAAe,gBAAgB;AAClD;;AAEA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,IAAI,EAA0C;AACtF,EAAE,IAAI,QAAA,GAAW,IAAI,EAAE,UAAU,CAAC,SAAS,CAAA,GAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA,GAAI,IAAI;AACnE;AACA,EAAE,IAAI,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE;AACnC,IAAI,WAAW,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAChC,EAAE;AACF,EAAE,OAAO,QAAQ;AACjB;;;;;;;;;;;"}
@@ -117,6 +117,9 @@ function isMatchingPattern(
117
117
  if (is.isString(pattern)) {
118
118
  return requireExactStringMatch ? value === pattern : value.includes(pattern);
119
119
  }
120
+ if (typeof pattern === 'function') {
121
+ return pattern(value);
122
+ }
120
123
 
121
124
  return false;
122
125
  }
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sources":["../../../src/utils/string.ts"],"sourcesContent":["import { isRegExp, isString, isVueViewModel } from './is';\nimport { getVueInternalName } from './stacktrace';\n\nexport { escapeStringForRegex } from '../vendor/escapeStringForRegex';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string (0 = unlimited)\n * @returns string Encoded\n */\nexport function truncate(str: string, max: number = 0): string {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function snipLine(line: string, colno: number): string {\n let newLine = line;\n const lineLength = newLine.length;\n if (lineLength <= 150) {\n return newLine;\n }\n if (colno > lineLength) {\n // eslint-disable-next-line no-param-reassign\n colno = lineLength;\n }\n\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n\n let end = Math.min(start + 140, lineLength);\n if (end > lineLength - 5) {\n end = lineLength;\n }\n if (end === lineLength) {\n start = Math.max(end - 140, 0);\n }\n\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < lineLength) {\n newLine += ' {snip}';\n }\n\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\nexport function safeJoin(input: unknown[], delimiter?: string): string {\n if (!Array.isArray(input)) {\n return '';\n }\n\n const output = [];\n // eslint-disable-next-line typescript/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n // This is a hack to fix a Vue3-specific bug that causes an infinite loop of\n // console warnings. This happens when a Vue template is rendered with\n // an undeclared variable, which we try to stringify, ultimately causing\n // Vue to issue another warning which repeats indefinitely.\n // see: https://github.com/getsentry/sentry-javascript/pull/8981\n if (isVueViewModel(value)) {\n output.push(getVueInternalName(value));\n } else {\n output.push(String(value));\n }\n } catch {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n/**\n * Checks if the given value matches a regex or string\n *\n * @param value The string to test\n * @param pattern Either a regex or a string against which `value` will be matched\n * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match\n * `pattern` if it contains `pattern`. Only applies to string-type patterns.\n */\nexport function isMatchingPattern(\n value: string,\n pattern: RegExp | string,\n requireExactStringMatch: boolean = false,\n): boolean {\n if (!isString(value)) {\n return false;\n }\n\n if (isRegExp(pattern)) {\n return pattern.test(value);\n }\n if (isString(pattern)) {\n return requireExactStringMatch ? value === pattern : value.includes(pattern);\n }\n\n return false;\n}\n\n/**\n * Test the given string against an array of strings and regexes. By default, string matching is done on a\n * substring-inclusion basis rather than a strict equality basis\n *\n * @param testString The string to test\n * @param patterns The patterns against which to test the string\n * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to\n * count. If false, `testString` will match a string pattern if it contains that pattern.\n * @returns\n */\nexport function stringMatchesSomePattern(\n testString: string,\n patterns: Array<string | RegExp> = [],\n requireExactStringMatch: boolean = false,\n): boolean {\n return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));\n}\n"],"names":["isVueViewModel","getVueInternalName","isString","isRegExp"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,GAAG,EAAU,GAAG,GAAW,CAAC,EAAU;AAC/D,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,CAAC,EAAE;AAC5C,IAAI,OAAO,GAAG;AACd,EAAE;AACF,EAAE,OAAO,GAAG,CAAC,MAAA,IAAU,MAAM,GAAA,GAAM,CAAC,EAAA,GAAA,CAAA,KAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,QAAA,CAAA,IAAA,EAAA,KAAA,EAAA;AACA,EAAA,IAAA,OAAA,GAAA,IAAA;AACA,EAAA,MAAA,UAAA,GAAA,OAAA,CAAA,MAAA;AACA,EAAA,IAAA,UAAA,IAAA,GAAA,EAAA;AACA,IAAA,OAAA,OAAA;AACA,EAAA;AACA,EAAA,IAAA,KAAA,GAAA,UAAA,EAAA;AACA;AACA,IAAA,KAAA,GAAA,UAAA;AACA,EAAA;;AA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,CAAA,EAAA;AACA,QAAA,MAAA,CAAA,IAAA,CAAAC,6BAAA,CAAA,KAAA,CAAA,CAAA;AACA,MAAA,CAAA,MAAA;AACA,QAAA,MAAA,CAAA,IAAA,CAAA,MAAA,CAAA,KAAA,CAAA,CAAA;AACA,MAAA;AACA,IAAA,CAAA,CAAA,MAAA;AACA,MAAA,MAAA,CAAA,IAAA,CAAA,8BAAA,CAAA;AACA,IAAA;AACA,EAAA;;AAEA,EAAA,OAAA,MAAA,CAAA,IAAA,CAAA,SAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,iBAAA;AACA,EAAA,KAAA;AACA,EAAA,OAAA;AACA,EAAA,uBAAA,GAAA,KAAA;AACA,EAAA;AACA,EAAA,IAAA,CAAAC,WAAA,CAAA,KAAA,CAAA,EAAA;AACA,IAAA,OAAA,KAAA;AACA,EAAA;;AAEA,EAAA,IAAAC,WAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,OAAA,CAAA,IAAA,CAAA,KAAA,CAAA;AACA,EAAA;AACA,EAAA,IAAAD,WAAA,CAAA,OAAA,CAAA,EAAA;AACA,IAAA,OAAA,uBAAA,GAAA,KAAA,KAAA,OAAA,GAAA,KAAA,CAAA,QAAA,CAAA,OAAA,CAAA;AACA,EAAA;;AAEA,EAAA,OAAA,KAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA;AACA,EAAA,UAAA;AACA,EAAA,QAAA,GAAA,EAAA;AACA,EAAA,uBAAA,GAAA,KAAA;AACA,EAAA;AACA,EAAA,OAAA,QAAA,CAAA,IAAA,CAAA,OAAA,IAAA,iBAAA,CAAA,UAAA,EAAA,OAAA,EAAA,uBAAA,CAAA,CAAA;AACA;;;;;;;;"}
1
+ {"version":3,"file":"string.js","sources":["../../../src/utils/string.ts"],"sourcesContent":["import { isRegExp, isString, isVueViewModel } from './is';\nimport { getVueInternalName } from './stacktrace';\n\nexport { escapeStringForRegex } from '../vendor/escapeStringForRegex';\n\n/**\n * Truncates given string to the maximum characters count\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string (0 = unlimited)\n * @returns string Encoded\n */\nexport function truncate(str: string, max: number = 0): string {\n if (typeof str !== 'string' || max === 0) {\n return str;\n }\n return str.length <= max ? str : `${str.slice(0, max)}...`;\n}\n\n/**\n * This is basically just `trim_line` from\n * https://github.com/getsentry/sentry/blob/master/src/sentry/lang/javascript/processor.py#L67\n *\n * @param str An object that contains serializable values\n * @param max Maximum number of characters in truncated string\n * @returns string Encoded\n */\nexport function snipLine(line: string, colno: number): string {\n let newLine = line;\n const lineLength = newLine.length;\n if (lineLength <= 150) {\n return newLine;\n }\n if (colno > lineLength) {\n // eslint-disable-next-line no-param-reassign\n colno = lineLength;\n }\n\n let start = Math.max(colno - 60, 0);\n if (start < 5) {\n start = 0;\n }\n\n let end = Math.min(start + 140, lineLength);\n if (end > lineLength - 5) {\n end = lineLength;\n }\n if (end === lineLength) {\n start = Math.max(end - 140, 0);\n }\n\n newLine = newLine.slice(start, end);\n if (start > 0) {\n newLine = `'{snip} ${newLine}`;\n }\n if (end < lineLength) {\n newLine += ' {snip}';\n }\n\n return newLine;\n}\n\n/**\n * Join values in array\n * @param input array of values to be joined together\n * @param delimiter string to be placed in-between values\n * @returns Joined values\n */\nexport function safeJoin(input: unknown[], delimiter?: string): string {\n if (!Array.isArray(input)) {\n return '';\n }\n\n const output = [];\n // eslint-disable-next-line typescript/prefer-for-of\n for (let i = 0; i < input.length; i++) {\n const value = input[i];\n try {\n // This is a hack to fix a Vue3-specific bug that causes an infinite loop of\n // console warnings. This happens when a Vue template is rendered with\n // an undeclared variable, which we try to stringify, ultimately causing\n // Vue to issue another warning which repeats indefinitely.\n // see: https://github.com/getsentry/sentry-javascript/pull/8981\n if (isVueViewModel(value)) {\n output.push(getVueInternalName(value));\n } else {\n output.push(String(value));\n }\n } catch {\n output.push('[value cannot be serialized]');\n }\n }\n\n return output.join(delimiter);\n}\n\n/**\n * Checks if the given value matches a regex or string\n *\n * @param value The string to test\n * @param pattern Either a regex or a string against which `value` will be matched\n * @param requireExactStringMatch If true, `value` must match `pattern` exactly. If false, `value` will match\n * `pattern` if it contains `pattern`. Only applies to string-type patterns.\n */\nexport function isMatchingPattern(\n value: string,\n pattern: RegExp | string | ((value: string) => boolean),\n requireExactStringMatch: boolean = false,\n): boolean {\n if (!isString(value)) {\n return false;\n }\n\n if (isRegExp(pattern)) {\n return pattern.test(value);\n }\n if (isString(pattern)) {\n return requireExactStringMatch ? value === pattern : value.includes(pattern);\n }\n if (typeof pattern === 'function') {\n return pattern(value);\n }\n\n return false;\n}\n\n/**\n * Test the given string against an array of strings and regexes. By default, string matching is done on a\n * substring-inclusion basis rather than a strict equality basis\n *\n * @param testString The string to test\n * @param patterns The patterns against which to test the string\n * @param requireExactStringMatch If true, `testString` must match one of the given string patterns exactly in order to\n * count. If false, `testString` will match a string pattern if it contains that pattern.\n * @returns\n */\nexport function stringMatchesSomePattern(\n testString: string,\n patterns: Array<string | RegExp | ((value: string) => boolean)> = [],\n requireExactStringMatch: boolean = false,\n): boolean {\n return patterns.some(pattern => isMatchingPattern(testString, pattern, requireExactStringMatch));\n}\n"],"names":["isVueViewModel","getVueInternalName","isString","isRegExp"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,QAAQ,CAAC,GAAG,EAAU,GAAG,GAAW,CAAC,EAAU;AAC/D,EAAE,IAAI,OAAO,GAAA,KAAQ,YAAY,GAAA,KAAQ,CAAC,EAAE;AAC5C,IAAI,OAAO,GAAG;AACd,EAAE;AACF,EAAE,OAAO,GAAG,CAAC,MAAA,IAAU,MAAM,GAAA,GAAM,CAAC,EAAA,GAAA,CAAA,KAAA,CAAA,CAAA,EAAA,GAAA,CAAA,CAAA,GAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,QA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AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA;AACA,EAAA,UAAA;AACA,EAAA,QAAA,GAAA,EAAA;AACA,EAAA,uBAAA,GAAA,KAAA;AACA,EAAA;AACA,EAAA,OAAA,QAAA,CAAA,IAAA,CAAA,OAAA,IAAA,iBAAA,CAAA,UAAA,EAAA,OAAA,EAAA,uBAAA,CAAA,CAAA;AACA;;;;;;;;"}
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  // This is a magic string replaced by rollup
4
4
 
5
- const SDK_VERSION = "10.47.0" ;
5
+ const SDK_VERSION = "10.49.0" ;
6
6
 
7
7
  exports.SDK_VERSION = SDK_VERSION;
8
8
  //# sourceMappingURL=version.js.map