@sentry/node 9.33.0 → 9.34.0-alpha.1

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