@sentry/cloudflare 11.11.0 → 11.13.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 (628) hide show
  1. package/build/cjs/dev/_virtual/_rolldown/runtime.js +22 -0
  2. package/build/cjs/dev/baseSdk.js +98 -103
  3. package/build/cjs/dev/baseSdk.js.map +1 -1
  4. package/build/cjs/dev/client.js +213 -237
  5. package/build/cjs/dev/client.js.map +1 -1
  6. package/build/cjs/dev/clientCache.js +8 -8
  7. package/build/cjs/dev/clientCache.js.map +1 -1
  8. package/build/cjs/dev/debug-build.js +9 -5
  9. package/build/cjs/dev/debug-build.js.map +1 -1
  10. package/build/cjs/dev/defineCloudflareOptions.js +5 -8
  11. package/build/cjs/dev/defineCloudflareOptions.js.map +1 -1
  12. package/build/cjs/dev/durableobject.js +290 -163
  13. package/build/cjs/dev/durableobject.js.map +1 -1
  14. package/build/cjs/dev/flush.js +104 -77
  15. package/build/cjs/dev/flush.js.map +1 -1
  16. package/build/cjs/dev/index.js +181 -182
  17. package/build/cjs/dev/instrument.js +53 -39
  18. package/build/cjs/dev/instrument.js.map +1 -1
  19. package/build/cjs/dev/instrumentations/agents/index.js +34 -13
  20. package/build/cjs/dev/instrumentations/agents/index.js.map +1 -1
  21. package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
  22. package/build/cjs/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  23. package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
  24. package/build/cjs/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  25. package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
  26. package/build/cjs/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  27. package/build/cjs/dev/instrumentations/agents/types.js +103 -58
  28. package/build/cjs/dev/instrumentations/agents/types.js.map +1 -1
  29. package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -118
  30. package/build/cjs/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  31. package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -44
  32. package/build/cjs/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  33. package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js +70 -71
  34. package/build/cjs/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  35. package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
  36. package/build/cjs/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  37. package/build/cjs/dev/instrumentations/instrumentSqlStorage.js +50 -52
  38. package/build/cjs/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
  39. package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -123
  40. package/build/cjs/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  41. package/build/cjs/dev/instrumentations/worker/instrumentD1.js +131 -146
  42. package/build/cjs/dev/instrumentations/worker/instrumentD1.js.map +1 -1
  43. package/build/cjs/dev/instrumentations/worker/instrumentEmail.js +63 -61
  44. package/build/cjs/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
  45. package/build/cjs/dev/instrumentations/worker/instrumentEnv.js +83 -87
  46. package/build/cjs/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
  47. package/build/cjs/dev/instrumentations/worker/instrumentFetch.js +41 -48
  48. package/build/cjs/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
  49. package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js +25 -21
  50. package/build/cjs/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
  51. package/build/cjs/dev/instrumentations/worker/instrumentKV.js +54 -67
  52. package/build/cjs/dev/instrumentations/worker/instrumentKV.js.map +1 -1
  53. package/build/cjs/dev/instrumentations/worker/instrumentQueue.js +100 -76
  54. package/build/cjs/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
  55. package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js +91 -75
  56. package/build/cjs/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  57. package/build/cjs/dev/instrumentations/worker/instrumentR2.js +128 -115
  58. package/build/cjs/dev/instrumentations/worker/instrumentR2.js.map +1 -1
  59. package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js +90 -94
  60. package/build/cjs/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
  61. package/build/cjs/dev/instrumentations/worker/instrumentTail.js +100 -55
  62. package/build/cjs/dev/instrumentations/worker/instrumentTail.js.map +1 -1
  63. package/build/cjs/dev/integrations/cronTriggers.js +130 -85
  64. package/build/cjs/dev/integrations/cronTriggers.js.map +1 -1
  65. package/build/cjs/dev/integrations/fetch.js +9 -9
  66. package/build/cjs/dev/integrations/fetch.js.map +1 -1
  67. package/build/cjs/dev/integrations/httpServer.js +41 -22
  68. package/build/cjs/dev/integrations/httpServer.js.map +1 -1
  69. package/build/cjs/dev/integrations/spotlight.js +52 -55
  70. package/build/cjs/dev/integrations/spotlight.js.map +1 -1
  71. package/build/cjs/dev/opentelemetry/tracer.js +10 -8
  72. package/build/cjs/dev/opentelemetry/tracer.js.map +1 -1
  73. package/build/cjs/dev/options.js +55 -39
  74. package/build/cjs/dev/options.js.map +1 -1
  75. package/build/cjs/dev/orchestrion-deferred-channels.js +45 -29
  76. package/build/cjs/dev/orchestrion-deferred-channels.js.map +1 -1
  77. package/build/cjs/dev/orchestrion-diagnostics-channel.js +97 -72
  78. package/build/cjs/dev/orchestrion-diagnostics-channel.js.map +1 -1
  79. package/build/cjs/dev/pages-plugin.js +20 -21
  80. package/build/cjs/dev/pages-plugin.js.map +1 -1
  81. package/build/cjs/dev/request.js +16 -10
  82. package/build/cjs/dev/request.js.map +1 -1
  83. package/build/cjs/dev/scope-utils.js +12 -12
  84. package/build/cjs/dev/scope-utils.js.map +1 -1
  85. package/build/cjs/dev/sdk.js +24 -15
  86. package/build/cjs/dev/sdk.js.map +1 -1
  87. package/build/cjs/dev/transport.js +93 -86
  88. package/build/cjs/dev/transport.js.map +1 -1
  89. package/build/cjs/dev/utils/asyncContextStrategy.js +10 -10
  90. package/build/cjs/dev/utils/asyncContextStrategy.js.map +1 -1
  91. package/build/cjs/dev/utils/bindingPropagation.js +24 -0
  92. package/build/cjs/dev/utils/bindingPropagation.js.map +1 -0
  93. package/build/cjs/dev/utils/cloudflareTrace.js +34 -0
  94. package/build/cjs/dev/utils/cloudflareTrace.js.map +1 -0
  95. package/build/cjs/dev/utils/instrumentContext.js +74 -58
  96. package/build/cjs/dev/utils/instrumentContext.js.map +1 -1
  97. package/build/cjs/dev/utils/internalSqlQuery.js +38 -21
  98. package/build/cjs/dev/utils/internalSqlQuery.js.map +1 -1
  99. package/build/cjs/dev/utils/internalStorageKey.js +41 -38
  100. package/build/cjs/dev/utils/internalStorageKey.js.map +1 -1
  101. package/build/cjs/dev/utils/invocationContext.js +42 -32
  102. package/build/cjs/dev/utils/invocationContext.js.map +1 -1
  103. package/build/cjs/dev/utils/invocationScope.js +45 -21
  104. package/build/cjs/dev/utils/invocationScope.js.map +1 -1
  105. package/build/cjs/dev/utils/isBinding.js +47 -15
  106. package/build/cjs/dev/utils/isBinding.js.map +1 -1
  107. package/build/cjs/dev/utils/isCloudflareClass.js +11 -20
  108. package/build/cjs/dev/utils/isCloudflareClass.js.map +1 -1
  109. package/build/cjs/dev/utils/queueTraceMeta.js +33 -0
  110. package/build/cjs/dev/utils/queueTraceMeta.js.map +1 -0
  111. package/build/cjs/dev/utils/rpcMeta.js +37 -27
  112. package/build/cjs/dev/utils/rpcMeta.js.map +1 -1
  113. package/build/cjs/dev/utils/traceLinks.js +52 -42
  114. package/build/cjs/dev/utils/traceLinks.js.map +1 -1
  115. package/build/cjs/dev/vendor/stacktrace.js +32 -24
  116. package/build/cjs/dev/vendor/stacktrace.js.map +1 -1
  117. package/build/cjs/dev/vite/agentClass.js +105 -98
  118. package/build/cjs/dev/vite/agentClass.js.map +1 -1
  119. package/build/cjs/dev/vite/autoInstrument.js +121 -122
  120. package/build/cjs/dev/vite/autoInstrument.js.map +1 -1
  121. package/build/cjs/dev/vite/index.js +44 -21
  122. package/build/cjs/dev/vite/index.js.map +1 -1
  123. package/build/cjs/dev/vite/instrumentFile.js +37 -20
  124. package/build/cjs/dev/vite/instrumentFile.js.map +1 -1
  125. package/build/cjs/dev/vite/mastraObservability.js +19 -12
  126. package/build/cjs/dev/vite/mastraObservability.js.map +1 -1
  127. package/build/cjs/dev/vite/moduleShape.js +220 -201
  128. package/build/cjs/dev/vite/moduleShape.js.map +1 -1
  129. package/build/cjs/dev/vite/providedModulePlugin.js +62 -45
  130. package/build/cjs/dev/vite/providedModulePlugin.js.map +1 -1
  131. package/build/cjs/dev/vite/transform.js +333 -284
  132. package/build/cjs/dev/vite/transform.js.map +1 -1
  133. package/build/cjs/dev/vite/workerEntrypoint.js +66 -57
  134. package/build/cjs/dev/vite/workerEntrypoint.js.map +1 -1
  135. package/build/cjs/dev/vite/wranglerConfig.js +92 -67
  136. package/build/cjs/dev/vite/wranglerConfig.js.map +1 -1
  137. package/build/cjs/dev/withSentry.js +32 -26
  138. package/build/cjs/dev/withSentry.js.map +1 -1
  139. package/build/cjs/dev/workflows.js +165 -149
  140. package/build/cjs/dev/workflows.js.map +1 -1
  141. package/build/cjs/dev/wrapMethodWithSentry.js +148 -169
  142. package/build/cjs/dev/wrapMethodWithSentry.js.map +1 -1
  143. package/build/cjs/dev/wrapRequestHandlerWithInit.js +78 -72
  144. package/build/cjs/dev/wrapRequestHandlerWithInit.js.map +1 -1
  145. package/build/cjs/prod/_virtual/_rolldown/runtime.js +22 -0
  146. package/build/cjs/prod/baseSdk.js +94 -93
  147. package/build/cjs/prod/baseSdk.js.map +1 -1
  148. package/build/cjs/prod/client.js +213 -237
  149. package/build/cjs/prod/client.js.map +1 -1
  150. package/build/cjs/prod/clientCache.js +8 -8
  151. package/build/cjs/prod/clientCache.js.map +1 -1
  152. package/build/cjs/prod/debug-build.js +9 -5
  153. package/build/cjs/prod/debug-build.js.map +1 -1
  154. package/build/cjs/prod/defineCloudflareOptions.js +5 -8
  155. package/build/cjs/prod/defineCloudflareOptions.js.map +1 -1
  156. package/build/cjs/prod/durableobject.js +290 -163
  157. package/build/cjs/prod/durableobject.js.map +1 -1
  158. package/build/cjs/prod/flush.js +104 -77
  159. package/build/cjs/prod/flush.js.map +1 -1
  160. package/build/cjs/prod/index.js +181 -182
  161. package/build/cjs/prod/instrument.js +53 -39
  162. package/build/cjs/prod/instrument.js.map +1 -1
  163. package/build/cjs/prod/instrumentations/agents/index.js +34 -13
  164. package/build/cjs/prod/instrumentations/agents/index.js.map +1 -1
  165. package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -49
  166. package/build/cjs/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  167. package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -16
  168. package/build/cjs/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  169. package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -28
  170. package/build/cjs/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  171. package/build/cjs/prod/instrumentations/agents/types.js +103 -58
  172. package/build/cjs/prod/instrumentations/agents/types.js.map +1 -1
  173. package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -118
  174. package/build/cjs/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  175. package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -44
  176. package/build/cjs/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  177. package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js +70 -71
  178. package/build/cjs/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  179. package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -39
  180. package/build/cjs/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  181. package/build/cjs/prod/instrumentations/instrumentSqlStorage.js +50 -52
  182. package/build/cjs/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
  183. package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -123
  184. package/build/cjs/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  185. package/build/cjs/prod/instrumentations/worker/instrumentD1.js +131 -146
  186. package/build/cjs/prod/instrumentations/worker/instrumentD1.js.map +1 -1
  187. package/build/cjs/prod/instrumentations/worker/instrumentEmail.js +63 -61
  188. package/build/cjs/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
  189. package/build/cjs/prod/instrumentations/worker/instrumentEnv.js +83 -87
  190. package/build/cjs/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
  191. package/build/cjs/prod/instrumentations/worker/instrumentFetch.js +41 -48
  192. package/build/cjs/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
  193. package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js +25 -21
  194. package/build/cjs/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
  195. package/build/cjs/prod/instrumentations/worker/instrumentKV.js +54 -67
  196. package/build/cjs/prod/instrumentations/worker/instrumentKV.js.map +1 -1
  197. package/build/cjs/prod/instrumentations/worker/instrumentQueue.js +100 -76
  198. package/build/cjs/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
  199. package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js +91 -75
  200. package/build/cjs/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  201. package/build/cjs/prod/instrumentations/worker/instrumentR2.js +128 -115
  202. package/build/cjs/prod/instrumentations/worker/instrumentR2.js.map +1 -1
  203. package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js +90 -94
  204. package/build/cjs/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
  205. package/build/cjs/prod/instrumentations/worker/instrumentTail.js +100 -55
  206. package/build/cjs/prod/instrumentations/worker/instrumentTail.js.map +1 -1
  207. package/build/cjs/prod/integrations/cronTriggers.js +130 -85
  208. package/build/cjs/prod/integrations/cronTriggers.js.map +1 -1
  209. package/build/cjs/prod/integrations/fetch.js +9 -9
  210. package/build/cjs/prod/integrations/fetch.js.map +1 -1
  211. package/build/cjs/prod/integrations/httpServer.js +41 -22
  212. package/build/cjs/prod/integrations/httpServer.js.map +1 -1
  213. package/build/cjs/prod/integrations/spotlight.js +52 -55
  214. package/build/cjs/prod/integrations/spotlight.js.map +1 -1
  215. package/build/cjs/prod/opentelemetry/tracer.js +10 -8
  216. package/build/cjs/prod/opentelemetry/tracer.js.map +1 -1
  217. package/build/cjs/prod/options.js +37 -24
  218. package/build/cjs/prod/options.js.map +1 -1
  219. package/build/cjs/prod/orchestrion-deferred-channels.js +45 -29
  220. package/build/cjs/prod/orchestrion-deferred-channels.js.map +1 -1
  221. package/build/cjs/prod/orchestrion-diagnostics-channel.js +97 -72
  222. package/build/cjs/prod/orchestrion-diagnostics-channel.js.map +1 -1
  223. package/build/cjs/prod/pages-plugin.js +20 -21
  224. package/build/cjs/prod/pages-plugin.js.map +1 -1
  225. package/build/cjs/prod/request.js +16 -10
  226. package/build/cjs/prod/request.js.map +1 -1
  227. package/build/cjs/prod/scope-utils.js +12 -12
  228. package/build/cjs/prod/scope-utils.js.map +1 -1
  229. package/build/cjs/prod/sdk.js +24 -15
  230. package/build/cjs/prod/sdk.js.map +1 -1
  231. package/build/cjs/prod/transport.js +93 -86
  232. package/build/cjs/prod/transport.js.map +1 -1
  233. package/build/cjs/prod/utils/asyncContextStrategy.js +10 -10
  234. package/build/cjs/prod/utils/asyncContextStrategy.js.map +1 -1
  235. package/build/cjs/prod/utils/bindingPropagation.js +24 -0
  236. package/build/cjs/prod/utils/bindingPropagation.js.map +1 -0
  237. package/build/cjs/prod/utils/cloudflareTrace.js +34 -0
  238. package/build/cjs/prod/utils/cloudflareTrace.js.map +1 -0
  239. package/build/cjs/prod/utils/instrumentContext.js +74 -58
  240. package/build/cjs/prod/utils/instrumentContext.js.map +1 -1
  241. package/build/cjs/prod/utils/internalSqlQuery.js +38 -21
  242. package/build/cjs/prod/utils/internalSqlQuery.js.map +1 -1
  243. package/build/cjs/prod/utils/internalStorageKey.js +41 -38
  244. package/build/cjs/prod/utils/internalStorageKey.js.map +1 -1
  245. package/build/cjs/prod/utils/invocationContext.js +42 -32
  246. package/build/cjs/prod/utils/invocationContext.js.map +1 -1
  247. package/build/cjs/prod/utils/invocationScope.js +45 -21
  248. package/build/cjs/prod/utils/invocationScope.js.map +1 -1
  249. package/build/cjs/prod/utils/isBinding.js +47 -15
  250. package/build/cjs/prod/utils/isBinding.js.map +1 -1
  251. package/build/cjs/prod/utils/isCloudflareClass.js +11 -20
  252. package/build/cjs/prod/utils/isCloudflareClass.js.map +1 -1
  253. package/build/cjs/prod/utils/queueTraceMeta.js +33 -0
  254. package/build/cjs/prod/utils/queueTraceMeta.js.map +1 -0
  255. package/build/cjs/prod/utils/rpcMeta.js +37 -27
  256. package/build/cjs/prod/utils/rpcMeta.js.map +1 -1
  257. package/build/cjs/prod/utils/traceLinks.js +52 -42
  258. package/build/cjs/prod/utils/traceLinks.js.map +1 -1
  259. package/build/cjs/prod/vendor/stacktrace.js +32 -24
  260. package/build/cjs/prod/vendor/stacktrace.js.map +1 -1
  261. package/build/cjs/prod/vite/agentClass.js +105 -98
  262. package/build/cjs/prod/vite/agentClass.js.map +1 -1
  263. package/build/cjs/prod/vite/autoInstrument.js +121 -122
  264. package/build/cjs/prod/vite/autoInstrument.js.map +1 -1
  265. package/build/cjs/prod/vite/index.js +44 -21
  266. package/build/cjs/prod/vite/index.js.map +1 -1
  267. package/build/cjs/prod/vite/instrumentFile.js +37 -20
  268. package/build/cjs/prod/vite/instrumentFile.js.map +1 -1
  269. package/build/cjs/prod/vite/mastraObservability.js +19 -12
  270. package/build/cjs/prod/vite/mastraObservability.js.map +1 -1
  271. package/build/cjs/prod/vite/moduleShape.js +220 -201
  272. package/build/cjs/prod/vite/moduleShape.js.map +1 -1
  273. package/build/cjs/prod/vite/providedModulePlugin.js +62 -45
  274. package/build/cjs/prod/vite/providedModulePlugin.js.map +1 -1
  275. package/build/cjs/prod/vite/transform.js +333 -284
  276. package/build/cjs/prod/vite/transform.js.map +1 -1
  277. package/build/cjs/prod/vite/workerEntrypoint.js +66 -57
  278. package/build/cjs/prod/vite/workerEntrypoint.js.map +1 -1
  279. package/build/cjs/prod/vite/wranglerConfig.js +92 -67
  280. package/build/cjs/prod/vite/wranglerConfig.js.map +1 -1
  281. package/build/cjs/prod/withSentry.js +32 -26
  282. package/build/cjs/prod/withSentry.js.map +1 -1
  283. package/build/cjs/prod/workflows.js +165 -149
  284. package/build/cjs/prod/workflows.js.map +1 -1
  285. package/build/cjs/prod/wrapMethodWithSentry.js +148 -169
  286. package/build/cjs/prod/wrapMethodWithSentry.js.map +1 -1
  287. package/build/cjs/prod/wrapRequestHandlerWithInit.js +78 -72
  288. package/build/cjs/prod/wrapRequestHandlerWithInit.js.map +1 -1
  289. package/build/esm/dev/baseSdk.js +98 -101
  290. package/build/esm/dev/baseSdk.js.map +1 -1
  291. package/build/esm/dev/client.js +213 -235
  292. package/build/esm/dev/client.js.map +1 -1
  293. package/build/esm/dev/clientCache.js +8 -6
  294. package/build/esm/dev/clientCache.js.map +1 -1
  295. package/build/esm/dev/debug-build.js +9 -3
  296. package/build/esm/dev/debug-build.js.map +1 -1
  297. package/build/esm/dev/defineCloudflareOptions.js +5 -6
  298. package/build/esm/dev/defineCloudflareOptions.js.map +1 -1
  299. package/build/esm/dev/durableobject.js +290 -161
  300. package/build/esm/dev/durableobject.js.map +1 -1
  301. package/build/esm/dev/flush.js +104 -75
  302. package/build/esm/dev/flush.js.map +1 -1
  303. package/build/esm/dev/index.js +19 -18
  304. package/build/esm/dev/instrument.js +53 -37
  305. package/build/esm/dev/instrument.js.map +1 -1
  306. package/build/esm/dev/instrumentations/agents/index.js +34 -11
  307. package/build/esm/dev/instrumentations/agents/index.js.map +1 -1
  308. package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
  309. package/build/esm/dev/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  310. package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
  311. package/build/esm/dev/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  312. package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
  313. package/build/esm/dev/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  314. package/build/esm/dev/instrumentations/agents/types.js +103 -56
  315. package/build/esm/dev/instrumentations/agents/types.js.map +1 -1
  316. package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js +87 -116
  317. package/build/esm/dev/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  318. package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js +46 -42
  319. package/build/esm/dev/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  320. package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js +70 -69
  321. package/build/esm/dev/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  322. package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
  323. package/build/esm/dev/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  324. package/build/esm/dev/instrumentations/instrumentSqlStorage.js +50 -50
  325. package/build/esm/dev/instrumentations/instrumentSqlStorage.js.map +1 -1
  326. package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js +136 -121
  327. package/build/esm/dev/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  328. package/build/esm/dev/instrumentations/worker/instrumentD1.js +131 -144
  329. package/build/esm/dev/instrumentations/worker/instrumentD1.js.map +1 -1
  330. package/build/esm/dev/instrumentations/worker/instrumentEmail.js +63 -59
  331. package/build/esm/dev/instrumentations/worker/instrumentEmail.js.map +1 -1
  332. package/build/esm/dev/instrumentations/worker/instrumentEnv.js +83 -85
  333. package/build/esm/dev/instrumentations/worker/instrumentEnv.js.map +1 -1
  334. package/build/esm/dev/instrumentations/worker/instrumentFetch.js +41 -46
  335. package/build/esm/dev/instrumentations/worker/instrumentFetch.js.map +1 -1
  336. package/build/esm/dev/instrumentations/worker/instrumentFetcher.js +25 -19
  337. package/build/esm/dev/instrumentations/worker/instrumentFetcher.js.map +1 -1
  338. package/build/esm/dev/instrumentations/worker/instrumentKV.js +54 -65
  339. package/build/esm/dev/instrumentations/worker/instrumentKV.js.map +1 -1
  340. package/build/esm/dev/instrumentations/worker/instrumentQueue.js +100 -74
  341. package/build/esm/dev/instrumentations/worker/instrumentQueue.js.map +1 -1
  342. package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js +91 -73
  343. package/build/esm/dev/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  344. package/build/esm/dev/instrumentations/worker/instrumentR2.js +128 -113
  345. package/build/esm/dev/instrumentations/worker/instrumentR2.js.map +1 -1
  346. package/build/esm/dev/instrumentations/worker/instrumentScheduled.js +90 -92
  347. package/build/esm/dev/instrumentations/worker/instrumentScheduled.js.map +1 -1
  348. package/build/esm/dev/instrumentations/worker/instrumentTail.js +100 -53
  349. package/build/esm/dev/instrumentations/worker/instrumentTail.js.map +1 -1
  350. package/build/esm/dev/integrations/cronTriggers.js +129 -82
  351. package/build/esm/dev/integrations/cronTriggers.js.map +1 -1
  352. package/build/esm/dev/integrations/fetch.js +9 -6
  353. package/build/esm/dev/integrations/fetch.js.map +1 -1
  354. package/build/esm/dev/integrations/httpServer.js +40 -19
  355. package/build/esm/dev/integrations/httpServer.js.map +1 -1
  356. package/build/esm/dev/integrations/spotlight.js +51 -52
  357. package/build/esm/dev/integrations/spotlight.js.map +1 -1
  358. package/build/esm/dev/opentelemetry/tracer.js +10 -6
  359. package/build/esm/dev/opentelemetry/tracer.js.map +1 -1
  360. package/build/esm/dev/options.js +55 -37
  361. package/build/esm/dev/options.js.map +1 -1
  362. package/build/esm/dev/orchestrion-deferred-channels.js +45 -27
  363. package/build/esm/dev/orchestrion-deferred-channels.js.map +1 -1
  364. package/build/esm/dev/orchestrion-diagnostics-channel.js +87 -66
  365. package/build/esm/dev/orchestrion-diagnostics-channel.js.map +1 -1
  366. package/build/esm/dev/package.json +1 -1
  367. package/build/esm/dev/pages-plugin.js +20 -19
  368. package/build/esm/dev/pages-plugin.js.map +1 -1
  369. package/build/esm/dev/request.js +14 -7
  370. package/build/esm/dev/request.js.map +1 -1
  371. package/build/esm/dev/scope-utils.js +12 -10
  372. package/build/esm/dev/scope-utils.js.map +1 -1
  373. package/build/esm/dev/sdk.js +23 -13
  374. package/build/esm/dev/sdk.js.map +1 -1
  375. package/build/esm/dev/transport.js +93 -84
  376. package/build/esm/dev/transport.js.map +1 -1
  377. package/build/esm/dev/utils/asyncContextStrategy.js +10 -8
  378. package/build/esm/dev/utils/asyncContextStrategy.js.map +1 -1
  379. package/build/esm/dev/utils/bindingPropagation.js +23 -0
  380. package/build/esm/dev/utils/bindingPropagation.js.map +1 -0
  381. package/build/esm/dev/utils/cloudflareTrace.js +34 -0
  382. package/build/esm/dev/utils/cloudflareTrace.js.map +1 -0
  383. package/build/esm/dev/utils/instrumentContext.js +74 -56
  384. package/build/esm/dev/utils/instrumentContext.js.map +1 -1
  385. package/build/esm/dev/utils/internalSqlQuery.js +38 -19
  386. package/build/esm/dev/utils/internalSqlQuery.js.map +1 -1
  387. package/build/esm/dev/utils/internalStorageKey.js +41 -36
  388. package/build/esm/dev/utils/internalStorageKey.js.map +1 -1
  389. package/build/esm/dev/utils/invocationContext.js +42 -30
  390. package/build/esm/dev/utils/invocationContext.js.map +1 -1
  391. package/build/esm/dev/utils/invocationScope.js +45 -19
  392. package/build/esm/dev/utils/invocationScope.js.map +1 -1
  393. package/build/esm/dev/utils/isBinding.js +47 -13
  394. package/build/esm/dev/utils/isBinding.js.map +1 -1
  395. package/build/esm/dev/utils/isCloudflareClass.js +11 -18
  396. package/build/esm/dev/utils/isCloudflareClass.js.map +1 -1
  397. package/build/esm/dev/utils/queueTraceMeta.js +32 -0
  398. package/build/esm/dev/utils/queueTraceMeta.js.map +1 -0
  399. package/build/esm/dev/utils/rpcMeta.js +37 -25
  400. package/build/esm/dev/utils/rpcMeta.js.map +1 -1
  401. package/build/esm/dev/utils/traceLinks.js +52 -40
  402. package/build/esm/dev/utils/traceLinks.js.map +1 -1
  403. package/build/esm/dev/vendor/stacktrace.js +31 -21
  404. package/build/esm/dev/vendor/stacktrace.js.map +1 -1
  405. package/build/esm/dev/vite/agentClass.js +105 -96
  406. package/build/esm/dev/vite/agentClass.js.map +1 -1
  407. package/build/esm/dev/vite/autoInstrument.js +121 -120
  408. package/build/esm/dev/vite/autoInstrument.js.map +1 -1
  409. package/build/esm/dev/vite/index.js +43 -19
  410. package/build/esm/dev/vite/index.js.map +1 -1
  411. package/build/esm/dev/vite/instrumentFile.js +37 -18
  412. package/build/esm/dev/vite/instrumentFile.js.map +1 -1
  413. package/build/esm/dev/vite/mastraObservability.js +19 -10
  414. package/build/esm/dev/vite/mastraObservability.js.map +1 -1
  415. package/build/esm/dev/vite/moduleShape.js +220 -199
  416. package/build/esm/dev/vite/moduleShape.js.map +1 -1
  417. package/build/esm/dev/vite/providedModulePlugin.js +60 -43
  418. package/build/esm/dev/vite/providedModulePlugin.js.map +1 -1
  419. package/build/esm/dev/vite/transform.js +331 -282
  420. package/build/esm/dev/vite/transform.js.map +1 -1
  421. package/build/esm/dev/vite/workerEntrypoint.js +66 -55
  422. package/build/esm/dev/vite/workerEntrypoint.js.map +1 -1
  423. package/build/esm/dev/vite/wranglerConfig.js +92 -65
  424. package/build/esm/dev/vite/wranglerConfig.js.map +1 -1
  425. package/build/esm/dev/withSentry.js +32 -24
  426. package/build/esm/dev/withSentry.js.map +1 -1
  427. package/build/esm/dev/workflows.js +165 -147
  428. package/build/esm/dev/workflows.js.map +1 -1
  429. package/build/esm/dev/wrapMethodWithSentry.js +148 -167
  430. package/build/esm/dev/wrapMethodWithSentry.js.map +1 -1
  431. package/build/esm/dev/wrapRequestHandlerWithInit.js +78 -70
  432. package/build/esm/dev/wrapRequestHandlerWithInit.js.map +1 -1
  433. package/build/esm/prod/baseSdk.js +94 -91
  434. package/build/esm/prod/baseSdk.js.map +1 -1
  435. package/build/esm/prod/client.js +213 -235
  436. package/build/esm/prod/client.js.map +1 -1
  437. package/build/esm/prod/clientCache.js +8 -6
  438. package/build/esm/prod/clientCache.js.map +1 -1
  439. package/build/esm/prod/debug-build.js +9 -3
  440. package/build/esm/prod/debug-build.js.map +1 -1
  441. package/build/esm/prod/defineCloudflareOptions.js +5 -6
  442. package/build/esm/prod/defineCloudflareOptions.js.map +1 -1
  443. package/build/esm/prod/durableobject.js +290 -161
  444. package/build/esm/prod/durableobject.js.map +1 -1
  445. package/build/esm/prod/flush.js +104 -75
  446. package/build/esm/prod/flush.js.map +1 -1
  447. package/build/esm/prod/index.js +19 -18
  448. package/build/esm/prod/instrument.js +53 -37
  449. package/build/esm/prod/instrument.js.map +1 -1
  450. package/build/esm/prod/instrumentations/agents/index.js +34 -11
  451. package/build/esm/prod/instrumentations/agents/index.js.map +1 -1
  452. package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js +46 -47
  453. package/build/esm/prod/instrumentations/agents/instrumentAgentCallableRpc.js.map +1 -1
  454. package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js +23 -14
  455. package/build/esm/prod/instrumentations/agents/instrumentAgentRequestConversation.js.map +1 -1
  456. package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js +36 -26
  457. package/build/esm/prod/instrumentations/agents/instrumentChatAgentConversation.js.map +1 -1
  458. package/build/esm/prod/instrumentations/agents/types.js +103 -56
  459. package/build/esm/prod/instrumentations/agents/types.js.map +1 -1
  460. package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js +87 -116
  461. package/build/esm/prod/instrumentations/instrumentDurableObjectHandlers.js.map +1 -1
  462. package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js +46 -42
  463. package/build/esm/prod/instrumentations/instrumentDurableObjectNamespace.js.map +1 -1
  464. package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js +70 -69
  465. package/build/esm/prod/instrumentations/instrumentDurableObjectStorage.js.map +1 -1
  466. package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js +31 -37
  467. package/build/esm/prod/instrumentations/instrumentDurableObjectSyncKvStorage.js.map +1 -1
  468. package/build/esm/prod/instrumentations/instrumentSqlStorage.js +50 -50
  469. package/build/esm/prod/instrumentations/instrumentSqlStorage.js.map +1 -1
  470. package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js +136 -121
  471. package/build/esm/prod/instrumentations/instrumentWorkerEntrypoint.js.map +1 -1
  472. package/build/esm/prod/instrumentations/worker/instrumentD1.js +131 -144
  473. package/build/esm/prod/instrumentations/worker/instrumentD1.js.map +1 -1
  474. package/build/esm/prod/instrumentations/worker/instrumentEmail.js +63 -59
  475. package/build/esm/prod/instrumentations/worker/instrumentEmail.js.map +1 -1
  476. package/build/esm/prod/instrumentations/worker/instrumentEnv.js +83 -85
  477. package/build/esm/prod/instrumentations/worker/instrumentEnv.js.map +1 -1
  478. package/build/esm/prod/instrumentations/worker/instrumentFetch.js +41 -46
  479. package/build/esm/prod/instrumentations/worker/instrumentFetch.js.map +1 -1
  480. package/build/esm/prod/instrumentations/worker/instrumentFetcher.js +25 -19
  481. package/build/esm/prod/instrumentations/worker/instrumentFetcher.js.map +1 -1
  482. package/build/esm/prod/instrumentations/worker/instrumentKV.js +54 -65
  483. package/build/esm/prod/instrumentations/worker/instrumentKV.js.map +1 -1
  484. package/build/esm/prod/instrumentations/worker/instrumentQueue.js +100 -74
  485. package/build/esm/prod/instrumentations/worker/instrumentQueue.js.map +1 -1
  486. package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js +91 -73
  487. package/build/esm/prod/instrumentations/worker/instrumentQueueProducer.js.map +1 -1
  488. package/build/esm/prod/instrumentations/worker/instrumentR2.js +128 -113
  489. package/build/esm/prod/instrumentations/worker/instrumentR2.js.map +1 -1
  490. package/build/esm/prod/instrumentations/worker/instrumentScheduled.js +90 -92
  491. package/build/esm/prod/instrumentations/worker/instrumentScheduled.js.map +1 -1
  492. package/build/esm/prod/instrumentations/worker/instrumentTail.js +100 -53
  493. package/build/esm/prod/instrumentations/worker/instrumentTail.js.map +1 -1
  494. package/build/esm/prod/integrations/cronTriggers.js +129 -82
  495. package/build/esm/prod/integrations/cronTriggers.js.map +1 -1
  496. package/build/esm/prod/integrations/fetch.js +9 -6
  497. package/build/esm/prod/integrations/fetch.js.map +1 -1
  498. package/build/esm/prod/integrations/httpServer.js +40 -19
  499. package/build/esm/prod/integrations/httpServer.js.map +1 -1
  500. package/build/esm/prod/integrations/spotlight.js +51 -52
  501. package/build/esm/prod/integrations/spotlight.js.map +1 -1
  502. package/build/esm/prod/opentelemetry/tracer.js +10 -6
  503. package/build/esm/prod/opentelemetry/tracer.js.map +1 -1
  504. package/build/esm/prod/options.js +37 -22
  505. package/build/esm/prod/options.js.map +1 -1
  506. package/build/esm/prod/orchestrion-deferred-channels.js +45 -27
  507. package/build/esm/prod/orchestrion-deferred-channels.js.map +1 -1
  508. package/build/esm/prod/orchestrion-diagnostics-channel.js +87 -66
  509. package/build/esm/prod/orchestrion-diagnostics-channel.js.map +1 -1
  510. package/build/esm/prod/package.json +1 -1
  511. package/build/esm/prod/pages-plugin.js +20 -19
  512. package/build/esm/prod/pages-plugin.js.map +1 -1
  513. package/build/esm/prod/request.js +14 -7
  514. package/build/esm/prod/request.js.map +1 -1
  515. package/build/esm/prod/scope-utils.js +12 -10
  516. package/build/esm/prod/scope-utils.js.map +1 -1
  517. package/build/esm/prod/sdk.js +23 -13
  518. package/build/esm/prod/sdk.js.map +1 -1
  519. package/build/esm/prod/transport.js +93 -84
  520. package/build/esm/prod/transport.js.map +1 -1
  521. package/build/esm/prod/utils/asyncContextStrategy.js +10 -8
  522. package/build/esm/prod/utils/asyncContextStrategy.js.map +1 -1
  523. package/build/esm/prod/utils/bindingPropagation.js +23 -0
  524. package/build/esm/prod/utils/bindingPropagation.js.map +1 -0
  525. package/build/esm/prod/utils/cloudflareTrace.js +34 -0
  526. package/build/esm/prod/utils/cloudflareTrace.js.map +1 -0
  527. package/build/esm/prod/utils/instrumentContext.js +74 -56
  528. package/build/esm/prod/utils/instrumentContext.js.map +1 -1
  529. package/build/esm/prod/utils/internalSqlQuery.js +38 -19
  530. package/build/esm/prod/utils/internalSqlQuery.js.map +1 -1
  531. package/build/esm/prod/utils/internalStorageKey.js +41 -36
  532. package/build/esm/prod/utils/internalStorageKey.js.map +1 -1
  533. package/build/esm/prod/utils/invocationContext.js +42 -30
  534. package/build/esm/prod/utils/invocationContext.js.map +1 -1
  535. package/build/esm/prod/utils/invocationScope.js +45 -19
  536. package/build/esm/prod/utils/invocationScope.js.map +1 -1
  537. package/build/esm/prod/utils/isBinding.js +47 -13
  538. package/build/esm/prod/utils/isBinding.js.map +1 -1
  539. package/build/esm/prod/utils/isCloudflareClass.js +11 -18
  540. package/build/esm/prod/utils/isCloudflareClass.js.map +1 -1
  541. package/build/esm/prod/utils/queueTraceMeta.js +32 -0
  542. package/build/esm/prod/utils/queueTraceMeta.js.map +1 -0
  543. package/build/esm/prod/utils/rpcMeta.js +37 -25
  544. package/build/esm/prod/utils/rpcMeta.js.map +1 -1
  545. package/build/esm/prod/utils/traceLinks.js +52 -40
  546. package/build/esm/prod/utils/traceLinks.js.map +1 -1
  547. package/build/esm/prod/vendor/stacktrace.js +31 -21
  548. package/build/esm/prod/vendor/stacktrace.js.map +1 -1
  549. package/build/esm/prod/vite/agentClass.js +105 -96
  550. package/build/esm/prod/vite/agentClass.js.map +1 -1
  551. package/build/esm/prod/vite/autoInstrument.js +121 -120
  552. package/build/esm/prod/vite/autoInstrument.js.map +1 -1
  553. package/build/esm/prod/vite/index.js +43 -19
  554. package/build/esm/prod/vite/index.js.map +1 -1
  555. package/build/esm/prod/vite/instrumentFile.js +37 -18
  556. package/build/esm/prod/vite/instrumentFile.js.map +1 -1
  557. package/build/esm/prod/vite/mastraObservability.js +19 -10
  558. package/build/esm/prod/vite/mastraObservability.js.map +1 -1
  559. package/build/esm/prod/vite/moduleShape.js +220 -199
  560. package/build/esm/prod/vite/moduleShape.js.map +1 -1
  561. package/build/esm/prod/vite/providedModulePlugin.js +60 -43
  562. package/build/esm/prod/vite/providedModulePlugin.js.map +1 -1
  563. package/build/esm/prod/vite/transform.js +331 -282
  564. package/build/esm/prod/vite/transform.js.map +1 -1
  565. package/build/esm/prod/vite/workerEntrypoint.js +66 -55
  566. package/build/esm/prod/vite/workerEntrypoint.js.map +1 -1
  567. package/build/esm/prod/vite/wranglerConfig.js +92 -65
  568. package/build/esm/prod/vite/wranglerConfig.js.map +1 -1
  569. package/build/esm/prod/withSentry.js +32 -24
  570. package/build/esm/prod/withSentry.js.map +1 -1
  571. package/build/esm/prod/workflows.js +165 -147
  572. package/build/esm/prod/workflows.js.map +1 -1
  573. package/build/esm/prod/wrapMethodWithSentry.js +148 -167
  574. package/build/esm/prod/wrapMethodWithSentry.js.map +1 -1
  575. package/build/esm/prod/wrapRequestHandlerWithInit.js +78 -70
  576. package/build/esm/prod/wrapRequestHandlerWithInit.js.map +1 -1
  577. package/build/types/client.d.ts +32 -1
  578. package/build/types/client.d.ts.map +1 -1
  579. package/build/types/durableobject.d.ts.map +1 -1
  580. package/build/types/index.d.ts +3 -2
  581. package/build/types/index.d.ts.map +1 -1
  582. package/build/types/instrumentations/worker/instrumentEmail.d.ts.map +1 -1
  583. package/build/types/instrumentations/worker/instrumentEnv.d.ts +1 -1
  584. package/build/types/instrumentations/worker/instrumentEnv.d.ts.map +1 -1
  585. package/build/types/instrumentations/worker/instrumentFetcher.d.ts.map +1 -1
  586. package/build/types/instrumentations/worker/instrumentQueue.d.ts.map +1 -1
  587. package/build/types/instrumentations/worker/instrumentQueueProducer.d.ts +1 -1
  588. package/build/types/instrumentations/worker/instrumentQueueProducer.d.ts.map +1 -1
  589. package/build/types/instrumentations/worker/instrumentScheduled.d.ts.map +1 -1
  590. package/build/types/instrumentations/worker/instrumentTail.d.ts +4 -2
  591. package/build/types/instrumentations/worker/instrumentTail.d.ts.map +1 -1
  592. package/build/types/utils/{rpcPropagation.d.ts → bindingPropagation.d.ts} +6 -1
  593. package/build/types/utils/bindingPropagation.d.ts.map +1 -0
  594. package/build/types/utils/cloudflareTrace.d.ts +13 -0
  595. package/build/types/utils/cloudflareTrace.d.ts.map +1 -0
  596. package/build/types/utils/queueTraceMeta.d.ts +7 -0
  597. package/build/types/utils/queueTraceMeta.d.ts.map +1 -0
  598. package/build/types/vite/autoInstrument.d.ts.map +1 -1
  599. package/build/types/vite/index.d.ts.map +1 -1
  600. package/build/types/vite/providedModulePlugin.d.ts +15 -11
  601. package/build/types/vite/providedModulePlugin.d.ts.map +1 -1
  602. package/build/types/workflows.d.ts.map +1 -1
  603. package/build/types/wrapMethodWithSentry.d.ts.map +1 -1
  604. package/build/types/wrapRequestHandlerWithInit.d.ts.map +1 -1
  605. package/package.json +20 -21
  606. package/build/cjs/dev/index.js.map +0 -1
  607. package/build/cjs/dev/utils/rpcPropagation.js +0 -15
  608. package/build/cjs/dev/utils/rpcPropagation.js.map +0 -1
  609. package/build/cjs/dev/vite/flueRuntime.js +0 -15
  610. package/build/cjs/dev/vite/flueRuntime.js.map +0 -1
  611. package/build/cjs/prod/index.js.map +0 -1
  612. package/build/cjs/prod/utils/rpcPropagation.js +0 -15
  613. package/build/cjs/prod/utils/rpcPropagation.js.map +0 -1
  614. package/build/cjs/prod/vite/flueRuntime.js +0 -15
  615. package/build/cjs/prod/vite/flueRuntime.js.map +0 -1
  616. package/build/esm/dev/index.js.map +0 -1
  617. package/build/esm/dev/utils/rpcPropagation.js +0 -13
  618. package/build/esm/dev/utils/rpcPropagation.js.map +0 -1
  619. package/build/esm/dev/vite/flueRuntime.js +0 -13
  620. package/build/esm/dev/vite/flueRuntime.js.map +0 -1
  621. package/build/esm/prod/index.js.map +0 -1
  622. package/build/esm/prod/utils/rpcPropagation.js +0 -13
  623. package/build/esm/prod/utils/rpcPropagation.js.map +0 -1
  624. package/build/esm/prod/vite/flueRuntime.js +0 -13
  625. package/build/esm/prod/vite/flueRuntime.js.map +0 -1
  626. package/build/types/utils/rpcPropagation.d.ts.map +0 -1
  627. package/build/types/vite/flueRuntime.d.ts +0 -12
  628. package/build/types/vite/flueRuntime.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"wrapRequestHandlerWithInit.js","sources":["../../../src/wrapRequestHandlerWithInit.ts"],"sourcesContent":["import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';\nimport { NETWORK_PROTOCOL_NAME, NETWORK_PROTOCOL_VERSION } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport { getIsolationScope, safeCallback } from '@sentry/core';\nimport { wrapServerRequestHandler } from '@sentry/server-utils/request-handler';\nimport { DEBUG_BUILD } from './debug-build';\nimport { getHttpServerRequestOptions } from './integrations/httpServer';\nimport { flushDeferredChannelEvents } from './orchestrion-deferred-channels';\nimport type { CloudflareClient, CloudflareOptions } from './client';\nimport type { ExecutionContextCompat } from './executionContext';\nimport { flushAndDispose, getOriginalWaitUntil } from './flush';\nimport { addCloudResourceContext, addCultureContext } from './scope-utils';\nimport { getInvocationState, getInvocationWaitUntil } from './utils/invocationContext';\nimport { withInvocationIsolationScope } from './utils/invocationScope';\n\nfunction getRequestErrorMechanismType(context: ExecutionContextCompat | undefined): string {\n // Durable Object fetch handlers use DO state as context (see instrumentDurableObjectWithSentry)\n return context && 'storage' in context ? 'auto.faas.cloudflare.durable_object' : 'auto.http.cloudflare';\n}\n\nexport interface RequestHandlerWrapperOptions {\n options: CloudflareOptions;\n request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;\n context: ExecutionContextCompat | undefined;\n /**\n * If true, errors will be captured, rethrown and sent to Sentry.\n * Otherwise, errors are rethrown but not captured.\n *\n * You most likely don't want to set this to `false`, if you use `wrapRequestHandler` directly.\n * This is primarily meant as an escape hatch for higher-level SDKs relying on additional error\n * capturing mechanisms where this wrapper captures errors too early or too generally.\n *\n * @default true\n */\n captureErrors?: boolean;\n}\n\ntype InitSdk = (options: CloudflareOptions) => CloudflareClient | undefined;\n\n/**\n * Same as {@link wrapRequestHandler}, but with the SDK initialization injected.\n *\n * Wrappers that are only reachable from the main entry point — where `nodejs_compat` is a\n * requirement anyway — pass `init` from `sdk.ts` so `enableOpenTelemetrySetup` is honored.\n *\n * @internal\n */\nexport function wrapRequestHandlerWithInit(\n wrapperOptions: RequestHandlerWrapperOptions,\n handler: (...args: unknown[]) => Response | Promise<Response>,\n initSdk: InitSdk,\n): Promise<Response> {\n return withInvocationIsolationScope(async isolationScope => {\n const { options, request, captureErrors = true } = wrapperOptions;\n const context = wrapperOptions.context;\n\n // The un-instrumented waitUntil, so flushAndDispose cannot deadlock on the flush\n // lock's own wrapper. Resolved once per invocation and cached on its state; reading\n // `ctx.waitUntil` on a native context is a runtime getter call.\n const invocationState = getInvocationState();\n const waitUntil = invocationState\n ? getInvocationWaitUntil(invocationState)\n : context\n ? getOriginalWaitUntil(context).bind(context)\n : undefined;\n\n const client = initSdk({ ...options, ctx: context });\n isolationScope.setClient(client);\n\n // Emit any orchestrion channel events deferred at module scope (e.g. a top-level\n // `const app = new Hono()` wrapped by build-time instrumentation): we're now in a\n // request, where workerd allows publish, and init() above has registered subscribers.\n flushDeferredChannelEvents();\n\n addCloudResourceContext(isolationScope);\n const attributes: SpanAttributes = {};\n if (request.cf) {\n addCultureContext(isolationScope, request.cf);\n\n if (typeof request.cf.httpProtocol === 'string') {\n const [protocolName, protocolVersion] = request.cf.httpProtocol.toLowerCase().split('/');\n attributes[NETWORK_PROTOCOL_NAME] = protocolName;\n attributes[NETWORK_PROTOCOL_VERSION] = protocolVersion;\n }\n }\n\n if (!client) {\n try {\n return await handler();\n } finally {\n waitUntil?.(flushAndDispose(client));\n }\n }\n\n // Note: The span will not have a duration unless I/O happens in the handler. This is\n // because of how the cloudflare workers runtime works.\n // See: https://developers.cloudflare.com/workers/runtime-apis/performance/\n return wrapServerRequestHandler(\n {\n request,\n client,\n // Without `AsyncLocalStorage`, `withInvocationIsolationScope` does not fork, and the scope it\n // passes in is not the current one. The request data has to go on the current scope, where\n // events captured in the handler read it.\n isolationScope: getIsolationScope(),\n options: getHttpServerRequestOptions(client),\n origin: 'auto.http.cloudflare',\n mechanism: captureErrors ? { handled: false, type: getRequestErrorMechanismType(context) } : undefined,\n attributes,\n isStreamingResponse: response => {\n const classification = safeCallback(\n DEBUG_BUILD ? 'Error in `isStreamingResponse`, using the default classification:' : '',\n () => options.isStreamingResponse?.(response, request),\n () => undefined,\n );\n // An async callback returns a promise, which would otherwise count as `true`.\n return typeof classification === 'boolean' ? classification : undefined;\n },\n onDone: response => {\n // Don't dispose for protocol upgrades (101 Switching Protocols) - the connection stays alive.\n // This includes WebSocket upgrades where webSocketMessage/webSocketClose handlers\n // will still be called and may need the client to capture errors.\n if (response?.status === 101) {\n waitUntil?.(client.flush(2000));\n } else {\n waitUntil?.(flushAndDispose(client));\n }\n },\n },\n () => handler(),\n );\n }, wrapperOptions.context);\n}\n"],"names":["withInvocationIsolationScope","getInvocationState","getInvocationWaitUntil","getOriginalWaitUntil","flushDeferredChannelEvents","addCloudResourceContext","attributes","addCultureContext","NETWORK_PROTOCOL_NAME","NETWORK_PROTOCOL_VERSION","flushAndDispose","wrapServerRequestHandler","getIsolationScope","getHttpServerRequestOptions","safeCallback","DEBUG_BUILD"],"mappings":";;;;;;;;;;;;;AAeA,SAAS,6BAA6B,OAAA,EAAqD;AAEzF,EAAA,OAAO,OAAA,IAAW,SAAA,IAAa,OAAA,GAAU,qCAAA,GAAwC,sBAAA;AACnF;AA6BO,SAAS,0BAAA,CACd,cAAA,EACA,OAAA,EACA,OAAA,EACmB;AACnB,EAAA,OAAOA,4CAAA,CAA6B,OAAM,cAAA,KAA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A;AAAA,QACA,MAAA;AAAA;AAAA;AAAA;AAAA,QAIA,gBAAgBC,sBAAA,EAAkB;AAAA,QAClC,OAAA,EAASC,uCAA4B,MAAM,CAAA;AAAA,QAC3C,MAAA,EAAQ,sBAAA;AAAA,QACR,SAAA,EAAW,gBAAgB,EAAE,OAAA,EAAS,OAAO,IAAA,EAAM,4BAAA,CAA6B,OAAO,CAAA,EAAE,GAAI,MAAA;AAAA,oBAC7FP,YAAA;AAAA,QACA,qBAAqB,CAAA,QAAA,KAAY;AAC/B,UAAA,MAAM,cAAA,GAAiBQ,iBAAA;AAAA,YACrBC,yBAAc,mEAAA,GAAsE,EAAA;AAAA,YACpF,MAAM,OAAA,CAAQ,mBAAA,GAAsB,QAAA,EAAU,OAAO,CAAA;AAAA,YACrD,MAAM;AAAA,WACR;AAEA,UAAA,OAAO,OAAO,cAAA,KAAmB,SAAA,GAAY,cAAA,GAAiB,MAAA;AAAA,QAChE,CAAA;AAAA,QACA,QAAQ,CAAA,QAAA,KAAY;AAIlB,UAAA,IAAI,QAAA,EAAU,WAAW,GAAA,EAAK;AAC5B,YAAA,SAAA,GAAY,MAAA,CAAO,KAAA,CAAM,GAAI,CAAC,CAAA;AAAA,UAChC,CAAA,MAAO;AACL,YAAA,SAAA,GAAYL,qBAAA,CAAgB,MAAM,CAAC,CAAA;AAAA,UACrC;AAAA,QACF;AAAA,OACF;AAAA,MACA,MAAM,OAAA;AAAQ,KAChB;AAAA,EACF,CAAA,EAAG,eAAe,OAAO,CAAA;AAC3B;;;;"}
1
+ {"version":3,"file":"wrapRequestHandlerWithInit.js","names":["withInvocationIsolationScope","getInvocationState","getInvocationWaitUntil","getOriginalWaitUntil","setScopeFlushedByRuntime","flushDeferredChannelEvents","handleServedTunnelRequest","flushAndDispose","addCloudResourceContext","addCultureContext","NETWORK_PROTOCOL_NAME","NETWORK_PROTOCOL_VERSION","wrapServerRequestHandler","getIsolationScope","getHttpServerRequestOptions","continueCloudflareTrace","safeCallback","DEBUG_BUILD"],"sources":["../../../src/wrapRequestHandlerWithInit.ts"],"sourcesContent":["import type { CfProperties, IncomingRequestCfProperties } from '@cloudflare/workers-types';\nimport { NETWORK_PROTOCOL_NAME, NETWORK_PROTOCOL_VERSION } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport { getIsolationScope, safeCallback } from '@sentry/core';\nimport {\n _INTERNAL_handleServedTunnelRequest as handleServedTunnelRequest,\n _INTERNAL_setScopeFlushedByRuntime as setScopeFlushedByRuntime,\n} from '@sentry/core/server';\nimport { wrapServerRequestHandler } from '@sentry/server-utils/request-handler';\nimport { DEBUG_BUILD } from './debug-build';\nimport { getHttpServerRequestOptions } from './integrations/httpServer';\nimport { flushDeferredChannelEvents } from './orchestrion-deferred-channels';\nimport type { CloudflareClient, CloudflareOptions } from './client';\nimport type { ExecutionContextCompat } from './executionContext';\nimport { flushAndDispose, getOriginalWaitUntil } from './flush';\nimport { addCloudResourceContext, addCultureContext } from './scope-utils';\nimport { continueCloudflareTrace } from './utils/cloudflareTrace';\nimport { getInvocationState, getInvocationWaitUntil } from './utils/invocationContext';\nimport { withInvocationIsolationScope } from './utils/invocationScope';\n\nfunction isDurableObjectContext(context: ExecutionContextCompat | undefined): boolean {\n // Durable Object fetch handlers use DO state as context (see instrumentDurableObjectWithSentry)\n return !!context && 'storage' in context;\n}\n\nfunction getRequestErrorMechanismType(context: ExecutionContextCompat | undefined): string {\n return isDurableObjectContext(context) ? 'auto.faas.cloudflare.durable_object' : 'auto.http.cloudflare';\n}\n\nexport interface RequestHandlerWrapperOptions {\n options: CloudflareOptions;\n request: Request<unknown, IncomingRequestCfProperties<unknown> | CfProperties<unknown>>;\n context: ExecutionContextCompat | undefined;\n /**\n * If true, errors will be captured, rethrown and sent to Sentry.\n * Otherwise, errors are rethrown but not captured.\n *\n * You most likely don't want to set this to `false`, if you use `wrapRequestHandler` directly.\n * This is primarily meant as an escape hatch for higher-level SDKs relying on additional error\n * capturing mechanisms where this wrapper captures errors too early or too generally.\n *\n * @default true\n */\n captureErrors?: boolean;\n}\n\ntype InitSdk = (options: CloudflareOptions) => CloudflareClient | undefined;\n\n/**\n * Same as {@link wrapRequestHandler}, but with the SDK initialization injected.\n *\n * Wrappers that are only reachable from the main entry point — where `nodejs_compat` is a\n * requirement anyway — pass `init` from `sdk.ts` so `enableOpenTelemetrySetup` is honored.\n *\n * @internal\n */\nexport function wrapRequestHandlerWithInit(\n wrapperOptions: RequestHandlerWrapperOptions,\n handler: (...args: unknown[]) => Response | Promise<Response>,\n initSdk: InitSdk,\n): Promise<Response> {\n return withInvocationIsolationScope(async isolationScope => {\n const { options, request, captureErrors = true } = wrapperOptions;\n const context = wrapperOptions.context;\n\n // The un-instrumented waitUntil, so flushAndDispose cannot deadlock on the flush\n // lock's own wrapper. Resolved once per invocation and cached on its state; reading\n // `ctx.waitUntil` on a native context is a runtime getter call.\n const invocationState = getInvocationState();\n const waitUntil = invocationState\n ? getInvocationWaitUntil(invocationState)\n : context\n ? getOriginalWaitUntil(context).bind(context)\n : undefined;\n\n const client = initSdk({ ...options, ctx: context });\n isolationScope.setClient(client);\n\n // This wrap flushes through `waitUntil` once the response is sent, so a framework's own `flushIfServerless()`\n // (e.g. the Astro middleware on Pages) would only hold the response for a flush that is coming anyway.\n if (waitUntil) {\n setScopeFlushedByRuntime(isolationScope);\n }\n\n // Emit any orchestrion channel events deferred at module scope (e.g. a top-level\n // `const app = new Hono()` wrapped by build-time instrumentation): we're now in a\n // request, where workerd allows publish, and init() above has registered subscribers.\n flushDeferredChannelEvents();\n\n // The tunnel answers these before the app, with no span. A Durable Object is only reached through the Worker,\n // which answered them already.\n const tunnelResponse = !isDurableObjectContext(context) && handleServedTunnelRequest(request, client);\n if (tunnelResponse) {\n return tunnelResponse.finally(() => waitUntil?.(flushAndDispose(client)));\n }\n\n addCloudResourceContext(isolationScope);\n const attributes: SpanAttributes = {};\n if (request.cf) {\n addCultureContext(isolationScope, request.cf);\n\n if (typeof request.cf.httpProtocol === 'string') {\n const [protocolName, protocolVersion] = request.cf.httpProtocol.toLowerCase().split('/');\n attributes[NETWORK_PROTOCOL_NAME] = protocolName;\n attributes[NETWORK_PROTOCOL_VERSION] = protocolVersion;\n }\n }\n\n if (!client) {\n try {\n return await handler();\n } finally {\n waitUntil?.(flushAndDispose(client));\n }\n }\n\n // Note: The span will not have a duration unless I/O happens in the handler. This is\n // because of how the cloudflare workers runtime works.\n // See: https://developers.cloudflare.com/workers/runtime-apis/performance/\n return wrapServerRequestHandler(\n {\n request,\n client,\n // Without `AsyncLocalStorage`, `withInvocationIsolationScope` does not fork, and the scope it\n // passes in is not the current one. The request data has to go on the current scope, where\n // events captured in the handler read it.\n isolationScope: getIsolationScope(),\n options: getHttpServerRequestOptions(client),\n origin: 'auto.http.cloudflare',\n mechanism: captureErrors ? { handled: false, type: getRequestErrorMechanismType(context) } : undefined,\n attributes,\n onTraceContinued: () => continueCloudflareTrace(context),\n isStreamingResponse: response => {\n const classification = safeCallback(\n DEBUG_BUILD ? 'Error in `isStreamingResponse`, using the default classification:' : '',\n () => options.isStreamingResponse?.(response, request),\n () => undefined,\n );\n // An async callback returns a promise, which would otherwise count as `true`.\n return typeof classification === 'boolean' ? classification : undefined;\n },\n onDone: response => {\n // Don't dispose for protocol upgrades (101 Switching Protocols) - the connection stays alive.\n // This includes WebSocket upgrades where webSocketMessage/webSocketClose handlers\n // will still be called and may need the client to capture errors.\n if (response?.status === 101) {\n waitUntil?.(client.flush(2000));\n } else {\n waitUntil?.(flushAndDispose(client));\n }\n },\n },\n () => handler(),\n );\n }, wrapperOptions.context);\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAS,uBAAuB,SAAsD;CAEpF,OAAO,CAAC,CAAC,WAAW,aAAa;AACnC;AAEA,SAAS,6BAA6B,SAAqD;CACzF,OAAO,uBAAuB,OAAO,IAAI,wCAAwC;AACnF;;;;;;;;;AA6BA,SAAgB,2BACd,gBACA,SACA,SACmB;CACnB,OAAOA,wBAAAA,6B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AO;GAAE,IAAI,KAAA;GAC7F;GACA,wBAAwBC,wBAAAA,wBAAwB,OAAO;GACvD,sBAAqB,aAAY;IAC/B,MAAM,kBAAA,GAAiBC,aAAAA,aAAAA,CACrBC,oBAAAA,cAAc,sEAAsE,UAC9E,QAAQ,sBAAsB,UAAU,OAAO,SAC/C,KAAA,CACR;IAEA,OAAO,OAAO,mBAAmB,YAAY,iBAAiB,KAAA;GAChE;GACA,SAAQ,aAAY;IAIlB,IAAI,UAAU,WAAW,KACvB,YAAY,OAAO,MAAM,GAAI,CAAC;SAE9B,YAAYV,cAAAA,gBAAgB,MAAM,CAAC;GAEvC;EACF,SACM,QAAQ,CAChB;CACF,GAAG,eAAe,OAAO;AAC3B"}
@@ -0,0 +1,22 @@
1
+ // \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ exports.__toESM = __toESM;
@@ -1,101 +1,102 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const client = require('./client.js');
5
- const flush = require('./flush.js');
6
- const clientCache = require('./clientCache.js');
7
- const debugBuild = require('./debug-build.js');
8
- const fetch = require('./integrations/fetch.js');
9
- const httpServer = require('./integrations/httpServer.js');
10
- const transport = require('./transport.js');
11
- const stacktrace = require('./vendor/stacktrace.js');
12
-
1
+ const require_client = require("./client.js");
2
+ const require_flush = require("./flush.js");
3
+ const require_clientCache = require("./clientCache.js");
4
+ const require_debug_build = require("./debug-build.js");
5
+ const require_fetch = require("./integrations/fetch.js");
6
+ const require_httpServer = require("./integrations/httpServer.js");
7
+ const require_transport = require("./transport.js");
8
+ const require_stacktrace = require("./vendor/stacktrace.js");
9
+ let _sentry_core = require("@sentry/core");
10
+ // src/baseSdk.ts
11
+ /**
12
+ * Instantiate the channel-subscriber factories the `@sentry/cloudflare/vite`
13
+ * plugin registered on the global marker. The plugin splices a small snippet
14
+ * into each instrumented module that `.set`s its factory here (keyed by module
15
+ * name), so the marker holds one factory per package actually bundled.
16
+ *
17
+ * The marker is read directly instead of importing the factories, so a worker
18
+ * built without the plugin — where the channels never fire — ships none of this
19
+ * code.
20
+ */
13
21
  function getRegisteredChannelIntegrations() {
14
- const registered = core.GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;
15
- return registered ? [...registered.values()].map((factory) => factory()) : [];
22
+ const registered = _sentry_core.GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;
23
+ return registered ? [...registered.values()].map((factory) => factory()) : [];
16
24
  }
25
+ /**
26
+ * Get the default integrations for the Cloudflare SDK.
27
+ * These also work on Workers-compatible runtimes without the `nodejs_compat` compatibility flag.
28
+ */
17
29
  function getDefaultIntegrations(options) {
18
- return [
19
- // The Dedupe integration should not be used in workflows because we want to
20
- // capture all step failures, even if they are the same error.
21
- ...options.enableDedupe === false ? [] : [core.dedupeIntegration()],
22
- core.eventFiltersIntegration(),
23
- core.functionToStringIntegration(),
24
- core.conversationIdIntegration(),
25
- core.linkedErrorsIntegration(),
26
- fetch.fetchIntegration(),
27
- httpServer.httpServerIntegration(),
28
- core.requestDataIntegration(),
29
- core.consoleIntegration(),
30
- // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The
31
- // `@sentry/cloudflare/vite` plugin injects the channels at build time and,
32
- // next to each, a snippet that registers the matching subscriber factory on
33
- // the global marker. Read from there instead of importing them so bundles
34
- // built without the plugin — where the channels would never fire — don't
35
- // ship the code.
36
- ...getRegisteredChannelIntegrations()
37
- ];
30
+ return [
31
+ ...options.enableDedupe === false ? [] : [(0, _sentry_core.dedupeIntegration)()],
32
+ (0, _sentry_core.eventFiltersIntegration)(),
33
+ (0, _sentry_core.functionToStringIntegration)(),
34
+ (0, _sentry_core.conversationIdIntegration)(),
35
+ (0, _sentry_core.linkedErrorsIntegration)(),
36
+ require_fetch.fetchIntegration(),
37
+ require_httpServer.httpServerIntegration(),
38
+ (0, _sentry_core.requestDataIntegration)(),
39
+ (0, _sentry_core.consoleIntegration)(),
40
+ ...getRegisteredChannelIntegrations()
41
+ ];
38
42
  }
43
+ /**
44
+ * Initializes the Cloudflare SDK without setting up an OpenTelemetry tracer provider.
45
+ *
46
+ * Kept separate from `sdk.ts` so `@sentry/cloudflare/request` can load without Node.js-only
47
+ * dependencies on runtimes such as Shopify Oxygen.
48
+ *
49
+ * The client is cached and reused across invocations within the same isolate,
50
+ * unless `cacheClient: false` is passed. This avoids the
51
+ * per-invocation cost of constructing a new client, and it is what makes
52
+ * Durable Object telemetry reliable: a per-invocation client is disposed at
53
+ * the end of the handler, and in a Durable Object there is no `waitUntil`
54
+ * boundary that reliably extends execution, so spans/events that end after
55
+ * disposal would otherwise be lost.
56
+ */
39
57
  function initBaseSdk(options) {
40
- const cached = clientCache.getCachedClient();
41
- const cacheEnabled = options.cacheClient !== false;
42
- if (cacheEnabled && cached && !core._INTERNAL_isClientClosed(cached)) {
43
- if (debugBuild.DEBUG_BUILD && cached.getOptions().dsn !== options.dsn) {
44
- core.debug.warn(
45
- "[Sentry] init() was called with a different DSN than the cached client of this isolate; the cached client keeps its DSN. Pass `cacheClient: false` for per-invocation options."
46
- );
47
- }
48
- core.getCurrentScope().update(options.initialScope);
49
- core.setCurrentClient(cached);
50
- return cached;
51
- }
52
- const usesSdkDefaults = options.defaultIntegrations === void 0 || !!options._extendsDefaultIntegrations;
53
- if (options.defaultIntegrations === void 0) {
54
- options.defaultIntegrations = getDefaultIntegrations(options);
55
- }
56
- const invocationContext = options.ctx;
57
- const flushLock = !cacheEnabled && invocationContext ? flush.makeFlushLock(invocationContext) : void 0;
58
- delete options.ctx;
59
- const clientOptions = {
60
- ...options,
61
- cacheClient: cacheEnabled,
62
- stackParser: core.stackParserFromStackParserOptions(options.stackParser || stacktrace.defaultStackParser),
63
- integrations: core.getIntegrationsToSetup(options),
64
- transport: options.transport || transport.makeCloudflareTransport,
65
- flushLock
66
- };
67
- if (!cacheEnabled) {
68
- core.getCurrentScope().setClient(void 0);
69
- }
70
- const client$1 = core.initAndBind(client.CloudflareClient, clientOptions);
71
- if (cacheEnabled && client$1) {
72
- clientCache.cacheClient(client$1);
73
- }
74
- const userIntegrations = options.integrations;
75
- client$1.on("orchestrion.module-injected", (moduleName) => {
76
- const factory = core.GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations?.get(moduleName);
77
- if (!usesSdkDefaults || !factory) {
78
- return;
79
- }
80
- const integration = factory();
81
- if (typeof userIntegrations !== "function") {
82
- client$1.addIntegration(integration);
83
- return;
84
- }
85
- const kept = core.safeCallback(
86
- debugBuild.DEBUG_BUILD ? "Error in the `integrations` function, skipping a late-loaded integration:" : "",
87
- () => core.getIntegrationsToSetup({ defaultIntegrations: [integration], integrations: userIntegrations }).find(
88
- ({ name }) => name === integration.name
89
- ),
90
- () => void 0
91
- );
92
- if (kept) {
93
- client$1.addIntegration(kept);
94
- }
95
- });
96
- return client$1;
58
+ const cached = require_clientCache.getCachedClient();
59
+ const cacheEnabled = options.cacheClient !== false;
60
+ if (cacheEnabled && cached && !(0, _sentry_core._INTERNAL_isClientClosed)(cached)) {
61
+ if (require_debug_build.DEBUG_BUILD && cached.getOptions().dsn !== options.dsn) _sentry_core.debug.warn("[Sentry] init() was called with a different DSN than the cached client of this isolate; the cached client keeps its DSN. Pass `cacheClient: false` for per-invocation options.");
62
+ (0, _sentry_core.getCurrentScope)().update(options.initialScope);
63
+ (0, _sentry_core.setCurrentClient)(cached);
64
+ return cached;
65
+ }
66
+ const usesSdkDefaults = options.defaultIntegrations === void 0 || !!options._extendsDefaultIntegrations;
67
+ if (options.defaultIntegrations === void 0) options.defaultIntegrations = getDefaultIntegrations(options);
68
+ const invocationContext = options.ctx;
69
+ const flushLock = !cacheEnabled && invocationContext ? require_flush.makeFlushLock(invocationContext) : void 0;
70
+ delete options.ctx;
71
+ const clientOptions = {
72
+ ...options,
73
+ cacheClient: cacheEnabled,
74
+ stackParser: (0, _sentry_core.stackParserFromStackParserOptions)(options.stackParser || require_stacktrace.defaultStackParser),
75
+ integrations: (0, _sentry_core.getIntegrationsToSetup)(options),
76
+ transport: options.transport || require_transport.makeCloudflareTransport,
77
+ flushLock
78
+ };
79
+ if (!cacheEnabled) (0, _sentry_core.getCurrentScope)().setClient(void 0);
80
+ const client = (0, _sentry_core.initAndBind)(require_client.CloudflareClient, clientOptions);
81
+ if (cacheEnabled && client) require_clientCache.cacheClient(client);
82
+ const userIntegrations = options.integrations;
83
+ client.on("orchestrion.module-injected", (moduleName) => {
84
+ const factory = _sentry_core.GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations?.get(moduleName);
85
+ if (!usesSdkDefaults || !factory) return;
86
+ const integration = factory();
87
+ if (typeof userIntegrations !== "function") {
88
+ client.addIntegration(integration);
89
+ return;
90
+ }
91
+ const kept = (0, _sentry_core.safeCallback)(require_debug_build.DEBUG_BUILD ? "Error in the `integrations` function, skipping a late-loaded integration:" : "", () => (0, _sentry_core.getIntegrationsToSetup)({
92
+ defaultIntegrations: [integration],
93
+ integrations: userIntegrations
94
+ }).find(({ name }) => name === integration.name), () => void 0);
95
+ if (kept) client.addIntegration(kept);
96
+ });
97
+ return client;
97
98
  }
98
-
99
99
  exports.getDefaultIntegrations = getDefaultIntegrations;
100
100
  exports.initBaseSdk = initBaseSdk;
101
- //# sourceMappingURL=baseSdk.js.map
101
+
102
+ //# sourceMappingURL=baseSdk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseSdk.js","sources":["../../../src/baseSdk.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { _INTERNAL_isClientClosed, debug, getCurrentScope, safeCallback, setCurrentClient } from '@sentry/core';\nimport {\n consoleIntegration,\n conversationIdIntegration,\n dedupeIntegration,\n eventFiltersIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n GLOBAL_OBJ,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport type { CloudflareClientOptions, CloudflareOptions } from './client';\nimport { CloudflareClient } from './client';\nimport { makeFlushLock } from './flush';\nimport { cacheClient, getCachedClient } from './clientCache';\nimport { DEBUG_BUILD } from './debug-build';\nimport { fetchIntegration } from './integrations/fetch';\nimport { httpServerIntegration } from './integrations/httpServer';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from './integrations/spotlight';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/**\n * Instantiate the channel-subscriber factories the `@sentry/cloudflare/vite`\n * plugin registered on the global marker. The plugin splices a small snippet\n * into each instrumented module that `.set`s its factory here (keyed by module\n * name), so the marker holds one factory per package actually bundled.\n *\n * The marker is read directly instead of importing the factories, so a worker\n * built without the plugin — where the channels never fire — ships none of this\n * code.\n */\nfunction getRegisteredChannelIntegrations(): Integration[] {\n const registered = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;\n\n return registered ? [...registered.values()].map(factory => factory()) : [];\n}\n\n/**\n * Get the default integrations for the Cloudflare SDK.\n * These also work on Workers-compatible runtimes without the `nodejs_compat` compatibility flag.\n */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n return [\n // The Dedupe integration should not be used in workflows because we want to\n // capture all step failures, even if they are the same error.\n ...(options.enableDedupe === false ? [] : [dedupeIntegration()]),\n eventFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n httpServerIntegration(),\n requestDataIntegration(),\n consoleIntegration(),\n // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The\n // `@sentry/cloudflare/vite` plugin injects the channels at build time and,\n // next to each, a snippet that registers the matching subscriber factory on\n // the global marker. Read from there instead of importing them so bundles\n // built without the plugin — where the channels would never fire — don't\n // ship the code.\n ...getRegisteredChannelIntegrations(),\n ];\n}\n\n/**\n * Initializes the Cloudflare SDK without setting up an OpenTelemetry tracer provider.\n *\n * Kept separate from `sdk.ts` so `@sentry/cloudflare/request` can load without Node.js-only\n * dependencies on runtimes such as Shopify Oxygen.\n *\n * The client is cached and reused across invocations within the same isolate,\n * unless `cacheClient: false` is passed. This avoids the\n * per-invocation cost of constructing a new client, and it is what makes\n * Durable Object telemetry reliable: a per-invocation client is disposed at\n * the end of the handler, and in a Durable Object there is no `waitUntil`\n * boundary that reliably extends execution, so spans/events that end after\n * disposal would otherwise be lost.\n */\nexport function initBaseSdk(options: CloudflareOptions): CloudflareClient | undefined {\n const cached = getCachedClient();\n const cacheEnabled = options.cacheClient !== false;\n\n // A closed client drops all data. `close()` marks the client before it\n // flushes, so this also skips a client that is still closing.\n if (cacheEnabled && cached && !_INTERNAL_isClientClosed(cached)) {\n if (DEBUG_BUILD && cached.getOptions().dsn !== options.dsn) {\n debug.warn(\n '[Sentry] init() was called with a different DSN than the cached client of this isolate; the cached client keeps its DSN. Pass `cacheClient: false` for per-invocation options.',\n );\n }\n getCurrentScope().update(options.initialScope);\n setCurrentClient(cached);\n return cached;\n }\n\n // `false` or a custom list turns off the SDK defaults, late-loaded ones\n // included, unless an SDK built the list from the defaults.\n const usesSdkDefaults = options.defaultIntegrations === undefined || !!options._extendsDefaultIntegrations;\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n // A cached client outlives any single invocation, so binding it to one\n // invocation's flush lock would make later flushes wait on that invocation's\n // waitUntil work forever. Eager delivery replaces the flush lock's purpose.\n const invocationContext = options.ctx;\n const flushLock = !cacheEnabled && invocationContext ? makeFlushLock(invocationContext) : undefined;\n delete options.ctx;\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n cacheClient: cacheEnabled,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n flushLock,\n };\n\n /*! rollup-include-development-only */\n if (options.spotlight && !clientOptions.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n clientOptions.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n /*! rollup-include-development-only-end */\n\n if (!cacheEnabled) {\n // `cacheClient: false` asks for a new client on each call, so replacing\n // the bound client is expected here and must not warn.\n getCurrentScope().setClient(undefined);\n }\n\n const client = initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n\n if (cacheEnabled && client) {\n cacheClient(client);\n }\n\n // An instrumented module that first evaluates AFTER this init (e.g. a driver\n // lazily required on first use) stores its subscriber factory on the global\n // marker too late for the default-integrations snapshot above. Its injected\n // snippet emits this event right after storing the factory, so install the\n // integration on the live client here, with the same rules as the defaults.\n // `addIntegration` dedupes by integration name, so an integration the user\n // configured stays in place.\n const userIntegrations = options.integrations;\n client.on('orchestrion.module-injected', moduleName => {\n const factory = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations?.get(moduleName);\n if (!usesSdkDefaults || !factory) {\n return;\n }\n\n const integration = factory();\n if (typeof userIntegrations !== 'function') {\n client.addIntegration(integration);\n return;\n }\n\n // Pass the late default through the user's `integrations` function, so a\n // filter that removed it at init removes it here too. This calls the\n // function again, once for each late module. If the function throws, skip\n // the integration, so the module load that emitted the event still works.\n const kept = safeCallback(\n DEBUG_BUILD ? 'Error in the `integrations` function, skipping a late-loaded integration:' : '',\n () =>\n getIntegrationsToSetup({ defaultIntegrations: [integration], integrations: userIntegrations }).find(\n ({ name }) => name === integration.name,\n ),\n () => undefined,\n );\n if (kept) {\n client.addIntegration(kept);\n }\n });\n\n return client;\n}\n"],"names":["GLOBAL_OBJ","dedupeIntegration","eventFiltersIntegration","functionToStringIntegration","conversationIdIntegration","linkedErrorsIntegration","fetchIntegration","httpServerIntegration","requestDataIntegration","consoleIntegration","getCachedClient","_INTERNAL_isClientClosed","DEBUG_BUILD","debug","getCurrentScope","setCurrentClient","makeFlushLock","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeCloudflareTransport","client","initAndBind","CloudflareClient","cacheClient","safeCallback"],"mappings":";;;;;;;;;;;;AAoCA,SAAS,gCAAA,GAAkD;AACzD,EAAA,MAAM,UAAA,GAAaA,gBAAW,sBAAA,EAAwB,YAAA;AAEtD,EAAA,OAAO,UAAA,GAAa,CAAC,GAAG,UAAA,CAAW,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,CAAA,OAAA,KAAW,OAAA,EAAS,CAAA,GAAI,EAAC;AAC5E;AAMO,SAAS,uBAAuB,OAAA,EAA2C;AAChF,EAAA,OAAO;AAAA;AAAA;AAAA,IAGL,GAAI,QAAQ,YAAA,KAAiB,KAAA,GAAQ,EAAC,GAAI,CAACC,wBAAmB,CAAA;AAAA,IAC9DC,4BAAA,EAAwB;AAAA,IACxBC,gCAAA,EAA4B;AAAA,IAC5BC,8BAAA,EAA0B;AAAA,IAC1BC,4BAAA,EAAwB;AAAA,IACxBC,sBAAA,EAAiB;AAAA,IACjBC,gCAAA,EAAsB;AAAA,IACtBC,2BAAA,EAAuB;AAAA,IACvBC,uBAAA,EAAmB;AAAA;AAAA;AAAA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eIntegration","eventFiltersIntegration","functionToStringIntegration","conversationIdIntegration","linkedErrorsIntegration","fetchIntegration","httpServerIntegration","requestDataIntegration","consoleIntegration","getCachedClient","_INTERNAL_isClientClosed","DEBUG_BUILD","debug","getCurrentScope","setCurrentClient","makeFlushLock","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeCloudflareTransport","initAndBind","CloudflareClient","cacheClient","safeCallback"],"sources":["../../../src/baseSdk.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { _INTERNAL_isClientClosed, debug, getCurrentScope, safeCallback, setCurrentClient } from '@sentry/core';\nimport {\n consoleIntegration,\n conversationIdIntegration,\n dedupeIntegration,\n eventFiltersIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n GLOBAL_OBJ,\n initAndBind,\n linkedErrorsIntegration,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport type { CloudflareClientOptions, CloudflareOptions } from './client';\nimport { CloudflareClient } from './client';\nimport { makeFlushLock } from './flush';\nimport { cacheClient, getCachedClient } from './clientCache';\nimport { DEBUG_BUILD } from './debug-build';\nimport { fetchIntegration } from './integrations/fetch';\nimport { httpServerIntegration } from './integrations/httpServer';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from './integrations/spotlight';\nimport { makeCloudflareTransport } from './transport';\nimport { defaultStackParser } from './vendor/stacktrace';\n\n/**\n * Instantiate the channel-subscriber factories the `@sentry/cloudflare/vite`\n * plugin registered on the global marker. The plugin splices a small snippet\n * into each instrumented module that `.set`s its factory here (keyed by module\n * name), so the marker holds one factory per package actually bundled.\n *\n * The marker is read directly instead of importing the factories, so a worker\n * built without the plugin — where the channels never fire — ships none of this\n * code.\n */\nfunction getRegisteredChannelIntegrations(): Integration[] {\n const registered = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations;\n\n return registered ? [...registered.values()].map(factory => factory()) : [];\n}\n\n/**\n * Get the default integrations for the Cloudflare SDK.\n * These also work on Workers-compatible runtimes without the `nodejs_compat` compatibility flag.\n */\nexport function getDefaultIntegrations(options: CloudflareOptions): Integration[] {\n return [\n // The Dedupe integration should not be used in workflows because we want to\n // capture all step failures, even if they are the same error.\n ...(options.enableDedupe === false ? [] : [dedupeIntegration()]),\n eventFiltersIntegration(),\n functionToStringIntegration(),\n conversationIdIntegration(),\n linkedErrorsIntegration(),\n fetchIntegration(),\n httpServerIntegration(),\n requestDataIntegration(),\n consoleIntegration(),\n // The orchestrion diagnostics-channel subscribers (mysql, pg, …). The\n // `@sentry/cloudflare/vite` plugin injects the channels at build time and,\n // next to each, a snippet that registers the matching subscriber factory on\n // the global marker. Read from there instead of importing them so bundles\n // built without the plugin — where the channels would never fire — don't\n // ship the code.\n ...getRegisteredChannelIntegrations(),\n ];\n}\n\n/**\n * Initializes the Cloudflare SDK without setting up an OpenTelemetry tracer provider.\n *\n * Kept separate from `sdk.ts` so `@sentry/cloudflare/request` can load without Node.js-only\n * dependencies on runtimes such as Shopify Oxygen.\n *\n * The client is cached and reused across invocations within the same isolate,\n * unless `cacheClient: false` is passed. This avoids the\n * per-invocation cost of constructing a new client, and it is what makes\n * Durable Object telemetry reliable: a per-invocation client is disposed at\n * the end of the handler, and in a Durable Object there is no `waitUntil`\n * boundary that reliably extends execution, so spans/events that end after\n * disposal would otherwise be lost.\n */\nexport function initBaseSdk(options: CloudflareOptions): CloudflareClient | undefined {\n const cached = getCachedClient();\n const cacheEnabled = options.cacheClient !== false;\n\n // A closed client drops all data. `close()` marks the client before it\n // flushes, so this also skips a client that is still closing.\n if (cacheEnabled && cached && !_INTERNAL_isClientClosed(cached)) {\n if (DEBUG_BUILD && cached.getOptions().dsn !== options.dsn) {\n debug.warn(\n '[Sentry] init() was called with a different DSN than the cached client of this isolate; the cached client keeps its DSN. Pass `cacheClient: false` for per-invocation options.',\n );\n }\n getCurrentScope().update(options.initialScope);\n setCurrentClient(cached);\n return cached;\n }\n\n // `false` or a custom list turns off the SDK defaults, late-loaded ones\n // included, unless an SDK built the list from the defaults.\n const usesSdkDefaults = options.defaultIntegrations === undefined || !!options._extendsDefaultIntegrations;\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrations(options);\n }\n\n // A cached client outlives any single invocation, so binding it to one\n // invocation's flush lock would make later flushes wait on that invocation's\n // waitUntil work forever. Eager delivery replaces the flush lock's purpose.\n const invocationContext = options.ctx;\n const flushLock = !cacheEnabled && invocationContext ? makeFlushLock(invocationContext) : undefined;\n delete options.ctx;\n\n const clientOptions: CloudflareClientOptions = {\n ...options,\n cacheClient: cacheEnabled,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeCloudflareTransport,\n flushLock,\n };\n\n /*! rollup-include-development-only */\n if (options.spotlight && !clientOptions.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n clientOptions.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n /*! rollup-include-development-only-end */\n\n if (!cacheEnabled) {\n // `cacheClient: false` asks for a new client on each call, so replacing\n // the bound client is expected here and must not warn.\n getCurrentScope().setClient(undefined);\n }\n\n const client = initAndBind(CloudflareClient, clientOptions) as CloudflareClient;\n\n if (cacheEnabled && client) {\n cacheClient(client);\n }\n\n // An instrumented module that first evaluates AFTER this init (e.g. a driver\n // lazily required on first use) stores its subscriber factory on the global\n // marker too late for the default-integrations snapshot above. Its injected\n // snippet emits this event right after storing the factory, so install the\n // integration on the live client here, with the same rules as the defaults.\n // `addIntegration` dedupes by integration name, so an integration the user\n // configured stays in place.\n const userIntegrations = options.integrations;\n client.on('orchestrion.module-injected', moduleName => {\n const factory = GLOBAL_OBJ.__SENTRY_ORCHESTRION__?.integrations?.get(moduleName);\n if (!usesSdkDefaults || !factory) {\n return;\n }\n\n const integration = factory();\n if (typeof userIntegrations !== 'function') {\n client.addIntegration(integration);\n return;\n }\n\n // Pass the late default through the user's `integrations` function, so a\n // filter that removed it at init removes it here too. This calls the\n // function again, once for each late module. If the function throws, skip\n // the integration, so the module load that emitted the event still works.\n const kept = safeCallback(\n DEBUG_BUILD ? 'Error in the `integrations` function, skipping a late-loaded integration:' : '',\n () =>\n getIntegrationsToSetup({ defaultIntegrations: [integration], integrations: userIntegrations }).find(\n ({ name }) => name === integration.name,\n ),\n () => undefined,\n );\n if (kept) {\n client.addIntegration(kept);\n }\n });\n\n return client;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,mCAAkD;CACzD,MAAM,aAAaA,aAAAA,WAAW,wBAAwB;CAEtD,OAAO,aAAa,CAAC,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC,KAAI,YAAW,QAAQ,CAAC,IAAI,CAAC;AAC5E;;;;;AAMA,SAAgB,uBAAuB,SAA2C;CAChF,OAAO;EAGL,GAAI,QAAQ,iBAAiB,QAAQ,CAAC,IAAI,EAAA,GAACC,aAAAA,kBAAAA,CAAkB,CAAC;GAC9DC,GAAAA,aAAAA,wBAAAA,CAAwB;GACxBC,GAAAA,aAAAA,4BAAAA,CAA4B;GAC5BC,GAAAA,aAAAA,0BAAAA,CAA0B;GAC1BC,GAAAA,aAAAA,wBAAAA,CAAwB;EACxBC,cAAAA,iBAAiB;EACjBC,mBAAAA,sBAAsB;GACtBC,GAAAA,aAAAA,uBAAAA,CAAuB;GACvBC,GAAAA,aAAAA,mBAAAA,CAAmB;EAOnB,GAAG,iCAAiC;CACtC;AACF;;;;;;;;;;;;;;;AAgBA,SAAgB,YAAY,SAA0D;CACpF,MAAM,SAASC,oBAAAA,gBAAgB;CAC/B,MAAM,eAAe,QAAQ,gBAAgB;CAI7C,IAAI,gBAAgB,UAAU,EAAA,GAACC,aAAAA,yBAAAA,CAAyB,MAAM,GAAG;EAC/D,IAAIC,oBAAAA,eAAe,OAAO,WAAW,CAAC,CAAC,QAAQ,QAAQ,KACrDC,aAAAA,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