@sentry/node 9.34.0-alpha.1 → 9.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (474) hide show
  1. package/build/cjs/cron/common.js +56 -0
  2. package/build/cjs/cron/common.js.map +1 -0
  3. package/build/cjs/cron/cron.js +112 -0
  4. package/build/cjs/cron/cron.js.map +1 -0
  5. package/build/cjs/cron/index.js +15 -0
  6. package/build/cjs/cron/index.js.map +1 -0
  7. package/build/cjs/cron/node-cron.js +71 -0
  8. package/build/cjs/cron/node-cron.js.map +1 -0
  9. package/build/cjs/cron/node-schedule.js +65 -0
  10. package/build/cjs/cron/node-schedule.js.map +1 -0
  11. package/build/cjs/index.js +56 -38
  12. package/build/cjs/index.js.map +1 -1
  13. package/build/cjs/integrations/anr/index.js +238 -0
  14. package/build/cjs/integrations/anr/index.js.map +1 -0
  15. package/build/cjs/integrations/childProcess.js +100 -0
  16. package/build/cjs/integrations/childProcess.js.map +1 -0
  17. package/build/cjs/integrations/context.js +457 -0
  18. package/build/cjs/integrations/context.js.map +1 -0
  19. package/build/cjs/integrations/contextlines.js +405 -0
  20. package/build/cjs/integrations/contextlines.js.map +1 -0
  21. package/build/cjs/integrations/fs.js +2 -2
  22. package/build/cjs/integrations/fs.js.map +1 -1
  23. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +558 -0
  24. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +1 -0
  25. package/build/cjs/integrations/http/index.js +11 -7
  26. package/build/cjs/integrations/http/index.js.map +1 -1
  27. package/build/cjs/integrations/local-variables/common.js +69 -0
  28. package/build/cjs/integrations/local-variables/common.js.map +1 -0
  29. package/build/cjs/integrations/local-variables/index.js +12 -0
  30. package/build/cjs/integrations/local-variables/index.js.map +1 -0
  31. package/build/cjs/integrations/local-variables/local-variables-async.js +143 -0
  32. package/build/cjs/integrations/local-variables/local-variables-async.js.map +1 -0
  33. package/build/cjs/integrations/local-variables/local-variables-sync.js +410 -0
  34. package/build/cjs/integrations/local-variables/local-variables-sync.js.map +1 -0
  35. package/build/cjs/integrations/modules.js +135 -0
  36. package/build/cjs/integrations/modules.js.map +1 -0
  37. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js +291 -0
  38. package/build/cjs/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +1 -0
  39. package/build/cjs/integrations/node-fetch/index.js +5 -4
  40. package/build/cjs/integrations/node-fetch/index.js.map +1 -1
  41. package/build/cjs/integrations/onuncaughtexception.js +134 -0
  42. package/build/cjs/integrations/onuncaughtexception.js.map +1 -0
  43. package/build/cjs/integrations/onunhandledrejection.js +89 -0
  44. package/build/cjs/integrations/onunhandledrejection.js.map +1 -0
  45. package/build/cjs/integrations/processSession.js +36 -0
  46. package/build/cjs/integrations/processSession.js.map +1 -0
  47. package/build/cjs/integrations/spotlight.js +101 -0
  48. package/build/cjs/integrations/spotlight.js.map +1 -0
  49. package/build/cjs/integrations/tracing/amqplib.js +5 -4
  50. package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
  51. package/build/cjs/integrations/tracing/connect.js +4 -3
  52. package/build/cjs/integrations/tracing/connect.js.map +1 -1
  53. package/build/cjs/integrations/tracing/dataloader.js +3 -3
  54. package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
  55. package/build/cjs/integrations/tracing/express.js +7 -5
  56. package/build/cjs/integrations/tracing/express.js.map +1 -1
  57. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  58. package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  59. package/build/cjs/integrations/tracing/fastify/index.js +6 -6
  60. package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
  61. package/build/cjs/integrations/tracing/genericPool.js +3 -3
  62. package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
  63. package/build/cjs/integrations/tracing/graphql.js +4 -3
  64. package/build/cjs/integrations/tracing/graphql.js.map +1 -1
  65. package/build/cjs/integrations/tracing/hapi/index.js +4 -3
  66. package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
  67. package/build/cjs/integrations/tracing/kafka.js +5 -4
  68. package/build/cjs/integrations/tracing/kafka.js.map +1 -1
  69. package/build/cjs/integrations/tracing/knex.js +3 -3
  70. package/build/cjs/integrations/tracing/knex.js.map +1 -1
  71. package/build/cjs/integrations/tracing/koa.js +6 -4
  72. package/build/cjs/integrations/tracing/koa.js.map +1 -1
  73. package/build/cjs/integrations/tracing/lrumemoizer.js +2 -2
  74. package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
  75. package/build/cjs/integrations/tracing/mongo.js +4 -3
  76. package/build/cjs/integrations/tracing/mongo.js.map +1 -1
  77. package/build/cjs/integrations/tracing/mongoose.js +4 -3
  78. package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
  79. package/build/cjs/integrations/tracing/mysql.js +2 -2
  80. package/build/cjs/integrations/tracing/mysql.js.map +1 -1
  81. package/build/cjs/integrations/tracing/mysql2.js +4 -3
  82. package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
  83. package/build/cjs/integrations/tracing/postgres.js +4 -3
  84. package/build/cjs/integrations/tracing/postgres.js.map +1 -1
  85. package/build/cjs/integrations/tracing/postgresjs.js +4 -3
  86. package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
  87. package/build/cjs/integrations/tracing/prisma.js +2 -2
  88. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  89. package/build/cjs/integrations/tracing/redis.js +3 -3
  90. package/build/cjs/integrations/tracing/redis.js.map +1 -1
  91. package/build/cjs/integrations/tracing/tedious.js +3 -3
  92. package/build/cjs/integrations/tracing/tedious.js.map +1 -1
  93. package/build/cjs/integrations/tracing/vercelai/index.js +2 -2
  94. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  95. package/build/cjs/integrations/winston.js +151 -0
  96. package/build/cjs/integrations/winston.js.map +1 -0
  97. package/build/cjs/logs/capture.js +29 -0
  98. package/build/cjs/logs/capture.js.map +1 -0
  99. package/build/cjs/logs/exports.js +178 -0
  100. package/build/cjs/logs/exports.js.map +1 -0
  101. package/build/cjs/nodeVersion.js +12 -0
  102. package/build/cjs/nodeVersion.js.map +1 -0
  103. package/build/cjs/otel/contextManager.js +16 -0
  104. package/build/cjs/otel/contextManager.js.map +1 -0
  105. package/build/cjs/otel/instrument.js +139 -0
  106. package/build/cjs/otel/instrument.js.map +1 -0
  107. package/build/cjs/preload.js +2 -2
  108. package/build/cjs/preload.js.map +1 -1
  109. package/build/cjs/proxy/base.js +122 -0
  110. package/build/cjs/proxy/base.js.map +1 -0
  111. package/build/cjs/proxy/index.js +173 -0
  112. package/build/cjs/proxy/index.js.map +1 -0
  113. package/build/cjs/proxy/parse-proxy-response.js +104 -0
  114. package/build/cjs/proxy/parse-proxy-response.js.map +1 -0
  115. package/build/cjs/sdk/api.js +117 -0
  116. package/build/cjs/sdk/api.js.map +1 -0
  117. package/build/cjs/sdk/client.js +156 -0
  118. package/build/cjs/sdk/client.js.map +1 -0
  119. package/build/cjs/sdk/index.js +203 -22
  120. package/build/cjs/sdk/index.js.map +1 -1
  121. package/build/cjs/sdk/initOtel.js +22 -4
  122. package/build/cjs/sdk/initOtel.js.map +1 -1
  123. package/build/cjs/transports/http.js +158 -0
  124. package/build/cjs/transports/http.js.map +1 -0
  125. package/build/cjs/utils/addOriginToSpan.js +11 -0
  126. package/build/cjs/utils/addOriginToSpan.js.map +1 -0
  127. package/build/cjs/utils/baggage.js +36 -0
  128. package/build/cjs/utils/baggage.js.map +1 -0
  129. package/build/cjs/utils/commonjs.js +13 -0
  130. package/build/cjs/utils/commonjs.js.map +1 -0
  131. package/build/cjs/utils/createMissingInstrumentationContext.js +11 -0
  132. package/build/cjs/utils/createMissingInstrumentationContext.js.map +1 -0
  133. package/build/cjs/utils/debug.js +23 -0
  134. package/build/cjs/utils/debug.js.map +1 -0
  135. package/build/cjs/utils/ensureIsWrapped.js +41 -0
  136. package/build/cjs/utils/ensureIsWrapped.js.map +1 -0
  137. package/build/cjs/utils/envToBool.js +32 -0
  138. package/build/cjs/utils/envToBool.js.map +1 -0
  139. package/build/cjs/utils/errorhandling.js +42 -0
  140. package/build/cjs/utils/errorhandling.js.map +1 -0
  141. package/build/cjs/utils/getRequestUrl.js +18 -0
  142. package/build/cjs/utils/getRequestUrl.js.map +1 -0
  143. package/build/cjs/utils/module.js +60 -0
  144. package/build/cjs/utils/module.js.map +1 -0
  145. package/build/esm/cron/common.js +54 -0
  146. package/build/esm/cron/common.js.map +1 -0
  147. package/build/esm/cron/cron.js +110 -0
  148. package/build/esm/cron/cron.js.map +1 -0
  149. package/build/esm/cron/index.js +13 -0
  150. package/build/esm/cron/index.js.map +1 -0
  151. package/build/esm/cron/node-cron.js +69 -0
  152. package/build/esm/cron/node-cron.js.map +1 -0
  153. package/build/esm/cron/node-schedule.js +63 -0
  154. package/build/esm/cron/node-schedule.js.map +1 -0
  155. package/build/esm/index.js +21 -2
  156. package/build/esm/index.js.map +1 -1
  157. package/build/esm/integrations/anr/index.js +234 -0
  158. package/build/esm/integrations/anr/index.js.map +1 -0
  159. package/build/esm/integrations/anr/worker-script.js +2 -0
  160. package/build/esm/integrations/childProcess.js +98 -0
  161. package/build/esm/integrations/childProcess.js.map +1 -0
  162. package/build/esm/integrations/context.js +451 -0
  163. package/build/esm/integrations/context.js.map +1 -0
  164. package/build/esm/integrations/contextlines.js +399 -0
  165. package/build/esm/integrations/contextlines.js.map +1 -0
  166. package/build/esm/integrations/fs.js +1 -1
  167. package/build/esm/integrations/fs.js.map +1 -1
  168. package/build/esm/integrations/http/SentryHttpInstrumentation.js +555 -0
  169. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +1 -0
  170. package/build/esm/integrations/http/index.js +5 -1
  171. package/build/esm/integrations/http/index.js.map +1 -1
  172. package/build/esm/integrations/local-variables/common.js +64 -0
  173. package/build/esm/integrations/local-variables/common.js.map +1 -0
  174. package/build/esm/integrations/local-variables/index.js +10 -0
  175. package/build/esm/integrations/local-variables/index.js.map +1 -0
  176. package/build/esm/integrations/local-variables/local-variables-async.js +140 -0
  177. package/build/esm/integrations/local-variables/local-variables-async.js.map +1 -0
  178. package/build/esm/integrations/local-variables/local-variables-sync.js +405 -0
  179. package/build/esm/integrations/local-variables/local-variables-sync.js.map +1 -0
  180. package/build/esm/integrations/local-variables/worker-script.js +2 -0
  181. package/build/esm/integrations/modules.js +133 -0
  182. package/build/esm/integrations/modules.js.map +1 -0
  183. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js +289 -0
  184. package/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js.map +1 -0
  185. package/build/esm/integrations/node-fetch/index.js +3 -2
  186. package/build/esm/integrations/node-fetch/index.js.map +1 -1
  187. package/build/esm/integrations/onuncaughtexception.js +131 -0
  188. package/build/esm/integrations/onuncaughtexception.js.map +1 -0
  189. package/build/esm/integrations/onunhandledrejection.js +86 -0
  190. package/build/esm/integrations/onunhandledrejection.js.map +1 -0
  191. package/build/esm/integrations/processSession.js +34 -0
  192. package/build/esm/integrations/processSession.js.map +1 -0
  193. package/build/esm/integrations/spotlight.js +98 -0
  194. package/build/esm/integrations/spotlight.js.map +1 -0
  195. package/build/esm/integrations/tracing/amqplib.js +2 -1
  196. package/build/esm/integrations/tracing/amqplib.js.map +1 -1
  197. package/build/esm/integrations/tracing/connect.js +2 -1
  198. package/build/esm/integrations/tracing/connect.js.map +1 -1
  199. package/build/esm/integrations/tracing/dataloader.js +1 -1
  200. package/build/esm/integrations/tracing/dataloader.js.map +1 -1
  201. package/build/esm/integrations/tracing/express.js +4 -2
  202. package/build/esm/integrations/tracing/express.js.map +1 -1
  203. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js +3 -3
  204. package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
  205. package/build/esm/integrations/tracing/fastify/index.js +5 -5
  206. package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
  207. package/build/esm/integrations/tracing/genericPool.js +1 -1
  208. package/build/esm/integrations/tracing/genericPool.js.map +1 -1
  209. package/build/esm/integrations/tracing/graphql.js +3 -2
  210. package/build/esm/integrations/tracing/graphql.js.map +1 -1
  211. package/build/esm/integrations/tracing/hapi/index.js +2 -1
  212. package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
  213. package/build/esm/integrations/tracing/kafka.js +2 -1
  214. package/build/esm/integrations/tracing/kafka.js.map +1 -1
  215. package/build/esm/integrations/tracing/knex.js +1 -1
  216. package/build/esm/integrations/tracing/knex.js.map +1 -1
  217. package/build/esm/integrations/tracing/koa.js +4 -2
  218. package/build/esm/integrations/tracing/koa.js.map +1 -1
  219. package/build/esm/integrations/tracing/lrumemoizer.js +1 -1
  220. package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
  221. package/build/esm/integrations/tracing/mongo.js +2 -1
  222. package/build/esm/integrations/tracing/mongo.js.map +1 -1
  223. package/build/esm/integrations/tracing/mongoose.js +2 -1
  224. package/build/esm/integrations/tracing/mongoose.js.map +1 -1
  225. package/build/esm/integrations/tracing/mysql.js +1 -1
  226. package/build/esm/integrations/tracing/mysql.js.map +1 -1
  227. package/build/esm/integrations/tracing/mysql2.js +2 -1
  228. package/build/esm/integrations/tracing/mysql2.js.map +1 -1
  229. package/build/esm/integrations/tracing/postgres.js +2 -1
  230. package/build/esm/integrations/tracing/postgres.js.map +1 -1
  231. package/build/esm/integrations/tracing/postgresjs.js +3 -2
  232. package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
  233. package/build/esm/integrations/tracing/prisma.js +1 -1
  234. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  235. package/build/esm/integrations/tracing/redis.js +1 -1
  236. package/build/esm/integrations/tracing/redis.js.map +1 -1
  237. package/build/esm/integrations/tracing/tedious.js +1 -1
  238. package/build/esm/integrations/tracing/tedious.js.map +1 -1
  239. package/build/esm/integrations/tracing/vercelai/index.js +1 -1
  240. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  241. package/build/esm/integrations/winston.js +149 -0
  242. package/build/esm/integrations/winston.js.map +1 -0
  243. package/build/esm/logs/capture.js +27 -0
  244. package/build/esm/logs/capture.js.map +1 -0
  245. package/build/esm/logs/exports.js +170 -0
  246. package/build/esm/logs/exports.js.map +1 -0
  247. package/build/esm/nodeVersion.js +8 -0
  248. package/build/esm/nodeVersion.js.map +1 -0
  249. package/build/esm/otel/contextManager.js +14 -0
  250. package/build/esm/otel/contextManager.js.map +1 -0
  251. package/build/esm/otel/instrument.js +135 -0
  252. package/build/esm/otel/instrument.js.map +1 -0
  253. package/build/esm/package.json +1 -1
  254. package/build/esm/preload.js +1 -1
  255. package/build/esm/preload.js.map +1 -1
  256. package/build/esm/proxy/base.js +120 -0
  257. package/build/esm/proxy/base.js.map +1 -0
  258. package/build/esm/proxy/index.js +171 -0
  259. package/build/esm/proxy/index.js.map +1 -0
  260. package/build/esm/proxy/parse-proxy-response.js +102 -0
  261. package/build/esm/proxy/parse-proxy-response.js.map +1 -0
  262. package/build/esm/sdk/api.js +114 -0
  263. package/build/esm/sdk/api.js.map +1 -0
  264. package/build/esm/sdk/client.js +154 -0
  265. package/build/esm/sdk/client.js.map +1 -0
  266. package/build/esm/sdk/index.js +202 -22
  267. package/build/esm/sdk/index.js.map +1 -1
  268. package/build/esm/sdk/initOtel.js +21 -3
  269. package/build/esm/sdk/initOtel.js.map +1 -1
  270. package/build/esm/transports/http.js +156 -0
  271. package/build/esm/transports/http.js.map +1 -0
  272. package/build/esm/utils/addOriginToSpan.js +9 -0
  273. package/build/esm/utils/addOriginToSpan.js.map +1 -0
  274. package/build/esm/utils/baggage.js +34 -0
  275. package/build/esm/utils/baggage.js.map +1 -0
  276. package/build/esm/utils/commonjs.js +11 -0
  277. package/build/esm/utils/commonjs.js.map +1 -0
  278. package/build/esm/utils/createMissingInstrumentationContext.js +9 -0
  279. package/build/esm/utils/createMissingInstrumentationContext.js.map +1 -0
  280. package/build/esm/utils/debug.js +21 -0
  281. package/build/esm/utils/debug.js.map +1 -0
  282. package/build/esm/utils/ensureIsWrapped.js +39 -0
  283. package/build/esm/utils/ensureIsWrapped.js.map +1 -0
  284. package/build/esm/utils/envToBool.js +28 -0
  285. package/build/esm/utils/envToBool.js.map +1 -0
  286. package/build/esm/utils/errorhandling.js +40 -0
  287. package/build/esm/utils/errorhandling.js.map +1 -0
  288. package/build/esm/utils/getRequestUrl.js +16 -0
  289. package/build/esm/utils/getRequestUrl.js.map +1 -0
  290. package/build/esm/utils/module.js +58 -0
  291. package/build/esm/utils/module.js.map +1 -0
  292. package/build/types/cron/common.d.ts +5 -0
  293. package/build/types/cron/common.d.ts.map +1 -0
  294. package/build/types/cron/cron.d.ts +43 -0
  295. package/build/types/cron/cron.d.ts.map +1 -0
  296. package/build/types/cron/index.d.ts +10 -0
  297. package/build/types/cron/index.d.ts.map +1 -0
  298. package/build/types/cron/node-cron.d.ts +27 -0
  299. package/build/types/cron/node-cron.d.ts.map +1 -0
  300. package/build/types/cron/node-schedule.d.ts +19 -0
  301. package/build/types/cron/node-schedule.d.ts.map +1 -0
  302. package/build/types/index.d.ts +21 -2
  303. package/build/types/index.d.ts.map +1 -1
  304. package/build/types/integrations/anr/common.d.ts +52 -0
  305. package/build/types/integrations/anr/common.d.ts.map +1 -0
  306. package/build/types/integrations/anr/index.d.ts +13 -0
  307. package/build/types/integrations/anr/index.d.ts.map +1 -0
  308. package/build/types/integrations/anr/worker.d.ts +2 -0
  309. package/build/types/integrations/anr/worker.d.ts.map +1 -0
  310. package/build/types/integrations/childProcess.d.ts +20 -0
  311. package/build/types/integrations/childProcess.d.ts.map +1 -0
  312. package/build/types/integrations/context.d.ts +30 -0
  313. package/build/types/integrations/context.d.ts.map +1 -0
  314. package/build/types/integrations/contextlines.d.ts +31 -0
  315. package/build/types/integrations/contextlines.d.ts.map +1 -0
  316. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +131 -0
  317. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +1 -0
  318. package/build/types/integrations/http/index.d.ts +1 -1
  319. package/build/types/integrations/http/index.d.ts.map +1 -1
  320. package/build/types/integrations/local-variables/common.d.ts +66 -0
  321. package/build/types/integrations/local-variables/common.d.ts.map +1 -0
  322. package/build/types/integrations/local-variables/index.d.ts +4 -0
  323. package/build/types/integrations/local-variables/index.d.ts.map +1 -0
  324. package/build/types/integrations/local-variables/local-variables-async.d.ts +7 -0
  325. package/build/types/integrations/local-variables/local-variables-async.d.ts.map +1 -0
  326. package/build/types/integrations/local-variables/local-variables-sync.d.ts +34 -0
  327. package/build/types/integrations/local-variables/local-variables-sync.d.ts.map +1 -0
  328. package/build/types/integrations/local-variables/worker.d.ts +2 -0
  329. package/build/types/integrations/local-variables/worker.d.ts.map +1 -0
  330. package/build/types/integrations/modules.d.ts +17 -0
  331. package/build/types/integrations/modules.d.ts.map +1 -0
  332. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +56 -0
  333. package/build/types/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts.map +1 -0
  334. package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
  335. package/build/types/integrations/onuncaughtexception.d.ts +31 -0
  336. package/build/types/integrations/onuncaughtexception.d.ts.map +1 -0
  337. package/build/types/integrations/onunhandledrejection.d.ts +23 -0
  338. package/build/types/integrations/onunhandledrejection.d.ts.map +1 -0
  339. package/build/types/integrations/processSession.d.ts +5 -0
  340. package/build/types/integrations/processSession.d.ts.map +1 -0
  341. package/build/types/integrations/spotlight.d.ts +18 -0
  342. package/build/types/integrations/spotlight.d.ts.map +1 -0
  343. package/build/types/integrations/tracing/amqplib.d.ts.map +1 -1
  344. package/build/types/integrations/tracing/connect.d.ts.map +1 -1
  345. package/build/types/integrations/tracing/express.d.ts.map +1 -1
  346. package/build/types/integrations/tracing/graphql.d.ts.map +1 -1
  347. package/build/types/integrations/tracing/hapi/index.d.ts.map +1 -1
  348. package/build/types/integrations/tracing/kafka.d.ts.map +1 -1
  349. package/build/types/integrations/tracing/koa.d.ts.map +1 -1
  350. package/build/types/integrations/tracing/mongo.d.ts.map +1 -1
  351. package/build/types/integrations/tracing/mongoose.d.ts.map +1 -1
  352. package/build/types/integrations/tracing/mysql2.d.ts.map +1 -1
  353. package/build/types/integrations/tracing/postgres.d.ts.map +1 -1
  354. package/build/types/integrations/tracing/postgresjs.d.ts.map +1 -1
  355. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  356. package/build/types/integrations/winston.d.ts +44 -0
  357. package/build/types/integrations/winston.d.ts.map +1 -0
  358. package/build/types/logs/capture.d.ts +11 -0
  359. package/build/types/logs/capture.d.ts.map +1 -0
  360. package/build/types/logs/exports.d.ts +150 -0
  361. package/build/types/logs/exports.d.ts.map +1 -0
  362. package/build/types/nodeVersion.d.ts +8 -0
  363. package/build/types/nodeVersion.d.ts.map +1 -0
  364. package/build/types/otel/contextManager.d.ts +10 -0
  365. package/build/types/otel/contextManager.d.ts.map +1 -0
  366. package/build/types/otel/instrument.d.ts +23 -0
  367. package/build/types/otel/instrument.d.ts.map +1 -0
  368. package/build/types/proxy/base.d.ts +65 -0
  369. package/build/types/proxy/base.d.ts.map +1 -0
  370. package/build/types/proxy/helpers.d.ts +42 -0
  371. package/build/types/proxy/helpers.d.ts.map +1 -0
  372. package/build/types/proxy/index.d.ts +73 -0
  373. package/build/types/proxy/index.d.ts.map +1 -0
  374. package/build/types/proxy/parse-proxy-response.d.ts +43 -0
  375. package/build/types/proxy/parse-proxy-response.d.ts.map +1 -0
  376. package/build/types/sdk/api.d.ts +8 -0
  377. package/build/types/sdk/api.d.ts.map +1 -0
  378. package/build/types/sdk/client.d.ts +29 -0
  379. package/build/types/sdk/client.d.ts.map +1 -0
  380. package/build/types/sdk/index.d.ts +6 -2
  381. package/build/types/sdk/index.d.ts.map +1 -1
  382. package/build/types/sdk/initOtel.d.ts +1 -1
  383. package/build/types/sdk/initOtel.d.ts.map +1 -1
  384. package/build/types/sdk/scope.d.ts +7 -0
  385. package/build/types/sdk/scope.d.ts.map +1 -0
  386. package/build/types/transports/http-module.d.ts +31 -0
  387. package/build/types/transports/http-module.d.ts.map +1 -0
  388. package/build/types/transports/http.d.ts +21 -0
  389. package/build/types/transports/http.d.ts.map +1 -0
  390. package/build/types/transports/index.d.ts +3 -0
  391. package/build/types/transports/index.d.ts.map +1 -0
  392. package/build/types/types.d.ts +1 -1
  393. package/build/types/types.d.ts.map +1 -1
  394. package/build/types/utils/addOriginToSpan.d.ts +5 -0
  395. package/build/types/utils/addOriginToSpan.d.ts.map +1 -0
  396. package/build/types/utils/baggage.d.ts +6 -0
  397. package/build/types/utils/baggage.d.ts.map +1 -0
  398. package/build/types/utils/commonjs.d.ts +3 -0
  399. package/build/types/utils/commonjs.d.ts.map +1 -0
  400. package/build/types/utils/createMissingInstrumentationContext.d.ts +3 -0
  401. package/build/types/utils/createMissingInstrumentationContext.d.ts.map +1 -0
  402. package/build/types/utils/debug.d.ts +5 -0
  403. package/build/types/utils/debug.d.ts.map +1 -0
  404. package/build/types/utils/ensureIsWrapped.d.ts +5 -0
  405. package/build/types/utils/ensureIsWrapped.d.ts.map +1 -0
  406. package/build/types/utils/entry-point.d.ts +24 -0
  407. package/build/types/utils/entry-point.d.ts.map +1 -0
  408. package/build/types/utils/envToBool.d.ts +13 -0
  409. package/build/types/utils/envToBool.d.ts.map +1 -0
  410. package/build/types/utils/errorhandling.d.ts +5 -0
  411. package/build/types/utils/errorhandling.d.ts.map +1 -0
  412. package/build/types/utils/getRequestUrl.d.ts +5 -0
  413. package/build/types/utils/getRequestUrl.d.ts.map +1 -0
  414. package/build/types/utils/module.d.ts +3 -0
  415. package/build/types/utils/module.d.ts.map +1 -0
  416. package/build/types/utils/prepareEvent.d.ts +17 -0
  417. package/build/types/utils/prepareEvent.d.ts.map +1 -0
  418. package/build/types-ts3.8/cron/common.d.ts +5 -0
  419. package/build/types-ts3.8/cron/cron.d.ts +43 -0
  420. package/build/types-ts3.8/cron/index.d.ts +10 -0
  421. package/build/types-ts3.8/cron/node-cron.d.ts +27 -0
  422. package/build/types-ts3.8/cron/node-schedule.d.ts +19 -0
  423. package/build/types-ts3.8/index.d.ts +21 -2
  424. package/build/types-ts3.8/integrations/anr/common.d.ts +52 -0
  425. package/build/types-ts3.8/integrations/anr/index.d.ts +13 -0
  426. package/build/types-ts3.8/integrations/anr/worker.d.ts +2 -0
  427. package/build/types-ts3.8/integrations/childProcess.d.ts +20 -0
  428. package/build/types-ts3.8/integrations/context.d.ts +30 -0
  429. package/build/types-ts3.8/integrations/contextlines.d.ts +31 -0
  430. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +133 -0
  431. package/build/types-ts3.8/integrations/http/index.d.ts +1 -1
  432. package/build/types-ts3.8/integrations/local-variables/common.d.ts +66 -0
  433. package/build/types-ts3.8/integrations/local-variables/index.d.ts +4 -0
  434. package/build/types-ts3.8/integrations/local-variables/local-variables-async.d.ts +7 -0
  435. package/build/types-ts3.8/integrations/local-variables/local-variables-sync.d.ts +34 -0
  436. package/build/types-ts3.8/integrations/local-variables/worker.d.ts +2 -0
  437. package/build/types-ts3.8/integrations/modules.d.ts +17 -0
  438. package/build/types-ts3.8/integrations/node-fetch/SentryNodeFetchInstrumentation.d.ts +56 -0
  439. package/build/types-ts3.8/integrations/onuncaughtexception.d.ts +31 -0
  440. package/build/types-ts3.8/integrations/onunhandledrejection.d.ts +23 -0
  441. package/build/types-ts3.8/integrations/processSession.d.ts +5 -0
  442. package/build/types-ts3.8/integrations/spotlight.d.ts +18 -0
  443. package/build/types-ts3.8/integrations/winston.d.ts +44 -0
  444. package/build/types-ts3.8/logs/capture.d.ts +18 -0
  445. package/build/types-ts3.8/logs/exports.d.ts +150 -0
  446. package/build/types-ts3.8/nodeVersion.d.ts +8 -0
  447. package/build/types-ts3.8/otel/contextManager.d.ts +10 -0
  448. package/build/types-ts3.8/otel/instrument.d.ts +23 -0
  449. package/build/types-ts3.8/proxy/base.d.ts +60 -0
  450. package/build/types-ts3.8/proxy/helpers.d.ts +38 -0
  451. package/build/types-ts3.8/proxy/index.d.ts +74 -0
  452. package/build/types-ts3.8/proxy/parse-proxy-response.d.ts +40 -0
  453. package/build/types-ts3.8/sdk/api.d.ts +8 -0
  454. package/build/types-ts3.8/sdk/client.d.ts +32 -0
  455. package/build/types-ts3.8/sdk/index.d.ts +6 -2
  456. package/build/types-ts3.8/sdk/initOtel.d.ts +1 -1
  457. package/build/types-ts3.8/sdk/scope.d.ts +7 -0
  458. package/build/types-ts3.8/transports/http-module.d.ts +28 -0
  459. package/build/types-ts3.8/transports/http.d.ts +20 -0
  460. package/build/types-ts3.8/transports/index.d.ts +3 -0
  461. package/build/types-ts3.8/types.d.ts +1 -1
  462. package/build/types-ts3.8/utils/addOriginToSpan.d.ts +5 -0
  463. package/build/types-ts3.8/utils/baggage.d.ts +6 -0
  464. package/build/types-ts3.8/utils/commonjs.d.ts +3 -0
  465. package/build/types-ts3.8/utils/createMissingInstrumentationContext.d.ts +3 -0
  466. package/build/types-ts3.8/utils/debug.d.ts +5 -0
  467. package/build/types-ts3.8/utils/ensureIsWrapped.d.ts +5 -0
  468. package/build/types-ts3.8/utils/entry-point.d.ts +24 -0
  469. package/build/types-ts3.8/utils/envToBool.d.ts +13 -0
  470. package/build/types-ts3.8/utils/errorhandling.d.ts +5 -0
  471. package/build/types-ts3.8/utils/getRequestUrl.d.ts +5 -0
  472. package/build/types-ts3.8/utils/module.d.ts +3 -0
  473. package/build/types-ts3.8/utils/prepareEvent.d.ts +17 -0
  474. package/package.json +3 -4
@@ -0,0 +1,156 @@
1
+ import * as http from 'node:http';
2
+ import * as https from 'node:https';
3
+ import { Readable } from 'node:stream';
4
+ import { createGzip } from 'node:zlib';
5
+ import { consoleSandbox, createTransport, suppressTracing } from '@sentry/core';
6
+ import { HttpsProxyAgent } from '../proxy/index.js';
7
+
8
+ // Estimated maximum size for reasonable standalone event
9
+ const GZIP_THRESHOLD = 1024 * 32;
10
+
11
+ /**
12
+ * Gets a stream from a Uint8Array or string
13
+ * Readable.from is ideal but was added in node.js v12.3.0 and v10.17.0
14
+ */
15
+ function streamFromBody(body) {
16
+ return new Readable({
17
+ read() {
18
+ this.push(body);
19
+ this.push(null);
20
+ },
21
+ });
22
+ }
23
+
24
+ /**
25
+ * Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.
26
+ */
27
+ function makeNodeTransport(options) {
28
+ let urlSegments;
29
+
30
+ try {
31
+ urlSegments = new URL(options.url);
32
+ } catch (e) {
33
+ consoleSandbox(() => {
34
+ // eslint-disable-next-line no-console
35
+ console.warn(
36
+ '[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.',
37
+ );
38
+ });
39
+ return createTransport(options, () => Promise.resolve({}));
40
+ }
41
+
42
+ const isHttps = urlSegments.protocol === 'https:';
43
+
44
+ // Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`
45
+ // Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`
46
+ const proxy = applyNoProxyOption(
47
+ urlSegments,
48
+ options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy,
49
+ );
50
+
51
+ const nativeHttpModule = isHttps ? https : http;
52
+ const keepAlive = options.keepAlive === undefined ? false : options.keepAlive;
53
+
54
+ // TODO(v10): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node
55
+ // versions(>= 8) as they had memory leaks when using it: #2555
56
+ const agent = proxy
57
+ ? (new HttpsProxyAgent(proxy) )
58
+ : new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 });
59
+
60
+ const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent);
61
+ return createTransport(options, requestExecutor);
62
+ }
63
+
64
+ /**
65
+ * Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion.
66
+ *
67
+ * @param transportUrl The URL the transport intends to send events to.
68
+ * @param proxy The client configured proxy.
69
+ * @returns A proxy the transport should use.
70
+ */
71
+ function applyNoProxyOption(transportUrlSegments, proxy) {
72
+ const { no_proxy } = process.env;
73
+
74
+ const urlIsExemptFromProxy = no_proxy
75
+ ?.split(',')
76
+ .some(
77
+ exemption => transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption),
78
+ );
79
+
80
+ if (urlIsExemptFromProxy) {
81
+ return undefined;
82
+ } else {
83
+ return proxy;
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Creates a RequestExecutor to be used with `createTransport`.
89
+ */
90
+ function createRequestExecutor(
91
+ options,
92
+ httpModule,
93
+ agent,
94
+ ) {
95
+ const { hostname, pathname, port, protocol, search } = new URL(options.url);
96
+ return function makeRequest(request) {
97
+ return new Promise((resolve, reject) => {
98
+ // This ensures we do not generate any spans in OpenTelemetry for the transport
99
+ suppressTracing(() => {
100
+ let body = streamFromBody(request.body);
101
+
102
+ const headers = { ...options.headers };
103
+
104
+ if (request.body.length > GZIP_THRESHOLD) {
105
+ headers['content-encoding'] = 'gzip';
106
+ body = body.pipe(createGzip());
107
+ }
108
+
109
+ const req = httpModule.request(
110
+ {
111
+ method: 'POST',
112
+ agent,
113
+ headers,
114
+ hostname,
115
+ path: `${pathname}${search}`,
116
+ port,
117
+ protocol,
118
+ ca: options.caCerts,
119
+ },
120
+ res => {
121
+ res.on('data', () => {
122
+ // Drain socket
123
+ });
124
+
125
+ res.on('end', () => {
126
+ // Drain socket
127
+ });
128
+
129
+ res.setEncoding('utf8');
130
+
131
+ // "Key-value pairs of header names and values. Header names are lower-cased."
132
+ // https://nodejs.org/api/http.html#http_message_headers
133
+ const retryAfterHeader = res.headers['retry-after'] ?? null;
134
+ const rateLimitsHeader = res.headers['x-sentry-rate-limits'] ?? null;
135
+
136
+ resolve({
137
+ statusCode: res.statusCode,
138
+ headers: {
139
+ 'retry-after': retryAfterHeader,
140
+ 'x-sentry-rate-limits': Array.isArray(rateLimitsHeader)
141
+ ? rateLimitsHeader[0] || null
142
+ : rateLimitsHeader,
143
+ },
144
+ });
145
+ },
146
+ );
147
+
148
+ req.on('error', reject);
149
+ body.pipe(req);
150
+ });
151
+ });
152
+ };
153
+ }
154
+
155
+ export { makeNodeTransport };
156
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sources":["../../../src/transports/http.ts"],"sourcesContent":["import * as http from 'node:http';\nimport * as https from 'node:https';\nimport { Readable } from 'node:stream';\nimport { createGzip } from 'node:zlib';\nimport type {\n BaseTransportOptions,\n Transport,\n TransportMakeRequestResponse,\n TransportRequest,\n TransportRequestExecutor,\n} from '@sentry/core';\nimport { consoleSandbox, createTransport, suppressTracing } from '@sentry/core';\nimport { HttpsProxyAgent } from '../proxy';\nimport type { HTTPModule } from './http-module';\n\nexport interface NodeTransportOptions extends BaseTransportOptions {\n /** Define custom headers */\n headers?: Record<string, string>;\n /** Set a proxy that should be used for outbound requests. */\n proxy?: string;\n /** HTTPS proxy CA certificates */\n caCerts?: string | Buffer | Array<string | Buffer>;\n /** Custom HTTP module. Defaults to the native 'http' and 'https' modules. */\n httpModule?: HTTPModule;\n /** Allow overriding connection keepAlive, defaults to false */\n keepAlive?: boolean;\n}\n\n// Estimated maximum size for reasonable standalone event\nconst GZIP_THRESHOLD = 1024 * 32;\n\n/**\n * Gets a stream from a Uint8Array or string\n * Readable.from is ideal but was added in node.js v12.3.0 and v10.17.0\n */\nfunction streamFromBody(body: Uint8Array | string): Readable {\n return new Readable({\n read() {\n this.push(body);\n this.push(null);\n },\n });\n}\n\n/**\n * Creates a Transport that uses native the native 'http' and 'https' modules to send events to Sentry.\n */\nexport function makeNodeTransport(options: NodeTransportOptions): Transport {\n let urlSegments: URL;\n\n try {\n urlSegments = new URL(options.url);\n } catch (e) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.',\n );\n });\n return createTransport(options, () => Promise.resolve({}));\n }\n\n const isHttps = urlSegments.protocol === 'https:';\n\n // Proxy prioritization: http => `options.proxy` | `process.env.http_proxy`\n // Proxy prioritization: https => `options.proxy` | `process.env.https_proxy` | `process.env.http_proxy`\n const proxy = applyNoProxyOption(\n urlSegments,\n options.proxy || (isHttps ? process.env.https_proxy : undefined) || process.env.http_proxy,\n );\n\n const nativeHttpModule = isHttps ? https : http;\n const keepAlive = options.keepAlive === undefined ? false : options.keepAlive;\n\n // TODO(v10): Evaluate if we can set keepAlive to true. This would involve testing for memory leaks in older node\n // versions(>= 8) as they had memory leaks when using it: #2555\n const agent = proxy\n ? (new HttpsProxyAgent(proxy) as http.Agent)\n : new nativeHttpModule.Agent({ keepAlive, maxSockets: 30, timeout: 2000 });\n\n const requestExecutor = createRequestExecutor(options, options.httpModule ?? nativeHttpModule, agent);\n return createTransport(options, requestExecutor);\n}\n\n/**\n * Honors the `no_proxy` env variable with the highest priority to allow for hosts exclusion.\n *\n * @param transportUrl The URL the transport intends to send events to.\n * @param proxy The client configured proxy.\n * @returns A proxy the transport should use.\n */\nfunction applyNoProxyOption(transportUrlSegments: URL, proxy: string | undefined): string | undefined {\n const { no_proxy } = process.env;\n\n const urlIsExemptFromProxy = no_proxy\n ?.split(',')\n .some(\n exemption => transportUrlSegments.host.endsWith(exemption) || transportUrlSegments.hostname.endsWith(exemption),\n );\n\n if (urlIsExemptFromProxy) {\n return undefined;\n } else {\n return proxy;\n }\n}\n\n/**\n * Creates a RequestExecutor to be used with `createTransport`.\n */\nfunction createRequestExecutor(\n options: NodeTransportOptions,\n httpModule: HTTPModule,\n agent: http.Agent,\n): TransportRequestExecutor {\n const { hostname, pathname, port, protocol, search } = new URL(options.url);\n return function makeRequest(request: TransportRequest): Promise<TransportMakeRequestResponse> {\n return new Promise((resolve, reject) => {\n // This ensures we do not generate any spans in OpenTelemetry for the transport\n suppressTracing(() => {\n let body = streamFromBody(request.body);\n\n const headers: Record<string, string> = { ...options.headers };\n\n if (request.body.length > GZIP_THRESHOLD) {\n headers['content-encoding'] = 'gzip';\n body = body.pipe(createGzip());\n }\n\n const req = httpModule.request(\n {\n method: 'POST',\n agent,\n headers,\n hostname,\n path: `${pathname}${search}`,\n port,\n protocol,\n ca: options.caCerts,\n },\n res => {\n res.on('data', () => {\n // Drain socket\n });\n\n res.on('end', () => {\n // Drain socket\n });\n\n res.setEncoding('utf8');\n\n // \"Key-value pairs of header names and values. Header names are lower-cased.\"\n // https://nodejs.org/api/http.html#http_message_headers\n const retryAfterHeader = res.headers['retry-after'] ?? null;\n const rateLimitsHeader = res.headers['x-sentry-rate-limits'] ?? null;\n\n resolve({\n statusCode: res.statusCode,\n headers: {\n 'retry-after': retryAfterHeader,\n 'x-sentry-rate-limits': Array.isArray(rateLimitsHeader)\n ? rateLimitsHeader[0] || null\n : rateLimitsHeader,\n },\n });\n },\n );\n\n req.on('error', reject);\n body.pipe(req);\n });\n });\n };\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
2
+
3
+ /** Adds an origin to an OTEL Span. */
4
+ function addOriginToSpan(span, origin) {
5
+ span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
6
+ }
7
+
8
+ export { addOriginToSpan };
9
+ //# sourceMappingURL=addOriginToSpan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addOriginToSpan.js","sources":["../../../src/utils/addOriginToSpan.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport type { SpanOrigin } from '@sentry/core';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\n\n/** Adds an origin to an OTEL Span. */\nexport function addOriginToSpan(span: Span, origin: SpanOrigin): void {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);\n}\n"],"names":[],"mappings":";;AAIA;AACO,SAAS,eAAe,CAAC,IAAI,EAAQ,MAAM,EAAoB;AACtE,EAAE,IAAI,CAAC,YAAY,CAAC,gCAAgC,EAAE,MAAM,CAAC;AAC7D;;;;"}
@@ -0,0 +1,34 @@
1
+ import { parseBaggageHeader, objectToBaggageHeader } from '@sentry/core';
2
+
3
+ /**
4
+ * Merge two baggage headers into one, where the existing one takes precedence.
5
+ * The order of the existing baggage will be preserved, and new entries will be added to the end.
6
+ */
7
+ function mergeBaggageHeaders(
8
+ existing,
9
+ baggage,
10
+ ) {
11
+ if (!existing) {
12
+ return baggage;
13
+ }
14
+
15
+ const existingBaggageEntries = parseBaggageHeader(existing);
16
+ const newBaggageEntries = parseBaggageHeader(baggage);
17
+
18
+ if (!newBaggageEntries) {
19
+ return existing;
20
+ }
21
+
22
+ // Existing entries take precedence, ensuring order remains stable for minimal changes
23
+ const mergedBaggageEntries = { ...existingBaggageEntries };
24
+ Object.entries(newBaggageEntries).forEach(([key, value]) => {
25
+ if (!mergedBaggageEntries[key]) {
26
+ mergedBaggageEntries[key] = value;
27
+ }
28
+ });
29
+
30
+ return objectToBaggageHeader(mergedBaggageEntries);
31
+ }
32
+
33
+ export { mergeBaggageHeaders };
34
+ //# sourceMappingURL=baggage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baggage.js","sources":["../../../src/utils/baggage.ts"],"sourcesContent":["import { objectToBaggageHeader, parseBaggageHeader } from '@sentry/core';\n\n/**\n * Merge two baggage headers into one, where the existing one takes precedence.\n * The order of the existing baggage will be preserved, and new entries will be added to the end.\n */\nexport function mergeBaggageHeaders<Existing extends string | string[] | number | undefined>(\n existing: Existing,\n baggage: string,\n): string | undefined | Existing {\n if (!existing) {\n return baggage;\n }\n\n const existingBaggageEntries = parseBaggageHeader(existing);\n const newBaggageEntries = parseBaggageHeader(baggage);\n\n if (!newBaggageEntries) {\n return existing;\n }\n\n // Existing entries take precedence, ensuring order remains stable for minimal changes\n const mergedBaggageEntries = { ...existingBaggageEntries };\n Object.entries(newBaggageEntries).forEach(([key, value]) => {\n if (!mergedBaggageEntries[key]) {\n mergedBaggageEntries[key] = value;\n }\n });\n\n return objectToBaggageHeader(mergedBaggageEntries);\n}\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACO,SAAS,mBAAmB;AACnC,EAAE,QAAQ;AACV,EAAE,OAAO;AACT,EAAiC;AACjC,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,OAAO;AAClB;;AAEA,EAAE,MAAM,sBAAuB,GAAE,kBAAkB,CAAC,QAAQ,CAAC;AAC7D,EAAE,MAAM,iBAAkB,GAAE,kBAAkB,CAAC,OAAO,CAAC;;AAEvD,EAAE,IAAI,CAAC,iBAAiB,EAAE;AAC1B,IAAI,OAAO,QAAQ;AACnB;;AAEA;AACA,EAAE,MAAM,oBAAqB,GAAE,EAAE,GAAG,wBAAwB;AAC5D,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC9D,IAAI,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE;AACpC,MAAM,oBAAoB,CAAC,GAAG,CAAA,GAAI,KAAK;AACvC;AACA,GAAG,CAAC;;AAEJ,EAAE,OAAO,qBAAqB,CAAC,oBAAoB,CAAC;AACpD;;;;"}
@@ -0,0 +1,11 @@
1
+ /** Detect CommonJS. */
2
+ function isCjs() {
3
+ try {
4
+ return typeof module !== 'undefined' && typeof module.exports !== 'undefined';
5
+ } catch {
6
+ return false;
7
+ }
8
+ }
9
+
10
+ export { isCjs };
11
+ //# sourceMappingURL=commonjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonjs.js","sources":["../../../src/utils/commonjs.ts"],"sourcesContent":["/** Detect CommonJS. */\nexport function isCjs(): boolean {\n try {\n return typeof module !== 'undefined' && typeof module.exports !== 'undefined';\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":"AAAA;AACO,SAAS,KAAK,GAAY;AACjC,EAAE,IAAI;AACN,IAAI,OAAO,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAM,CAAC,OAAQ,KAAI,WAAW;AACjF,IAAI,MAAM;AACV,IAAI,OAAO,KAAK;AAChB;AACA;;;;"}
@@ -0,0 +1,9 @@
1
+ import { isCjs } from './commonjs.js';
2
+
3
+ const createMissingInstrumentationContext = (pkg) => ({
4
+ package: pkg,
5
+ 'javascript.is_cjs': isCjs(),
6
+ });
7
+
8
+ export { createMissingInstrumentationContext };
9
+ //# sourceMappingURL=createMissingInstrumentationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMissingInstrumentationContext.js","sources":["../../../src/utils/createMissingInstrumentationContext.ts"],"sourcesContent":["import type { MissingInstrumentationContext } from '@sentry/core';\nimport { isCjs } from './commonjs';\n\nexport const createMissingInstrumentationContext = (pkg: string): MissingInstrumentationContext => ({\n package: pkg,\n 'javascript.is_cjs': isCjs(),\n});\n"],"names":[],"mappings":";;MAGa,mCAAoC,GAAE,CAAC,GAAG,MAA6C;AACpG,EAAE,OAAO,EAAE,GAAG;AACd,EAAE,mBAAmB,EAAE,KAAK,EAAE;AAC9B,CAAC;;;;"}
@@ -0,0 +1,21 @@
1
+ let cachedDebuggerEnabled;
2
+
3
+ /**
4
+ * Was the debugger enabled when this function was first called?
5
+ */
6
+ async function isDebuggerEnabled() {
7
+ if (cachedDebuggerEnabled === undefined) {
8
+ try {
9
+ // Node can be built without inspector support
10
+ const inspector = await import('node:inspector');
11
+ cachedDebuggerEnabled = !!inspector.url();
12
+ } catch (_) {
13
+ cachedDebuggerEnabled = false;
14
+ }
15
+ }
16
+
17
+ return cachedDebuggerEnabled;
18
+ }
19
+
20
+ export { isDebuggerEnabled };
21
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sources":["../../../src/utils/debug.ts"],"sourcesContent":["let cachedDebuggerEnabled: boolean | undefined;\n\n/**\n * Was the debugger enabled when this function was first called?\n */\nexport async function isDebuggerEnabled(): Promise<boolean> {\n if (cachedDebuggerEnabled === undefined) {\n try {\n // Node can be built without inspector support\n const inspector = await import('node:inspector');\n cachedDebuggerEnabled = !!inspector.url();\n } catch (_) {\n cachedDebuggerEnabled = false;\n }\n }\n\n return cachedDebuggerEnabled;\n}\n"],"names":[],"mappings":"AAAA,IAAI,qBAAqB;;AAEzB;AACA;AACA;AACO,eAAe,iBAAiB,GAAqB;AAC5D,EAAE,IAAI,qBAAsB,KAAI,SAAS,EAAE;AAC3C,IAAI,IAAI;AACR;AACA,MAAM,MAAM,SAAU,GAAE,MAAM,OAAO,gBAAgB,CAAC;AACtD,MAAM,qBAAA,GAAwB,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;AAC/C,KAAM,CAAA,OAAO,CAAC,EAAE;AAChB,MAAM,qBAAA,GAAwB,KAAK;AACnC;AACA;;AAEA,EAAE,OAAO,qBAAqB;AAC9B;;;;"}
@@ -0,0 +1,39 @@
1
+ import { isWrapped } from '@opentelemetry/core';
2
+ import { getClient, isEnabled, hasSpansEnabled, consoleSandbox, getGlobalScope } from '@sentry/core';
3
+ import { isCjs } from './commonjs.js';
4
+ import { createMissingInstrumentationContext } from './createMissingInstrumentationContext.js';
5
+
6
+ /**
7
+ * Checks and warns if a framework isn't wrapped by opentelemetry.
8
+ */
9
+ function ensureIsWrapped(
10
+ maybeWrappedFunction,
11
+ name,
12
+ ) {
13
+ const clientOptions = getClient()?.getOptions();
14
+ if (
15
+ !clientOptions?.disableInstrumentationWarnings &&
16
+ !isWrapped(maybeWrappedFunction) &&
17
+ isEnabled() &&
18
+ hasSpansEnabled(clientOptions)
19
+ ) {
20
+ consoleSandbox(() => {
21
+ if (isCjs()) {
22
+ // eslint-disable-next-line no-console
23
+ console.warn(
24
+ `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \`Sentry.init()\`.`,
25
+ );
26
+ } else {
27
+ // eslint-disable-next-line no-console
28
+ console.warn(
29
+ `[Sentry] ${name} is not instrumented. Please make sure to initialize Sentry in a separate file that you \`--import\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${name}/install/esm/.`,
30
+ );
31
+ }
32
+ });
33
+
34
+ getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));
35
+ }
36
+ }
37
+
38
+ export { ensureIsWrapped };
39
+ //# sourceMappingURL=ensureIsWrapped.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureIsWrapped.js","sources":["../../../src/utils/ensureIsWrapped.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/core';\nimport { consoleSandbox, getClient, getGlobalScope, hasSpansEnabled, isEnabled } from '@sentry/core';\nimport type { NodeClient } from '../sdk/client';\nimport { isCjs } from './commonjs';\nimport { createMissingInstrumentationContext } from './createMissingInstrumentationContext';\n\n/**\n * Checks and warns if a framework isn't wrapped by opentelemetry.\n */\nexport function ensureIsWrapped(\n maybeWrappedFunction: unknown,\n name: 'express' | 'connect' | 'fastify' | 'hapi' | 'koa',\n): void {\n const clientOptions = getClient<NodeClient>()?.getOptions();\n if (\n !clientOptions?.disableInstrumentationWarnings &&\n !isWrapped(maybeWrappedFunction) &&\n isEnabled() &&\n hasSpansEnabled(clientOptions)\n ) {\n consoleSandbox(() => {\n if (isCjs()) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \\`Sentry.init()\\`.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. Please make sure to initialize Sentry in a separate file that you \\`--import\\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${name}/install/esm/.`,\n );\n }\n });\n\n getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));\n }\n}\n"],"names":[],"mappings":";;;;;AAMA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,oBAAoB;AACtB,EAAE,IAAI;AACN,EAAQ;AACR,EAAE,MAAM,gBAAgB,SAAS,EAAc,EAAE,UAAU,EAAE;AAC7D,EAAE;AACF,IAAI,CAAC,aAAa,EAAE,8BAA+B;AACnD,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAE;AACrC,IAAI,SAAS,EAAG;AAChB,IAAI,eAAe,CAAC,aAAa;AACjC,IAAI;AACJ,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,IAAI,KAAK,EAAE,EAAE;AACnB;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,mEAAmE,EAAE,IAAI,CAAC,kCAAkC,CAAC;AACxI,SAAS;AACT,aAAa;AACb;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,gLAAgL,EAAE,IAAI,CAAC,cAAc,CAAC;AACjO,SAAS;AACT;AACA,KAAK,CAAC;;AAEN,IAAI,cAAc,EAAE,CAAC,UAAU,CAAC,yBAAyB,EAAE,mCAAmC,CAAC,IAAI,CAAC,CAAC;AACrG;AACA;;;;"}
@@ -0,0 +1,28 @@
1
+ const FALSY_ENV_VALUES = new Set(['false', 'f', 'n', 'no', 'off', '0']);
2
+ const TRUTHY_ENV_VALUES = new Set(['true', 't', 'y', 'yes', 'on', '1']);
3
+
4
+ /**
5
+ * A helper function which casts an ENV variable value to `true` or `false` using the constants defined above.
6
+ * In strict mode, it may return `null` if the value doesn't match any of the predefined values.
7
+ *
8
+ * @param value The value of the env variable
9
+ * @param options -- Only has `strict` key for now, which requires a strict match for `true` in TRUTHY_ENV_VALUES
10
+ * @returns true/false if the lowercase value matches the predefined values above. If not, null in strict mode,
11
+ * and Boolean(value) in loose mode.
12
+ */
13
+ function envToBool(value, options) {
14
+ const normalized = String(value).toLowerCase();
15
+
16
+ if (FALSY_ENV_VALUES.has(normalized)) {
17
+ return false;
18
+ }
19
+
20
+ if (TRUTHY_ENV_VALUES.has(normalized)) {
21
+ return true;
22
+ }
23
+
24
+ return options?.strict ? null : Boolean(value);
25
+ }
26
+
27
+ export { FALSY_ENV_VALUES, TRUTHY_ENV_VALUES, envToBool };
28
+ //# sourceMappingURL=envToBool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envToBool.js","sources":["../../../src/utils/envToBool.ts"],"sourcesContent":["export const FALSY_ENV_VALUES = new Set(['false', 'f', 'n', 'no', 'off', '0']);\nexport const TRUTHY_ENV_VALUES = new Set(['true', 't', 'y', 'yes', 'on', '1']);\n\nexport type StrictBoolCast = {\n strict: true;\n};\n\nexport type LooseBoolCast = {\n strict?: false;\n};\n\nexport type BoolCastOptions = StrictBoolCast | LooseBoolCast;\n\nexport function envToBool(value: unknown, options?: LooseBoolCast): boolean;\nexport function envToBool(value: unknown, options: StrictBoolCast): boolean | null;\nexport function envToBool(value: unknown, options?: BoolCastOptions): boolean | null;\n/**\n * A helper function which casts an ENV variable value to `true` or `false` using the constants defined above.\n * In strict mode, it may return `null` if the value doesn't match any of the predefined values.\n *\n * @param value The value of the env variable\n * @param options -- Only has `strict` key for now, which requires a strict match for `true` in TRUTHY_ENV_VALUES\n * @returns true/false if the lowercase value matches the predefined values above. If not, null in strict mode,\n * and Boolean(value) in loose mode.\n */\nexport function envToBool(value: unknown, options?: BoolCastOptions): boolean | null {\n const normalized = String(value).toLowerCase();\n\n if (FALSY_ENV_VALUES.has(normalized)) {\n return false;\n }\n\n if (TRUTHY_ENV_VALUES.has(normalized)) {\n return true;\n }\n\n return options?.strict ? null : Boolean(value);\n}\n"],"names":[],"mappings":"MAAa,gBAAiB,GAAE,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC;MAChE,iBAAkB,GAAE,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC;;AAe7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,SAAS,CAAC,KAAK,EAAW,OAAO,EAAoC;AACrF,EAAE,MAAM,UAAW,GAAE,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE;;AAEhD,EAAE,IAAI,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACxC,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,IAAI,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACzC,IAAI,OAAO,IAAI;AACf;;AAEA,EAAE,OAAO,OAAO,EAAE,MAAO,GAAE,OAAO,OAAO,CAAC,KAAK,CAAC;AAChD;;;;"}
@@ -0,0 +1,40 @@
1
+ import { consoleSandbox, getClient, logger } from '@sentry/core';
2
+ import { DEBUG_BUILD } from '../debug-build.js';
3
+
4
+ const DEFAULT_SHUTDOWN_TIMEOUT = 2000;
5
+
6
+ /**
7
+ * @hidden
8
+ */
9
+ function logAndExitProcess(error) {
10
+ consoleSandbox(() => {
11
+ // eslint-disable-next-line no-console
12
+ console.error(error);
13
+ });
14
+
15
+ const client = getClient();
16
+
17
+ if (client === undefined) {
18
+ DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.');
19
+ global.process.exit(1);
20
+ return;
21
+ }
22
+
23
+ const options = client.getOptions();
24
+ const timeout =
25
+ options?.shutdownTimeout && options.shutdownTimeout > 0 ? options.shutdownTimeout : DEFAULT_SHUTDOWN_TIMEOUT;
26
+ client.close(timeout).then(
27
+ (result) => {
28
+ if (!result) {
29
+ DEBUG_BUILD && logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');
30
+ }
31
+ global.process.exit(1);
32
+ },
33
+ error => {
34
+ DEBUG_BUILD && logger.error(error);
35
+ },
36
+ );
37
+ }
38
+
39
+ export { logAndExitProcess };
40
+ //# sourceMappingURL=errorhandling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorhandling.js","sources":["../../../src/utils/errorhandling.ts"],"sourcesContent":["import { consoleSandbox, getClient, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { NodeClient } from '../sdk/client';\n\nconst DEFAULT_SHUTDOWN_TIMEOUT = 2000;\n\n/**\n * @hidden\n */\nexport function logAndExitProcess(error: unknown): void {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(error);\n });\n\n const client = getClient<NodeClient>();\n\n if (client === undefined) {\n DEBUG_BUILD && logger.warn('No NodeClient was defined, we are exiting the process now.');\n global.process.exit(1);\n return;\n }\n\n const options = client.getOptions();\n const timeout =\n options?.shutdownTimeout && options.shutdownTimeout > 0 ? options.shutdownTimeout : DEFAULT_SHUTDOWN_TIMEOUT;\n client.close(timeout).then(\n (result: boolean) => {\n if (!result) {\n DEBUG_BUILD && logger.warn('We reached the timeout for emptying the request buffer, still exiting now!');\n }\n global.process.exit(1);\n },\n error => {\n DEBUG_BUILD && logger.error(error);\n },\n );\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,wBAAA,GAA2B,IAAI;;AAErC;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,KAAK,EAAiB;AACxD,EAAE,cAAc,CAAC,MAAM;AACvB;AACA,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACxB,GAAG,CAAC;;AAEJ,EAAE,MAAM,MAAA,GAAS,SAAS,EAAc;;AAExC,EAAE,IAAI,MAAO,KAAI,SAAS,EAAE;AAC5B,IAAI,eAAe,MAAM,CAAC,IAAI,CAAC,4DAA4D,CAAC;AAC5F,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1B,IAAI;AACJ;;AAEA,EAAE,MAAM,OAAQ,GAAE,MAAM,CAAC,UAAU,EAAE;AACrC,EAAE,MAAM,OAAQ;AAChB,IAAI,OAAO,EAAE,eAAgB,IAAG,OAAO,CAAC,eAAA,GAAkB,CAAA,GAAI,OAAO,CAAC,eAAA,GAAkB,wBAAwB;AAChH,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI;AAC5B,IAAI,CAAC,MAAM,KAAc;AACzB,MAAM,IAAI,CAAC,MAAM,EAAE;AACnB,QAAQ,eAAe,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC;AAChH;AACA,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5B,KAAK;AACL,IAAI,SAAS;AACb,MAAM,eAAe,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;AACxC,KAAK;AACL,GAAG;AACH;;;;"}
@@ -0,0 +1,16 @@
1
+ /** Build a full URL from request options. */
2
+ function getRequestUrl(requestOptions) {
3
+ const protocol = requestOptions.protocol || '';
4
+ const hostname = requestOptions.hostname || requestOptions.host || '';
5
+ // Don't log standard :80 (http) and :443 (https) ports to reduce the noise
6
+ // Also don't add port if the hostname already includes a port
7
+ const port =
8
+ !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname)
9
+ ? ''
10
+ : `:${requestOptions.port}`;
11
+ const path = requestOptions.path ? requestOptions.path : '/';
12
+ return `${protocol}//${hostname}${port}${path}`;
13
+ }
14
+
15
+ export { getRequestUrl };
16
+ //# sourceMappingURL=getRequestUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRequestUrl.js","sources":["../../../src/utils/getRequestUrl.ts"],"sourcesContent":["import type { RequestOptions } from 'node:http';\n\n/** Build a full URL from request options. */\nexport function getRequestUrl(requestOptions: RequestOptions): string {\n const protocol = requestOptions.protocol || '';\n const hostname = requestOptions.hostname || requestOptions.host || '';\n // Don't log standard :80 (http) and :443 (https) ports to reduce the noise\n // Also don't add port if the hostname already includes a port\n const port =\n !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\\d+)$/.test(hostname)\n ? ''\n : `:${requestOptions.port}`;\n const path = requestOptions.path ? requestOptions.path : '/';\n return `${protocol}//${hostname}${port}${path}`;\n}\n"],"names":[],"mappings":"AAEA;AACO,SAAS,aAAa,CAAC,cAAc,EAA0B;AACtE,EAAE,MAAM,QAAS,GAAE,cAAc,CAAC,QAAA,IAAY,EAAE;AAChD,EAAE,MAAM,QAAS,GAAE,cAAc,CAAC,QAAS,IAAG,cAAc,CAAC,IAAK,IAAG,EAAE;AACvE;AACA;AACA,EAAE,MAAM,IAAK;AACb,IAAI,CAAC,cAAc,CAAC,IAAA,IAAQ,cAAc,CAAC,SAAS,EAAA,IAAM,cAAc,CAAC,SAAS,GAAA,IAAO,cAAc,CAAC,IAAI,CAAC,QAAQ;AACrH,QAAQ;AACR,QAAQ,CAAC,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA;AACA,EAAA,MAAA,IAAA,GAAA,cAAA,CAAA,IAAA,GAAA,cAAA,CAAA,IAAA,GAAA,GAAA;AACA,EAAA,OAAA,CAAA,EAAA,QAAA,CAAA,EAAA,EAAA,QAAA,CAAA,EAAA,IAAA,CAAA,EAAA,IAAA,CAAA,CAAA;AACA;;;;"}
@@ -0,0 +1,58 @@
1
+ import { posix, sep } from 'node:path';
2
+ import { dirname } from '@sentry/core';
3
+
4
+ /** normalizes Windows paths */
5
+ function normalizeWindowsPath(path) {
6
+ return path
7
+ .replace(/^[A-Z]:/, '') // remove Windows-style prefix
8
+ .replace(/\\/g, '/'); // replace all `\` instances with `/`
9
+ }
10
+
11
+ /** Creates a function that gets the module name from a filename */
12
+ function createGetModuleFromFilename(
13
+ basePath = process.argv[1] ? dirname(process.argv[1]) : process.cwd(),
14
+ isWindows = sep === '\\',
15
+ ) {
16
+ const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;
17
+
18
+ return (filename) => {
19
+ if (!filename) {
20
+ return;
21
+ }
22
+
23
+ const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;
24
+
25
+ // eslint-disable-next-line prefer-const
26
+ let { dir, base: file, ext } = posix.parse(normalizedFilename);
27
+
28
+ if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {
29
+ file = file.slice(0, ext.length * -1);
30
+ }
31
+
32
+ // The file name might be URI-encoded which we want to decode to
33
+ // the original file name.
34
+ const decodedFile = decodeURIComponent(file);
35
+
36
+ if (!dir) {
37
+ // No dirname whatsoever
38
+ dir = '.';
39
+ }
40
+
41
+ const n = dir.lastIndexOf('/node_modules');
42
+ if (n > -1) {
43
+ return `${dir.slice(n + 14).replace(/\//g, '.')}:${decodedFile}`;
44
+ }
45
+
46
+ // Let's see if it's a part of the main module
47
+ // To be a part of main module, it has to share the same base
48
+ if (dir.startsWith(normalizedBase)) {
49
+ const moduleName = dir.slice(normalizedBase.length + 1).replace(/\//g, '.');
50
+ return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;
51
+ }
52
+
53
+ return decodedFile;
54
+ };
55
+ }
56
+
57
+ export { createGetModuleFromFilename };
58
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sources":["../../../src/utils/module.ts"],"sourcesContent":["import { posix, sep } from 'node:path';\nimport { dirname } from '@sentry/core';\n\n/** normalizes Windows paths */\nfunction normalizeWindowsPath(path: string): string {\n return path\n .replace(/^[A-Z]:/, '') // remove Windows-style prefix\n .replace(/\\\\/g, '/'); // replace all `\\` instances with `/`\n}\n\n/** Creates a function that gets the module name from a filename */\nexport function createGetModuleFromFilename(\n basePath: string = process.argv[1] ? dirname(process.argv[1]) : process.cwd(),\n isWindows: boolean = sep === '\\\\',\n): (filename: string | undefined) => string | undefined {\n const normalizedBase = isWindows ? normalizeWindowsPath(basePath) : basePath;\n\n return (filename: string | undefined) => {\n if (!filename) {\n return;\n }\n\n const normalizedFilename = isWindows ? normalizeWindowsPath(filename) : filename;\n\n // eslint-disable-next-line prefer-const\n let { dir, base: file, ext } = posix.parse(normalizedFilename);\n\n if (ext === '.js' || ext === '.mjs' || ext === '.cjs') {\n file = file.slice(0, ext.length * -1);\n }\n\n // The file name might be URI-encoded which we want to decode to\n // the original file name.\n const decodedFile = decodeURIComponent(file);\n\n if (!dir) {\n // No dirname whatsoever\n dir = '.';\n }\n\n const n = dir.lastIndexOf('/node_modules');\n if (n > -1) {\n return `${dir.slice(n + 14).replace(/\\//g, '.')}:${decodedFile}`;\n }\n\n // Let's see if it's a part of the main module\n // To be a part of main module, it has to share the same base\n if (dir.startsWith(normalizedBase)) {\n const moduleName = dir.slice(normalizedBase.length + 1).replace(/\\//g, '.');\n return moduleName ? `${moduleName}:${decodedFile}` : decodedFile;\n }\n\n return decodedFile;\n };\n}\n"],"names":[],"mappings":";;;AAGA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAAkB;AACpD,EAAE,OAAO;AACT,KAAK,OAAO,CAAC,SAAS,EAAE,EAAE,CAAA;AAC1B,KAAK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACxB;;AAEA;AACO,SAAS,2BAA2B;AAC3C,EAAE,QAAQ,GAAW,OAAO,CAAC,IAAI,CAAC,CAAC,CAAE,GAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA,GAAI,OAAO,CAAC,GAAG,EAAE;AAC/E,EAAE,SAAS,GAAY,GAAA,KAAQ,IAAI;AACnC,EAAwD;AACxD,EAAE,MAAM,cAAe,GAAE,SAAU,GAAE,oBAAoB,CAAC,QAAQ,CAAE,GAAE,QAAQ;;AAE9E,EAAE,OAAO,CAAC,QAAQ,KAAyB;AAC3C,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,MAAM;AACN;;AAEA,IAAI,MAAM,kBAAmB,GAAE,SAAU,GAAE,oBAAoB,CAAC,QAAQ,CAAE,GAAE,QAAQ;;AAEpF;AACA,IAAI,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAI,EAAA,GAAI,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC;;AAElE,IAAI,IAAI,GAAI,KAAI,KAAM,IAAG,GAAI,KAAI,MAAO,IAAG,GAAI,KAAI,MAAM,EAAE;AAC3D,MAAM,IAAK,GAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAA,GAAS,EAAE,CAAC;AAC3C;;AAEA;AACA;AACA,IAAI,MAAM,WAAY,GAAE,kBAAkB,CAAC,IAAI,CAAC;;AAEhD,IAAI,IAAI,CAAC,GAAG,EAAE;AACd;AACA,MAAM,GAAA,GAAM,GAAG;AACf;;AAEA,IAAI,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC;AAC9C,IAAI,IAAI,CAAA,GAAI,EAAE,EAAE;AAChB,MAAM,OAAO,CAAC,EAAA,GAAA,CAAA,KAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,OAAA,CAAA,KAAA,EAAA,GAAA,CAAA,CAAA,CAAA,EAAA,WAAA,CAAA,CAAA;AACA;;AAEA;AACA;AACA,IAAA,IAAA,GAAA,CAAA,UAAA,CAAA,cAAA,CAAA,EAAA;AACA,MAAA,MAAA,UAAA,GAAA,GAAA,CAAA,KAAA,CAAA,cAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,OAAA,CAAA,KAAA,EAAA,GAAA,CAAA;AACA,MAAA,OAAA,UAAA,GAAA,CAAA,EAAA,UAAA,CAAA,CAAA,EAAA,WAAA,CAAA,CAAA,GAAA,WAAA;AACA;;AAEA,IAAA,OAAA,WAAA;AACA,GAAA;AACA;;;;"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Replaces names in cron expressions
3
+ */
4
+ export declare function replaceCronNames(cronExpression: string): string;
5
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/cron/common.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAM/D"}
@@ -0,0 +1,43 @@
1
+ export type CronJobParams = {
2
+ cronTime: string | Date;
3
+ onTick: (context: unknown, onComplete?: unknown) => void | Promise<void>;
4
+ onComplete?: () => void | Promise<void>;
5
+ start?: boolean | null;
6
+ context?: unknown;
7
+ runOnInit?: boolean | null;
8
+ unrefTimeout?: boolean | null;
9
+ } & ({
10
+ timeZone?: string | null;
11
+ utcOffset?: never;
12
+ } | {
13
+ timeZone?: never;
14
+ utcOffset?: number | null;
15
+ });
16
+ export type CronJob = {};
17
+ export type CronJobConstructor = {
18
+ from: (param: CronJobParams) => CronJob;
19
+ new (cronTime: CronJobParams['cronTime'], onTick: CronJobParams['onTick'], onComplete?: CronJobParams['onComplete'], start?: CronJobParams['start'], timeZone?: CronJobParams['timeZone'], context?: CronJobParams['context'], runOnInit?: CronJobParams['runOnInit'], utcOffset?: null, unrefTimeout?: CronJobParams['unrefTimeout']): CronJob;
20
+ new (cronTime: CronJobParams['cronTime'], onTick: CronJobParams['onTick'], onComplete?: CronJobParams['onComplete'], start?: CronJobParams['start'], timeZone?: null, context?: CronJobParams['context'], runOnInit?: CronJobParams['runOnInit'], utcOffset?: CronJobParams['utcOffset'], unrefTimeout?: CronJobParams['unrefTimeout']): CronJob;
21
+ };
22
+ /**
23
+ * Instruments the `cron` library to send a check-in event to Sentry for each job execution.
24
+ *
25
+ * ```ts
26
+ * import * as Sentry from '@sentry/node';
27
+ * import { CronJob } from 'cron';
28
+ *
29
+ * const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, 'my-cron-job');
30
+ *
31
+ * // use the constructor
32
+ * const job = new CronJobWithCheckIn('* * * * *', () => {
33
+ * console.log('You will see this message every minute');
34
+ * });
35
+ *
36
+ * // or from
37
+ * const job = CronJobWithCheckIn.from({ cronTime: '* * * * *', onTick: () => {
38
+ * console.log('You will see this message every minute');
39
+ * });
40
+ * ```
41
+ */
42
+ export declare function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: string): T;
43
+ //# sourceMappingURL=cron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../../../src/cron/cron.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,UAAU,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B,GAAG,CACA;IACE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CACJ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,EAErB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC;IAExC,KACE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,EACnC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC/B,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,EACxC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,EACpC,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,EAClC,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,EACtC,SAAS,CAAC,EAAE,IAAI,EAChB,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,GAC3C,OAAO,CAAC;IACX,KACE,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,EACnC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAC/B,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,EACxC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,IAAI,EACf,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,EAClC,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,EACtC,SAAS,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,EACtC,YAAY,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,GAC3C,OAAO,CAAC;CACZ,CAAC;AAIF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,kBAAkB,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAiFrF"}
@@ -0,0 +1,10 @@
1
+ import { instrumentCron } from './cron';
2
+ import { instrumentNodeCron } from './node-cron';
3
+ import { instrumentNodeSchedule } from './node-schedule';
4
+ /** Methods to instrument cron libraries for Sentry check-ins */
5
+ export declare const cron: {
6
+ instrumentCron: typeof instrumentCron;
7
+ instrumentNodeCron: typeof instrumentNodeCron;
8
+ instrumentNodeSchedule: typeof instrumentNodeSchedule;
9
+ };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cron/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,gEAAgE;AAChE,eAAO,MAAM,IAAI;;;;CAIhB,CAAC"}
@@ -0,0 +1,27 @@
1
+ export interface NodeCronOptions {
2
+ name: string;
3
+ timezone?: string;
4
+ }
5
+ export interface NodeCron {
6
+ schedule: (cronExpression: string, callback: () => void, options: NodeCronOptions | undefined) => unknown;
7
+ }
8
+ /**
9
+ * Wraps the `node-cron` library with check-in monitoring.
10
+ *
11
+ * ```ts
12
+ * import * as Sentry from "@sentry/node";
13
+ * import * as cron from "node-cron";
14
+ *
15
+ * const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron);
16
+ *
17
+ * cronWithCheckIn.schedule(
18
+ * "* * * * *",
19
+ * () => {
20
+ * console.log("running a task every minute");
21
+ * },
22
+ * { name: "my-cron-job" },
23
+ * );
24
+ * ```
25
+ */
26
+ export declare function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T;
27
+ //# sourceMappingURL=node-cron.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-cron.d.ts","sourceRoot":"","sources":["../../../src/cron/node-cron.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,eAAe,GAAG,SAAS,KAAK,OAAO,CAAC;CAC3G;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CA4CnE"}