@depup/sentry__server-utils 10.67.0-depup.0 → 10.68.0-depup.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 (360) hide show
  1. package/README.md +5 -4
  2. package/build/cjs/integrations/tracing-channel/dataloader.js +17 -7
  3. package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -1
  4. package/build/cjs/integrations/tracing-channel/fastify/index.js +2 -4
  5. package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -1
  6. package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -1
  7. package/build/cjs/integrations/tracing-channel/firebase/firestore.js +78 -0
  8. package/build/cjs/integrations/tracing-channel/firebase/firestore.js.map +1 -0
  9. package/build/cjs/integrations/tracing-channel/firebase/functions.js +67 -0
  10. package/build/cjs/integrations/tracing-channel/firebase/functions.js.map +1 -0
  11. package/build/cjs/integrations/tracing-channel/firebase/index.js +24 -0
  12. package/build/cjs/integrations/tracing-channel/firebase/index.js.map +1 -0
  13. package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js +66 -0
  14. package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
  15. package/build/cjs/orchestrion/bundler/esbuild.js +24 -1
  16. package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -1
  17. package/build/cjs/orchestrion/bundler/options.js +16 -2
  18. package/build/cjs/orchestrion/bundler/options.js.map +1 -1
  19. package/build/cjs/orchestrion/bundler/rollup.js +11 -1
  20. package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
  21. package/build/cjs/orchestrion/bundler/subscribeInjection.js +40 -0
  22. package/build/cjs/orchestrion/bundler/subscribeInjection.js.map +1 -0
  23. package/build/cjs/orchestrion/bundler/vite.js +13 -0
  24. package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
  25. package/build/cjs/orchestrion/bundler/webpack.js +32 -1
  26. package/build/cjs/orchestrion/bundler/webpack.js.map +1 -1
  27. package/build/cjs/orchestrion/channels.js +0 -4
  28. package/build/cjs/orchestrion/channels.js.map +1 -1
  29. package/build/cjs/orchestrion/config/amqplib.js +4 -0
  30. package/build/cjs/orchestrion/config/amqplib.js.map +1 -1
  31. package/build/cjs/orchestrion/config/anthropic-ai.js +4 -0
  32. package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
  33. package/build/cjs/orchestrion/config/aws-sdk.js +4 -0
  34. package/build/cjs/orchestrion/config/aws-sdk.js.map +1 -1
  35. package/build/cjs/orchestrion/config/channel-integration-definitions.js +29 -0
  36. package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -0
  37. package/build/cjs/orchestrion/config/dataloader.js +4 -0
  38. package/build/cjs/orchestrion/config/dataloader.js.map +1 -1
  39. package/build/cjs/orchestrion/config/express.js +4 -0
  40. package/build/cjs/orchestrion/config/express.js.map +1 -1
  41. package/build/cjs/orchestrion/config/firebase.js +79 -2
  42. package/build/cjs/orchestrion/config/firebase.js.map +1 -1
  43. package/build/cjs/orchestrion/config/generic-pool.js +4 -0
  44. package/build/cjs/orchestrion/config/generic-pool.js.map +1 -1
  45. package/build/cjs/orchestrion/config/google-genai.js +4 -0
  46. package/build/cjs/orchestrion/config/google-genai.js.map +1 -1
  47. package/build/cjs/orchestrion/config/graphql.js +4 -0
  48. package/build/cjs/orchestrion/config/graphql.js.map +1 -1
  49. package/build/cjs/orchestrion/config/hapi.js +4 -0
  50. package/build/cjs/orchestrion/config/hapi.js.map +1 -1
  51. package/build/cjs/orchestrion/config/index.js +33 -5
  52. package/build/cjs/orchestrion/config/index.js.map +1 -1
  53. package/build/cjs/orchestrion/config/ioredis.js +4 -0
  54. package/build/cjs/orchestrion/config/ioredis.js.map +1 -1
  55. package/build/cjs/orchestrion/config/kafkajs.js +4 -0
  56. package/build/cjs/orchestrion/config/kafkajs.js.map +1 -1
  57. package/build/cjs/orchestrion/config/knex.js +4 -0
  58. package/build/cjs/orchestrion/config/knex.js.map +1 -1
  59. package/build/cjs/orchestrion/config/koa.js +4 -0
  60. package/build/cjs/orchestrion/config/koa.js.map +1 -1
  61. package/build/cjs/orchestrion/config/langchain.js +4 -0
  62. package/build/cjs/orchestrion/config/langchain.js.map +1 -1
  63. package/build/cjs/orchestrion/config/langgraph.js +4 -0
  64. package/build/cjs/orchestrion/config/langgraph.js.map +1 -1
  65. package/build/cjs/orchestrion/config/lru-memoizer.js +4 -0
  66. package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -1
  67. package/build/cjs/orchestrion/config/mongodb.js +4 -0
  68. package/build/cjs/orchestrion/config/mongodb.js.map +1 -1
  69. package/build/cjs/orchestrion/config/mongoose.js +4 -0
  70. package/build/cjs/orchestrion/config/mongoose.js.map +1 -1
  71. package/build/cjs/orchestrion/config/mysql.js +4 -0
  72. package/build/cjs/orchestrion/config/mysql.js.map +1 -1
  73. package/build/cjs/orchestrion/config/mysql2.js +4 -0
  74. package/build/cjs/orchestrion/config/mysql2.js.map +1 -1
  75. package/build/cjs/orchestrion/config/nestjs.js +4 -0
  76. package/build/cjs/orchestrion/config/nestjs.js.map +1 -1
  77. package/build/cjs/orchestrion/config/openai.js +4 -0
  78. package/build/cjs/orchestrion/config/openai.js.map +1 -1
  79. package/build/cjs/orchestrion/config/pg.js +4 -0
  80. package/build/cjs/orchestrion/config/pg.js.map +1 -1
  81. package/build/cjs/orchestrion/config/postgres.js +4 -0
  82. package/build/cjs/orchestrion/config/postgres.js.map +1 -1
  83. package/build/cjs/orchestrion/config/redis.js +4 -0
  84. package/build/cjs/orchestrion/config/redis.js.map +1 -1
  85. package/build/cjs/orchestrion/config/remix.js +4 -0
  86. package/build/cjs/orchestrion/config/remix.js.map +1 -1
  87. package/build/cjs/orchestrion/config/subscribe-injection.js +25 -0
  88. package/build/cjs/orchestrion/config/subscribe-injection.js.map +1 -0
  89. package/build/cjs/orchestrion/config/tedious.js +4 -0
  90. package/build/cjs/orchestrion/config/tedious.js.map +1 -1
  91. package/build/cjs/orchestrion/config/vercel-ai.js +4 -0
  92. package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
  93. package/build/cjs/orchestrion/index.js +12 -7
  94. package/build/cjs/orchestrion/index.js.map +1 -1
  95. package/build/cjs/orchestrion/registerChannelIntegration.js +13 -0
  96. package/build/cjs/orchestrion/registerChannelIntegration.js.map +1 -0
  97. package/build/cjs/vercel-ai/index.js.map +1 -1
  98. package/build/esm/integrations/tracing-channel/dataloader.js +17 -7
  99. package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -1
  100. package/build/esm/integrations/tracing-channel/fastify/index.js +2 -4
  101. package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -1
  102. package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -1
  103. package/build/esm/integrations/tracing-channel/firebase/firestore.js +75 -0
  104. package/build/esm/integrations/tracing-channel/firebase/firestore.js.map +1 -0
  105. package/build/esm/integrations/tracing-channel/firebase/functions.js +65 -0
  106. package/build/esm/integrations/tracing-channel/firebase/functions.js.map +1 -0
  107. package/build/esm/integrations/tracing-channel/firebase/index.js +22 -0
  108. package/build/esm/integrations/tracing-channel/firebase/index.js.map +1 -0
  109. package/build/esm/integrations/tracing-channel/firebase/instrumentation.js +64 -0
  110. package/build/esm/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
  111. package/build/esm/orchestrion/bundler/esbuild.js +25 -2
  112. package/build/esm/orchestrion/bundler/esbuild.js.map +1 -1
  113. package/build/esm/orchestrion/bundler/options.js +15 -3
  114. package/build/esm/orchestrion/bundler/options.js.map +1 -1
  115. package/build/esm/orchestrion/bundler/rollup.js +12 -2
  116. package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
  117. package/build/esm/orchestrion/bundler/subscribeInjection.js +38 -0
  118. package/build/esm/orchestrion/bundler/subscribeInjection.js.map +1 -0
  119. package/build/esm/orchestrion/bundler/vite.js +14 -1
  120. package/build/esm/orchestrion/bundler/vite.js.map +1 -1
  121. package/build/esm/orchestrion/bundler/webpack.js +33 -3
  122. package/build/esm/orchestrion/bundler/webpack.js.map +1 -1
  123. package/build/esm/orchestrion/channels.js +0 -4
  124. package/build/esm/orchestrion/channels.js.map +1 -1
  125. package/build/esm/orchestrion/config/amqplib.js +4 -1
  126. package/build/esm/orchestrion/config/amqplib.js.map +1 -1
  127. package/build/esm/orchestrion/config/anthropic-ai.js +4 -1
  128. package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
  129. package/build/esm/orchestrion/config/aws-sdk.js +4 -1
  130. package/build/esm/orchestrion/config/aws-sdk.js.map +1 -1
  131. package/build/esm/orchestrion/config/channel-integration-definitions.js +26 -0
  132. package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -0
  133. package/build/esm/orchestrion/config/dataloader.js +4 -1
  134. package/build/esm/orchestrion/config/dataloader.js.map +1 -1
  135. package/build/esm/orchestrion/config/express.js +4 -1
  136. package/build/esm/orchestrion/config/express.js.map +1 -1
  137. package/build/esm/orchestrion/config/firebase.js +79 -3
  138. package/build/esm/orchestrion/config/firebase.js.map +1 -1
  139. package/build/esm/orchestrion/config/generic-pool.js +4 -1
  140. package/build/esm/orchestrion/config/generic-pool.js.map +1 -1
  141. package/build/esm/orchestrion/config/google-genai.js +4 -1
  142. package/build/esm/orchestrion/config/google-genai.js.map +1 -1
  143. package/build/esm/orchestrion/config/graphql.js +4 -1
  144. package/build/esm/orchestrion/config/graphql.js.map +1 -1
  145. package/build/esm/orchestrion/config/hapi.js +4 -1
  146. package/build/esm/orchestrion/config/hapi.js.map +1 -1
  147. package/build/esm/orchestrion/config/index.js +61 -34
  148. package/build/esm/orchestrion/config/index.js.map +1 -1
  149. package/build/esm/orchestrion/config/ioredis.js +4 -1
  150. package/build/esm/orchestrion/config/ioredis.js.map +1 -1
  151. package/build/esm/orchestrion/config/kafkajs.js +4 -1
  152. package/build/esm/orchestrion/config/kafkajs.js.map +1 -1
  153. package/build/esm/orchestrion/config/knex.js +4 -1
  154. package/build/esm/orchestrion/config/knex.js.map +1 -1
  155. package/build/esm/orchestrion/config/koa.js +4 -1
  156. package/build/esm/orchestrion/config/koa.js.map +1 -1
  157. package/build/esm/orchestrion/config/langchain.js +4 -1
  158. package/build/esm/orchestrion/config/langchain.js.map +1 -1
  159. package/build/esm/orchestrion/config/langgraph.js +4 -1
  160. package/build/esm/orchestrion/config/langgraph.js.map +1 -1
  161. package/build/esm/orchestrion/config/lru-memoizer.js +4 -1
  162. package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -1
  163. package/build/esm/orchestrion/config/mongodb.js +4 -1
  164. package/build/esm/orchestrion/config/mongodb.js.map +1 -1
  165. package/build/esm/orchestrion/config/mongoose.js +4 -1
  166. package/build/esm/orchestrion/config/mongoose.js.map +1 -1
  167. package/build/esm/orchestrion/config/mysql.js +4 -1
  168. package/build/esm/orchestrion/config/mysql.js.map +1 -1
  169. package/build/esm/orchestrion/config/mysql2.js +4 -1
  170. package/build/esm/orchestrion/config/mysql2.js.map +1 -1
  171. package/build/esm/orchestrion/config/nestjs.js +4 -1
  172. package/build/esm/orchestrion/config/nestjs.js.map +1 -1
  173. package/build/esm/orchestrion/config/openai.js +4 -1
  174. package/build/esm/orchestrion/config/openai.js.map +1 -1
  175. package/build/esm/orchestrion/config/pg.js +4 -1
  176. package/build/esm/orchestrion/config/pg.js.map +1 -1
  177. package/build/esm/orchestrion/config/postgres.js +4 -1
  178. package/build/esm/orchestrion/config/postgres.js.map +1 -1
  179. package/build/esm/orchestrion/config/redis.js +4 -1
  180. package/build/esm/orchestrion/config/redis.js.map +1 -1
  181. package/build/esm/orchestrion/config/remix.js +4 -1
  182. package/build/esm/orchestrion/config/remix.js.map +1 -1
  183. package/build/esm/orchestrion/config/subscribe-injection.js +22 -0
  184. package/build/esm/orchestrion/config/subscribe-injection.js.map +1 -0
  185. package/build/esm/orchestrion/config/tedious.js +4 -1
  186. package/build/esm/orchestrion/config/tedious.js.map +1 -1
  187. package/build/esm/orchestrion/config/vercel-ai.js +4 -1
  188. package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
  189. package/build/esm/orchestrion/index.js +5 -2
  190. package/build/esm/orchestrion/index.js.map +1 -1
  191. package/build/esm/orchestrion/registerChannelIntegration.js +11 -0
  192. package/build/esm/orchestrion/registerChannelIntegration.js.map +1 -0
  193. package/build/esm/package.json +1 -1
  194. package/build/esm/vercel-ai/index.js.map +1 -1
  195. package/build/types/index.d.ts +1 -1
  196. package/build/types/index.d.ts.map +1 -1
  197. package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -1
  198. package/build/types/integrations/tracing-channel/fastify/index.d.ts +2 -2
  199. package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -1
  200. package/build/types/integrations/tracing-channel/fastify/utils.d.ts +1 -1
  201. package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -1
  202. package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
  203. package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts.map +1 -0
  204. package/build/types/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
  205. package/build/types/integrations/tracing-channel/firebase/firestore.d.ts.map +1 -0
  206. package/build/types/integrations/tracing-channel/firebase/functions.d.ts +15 -0
  207. package/build/types/integrations/tracing-channel/firebase/functions.d.ts.map +1 -0
  208. package/build/types/integrations/tracing-channel/firebase/index.d.ts +15 -0
  209. package/build/types/integrations/tracing-channel/firebase/index.d.ts.map +1 -0
  210. package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
  211. package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts.map +1 -0
  212. package/build/types/integrations/tracing-channel/vercel-ai.d.ts +1 -5
  213. package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -1
  214. package/build/types/orchestrion/bundler/esbuild.d.ts +2 -3
  215. package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -1
  216. package/build/types/orchestrion/bundler/options.d.ts +34 -0
  217. package/build/types/orchestrion/bundler/options.d.ts.map +1 -1
  218. package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
  219. package/build/types/orchestrion/bundler/subscribeInjection.d.ts +13 -0
  220. package/build/types/orchestrion/bundler/subscribeInjection.d.ts.map +1 -0
  221. package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
  222. package/build/types/orchestrion/bundler/webpack.d.ts +6 -1
  223. package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -1
  224. package/build/types/orchestrion/channels.d.ts +15 -0
  225. package/build/types/orchestrion/channels.d.ts.map +1 -1
  226. package/build/types/orchestrion/config/amqplib.d.ts +2 -0
  227. package/build/types/orchestrion/config/amqplib.d.ts.map +1 -1
  228. package/build/types/orchestrion/config/anthropic-ai.d.ts +2 -0
  229. package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
  230. package/build/types/orchestrion/config/aws-sdk.d.ts +2 -0
  231. package/build/types/orchestrion/config/aws-sdk.d.ts.map +1 -1
  232. package/build/types/orchestrion/config/channel-integration-definitions.d.ts +81 -0
  233. package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -0
  234. package/build/types/orchestrion/config/dataloader.d.ts +2 -0
  235. package/build/types/orchestrion/config/dataloader.d.ts.map +1 -1
  236. package/build/types/orchestrion/config/express.d.ts +2 -0
  237. package/build/types/orchestrion/config/express.d.ts.map +1 -1
  238. package/build/types/orchestrion/config/firebase.d.ts +41 -2
  239. package/build/types/orchestrion/config/firebase.d.ts.map +1 -1
  240. package/build/types/orchestrion/config/generic-pool.d.ts +2 -0
  241. package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -1
  242. package/build/types/orchestrion/config/google-genai.d.ts +2 -0
  243. package/build/types/orchestrion/config/google-genai.d.ts.map +1 -1
  244. package/build/types/orchestrion/config/graphql.d.ts +2 -0
  245. package/build/types/orchestrion/config/graphql.d.ts.map +1 -1
  246. package/build/types/orchestrion/config/hapi.d.ts +2 -0
  247. package/build/types/orchestrion/config/hapi.d.ts.map +1 -1
  248. package/build/types/orchestrion/config/index.d.ts +12 -0
  249. package/build/types/orchestrion/config/index.d.ts.map +1 -1
  250. package/build/types/orchestrion/config/ioredis.d.ts +1 -0
  251. package/build/types/orchestrion/config/ioredis.d.ts.map +1 -1
  252. package/build/types/orchestrion/config/kafkajs.d.ts +2 -0
  253. package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -1
  254. package/build/types/orchestrion/config/knex.d.ts +1 -0
  255. package/build/types/orchestrion/config/knex.d.ts.map +1 -1
  256. package/build/types/orchestrion/config/koa.d.ts +2 -0
  257. package/build/types/orchestrion/config/koa.d.ts.map +1 -1
  258. package/build/types/orchestrion/config/langchain.d.ts +2 -0
  259. package/build/types/orchestrion/config/langchain.d.ts.map +1 -1
  260. package/build/types/orchestrion/config/langgraph.d.ts +2 -0
  261. package/build/types/orchestrion/config/langgraph.d.ts.map +1 -1
  262. package/build/types/orchestrion/config/lru-memoizer.d.ts +2 -0
  263. package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -1
  264. package/build/types/orchestrion/config/mongodb.d.ts +2 -0
  265. package/build/types/orchestrion/config/mongodb.d.ts.map +1 -1
  266. package/build/types/orchestrion/config/mongoose.d.ts +2 -0
  267. package/build/types/orchestrion/config/mongoose.d.ts.map +1 -1
  268. package/build/types/orchestrion/config/mysql.d.ts +2 -0
  269. package/build/types/orchestrion/config/mysql.d.ts.map +1 -1
  270. package/build/types/orchestrion/config/mysql2.d.ts +2 -0
  271. package/build/types/orchestrion/config/mysql2.d.ts.map +1 -1
  272. package/build/types/orchestrion/config/nestjs.d.ts +1 -0
  273. package/build/types/orchestrion/config/nestjs.d.ts.map +1 -1
  274. package/build/types/orchestrion/config/openai.d.ts +2 -0
  275. package/build/types/orchestrion/config/openai.d.ts.map +1 -1
  276. package/build/types/orchestrion/config/pg.d.ts +2 -0
  277. package/build/types/orchestrion/config/pg.d.ts.map +1 -1
  278. package/build/types/orchestrion/config/postgres.d.ts +1 -0
  279. package/build/types/orchestrion/config/postgres.d.ts.map +1 -1
  280. package/build/types/orchestrion/config/redis.d.ts +2 -0
  281. package/build/types/orchestrion/config/redis.d.ts.map +1 -1
  282. package/build/types/orchestrion/config/remix.d.ts +1 -0
  283. package/build/types/orchestrion/config/remix.d.ts.map +1 -1
  284. package/build/types/orchestrion/config/subscribe-injection.d.ts +31 -0
  285. package/build/types/orchestrion/config/subscribe-injection.d.ts.map +1 -0
  286. package/build/types/orchestrion/config/tedious.d.ts +1 -0
  287. package/build/types/orchestrion/config/tedious.d.ts.map +1 -1
  288. package/build/types/orchestrion/config/vercel-ai.d.ts +1 -0
  289. package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -1
  290. package/build/types/orchestrion/index.d.ts +7 -6
  291. package/build/types/orchestrion/index.d.ts.map +1 -1
  292. package/build/types/orchestrion/registerChannelIntegration.d.ts +33 -0
  293. package/build/types/orchestrion/registerChannelIntegration.d.ts.map +1 -0
  294. package/build/types/vercel-ai/index.d.ts +2 -3
  295. package/build/types/vercel-ai/index.d.ts.map +1 -1
  296. package/build/types-ts3.8/index.d.ts +1 -1
  297. package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +2 -2
  298. package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +1 -1
  299. package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
  300. package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
  301. package/build/types-ts3.8/integrations/tracing-channel/firebase/functions.d.ts +15 -0
  302. package/build/types-ts3.8/integrations/tracing-channel/firebase/index.d.ts +15 -0
  303. package/build/types-ts3.8/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
  304. package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +1 -5
  305. package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +2 -3
  306. package/build/types-ts3.8/orchestrion/bundler/options.d.ts +34 -0
  307. package/build/types-ts3.8/orchestrion/bundler/subscribeInjection.d.ts +13 -0
  308. package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +6 -1
  309. package/build/types-ts3.8/orchestrion/channels.d.ts +15 -0
  310. package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +2 -0
  311. package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +2 -0
  312. package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +2 -0
  313. package/build/types-ts3.8/orchestrion/config/channel-integration-definitions.d.ts +139 -0
  314. package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +2 -0
  315. package/build/types-ts3.8/orchestrion/config/express.d.ts +2 -0
  316. package/build/types-ts3.8/orchestrion/config/firebase.d.ts +41 -2
  317. package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +2 -0
  318. package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +2 -0
  319. package/build/types-ts3.8/orchestrion/config/graphql.d.ts +2 -0
  320. package/build/types-ts3.8/orchestrion/config/hapi.d.ts +2 -0
  321. package/build/types-ts3.8/orchestrion/config/index.d.ts +12 -0
  322. package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +1 -0
  323. package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +2 -0
  324. package/build/types-ts3.8/orchestrion/config/knex.d.ts +1 -0
  325. package/build/types-ts3.8/orchestrion/config/koa.d.ts +2 -0
  326. package/build/types-ts3.8/orchestrion/config/langchain.d.ts +2 -0
  327. package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +2 -0
  328. package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +2 -0
  329. package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +2 -0
  330. package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +2 -0
  331. package/build/types-ts3.8/orchestrion/config/mysql.d.ts +2 -0
  332. package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +2 -0
  333. package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +1 -0
  334. package/build/types-ts3.8/orchestrion/config/openai.d.ts +2 -0
  335. package/build/types-ts3.8/orchestrion/config/pg.d.ts +2 -0
  336. package/build/types-ts3.8/orchestrion/config/postgres.d.ts +1 -0
  337. package/build/types-ts3.8/orchestrion/config/redis.d.ts +2 -0
  338. package/build/types-ts3.8/orchestrion/config/remix.d.ts +1 -0
  339. package/build/types-ts3.8/orchestrion/config/subscribe-injection.d.ts +31 -0
  340. package/build/types-ts3.8/orchestrion/config/tedious.d.ts +1 -0
  341. package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +1 -0
  342. package/build/types-ts3.8/orchestrion/index.d.ts +7 -6
  343. package/build/types-ts3.8/orchestrion/registerChannelIntegration.d.ts +33 -0
  344. package/build/types-ts3.8/vercel-ai/index.d.ts +2 -3
  345. package/changes.json +7 -3
  346. package/package.json +11 -6
  347. package/build/cjs/orchestrion/config/prisma.js +0 -8
  348. package/build/cjs/orchestrion/config/prisma.js.map +0 -1
  349. package/build/cjs/orchestrion/config/react-router.js +0 -8
  350. package/build/cjs/orchestrion/config/react-router.js.map +0 -1
  351. package/build/esm/orchestrion/config/prisma.js +0 -5
  352. package/build/esm/orchestrion/config/prisma.js.map +0 -1
  353. package/build/esm/orchestrion/config/react-router.js +0 -5
  354. package/build/esm/orchestrion/config/react-router.js.map +0 -1
  355. package/build/types/orchestrion/config/prisma.d.ts +0 -4
  356. package/build/types/orchestrion/config/prisma.d.ts.map +0 -1
  357. package/build/types/orchestrion/config/react-router.d.ts +0 -4
  358. package/build/types/orchestrion/config/react-router.d.ts.map +0 -1
  359. package/build/types-ts3.8/orchestrion/config/prisma.d.ts +0 -4
  360. package/build/types-ts3.8/orchestrion/config/react-router.d.ts +0 -4
package/README.md CHANGED
@@ -13,17 +13,18 @@ npm install @depup/sentry__server-utils
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@sentry/server-utils](https://www.npmjs.com/package/@sentry/server-utils) @ 10.67.0 |
17
- | Processed | 2026-07-21 |
16
+ | Original | [@sentry/server-utils](https://www.npmjs.com/package/@sentry/server-utils) @ 10.68.0 |
17
+ | Processed | 2026-07-24 |
18
18
  | Smoke test | passed |
19
- | Deps updated | 2 |
19
+ | Deps updated | 3 |
20
20
 
21
21
  ## Dependency Changes
22
22
 
23
23
  | Dependency | From | To |
24
24
  |------------|------|-----|
25
- | @apm-js-collab/code-transformer-bundler-plugins | ^0.7.1 | ^0.7.2 |
25
+ | @apm-js-collab/code-transformer-bundler-plugins | 0.7.1 | ^0.7.2 |
26
26
  | @sentry/conventions | ^0.16.0 | ^0.17.0 |
27
+ | meriyah | ^6.1.4 | ^7.2.0 |
27
28
 
28
29
  ---
29
30
 
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const attributes = require('@sentry/conventions/attributes');
4
5
  const core = require('@sentry/core');
5
6
  const debugBuild = require('../../debug-build.js');
6
7
  const channels = require('../../orchestrion/channels.js');
@@ -15,7 +16,13 @@ function getSpanName(loader, operation) {
15
16
  const name = loader?.name;
16
17
  return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;
17
18
  }
18
- function makeSpanOptions(loader, operation) {
19
+ function getCacheKey(keyArg) {
20
+ if (Array.isArray(keyArg)) {
21
+ return keyArg.map((key) => String(key));
22
+ }
23
+ return keyArg == null ? void 0 : [String(keyArg)];
24
+ }
25
+ function makeSpanOptions(loader, operation, keyArg) {
19
26
  const isCacheGet = operation === "load" || operation === "loadMany" || operation === "batch";
20
27
  return {
21
28
  name: getSpanName(loader, operation),
@@ -26,7 +33,8 @@ function makeSpanOptions(loader, operation) {
26
33
  op: isCacheGet ? CACHE_GET_OP : void 0,
27
34
  onlyIfParent: true,
28
35
  attributes: {
29
- [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
36
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
37
+ [attributes.CACHE_KEY]: isCacheGet ? getCacheKey(keyArg) : void 0
30
38
  }
31
39
  };
32
40
  }
@@ -59,7 +67,7 @@ function subscribeConstruct() {
59
67
  const original = batchLoadFn;
60
68
  const wrapped = function(...args) {
61
69
  return core.startSpan(
62
- { ...makeSpanOptions(this, "batch"), links: this._batch?.spanLinks },
70
+ { ...makeSpanOptions(this, "batch", args[0]), links: this._batch?.spanLinks },
63
71
  () => original.apply(this, args)
64
72
  );
65
73
  };
@@ -69,7 +77,9 @@ function subscribeConstruct() {
69
77
  }
70
78
  function subscribeLoad() {
71
79
  const channel = diagnosticsChannel.tracingChannel(channels.CHANNELS.DATALOADER_LOAD);
72
- tracingChannel.bindTracingChannelToSpan(channel, (data) => startInactiveSpanFor(data.self, "load"), { requiresParentSpan: true });
80
+ tracingChannel.bindTracingChannelToSpan(channel, (data) => startInactiveSpanFor(data.self, "load", data.arguments[0]), {
81
+ requiresParentSpan: true
82
+ });
73
83
  channel.end.subscribe((message) => {
74
84
  const data = message;
75
85
  const span = data._sentrySpan;
@@ -82,12 +92,12 @@ function subscribeLoad() {
82
92
  function subscribeSimpleOperation(channelName, operation) {
83
93
  tracingChannel.bindTracingChannelToSpan(
84
94
  diagnosticsChannel.tracingChannel(channelName),
85
- (data) => startInactiveSpanFor(data.self, operation),
95
+ (data) => startInactiveSpanFor(data.self, operation, data.arguments[0]),
86
96
  { requiresParentSpan: true }
87
97
  );
88
98
  }
89
- function startInactiveSpanFor(loader, operation) {
90
- return core.startInactiveSpan(makeSpanOptions(loader, operation));
99
+ function startInactiveSpanFor(loader, operation, keyArg) {
100
+ return core.startInactiveSpan(makeSpanOptions(loader, operation, keyArg));
91
101
  }
92
102
  const dataloaderChannelIntegration = core.defineIntegration(_dataloaderChannelIntegration);
93
103
 
@@ -1 +1 @@
1
- {"version":3,"file":"dataloader.js","sources":["../../../../src/integrations/tracing-channel/dataloader.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n startSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { ChannelName } from '../../orchestrion/channels';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport type { TracingChannelPayloadWithSpan } from '../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design.\n// When enabled, the OTel 'Dataloader' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Dataloader' as const;\n\nconst MODULE_NAME = 'dataloader';\nconst ORIGIN = 'auto.db.orchestrion.dataloader';\n\n// `load`, `loadMany` and `batch` are cache reads; the rest are cache mutations that get no `op`.\nconst CACHE_GET_OP = 'cache.get';\n\ntype Operation = 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll';\n\n// The link shape shared between a `load` span and the `batch` span it triggers.\ntype DataLoaderSpanLink = { context: ReturnType<Span['spanContext']> };\n\n// The private batch object `dataloader` stores on the loader. We stash the pending `load` span links\n// here (matching the vendored OTel instrumentation) so the batch span can link back to them.\ninterface DataLoaderBatch {\n spanLinks?: DataLoaderSpanLink[];\n}\n\ninterface DataLoaderInstance {\n name?: string | null;\n _batch?: DataLoaderBatch | null;\n}\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context`. Documented here rather\n * than imported because orchestrion's runtime doesn't export it.\n */\ninterface DataLoaderChannelContext {\n arguments: unknown[];\n self?: DataLoaderInstance;\n result?: unknown;\n error?: unknown;\n}\n\n// Marks a wrapped `batchLoadFn` so a re-used loader (or a double construct) isn't wrapped twice.\nconst WRAPPED = Symbol('sentry.dataloader.wrapped');\n\nfunction getSpanName(loader: DataLoaderInstance | undefined, operation: Operation): string {\n const name = loader?.name;\n\n return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;\n}\n\nfunction makeSpanOptions(loader: DataLoaderInstance | undefined, operation: Operation): StartSpanOptions {\n const isCacheGet = operation === 'load' || operation === 'loadMany' || operation === 'batch';\n\n return {\n name: getSpanName(loader, operation),\n // Every direct operation (`load`/`loadMany`/`prime`/`clear`/`clearAll`) is a client call, matching\n // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network\n // peer, so it gets no kind.\n kind: operation === 'batch' ? undefined : SPAN_KIND.CLIENT,\n op: isCacheGet ? CACHE_GET_OP : undefined,\n onlyIfParent: true,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n };\n}\n\nconst _dataloaderChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD && debug.log('[orchestrion:dataloader] subscribing to dataloader tracing channels');\n\n waitForTracingChannelBinding(() => {\n subscribeConstruct();\n subscribeLoad();\n subscribeSimpleOperation(CHANNELS.DATALOADER_LOAD_MANY, 'loadMany');\n subscribeSimpleOperation(CHANNELS.DATALOADER_PRIME, 'prime');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR, 'clear');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR_ALL, 'clearAll');\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Wraps the user's `batchLoadFn` (constructor arg 0) so the batch span opens when it runs on the\n * deferred dispatch tick. The span links back to the `load` calls that populated the batch.\n */\nfunction subscribeConstruct(): void {\n diagnosticsChannel\n .tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_CONSTRUCT)\n .start.subscribe(message => {\n const data = message as DataLoaderChannelContext;\n const batchLoadFn = data.arguments[0];\n if (typeof batchLoadFn !== 'function' || (batchLoadFn as { [WRAPPED]?: boolean })[WRAPPED]) {\n return;\n }\n\n const original = batchLoadFn as (...args: unknown[]) => unknown;\n const wrapped = function (this: DataLoaderInstance, ...args: unknown[]): unknown {\n return startSpan({ ...makeSpanOptions(this, 'batch'), links: this._batch?.spanLinks }, () =>\n original.apply(this, args),\n );\n };\n (wrapped as { [WRAPPED]?: boolean })[WRAPPED] = true;\n data.arguments[0] = wrapped;\n });\n}\n\n/**\n * `load` is a cache read that additionally records its span so the batch it feeds into can link back.\n *\n * The span itself is `Async` (ends on `asyncEnd`, so its duration covers the awaited load). But the\n * link has to be recorded earlier, on the synchronous `end` (fired when `load` returns): the batch\n * dispatches on a deferred tick and reads `spanLinks` at batch-span creation, which happens BEFORE\n * `load`'s promise resolves (`asyncEnd`) — so recording at span end would be too late and drop the\n * link. The sync `end` runs after `dataloader` has assigned `this._batch` in `load`'s body and before\n * the deferred dispatch, so the link lands in time.\n */\nfunction subscribeLoad(): void {\n const channel = diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_LOAD);\n\n bindTracingChannelToSpan(channel, data => startInactiveSpanFor(data.self, 'load'), { requiresParentSpan: true });\n\n channel.end.subscribe(message => {\n const data = message as TracingChannelPayloadWithSpan<DataLoaderChannelContext>;\n const span = data._sentrySpan;\n const batch = data.self?._batch;\n if (span && batch && span.isRecording()) {\n (batch.spanLinks ??= []).push({ context: span.spanContext() });\n }\n });\n}\n\nfunction subscribeSimpleOperation(channelName: ChannelName, operation: Operation): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(channelName),\n data => startInactiveSpanFor(data.self, operation),\n { requiresParentSpan: true },\n );\n}\n\nfunction startInactiveSpanFor(loader: DataLoaderInstance | undefined, operation: Operation): Span {\n return startInactiveSpan(makeSpanOptions(loader, operation));\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven `dataloader` integration.\n *\n * Subscribes to the `orchestrion:dataloader:*` diagnostics_channels that the orchestrion code\n * transform injects into `dataloader`'s constructor and prototype methods. Requires the orchestrion\n * runtime hook or bundler plugin to be active.\n */\nexport const dataloaderChannelIntegration = defineIntegration(_dataloaderChannelIntegration);\n"],"names":["SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","DEBUG_BUILD","debug","waitForTracingChannelBinding","CHANNELS","startSpan","bindTracingChannelToSpan","startInactiveSpan","defineIntegration"],"mappings":";;;;;;;;AAmBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,MAAA,GAAS,gCAAA;AAGf,MAAM,YAAA,GAAe,WAAA;AA8BrB,MAAM,OAAA,0BAAiB,2BAA2B,CAAA;AAElD,SAAS,WAAA,CAAY,QAAwC,SAAA,EAA8B;AACzF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AAErB,EAAA,OAAO,IAAA,GAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,GAAK,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AACnF;AAEA,SAAS,eAAA,CAAgB,QAAwC,SAAA,EAAwC;AACvG,EAAA,MAAM,UAAA,GAAa,SAAA,KAAc,MAAA,IAAU,SAAA,KAAc,cAAc,SAAA,KAAc,OAAA;AAErF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA,CAAY,MAAA,EAAQ,SAAS,CAAA;AAAA;AAAA;AAAA;AAAA,IAInC,IAAA,EAAM,SAAA,KAAc,OAAA,GAAU,MAAA,GAAYA,cAAA,CAAU,MAAA;AAAA,IACpD,EAAA,EAAI,aAAa,YAAA,GAAe,MAAA;AAAA,IAChC,YAAA,EAAc,IAAA;AAAA,IACd,UAAA,EAAY;AAAA,MACV,CAACC,qCAAgC,GAAG;AAAA;AACtC,GACF;AACF;AAEA,MAAM,iCAAiC,MAAM;AAC3C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAAC,sBAAA,IA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el from 'node:diagnostics_channel';\nimport { CACHE_KEY } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n startSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { ChannelName } from '../../orchestrion/channels';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport type { TracingChannelPayloadWithSpan } from '../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design.\n// When enabled, the OTel 'Dataloader' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Dataloader' as const;\n\nconst MODULE_NAME = 'dataloader';\nconst ORIGIN = 'auto.db.orchestrion.dataloader';\n\n// `load`, `loadMany` and `batch` are cache reads; the rest are cache mutations that get no `op`.\nconst CACHE_GET_OP = 'cache.get';\n\ntype Operation = 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll';\n\n// The link shape shared between a `load` span and the `batch` span it triggers.\ntype DataLoaderSpanLink = { context: ReturnType<Span['spanContext']> };\n\n// The private batch object `dataloader` stores on the loader. We stash the pending `load` span links\n// here (matching the vendored OTel instrumentation) so the batch span can link back to them.\ninterface DataLoaderBatch {\n spanLinks?: DataLoaderSpanLink[];\n}\n\ninterface DataLoaderInstance {\n name?: string | null;\n _batch?: DataLoaderBatch | null;\n}\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context`. Documented here rather\n * than imported because orchestrion's runtime doesn't export it.\n */\ninterface DataLoaderChannelContext {\n arguments: unknown[];\n self?: DataLoaderInstance;\n result?: unknown;\n error?: unknown;\n}\n\n// Marks a wrapped `batchLoadFn` so a re-used loader (or a double construct) isn't wrapped twice.\nconst WRAPPED = Symbol('sentry.dataloader.wrapped');\n\nfunction getSpanName(loader: DataLoaderInstance | undefined, operation: Operation): string {\n const name = loader?.name;\n\n return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;\n}\n\n// `load` receives a single key, `loadMany`/`batch` receive a key array. Normalize both to the\n// `string[]` shape `cache.key` expects.\nfunction getCacheKey(keyArg: unknown): string[] | undefined {\n if (Array.isArray(keyArg)) {\n return keyArg.map(key => String(key));\n }\n\n return keyArg == null ? undefined : [String(keyArg)];\n}\n\nfunction makeSpanOptions(\n loader: DataLoaderInstance | undefined,\n operation: Operation,\n keyArg?: unknown,\n): StartSpanOptions {\n const isCacheGet = operation === 'load' || operation === 'loadMany' || operation === 'batch';\n\n return {\n name: getSpanName(loader, operation),\n // Every direct operation (`load`/`loadMany`/`prime`/`clear`/`clearAll`) is a client call, matching\n // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network\n // peer, so it gets no kind.\n kind: operation === 'batch' ? undefined : SPAN_KIND.CLIENT,\n op: isCacheGet ? CACHE_GET_OP : undefined,\n onlyIfParent: true,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [CACHE_KEY]: isCacheGet ? getCacheKey(keyArg) : undefined,\n },\n };\n}\n\nconst _dataloaderChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD && debug.log('[orchestrion:dataloader] subscribing to dataloader tracing channels');\n\n waitForTracingChannelBinding(() => {\n subscribeConstruct();\n subscribeLoad();\n subscribeSimpleOperation(CHANNELS.DATALOADER_LOAD_MANY, 'loadMany');\n subscribeSimpleOperation(CHANNELS.DATALOADER_PRIME, 'prime');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR, 'clear');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR_ALL, 'clearAll');\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Wraps the user's `batchLoadFn` (constructor arg 0) so the batch span opens when it runs on the\n * deferred dispatch tick. The span links back to the `load` calls that populated the batch.\n */\nfunction subscribeConstruct(): void {\n diagnosticsChannel\n .tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_CONSTRUCT)\n .start.subscribe(message => {\n const data = message as DataLoaderChannelContext;\n const batchLoadFn = data.arguments[0];\n if (typeof batchLoadFn !== 'function' || (batchLoadFn as { [WRAPPED]?: boolean })[WRAPPED]) {\n return;\n }\n\n const original = batchLoadFn as (...args: unknown[]) => unknown;\n const wrapped = function (this: DataLoaderInstance, ...args: unknown[]): unknown {\n // `batchLoadFn` receives the batched keys as its first argument.\n return startSpan({ ...makeSpanOptions(this, 'batch', args[0]), links: this._batch?.spanLinks }, () =>\n original.apply(this, args),\n );\n };\n (wrapped as { [WRAPPED]?: boolean })[WRAPPED] = true;\n data.arguments[0] = wrapped;\n });\n}\n\n/**\n * `load` is a cache read that additionally records its span so the batch it feeds into can link back.\n *\n * The span itself is `Async` (ends on `asyncEnd`, so its duration covers the awaited load). But the\n * link has to be recorded earlier, on the synchronous `end` (fired when `load` returns): the batch\n * dispatches on a deferred tick and reads `spanLinks` at batch-span creation, which happens BEFORE\n * `load`'s promise resolves (`asyncEnd`) — so recording at span end would be too late and drop the\n * link. The sync `end` runs after `dataloader` has assigned `this._batch` in `load`'s body and before\n * the deferred dispatch, so the link lands in time.\n */\nfunction subscribeLoad(): void {\n const channel = diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_LOAD);\n\n bindTracingChannelToSpan(channel, data => startInactiveSpanFor(data.self, 'load', data.arguments[0]), {\n requiresParentSpan: true,\n });\n\n channel.end.subscribe(message => {\n const data = message as TracingChannelPayloadWithSpan<DataLoaderChannelContext>;\n const span = data._sentrySpan;\n const batch = data.self?._batch;\n if (span && batch && span.isRecording()) {\n (batch.spanLinks ??= []).push({ context: span.spanContext() });\n }\n });\n}\n\nfunction subscribeSimpleOperation(channelName: ChannelName, operation: Operation): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(channelName),\n data => startInactiveSpanFor(data.self, operation, data.arguments[0]),\n { requiresParentSpan: true },\n );\n}\n\nfunction startInactiveSpanFor(loader: DataLoaderInstance | undefined, operation: Operation, keyArg?: unknown): Span {\n return startInactiveSpan(makeSpanOptions(loader, operation, keyArg));\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven `dataloader` integration.\n *\n * Subscribes to the `orchestrion:dataloader:*` diagnostics_channels that the orchestrion code\n * transform injects into `dataloader`'s constructor and prototype methods. Requires the orchestrion\n * runtime hook or bundler plugin to be active.\n */\nexport const dataloaderChannelIntegration = defineIntegration(_dataloaderChannelIntegration);\n"],"names":["SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","CACHE_KEY","DEBUG_BUILD","debug","waitForTracingChannelBinding","CHANNELS","startSpan","bindTracingChannelToSpan","startInactiveSpan","defineIntegration"],"mappings":";;;;;;;;;AAoBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,MAAA,GAAS,gCAAA;AAGf,MAAM,YAAA,GAAe,WAAA;AA8BrB,MAAM,OAAA,0BAAiB,2BAA2B,CAAA;AAElD,SAAS,WAAA,CAAY,QAAwC,SAAA,EAA8B;AACzF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AAErB,EAAA,OAAO,IAAA,GAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,GAAK,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AACnF;AAIA,SAAS,YAAY,MAAA,EAAuC;AAC1D,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAA,GAAA,KAAO,MAAA,CAAO,GAAG,CA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,CAAA,OAAA,KAAW;AAC/B,IAAA,MAAM,IAAA,GAAO,OAAA;AACb,IAAA,MAAM,OAAO,IAAA,CAAK,WAAA;AAClB,IAAA,MAAM,KAAA,GAAQ,KAAK,IAAA,EAAM,MAAA;AACzB,IAAA,IAAI,IAAA,IAAQ,KAAA,IAAS,IAAA,CAAK,WAAA,EAAY,EAAG;AACvC,MAAA,CAAC,KAAA,CAAM,SAAA,KAAN,KAAA,CAAM,SAAA,GAAc,EAAC,CAAA,EAAG,IAAA,CAAK,EAAE,OAAA,EAAS,IAAA,CAAK,WAAA,EAAY,EAAG,CAAA;AAAA,IAC/D;AAAA,EACF,CAAC,CAAA;AACH;AAEA,SAAS,wBAAA,CAAyB,aAA0B,SAAA,EAA4B;AACtF,EAAAA,uCAAA;AAAA,IACE,kBAAA,CAAmB,eAAyC,WAAW,CAAA;AAAA,IACvE,CAAA,IAAA,KAAQ,qBAAqB,IAAA,CAAK,IAAA,EAAM,WAAW,IAAA,CAAK,SAAA,CAAU,CAAC,CAAC,CAAA;AAAA,IACpE,EAAE,oBAAoB,IAAA;AAAK,GAC7B;AACF;AAEA,SAAS,oBAAA,CAAqB,MAAA,EAAwC,SAAA,EAAsB,MAAA,EAAwB;AAClH,EAAA,OAAOC,sBAAA,CAAkB,eAAA,CAAgB,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAC,CAAA;AACrE;AASO,MAAM,4BAAA,GAA+BC,uBAAkB,6BAA6B;;;;"}
@@ -5,7 +5,7 @@ const instrumentation = require('./instrumentation.js');
5
5
  const utils = require('./utils.js');
6
6
  const errors = require('./errors.js');
7
7
 
8
- const _fastifyIntegration = (({ shouldHandleError }) => {
8
+ const _fastifyIntegration = (({ shouldHandleError } = {}) => {
9
9
  let _shouldHandleError;
10
10
  return {
11
11
  name: utils.INTEGRATION_NAME,
@@ -22,9 +22,7 @@ const _fastifyIntegration = (({ shouldHandleError }) => {
22
22
  }
23
23
  };
24
24
  });
25
- const fastifyIntegration = core.defineIntegration(
26
- (options = {}) => _fastifyIntegration(options)
27
- );
25
+ const fastifyIntegration = core.defineIntegration(_fastifyIntegration);
28
26
  const instrumentFastify = instrumentation.instrumentFastify;
29
27
  const handleFastifyError = errors.handleFastifyError;
30
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\n\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions>) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration((options: Partial<FastifyIntegrationOptions> = {}) =>\n _fastifyIntegration(options),\n);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["INTEGRATION_NAME","defaultShouldHandleError","subscribeToFastifyErrorChannel","_instrumentFastify","shouldHandleError","defineIntegration","_handleFastifyError"],"mappings":";;;;;;;AA2CA,MAAM,mBAAA,IAAuB,CAAC,EAAE,iBAAA,EAAkB,KAA0C;AAC1F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAMA,sBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqBC,8BAAA;AAE1C,MAAAC,qCAAA,EAA+B;AAC/B,MAAAC,iCAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqBC,sBAAA;AAAA,EAAkB,CAAC,OAAA,GAA8C,EAAC,KAClG,oBAAoB,OAAO;AAC7B;AAKO,MAAM,iBAAA,GAAoBF;AAK1B,MAAM,kBAAA,GAAqBG;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions> = {}) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration(_fastifyIntegration);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["INTEGRATION_NAME","defaultShouldHandleError","subscribeToFastifyErrorChannel","_instrumentFastify","shouldHandleError","defineIntegration","_handleFastifyError"],"mappings":";;;;;;;AA0CA,MAAM,uBAAuB,CAAC,EAAE,iBAAA,EAAkB,GAAwC,EAAC,KAAM;AAC/F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAMA,sBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqBC,8BAAA;AAE1C,MAAAC,qCAAA,EAA+B;AAC/B,MAAAC,iCAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqBC,uBAAkB,mBAAmB;AAKhE,MAAM,iBAAA,GAAoBF;AAK1B,MAAM,kBAAA,GAAqBG;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify';\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify' as const;\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;;"}
@@ -0,0 +1,78 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const net = require('node:net');
4
+ const attributes = require('@sentry/conventions/attributes');
5
+ const core = require('@sentry/core');
6
+
7
+ function startFirestoreSpan(spanName, reference) {
8
+ return core.startInactiveSpan({
9
+ name: `${spanName} ${reference.path}`,
10
+ op: "db.query",
11
+ kind: core.SPAN_KIND.CLIENT,
12
+ attributes: {
13
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.firebase.orchestrion.firestore",
14
+ [attributes.DB_OPERATION_NAME]: spanName,
15
+ ...buildAttributes(reference)
16
+ }
17
+ });
18
+ }
19
+ function getPortAndAddress(settings) {
20
+ let address;
21
+ let port;
22
+ if (typeof settings.host === "string") {
23
+ if (settings.host.startsWith("[")) {
24
+ if (settings.host.endsWith("]")) {
25
+ address = settings.host.replace(/^\[|\]$/g, "");
26
+ } else if (settings.host.includes("]:")) {
27
+ const lastColonIndex = settings.host.lastIndexOf(":");
28
+ if (lastColonIndex !== -1) {
29
+ address = settings.host.slice(1, lastColonIndex).replace(/^\[|\]$/g, "");
30
+ port = settings.host.slice(lastColonIndex + 1);
31
+ }
32
+ }
33
+ } else {
34
+ if (net.isIPv6(settings.host)) {
35
+ address = settings.host;
36
+ } else {
37
+ const lastColonIndex = settings.host.lastIndexOf(":");
38
+ if (lastColonIndex !== -1) {
39
+ address = settings.host.slice(0, lastColonIndex);
40
+ port = settings.host.slice(lastColonIndex + 1);
41
+ } else {
42
+ address = settings.host;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ return {
48
+ address,
49
+ port: port ? parseInt(port, 10) : void 0
50
+ };
51
+ }
52
+ function buildAttributes(reference) {
53
+ const firestoreApp = reference.firestore.app;
54
+ const firestoreOptions = firestoreApp.options;
55
+ const settings = reference.firestore.toJSON()?.settings || {};
56
+ const attributes$1 = {
57
+ [attributes.DB_COLLECTION_NAME]: reference.path,
58
+ [attributes.DB_NAMESPACE]: firestoreApp.name,
59
+ [attributes.DB_SYSTEM_NAME]: "firebase.firestore",
60
+ "firebase.firestore.type": reference.type,
61
+ "firebase.firestore.options.projectId": firestoreOptions.projectId,
62
+ "firebase.firestore.options.appId": firestoreOptions.appId,
63
+ "firebase.firestore.options.messagingSenderId": firestoreOptions.messagingSenderId,
64
+ "firebase.firestore.options.storageBucket": firestoreOptions.storageBucket
65
+ };
66
+ const { address, port } = getPortAndAddress(settings);
67
+ if (address) {
68
+ attributes$1[attributes.SERVER_ADDRESS] = address;
69
+ }
70
+ if (port) {
71
+ attributes$1[attributes.SERVER_PORT] = port;
72
+ }
73
+ return attributes$1;
74
+ }
75
+
76
+ exports.getPortAndAddress = getPortAndAddress;
77
+ exports.startFirestoreSpan = startFirestoreSpan;
78
+ //# sourceMappingURL=firestore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.js","sources":["../../../../../src/integrations/tracing-channel/firebase/firestore.ts"],"sourcesContent":["import * as net from 'node:net';\nimport {\n DB_COLLECTION_NAME,\n DB_NAMESPACE,\n DB_OPERATION_NAME,\n DB_SYSTEM_NAME,\n SERVER_ADDRESS,\n SERVER_PORT,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_KIND, startInactiveSpan } from '@sentry/core';\nimport type { FirebaseApp, FirebaseOptions, FirestoreReference, FirestoreSettings } from './firestore-types';\n\n/**\n * Opens the inactive `db.query` span for a Firestore operation. `bindTracingChannelToSpan` makes it the\n * active span for the traced call and ends it when the call settles. Mirrors the OTel integration's span,\n * with a distinct `auto.firebase.orchestrion.firestore` origin.\n */\nexport function startFirestoreSpan(spanName: string, reference: FirestoreReference): Span {\n return startInactiveSpan({\n name: `${spanName} ${reference.path}`,\n op: 'db.query',\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.firebase.orchestrion.firestore',\n [DB_OPERATION_NAME]: spanName,\n ...buildAttributes(reference),\n },\n });\n}\n\n/**\n * Gets the server address and port attributes from the Firestore settings.\n * It's best effort to extract the address and port from the settings, especially for IPv6.\n * @param settings - The Firestore settings containing host information.\n */\nexport function getPortAndAddress(settings: FirestoreSettings): {\n address?: string;\n port?: number;\n} {\n let address: string | undefined;\n let port: string | undefined;\n\n if (typeof settings.host === 'string') {\n if (settings.host.startsWith('[')) {\n // IPv6 addresses can be enclosed in square brackets, e.g., [2001:db8::1]:8080\n if (settings.host.endsWith(']')) {\n // IPv6 with square brackets without port\n address = settings.host.replace(/^\\[|\\]$/g, '');\n } else if (settings.host.includes(']:')) {\n // IPv6 with square brackets with port\n const lastColonIndex = settings.host.lastIndexOf(':');\n if (lastColonIndex !== -1) {\n address = settings.host.slice(1, lastColonIndex).replace(/^\\[|\\]$/g, '');\n port = settings.host.slice(lastColonIndex + 1);\n }\n }\n } else {\n // IPv4 or IPv6 without square brackets\n // If it's an IPv6 address without square brackets, we assume it does not have a port.\n if (net.isIPv6(settings.host)) {\n address = settings.host;\n }\n // If it's an IPv4 address, we can extract the port if it exists.\n else {\n const lastColonIndex = settings.host.lastIndexOf(':');\n if (lastColonIndex !== -1) {\n address = settings.host.slice(0, lastColonIndex);\n port = settings.host.slice(lastColonIndex + 1);\n } else {\n address = settings.host;\n }\n }\n }\n }\n return {\n address: address,\n port: port ? parseInt(port, 10) : undefined,\n };\n}\n\nfunction buildAttributes(reference: FirestoreReference): SpanAttributes {\n const firestoreApp: FirebaseApp = reference.firestore.app;\n const firestoreOptions: FirebaseOptions = firestoreApp.options;\n const settings: FirestoreSettings = reference.firestore.toJSON()?.settings || {};\n\n const attributes: SpanAttributes = {\n [DB_COLLECTION_NAME]: reference.path,\n [DB_NAMESPACE]: firestoreApp.name,\n [DB_SYSTEM_NAME]: 'firebase.firestore',\n 'firebase.firestore.type': reference.type,\n 'firebase.firestore.options.projectId': firestoreOptions.projectId,\n 'firebase.firestore.options.appId': firestoreOptions.appId,\n 'firebase.firestore.options.messagingSenderId': firestoreOptions.messagingSenderId,\n 'firebase.firestore.options.storageBucket': firestoreOptions.storageBucket,\n };\n\n const { address, port } = getPortAndAddress(settings);\n\n if (address) {\n attributes[SERVER_ADDRESS] = address;\n }\n if (port) {\n attributes[SERVER_PORT] = port;\n }\n\n return attributes;\n}\n"],"names":["startInactiveSpan","SPAN_KIND","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","DB_OPERATION_NAME","attributes","DB_COLLECTION_NAME","DB_NAMESPACE","DB_SYSTEM_NAME","SERVER_ADDRESS","SERVER_PORT"],"mappings":";;;;;;AAkBO,SAAS,kBAAA,CAAmB,UAAkB,SAAA,EAAqC;AACxF,EAAA,OAAOA,sBAAA,CAAkB;AAAA,IACvB,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,CAAA,EAAI,UAAU,IAAI,CAAA,CAAA;AAAA,IACnC,EAAA,EAAI,UAAA;AAAA,IACJ,MAAMC,cAAA,CAAU,MAAA;AAAA,IAChB,UAAA,EAAY;AAAA,MACV,CAACC,qCAAgC,GAAG,qCAAA;AAAA,MACpC,CAACC,4BAAiB,GAAG,QAAA;AAAA,MACrB,GAAG,gBAAgB,SAAS;AAAA;AAC9B,GACD,CAAA;AACH;AAOO,SAAS,kBAAkB,QAAA,EAGhC;AACA,EAAA,IAAI,OAAA;AACJ,EAAA,IAAI,IAAA;AAEJ,EAAA,IAAI,OAAO,QAAA,CAAS,IAAA,KAAS,QAAA,EAAU;AACrC,IAAA,IAAI,QAAA,CAAS,IAAA,CAAK,UAAA,CAAW,GAAG,CAAA,EAAG;AAEjC,MAAA,IAAI,QAAA,CAAS,IAAA,CAAK,QAAA,CAAS,GAAG,CAAA,EAAG;AAE/B,QAAA,OAAA,GAAU,QAAA,CAAS,IAAA,CAAK,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAA;AAAA,MAChD,CAAA,MAAA,IAAW,QAAA,CAAS,IAAA,CAAK,QAAA,CAAS,IAAI,CAAA,EAAG;AAEvC,QAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,IAAA,CAAK,WAAA,CAA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BAAkB,GAAG,SAAA,CAAU,IAAA;AAAA,IAChC,CAACC,uBAAY,GAAG,YAAA,CAAa,IAAA;AAAA,IAC7B,CAACC,yBAAc,GAAG,oBAAA;AAAA,IAClB,2BAA2B,SAAA,CAAU,IAAA;AAAA,IACrC,wCAAwC,gBAAA,CAAiB,SAAA;AAAA,IACzD,oCAAoC,gBAAA,CAAiB,KAAA;AAAA,IACrD,gDAAgD,gBAAA,CAAiB,iBAAA;AAAA,IACjE,4CAA4C,gBAAA,CAAiB;AAAA,GAC/D;AAEA,EAAA,MAAM,EAAE,OAAA,EAAS,IAAA,EAAK,GAAI,kBAAkB,QAAQ,CAAA;AAEpD,EAAA,IAAI,OAAA,EAAS;AACX,IAAAH,YAAA,CAAWI,yBAAc,CAAA,GAAI,OAAA;AAAA,EAC/B;AACA,EAAA,IAAI,IAAA,EAAM;AACR,IAAAJ,YAAA,CAAWK,sBAAW,CAAA,GAAI,IAAA;AAAA,EAC5B;AAEA,EAAA,OAAOL,YAAA;AACT;;;;;"}
@@ -0,0 +1,67 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const attributes = require('@sentry/conventions/attributes');
4
+ const core = require('@sentry/core');
5
+
6
+ const FUNCTIONS_ORIGIN = "auto.firebase.orchestrion.functions";
7
+ const WRAPPED = "__sentryFirebaseWrapped";
8
+ function wrapFunctionsRegistration(data, triggerType) {
9
+ const args = data.arguments;
10
+ if (!Array.isArray(args) || args.length === 0) {
11
+ return;
12
+ }
13
+ const handlerIndex = typeof args[0] === "function" ? 0 : 1;
14
+ const handler = args[handlerIndex];
15
+ if (typeof handler !== "function" || handler[WRAPPED]) {
16
+ return;
17
+ }
18
+ args[handlerIndex] = wrapHandler(handler, triggerType);
19
+ }
20
+ function wrapHandler(handler, triggerType) {
21
+ const wrapped = async function(...handlerArgs) {
22
+ const functionName = process.env.FUNCTION_TARGET || process.env.K_SERVICE || "unknown";
23
+ const attributes$1 = {
24
+ [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN,
25
+ [attributes.FAAS_NAME]: functionName,
26
+ [attributes.FAAS_TRIGGER]: triggerType,
27
+ "faas.provider": "firebase"
28
+ };
29
+ if (process.env.GCLOUD_PROJECT) {
30
+ attributes$1["cloud.project_id"] = process.env.GCLOUD_PROJECT;
31
+ }
32
+ if (process.env.EVENTARC_CLOUD_EVENT_SOURCE) {
33
+ attributes$1["cloud.event_source"] = process.env.EVENTARC_CLOUD_EVENT_SOURCE;
34
+ }
35
+ return core.startSpanManual(
36
+ {
37
+ name: `firebase.function.${triggerType}`,
38
+ op: "function.firebase",
39
+ kind: core.SPAN_KIND.SERVER,
40
+ attributes: attributes$1
41
+ },
42
+ async (span) => {
43
+ try {
44
+ const result = await handler.apply(this, handlerArgs);
45
+ span.end();
46
+ return result;
47
+ } catch (error) {
48
+ span.setStatus({ code: core.SPAN_STATUS_ERROR });
49
+ core.captureException(error, {
50
+ mechanism: {
51
+ type: FUNCTIONS_ORIGIN,
52
+ handled: false
53
+ }
54
+ });
55
+ span.end();
56
+ await core.flush(2e3);
57
+ throw error;
58
+ }
59
+ }
60
+ );
61
+ };
62
+ wrapped[WRAPPED] = true;
63
+ return wrapped;
64
+ }
65
+
66
+ exports.wrapFunctionsRegistration = wrapFunctionsRegistration;
67
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sources":["../../../../../src/integrations/tracing-channel/firebase/functions.ts"],"sourcesContent":["import { FAAS_NAME, FAAS_TRIGGER } from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport {\n captureException,\n flush,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\n\nconst FUNCTIONS_ORIGIN = 'auto.firebase.orchestrion.functions';\n\n// Set on a wrapped handler so re-entrant `start` events don't double-wrap it.\nconst WRAPPED = '__sentryFirebaseWrapped';\n\ntype Handler = (this: unknown, ...args: unknown[]) => unknown;\n\ninterface FunctionsChannelContext {\n // The live args of the `onX(...)` registration call. firebase-functions accepts either\n // `onX(handler)` or `onX(documentOrOptions, handler)`, so the handler is `arguments[0]` when it's a\n // function, otherwise `arguments[1]`. Mutating the entry here swaps in the wrapped handler.\n arguments: unknown[];\n self?: unknown;\n}\n\n/**\n * Rewrap the handler argument of a firebase-functions `onX(...)` registration so the returned cloud\n * function opens a `SERVER` span (and error boundary) each time it's invoked. Runs as the tracing\n * channel's `start` subscriber, before orchestrion forwards the (mutated) arguments to the real call.\n *\n * The registration call itself is trivial and synchronous, so — unlike the firestore path — this does\n * not bind a span to the channel; it only uses the channel as an injection point.\n */\nexport function wrapFunctionsRegistration(data: FunctionsChannelContext, triggerType: string): void {\n const args = data.arguments;\n if (!Array.isArray(args) || args.length === 0) {\n return;\n }\n\n const handlerIndex = typeof args[0] === 'function' ? 0 : 1;\n const handler = args[handlerIndex];\n\n if (typeof handler !== 'function' || (handler as unknown as Record<string, unknown>)[WRAPPED]) {\n return;\n }\n\n args[handlerIndex] = wrapHandler(handler as Handler, triggerType);\n}\n\nfunction wrapHandler(handler: Handler, triggerType: string): Handler {\n const wrapped = async function (this: unknown, ...handlerArgs: unknown[]): Promise<unknown> {\n const functionName = process.env.FUNCTION_TARGET || process.env.K_SERVICE || 'unknown';\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: FUNCTIONS_ORIGIN,\n [FAAS_NAME]: functionName,\n [FAAS_TRIGGER]: triggerType,\n 'faas.provider': 'firebase',\n };\n\n if (process.env.GCLOUD_PROJECT) {\n attributes['cloud.project_id'] = process.env.GCLOUD_PROJECT;\n }\n\n if (process.env.EVENTARC_CLOUD_EVENT_SOURCE) {\n attributes['cloud.event_source'] = process.env.EVENTARC_CLOUD_EVENT_SOURCE;\n }\n\n // `startSpanManual` keeps the span active while still allowing us to end it before flushing on error.\n return startSpanManual(\n {\n name: `firebase.function.${triggerType}`,\n op: 'function.firebase',\n kind: SPAN_KIND.SERVER,\n attributes,\n },\n async span => {\n try {\n const result = await handler.apply(this, handlerArgs);\n span.end();\n return result;\n } catch (error) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n captureException(error, {\n mechanism: {\n type: FUNCTIONS_ORIGIN,\n handled: false,\n },\n });\n span.end();\n await flush(2000);\n throw error;\n }\n },\n );\n };\n\n (wrapped as unknown as Record<string, unknown>)[WRAPPED] = true;\n return wrapped;\n}\n"],"names":["attributes","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","FAAS_NAME","FAAS_TRIGGER","startSpanManual","SPAN_KIND","SPAN_STATUS_ERROR","captureException","flush"],"mappings":";;;;;AAWA,MAAM,gBAAA,GAAmB,qCAAA;AAGzB,MAAM,OAAA,GAAU,yBAAA;AAoBT,SAAS,yBAAA,CAA0B,MAA+B,WAAA,EAA2B;AAClG,EAAA,MAAM,OAAO,IAAA,CAAK,SAAA;AAClB,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,IAAK,IAAA,CAAK,WAAW,CAAA,EAAG;AAC7C,IAAA;AAAA,EACF;AAEA,EAAA,MAAM,eAAe,OAAO,IAAA,CAAK,CAAC,CAAA,KAAM,aAAa,CAAA,GAAI,CAAA;AACzD,EAAA,MAAM,OAAA,GAAU,KAAK,YAAY,CAAA;AAEjC,EAAA,IAAI,OAAO,OAAA,KAAY,UAAA,IAAe,OAAA,CAA+C,OAAO,CAAA,EAAG;AAC7F,IAAA;AAAA,EACF;AAEA,EAAA,IAAA,CAAK,YAAY,CAAA,GAAI,WAAA,CAAY,OAAA,EAAoB,WAAW,CAAA;AAClE;AAEA,SAAS,WAAA,CAAY,SAAkB,WAAA,EAA8B;AACnE,EAAA,MAAM,OAAA,GAAU,kBAAkC,WAAA,EAA0C;AAC1F,IAAA,MAAM,eAAe,OAAA,CAAQ,GAAA,CAAI,eAAA,IAAmB,OAAA,CAAQ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AAAA,EACF,CAAA;AAEA,EAAC,OAAA,CAA+C,OAAO,CAAA,GAAI,IAAA;AAC3D,EAAA,OAAO,OAAA;AACT;;;;"}
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const instrumentation = require('./instrumentation.js');
6
+
7
+ const INTEGRATION_NAME = "Firebase";
8
+ const _firebaseChannelIntegration = (() => {
9
+ return {
10
+ name: INTEGRATION_NAME,
11
+ setupOnce() {
12
+ if (!diagnosticsChannel.tracingChannel) {
13
+ return;
14
+ }
15
+ core.waitForTracingChannelBinding(() => {
16
+ instrumentation.instrumentFirebase();
17
+ });
18
+ }
19
+ };
20
+ });
21
+ const firebaseChannelIntegration = core.defineIntegration(_firebaseChannelIntegration);
22
+
23
+ exports.firebaseChannelIntegration = firebaseChannelIntegration;
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/firebase/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport { instrumentFirebase } from './instrumentation';\n\nconst INTEGRATION_NAME = 'Firebase' as const;\n\nconst _firebaseChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n waitForTracingChannelBinding(() => {\n instrumentFirebase();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven firebase integration.\n *\n * Subscribes to the `orchestrion:@firebase/firestore:*` and `orchestrion:firebase-functions:*`\n * diagnostics_channels the orchestrion code transform injects into firestore's `addDoc`/`getDocs`/\n * `setDoc`/`deleteDoc` and firebase-functions' `onX` registration functions, emitting spans identical\n * to the OTel integration — with a distinct `auto.firebase.orchestrion.*` origin. Requires the\n * orchestrion runtime hook or bundler plugin — wire it up via `experimentalUseDiagnosticsChannelInjection()`.\n *\n * @experimental\n */\nexport const firebaseChannelIntegration = defineIntegration(_firebaseChannelIntegration);\n"],"names":["waitForTracingChannelBinding","instrumentFirebase","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAA;AAEzB,MAAM,+BAA+B,MAAM;AACzC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAAA,iCAAA,CAA6B,MAAM;AACjC,QAAAC,kCAAA,EAAmB;AAAA,MACrB,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAaO,MAAM,0BAAA,GAA6BC,uBAAkB,2BAA2B;;;;"}
@@ -0,0 +1,66 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const diagnosticsChannel = require('node:diagnostics_channel');
4
+ const core = require('@sentry/core');
5
+ const debugBuild = require('../../../debug-build.js');
6
+ const channels = require('../../../orchestrion/channels.js');
7
+ const tracingChannel = require('../../../tracing-channel.js');
8
+ const firestore = require('./firestore.js');
9
+ const functions = require('./functions.js');
10
+
11
+ const FIRESTORE_OPERATIONS = [
12
+ { channel: channels.CHANNELS.FIREBASE_FIRESTORE_ADD_DOC, spanName: "addDoc", useParent: false },
13
+ { channel: channels.CHANNELS.FIREBASE_FIRESTORE_GET_DOCS, spanName: "getDocs", useParent: false },
14
+ { channel: channels.CHANNELS.FIREBASE_FIRESTORE_SET_DOC, spanName: "setDoc", useParent: true },
15
+ { channel: channels.CHANNELS.FIREBASE_FIRESTORE_DELETE_DOC, spanName: "deleteDoc", useParent: true }
16
+ ];
17
+ const FUNCTIONS_TRIGGERS = [
18
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_HTTP_REQUEST, triggerType: "http.request" },
19
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_HTTP_CALL, triggerType: "http.call" },
20
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_CREATED, triggerType: "firestore.document.created" },
21
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED, triggerType: "firestore.document.updated" },
22
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_DELETED, triggerType: "firestore.document.deleted" },
23
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN, triggerType: "firestore.document.written" },
24
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_SCHEDULER, triggerType: "scheduler.scheduled" },
25
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_STORAGE_FINALIZED, triggerType: "storage.object.finalized" },
26
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED, triggerType: "storage.object.archived" },
27
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_STORAGE_DELETED, triggerType: "storage.object.deleted" },
28
+ { channel: channels.CHANNELS.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED, triggerType: "storage.object.metadataUpdated" }
29
+ ];
30
+ const NOOP = () => {
31
+ };
32
+ function safe(fn) {
33
+ try {
34
+ return fn();
35
+ } catch (error) {
36
+ debugBuild.DEBUG_BUILD && core.debug.warn("[orchestrion:firebase] error handling channel event", error);
37
+ return void 0;
38
+ }
39
+ }
40
+ function instrumentFirebase() {
41
+ for (const { channel, spanName, useParent } of FIRESTORE_OPERATIONS) {
42
+ tracingChannel.bindTracingChannelToSpan(
43
+ diagnosticsChannel.tracingChannel(channel),
44
+ (data) => safe(() => {
45
+ const reference = data.arguments[0];
46
+ if (!reference) {
47
+ return void 0;
48
+ }
49
+ const spanReference = useParent ? reference.parent || reference : reference;
50
+ return firestore.startFirestoreSpan(spanName, spanReference);
51
+ })
52
+ );
53
+ }
54
+ for (const { channel, triggerType } of FUNCTIONS_TRIGGERS) {
55
+ diagnosticsChannel.tracingChannel(channel).subscribe({
56
+ start: (data) => void safe(() => functions.wrapFunctionsRegistration(data, triggerType)),
57
+ end: NOOP,
58
+ asyncStart: NOOP,
59
+ asyncEnd: NOOP,
60
+ error: NOOP
61
+ });
62
+ }
63
+ }
64
+
65
+ exports.instrumentFirebase = instrumentFirebase;
66
+ //# sourceMappingURL=instrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing-channel/firebase/instrumentation.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport type { FirestoreReference } from './firestore-types';\nimport { startFirestoreSpan } from './firestore';\nimport { wrapFunctionsRegistration } from './functions';\n\n// The context orchestrion's transform attaches to each firestore channel: `arguments` is the live args\n// of the wrapped `addDoc`/`getDocs`/`setDoc`/`deleteDoc` call, `arguments[0]` the reference.\ninterface FirestoreChannelContext {\n arguments: unknown[];\n self?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\n// The firestore operations, keyed by channel. `useParent` mirrors the OTel integration: `setDoc`/\n// `deleteDoc` take a *document* reference but the span is named after its parent *collection*.\nconst FIRESTORE_OPERATIONS: Array<{ channel: string; spanName: string; useParent: boolean }> = [\n { channel: CHANNELS.FIREBASE_FIRESTORE_ADD_DOC, spanName: 'addDoc', useParent: false },\n { channel: CHANNELS.FIREBASE_FIRESTORE_GET_DOCS, spanName: 'getDocs', useParent: false },\n { channel: CHANNELS.FIREBASE_FIRESTORE_SET_DOC, spanName: 'setDoc', useParent: true },\n { channel: CHANNELS.FIREBASE_FIRESTORE_DELETE_DOC, spanName: 'deleteDoc', useParent: true },\n];\n\n// The firebase-functions triggers, keyed by channel. The value is the faas trigger type used for the\n// span name (`firebase.function.<trigger>`) and `faas.trigger` attribute.\nconst FUNCTIONS_TRIGGERS: Array<{ channel: string; triggerType: string }> = [\n { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_REQUEST, triggerType: 'http.request' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_HTTP_CALL, triggerType: 'http.call' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_CREATED, triggerType: 'firestore.document.created' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_UPDATED, triggerType: 'firestore.document.updated' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_DELETED, triggerType: 'firestore.document.deleted' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_FIRESTORE_WRITTEN, triggerType: 'firestore.document.written' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_SCHEDULER, triggerType: 'scheduler.scheduled' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_FINALIZED, triggerType: 'storage.object.finalized' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_ARCHIVED, triggerType: 'storage.object.archived' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_DELETED, triggerType: 'storage.object.deleted' },\n { channel: CHANNELS.FIREBASE_FUNCTIONS_STORAGE_METADATA_UPDATED, triggerType: 'storage.object.metadataUpdated' },\n];\n\nconst NOOP = (): void => {};\n\n/**\n * Runs a span-building callback so a throw inside it can never break the user's firebase call: these run\n * inside the `tracingChannel(...)` machinery wrapping the real function, where an unguarded throw would\n * propagate into the traced call.\n */\nfunction safe<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[orchestrion:firebase] error handling channel event', error);\n return undefined;\n }\n}\n\nexport function instrumentFirebase() {\n for (const { channel, spanName, useParent } of FIRESTORE_OPERATIONS) {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<FirestoreChannelContext>(channel), data =>\n safe(() => {\n const reference = data.arguments[0] as FirestoreReference | undefined;\n if (!reference) {\n return undefined;\n }\n const spanReference = useParent ? reference.parent || reference : reference;\n return startFirestoreSpan(spanName, spanReference);\n }),\n );\n }\n\n for (const { channel, triggerType } of FUNCTIONS_TRIGGERS) {\n // Functions are wrapped, not span-bound: the handler runs long after this synchronous\n // registration call, so we only rewrap the handler argument here (in `start`) and open the\n // span inside that wrapper. The other lifecycle events are irrelevant, so no-op them.\n diagnosticsChannel.tracingChannel(channel).subscribe({\n start: data => void safe(() => wrapFunctionsRegistration(data as { arguments: unknown[] }, triggerType)),\n end: NOOP,\n asyncStart: NOOP,\n asyncEnd: NOOP,\n error: NOOP,\n });\n }\n}\n"],"names":["CHANNELS","DEBUG_BUILD","debug","bindTracingChannelToSpan","startFirestoreSpan","wrapFunctionsRegistration"],"mappings":";;;;;;;;;;AAoBA,MAAM,oBAAA,GAAyF;AAAA,EAC7F,EAAE,OAAA,EAASA,iBAAA,CAAS,4BAA4B,QAAA,EAAU,QAAA,EAAU,WAAW,KAAA,EAAM;AAAA,EACrF,EAAE,OAAA,EAASA,iBAAA,CAAS,6BAA6B,QAAA,EAAU,SAAA,EAAW,WAAW,KAAA,EAAM;AAAA,EACvF,EAAE,OAAA,EAASA,iBAAA,CAAS,4BAA4B,QAAA,EAAU,QAAA,EAAU,WAAW,IAAA,EAAK;AAAA,EACpF,EAAE,OAAA,EAASA,iBAAA,CAAS,+BAA+B,QAAA,EAAU,WAAA,EAAa,WAAW,IAAA;AACvF,CAAA;AAIA,MAAM,kBAAA,GAAsE;AAAA,EAC1E,EAAE,OAAA,EAASA,iBAAA,CAAS,+BAAA,EAAiC,aAAa,cAAA,EAAe;AAAA,EACjF,EAAE,OAAA,EAASA,iBAAA,CAAS,4BAAA,EAA8B,aAAa,WAAA,EAAY;AAAA,EAC3E,EAAE,OAAA,EAASA,iBAAA,CAAS,oCAAA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SAAA,EAAW;AACd,UAAA,OAAO,KAAA,CAAA;AAAA,QACT;AACA,QAAA,MAAM,aAAA,GAAgB,SAAA,GAAY,SAAA,CAAU,MAAA,IAAU,SAAA,GAAY,SAAA;AAClE,QAAA,OAAOC,4BAAA,CAAmB,UAAU,aAAa,CAAA;AAAA,MACnD,CAAC;AAAA,KACH;AAAA,EACF;AAEA,EAAA,KAAA,MAAW,EAAE,OAAA,EAAS,WAAA,EAAY,IAAK,kBAAA,EAAoB;AAIzD,IAAA,kBAAA,CAAmB,cAAA,CAAe,OAAO,CAAA,CAAE,SAAA,CAAU;AAAA,MACnD,KAAA,EAAO,UAAQ,KAAK,IAAA,CAAK,MAAMC,mCAAA,CAA0B,IAAA,EAAkC,WAAW,CAAC,CAAA;AAAA,MACvG,GAAA,EAAK,IAAA;AAAA,MACL,UAAA,EAAY,IAAA;AAAA,MACZ,QAAA,EAAU,IAAA;AAAA,MACV,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,EACH;AACF;;;;"}
@@ -1,14 +1,37 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const codeTransformer = require('@apm-js-collab/code-transformer-bundler-plugins/esbuild');
4
+ const core = require('@sentry/core');
5
+ const index = require('../config/index.js');
4
6
  const options = require('./options.js');
5
7
 
6
8
  const _interopDefault = e => e && e.__esModule ? e.default : e;
7
9
 
8
10
  const codeTransformer__default = /*#__PURE__*/_interopDefault(codeTransformer);
9
11
 
12
+ function matchesEsbuildExternal(entry, moduleName) {
13
+ if (entry.includes("*")) {
14
+ return new RegExp(`^${entry.split("*").map(core.escapeStringForRegex).join(".*")}$`).test(moduleName);
15
+ }
16
+ return options.externalEntryMatchesModule(entry, moduleName);
17
+ }
10
18
  function sentryOrchestrionPlugin(options$1 = {}) {
11
- return codeTransformer__default(options.orchestrionTransformOptions(options$1));
19
+ const plugin = codeTransformer__default(options.orchestrionTransformOptions(options$1));
20
+ const moduleNames = index.instrumentedModuleNames(options$1.instrumentations);
21
+ const setup = plugin.setup;
22
+ return {
23
+ ...plugin,
24
+ setup(build) {
25
+ const external = build.initialOptions.external || [];
26
+ const externalizedModules = moduleNames.filter(
27
+ (name) => external.some((entry) => matchesEsbuildExternal(entry, name))
28
+ );
29
+ if (externalizedModules.length > 0) {
30
+ build.onStart(() => ({ warnings: [{ text: options.externalizedModulesWarning(externalizedModules) }] }));
31
+ }
32
+ return setup(build);
33
+ }
34
+ };
12
35
  }
13
36
 
14
37
  exports.sentryOrchestrionPlugin = sentryOrchestrionPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild.js","sources":["../../../../src/orchestrion/bundler/esbuild.ts"],"sourcesContent":["import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/esbuild';\nimport type { PluginOptions } from './options';\nimport { orchestrionTransformOptions } from './options';\n\n/**\n * esbuild plugin that runs the orchestrion code transform on the bundled output.\n *\n * Use when bundling a Node app with esbuild. For unbundled Node processes use the\n * runtime hook instead (`node --import @sentry/node/orchestrion app.js`).\n *\n * esbuild does not flatten nested `plugins` arrays, so this returns a single\n * plugin that strips instrumented packages from an `external` denylist before\n * delegating to the upstream transform.\n *\n * @example\n * ```ts\n * // build.mjs\n * import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/esbuild';\n * await esbuild.build({ plugins: [sentryOrchestrionPlugin()] });\n * ```\n */\nexport function sentryOrchestrionPlugin(options: PluginOptions = {}): ReturnType<typeof codeTransformer> {\n return codeTransformer(orchestrionTransformOptions(options));\n}\n"],"names":["options","codeTransformer","orchestrionTransformOptions"],"mappings":";;;;;;;;;AAqBO,SAAS,uBAAA,CAAwBA,SAAA,GAAyB,EAAC,EAAuC;AACvG,EAAA,OAAOC,wBAAA,CAAgBC,mCAAA,CAA4BF,SAAO,CAAC,CAAA;AAC7D;;;;"}
1
+ {"version":3,"file":"esbuild.js","sources":["../../../../src/orchestrion/bundler/esbuild.ts"],"sourcesContent":["import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/esbuild';\nimport { escapeStringForRegex } from '@sentry/core';\nimport { instrumentedModuleNames } from '../config';\nimport type { PluginOptions } from './options';\nimport { externalEntryMatchesModule, externalizedModulesWarning, orchestrionTransformOptions } from './options';\n\n// esbuild `external` entries may contain `*` wildcards.\nfunction matchesEsbuildExternal(entry: string, moduleName: string): boolean {\n if (entry.includes('*')) {\n return new RegExp(`^${entry.split('*').map(escapeStringForRegex).join('.*')}$`).test(moduleName);\n }\n return externalEntryMatchesModule(entry, moduleName);\n}\n\n/**\n * esbuild plugin that runs the orchestrion code transform on the bundled output.\n *\n * Use when bundling a Node app with esbuild. For unbundled Node processes use the\n * runtime hook instead (`node --import @sentry/node/orchestrion app.js`).\n *\n * Instrumented packages marked as `external` never pass through the code\n * transform, so a build warning is emitted for them.\n *\n * @example\n * ```ts\n * // build.mjs\n * import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/esbuild';\n * await esbuild.build({ plugins: [sentryOrchestrionPlugin()] });\n * ```\n */\nexport function sentryOrchestrionPlugin(options: PluginOptions = {}): ReturnType<typeof codeTransformer> {\n const plugin = codeTransformer(orchestrionTransformOptions(options));\n const moduleNames = instrumentedModuleNames(options.instrumentations);\n const setup = plugin.setup;\n\n return {\n ...plugin,\n setup(build): ReturnType<typeof setup> {\n const external = build.initialOptions.external || [];\n const externalizedModules = moduleNames.filter(name =>\n external.some(entry => matchesEsbuildExternal(entry, name)),\n );\n if (externalizedModules.length > 0) {\n build.onStart(() => ({ warnings: [{ text: externalizedModulesWarning(externalizedModules) }] }));\n }\n return setup(build);\n },\n };\n}\n"],"names":["escapeStringForRegex","externalEntryMatchesModule","options","codeTransformer","orchestrionTransformOptions","instrumentedModuleNames","externalizedModulesWarning"],"mappings":";;;;;;;;;;;AAOA,SAAS,sBAAA,CAAuB,OAAe,UAAA,EAA6B;AAC1E,EAAA,IAAI,KAAA,CAAM,QAAA,CAAS,GAAG,CAAA,EAAG;AACvB,IAAA,OAAO,IAAI,MAAA,CAAO,CAAA,CAAA,EAAI,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA,CAAE,GAAA,CAAIA,yBAAoB,CAAA,CAAE,KAAK,IAAI,CAAC,CAAA,CAAA,CAAG,CAAA,CAAE,KAAK,UAAU,CAAA;AAAA,EACjG;AACA,EAAA,OAAOC,kCAAA,CAA2B,OAAO,UAAU,CAAA;AACrD;AAkBO,SAAS,uBAAA,CAAwBC,SAAA,GAAyB,EAAC,EAAuC;AACvG,EAAA,MAAM,MAAA,GAASC,wBAAA,CAAgBC,mCAAA,CAA4BF,SAAO,CAAC,CAAA;AACnE,EAAA,MAAM,WAAA,GAAcG,6BAAA,CAAwBH,SAAA,CAAQ,gBAAgB,CAAA;AACpE,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AAErB,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,MAAM,KAAA,EAAiC;AACrC,MAAA,MAAM,QAAA,GAAW,KAAA,CAAM,cAAA,CAAe,QAAA,IAAY,EAAC;AACnD,MAAA,MAAM,sBAAsB,WAAA,CAAY,MAAA;AAAA,QAAO,UAC7C,QAAA,CAAS,IAAA,CAAK,WAAS,sBAAA,CAAuB,KAAA,EAAO,IAAI,CAAC;AAAA,OAC5D;AACA,MAAA,IAAI,mBAAA,CAAoB,SAAS,CAAA,EAAG;AAClC,QAAA,KAAA,CAAM,OAAA,CAAQ,OAAO,EAAE,QAAA,EAAU,CAAC,EAAE,IAAA,EAAMI,kCAAA,CAA2B,mBAAmB,CAAA,EAAG,CAAA,EAAE,CAAE,CAAA;AAAA,MACjG;AACA,MAAA,OAAO,MAAM,KAAK,CAAA;AAAA,IACpB;AAAA,GACF;AACF;;;;"}
@@ -1,10 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const index = require('../config/index.js');
4
+ const subscribeInjection = require('./subscribeInjection.js');
4
5
 
6
+ function externalEntryMatchesModule(entry, moduleName) {
7
+ return entry === moduleName || entry.startsWith(`${moduleName}/`);
8
+ }
9
+ function externalizedModulesWarning(externalizedModules) {
10
+ return `The following packages are marked as external in your bundler configuration but need to be bundled for Sentry instrumentation to work: ${externalizedModules.join(", ")}. Remove them from your bundler's "external" configuration, or use the Sentry Node SDK's runtime instrumentation instead.`;
11
+ }
5
12
  function orchestrionTransformOptions(options) {
6
- const instrumentations = [...index.SENTRY_INSTRUMENTATIONS, ...options.instrumentations || []];
7
- const customTransforms = options.customTransforms;
13
+ const subscribeInjection$1 = options.injectChannelSubscribers ? subscribeInjection.subscribeInjectionOptions() : void 0;
14
+ const instrumentations = [
15
+ ...index.SENTRY_INSTRUMENTATIONS,
16
+ ...options.instrumentations || [],
17
+ ...subscribeInjection$1?.instrumentations || []
18
+ ];
19
+ const customTransforms = { ...options.customTransforms, ...subscribeInjection$1?.customTransforms };
8
20
  if (options.shouldInjectDiagnostics === false) {
9
21
  return {
10
22
  instrumentations,
@@ -20,5 +32,7 @@ function orchestrionTransformOptions(options) {
20
32
  };
21
33
  }
22
34
 
35
+ exports.externalEntryMatchesModule = externalEntryMatchesModule;
36
+ exports.externalizedModulesWarning = externalizedModulesWarning;
23
37
  exports.orchestrionTransformOptions = orchestrionTransformOptions;
24
38
  //# sourceMappingURL=options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sources":["../../../../src/orchestrion/bundler/options.ts"],"sourcesContent":["import type { InstrumentationConfig, CustomTransform } from '..';\nimport { SENTRY_INSTRUMENTATIONS } from '../config';\nimport type { CodeTransformerPluginOptions } from '@apm-js-collab/code-transformer-bundler-plugins/core';\n\nexport type PluginOptions = {\n /**\n * Additional instrumentations to include with the default instrumentation.\n */\n instrumentations?: InstrumentationConfig[];\n /**\n * Custom transforms that can be applied using the `transform` option in each `InstrumentationConfig`.\n */\n customTransforms?: Record<string, CustomTransform>;\n /**\n * Whether to inject the global diagnostics.\n *\n * Defaults to `true`.\n */\n shouldInjectDiagnostics?: boolean;\n};\n\n/**\n * The `@apm-js-collab/code-transformer-bundler-plugins` options shared by every\n * orchestrion bundler plugin.\n *\n * `injectDiagnostics` sets `globalThis.__SENTRY_ORCHESTRION__.bundler = [\"mysql\"]` at\n * app boot so the `_experimentalSetupOrchestrion()` detector can confirm the\n * bundler path ran (rather than relying on a build-time flag that wouldn't be\n * visible to the runtime).\n */\nexport function orchestrionTransformOptions(options: PluginOptions): CodeTransformerPluginOptions {\n const instrumentations = [...SENTRY_INSTRUMENTATIONS, ...(options.instrumentations || [])];\n const customTransforms = options.customTransforms;\n\n if (options.shouldInjectDiagnostics === false) {\n return {\n instrumentations,\n customTransforms,\n };\n }\n\n return {\n instrumentations,\n customTransforms,\n injectDiagnostics: (diag: { transformedModules: string[]; failedModules: string[] }) => {\n return `(globalThis.__SENTRY_ORCHESTRION__=globalThis.__SENTRY_ORCHESTRION__||{}).bundler=${JSON.stringify(diag.transformedModules)};`;\n },\n };\n}\n"],"names":["SENTRY_INSTRUMENTATIONS"],"mappings":";;;;AA8BO,SAAS,4BAA4B,OAAA,EAAsD;AAChG,EAAA,MAAM,gBAAA,GAAmB,CAAC,GAAGA,6BAAA,EAAyB,GAAI,OAAA,CAAQ,gBAAA,IAAoB,EAAG,CAAA;AACzF,EAAA,MAAM,mBAAmB,OAAA,CAAQ,gBAAA;AAEjC,EAAA,IAAI,OAAA,CAAQ,4BAA4B,KAAA,EAAO;AAC7C,IAAA,OAAO;AAAA,MACL,gBAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,gBAAA;AAAA,IACA,gBAAA;AAAA,IACA,iBAAA,EAAmB,CAAC,IAAA,KAAoE;AACtF,MAAA,OAAO,CAAA,kFAAA,EAAqF,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,kBAAkB,CAAC,CAAA,CAAA,CAAA;AAAA,IACrI;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"options.js","sources":["../../../../src/orchestrion/bundler/options.ts"],"sourcesContent":["import type { InstrumentationConfig, CustomTransform } from '..';\nimport { SENTRY_INSTRUMENTATIONS } from '../config';\nimport { subscribeInjectionOptions } from './subscribeInjection';\nimport type { CodeTransformerPluginOptions } from '@apm-js-collab/code-transformer-bundler-plugins/core';\n\nexport type PluginOptions = {\n /**\n * Additional instrumentations to include with the default instrumentation.\n */\n instrumentations?: InstrumentationConfig[];\n /**\n * Custom transforms that can be applied using the `transform` option in each `InstrumentationConfig`.\n */\n customTransforms?: Record<string, CustomTransform>;\n /**\n * Whether to inject the global diagnostics.\n *\n * Defaults to `true`.\n */\n shouldInjectDiagnostics?: boolean;\n /**\n * Inject a small marker-push into each instrumented module that imports only\n * that package's channel-subscriber factory and pushes it onto\n * `globalThis.__SENTRY_ORCHESTRION__.integrations`. A bundler-only SDK reads\n * the marker at `init()` and instantiates the collected factories, so every\n * transformed package's subscriber is wired up with no runtime module hook.\n *\n * Because each site imports a single named factory, it tree-shakes: a bundle\n * carries subscriber code only for the packages actually transformed into it.\n *\n * This is what lets a bundler-only SDK (e.g. `@sentry/cloudflare`, which runs\n * in workerd where requires can't be monkey-patched) record channel spans,\n * but it is bundler-agnostic: any orchestrion bundler plugin can enable it.\n * Leave it off for SDKs that wire the integrations up through a static import\n * instead (e.g. `@sentry/node`'s `experimentalUseDiagnosticsChannelInjection()`),\n * so the subscribers aren't registered twice.\n *\n * Defaults to `false`.\n */\n injectChannelSubscribers?: boolean;\n};\n\n/**\n * Whether an \"external\" config entry covers an instrumented module: an exact\n * package name (`'mysql'`) or a subpath (`'mysql/lib/...'`) — the transform may\n * target exactly the file a subpath entry externalizes. Mirrors the matching in\n * `withoutInstrumentedExternals`.\n */\nexport function externalEntryMatchesModule(entry: string, moduleName: string): boolean {\n return entry === moduleName || entry.startsWith(`${moduleName}/`);\n}\n\n/**\n * Warning emitted when a bundler config externalizes packages that orchestrion\n * needs to transform. An externalized dependency is resolved from\n * `node_modules` at runtime and never passes through the code transform, so\n * its diagnostics_channel calls are silently never injected.\n */\nexport function externalizedModulesWarning(externalizedModules: string[]): string {\n return (\n `The following packages are marked as external in your bundler configuration but need to be bundled for Sentry ` +\n `instrumentation to work: ${externalizedModules.join(', ')}. Remove them from your bundler's \"external\" ` +\n `configuration, or use the Sentry Node SDK's runtime instrumentation instead.`\n );\n}\n\n/**\n * The `@apm-js-collab/code-transformer-bundler-plugins` options shared by every\n * orchestrion bundler plugin.\n *\n * `injectDiagnostics` sets `globalThis.__SENTRY_ORCHESTRION__.bundler = [\"mysql\"]` at\n * app boot so the `_experimentalSetupOrchestrion()` detector can confirm the\n * bundler path ran (rather than relying on a build-time flag that wouldn't be\n * visible to the runtime).\n */\nexport function orchestrionTransformOptions(options: PluginOptions): CodeTransformerPluginOptions {\n const subscribeInjection = options.injectChannelSubscribers ? subscribeInjectionOptions() : undefined;\n\n const instrumentations = [\n ...SENTRY_INSTRUMENTATIONS,\n ...(options.instrumentations || []),\n ...(subscribeInjection?.instrumentations || []),\n ];\n const customTransforms = { ...options.customTransforms, ...subscribeInjection?.customTransforms };\n\n if (options.shouldInjectDiagnostics === false) {\n return {\n instrumentations,\n customTransforms,\n };\n }\n\n return {\n instrumentations,\n customTransforms,\n injectDiagnostics: (diag: { transformedModules: string[]; failedModules: string[] }) => {\n return `(globalThis.__SENTRY_ORCHESTRION__=globalThis.__SENTRY_ORCHESTRION__||{}).bundler=${JSON.stringify(diag.transformedModules)};`;\n },\n };\n}\n"],"names":["subscribeInjection","subscribeInjectionOptions","SENTRY_INSTRUMENTATIONS"],"mappings":";;;;;AAgDO,SAAS,0BAAA,CAA2B,OAAe,UAAA,EAA6B;AACrF,EAAA,OAAO,UAAU,UAAA,IAAc,KAAA,CAAM,UAAA,CAAW,CAAA,EAAG,UAAU,CAAA,CAAA,CAAG,CAAA;AAClE;AAQO,SAAS,2BAA2B,mBAAA,EAAuC;AAChF,EAAA,OACE,CAAA,uIAAA,EAC4B,mBAAA,CAAoB,IAAA,CAAK,IAAI,CAAC,CAAA,yHAAA,CAAA;AAG9D;AAWO,SAAS,4BAA4B,OAAA,EAAsD;AAChG,EAAA,MAAMA,oBAAA,GAAqB,OAAA,CAAQ,wBAAA,GAA2BC,4CAAA,EAA0B,GAAI,MAAA;AAE5F,EAAA,MAAM,gBAAA,GAAmB;AAAA,IACvB,GAAGC,6BAAA;AAAA,IACH,GAAI,OAAA,CAAQ,gBAAA,IAAoB,EAAC;AAAA,IACjC,GAAIF,oBAAA,EAAoB,gBAAA,IAAoB;AAAC,GAC/C;AACA,EAAA,MAAM,mBAAmB,EAAE,GAAG,QAAQ,gBAAA,EAAkB,GAAGA,sBAAoB,gBAAA,EAAiB;AAEhG,EAAA,IAAI,OAAA,CAAQ,4BAA4B,KAAA,EAAO;AAC7C,IAAA,OAAO;AAAA,MACL,gBAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,gBAAA;AAAA,IACA,gBAAA;AAAA,IACA,iBAAA,EAAmB,CAAC,IAAA,KAAoE;AACtF,MAAA,OAAO,CAAA,kFAAA,EAAqF,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,kBAAkB,CAAC,CAAA,CAAA,CAAA;AAAA,IACrI;AAAA,GACF;AACF;;;;;;"}