@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,44 +1,47 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
-
1
+ let _sentry_core = require("@sentry/core");
2
+ // src/utils/internalStorageKey.ts
3
+ /**
4
+ * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage
5
+ * their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved
6
+ * prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these
7
+ * (message persistence, MCP connection bookkeeping, name hydration) are framework implementation
8
+ * details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans
9
+ * per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the
10
+ * `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).
11
+ *
12
+ * The prefixes are a reserved convention for framework-managed entries, so user keys should not use
13
+ * them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them
14
+ * opt those keys back into instrumentation.
15
+ */
5
16
  function targetsCloudflareInternalKey(key, allowlist) {
6
- if (!key) {
7
- return false;
8
- }
9
- const isFrameworkKey = key.startsWith("cf_") || key.startsWith("cf:") || key.startsWith("__ps_") || key.startsWith("/");
10
- if (!isFrameworkKey) {
11
- return false;
12
- }
13
- return !allowlist?.length || !core.stringMatchesSomePattern(key, allowlist, true);
17
+ if (!key) return false;
18
+ if (!(key.startsWith("cf_") || key.startsWith("cf:") || key.startsWith("__ps_") || key.startsWith("/"))) return false;
19
+ return !allowlist?.length || !(0, _sentry_core.stringMatchesSomePattern)(key, allowlist, true);
14
20
  }
21
+ /**
22
+ * Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the
23
+ * operation only touches framework-internal entries. Returns `undefined` when the keys can't be
24
+ * determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated
25
+ * as user work and stays instrumented.
26
+ */
15
27
  function getStorageKeys(methodName, args) {
16
- const [first] = args;
17
- if (methodName === "get" || methodName === "delete") {
18
- if (typeof first === "string") {
19
- return [first];
20
- }
21
- if (Array.isArray(first)) {
22
- return first.filter((k) => typeof k === "string");
23
- }
24
- return void 0;
25
- }
26
- if (methodName === "put") {
27
- if (typeof first === "string") {
28
- return [first];
29
- }
30
- if (first && typeof first === "object" && !Array.isArray(first)) {
31
- return Object.keys(first);
32
- }
33
- return void 0;
34
- }
35
- if (methodName === "list") {
36
- const prefix = first && typeof first === "object" ? first.prefix : void 0;
37
- return typeof prefix === "string" ? [prefix] : void 0;
38
- }
39
- return void 0;
28
+ const [first] = args;
29
+ if (methodName === "get" || methodName === "delete") {
30
+ if (typeof first === "string") return [first];
31
+ if (Array.isArray(first)) return first.filter((k) => typeof k === "string");
32
+ return;
33
+ }
34
+ if (methodName === "put") {
35
+ if (typeof first === "string") return [first];
36
+ if (first && typeof first === "object" && !Array.isArray(first)) return Object.keys(first);
37
+ return;
38
+ }
39
+ if (methodName === "list") {
40
+ const prefix = first && typeof first === "object" ? first.prefix : void 0;
41
+ return typeof prefix === "string" ? [prefix] : void 0;
42
+ }
40
43
  }
41
-
42
44
  exports.getStorageKeys = getStorageKeys;
43
45
  exports.targetsCloudflareInternalKey = targetsCloudflareInternalKey;
44
- //# sourceMappingURL=internalStorageKey.js.map
46
+
47
+ //# sourceMappingURL=internalStorageKey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internalStorageKey.js","sources":["../../../../src/utils/internalStorageKey.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage\n * their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved\n * prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these\n * (message persistence, MCP connection bookkeeping, name hydration) are framework implementation\n * details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans\n * per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the\n * `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).\n *\n * The prefixes are a reserved convention for framework-managed entries, so user keys should not use\n * them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them\n * opt those keys back into instrumentation.\n */\nexport function targetsCloudflareInternalKey(key: string | undefined, allowlist?: Array<string | RegExp>): boolean {\n if (!key) {\n return false;\n }\n\n // Framework-managed KV namespaces:\n // - `cf_` — agents / ai-chat internal state (mirrors the internal SQL table convention)\n // - `cf:` — agents chat-recovery entries (`cf:chat-recovery:*`, `cf:chat:*`); the same reserved\n // `cf` namespace, but colon-separated instead of underscore-separated\n // - `__ps_` — partyserver internals (e.g. `__ps_name`)\n // - `/` — MCP OAuth client state (`/<clientName>/<serverId>/{token,client_info,state,...}`),\n // read on every MCP tool call. User keys on an Agent rarely use a leading slash; if one does,\n // the allowlist opts it back in.\n const isFrameworkKey =\n key.startsWith('cf_') || key.startsWith('cf:') || key.startsWith('__ps_') || key.startsWith('/');\n if (!isFrameworkKey) {\n return false;\n }\n\n // A key on the allowlist is treated as a user key and stays instrumented, even though it matches\n // a reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(key, allowlist, true);\n}\n\n/**\n * Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the\n * operation only touches framework-internal entries. Returns `undefined` when the keys can't be\n * determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated\n * as user work and stays instrumented.\n */\nexport function getStorageKeys(methodName: string, args: unknown[]): string[] | undefined {\n const [first] = args;\n\n if (methodName === 'get' || methodName === 'delete') {\n // get(key) / get(keys[]) / delete(key) / delete(keys[])\n if (typeof first === 'string') {\n return [first];\n }\n if (Array.isArray(first)) {\n return first.filter((k): k is string => typeof k === 'string');\n }\n return undefined;\n }\n\n if (methodName === 'put') {\n // put(key, value) or put({ key: value, ... })\n if (typeof first === 'string') {\n return [first];\n }\n if (first && typeof first === 'object' && !Array.isArray(first)) {\n return Object.keys(first);\n }\n return undefined;\n }\n\n if (methodName === 'list') {\n // list({ prefix })\n const prefix = first && typeof first === 'object' ? (first as { prefix?: unknown }).prefix : undefined;\n return typeof prefix === 'string' ? [prefix] : undefined;\n }\n\n return undefined;\n}\n"],"names":["stringMatchesSomePattern"],"mappings":";;;;AAeO,SAAS,4BAAA,CAA6B,KAAyB,SAAA,EAA6C;AACjH,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA,OAAO,KAAA;AAAA,EACT;AAUA,EAAA,MAAM,cAAA,GACJ,GAAA,CAAI,UAAA,CAAW,KAAK,KAAK,GAAA,CAAI,UAAA,CAAW,KAAK,CAAA,IAAK,IAAI,UAAA,CAAW,OAAO,CAAA,IAAK,GAAA,CAAI,WAAW,GAAG,CAAA;AACjG,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,KAAA;AAAA,EACT;AAIA,EAAA,OAAO,CAAC,SAAA,EAAW,MAAA,IAAU,CAACA,6BAAA,CAAyB,GAAA,EAAK,WAAW,IAAI,CAAA;AAC7E;AAQO,SAAS,cAAA,CAAe,YAAoB,IAAA,EAAuC;AACxF,EAAA,MAAM,CAAC,KAAK,CAAA,GAAI,IAAA;AAEhB,EAAA,IAAI,UAAA,KAAe,KAAA,IAAS,UAAA,KAAe,QAAA,EAAU;AAEnD,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,MAAA,OAAO,MAAM,MAAA,CAAO,CAAC,CAAA,KAAmB,OAAO,MAAM,QAAQ,CAAA;AAAA,IAC/D;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,KAAA,EAAO;AAExB,IAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,MAAA,OAAO,CAAC,KAAK,CAAA;AAAA,IACf;AACA,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC/D,MAAA,OAAO,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA,IAC1B;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,IAAI,eAAe,MAAA,EAAQ;AAEzB,IAAA,MAAM,SAAS,KAAA,IAAS,OAAO,KAAA,KAAU,QAAA,GAAY,MAA+B,MAAA,GAAS,MAAA;AAC7F,IAAA,OAAO,OAAO,MAAA,KAAW,QAAA,GAAW,CAAC,MAAM,CAAA,GAAI,MAAA;AAAA,EACjD;AAEA,EAAA,OAAO,MAAA;AACT;;;;;"}
1
+ {"version":3,"file":"internalStorageKey.js","names":["stringMatchesSomePattern"],"sources":["../../../../src/utils/internalStorageKey.ts"],"sourcesContent":["import { stringMatchesSomePattern } from '@sentry/core';\n\n/**\n * Cloudflare frameworks that build on Durable Objects (`agents`, `partyserver`, ...) also manage\n * their own internal KV entries alongside their internal SQLite tables, namespaced with a reserved\n * prefix — e.g. `cf_agents_state`, `cf_agents_mcp_servers`, `__ps_name`. Reads/writes of these\n * (message persistence, MCP connection bookkeeping, name hydration) are framework implementation\n * details that otherwise flood traces with dozens of zero-signal `durable_object_storage_*` spans\n * per request, so we match the reserved prefixes rather than an enumerated list. This mirrors the\n * `cf_` convention used for internal SQL tables (see `targetsCloudflareInternalTable`).\n *\n * The prefixes are a reserved convention for framework-managed entries, so user keys should not use\n * them. In case a user key does collide, the `durableObjectStorageSpanAllowlist` option lets them\n * opt those keys back into instrumentation.\n */\nexport function targetsCloudflareInternalKey(key: string | undefined, allowlist?: Array<string | RegExp>): boolean {\n if (!key) {\n return false;\n }\n\n // Framework-managed KV namespaces:\n // - `cf_` — agents / ai-chat internal state (mirrors the internal SQL table convention)\n // - `cf:` — agents chat-recovery entries (`cf:chat-recovery:*`, `cf:chat:*`); the same reserved\n // `cf` namespace, but colon-separated instead of underscore-separated\n // - `__ps_` — partyserver internals (e.g. `__ps_name`)\n // - `/` — MCP OAuth client state (`/<clientName>/<serverId>/{token,client_info,state,...}`),\n // read on every MCP tool call. User keys on an Agent rarely use a leading slash; if one does,\n // the allowlist opts it back in.\n const isFrameworkKey =\n key.startsWith('cf_') || key.startsWith('cf:') || key.startsWith('__ps_') || key.startsWith('/');\n if (!isFrameworkKey) {\n return false;\n }\n\n // A key on the allowlist is treated as a user key and stays instrumented, even though it matches\n // a reserved prefix.\n return !allowlist?.length || !stringMatchesSomePattern(key, allowlist, true);\n}\n\n/**\n * Extracts the KV keys a Durable Object storage call targets, so the caller can decide whether the\n * operation only touches framework-internal entries. Returns `undefined` when the keys can't be\n * determined from the arguments (e.g. `list()` without a prefix), in which case the call is treated\n * as user work and stays instrumented.\n */\nexport function getStorageKeys(methodName: string, args: unknown[]): string[] | undefined {\n const [first] = args;\n\n if (methodName === 'get' || methodName === 'delete') {\n // get(key) / get(keys[]) / delete(key) / delete(keys[])\n if (typeof first === 'string') {\n return [first];\n }\n if (Array.isArray(first)) {\n return first.filter((k): k is string => typeof k === 'string');\n }\n return undefined;\n }\n\n if (methodName === 'put') {\n // put(key, value) or put({ key: value, ... })\n if (typeof first === 'string') {\n return [first];\n }\n if (first && typeof first === 'object' && !Array.isArray(first)) {\n return Object.keys(first);\n }\n return undefined;\n }\n\n if (methodName === 'list') {\n // list({ prefix })\n const prefix = first && typeof first === 'object' ? (first as { prefix?: unknown }).prefix : undefined;\n return typeof prefix === 'string' ? [prefix] : undefined;\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAgB,6BAA6B,KAAyB,WAA6C;CACjH,IAAI,CAAC,KACH,OAAO;CAaT,IAAI,EADF,IAAI,WAAW,KAAK,KAAK,IAAI,WAAW,KAAK,KAAK,IAAI,WAAW,OAAO,KAAK,IAAI,WAAW,GAAG,IAE/F,OAAO;CAKT,OAAO,CAAC,WAAW,UAAU,EAAA,GAACA,aAAAA,yBAAAA,CAAyB,KAAK,WAAW,IAAI;AAC7E;;;;;;;AAQA,SAAgB,eAAe,YAAoB,MAAuC;CACxF,MAAM,CAAC,SAAS;CAEhB,IAAI,eAAe,SAAS,eAAe,UAAU;EAEnD,IAAI,OAAO,UAAU,UACnB,OAAO,CAAC,KAAK;EAEf,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,QAAQ,MAAmB,OAAO,MAAM,QAAQ;EAE/D;CACF;CAEA,IAAI,eAAe,OAAO;EAExB,IAAI,OAAO,UAAU,UACnB,OAAO,CAAC,KAAK;EAEf,IAAI,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,GAC5D,OAAO,OAAO,KAAK,KAAK;EAE1B;CACF;CAEA,IAAI,eAAe,QAAQ;EAEzB,MAAM,SAAS,SAAS,OAAO,UAAU,WAAY,MAA+B,SAAS,KAAA;EAC7F,OAAO,OAAO,WAAW,WAAW,CAAC,MAAM,IAAI,KAAA;CACjD;AAGF"}
@@ -1,41 +1,51 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const debugBuild = require('../debug-build.js');
5
- const flush = require('../flush.js');
6
-
7
- const INVOCATION_STATE = /* @__PURE__ */ Symbol("sentryInvocationState");
1
+ const require_debug_build = require("../debug-build.js");
2
+ const require_flush = require("../flush.js");
3
+ let _sentry_core = require("@sentry/core");
4
+ // src/utils/invocationContext.ts
5
+ const INVOCATION_STATE = Symbol("sentryInvocationState");
6
+ /**
7
+ * Returns the invocation's original (un-instrumented) `waitUntil`, bound to its context,
8
+ * resolving it on first use and caching it on the state. Reading `ctx.waitUntil` on a
9
+ * native `ExecutionContext`/`DurableObjectState` goes through the runtime's property
10
+ * getter every time; one read per invocation is enough.
11
+ */
8
12
  function getInvocationWaitUntil(state) {
9
- if (state.waitUntil === void 0) {
10
- const ctx = state.ctx;
11
- let resolved = null;
12
- try {
13
- const original = ctx && flush.getOriginalWaitUntil(ctx);
14
- resolved = original ? original.bind(ctx) : null;
15
- } catch {
16
- }
17
- state.waitUntil = resolved;
18
- }
19
- return state.waitUntil ?? void 0;
13
+ if (state.waitUntil === void 0) {
14
+ const ctx = state.ctx;
15
+ let resolved = null;
16
+ try {
17
+ const original = ctx && require_flush.getOriginalWaitUntil(ctx);
18
+ resolved = original ? original.bind(ctx) : null;
19
+ } catch {}
20
+ state.waitUntil = resolved;
21
+ }
22
+ return state.waitUntil ?? void 0;
20
23
  }
24
+ /**
25
+ * Attaches invocation state to a forked isolation scope. Only meaningful on a scope
26
+ * that outlives nothing but this invocation — never attach to the default isolation
27
+ * scope, which is shared by every invocation in the isolate.
28
+ */
21
29
  function setInvocationState(scope, state) {
22
- if (scope === core.getDefaultIsolationScope()) {
23
- debugBuild.DEBUG_BUILD && core.debug.warn(
24
- "[Sentry] Cannot track this invocation. Telemetry captured after the invocation ends may not be delivered."
25
- );
26
- return;
27
- }
28
- scope.refs[INVOCATION_STATE] = state;
30
+ if (scope === (0, _sentry_core.getDefaultIsolationScope)()) {
31
+ require_debug_build.DEBUG_BUILD && _sentry_core.debug.warn("[Sentry] Cannot track this invocation. Telemetry captured after the invocation ends may not be delivered.");
32
+ return;
33
+ }
34
+ scope.refs[INVOCATION_STATE] = state;
29
35
  }
36
+ /**
37
+ * Returns the state of the invocation that owns the current async context, or
38
+ * `undefined` outside any instrumented invocation (the default isolation scope is
39
+ * shared, so state read from it could not be attributed to one invocation — and it
40
+ * is never attached there in the first place).
41
+ */
30
42
  function getInvocationState() {
31
- const isolationScope = core.getIsolationScope();
32
- if (isolationScope === core.getDefaultIsolationScope()) {
33
- return void 0;
34
- }
35
- return isolationScope.refs[INVOCATION_STATE];
43
+ const isolationScope = (0, _sentry_core.getIsolationScope)();
44
+ if (isolationScope === (0, _sentry_core.getDefaultIsolationScope)()) return;
45
+ return isolationScope.refs[INVOCATION_STATE];
36
46
  }
37
-
38
47
  exports.getInvocationState = getInvocationState;
39
48
  exports.getInvocationWaitUntil = getInvocationWaitUntil;
40
49
  exports.setInvocationState = setInvocationState;
41
- //# sourceMappingURL=invocationContext.js.map
50
+
51
+ //# sourceMappingURL=invocationContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"invocationContext.js","sources":["../../../../src/utils/invocationContext.ts"],"sourcesContent":["import type { ExecutionContext } from '@cloudflare/workers-types';\nimport type { Scope } from '@sentry/core';\nimport { debug, getDefaultIsolationScope, getIsolationScope } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { ExecutionContextCompat } from '../executionContext';\nimport { getOriginalWaitUntil } from '../flush';\n\n/**\n * State owned by a single invocation (request, RPC call, cron, ...).\n *\n * A cached client (`cacheClient`) is shared by all invocations running in the same\n * isolate, so anything invocation-owned must not live on the client: two overlapping\n * requests would otherwise overwrite each other's state (e.g. the execution context\n * used to register eager flushes) and the earlier invocation's envelopes would be\n * suspended when the later invocation ends.\n *\n * The state rides on the invocation's forked isolation scope, which the async\n * context strategy (AsyncLocalStorage) hands back for exactly the async context that\n * owns the invocation — including detached continuations created inside it. It lives under\n * a symbol key in the scope's `refs`, so isolation scopes forked inside the invocation\n * (`withMonitor`, `withIsolationScope`) share it, and it stays out of serialized event data.\n */\nexport interface InvocationState {\n /**\n * The execution context of the invocation that owns this scope. Eager envelope\n * sends are registered with this context's `waitUntil`, so they are attributed to\n * the invocation that captured the data even when invocations overlap.\n */\n readonly ctx: ExecutionContextCompat | undefined;\n /**\n * Set on the client's `flush` hook, the invocation's natural flush point.\n * Captures before it are drained by that flush; captures after it (in\n * `waitUntil` work or detached continuations) have no later flush to ride and\n * are delivered eagerly.\n */\n flushPointReached?: boolean;\n /**\n * `ctx.waitUntil` resolved once for this invocation (see `getInvocationWaitUntil`).\n * `null` once resolved to \"no usable waitUntil\".\n */\n waitUntil?: ExecutionContext['waitUntil'] | null;\n}\n\nconst INVOCATION_STATE: unique symbol = Symbol('sentryInvocationState');\n\n/**\n * Returns the invocation's original (un-instrumented) `waitUntil`, bound to its context,\n * resolving it on first use and caching it on the state. Reading `ctx.waitUntil` on a\n * native `ExecutionContext`/`DurableObjectState` goes through the runtime's property\n * getter every time; one read per invocation is enough.\n */\nexport function getInvocationWaitUntil(state: InvocationState): ExecutionContext['waitUntil'] | undefined {\n if (state.waitUntil === undefined) {\n const ctx = state.ctx;\n let resolved: ExecutionContext['waitUntil'] | null = null;\n try {\n const original = ctx && getOriginalWaitUntil(ctx);\n resolved = original ? original.bind(ctx) : null;\n } catch {\n // Accessing `waitUntil` can throw on foreign or already-torn-down contexts.\n }\n state.waitUntil = resolved;\n }\n return state.waitUntil ?? undefined;\n}\n\ntype ScopeRefsWithInvocationState = Scope['refs'] & {\n [INVOCATION_STATE]?: InvocationState;\n};\n\n/**\n * Attaches invocation state to a forked isolation scope. Only meaningful on a scope\n * that outlives nothing but this invocation — never attach to the default isolation\n * scope, which is shared by every invocation in the isolate.\n */\nexport function setInvocationState(scope: Scope, state: InvocationState): void {\n if (scope === getDefaultIsolationScope()) {\n DEBUG_BUILD &&\n debug.warn(\n '[Sentry] Cannot track this invocation. Telemetry captured after the invocation ends may not be delivered.',\n );\n return;\n }\n\n (scope.refs as ScopeRefsWithInvocationState)[INVOCATION_STATE] = state;\n}\n\n/**\n * Returns the state of the invocation that owns the current async context, or\n * `undefined` outside any instrumented invocation (the default isolation scope is\n * shared, so state read from it could not be attributed to one invocation — and it\n * is never attached there in the first place).\n */\nexport function getInvocationState(): InvocationState | undefined {\n const isolationScope = getIsolationScope();\n if (isolationScope === getDefaultIsolationScope()) {\n return undefined;\n }\n return (isolationScope.refs as ScopeRefsWithInvocationState)[INVOCATION_STATE];\n}\n"],"names":["getOriginalWaitUntil","getDefaultIsolationScope","DEBUG_BUILD","debug","getIsolationScope"],"mappings":";;;;;;AA2CA,MAAM,gBAAA,0BAAyC,uBAAuB,CAAA;AAQ/D,SAAS,uBAAuB,KAAA,EAAmE;AACxG,EAAA,IAAI,KAAA,CAAM,cAAc,MAAA,EAAW;AACjC,IAAA,MAAM,MAAM,KAAA,CAAM,GAAA;AAClB,IAAA,IAAI,QAAA,GAAiD,IAAA;AACrD,IAAA,IAAI;AACF,MAAA,MAAM,QAAA,GAAW,GAAA,IAAOA,0BAAA,CAAqB,GAAG,CAAA;AAChD,MAAA,QAAA,GAAW,QAAA,GAAW,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA,GAAI,IAAA;AAAA,IAC7C,CAAA,CAAA,MAAQ;AAAA,IAER;AACA,IAAA,KAAA,CAAM,SAAA,GAAY,QAAA;AAAA,EACpB;AACA,EAAA,OAAO,MAAM,SAAA,IAAa,MAAA;AAC5B;AAWO,SAAS,kBAAA,CAAmB,OAAc,KAAA,EAA8B;AAC7E,EAAA,IAAI,KAAA,KAAUC,+BAAyB,EAAG;AACxC,IAAAC,sBAAA,IACEC,UAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AACF,IAAA;AAAA,EACF;AAEA,EAAC,KAAA,CAAM,IAAA,CAAsC,gBAAgB,CAAA,GAAI,KAAA;AACnE;AAQO,SAAS,kBAAA,GAAkD;AAChE,EAAA,MAAM,iBAAiBC,sBAAA,EAAkB;AACzC,EAAA,IAAI,cAAA,KAAmBH,+BAAyB,EAAG;AACjD,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAQ,cAAA,CAAe,KAAsC,gBAAgB,CAAA;AAC/E;;;;;;"}
1
+ {"version":3,"file":"invocationContext.js","names":["getOriginalWaitUntil","getDefaultIsolationScope","DEBUG_BUILD","debug","getIsolationScope"],"sources":["../../../../src/utils/invocationContext.ts"],"sourcesContent":["import type { ExecutionContext } from '@cloudflare/workers-types';\nimport type { Scope } from '@sentry/core';\nimport { debug, getDefaultIsolationScope, getIsolationScope } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { ExecutionContextCompat } from '../executionContext';\nimport { getOriginalWaitUntil } from '../flush';\n\n/**\n * State owned by a single invocation (request, RPC call, cron, ...).\n *\n * A cached client (`cacheClient`) is shared by all invocations running in the same\n * isolate, so anything invocation-owned must not live on the client: two overlapping\n * requests would otherwise overwrite each other's state (e.g. the execution context\n * used to register eager flushes) and the earlier invocation's envelopes would be\n * suspended when the later invocation ends.\n *\n * The state rides on the invocation's forked isolation scope, which the async\n * context strategy (AsyncLocalStorage) hands back for exactly the async context that\n * owns the invocation — including detached continuations created inside it. It lives under\n * a symbol key in the scope's `refs`, so isolation scopes forked inside the invocation\n * (`withMonitor`, `withIsolationScope`) share it, and it stays out of serialized event data.\n */\nexport interface InvocationState {\n /**\n * The execution context of the invocation that owns this scope. Eager envelope\n * sends are registered with this context's `waitUntil`, so they are attributed to\n * the invocation that captured the data even when invocations overlap.\n */\n readonly ctx: ExecutionContextCompat | undefined;\n /**\n * Set on the client's `flush` hook, the invocation's natural flush point.\n * Captures before it are drained by that flush; captures after it (in\n * `waitUntil` work or detached continuations) have no later flush to ride and\n * are delivered eagerly.\n */\n flushPointReached?: boolean;\n /**\n * `ctx.waitUntil` resolved once for this invocation (see `getInvocationWaitUntil`).\n * `null` once resolved to \"no usable waitUntil\".\n */\n waitUntil?: ExecutionContext['waitUntil'] | null;\n}\n\nconst INVOCATION_STATE: unique symbol = Symbol('sentryInvocationState');\n\n/**\n * Returns the invocation's original (un-instrumented) `waitUntil`, bound to its context,\n * resolving it on first use and caching it on the state. Reading `ctx.waitUntil` on a\n * native `ExecutionContext`/`DurableObjectState` goes through the runtime's property\n * getter every time; one read per invocation is enough.\n */\nexport function getInvocationWaitUntil(state: InvocationState): ExecutionContext['waitUntil'] | undefined {\n if (state.waitUntil === undefined) {\n const ctx = state.ctx;\n let resolved: ExecutionContext['waitUntil'] | null = null;\n try {\n const original = ctx && getOriginalWaitUntil(ctx);\n resolved = original ? original.bind(ctx) : null;\n } catch {\n // Accessing `waitUntil` can throw on foreign or already-torn-down contexts.\n }\n state.waitUntil = resolved;\n }\n return state.waitUntil ?? undefined;\n}\n\ntype ScopeRefsWithInvocationState = Scope['refs'] & {\n [INVOCATION_STATE]?: InvocationState;\n};\n\n/**\n * Attaches invocation state to a forked isolation scope. Only meaningful on a scope\n * that outlives nothing but this invocation — never attach to the default isolation\n * scope, which is shared by every invocation in the isolate.\n */\nexport function setInvocationState(scope: Scope, state: InvocationState): void {\n if (scope === getDefaultIsolationScope()) {\n DEBUG_BUILD &&\n debug.warn(\n '[Sentry] Cannot track this invocation. Telemetry captured after the invocation ends may not be delivered.',\n );\n return;\n }\n\n (scope.refs as ScopeRefsWithInvocationState)[INVOCATION_STATE] = state;\n}\n\n/**\n * Returns the state of the invocation that owns the current async context, or\n * `undefined` outside any instrumented invocation (the default isolation scope is\n * shared, so state read from it could not be attributed to one invocation — and it\n * is never attached there in the first place).\n */\nexport function getInvocationState(): InvocationState | undefined {\n const isolationScope = getIsolationScope();\n if (isolationScope === getDefaultIsolationScope()) {\n return undefined;\n }\n return (isolationScope.refs as ScopeRefsWithInvocationState)[INVOCATION_STATE];\n}\n"],"mappings":";;;;AA2CA,MAAM,mBAAkC,OAAO,uBAAuB;;;;;;;AAQtE,SAAgB,uBAAuB,OAAmE;CACxG,IAAI,MAAM,cAAc,KAAA,GAAW;EACjC,MAAM,MAAM,MAAM;EAClB,IAAI,WAAiD;EACrD,IAAI;GACF,MAAM,WAAW,OAAOA,cAAAA,qBAAqB,GAAG;GAChD,WAAW,WAAW,SAAS,KAAK,GAAG,IAAI;EAC7C,QAAQ,CAER;EACA,MAAM,YAAY;CACpB;CACA,OAAO,MAAM,aAAa,KAAA;AAC5B;;;;;;AAWA,SAAgB,mBAAmB,OAAc,OAA8B;CAC7E,IAAI,WAAA,GAAUC,aAAAA,yBAAAA,CAAyB,GAAG;EACxCC,oBAAAA,eACEC,aAAAA,MAAM,KACJ,2GACF;EACF;CACF;CAEC,MAAM,KAAsC,oBAAoB;AACnE;;;;;;;AAQA,SAAgB,qBAAkD;CAChE,MAAM,kBAAA,GAAiBC,aAAAA,kBAAAA,CAAkB;CACzC,IAAI,oBAAA,GAAmBH,aAAAA,yBAAAA,CAAyB,GAC9C;CAEF,OAAQ,eAAe,KAAsC;AAC/D"}
@@ -1,28 +1,52 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const core = require('@sentry/core');
4
- const invocationContext = require('./invocationContext.js');
5
-
1
+ const require_invocationContext = require("./invocationContext.js");
2
+ let _sentry_core = require("@sentry/core");
3
+ // src/utils/invocationScope.ts
6
4
  const constructionScopes = /* @__PURE__ */ new WeakSet();
5
+ /**
6
+ * Runs a Durable Object constructor on a forked isolation scope.
7
+ *
8
+ * Async work the constructor starts, such as a `blockConcurrencyWhile` callback, runs after the RPC
9
+ * wrappers are installed and inherits this scope, so the calls it makes to the instance's own methods
10
+ * are not treated as incoming RPC calls. The scope is not an invocation: it has no invocation state,
11
+ * and an instrumented handler that this work calls still forks a scope of its own.
12
+ */
7
13
  function withConstructionIsolationScope(callback) {
8
- if (core.getIsolationScope() !== core.getDefaultIsolationScope()) {
9
- return callback();
10
- }
11
- return core.withIsolationScope((scope) => {
12
- constructionScopes.add(scope);
13
- return callback();
14
- });
14
+ if ((0, _sentry_core.getIsolationScope)() !== (0, _sentry_core.getDefaultIsolationScope)()) return callback();
15
+ return (0, _sentry_core.withIsolationScope)((scope) => {
16
+ constructionScopes.add(scope);
17
+ return callback();
18
+ });
15
19
  }
20
+ /**
21
+ * Runs `callback` on the isolation scope for the current invocation.
22
+ *
23
+ * An instrumented handler is either the entry point of an invocation or reentrant — reached from
24
+ * another instrumented handler already serving the same invocation (a Durable Object method calling
25
+ * its own `fetch`, an RPC method reaching a sibling method). Only the entry point may fork:
26
+ *
27
+ * - Forking at the entry point is mandatory. `setUser`/`setTag` write to the isolation scope, and a
28
+ * Durable Object's isolation scope outlives the invocation that touched it, so without a fork one
29
+ * invocation's user and tags reappear on the next invocation's events in the same isolate.
30
+ * Forking clones, so request data set by an enclosing wrapper is still inherited.
31
+ * - Forking again when reentrant would be wrong. Everything below the entry point is one logical
32
+ * unit of work: a nested call must see what the caller set and be able to add to it, the way it
33
+ * would if the SDK were not wrapping it at all.
34
+ *
35
+ * The AsyncLocalStorage strategy hands the default isolation scope back whenever no invocation is in
36
+ * flight, and a forked one while inside `withIsolationScope`. Reference-comparing against the default
37
+ * and the construction scopes (see {@link withConstructionIsolationScope}) is therefore enough to tell
38
+ * the two cases apart. The stack fallback does not fork, so it reports the default scope even inside an
39
+ * invocation; there the fork degrades to a no-op, which the stack strategy tolerates. This matches the
40
+ * approach used by `patchEventHandler` in Nuxt.
41
+ */
16
42
  function withInvocationIsolationScope(callback, context) {
17
- const isolationScope = core.getIsolationScope();
18
- const isEntryPoint = isolationScope === core.getDefaultIsolationScope() || constructionScopes.has(isolationScope);
19
- const newIsolationScope = isEntryPoint ? isolationScope.clone() : isolationScope;
20
- if (isEntryPoint) {
21
- invocationContext.setInvocationState(newIsolationScope, { ctx: context });
22
- }
23
- return core.withIsolationScope(newIsolationScope, () => callback(newIsolationScope));
43
+ const isolationScope = (0, _sentry_core.getIsolationScope)();
44
+ const isEntryPoint = isolationScope === (0, _sentry_core.getDefaultIsolationScope)() || constructionScopes.has(isolationScope);
45
+ const newIsolationScope = isEntryPoint ? isolationScope.clone() : isolationScope;
46
+ if (isEntryPoint) require_invocationContext.setInvocationState(newIsolationScope, { ctx: context });
47
+ return (0, _sentry_core.withIsolationScope)(newIsolationScope, () => callback(newIsolationScope));
24
48
  }
25
-
26
49
  exports.withConstructionIsolationScope = withConstructionIsolationScope;
27
50
  exports.withInvocationIsolationScope = withInvocationIsolationScope;
28
- //# sourceMappingURL=invocationScope.js.map
51
+
52
+ //# sourceMappingURL=invocationScope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"invocationScope.js","sources":["../../../../src/utils/invocationScope.ts"],"sourcesContent":["import { getDefaultIsolationScope, getIsolationScope, type Scope, withIsolationScope } from '@sentry/core';\nimport type { ExecutionContextCompat } from '../executionContext';\nimport { setInvocationState } from './invocationContext';\n\nconst constructionScopes = new WeakSet<Scope>();\n\n/**\n * Runs a Durable Object constructor on a forked isolation scope.\n *\n * Async work the constructor starts, such as a `blockConcurrencyWhile` callback, runs after the RPC\n * wrappers are installed and inherits this scope, so the calls it makes to the instance's own methods\n * are not treated as incoming RPC calls. The scope is not an invocation: it has no invocation state,\n * and an instrumented handler that this work calls still forks a scope of its own.\n */\nexport function withConstructionIsolationScope<T>(callback: () => T): T {\n if (getIsolationScope() !== getDefaultIsolationScope()) {\n return callback();\n }\n\n return withIsolationScope(scope => {\n constructionScopes.add(scope);\n return callback();\n });\n}\n\n/**\n * Runs `callback` on the isolation scope for the current invocation.\n *\n * An instrumented handler is either the entry point of an invocation or reentrant — reached from\n * another instrumented handler already serving the same invocation (a Durable Object method calling\n * its own `fetch`, an RPC method reaching a sibling method). Only the entry point may fork:\n *\n * - Forking at the entry point is mandatory. `setUser`/`setTag` write to the isolation scope, and a\n * Durable Object's isolation scope outlives the invocation that touched it, so without a fork one\n * invocation's user and tags reappear on the next invocation's events in the same isolate.\n * Forking clones, so request data set by an enclosing wrapper is still inherited.\n * - Forking again when reentrant would be wrong. Everything below the entry point is one logical\n * unit of work: a nested call must see what the caller set and be able to add to it, the way it\n * would if the SDK were not wrapping it at all.\n *\n * The AsyncLocalStorage strategy hands the default isolation scope back whenever no invocation is in\n * flight, and a forked one while inside `withIsolationScope`. Reference-comparing against the default\n * and the construction scopes (see {@link withConstructionIsolationScope}) is therefore enough to tell\n * the two cases apart. The stack fallback does not fork, so it reports the default scope even inside an\n * invocation; there the fork degrades to a no-op, which the stack strategy tolerates. This matches the\n * approach used by `patchEventHandler` in Nuxt.\n */\nexport function withInvocationIsolationScope<T>(callback: (scope: Scope) => T, context?: ExecutionContextCompat): T {\n const isolationScope = getIsolationScope();\n\n const isEntryPoint = isolationScope === getDefaultIsolationScope() || constructionScopes.has(isolationScope);\n const newIsolationScope = isEntryPoint ? isolationScope.clone() : isolationScope;\n\n if (isEntryPoint) {\n setInvocationState(newIsolationScope, { ctx: context });\n }\n\n return withIsolationScope(newIsolationScope, () => callback(newIsolationScope));\n}\n"],"names":["getIsolationScope","getDefaultIsolationScope","withIsolationScope","setInvocationState"],"mappings":";;;;;AAIA,MAAM,kBAAA,uBAAyB,OAAA,EAAe;AAUvC,SAAS,+BAAkC,QAAA,EAAsB;AACtE,EAAA,IAAIA,sBAAA,EAAkB,KAAMC,6BAAA,EAAyB,EAAG;AACtD,IAAA,OAAO,QAAA,EAAS;AAAA,EAClB;AAEA,EAAA,OAAOC,wBAAmB,CAAA,KAAA,KAAS;AACjC,IAAA,kBAAA,CAAmB,IAAI,KAAK,CAAA;AAC5B,IAAA,OAAO,QAAA,EAAS;AAAA,EAClB,CAAC,CAAA;AACH;AAwBO,SAAS,4BAAA,CAAgC,UAA+B,OAAA,EAAqC;AAClH,EAAA,MAAM,iBAAiBF,sBAAA,EAAkB;AAEzC,EAAA,MAAM,eAAe,cAAA,KAAmBC,6BAAA,EAAyB,IAAK,kBAAA,CAAmB,IAAI,cAAc,CAAA;AAC3G,EAAA,MAAM,iBAAA,GAAoB,YAAA,GAAe,cAAA,CAAe,KAAA,EAAM,GAAI,cAAA;AAElE,EAAA,IAAI,YAAA,EAAc;AAChB,IAAAE,oCAAA,CAAmB,iBAAA,EAAmB,EAAE,GAAA,EAAK,OAAA,EAAS,CAAA;AAAA,EACxD;AAEA,EAAA,OAAOD,uBAAA,CAAmB,iBAAA,EAAmB,MAAM,QAAA,CAAS,iBAAiB,CAAC,CAAA;AAChF;;;;;"}
1
+ {"version":3,"file":"invocationScope.js","names":["getIsolationScope","getDefaultIsolationScope","withIsolationScope","setInvocationState"],"sources":["../../../../src/utils/invocationScope.ts"],"sourcesContent":["import { getDefaultIsolationScope, getIsolationScope, type Scope, withIsolationScope } from '@sentry/core';\nimport type { ExecutionContextCompat } from '../executionContext';\nimport { setInvocationState } from './invocationContext';\n\nconst constructionScopes = new WeakSet<Scope>();\n\n/**\n * Runs a Durable Object constructor on a forked isolation scope.\n *\n * Async work the constructor starts, such as a `blockConcurrencyWhile` callback, runs after the RPC\n * wrappers are installed and inherits this scope, so the calls it makes to the instance's own methods\n * are not treated as incoming RPC calls. The scope is not an invocation: it has no invocation state,\n * and an instrumented handler that this work calls still forks a scope of its own.\n */\nexport function withConstructionIsolationScope<T>(callback: () => T): T {\n if (getIsolationScope() !== getDefaultIsolationScope()) {\n return callback();\n }\n\n return withIsolationScope(scope => {\n constructionScopes.add(scope);\n return callback();\n });\n}\n\n/**\n * Runs `callback` on the isolation scope for the current invocation.\n *\n * An instrumented handler is either the entry point of an invocation or reentrant — reached from\n * another instrumented handler already serving the same invocation (a Durable Object method calling\n * its own `fetch`, an RPC method reaching a sibling method). Only the entry point may fork:\n *\n * - Forking at the entry point is mandatory. `setUser`/`setTag` write to the isolation scope, and a\n * Durable Object's isolation scope outlives the invocation that touched it, so without a fork one\n * invocation's user and tags reappear on the next invocation's events in the same isolate.\n * Forking clones, so request data set by an enclosing wrapper is still inherited.\n * - Forking again when reentrant would be wrong. Everything below the entry point is one logical\n * unit of work: a nested call must see what the caller set and be able to add to it, the way it\n * would if the SDK were not wrapping it at all.\n *\n * The AsyncLocalStorage strategy hands the default isolation scope back whenever no invocation is in\n * flight, and a forked one while inside `withIsolationScope`. Reference-comparing against the default\n * and the construction scopes (see {@link withConstructionIsolationScope}) is therefore enough to tell\n * the two cases apart. The stack fallback does not fork, so it reports the default scope even inside an\n * invocation; there the fork degrades to a no-op, which the stack strategy tolerates. This matches the\n * approach used by `patchEventHandler` in Nuxt.\n */\nexport function withInvocationIsolationScope<T>(callback: (scope: Scope) => T, context?: ExecutionContextCompat): T {\n const isolationScope = getIsolationScope();\n\n const isEntryPoint = isolationScope === getDefaultIsolationScope() || constructionScopes.has(isolationScope);\n const newIsolationScope = isEntryPoint ? isolationScope.clone() : isolationScope;\n\n if (isEntryPoint) {\n setInvocationState(newIsolationScope, { ctx: context });\n }\n\n return withIsolationScope(newIsolationScope, () => callback(newIsolationScope));\n}\n"],"mappings":";;;AAIA,MAAM,qCAAqB,IAAI,QAAe;;;;;;;;;AAU9C,SAAgB,+BAAkC,UAAsB;CACtE,KAAA,GAAIA,aAAAA,kBAAAA,CAAkB,OAAA,GAAMC,aAAAA,yBAAAA,CAAyB,GACnD,OAAO,SAAS;CAGlB,QAAA,GAAOC,aAAAA,mBAAAA,EAAmB,UAAS;EACjC,mBAAmB,IAAI,KAAK;EAC5B,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,6BAAgC,UAA+B,SAAqC;CAClH,MAAM,kBAAA,GAAiBF,aAAAA,kBAAAA,CAAkB;CAEzC,MAAM,eAAe,oBAAA,GAAmBC,aAAAA,yBAAAA,CAAyB,KAAK,mBAAmB,IAAI,cAAc;CAC3G,MAAM,oBAAoB,eAAe,eAAe,MAAM,IAAI;CAElE,IAAI,cACFE,0BAAAA,mBAAmB,mBAAmB,EAAE,KAAK,QAAQ,CAAC;CAGxD,QAAA,GAAOD,aAAAA,mBAAAA,CAAmB,yBAAyB,SAAS,iBAAiB,CAAC;AAChF"}
@@ -1,32 +1,63 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ // src/utils/isBinding.ts
2
+ /**
3
+ * Checks if a value is a JSRPC proxy (service binding).
4
+ *
5
+ * JSRPC proxies return a truthy value for ANY property access, including
6
+ * properties that don't exist. This makes other duck-type checks unreliable
7
+ * unless we exclude JSRPC first.
8
+ *
9
+ * Must be checked before other binding type checks.
10
+ */
3
11
  function isJSRPC(item) {
4
- try {
5
- return !!item[`__some_property_that_will_never_exist__${Math.random()}`];
6
- } catch {
7
- return false;
8
- }
12
+ try {
13
+ return !!item[`__some_property_that_will_never_exist__${Math.random()}`];
14
+ } catch {
15
+ return false;
16
+ }
9
17
  }
10
18
  const isNotJSRPC = (item) => !isJSRPC(item);
19
+ /**
20
+ * Duck-type check for DurableObjectNamespace bindings.
21
+ * DurableObjectNamespace has `idFromName`, `idFromString`, `get`, `newUniqueId`.
22
+ */
11
23
  function isDurableObjectNamespace(item) {
12
- return item != null && isNotJSRPC(item) && typeof item.idFromName === "function";
24
+ return item != null && isNotJSRPC(item) && typeof item.idFromName === "function";
13
25
  }
26
+ /**
27
+ * Duck-type check for Queue producer bindings.
28
+ * Queue has `send` and `sendBatch` async methods.
29
+ */
14
30
  function isQueue(item) {
15
- return item != null && isNotJSRPC(item) && typeof item.send === "function" && typeof item.sendBatch === "function";
31
+ return item != null && isNotJSRPC(item) && typeof item.send === "function" && typeof item.sendBatch === "function";
16
32
  }
33
+ /**
34
+ * Duck-type check for D1Database bindings.
35
+ * D1Database has `prepare`, `batch`, and `exec` methods.
36
+ */
17
37
  function isD1Database(item) {
18
- return item != null && isNotJSRPC(item) && typeof item.prepare === "function" && typeof item.batch === "function" && typeof item.exec === "function";
38
+ return item != null && isNotJSRPC(item) && typeof item.prepare === "function" && typeof item.batch === "function" && typeof item.exec === "function";
19
39
  }
40
+ /**
41
+ * Duck-type check for Workers AI bindings.
42
+ * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.
43
+ */
20
44
  function isAiBinding(item) {
21
- return item != null && isNotJSRPC(item) && typeof item.run === "function" && typeof item.gateway === "function" && typeof item.toMarkdown === "function";
45
+ return item != null && isNotJSRPC(item) && typeof item.run === "function" && typeof item.gateway === "function" && typeof item.toMarkdown === "function";
22
46
  }
47
+ /**
48
+ * Duck-type check for Workers KV namespace bindings.
49
+ * KVNamespace has `get`, `put`, `list`, and `getWithMetadata` methods.
50
+ */
23
51
  function isKVNamespace(item) {
24
- return item != null && isNotJSRPC(item) && typeof item.get === "function" && typeof item.put === "function" && typeof item.list === "function" && typeof item.getWithMetadata === "function";
52
+ return item != null && isNotJSRPC(item) && typeof item.get === "function" && typeof item.put === "function" && typeof item.list === "function" && typeof item.getWithMetadata === "function";
25
53
  }
54
+ /**
55
+ * Duck-type check for R2 Bucket bindings.
56
+ * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.
57
+ */
26
58
  function isR2Bucket(item) {
27
- return item != null && isNotJSRPC(item) && typeof item.head === "function" && typeof item.put === "function" && typeof item.createMultipartUpload === "function";
59
+ return item != null && isNotJSRPC(item) && typeof item.head === "function" && typeof item.put === "function" && typeof item.createMultipartUpload === "function";
28
60
  }
29
-
30
61
  exports.isAiBinding = isAiBinding;
31
62
  exports.isD1Database = isD1Database;
32
63
  exports.isDurableObjectNamespace = isDurableObjectNamespace;
@@ -34,4 +65,5 @@ exports.isJSRPC = isJSRPC;
34
65
  exports.isKVNamespace = isKVNamespace;
35
66
  exports.isQueue = isQueue;
36
67
  exports.isR2Bucket = isR2Bucket;
37
- //# sourceMappingURL=isBinding.js.map
68
+
69
+ //# sourceMappingURL=isBinding.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isBinding.js","sources":["../../../../src/utils/isBinding.ts"],"sourcesContent":["/**\n * Adapted from https://github.com/evanderkoogh/otel-cf-workers/blob/effeb549f0a4ed1c55ea0c4f0d8e8e37e5494fb3/src/instrumentation/env.ts\n *\n * BSD 3-Clause License\n *\n * Copyright (c) 2023, Erwin van der Koogh\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. Neither the name of the copyright holder nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { Ai, D1Database, DurableObjectNamespace, KVNamespace, Queue, R2Bucket } from '@cloudflare/workers-types';\n\n/**\n * Checks if a value is a JSRPC proxy (service binding).\n *\n * JSRPC proxies return a truthy value for ANY property access, including\n * properties that don't exist. This makes other duck-type checks unreliable\n * unless we exclude JSRPC first.\n *\n * Must be checked before other binding type checks.\n */\nexport function isJSRPC(item: unknown): item is Service {\n try {\n return !!(item as Record<string, unknown>)[`__some_property_that_will_never_exist__${Math.random()}`];\n } catch {\n return false;\n }\n}\n\nconst isNotJSRPC = (item: unknown): item is Record<string, unknown> => !isJSRPC(item);\n\n/**\n * Duck-type check for DurableObjectNamespace bindings.\n * DurableObjectNamespace has `idFromName`, `idFromString`, `get`, `newUniqueId`.\n */\nexport function isDurableObjectNamespace(item: unknown): item is DurableObjectNamespace {\n return item != null && isNotJSRPC(item) && typeof item.idFromName === 'function';\n}\n\n/**\n * Duck-type check for Queue producer bindings.\n * Queue has `send` and `sendBatch` async methods.\n */\nexport function isQueue(item: unknown): item is Queue {\n return item != null && isNotJSRPC(item) && typeof item.send === 'function' && typeof item.sendBatch === 'function';\n}\n\n/**\n * Duck-type check for D1Database bindings.\n * D1Database has `prepare`, `batch`, and `exec` methods.\n */\nexport function isD1Database(item: unknown): item is D1Database {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.prepare === 'function' &&\n typeof item.batch === 'function' &&\n typeof item.exec === 'function'\n );\n}\n\n/**\n * Duck-type check for Workers AI bindings.\n * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.\n */\nexport function isAiBinding(item: unknown): item is Ai {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.run === 'function' &&\n typeof item.gateway === 'function' &&\n typeof item.toMarkdown === 'function'\n );\n}\n\n/**\n * Duck-type check for Workers KV namespace bindings.\n * KVNamespace has `get`, `put`, `list`, and `getWithMetadata` methods.\n */\nexport function isKVNamespace(item: unknown): item is KVNamespace {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.get === 'function' &&\n typeof item.put === 'function' &&\n typeof item.list === 'function' &&\n typeof item.getWithMetadata === 'function'\n );\n}\n\n/**\n * Duck-type check for R2 Bucket bindings.\n * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.\n */\nexport function isR2Bucket(item: unknown): item is R2Bucket {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.head === 'function' &&\n typeof item.put === 'function' &&\n typeof item.createMultipartUpload === 'function'\n );\n}\n"],"names":[],"mappings":";;AA4CO,SAAS,QAAQ,IAAA,EAAgC;AACtD,EAAA,IAAI;AACF,IAAA,OAAO,CAAC,CAAE,IAAA,CAAiC,0CAA0C,IAAA,CAAK,MAAA,EAAQ,CAAA,CAAE,CAAA;AAAA,EACtG,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAEA,MAAM,UAAA,GAAa,CAAC,IAAA,KAAmD,CAAC,QAAQ,IAAI,CAAA;AAM7E,SAAS,yBAAyB,IAAA,EAA+C;AACtF,EAAA,OAAO,QAAQ,IAAA,IAAQ,UAAA,CAAW,IAAI,CAAA,IAAK,OAAO,KAAK,UAAA,KAAe,UAAA;AACxE;AAMO,SAAS,QAAQ,IAAA,EAA8B;AACpD,EAAA,OAAO,IAAA,IAAQ,IAAA,IAAQ,UAAA,CAAW,IAAI,CAAA,IAAK,OAAO,IAAA,CAAK,IAAA,KAAS,UAAA,IAAc,OAAO,IAAA,CAAK,SAAA,KAAc,UAAA;AAC1G;AAMO,SAAS,aAAa,IAAA,EAAmC;AAC9D,EAAA,OACE,IAAA,IAAQ,IAAA,IACR,UAAA,CAAW,IAAI,KACf,OAAO,IAAA,CAAK,OAAA,KAAY,UAAA,IACxB,OAAO,IAAA,CAAK,KAAA,KAAU,UAAA,IACtB,OAAO,KAAK,IAAA,KAAS,UAAA;AAEzB;AAMO,SAAS,YAAY,IAAA,EAA2B;AACrD,EAAA,OACE,IAAA,IAAQ,IAAA,IACR,UAAA,CAAW,IAAI,KACf,OAAO,IAAA,CAAK,GAAA,KAAQ,UAAA,IACpB,OAAO,IAAA,CAAK,OAAA,KAAY,UAAA,IACxB,OAAO,KAAK,UAAA,KAAe,UAAA;AAE/B;AAMO,SAAS,cAAc,IAAA,EAAoC;AAChE,EAAA,OACE,QAAQ,IAAA,IACR,UAAA,CAAW,IAAI,CAAA,IACf,OAAO,KAAK,GAAA,KAAQ,UAAA,IACpB,OAAO,IAAA,CAAK,GAAA,KAAQ,cACpB,OAAO,IAAA,CAAK,SAAS,UAAA,IACrB,OAAO,KAAK,eAAA,KAAoB,UAAA;AAEpC;AAMO,SAAS,WAAW,IAAA,EAAiC;AAC1D,EAAA,OACE,IAAA,IAAQ,IAAA,IACR,UAAA,CAAW,IAAI,KACf,OAAO,IAAA,CAAK,IAAA,KAAS,UAAA,IACrB,OAAO,IAAA,CAAK,GAAA,KAAQ,UAAA,IACpB,OAAO,KAAK,qBAAA,KAA0B,UAAA;AAE1C;;;;;;;;;;"}
1
+ {"version":3,"file":"isBinding.js","names":[],"sources":["../../../../src/utils/isBinding.ts"],"sourcesContent":["/**\n * Adapted from https://github.com/evanderkoogh/otel-cf-workers/blob/effeb549f0a4ed1c55ea0c4f0d8e8e37e5494fb3/src/instrumentation/env.ts\n *\n * BSD 3-Clause License\n *\n * Copyright (c) 2023, Erwin van der Koogh\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. Neither the name of the copyright holder nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { Ai, D1Database, DurableObjectNamespace, KVNamespace, Queue, R2Bucket } from '@cloudflare/workers-types';\n\n/**\n * Checks if a value is a JSRPC proxy (service binding).\n *\n * JSRPC proxies return a truthy value for ANY property access, including\n * properties that don't exist. This makes other duck-type checks unreliable\n * unless we exclude JSRPC first.\n *\n * Must be checked before other binding type checks.\n */\nexport function isJSRPC(item: unknown): item is Service {\n try {\n return !!(item as Record<string, unknown>)[`__some_property_that_will_never_exist__${Math.random()}`];\n } catch {\n return false;\n }\n}\n\nconst isNotJSRPC = (item: unknown): item is Record<string, unknown> => !isJSRPC(item);\n\n/**\n * Duck-type check for DurableObjectNamespace bindings.\n * DurableObjectNamespace has `idFromName`, `idFromString`, `get`, `newUniqueId`.\n */\nexport function isDurableObjectNamespace(item: unknown): item is DurableObjectNamespace {\n return item != null && isNotJSRPC(item) && typeof item.idFromName === 'function';\n}\n\n/**\n * Duck-type check for Queue producer bindings.\n * Queue has `send` and `sendBatch` async methods.\n */\nexport function isQueue(item: unknown): item is Queue {\n return item != null && isNotJSRPC(item) && typeof item.send === 'function' && typeof item.sendBatch === 'function';\n}\n\n/**\n * Duck-type check for D1Database bindings.\n * D1Database has `prepare`, `batch`, and `exec` methods.\n */\nexport function isD1Database(item: unknown): item is D1Database {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.prepare === 'function' &&\n typeof item.batch === 'function' &&\n typeof item.exec === 'function'\n );\n}\n\n/**\n * Duck-type check for Workers AI bindings.\n * The Ai binding has `run`, `gateway`, and `toMarkdown` methods.\n */\nexport function isAiBinding(item: unknown): item is Ai {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.run === 'function' &&\n typeof item.gateway === 'function' &&\n typeof item.toMarkdown === 'function'\n );\n}\n\n/**\n * Duck-type check for Workers KV namespace bindings.\n * KVNamespace has `get`, `put`, `list`, and `getWithMetadata` methods.\n */\nexport function isKVNamespace(item: unknown): item is KVNamespace {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.get === 'function' &&\n typeof item.put === 'function' &&\n typeof item.list === 'function' &&\n typeof item.getWithMetadata === 'function'\n );\n}\n\n/**\n * Duck-type check for R2 Bucket bindings.\n * R2Bucket has `head`, `put`, and `createMultipartUpload` methods.\n */\nexport function isR2Bucket(item: unknown): item is R2Bucket {\n return (\n item != null &&\n isNotJSRPC(item) &&\n typeof item.head === 'function' &&\n typeof item.put === 'function' &&\n typeof item.createMultipartUpload === 'function'\n );\n}\n"],"mappings":";;;;;;;;;;AA4CA,SAAgB,QAAQ,MAAgC;CACtD,IAAI;EACF,OAAO,CAAC,CAAE,KAAiC,0CAA0C,KAAK,OAAO;CACnG,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAM,cAAc,SAAmD,CAAC,QAAQ,IAAI;;;;;AAMpF,SAAgB,yBAAyB,MAA+C;CACtF,OAAO,QAAQ,QAAQ,WAAW,IAAI,KAAK,OAAO,KAAK,eAAe;AACxE;;;;;AAMA,SAAgB,QAAQ,MAA8B;CACpD,OAAO,QAAQ,QAAQ,WAAW,IAAI,KAAK,OAAO,KAAK,SAAS,cAAc,OAAO,KAAK,cAAc;AAC1G;;;;;AAMA,SAAgB,aAAa,MAAmC;CAC9D,OACE,QAAQ,QACR,WAAW,IAAI,KACf,OAAO,KAAK,YAAY,cACxB,OAAO,KAAK,UAAU,cACtB,OAAO,KAAK,SAAS;AAEzB;;;;;AAMA,SAAgB,YAAY,MAA2B;CACrD,OACE,QAAQ,QACR,WAAW,IAAI,KACf,OAAO,KAAK,QAAQ,cACpB,OAAO,KAAK,YAAY,cACxB,OAAO,KAAK,eAAe;AAE/B;;;;;AAMA,SAAgB,cAAc,MAAoC;CAChE,OACE,QAAQ,QACR,WAAW,IAAI,KACf,OAAO,KAAK,QAAQ,cACpB,OAAO,KAAK,QAAQ,cACpB,OAAO,KAAK,SAAS,cACrB,OAAO,KAAK,oBAAoB;AAEpC;;;;;AAMA,SAAgB,WAAW,MAAiC;CAC1D,OACE,QAAQ,QACR,WAAW,IAAI,KACf,OAAO,KAAK,SAAS,cACrB,OAAO,KAAK,QAAQ,cACpB,OAAO,KAAK,0BAA0B;AAE1C"}
@@ -1,23 +1,14 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ // src/utils/isCloudflareClass.ts
3
2
  function isCloudflareClass(value, className) {
4
- if (!value || typeof value !== "function") {
5
- return false;
6
- }
7
- if (value.name === className) {
8
- return false;
9
- }
10
- let proto = value.prototype;
11
- while (proto) {
12
- const ctor = proto.constructor;
13
- const constructorName = ctor?.name;
14
- if (constructorName === className) {
15
- return true;
16
- }
17
- proto = Object.getPrototypeOf(proto);
18
- }
19
- return false;
3
+ if (!value || typeof value !== "function") return false;
4
+ if (value.name === className) return false;
5
+ let proto = value.prototype;
6
+ while (proto) {
7
+ if (proto.constructor?.name === className) return true;
8
+ proto = Object.getPrototypeOf(proto);
9
+ }
10
+ return false;
20
11
  }
21
-
22
12
  exports.isCloudflareClass = isCloudflareClass;
23
- //# sourceMappingURL=isCloudflareClass.js.map
13
+
14
+ //# sourceMappingURL=isCloudflareClass.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isCloudflareClass.js","sources":["../../../../src/utils/isCloudflareClass.ts"],"sourcesContent":["import type { DurableObject, WorkflowEntrypoint } from 'cloudflare:workers';\nimport type { WorkerEntrypointConstructor } from '../instrumentations/instrumentWorkerEntrypoint';\ntype CloudflareClassName = 'WorkerEntrypoint' | 'DurableObject' | 'WorkflowEntrypoint';\n\n/**\n * Checks if a class constructor extends a specific Cloudflare base class.\n *\n * Uses prototype chain walking with constructor names rather than instanceof,\n * so it works in Node at build time without requiring the cloudflare:workers\n * module (which only exists in the Workers runtime).\n *\n * This is used to differentiate between different Cloudflare worker types:\n * - WorkerEntrypoint: Class-based workers (used with instrumentWorkerEntrypoint)\n * - DurableObject: Durable Object classes\n * - Workflow: Workflow classes\n *\n * For ExportedHandler (plain objects), this will return false for all types.\n *\n * @param value - The value to check (typically a class constructor)\n * @param className - The Cloudflare base class name to check against\n * @returns true if the value is a class that extends the specified Cloudflare class\n *\n * @example\n * ```ts\n * isCloudflareClass(MyWorker, 'WorkerEntrypoint') // true if MyWorker extends WorkerEntrypoint\n * isCloudflareClass(MyDO, 'DurableObject') // true if MyDO extends DurableObject\n * ```\n */\nexport function isCloudflareClass(\n value: unknown,\n className: 'WorkerEntrypoint',\n // oxlint-disable-next-line typescript/no-explicit-any\n): value is WorkerEntrypointConstructor<any, any>;\nexport function isCloudflareClass(\n value: unknown,\n className: 'DurableObject',\n): value is new (...args: unknown[]) => DurableObject;\nexport function isCloudflareClass(\n value: unknown,\n className: 'WorkflowEntrypoint',\n): value is new (...args: unknown[]) => WorkflowEntrypoint;\nexport function isCloudflareClass(value: unknown, className: CloudflareClassName): boolean {\n if (!value || typeof value !== 'function') {\n return false;\n }\n\n if (value.name === className) {\n return false;\n }\n\n let proto: object | null = value.prototype;\n\n while (proto) {\n const ctor = (proto as { constructor?: { name?: string } }).constructor;\n const constructorName = ctor?.name;\n\n if (constructorName === className) {\n return true;\n }\n\n proto = Object.getPrototypeOf(proto);\n }\n\n return false;\n}\n"],"names":[],"mappings":";;AAyCO,SAAS,iBAAA,CAAkB,OAAgB,SAAA,EAAyC;AACzF,EAAA,IAAI,CAAC,KAAA,IAAS,OAAO,KAAA,KAAU,UAAA,EAAY;AACzC,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,KAAA,CAAM,SAAS,SAAA,EAAW;AAC5B,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,IAAI,QAAuB,KAAA,CAAM,SAAA;AAEjC,EAAA,OAAO,KAAA,EAAO;AACZ,IAAA,MAAM,OAAQ,KAAA,CAA8C,WAAA;AAC5D,IAAA,MAAM,kBAAkB,IAAA,EAAM,IAAA;AAE9B,IAAA,IAAI,oBAAoB,SAAA,EAAW;AACjC,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,KAAA,GAAQ,MAAA,CAAO,eAAe,KAAK,CAAA;AAAA,EACrC;AAEA,EAAA,OAAO,KAAA;AACT;;;;"}
1
+ {"version":3,"file":"isCloudflareClass.js","names":[],"sources":["../../../../src/utils/isCloudflareClass.ts"],"sourcesContent":["import type { DurableObject, WorkflowEntrypoint } from 'cloudflare:workers';\nimport type { WorkerEntrypointConstructor } from '../instrumentations/instrumentWorkerEntrypoint';\ntype CloudflareClassName = 'WorkerEntrypoint' | 'DurableObject' | 'WorkflowEntrypoint';\n\n/**\n * Checks if a class constructor extends a specific Cloudflare base class.\n *\n * Uses prototype chain walking with constructor names rather than instanceof,\n * so it works in Node at build time without requiring the cloudflare:workers\n * module (which only exists in the Workers runtime).\n *\n * This is used to differentiate between different Cloudflare worker types:\n * - WorkerEntrypoint: Class-based workers (used with instrumentWorkerEntrypoint)\n * - DurableObject: Durable Object classes\n * - Workflow: Workflow classes\n *\n * For ExportedHandler (plain objects), this will return false for all types.\n *\n * @param value - The value to check (typically a class constructor)\n * @param className - The Cloudflare base class name to check against\n * @returns true if the value is a class that extends the specified Cloudflare class\n *\n * @example\n * ```ts\n * isCloudflareClass(MyWorker, 'WorkerEntrypoint') // true if MyWorker extends WorkerEntrypoint\n * isCloudflareClass(MyDO, 'DurableObject') // true if MyDO extends DurableObject\n * ```\n */\nexport function isCloudflareClass(\n value: unknown,\n className: 'WorkerEntrypoint',\n // oxlint-disable-next-line typescript/no-explicit-any\n): value is WorkerEntrypointConstructor<any, any>;\nexport function isCloudflareClass(\n value: unknown,\n className: 'DurableObject',\n): value is new (...args: unknown[]) => DurableObject;\nexport function isCloudflareClass(\n value: unknown,\n className: 'WorkflowEntrypoint',\n): value is new (...args: unknown[]) => WorkflowEntrypoint;\nexport function isCloudflareClass(value: unknown, className: CloudflareClassName): boolean {\n if (!value || typeof value !== 'function') {\n return false;\n }\n\n if (value.name === className) {\n return false;\n }\n\n let proto: object | null = value.prototype;\n\n while (proto) {\n const ctor = (proto as { constructor?: { name?: string } }).constructor;\n const constructorName = ctor?.name;\n\n if (constructorName === className) {\n return true;\n }\n\n proto = Object.getPrototypeOf(proto);\n }\n\n return false;\n}\n"],"mappings":";AAyCA,SAAgB,kBAAkB,OAAgB,WAAyC;CACzF,IAAI,CAAC,SAAS,OAAO,UAAU,YAC7B,OAAO;CAGT,IAAI,MAAM,SAAS,WACjB,OAAO;CAGT,IAAI,QAAuB,MAAM;CAEjC,OAAO,OAAO;EAIZ,IAHc,MAA8C,aAC9B,SAEN,WACtB,OAAO;EAGT,QAAQ,OAAO,eAAe,KAAK;CACrC;CAEA,OAAO;AACT"}
@@ -0,0 +1,33 @@
1
+ let _sentry_core = require("@sentry/core");
2
+ // src/utils/queueTraceMeta.ts
3
+ const SENTRY_QUEUE_TRACE_KEY = "__sentry_queue_trace__";
4
+ function isQueueTraceCarrier(body) {
5
+ if (typeof body !== "object" || body === null || Array.isArray(body)) return false;
6
+ const prototype = Object.getPrototypeOf(body);
7
+ return prototype === Object.prototype || prototype === null;
8
+ }
9
+ function addQueueTraceContext(body, sentryTrace) {
10
+ if (!isQueueTraceCarrier(body) || !sentryTrace || Object.prototype.hasOwnProperty.call(body, SENTRY_QUEUE_TRACE_KEY)) return body;
11
+ return {
12
+ ...body,
13
+ [SENTRY_QUEUE_TRACE_KEY]: sentryTrace
14
+ };
15
+ }
16
+ function extractQueueTraceContext(body) {
17
+ if (!isQueueTraceCarrier(body)) return;
18
+ if (!Object.prototype.hasOwnProperty.call(body, SENTRY_QUEUE_TRACE_KEY)) return;
19
+ const sentryTrace = body[SENTRY_QUEUE_TRACE_KEY];
20
+ Reflect.deleteProperty(body, SENTRY_QUEUE_TRACE_KEY);
21
+ if (typeof sentryTrace !== "string") return;
22
+ const traceparentData = (0, _sentry_core.extractTraceparentData)(sentryTrace);
23
+ if (!traceparentData?.traceId || !traceparentData.parentSpanId) return;
24
+ return {
25
+ traceId: traceparentData.traceId,
26
+ spanId: traceparentData.parentSpanId,
27
+ sampled: traceparentData.parentSampled
28
+ };
29
+ }
30
+ exports.addQueueTraceContext = addQueueTraceContext;
31
+ exports.extractQueueTraceContext = extractQueueTraceContext;
32
+
33
+ //# sourceMappingURL=queueTraceMeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queueTraceMeta.js","names":["extractTraceparentData"],"sources":["../../../../src/utils/queueTraceMeta.ts"],"sourcesContent":["import { extractTraceparentData } from '@sentry/core';\n\nconst SENTRY_QUEUE_TRACE_KEY = '__sentry_queue_trace__';\n\nfunction isQueueTraceCarrier(body: unknown): body is Record<string, unknown> {\n if (typeof body !== 'object' || body === null || Array.isArray(body)) {\n return false;\n }\n\n // Cloudflare Queues has no message-header API. Only record-like bodies can carry a named field; binary data and\n // other structured-clone values must pass through untouched.\n const prototype = Object.getPrototypeOf(body);\n return prototype === Object.prototype || prototype === null;\n}\n\nexport function addQueueTraceContext(body: unknown, sentryTrace: string | undefined): unknown {\n if (\n !isQueueTraceCarrier(body) ||\n !sentryTrace ||\n Object.prototype.hasOwnProperty.call(body, SENTRY_QUEUE_TRACE_KEY)\n ) {\n return body;\n }\n\n // Cloudflare rejects messages over 128 KB (https://developers.cloudflare.com/queues/platform/limits/),\n // and the field adds about 80 bytes, so a payload right under the limit can start failing to send.\n // Span links only need `sentry-trace`, so baggage would only cost more of that budget. Copy instead\n // of mutating, because callers may reuse a payload after enqueueing it.\n return { ...body, [SENTRY_QUEUE_TRACE_KEY]: sentryTrace };\n}\n\nexport function extractQueueTraceContext(\n body: unknown,\n): { traceId: string; spanId: string; sampled: boolean | undefined } | undefined {\n if (!isQueueTraceCarrier(body)) {\n return undefined;\n }\n\n if (!Object.prototype.hasOwnProperty.call(body, SENTRY_QUEUE_TRACE_KEY)) {\n return undefined;\n }\n\n const sentryTrace = body[SENTRY_QUEUE_TRACE_KEY];\n\n // The key is reserved transport metadata, so strip it even if its value is not a valid trace.\n // Unlike `delete`, this returns false instead of throwing on frozen bodies, which keep the field.\n Reflect.deleteProperty(body, SENTRY_QUEUE_TRACE_KEY);\n\n if (typeof sentryTrace !== 'string') {\n return undefined;\n }\n\n const traceparentData = extractTraceparentData(sentryTrace);\n if (!traceparentData?.traceId || !traceparentData.parentSpanId) {\n return undefined;\n }\n\n return {\n traceId: traceparentData.traceId,\n spanId: traceparentData.parentSpanId,\n sampled: traceparentData.parentSampled,\n };\n}\n"],"mappings":";;AAEA,MAAM,yBAAyB;AAE/B,SAAS,oBAAoB,MAAgD;CAC3E,IAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,MAAM,QAAQ,IAAI,GACjE,OAAO;CAKT,MAAM,YAAY,OAAO,eAAe,IAAI;CAC5C,OAAO,cAAc,OAAO,aAAa,cAAc;AACzD;AAEA,SAAgB,qBAAqB,MAAe,aAA0C;CAC5F,IACE,CAAC,oBAAoB,IAAI,KACzB,CAAC,eACD,OAAO,UAAU,eAAe,KAAK,MAAM,sBAAsB,GAEjE,OAAO;CAOT,OAAO;EAAE,GAAG;GAAO,yBAAyB;CAAY;AAC1D;AAEA,SAAgB,yBACd,MAC+E;CAC/E,IAAI,CAAC,oBAAoB,IAAI,GAC3B;CAGF,IAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,sBAAsB,GACpE;CAGF,MAAM,cAAc,KAAK;CAIzB,QAAQ,eAAe,MAAM,sBAAsB;CAEnD,IAAI,OAAO,gBAAgB,UACzB;CAGF,MAAM,mBAAA,GAAkBA,aAAAA,uBAAAA,CAAuB,WAAW;CAC1D,IAAI,CAAC,iBAAiB,WAAW,CAAC,gBAAgB,cAChD;CAGF,OAAO;EACL,SAAS,gBAAgB;EACzB,QAAQ,gBAAgB;EACxB,SAAS,gBAAgB;CAC3B;AACF"}