@sentry/node 9.35.0 → 9.36.0-alpha.2

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 (474) hide show
  1. package/build/cjs/index.js +38 -56
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/integrations/fs.js +2 -2
  4. package/build/cjs/integrations/fs.js.map +1 -1
  5. package/build/cjs/integrations/http/index.js +7 -11
  6. package/build/cjs/integrations/http/index.js.map +1 -1
  7. package/build/cjs/integrations/node-fetch/index.js +4 -5
  8. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  9. package/build/cjs/integrations/tracing/amqplib.js +4 -5
  10. package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
  11. package/build/cjs/integrations/tracing/connect.js +3 -4
  12. package/build/cjs/integrations/tracing/connect.js.map +1 -1
  13. package/build/cjs/integrations/tracing/dataloader.js +3 -3
  14. package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
  15. package/build/cjs/integrations/tracing/express.js +5 -7
  16. package/build/cjs/integrations/tracing/express.js.map +1 -1
  17. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  18. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  19. package/build/cjs/integrations/tracing/fastify/index.js +6 -6
  20. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  21. package/build/cjs/integrations/tracing/genericPool.js +3 -3
  22. package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
  23. package/build/cjs/integrations/tracing/graphql.js +3 -4
  24. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  25. package/build/cjs/integrations/tracing/hapi/index.js +3 -4
  26. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  27. package/build/cjs/integrations/tracing/kafka.js +4 -5
  28. package/build/cjs/integrations/tracing/kafka.js.map +1 -1
  29. package/build/cjs/integrations/tracing/knex.js +3 -3
  30. package/build/cjs/integrations/tracing/knex.js.map +1 -1
  31. package/build/cjs/integrations/tracing/koa.js +4 -6
  32. package/build/cjs/integrations/tracing/koa.js.map +1 -1
  33. package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
  34. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
  35. package/build/cjs/integrations/tracing/mongo.js +3 -4
  36. package/build/cjs/integrations/tracing/mongo.js.map +1 -1
  37. package/build/cjs/integrations/tracing/mongoose.js +3 -4
  38. package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
  39. package/build/cjs/integrations/tracing/mysql.js +2 -2
  40. package/build/cjs/integrations/tracing/mysql.js.map +1 -1
  41. package/build/cjs/integrations/tracing/mysql2.js +3 -4
  42. package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
  43. package/build/cjs/integrations/tracing/postgres.js +3 -4
  44. package/build/cjs/integrations/tracing/postgres.js.map +1 -1
  45. package/build/cjs/integrations/tracing/postgresjs.js +3 -4
  46. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  47. package/build/cjs/integrations/tracing/prisma.js +2 -2
  48. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  49. package/build/cjs/integrations/tracing/redis.js +3 -3
  50. package/build/cjs/integrations/tracing/redis.js.map +1 -1
  51. package/build/cjs/integrations/tracing/tedious.js +3 -3
  52. package/build/cjs/integrations/tracing/tedious.js.map +1 -1
  53. package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
  54. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  55. package/build/cjs/preload.js +2 -2
  56. package/build/cjs/preload.js.map +1 -1
  57. package/build/cjs/sdk/index.js +22 -203
  58. package/build/cjs/sdk/index.js.map +1 -1
  59. package/build/cjs/sdk/initOtel.js +4 -22
  60. package/build/cjs/sdk/initOtel.js.map +1 -1
  61. package/build/esm/index.js +2 -21
  62. package/build/esm/index.js.map +1 -1
  63. package/build/esm/integrations/fs.js +1 -1
  64. package/build/esm/integrations/fs.js.map +1 -1
  65. package/build/esm/integrations/http/index.js +1 -5
  66. package/build/esm/integrations/http/index.js.map +1 -1
  67. package/build/esm/integrations/node-fetch/index.js +2 -3
  68. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  69. package/build/esm/integrations/tracing/amqplib.js +1 -2
  70. package/build/esm/integrations/tracing/amqplib.js.map +1 -1
  71. package/build/esm/integrations/tracing/connect.js +1 -2
  72. package/build/esm/integrations/tracing/connect.js.map +1 -1
  73. package/build/esm/integrations/tracing/dataloader.js +1 -1
  74. package/build/esm/integrations/tracing/dataloader.js.map +1 -1
  75. package/build/esm/integrations/tracing/express.js +2 -4
  76. package/build/esm/integrations/tracing/express.js.map +1 -1
  77. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  78. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  79. package/build/esm/integrations/tracing/fastify/index.js +5 -5
  80. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  81. package/build/esm/integrations/tracing/genericPool.js +1 -1
  82. package/build/esm/integrations/tracing/genericPool.js.map +1 -1
  83. package/build/esm/integrations/tracing/graphql.js +2 -3
  84. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  85. package/build/esm/integrations/tracing/hapi/index.js +1 -2
  86. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  87. package/build/esm/integrations/tracing/kafka.js +1 -2
  88. package/build/esm/integrations/tracing/kafka.js.map +1 -1
  89. package/build/esm/integrations/tracing/knex.js +1 -1
  90. package/build/esm/integrations/tracing/knex.js.map +1 -1
  91. package/build/esm/integrations/tracing/koa.js +2 -4
  92. package/build/esm/integrations/tracing/koa.js.map +1 -1
  93. package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
  94. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
  95. package/build/esm/integrations/tracing/mongo.js +1 -2
  96. package/build/esm/integrations/tracing/mongo.js.map +1 -1
  97. package/build/esm/integrations/tracing/mongoose.js +1 -2
  98. package/build/esm/integrations/tracing/mongoose.js.map +1 -1
  99. package/build/esm/integrations/tracing/mysql.js +1 -1
  100. package/build/esm/integrations/tracing/mysql.js.map +1 -1
  101. package/build/esm/integrations/tracing/mysql2.js +1 -2
  102. package/build/esm/integrations/tracing/mysql2.js.map +1 -1
  103. package/build/esm/integrations/tracing/postgres.js +1 -2
  104. package/build/esm/integrations/tracing/postgres.js.map +1 -1
  105. package/build/esm/integrations/tracing/postgresjs.js +2 -3
  106. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  107. package/build/esm/integrations/tracing/prisma.js +1 -1
  108. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  109. package/build/esm/integrations/tracing/redis.js +1 -1
  110. package/build/esm/integrations/tracing/redis.js.map +1 -1
  111. package/build/esm/integrations/tracing/tedious.js +1 -1
  112. package/build/esm/integrations/tracing/tedious.js.map +1 -1
  113. package/build/esm/integrations/tracing/vercelai/index.js +1 -1
  114. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  115. package/build/esm/package.json +1 -1
  116. package/build/esm/preload.js +1 -1
  117. package/build/esm/preload.js.map +1 -1
  118. package/build/esm/sdk/index.js +22 -202
  119. package/build/esm/sdk/index.js.map +1 -1
  120. package/build/esm/sdk/initOtel.js +3 -21
  121. package/build/esm/sdk/initOtel.js.map +1 -1
  122. package/build/types/index.d.ts +2 -21
  123. package/build/types/index.d.ts.map +1 -1
  124. package/build/types/integrations/http/index.d.ts +1 -1
  125. package/build/types/integrations/http/index.d.ts.map +1 -1
  126. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  127. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
  128. package/build/types/integrations/tracing/connect.d.ts.map +1 -1
  129. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  130. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  131. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  132. package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
  133. package/build/types/integrations/tracing/koa.d.ts.map +1 -1
  134. package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
  135. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
  136. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
  137. package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
  138. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  139. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  140. package/build/types/sdk/index.d.ts +2 -6
  141. package/build/types/sdk/index.d.ts.map +1 -1
  142. package/build/types/sdk/initOtel.d.ts +1 -1
  143. package/build/types/sdk/initOtel.d.ts.map +1 -1
  144. package/build/types/types.d.ts +1 -1
  145. package/build/types/types.d.ts.map +1 -1
  146. package/build/types-ts3.8/index.d.ts +2 -21
  147. package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
  148. package/build/types-ts3.8/sdk/index.d.ts +2 -6
  149. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
  150. package/build/types-ts3.8/types.d.ts +1 -1
  151. package/package.json +4 -3
  152. package/build/cjs/cron/common.js +0 -56
  153. package/build/cjs/cron/common.js.map +0 -1
  154. package/build/cjs/cron/cron.js +0 -112
  155. package/build/cjs/cron/cron.js.map +0 -1
  156. package/build/cjs/cron/index.js +0 -15
  157. package/build/cjs/cron/index.js.map +0 -1
  158. package/build/cjs/cron/node-cron.js +0 -71
  159. package/build/cjs/cron/node-cron.js.map +0 -1
  160. package/build/cjs/cron/node-schedule.js +0 -65
  161. package/build/cjs/cron/node-schedule.js.map +0 -1
  162. package/build/cjs/integrations/anr/index.js +0 -238
  163. package/build/cjs/integrations/anr/index.js.map +0 -1
  164. package/build/cjs/integrations/childProcess.js +0 -100
  165. package/build/cjs/integrations/childProcess.js.map +0 -1
  166. package/build/cjs/integrations/context.js +0 -457
  167. package/build/cjs/integrations/context.js.map +0 -1
  168. package/build/cjs/integrations/contextlines.js +0 -405
  169. package/build/cjs/integrations/contextlines.js.map +0 -1
  170. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +0 -558
  171. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  172. package/build/cjs/integrations/local-variables/common.js +0 -69
  173. package/build/cjs/integrations/local-variables/common.js.map +0 -1
  174. package/build/cjs/integrations/local-variables/index.js +0 -12
  175. package/build/cjs/integrations/local-variables/index.js.map +0 -1
  176. package/build/cjs/integrations/local-variables/local-variables-async.js +0 -143
  177. package/build/cjs/integrations/local-variables/local-variables-async.js.map +0 -1
  178. package/build/cjs/integrations/local-variables/local-variables-sync.js +0 -410
  179. package/build/cjs/integrations/local-variables/local-variables-sync.js.map +0 -1
  180. package/build/cjs/integrations/modules.js +0 -135
  181. package/build/cjs/integrations/modules.js.map +0 -1
  182. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -291
  183. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  184. package/build/cjs/integrations/onuncaughtexception.js +0 -134
  185. package/build/cjs/integrations/onuncaughtexception.js.map +0 -1
  186. package/build/cjs/integrations/onunhandledrejection.js +0 -89
  187. package/build/cjs/integrations/onunhandledrejection.js.map +0 -1
  188. package/build/cjs/integrations/processSession.js +0 -36
  189. package/build/cjs/integrations/processSession.js.map +0 -1
  190. package/build/cjs/integrations/spotlight.js +0 -101
  191. package/build/cjs/integrations/spotlight.js.map +0 -1
  192. package/build/cjs/integrations/winston.js +0 -151
  193. package/build/cjs/integrations/winston.js.map +0 -1
  194. package/build/cjs/logs/capture.js +0 -29
  195. package/build/cjs/logs/capture.js.map +0 -1
  196. package/build/cjs/logs/exports.js +0 -178
  197. package/build/cjs/logs/exports.js.map +0 -1
  198. package/build/cjs/nodeVersion.js +0 -12
  199. package/build/cjs/nodeVersion.js.map +0 -1
  200. package/build/cjs/otel/contextManager.js +0 -16
  201. package/build/cjs/otel/contextManager.js.map +0 -1
  202. package/build/cjs/otel/instrument.js +0 -139
  203. package/build/cjs/otel/instrument.js.map +0 -1
  204. package/build/cjs/proxy/base.js +0 -122
  205. package/build/cjs/proxy/base.js.map +0 -1
  206. package/build/cjs/proxy/index.js +0 -173
  207. package/build/cjs/proxy/index.js.map +0 -1
  208. package/build/cjs/proxy/parse-proxy-response.js +0 -104
  209. package/build/cjs/proxy/parse-proxy-response.js.map +0 -1
  210. package/build/cjs/sdk/api.js +0 -117
  211. package/build/cjs/sdk/api.js.map +0 -1
  212. package/build/cjs/sdk/client.js +0 -156
  213. package/build/cjs/sdk/client.js.map +0 -1
  214. package/build/cjs/transports/http.js +0 -158
  215. package/build/cjs/transports/http.js.map +0 -1
  216. package/build/cjs/utils/addOriginToSpan.js +0 -11
  217. package/build/cjs/utils/addOriginToSpan.js.map +0 -1
  218. package/build/cjs/utils/baggage.js +0 -36
  219. package/build/cjs/utils/baggage.js.map +0 -1
  220. package/build/cjs/utils/commonjs.js +0 -13
  221. package/build/cjs/utils/commonjs.js.map +0 -1
  222. package/build/cjs/utils/createMissingInstrumentationContext.js +0 -11
  223. package/build/cjs/utils/createMissingInstrumentationContext.js.map +0 -1
  224. package/build/cjs/utils/debug.js +0 -23
  225. package/build/cjs/utils/debug.js.map +0 -1
  226. package/build/cjs/utils/ensureIsWrapped.js +0 -41
  227. package/build/cjs/utils/ensureIsWrapped.js.map +0 -1
  228. package/build/cjs/utils/envToBool.js +0 -32
  229. package/build/cjs/utils/envToBool.js.map +0 -1
  230. package/build/cjs/utils/errorhandling.js +0 -42
  231. package/build/cjs/utils/errorhandling.js.map +0 -1
  232. package/build/cjs/utils/getRequestUrl.js +0 -18
  233. package/build/cjs/utils/getRequestUrl.js.map +0 -1
  234. package/build/cjs/utils/module.js +0 -60
  235. package/build/cjs/utils/module.js.map +0 -1
  236. package/build/esm/cron/common.js +0 -54
  237. package/build/esm/cron/common.js.map +0 -1
  238. package/build/esm/cron/cron.js +0 -110
  239. package/build/esm/cron/cron.js.map +0 -1
  240. package/build/esm/cron/index.js +0 -13
  241. package/build/esm/cron/index.js.map +0 -1
  242. package/build/esm/cron/node-cron.js +0 -69
  243. package/build/esm/cron/node-cron.js.map +0 -1
  244. package/build/esm/cron/node-schedule.js +0 -63
  245. package/build/esm/cron/node-schedule.js.map +0 -1
  246. package/build/esm/integrations/anr/index.js +0 -234
  247. package/build/esm/integrations/anr/index.js.map +0 -1
  248. package/build/esm/integrations/anr/worker-script.js +0 -2
  249. package/build/esm/integrations/childProcess.js +0 -98
  250. package/build/esm/integrations/childProcess.js.map +0 -1
  251. package/build/esm/integrations/context.js +0 -451
  252. package/build/esm/integrations/context.js.map +0 -1
  253. package/build/esm/integrations/contextlines.js +0 -399
  254. package/build/esm/integrations/contextlines.js.map +0 -1
  255. package/build/esm/integrations/http/SentryHttpInstrumentation.js +0 -555
  256. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +0 -1
  257. package/build/esm/integrations/local-variables/common.js +0 -64
  258. package/build/esm/integrations/local-variables/common.js.map +0 -1
  259. package/build/esm/integrations/local-variables/index.js +0 -10
  260. package/build/esm/integrations/local-variables/index.js.map +0 -1
  261. package/build/esm/integrations/local-variables/local-variables-async.js +0 -140
  262. package/build/esm/integrations/local-variables/local-variables-async.js.map +0 -1
  263. package/build/esm/integrations/local-variables/local-variables-sync.js +0 -405
  264. package/build/esm/integrations/local-variables/local-variables-sync.js.map +0 -1
  265. package/build/esm/integrations/local-variables/worker-script.js +0 -2
  266. package/build/esm/integrations/modules.js +0 -133
  267. package/build/esm/integrations/modules.js.map +0 -1
  268. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +0 -289
  269. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +0 -1
  270. package/build/esm/integrations/onuncaughtexception.js +0 -131
  271. package/build/esm/integrations/onuncaughtexception.js.map +0 -1
  272. package/build/esm/integrations/onunhandledrejection.js +0 -86
  273. package/build/esm/integrations/onunhandledrejection.js.map +0 -1
  274. package/build/esm/integrations/processSession.js +0 -34
  275. package/build/esm/integrations/processSession.js.map +0 -1
  276. package/build/esm/integrations/spotlight.js +0 -98
  277. package/build/esm/integrations/spotlight.js.map +0 -1
  278. package/build/esm/integrations/winston.js +0 -149
  279. package/build/esm/integrations/winston.js.map +0 -1
  280. package/build/esm/logs/capture.js +0 -27
  281. package/build/esm/logs/capture.js.map +0 -1
  282. package/build/esm/logs/exports.js +0 -170
  283. package/build/esm/logs/exports.js.map +0 -1
  284. package/build/esm/nodeVersion.js +0 -8
  285. package/build/esm/nodeVersion.js.map +0 -1
  286. package/build/esm/otel/contextManager.js +0 -14
  287. package/build/esm/otel/contextManager.js.map +0 -1
  288. package/build/esm/otel/instrument.js +0 -135
  289. package/build/esm/otel/instrument.js.map +0 -1
  290. package/build/esm/proxy/base.js +0 -120
  291. package/build/esm/proxy/base.js.map +0 -1
  292. package/build/esm/proxy/index.js +0 -171
  293. package/build/esm/proxy/index.js.map +0 -1
  294. package/build/esm/proxy/parse-proxy-response.js +0 -102
  295. package/build/esm/proxy/parse-proxy-response.js.map +0 -1
  296. package/build/esm/sdk/api.js +0 -114
  297. package/build/esm/sdk/api.js.map +0 -1
  298. package/build/esm/sdk/client.js +0 -154
  299. package/build/esm/sdk/client.js.map +0 -1
  300. package/build/esm/transports/http.js +0 -156
  301. package/build/esm/transports/http.js.map +0 -1
  302. package/build/esm/utils/addOriginToSpan.js +0 -9
  303. package/build/esm/utils/addOriginToSpan.js.map +0 -1
  304. package/build/esm/utils/baggage.js +0 -34
  305. package/build/esm/utils/baggage.js.map +0 -1
  306. package/build/esm/utils/commonjs.js +0 -11
  307. package/build/esm/utils/commonjs.js.map +0 -1
  308. package/build/esm/utils/createMissingInstrumentationContext.js +0 -9
  309. package/build/esm/utils/createMissingInstrumentationContext.js.map +0 -1
  310. package/build/esm/utils/debug.js +0 -21
  311. package/build/esm/utils/debug.js.map +0 -1
  312. package/build/esm/utils/ensureIsWrapped.js +0 -39
  313. package/build/esm/utils/ensureIsWrapped.js.map +0 -1
  314. package/build/esm/utils/envToBool.js +0 -28
  315. package/build/esm/utils/envToBool.js.map +0 -1
  316. package/build/esm/utils/errorhandling.js +0 -40
  317. package/build/esm/utils/errorhandling.js.map +0 -1
  318. package/build/esm/utils/getRequestUrl.js +0 -16
  319. package/build/esm/utils/getRequestUrl.js.map +0 -1
  320. package/build/esm/utils/module.js +0 -58
  321. package/build/esm/utils/module.js.map +0 -1
  322. package/build/types/cron/common.d.ts +0 -5
  323. package/build/types/cron/common.d.ts.map +0 -1
  324. package/build/types/cron/cron.d.ts +0 -43
  325. package/build/types/cron/cron.d.ts.map +0 -1
  326. package/build/types/cron/index.d.ts +0 -10
  327. package/build/types/cron/index.d.ts.map +0 -1
  328. package/build/types/cron/node-cron.d.ts +0 -27
  329. package/build/types/cron/node-cron.d.ts.map +0 -1
  330. package/build/types/cron/node-schedule.d.ts +0 -19
  331. package/build/types/cron/node-schedule.d.ts.map +0 -1
  332. package/build/types/integrations/anr/common.d.ts +0 -52
  333. package/build/types/integrations/anr/common.d.ts.map +0 -1
  334. package/build/types/integrations/anr/index.d.ts +0 -13
  335. package/build/types/integrations/anr/index.d.ts.map +0 -1
  336. package/build/types/integrations/anr/worker.d.ts +0 -2
  337. package/build/types/integrations/anr/worker.d.ts.map +0 -1
  338. package/build/types/integrations/childProcess.d.ts +0 -20
  339. package/build/types/integrations/childProcess.d.ts.map +0 -1
  340. package/build/types/integrations/context.d.ts +0 -30
  341. package/build/types/integrations/context.d.ts.map +0 -1
  342. package/build/types/integrations/contextlines.d.ts +0 -31
  343. package/build/types/integrations/contextlines.d.ts.map +0 -1
  344. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +0 -131
  345. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +0 -1
  346. package/build/types/integrations/local-variables/common.d.ts +0 -66
  347. package/build/types/integrations/local-variables/common.d.ts.map +0 -1
  348. package/build/types/integrations/local-variables/index.d.ts +0 -4
  349. package/build/types/integrations/local-variables/index.d.ts.map +0 -1
  350. package/build/types/integrations/local-variables/local-variables-async.d.ts +0 -7
  351. package/build/types/integrations/local-variables/local-variables-async.d.ts.map +0 -1
  352. package/build/types/integrations/local-variables/local-variables-sync.d.ts +0 -34
  353. package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +0 -1
  354. package/build/types/integrations/local-variables/worker.d.ts +0 -2
  355. package/build/types/integrations/local-variables/worker.d.ts.map +0 -1
  356. package/build/types/integrations/modules.d.ts +0 -17
  357. package/build/types/integrations/modules.d.ts.map +0 -1
  358. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  359. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +0 -1
  360. package/build/types/integrations/onuncaughtexception.d.ts +0 -31
  361. package/build/types/integrations/onuncaughtexception.d.ts.map +0 -1
  362. package/build/types/integrations/onunhandledrejection.d.ts +0 -23
  363. package/build/types/integrations/onunhandledrejection.d.ts.map +0 -1
  364. package/build/types/integrations/processSession.d.ts +0 -5
  365. package/build/types/integrations/processSession.d.ts.map +0 -1
  366. package/build/types/integrations/spotlight.d.ts +0 -18
  367. package/build/types/integrations/spotlight.d.ts.map +0 -1
  368. package/build/types/integrations/winston.d.ts +0 -44
  369. package/build/types/integrations/winston.d.ts.map +0 -1
  370. package/build/types/logs/capture.d.ts +0 -11
  371. package/build/types/logs/capture.d.ts.map +0 -1
  372. package/build/types/logs/exports.d.ts +0 -150
  373. package/build/types/logs/exports.d.ts.map +0 -1
  374. package/build/types/nodeVersion.d.ts +0 -8
  375. package/build/types/nodeVersion.d.ts.map +0 -1
  376. package/build/types/otel/contextManager.d.ts +0 -10
  377. package/build/types/otel/contextManager.d.ts.map +0 -1
  378. package/build/types/otel/instrument.d.ts +0 -23
  379. package/build/types/otel/instrument.d.ts.map +0 -1
  380. package/build/types/proxy/base.d.ts +0 -65
  381. package/build/types/proxy/base.d.ts.map +0 -1
  382. package/build/types/proxy/helpers.d.ts +0 -42
  383. package/build/types/proxy/helpers.d.ts.map +0 -1
  384. package/build/types/proxy/index.d.ts +0 -73
  385. package/build/types/proxy/index.d.ts.map +0 -1
  386. package/build/types/proxy/parse-proxy-response.d.ts +0 -43
  387. package/build/types/proxy/parse-proxy-response.d.ts.map +0 -1
  388. package/build/types/sdk/api.d.ts +0 -8
  389. package/build/types/sdk/api.d.ts.map +0 -1
  390. package/build/types/sdk/client.d.ts +0 -29
  391. package/build/types/sdk/client.d.ts.map +0 -1
  392. package/build/types/sdk/scope.d.ts +0 -7
  393. package/build/types/sdk/scope.d.ts.map +0 -1
  394. package/build/types/transports/http-module.d.ts +0 -31
  395. package/build/types/transports/http-module.d.ts.map +0 -1
  396. package/build/types/transports/http.d.ts +0 -21
  397. package/build/types/transports/http.d.ts.map +0 -1
  398. package/build/types/transports/index.d.ts +0 -3
  399. package/build/types/transports/index.d.ts.map +0 -1
  400. package/build/types/utils/addOriginToSpan.d.ts +0 -5
  401. package/build/types/utils/addOriginToSpan.d.ts.map +0 -1
  402. package/build/types/utils/baggage.d.ts +0 -6
  403. package/build/types/utils/baggage.d.ts.map +0 -1
  404. package/build/types/utils/commonjs.d.ts +0 -3
  405. package/build/types/utils/commonjs.d.ts.map +0 -1
  406. package/build/types/utils/createMissingInstrumentationContext.d.ts +0 -3
  407. package/build/types/utils/createMissingInstrumentationContext.d.ts.map +0 -1
  408. package/build/types/utils/debug.d.ts +0 -5
  409. package/build/types/utils/debug.d.ts.map +0 -1
  410. package/build/types/utils/ensureIsWrapped.d.ts +0 -5
  411. package/build/types/utils/ensureIsWrapped.d.ts.map +0 -1
  412. package/build/types/utils/entry-point.d.ts +0 -24
  413. package/build/types/utils/entry-point.d.ts.map +0 -1
  414. package/build/types/utils/envToBool.d.ts +0 -13
  415. package/build/types/utils/envToBool.d.ts.map +0 -1
  416. package/build/types/utils/errorhandling.d.ts +0 -5
  417. package/build/types/utils/errorhandling.d.ts.map +0 -1
  418. package/build/types/utils/getRequestUrl.d.ts +0 -5
  419. package/build/types/utils/getRequestUrl.d.ts.map +0 -1
  420. package/build/types/utils/module.d.ts +0 -3
  421. package/build/types/utils/module.d.ts.map +0 -1
  422. package/build/types/utils/prepareEvent.d.ts +0 -17
  423. package/build/types/utils/prepareEvent.d.ts.map +0 -1
  424. package/build/types-ts3.8/cron/common.d.ts +0 -5
  425. package/build/types-ts3.8/cron/cron.d.ts +0 -43
  426. package/build/types-ts3.8/cron/index.d.ts +0 -10
  427. package/build/types-ts3.8/cron/node-cron.d.ts +0 -27
  428. package/build/types-ts3.8/cron/node-schedule.d.ts +0 -19
  429. package/build/types-ts3.8/integrations/anr/common.d.ts +0 -52
  430. package/build/types-ts3.8/integrations/anr/index.d.ts +0 -13
  431. package/build/types-ts3.8/integrations/anr/worker.d.ts +0 -2
  432. package/build/types-ts3.8/integrations/childProcess.d.ts +0 -20
  433. package/build/types-ts3.8/integrations/context.d.ts +0 -30
  434. package/build/types-ts3.8/integrations/contextlines.d.ts +0 -31
  435. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +0 -133
  436. package/build/types-ts3.8/integrations/local-variables/common.d.ts +0 -66
  437. package/build/types-ts3.8/integrations/local-variables/index.d.ts +0 -4
  438. package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +0 -7
  439. package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +0 -34
  440. package/build/types-ts3.8/integrations/local-variables/worker.d.ts +0 -2
  441. package/build/types-ts3.8/integrations/modules.d.ts +0 -17
  442. package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +0 -56
  443. package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +0 -31
  444. package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +0 -23
  445. package/build/types-ts3.8/integrations/processSession.d.ts +0 -5
  446. package/build/types-ts3.8/integrations/spotlight.d.ts +0 -18
  447. package/build/types-ts3.8/integrations/winston.d.ts +0 -44
  448. package/build/types-ts3.8/logs/capture.d.ts +0 -18
  449. package/build/types-ts3.8/logs/exports.d.ts +0 -150
  450. package/build/types-ts3.8/nodeVersion.d.ts +0 -8
  451. package/build/types-ts3.8/otel/contextManager.d.ts +0 -10
  452. package/build/types-ts3.8/otel/instrument.d.ts +0 -23
  453. package/build/types-ts3.8/proxy/base.d.ts +0 -60
  454. package/build/types-ts3.8/proxy/helpers.d.ts +0 -38
  455. package/build/types-ts3.8/proxy/index.d.ts +0 -74
  456. package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +0 -40
  457. package/build/types-ts3.8/sdk/api.d.ts +0 -8
  458. package/build/types-ts3.8/sdk/client.d.ts +0 -32
  459. package/build/types-ts3.8/sdk/scope.d.ts +0 -7
  460. package/build/types-ts3.8/transports/http-module.d.ts +0 -28
  461. package/build/types-ts3.8/transports/http.d.ts +0 -20
  462. package/build/types-ts3.8/transports/index.d.ts +0 -3
  463. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +0 -5
  464. package/build/types-ts3.8/utils/baggage.d.ts +0 -6
  465. package/build/types-ts3.8/utils/commonjs.d.ts +0 -3
  466. package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +0 -3
  467. package/build/types-ts3.8/utils/debug.d.ts +0 -5
  468. package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +0 -5
  469. package/build/types-ts3.8/utils/entry-point.d.ts +0 -24
  470. package/build/types-ts3.8/utils/envToBool.d.ts +0 -13
  471. package/build/types-ts3.8/utils/errorhandling.d.ts +0 -5
  472. package/build/types-ts3.8/utils/getRequestUrl.d.ts +0 -5
  473. package/build/types-ts3.8/utils/module.d.ts +0 -3
  474. package/build/types-ts3.8/utils/prepareEvent.d.ts +0 -17
@@ -1,64 +0,0 @@
1
- /**
2
- * The key used to store the local variables on the error object.
3
- */
4
- const LOCAL_VARIABLES_KEY = '__SENTRY_ERROR_LOCAL_VARIABLES__';
5
-
6
- /**
7
- * Creates a rate limiter that will call the disable callback when the rate limit is reached and the enable callback
8
- * when a timeout has occurred.
9
- * @param maxPerSecond Maximum number of calls per second
10
- * @param enable Callback to enable capture
11
- * @param disable Callback to disable capture
12
- * @returns A function to call to increment the rate limiter count
13
- */
14
- function createRateLimiter(
15
- maxPerSecond,
16
- enable,
17
- disable,
18
- ) {
19
- let count = 0;
20
- let retrySeconds = 5;
21
- let disabledTimeout = 0;
22
-
23
- setInterval(() => {
24
- if (disabledTimeout === 0) {
25
- if (count > maxPerSecond) {
26
- retrySeconds *= 2;
27
- disable(retrySeconds);
28
-
29
- // Cap at one day
30
- if (retrySeconds > 86400) {
31
- retrySeconds = 86400;
32
- }
33
- disabledTimeout = retrySeconds;
34
- }
35
- } else {
36
- disabledTimeout -= 1;
37
-
38
- if (disabledTimeout === 0) {
39
- enable();
40
- }
41
- }
42
-
43
- count = 0;
44
- }, 1000).unref();
45
-
46
- return () => {
47
- count += 1;
48
- };
49
- }
50
-
51
- // Add types for the exception event data
52
-
53
- /** Could this be an anonymous function? */
54
- function isAnonymous(name) {
55
- return name !== undefined && (name.length === 0 || name === '?' || name === '<anonymous>');
56
- }
57
-
58
- /** Do the function names appear to match? */
59
- function functionNamesMatch(a, b) {
60
- return a === b || `Object.${a}` === b || a === `Object.${b}` || (isAnonymous(a) && isAnonymous(b));
61
- }
62
-
63
- export { LOCAL_VARIABLES_KEY, createRateLimiter, functionNamesMatch, isAnonymous };
64
- //# sourceMappingURL=common.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sources":["../../../../src/integrations/local-variables/common.ts"],"sourcesContent":["import type { Debugger } from 'node:inspector';\n\nexport type Variables = Record<string, unknown>;\n\nexport type RateLimitIncrement = () => void;\n\n/**\n * The key used to store the local variables on the error object.\n */\nexport const LOCAL_VARIABLES_KEY = '__SENTRY_ERROR_LOCAL_VARIABLES__';\n\n/**\n * Creates a rate limiter that will call the disable callback when the rate limit is reached and the enable callback\n * when a timeout has occurred.\n * @param maxPerSecond Maximum number of calls per second\n * @param enable Callback to enable capture\n * @param disable Callback to disable capture\n * @returns A function to call to increment the rate limiter count\n */\nexport function createRateLimiter(\n maxPerSecond: number,\n enable: () => void,\n disable: (seconds: number) => void,\n): RateLimitIncrement {\n let count = 0;\n let retrySeconds = 5;\n let disabledTimeout = 0;\n\n setInterval(() => {\n if (disabledTimeout === 0) {\n if (count > maxPerSecond) {\n retrySeconds *= 2;\n disable(retrySeconds);\n\n // Cap at one day\n if (retrySeconds > 86400) {\n retrySeconds = 86400;\n }\n disabledTimeout = retrySeconds;\n }\n } else {\n disabledTimeout -= 1;\n\n if (disabledTimeout === 0) {\n enable();\n }\n }\n\n count = 0;\n }, 1_000).unref();\n\n return () => {\n count += 1;\n };\n}\n\n// Add types for the exception event data\nexport type PausedExceptionEvent = Debugger.PausedEventDataType & {\n data: {\n // This contains error.stack\n description: string;\n objectId?: string;\n };\n};\n\n/** Could this be an anonymous function? */\nexport function isAnonymous(name: string | undefined): boolean {\n return name !== undefined && (name.length === 0 || name === '?' || name === '<anonymous>');\n}\n\n/** Do the function names appear to match? */\nexport function functionNamesMatch(a: string | undefined, b: string | undefined): boolean {\n return a === b || `Object.${a}` === b || a === `Object.${b}` || (isAnonymous(a) && isAnonymous(b));\n}\n\nexport interface FrameVariables {\n function: string;\n vars?: Variables;\n}\n\nexport interface LocalVariablesIntegrationOptions {\n /**\n * Capture local variables for both caught and uncaught exceptions\n *\n * - When false, only uncaught exceptions will have local variables\n * - When true, both caught and uncaught exceptions will have local variables.\n *\n * Defaults to `true`.\n *\n * Capturing local variables for all exceptions can be expensive since the debugger pauses for every throw to collect\n * local variables.\n *\n * To reduce the likelihood of this feature impacting app performance or throughput, this feature is rate-limited.\n * Once the rate limit is reached, local variables will only be captured for uncaught exceptions until a timeout has\n * been reached.\n */\n captureAllExceptions?: boolean;\n /**\n * Maximum number of exceptions to capture local variables for per second before rate limiting is triggered.\n */\n maxExceptionsPerSecond?: number;\n}\n\nexport interface LocalVariablesWorkerArgs extends LocalVariablesIntegrationOptions {\n /**\n * Whether to enable debug logging.\n */\n debug: boolean;\n /**\n * Base path used to calculate module name.\n *\n * Defaults to `dirname(process.argv[1])` and falls back to `process.cwd()`\n */\n basePath?: string;\n}\n"],"names":[],"mappings":"AAMA;AACA;AACA;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A,CAAA,CAAA,CAAA,IAAA,WAAA,CAAA,CAAA,CAAA,CAAA;AACA;;;;"}
@@ -1,10 +0,0 @@
1
- import { NODE_VERSION } from '../../nodeVersion.js';
2
- import { localVariablesAsyncIntegration } from './local-variables-async.js';
3
- import { localVariablesSyncIntegration } from './local-variables-sync.js';
4
-
5
- const localVariablesIntegration = (options = {}) => {
6
- return NODE_VERSION.major < 19 ? localVariablesSyncIntegration(options) : localVariablesAsyncIntegration(options);
7
- };
8
-
9
- export { localVariablesIntegration };
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/integrations/local-variables/index.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { NODE_VERSION } from '../../nodeVersion';\nimport type { LocalVariablesIntegrationOptions } from './common';\nimport { localVariablesAsyncIntegration } from './local-variables-async';\nimport { localVariablesSyncIntegration } from './local-variables-sync';\n\nexport const localVariablesIntegration = (options: LocalVariablesIntegrationOptions = {}): Integration => {\n return NODE_VERSION.major < 19 ? localVariablesSyncIntegration(options) : localVariablesAsyncIntegration(options);\n};\n"],"names":[],"mappings":";;;;AAMO,MAAM,4BAA4B,CAAC,OAAO,GAAqC,EAAE,KAAkB;AAC1G,EAAE,OAAO,YAAY,CAAC,KAAA,GAAQ,EAAG,GAAE,6BAA6B,CAAC,OAAO,CAAE,GAAE,8BAA8B,CAAC,OAAO,CAAC;AACnH;;;;"}
@@ -1,140 +0,0 @@
1
- import { Worker } from 'node:worker_threads';
2
- import { defineIntegration, logger } from '@sentry/core';
3
- import { isDebuggerEnabled } from '../../utils/debug.js';
4
- import { LOCAL_VARIABLES_KEY, functionNamesMatch } from './common.js';
5
-
6
- // This string is a placeholder that gets overwritten with the worker code.
7
- const base64WorkerScript = 'LyohIEBzZW50cnkvbm9kZSA5LjM1LjAgKDhkNTA4ZWYpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLw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KCksKCk9PntvKz0xfX0oZSwoYXN5bmMoKT0+e2woIlJhdGUtbGltaXQgbGlmdGVkLiIpLGF3YWl0IHQucG9zdCgiRGVidWdnZXIuc2V0UGF1c2VPbkV4Y2VwdGlvbnMiLHtzdGF0ZToiYWxsIn0pfSksKGFzeW5jIGU9PntsKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pKX19KSgpLmNhdGNoKChlPT57bCgiRmFpbGVkIHRvIHN0YXJ0IGRlYnVnZ2VyIixlKX0pKSxzZXRJbnRlcnZhbCgoKCk9Pnt9KSwxZTQpOw==';
8
-
9
- function log(...args) {
10
- logger.log('[LocalVariables]', ...args);
11
- }
12
-
13
- /**
14
- * Adds local variables to exception frames
15
- */
16
- const localVariablesAsyncIntegration = defineIntegration(((
17
- integrationOptions = {},
18
- ) => {
19
- function addLocalVariablesToException(exception, localVariables) {
20
- // Filter out frames where the function name is `new Promise` since these are in the error.stack frames
21
- // but do not appear in the debugger call frames
22
- const frames = (exception.stacktrace?.frames || []).filter(frame => frame.function !== 'new Promise');
23
-
24
- for (let i = 0; i < frames.length; i++) {
25
- // Sentry frames are in reverse order
26
- const frameIndex = frames.length - i - 1;
27
-
28
- const frameLocalVariables = localVariables[i];
29
- const frame = frames[frameIndex];
30
-
31
- if (!frame || !frameLocalVariables) {
32
- // Drop out if we run out of frames to match up
33
- break;
34
- }
35
-
36
- if (
37
- // We need to have vars to add
38
- frameLocalVariables.vars === undefined ||
39
- // We're not interested in frames that are not in_app because the vars are not relevant
40
- frame.in_app === false ||
41
- // The function names need to match
42
- !functionNamesMatch(frame.function, frameLocalVariables.function)
43
- ) {
44
- continue;
45
- }
46
-
47
- frame.vars = frameLocalVariables.vars;
48
- }
49
- }
50
-
51
- function addLocalVariablesToEvent(event, hint) {
52
- if (
53
- hint.originalException &&
54
- typeof hint.originalException === 'object' &&
55
- LOCAL_VARIABLES_KEY in hint.originalException &&
56
- Array.isArray(hint.originalException[LOCAL_VARIABLES_KEY])
57
- ) {
58
- for (const exception of event.exception?.values || []) {
59
- addLocalVariablesToException(exception, hint.originalException[LOCAL_VARIABLES_KEY]);
60
- }
61
-
62
- hint.originalException[LOCAL_VARIABLES_KEY] = undefined;
63
- }
64
-
65
- return event;
66
- }
67
-
68
- async function startInspector() {
69
- // We load inspector dynamically because on some platforms Node is built without inspector support
70
- const inspector = await import('node:inspector');
71
- if (!inspector.url()) {
72
- inspector.open(0);
73
- }
74
- }
75
-
76
- function startWorker(options) {
77
- const worker = new Worker(new URL(`data:application/javascript;base64,${base64WorkerScript}`), {
78
- workerData: options,
79
- // We don't want any Node args to be passed to the worker
80
- execArgv: [],
81
- env: { ...process.env, NODE_OPTIONS: undefined },
82
- });
83
-
84
- process.on('exit', () => {
85
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
86
- worker.terminate();
87
- });
88
-
89
- worker.once('error', (err) => {
90
- log('Worker error', err);
91
- });
92
-
93
- worker.once('exit', (code) => {
94
- log('Worker exit', code);
95
- });
96
-
97
- // Ensure this thread can't block app exit
98
- worker.unref();
99
- }
100
-
101
- return {
102
- name: 'LocalVariablesAsync',
103
- async setup(client) {
104
- const clientOptions = client.getOptions();
105
-
106
- if (!clientOptions.includeLocalVariables) {
107
- return;
108
- }
109
-
110
- if (await isDebuggerEnabled()) {
111
- logger.warn('Local variables capture has been disabled because the debugger was already enabled');
112
- return;
113
- }
114
-
115
- const options = {
116
- ...integrationOptions,
117
- debug: logger.isEnabled(),
118
- };
119
-
120
- startInspector().then(
121
- () => {
122
- try {
123
- startWorker(options);
124
- } catch (e) {
125
- logger.error('Failed to start worker', e);
126
- }
127
- },
128
- e => {
129
- logger.error('Failed to start inspector', e);
130
- },
131
- );
132
- },
133
- processEvent(event, hint) {
134
- return addLocalVariablesToEvent(event, hint);
135
- },
136
- };
137
- }) );
138
-
139
- export { base64WorkerScript, localVariablesAsyncIntegration };
140
- //# sourceMappingURL=local-variables-async.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"local-variables-async.js","sources":["../../../../src/integrations/local-variables/local-variables-async.ts"],"sourcesContent":["import { Worker } from 'node:worker_threads';\nimport type { Event, EventHint, Exception, IntegrationFn } from '@sentry/core';\nimport { defineIntegration, logger } from '@sentry/core';\nimport type { NodeClient } from '../../sdk/client';\nimport { isDebuggerEnabled } from '../../utils/debug';\nimport type { FrameVariables, LocalVariablesIntegrationOptions, LocalVariablesWorkerArgs } from './common';\nimport { functionNamesMatch, LOCAL_VARIABLES_KEY } from './common';\n\n// This string is a placeholder that gets overwritten with the worker code.\nexport const base64WorkerScript = '###LocalVariablesWorkerScript###';\n\nfunction log(...args: unknown[]): void {\n logger.log('[LocalVariables]', ...args);\n}\n\n/**\n * Adds local variables to exception frames\n */\nexport const localVariablesAsyncIntegration = defineIntegration(((\n integrationOptions: LocalVariablesIntegrationOptions = {},\n) => {\n function addLocalVariablesToException(exception: Exception, localVariables: FrameVariables[]): void {\n // Filter out frames where the function name is `new Promise` since these are in the error.stack frames\n // but do not appear in the debugger call frames\n const frames = (exception.stacktrace?.frames || []).filter(frame => frame.function !== 'new Promise');\n\n for (let i = 0; i < frames.length; i++) {\n // Sentry frames are in reverse order\n const frameIndex = frames.length - i - 1;\n\n const frameLocalVariables = localVariables[i];\n const frame = frames[frameIndex];\n\n if (!frame || !frameLocalVariables) {\n // Drop out if we run out of frames to match up\n break;\n }\n\n if (\n // We need to have vars to add\n frameLocalVariables.vars === undefined ||\n // We're not interested in frames that are not in_app because the vars are not relevant\n frame.in_app === false ||\n // The function names need to match\n !functionNamesMatch(frame.function, frameLocalVariables.function)\n ) {\n continue;\n }\n\n frame.vars = frameLocalVariables.vars;\n }\n }\n\n function addLocalVariablesToEvent(event: Event, hint: EventHint): Event {\n if (\n hint.originalException &&\n typeof hint.originalException === 'object' &&\n LOCAL_VARIABLES_KEY in hint.originalException &&\n Array.isArray(hint.originalException[LOCAL_VARIABLES_KEY])\n ) {\n for (const exception of event.exception?.values || []) {\n addLocalVariablesToException(exception, hint.originalException[LOCAL_VARIABLES_KEY]);\n }\n\n hint.originalException[LOCAL_VARIABLES_KEY] = undefined;\n }\n\n return event;\n }\n\n async function startInspector(): Promise<void> {\n // We load inspector dynamically because on some platforms Node is built without inspector support\n const inspector = await import('node:inspector');\n if (!inspector.url()) {\n inspector.open(0);\n }\n }\n\n function startWorker(options: LocalVariablesWorkerArgs): void {\n const worker = new Worker(new URL(`data:application/javascript;base64,${base64WorkerScript}`), {\n workerData: options,\n // We don't want any Node args to be passed to the worker\n execArgv: [],\n env: { ...process.env, NODE_OPTIONS: undefined },\n });\n\n process.on('exit', () => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n worker.terminate();\n });\n\n worker.once('error', (err: Error) => {\n log('Worker error', err);\n });\n\n worker.once('exit', (code: number) => {\n log('Worker exit', code);\n });\n\n // Ensure this thread can't block app exit\n worker.unref();\n }\n\n return {\n name: 'LocalVariablesAsync',\n async setup(client: NodeClient) {\n const clientOptions = client.getOptions();\n\n if (!clientOptions.includeLocalVariables) {\n return;\n }\n\n if (await isDebuggerEnabled()) {\n logger.warn('Local variables capture has been disabled because the debugger was already enabled');\n return;\n }\n\n const options: LocalVariablesWorkerArgs = {\n ...integrationOptions,\n debug: logger.isEnabled(),\n };\n\n startInspector().then(\n () => {\n try {\n startWorker(options);\n } catch (e) {\n logger.error('Failed to start worker', e);\n }\n },\n e => {\n logger.error('Failed to start inspector', e);\n },\n );\n },\n processEvent(event: Event, hint: EventHint): Event {\n return addLocalVariablesToEvent(event, hint);\n },\n };\n}) satisfies IntegrationFn);\n"],"names":[],"mappings":";;;;;AAQA;AACO,MAAM,kBAAmB,GAAE;;AAElC,SAAS,GAAG,CAAC,GAAG,IAAI,EAA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A,KAAA;AACA,MAAA,GAAA,CAAA,aAAA,EAAA,IAAA,CAAA;AACA,KAAA,CAAA;;AAEA;AACA,IAAA,MAAA,CAAA,KAAA,EAAA;AACA;;AAEA,EAAA,OAAA;AACA,IAAA,IAAA,EAAA,qBAAA;AACA,IAAA,MAAA,KAAA,CAAA,MAAA,EAAA;AACA,MAAA,MAAA,aAAA,GAAA,MAAA,CAAA,UAAA,EAAA;;AAEA,MAAA,IAAA,CAAA,aAAA,CAAA,qBAAA,EAAA;AACA,QAAA;AACA;;AAEA,MAAA,IAAA,MAAA,iBAAA,EAAA,EAAA;AACA,QAAA,MAAA,CAAA,IAAA,CAAA,oFAAA,CAAA;AACA,QAAA;AACA;;AAEA,MAAA,MAAA,OAAA,GAAA;AACA,QAAA,GAAA,kBAAA;AACA,QAAA,KAAA,EAAA,MAAA,CAAA,SAAA,EAAA;AACA,OAAA;;AAEA,MAAA,cAAA,EAAA,CAAA,IAAA;AACA,QAAA,MAAA;AACA,UAAA,IAAA;AACA,YAAA,WAAA,CAAA,OAAA,CAAA;AACA,WAAA,CAAA,OAAA,CAAA,EAAA;AACA,YAAA,MAAA,CAAA,KAAA,CAAA,wBAAA,EAAA,CAAA,CAAA;AACA;AACA,SAAA;AACA,QAAA,CAAA,IAAA;AACA,UAAA,MAAA,CAAA,KAAA,CAAA,2BAAA,EAAA,CAAA,CAAA;AACA,SAAA;AACA,OAAA;AACA,KAAA;AACA,IAAA,YAAA,CAAA,KAAA,EAAA,IAAA,EAAA;AACA,MAAA,OAAA,wBAAA,CAAA,KAAA,EAAA,IAAA,CAAA;AACA,KAAA;AACA,GAAA;AACA,CAAA;;;;"}
@@ -1,405 +0,0 @@
1
- import { defineIntegration, LRUMap, getClient, logger } from '@sentry/core';
2
- import { NODE_MAJOR } from '../../nodeVersion.js';
3
- import { isDebuggerEnabled } from '../../utils/debug.js';
4
- import { createRateLimiter, functionNamesMatch } from './common.js';
5
-
6
- /** Creates a unique hash from stack frames */
7
- function hashFrames(frames) {
8
- if (frames === undefined) {
9
- return;
10
- }
11
-
12
- // Only hash the 10 most recent frames (ie. the last 10)
13
- return frames.slice(-10).reduce((acc, frame) => `${acc},${frame.function},${frame.lineno},${frame.colno}`, '');
14
- }
15
-
16
- /**
17
- * We use the stack parser to create a unique hash from the exception stack trace
18
- * This is used to lookup vars when the exception passes through the event processor
19
- */
20
- function hashFromStack(stackParser, stack) {
21
- if (stack === undefined) {
22
- return undefined;
23
- }
24
-
25
- return hashFrames(stackParser(stack, 1));
26
- }
27
-
28
- /** Creates a container for callbacks to be called sequentially */
29
- function createCallbackList(complete) {
30
- // A collection of callbacks to be executed last to first
31
- let callbacks = [];
32
-
33
- let completedCalled = false;
34
- function checkedComplete(result) {
35
- callbacks = [];
36
- if (completedCalled) {
37
- return;
38
- }
39
- completedCalled = true;
40
- complete(result);
41
- }
42
-
43
- // complete should be called last
44
- callbacks.push(checkedComplete);
45
-
46
- function add(fn) {
47
- callbacks.push(fn);
48
- }
49
-
50
- function next(result) {
51
- const popped = callbacks.pop() || checkedComplete;
52
-
53
- try {
54
- popped(result);
55
- } catch (_) {
56
- // If there is an error, we still want to call the complete callback
57
- checkedComplete(result);
58
- }
59
- }
60
-
61
- return { add, next };
62
- }
63
-
64
- /**
65
- * Promise API is available as `Experimental` and in Node 19 only.
66
- *
67
- * Callback-based API is `Stable` since v14 and `Experimental` since v8.
68
- * Because of that, we are creating our own `AsyncSession` class.
69
- *
70
- * https://nodejs.org/docs/latest-v19.x/api/inspector.html#promises-api
71
- * https://nodejs.org/docs/latest-v14.x/api/inspector.html
72
- */
73
- class AsyncSession {
74
- /** Throws if inspector API is not available */
75
- constructor( _session) {this._session = _session;
76
- //
77
- }
78
-
79
- static async create(orDefault) {
80
- if (orDefault) {
81
- return orDefault;
82
- }
83
-
84
- const inspector = await import('node:inspector');
85
- return new AsyncSession(new inspector.Session());
86
- }
87
-
88
- /** @inheritdoc */
89
- configureAndConnect(onPause, captureAll) {
90
- this._session.connect();
91
-
92
- this._session.on('Debugger.paused', event => {
93
- onPause(event, () => {
94
- // After the pause work is complete, resume execution or the exception context memory is leaked
95
- this._session.post('Debugger.resume');
96
- });
97
- });
98
-
99
- this._session.post('Debugger.enable');
100
- this._session.post('Debugger.setPauseOnExceptions', { state: captureAll ? 'all' : 'uncaught' });
101
- }
102
-
103
- setPauseOnExceptions(captureAll) {
104
- this._session.post('Debugger.setPauseOnExceptions', { state: captureAll ? 'all' : 'uncaught' });
105
- }
106
-
107
- /** @inheritdoc */
108
- getLocalVariables(objectId, complete) {
109
- this._getProperties(objectId, props => {
110
- const { add, next } = createCallbackList(complete);
111
-
112
- for (const prop of props) {
113
- if (prop.value?.objectId && prop.value.className === 'Array') {
114
- const id = prop.value.objectId;
115
- add(vars => this._unrollArray(id, prop.name, vars, next));
116
- } else if (prop.value?.objectId && prop.value.className === 'Object') {
117
- const id = prop.value.objectId;
118
- add(vars => this._unrollObject(id, prop.name, vars, next));
119
- } else if (prop.value) {
120
- add(vars => this._unrollOther(prop, vars, next));
121
- }
122
- }
123
-
124
- next({});
125
- });
126
- }
127
-
128
- /**
129
- * Gets all the PropertyDescriptors of an object
130
- */
131
- _getProperties(objectId, next) {
132
- this._session.post(
133
- 'Runtime.getProperties',
134
- {
135
- objectId,
136
- ownProperties: true,
137
- },
138
- (err, params) => {
139
- if (err) {
140
- next([]);
141
- } else {
142
- next(params.result);
143
- }
144
- },
145
- );
146
- }
147
-
148
- /**
149
- * Unrolls an array property
150
- */
151
- _unrollArray(objectId, name, vars, next) {
152
- this._getProperties(objectId, props => {
153
- vars[name] = props
154
- .filter(v => v.name !== 'length' && !isNaN(parseInt(v.name, 10)))
155
- .sort((a, b) => parseInt(a.name, 10) - parseInt(b.name, 10))
156
- .map(v => v.value?.value);
157
-
158
- next(vars);
159
- });
160
- }
161
-
162
- /**
163
- * Unrolls an object property
164
- */
165
- _unrollObject(objectId, name, vars, next) {
166
- this._getProperties(objectId, props => {
167
- vars[name] = props
168
- .map(v => [v.name, v.value?.value])
169
- .reduce((obj, [key, val]) => {
170
- obj[key] = val;
171
- return obj;
172
- }, {} );
173
-
174
- next(vars);
175
- });
176
- }
177
-
178
- /**
179
- * Unrolls other properties
180
- */
181
- _unrollOther(prop, vars, next) {
182
- if (prop.value) {
183
- if ('value' in prop.value) {
184
- if (prop.value.value === undefined || prop.value.value === null) {
185
- vars[prop.name] = `<${prop.value.value}>`;
186
- } else {
187
- vars[prop.name] = prop.value.value;
188
- }
189
- } else if ('description' in prop.value && prop.value.type !== 'function') {
190
- vars[prop.name] = `<${prop.value.description}>`;
191
- } else if (prop.value.type === 'undefined') {
192
- vars[prop.name] = '<undefined>';
193
- }
194
- }
195
-
196
- next(vars);
197
- }
198
- }
199
-
200
- const INTEGRATION_NAME = 'LocalVariables';
201
-
202
- /**
203
- * Adds local variables to exception frames
204
- */
205
- const _localVariablesSyncIntegration = ((
206
- options = {},
207
- sessionOverride,
208
- ) => {
209
- const cachedFrames = new LRUMap(20);
210
- let rateLimiter;
211
- let shouldProcessEvent = false;
212
-
213
- function addLocalVariablesToException(exception) {
214
- const hash = hashFrames(exception.stacktrace?.frames);
215
-
216
- if (hash === undefined) {
217
- return;
218
- }
219
-
220
- // Check if we have local variables for an exception that matches the hash
221
- // remove is identical to get but also removes the entry from the cache
222
- const cachedFrame = cachedFrames.remove(hash);
223
-
224
- if (cachedFrame === undefined) {
225
- return;
226
- }
227
-
228
- // Filter out frames where the function name is `new Promise` since these are in the error.stack frames
229
- // but do not appear in the debugger call frames
230
- const frames = (exception.stacktrace?.frames || []).filter(frame => frame.function !== 'new Promise');
231
-
232
- for (let i = 0; i < frames.length; i++) {
233
- // Sentry frames are in reverse order
234
- const frameIndex = frames.length - i - 1;
235
-
236
- const cachedFrameVariable = cachedFrame[i];
237
- const frameVariable = frames[frameIndex];
238
-
239
- // Drop out if we run out of frames to match up
240
- if (!frameVariable || !cachedFrameVariable) {
241
- break;
242
- }
243
-
244
- if (
245
- // We need to have vars to add
246
- cachedFrameVariable.vars === undefined ||
247
- // We're not interested in frames that are not in_app because the vars are not relevant
248
- frameVariable.in_app === false ||
249
- // The function names need to match
250
- !functionNamesMatch(frameVariable.function, cachedFrameVariable.function)
251
- ) {
252
- continue;
253
- }
254
-
255
- frameVariable.vars = cachedFrameVariable.vars;
256
- }
257
- }
258
-
259
- function addLocalVariablesToEvent(event) {
260
- for (const exception of event.exception?.values || []) {
261
- addLocalVariablesToException(exception);
262
- }
263
-
264
- return event;
265
- }
266
-
267
- return {
268
- name: INTEGRATION_NAME,
269
- async setupOnce() {
270
- const client = getClient();
271
- const clientOptions = client?.getOptions();
272
-
273
- if (!clientOptions?.includeLocalVariables) {
274
- return;
275
- }
276
-
277
- // Only setup this integration if the Node version is >= v18
278
- // https://github.com/getsentry/sentry-javascript/issues/7697
279
- const unsupportedNodeVersion = NODE_MAJOR < 18;
280
-
281
- if (unsupportedNodeVersion) {
282
- logger.log('The `LocalVariables` integration is only supported on Node >= v18.');
283
- return;
284
- }
285
-
286
- if (await isDebuggerEnabled()) {
287
- logger.warn('Local variables capture has been disabled because the debugger was already enabled');
288
- return;
289
- }
290
-
291
- AsyncSession.create(sessionOverride).then(
292
- session => {
293
- function handlePaused(
294
- stackParser,
295
- { params: { reason, data, callFrames } },
296
- complete,
297
- ) {
298
- if (reason !== 'exception' && reason !== 'promiseRejection') {
299
- complete();
300
- return;
301
- }
302
-
303
- rateLimiter?.();
304
-
305
- // data.description contains the original error.stack
306
- const exceptionHash = hashFromStack(stackParser, data.description);
307
-
308
- if (exceptionHash == undefined) {
309
- complete();
310
- return;
311
- }
312
-
313
- const { add, next } = createCallbackList(frames => {
314
- cachedFrames.set(exceptionHash, frames);
315
- complete();
316
- });
317
-
318
- // Because we're queuing up and making all these calls synchronously, we can potentially overflow the stack
319
- // For this reason we only attempt to get local variables for the first 5 frames
320
- for (let i = 0; i < Math.min(callFrames.length, 5); i++) {
321
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
322
- const { scopeChain, functionName, this: obj } = callFrames[i];
323
-
324
- const localScope = scopeChain.find(scope => scope.type === 'local');
325
-
326
- // obj.className is undefined in ESM modules
327
- const fn =
328
- obj.className === 'global' || !obj.className ? functionName : `${obj.className}.${functionName}`;
329
-
330
- if (localScope?.object.objectId === undefined) {
331
- add(frames => {
332
- frames[i] = { function: fn };
333
- next(frames);
334
- });
335
- } else {
336
- const id = localScope.object.objectId;
337
- add(frames =>
338
- session.getLocalVariables(id, vars => {
339
- frames[i] = { function: fn, vars };
340
- next(frames);
341
- }),
342
- );
343
- }
344
- }
345
-
346
- next([]);
347
- }
348
-
349
- const captureAll = options.captureAllExceptions !== false;
350
-
351
- session.configureAndConnect(
352
- (ev, complete) =>
353
- handlePaused(clientOptions.stackParser, ev , complete),
354
- captureAll,
355
- );
356
-
357
- if (captureAll) {
358
- const max = options.maxExceptionsPerSecond || 50;
359
-
360
- rateLimiter = createRateLimiter(
361
- max,
362
- () => {
363
- logger.log('Local variables rate-limit lifted.');
364
- session.setPauseOnExceptions(true);
365
- },
366
- seconds => {
367
- logger.log(
368
- `Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${seconds} seconds.`,
369
- );
370
- session.setPauseOnExceptions(false);
371
- },
372
- );
373
- }
374
-
375
- shouldProcessEvent = true;
376
- },
377
- error => {
378
- logger.log('The `LocalVariables` integration failed to start.', error);
379
- },
380
- );
381
- },
382
- processEvent(event) {
383
- if (shouldProcessEvent) {
384
- return addLocalVariablesToEvent(event);
385
- }
386
-
387
- return event;
388
- },
389
- // These are entirely for testing
390
- _getCachedFramesCount() {
391
- return cachedFrames.size;
392
- },
393
- _getFirstCachedFrame() {
394
- return cachedFrames.values()[0];
395
- },
396
- };
397
- }) ;
398
-
399
- /**
400
- * Adds local variables to exception frames.
401
- */
402
- const localVariablesSyncIntegration = defineIntegration(_localVariablesSyncIntegration);
403
-
404
- export { createCallbackList, hashFrames, hashFromStack, localVariablesSyncIntegration };
405
- //# sourceMappingURL=local-variables-sync.js.map