apitally 0.25.8 → 1.0.0-beta.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 (555) hide show
  1. package/README.md +228 -178
  2. package/dist/activation.cjs +393 -0
  3. package/dist/activation.cjs.map +1 -0
  4. package/dist/activation.d.cts +42 -0
  5. package/dist/activation.d.ts +42 -0
  6. package/dist/activation.js +383 -0
  7. package/dist/activation.js.map +1 -0
  8. package/dist/adonisjs/configure.cjs +86 -30
  9. package/dist/adonisjs/configure.cjs.map +1 -1
  10. package/dist/adonisjs/configure.d.cts +0 -4
  11. package/dist/adonisjs/configure.d.ts +0 -4
  12. package/dist/adonisjs/configure.js +83 -29
  13. package/dist/adonisjs/configure.js.map +1 -1
  14. package/dist/adonisjs/index.cjs +38 -21
  15. package/dist/adonisjs/index.cjs.map +1 -1
  16. package/dist/adonisjs/index.d.cts +5 -14
  17. package/dist/adonisjs/index.d.ts +5 -14
  18. package/dist/adonisjs/index.js +39 -18
  19. package/dist/adonisjs/index.js.map +1 -1
  20. package/dist/adonisjs/middleware.cjs +43 -109
  21. package/dist/adonisjs/middleware.cjs.map +1 -1
  22. package/dist/adonisjs/middleware.d.cts +1 -16
  23. package/dist/adonisjs/middleware.d.ts +1 -16
  24. package/dist/adonisjs/middleware.js +43 -110
  25. package/dist/adonisjs/middleware.js.map +1 -1
  26. package/dist/adonisjs/provider.cjs +19 -87
  27. package/dist/adonisjs/provider.cjs.map +1 -1
  28. package/dist/adonisjs/provider.d.cts +0 -22
  29. package/dist/adonisjs/provider.d.ts +0 -22
  30. package/dist/adonisjs/provider.js +19 -88
  31. package/dist/adonisjs/provider.js.map +1 -1
  32. package/dist/adonisjs/stubs/config/apitally.stub +11 -15
  33. package/dist/bodyCapture.cjs +128 -0
  34. package/dist/bodyCapture.cjs.map +1 -0
  35. package/dist/bodyCapture.d.cts +31 -0
  36. package/dist/bodyCapture.d.ts +31 -0
  37. package/dist/bodyCapture.js +101 -0
  38. package/dist/bodyCapture.js.map +1 -0
  39. package/dist/config.cjs +227 -0
  40. package/dist/config.cjs.map +1 -0
  41. package/dist/config.d.cts +45 -0
  42. package/dist/config.d.ts +45 -0
  43. package/dist/config.js +192 -0
  44. package/dist/config.js.map +1 -0
  45. package/dist/consumer.cjs +98 -0
  46. package/dist/consumer.cjs.map +1 -0
  47. package/dist/consumer.d.cts +15 -0
  48. package/dist/consumer.d.ts +15 -0
  49. package/dist/consumer.js +78 -0
  50. package/dist/consumer.js.map +1 -0
  51. package/dist/context.cjs +68 -0
  52. package/dist/context.cjs.map +1 -0
  53. package/dist/context.d.cts +33 -0
  54. package/dist/context.d.ts +33 -0
  55. package/dist/context.js +40 -0
  56. package/dist/context.js.map +1 -0
  57. package/dist/elysia/index.cjs +12 -3
  58. package/dist/elysia/index.cjs.map +1 -1
  59. package/dist/elysia/index.d.cts +8 -16
  60. package/dist/elysia/index.d.ts +8 -16
  61. package/dist/elysia/index.js +10 -2
  62. package/dist/elysia/index.js.map +1 -1
  63. package/dist/elysia/middleware.cjs +261 -0
  64. package/dist/elysia/middleware.cjs.map +1 -0
  65. package/dist/elysia/middleware.d.cts +14 -0
  66. package/dist/elysia/middleware.d.ts +14 -0
  67. package/dist/elysia/middleware.js +250 -0
  68. package/dist/elysia/middleware.js.map +1 -0
  69. package/dist/{otel/index.cjs → elysia/routes.cjs} +16 -7
  70. package/dist/elysia/routes.cjs.map +1 -0
  71. package/dist/elysia/routes.d.cts +7 -0
  72. package/dist/elysia/routes.d.ts +7 -0
  73. package/dist/elysia/routes.js +14 -0
  74. package/dist/elysia/routes.js.map +1 -0
  75. package/dist/exceptions.cjs +81 -0
  76. package/dist/exceptions.cjs.map +1 -0
  77. package/dist/exceptions.d.cts +7 -0
  78. package/dist/exceptions.d.ts +7 -0
  79. package/dist/exceptions.js +55 -0
  80. package/dist/exceptions.js.map +1 -0
  81. package/dist/exportSerialization.cjs +56 -0
  82. package/dist/exportSerialization.cjs.map +1 -0
  83. package/dist/exportSerialization.d.cts +7 -0
  84. package/dist/exportSerialization.d.ts +7 -0
  85. package/dist/exportSerialization.js +32 -0
  86. package/dist/exportSerialization.js.map +1 -0
  87. package/dist/exportWorker.cjs +305 -0
  88. package/dist/exportWorker.cjs.map +1 -0
  89. package/dist/exportWorker.d.cts +46 -0
  90. package/dist/exportWorker.d.ts +46 -0
  91. package/dist/exportWorker.js +279 -0
  92. package/dist/exportWorker.js.map +1 -0
  93. package/dist/express/index.cjs +9 -4
  94. package/dist/express/index.cjs.map +1 -1
  95. package/dist/express/index.d.cts +7 -10
  96. package/dist/express/index.d.ts +7 -10
  97. package/dist/express/index.js +8 -2
  98. package/dist/express/index.js.map +1 -1
  99. package/dist/express/install.cjs +45 -0
  100. package/dist/express/install.cjs.map +1 -0
  101. package/dist/express/install.d.cts +10 -0
  102. package/dist/express/install.d.ts +10 -0
  103. package/dist/express/install.js +21 -0
  104. package/dist/express/install.js.map +1 -0
  105. package/dist/express/middleware.cjs +87 -331
  106. package/dist/express/middleware.cjs.map +1 -1
  107. package/dist/express/middleware.d.cts +3 -21
  108. package/dist/express/middleware.d.ts +3 -21
  109. package/dist/express/middleware.js +91 -327
  110. package/dist/express/middleware.js.map +1 -1
  111. package/dist/express/register.cjs +20 -0
  112. package/dist/express/register.cjs.map +1 -0
  113. package/dist/express/register.d.cts +2 -0
  114. package/dist/express/register.d.ts +2 -0
  115. package/dist/express/register.js +19 -0
  116. package/dist/express/register.js.map +1 -0
  117. package/dist/express/routes.cjs +429 -0
  118. package/dist/express/routes.cjs.map +1 -0
  119. package/dist/express/routes.d.cts +14 -0
  120. package/dist/express/routes.d.ts +14 -0
  121. package/dist/express/routes.js +401 -0
  122. package/dist/express/routes.js.map +1 -0
  123. package/dist/fastify/index.cjs +10 -5
  124. package/dist/fastify/index.cjs.map +1 -1
  125. package/dist/fastify/index.d.cts +7 -11
  126. package/dist/fastify/index.d.ts +7 -11
  127. package/dist/fastify/index.js +9 -3
  128. package/dist/fastify/index.js.map +1 -1
  129. package/dist/{loggers/index.cjs → fastify/install.cjs} +17 -19
  130. package/dist/fastify/install.cjs.map +1 -0
  131. package/dist/fastify/install.d.cts +10 -0
  132. package/dist/fastify/install.d.ts +10 -0
  133. package/dist/fastify/install.js +15 -0
  134. package/dist/fastify/install.js.map +1 -0
  135. package/dist/fastify/middleware.cjs +135 -0
  136. package/dist/fastify/middleware.cjs.map +1 -0
  137. package/dist/fastify/middleware.d.cts +7 -0
  138. package/dist/fastify/middleware.d.ts +7 -0
  139. package/dist/fastify/middleware.js +114 -0
  140. package/dist/fastify/middleware.js.map +1 -0
  141. package/dist/{common/paramValidation.cjs → fastify/routes.cjs} +15 -17
  142. package/dist/fastify/routes.cjs.map +1 -0
  143. package/dist/fastify/routes.d.cts +8 -0
  144. package/dist/fastify/routes.d.ts +8 -0
  145. package/dist/fastify/routes.js +14 -0
  146. package/dist/fastify/routes.js.map +1 -0
  147. package/dist/h3/index.cjs +28 -4
  148. package/dist/h3/index.cjs.map +1 -1
  149. package/dist/h3/index.d.cts +8 -10
  150. package/dist/h3/index.d.ts +8 -10
  151. package/dist/h3/index.js +26 -2
  152. package/dist/h3/index.js.map +1 -1
  153. package/dist/h3/middleware.cjs +210 -0
  154. package/dist/h3/middleware.cjs.map +1 -0
  155. package/dist/h3/middleware.d.cts +5 -0
  156. package/dist/h3/middleware.d.ts +5 -0
  157. package/dist/h3/middleware.js +194 -0
  158. package/dist/h3/middleware.js.map +1 -0
  159. package/dist/h3/routes.cjs +66 -0
  160. package/dist/h3/routes.cjs.map +1 -0
  161. package/dist/h3/routes.d.cts +8 -0
  162. package/dist/h3/routes.d.ts +8 -0
  163. package/dist/h3/routes.js +41 -0
  164. package/dist/h3/routes.js.map +1 -0
  165. package/dist/hapi/index.cjs +15 -4
  166. package/dist/hapi/index.cjs.map +1 -1
  167. package/dist/hapi/index.d.cts +8 -10
  168. package/dist/hapi/index.d.ts +8 -10
  169. package/dist/hapi/index.js +13 -2
  170. package/dist/hapi/index.js.map +1 -1
  171. package/dist/{loggers/hapi.cjs → hapi/install.cjs} +20 -26
  172. package/dist/hapi/install.cjs.map +1 -0
  173. package/dist/hapi/install.d.cts +8 -0
  174. package/dist/hapi/install.d.ts +8 -0
  175. package/dist/hapi/install.js +22 -0
  176. package/dist/hapi/install.js.map +1 -0
  177. package/dist/hapi/middleware.cjs +158 -0
  178. package/dist/hapi/middleware.cjs.map +1 -0
  179. package/dist/hapi/middleware.d.cts +5 -0
  180. package/dist/hapi/middleware.d.ts +5 -0
  181. package/dist/hapi/middleware.js +137 -0
  182. package/dist/hapi/middleware.js.map +1 -0
  183. package/dist/{common/logging.cjs → hapi/routes.cjs} +14 -17
  184. package/dist/hapi/routes.cjs.map +1 -0
  185. package/dist/hapi/routes.d.cts +8 -0
  186. package/dist/hapi/routes.d.ts +8 -0
  187. package/dist/hapi/routes.js +12 -0
  188. package/dist/hapi/routes.js.map +1 -0
  189. package/dist/hono/index.cjs +13 -3
  190. package/dist/hono/index.cjs.map +1 -1
  191. package/dist/hono/index.d.cts +7 -10
  192. package/dist/hono/index.d.ts +7 -10
  193. package/dist/hono/index.js +13 -2
  194. package/dist/hono/index.js.map +1 -1
  195. package/dist/hono/middleware.cjs +219 -127
  196. package/dist/hono/middleware.cjs.map +1 -1
  197. package/dist/hono/middleware.d.cts +3 -18
  198. package/dist/hono/middleware.d.ts +3 -18
  199. package/dist/hono/middleware.js +229 -126
  200. package/dist/hono/middleware.js.map +1 -1
  201. package/dist/hono/routes.cjs +74 -0
  202. package/dist/hono/routes.cjs.map +1 -0
  203. package/dist/hono/routes.d.cts +8 -0
  204. package/dist/hono/routes.d.ts +8 -0
  205. package/dist/hono/routes.js +49 -0
  206. package/dist/hono/routes.js.map +1 -0
  207. package/dist/index.cjs +108 -0
  208. package/dist/index.cjs.map +1 -1
  209. package/dist/index.d.cts +29 -1
  210. package/dist/index.d.ts +29 -1
  211. package/dist/index.js +77 -0
  212. package/dist/index.js.map +1 -1
  213. package/dist/koa/index.cjs +13 -3
  214. package/dist/koa/index.cjs.map +1 -1
  215. package/dist/koa/index.d.cts +7 -10
  216. package/dist/koa/index.d.ts +7 -10
  217. package/dist/koa/index.js +13 -2
  218. package/dist/koa/index.js.map +1 -1
  219. package/dist/koa/middleware.cjs +85 -184
  220. package/dist/koa/middleware.cjs.map +1 -1
  221. package/dist/koa/middleware.d.cts +3 -13
  222. package/dist/koa/middleware.d.ts +3 -13
  223. package/dist/koa/middleware.js +88 -183
  224. package/dist/koa/middleware.js.map +1 -1
  225. package/dist/koa/routes.cjs +71 -0
  226. package/dist/koa/routes.cjs.map +1 -0
  227. package/dist/koa/routes.d.cts +8 -0
  228. package/dist/koa/routes.d.ts +8 -0
  229. package/dist/koa/routes.js +46 -0
  230. package/dist/koa/routes.js.map +1 -0
  231. package/dist/logCapture.cjs +417 -0
  232. package/dist/logCapture.cjs.map +1 -0
  233. package/dist/logCapture.d.cts +18 -0
  234. package/dist/logCapture.d.ts +18 -0
  235. package/dist/logCapture.js +390 -0
  236. package/dist/logCapture.js.map +1 -0
  237. package/dist/logRecordExporter.cjs +51 -0
  238. package/dist/logRecordExporter.cjs.map +1 -0
  239. package/dist/logRecordExporter.d.cts +14 -0
  240. package/dist/logRecordExporter.d.ts +14 -0
  241. package/dist/logRecordExporter.js +27 -0
  242. package/dist/logRecordExporter.js.map +1 -0
  243. package/dist/logRecordProcessor.cjs +137 -0
  244. package/dist/logRecordProcessor.cjs.map +1 -0
  245. package/dist/logRecordProcessor.d.cts +27 -0
  246. package/dist/logRecordProcessor.d.ts +27 -0
  247. package/dist/logRecordProcessor.js +113 -0
  248. package/dist/logRecordProcessor.js.map +1 -0
  249. package/dist/logger.cjs +62 -0
  250. package/dist/logger.cjs.map +1 -0
  251. package/dist/logger.d.cts +7 -0
  252. package/dist/logger.d.ts +7 -0
  253. package/dist/logger.js +34 -0
  254. package/dist/logger.js.map +1 -0
  255. package/dist/metrics.cjs +171 -0
  256. package/dist/metrics.cjs.map +1 -0
  257. package/dist/metrics.d.cts +26 -0
  258. package/dist/metrics.d.ts +26 -0
  259. package/dist/metrics.js +153 -0
  260. package/dist/metrics.js.map +1 -0
  261. package/dist/nestjs/index.cjs +81 -71
  262. package/dist/nestjs/index.cjs.map +1 -1
  263. package/dist/nestjs/index.d.cts +4 -11
  264. package/dist/nestjs/index.d.ts +4 -11
  265. package/dist/nestjs/index.js +81 -61
  266. package/dist/nestjs/index.js.map +1 -1
  267. package/dist/packageVersion.cjs +67 -0
  268. package/dist/packageVersion.cjs.map +1 -0
  269. package/dist/packageVersion.d.cts +5 -0
  270. package/dist/packageVersion.d.ts +5 -0
  271. package/dist/packageVersion.js +39 -0
  272. package/dist/packageVersion.js.map +1 -0
  273. package/dist/providers.cjs +149 -0
  274. package/dist/providers.cjs.map +1 -0
  275. package/dist/providers.d.cts +15 -0
  276. package/dist/providers.d.ts +15 -0
  277. package/dist/providers.js +136 -0
  278. package/dist/providers.js.map +1 -0
  279. package/dist/redaction.cjs +116 -0
  280. package/dist/redaction.cjs.map +1 -0
  281. package/dist/redaction.d.cts +17 -0
  282. package/dist/redaction.d.ts +17 -0
  283. package/dist/redaction.js +98 -0
  284. package/dist/redaction.js.map +1 -0
  285. package/dist/{common/packageVersions.cjs → requestAttributes.cjs} +21 -19
  286. package/dist/requestAttributes.cjs.map +1 -0
  287. package/dist/requestAttributes.d.cts +10 -0
  288. package/dist/requestAttributes.d.ts +10 -0
  289. package/dist/requestAttributes.js +22 -0
  290. package/dist/requestAttributes.js.map +1 -0
  291. package/dist/requestObservation.cjs +246 -0
  292. package/dist/requestObservation.cjs.map +1 -0
  293. package/dist/requestObservation.d.cts +62 -0
  294. package/dist/requestObservation.d.ts +62 -0
  295. package/dist/requestObservation.js +226 -0
  296. package/dist/requestObservation.js.map +1 -0
  297. package/dist/requestObservationNode.cjs +193 -0
  298. package/dist/requestObservationNode.cjs.map +1 -0
  299. package/dist/requestObservationNode.d.cts +31 -0
  300. package/dist/requestObservationNode.d.ts +31 -0
  301. package/dist/requestObservationNode.js +170 -0
  302. package/dist/requestObservationNode.js.map +1 -0
  303. package/dist/requestObservationWeb.cjs +202 -0
  304. package/dist/requestObservationWeb.cjs.map +1 -0
  305. package/dist/requestObservationWeb.d.cts +34 -0
  306. package/dist/requestObservationWeb.d.ts +34 -0
  307. package/dist/requestObservationWeb.js +182 -0
  308. package/dist/requestObservationWeb.js.map +1 -0
  309. package/dist/sentry.cjs +103 -0
  310. package/dist/sentry.cjs.map +1 -0
  311. package/dist/sentry.d.cts +3 -0
  312. package/dist/sentry.d.ts +3 -0
  313. package/dist/sentry.js +79 -0
  314. package/dist/sentry.js.map +1 -0
  315. package/dist/serverErrors.cjs +118 -0
  316. package/dist/serverErrors.cjs.map +1 -0
  317. package/dist/serverErrors.d.cts +8 -0
  318. package/dist/serverErrors.d.ts +8 -0
  319. package/dist/serverErrors.js +91 -0
  320. package/dist/serverErrors.js.map +1 -0
  321. package/dist/spanExporter.cjs +217 -0
  322. package/dist/spanExporter.cjs.map +1 -0
  323. package/dist/spanExporter.d.cts +34 -0
  324. package/dist/spanExporter.d.ts +34 -0
  325. package/dist/spanExporter.js +193 -0
  326. package/dist/spanExporter.js.map +1 -0
  327. package/dist/spanProcessor.cjs +535 -0
  328. package/dist/spanProcessor.cjs.map +1 -0
  329. package/dist/spanProcessor.d.cts +70 -0
  330. package/dist/spanProcessor.d.ts +70 -0
  331. package/dist/spanProcessor.js +513 -0
  332. package/dist/spanProcessor.js.map +1 -0
  333. package/dist/spool.cjs +314 -0
  334. package/dist/spool.cjs.map +1 -0
  335. package/dist/spool.d.cts +49 -0
  336. package/dist/spool.d.ts +49 -0
  337. package/dist/spool.js +297 -0
  338. package/dist/spool.js.map +1 -0
  339. package/dist/startup.cjs +98 -0
  340. package/dist/startup.cjs.map +1 -0
  341. package/dist/startup.d.cts +15 -0
  342. package/dist/startup.d.ts +15 -0
  343. package/dist/startup.js +73 -0
  344. package/dist/startup.js.map +1 -0
  345. package/dist/tracing.cjs +116 -0
  346. package/dist/tracing.cjs.map +1 -0
  347. package/dist/tracing.d.cts +5 -0
  348. package/dist/tracing.d.ts +5 -0
  349. package/dist/tracing.js +96 -0
  350. package/dist/tracing.js.map +1 -0
  351. package/dist/validationErrors.cjs +229 -0
  352. package/dist/validationErrors.cjs.map +1 -0
  353. package/dist/validationErrors.d.cts +21 -0
  354. package/dist/validationErrors.d.ts +21 -0
  355. package/dist/validationErrors.js +195 -0
  356. package/dist/validationErrors.js.map +1 -0
  357. package/package.json +113 -154
  358. package/dist/common/client.cjs +0 -335
  359. package/dist/common/client.cjs.map +0 -1
  360. package/dist/common/client.d.cts +0 -50
  361. package/dist/common/client.d.ts +0 -50
  362. package/dist/common/client.js +0 -302
  363. package/dist/common/client.js.map +0 -1
  364. package/dist/common/consumerRegistry.cjs +0 -86
  365. package/dist/common/consumerRegistry.cjs.map +0 -1
  366. package/dist/common/consumerRegistry.d.cts +0 -20
  367. package/dist/common/consumerRegistry.d.ts +0 -20
  368. package/dist/common/consumerRegistry.js +0 -62
  369. package/dist/common/consumerRegistry.js.map +0 -1
  370. package/dist/common/headers.cjs +0 -55
  371. package/dist/common/headers.cjs.map +0 -1
  372. package/dist/common/headers.d.cts +0 -6
  373. package/dist/common/headers.d.ts +0 -6
  374. package/dist/common/headers.js +0 -31
  375. package/dist/common/headers.js.map +0 -1
  376. package/dist/common/instance.cjs +0 -158
  377. package/dist/common/instance.cjs.map +0 -1
  378. package/dist/common/instance.d.cts +0 -4
  379. package/dist/common/instance.d.ts +0 -4
  380. package/dist/common/instance.js +0 -134
  381. package/dist/common/instance.js.map +0 -1
  382. package/dist/common/logging.cjs.map +0 -1
  383. package/dist/common/logging.d.cts +0 -11
  384. package/dist/common/logging.d.ts +0 -11
  385. package/dist/common/logging.js +0 -17
  386. package/dist/common/logging.js.map +0 -1
  387. package/dist/common/packageVersions.cjs.map +0 -1
  388. package/dist/common/packageVersions.d.cts +0 -3
  389. package/dist/common/packageVersions.d.ts +0 -3
  390. package/dist/common/packageVersions.js +0 -21
  391. package/dist/common/packageVersions.js.map +0 -1
  392. package/dist/common/paramValidation.cjs.map +0 -1
  393. package/dist/common/paramValidation.d.cts +0 -4
  394. package/dist/common/paramValidation.d.ts +0 -4
  395. package/dist/common/paramValidation.js +0 -17
  396. package/dist/common/paramValidation.js.map +0 -1
  397. package/dist/common/requestCounter.cjs +0 -114
  398. package/dist/common/requestCounter.cjs.map +0 -1
  399. package/dist/common/requestCounter.d.cts +0 -24
  400. package/dist/common/requestCounter.d.ts +0 -24
  401. package/dist/common/requestCounter.js +0 -91
  402. package/dist/common/requestCounter.js.map +0 -1
  403. package/dist/common/requestLogger.cjs +0 -543
  404. package/dist/common/requestLogger.cjs.map +0 -1
  405. package/dist/common/requestLogger.d.cts +0 -85
  406. package/dist/common/requestLogger.d.ts +0 -85
  407. package/dist/common/requestLogger.js +0 -508
  408. package/dist/common/requestLogger.js.map +0 -1
  409. package/dist/common/resources.cjs +0 -49
  410. package/dist/common/resources.cjs.map +0 -1
  411. package/dist/common/resources.d.cts +0 -6
  412. package/dist/common/resources.d.ts +0 -6
  413. package/dist/common/resources.js +0 -26
  414. package/dist/common/resources.js.map +0 -1
  415. package/dist/common/response.cjs +0 -104
  416. package/dist/common/response.cjs.map +0 -1
  417. package/dist/common/response.d.cts +0 -15
  418. package/dist/common/response.d.ts +0 -15
  419. package/dist/common/response.js +0 -80
  420. package/dist/common/response.js.map +0 -1
  421. package/dist/common/sentry.cjs +0 -56
  422. package/dist/common/sentry.cjs.map +0 -1
  423. package/dist/common/sentry.d.cts +0 -6
  424. package/dist/common/sentry.d.ts +0 -6
  425. package/dist/common/sentry.js +0 -23
  426. package/dist/common/sentry.js.map +0 -1
  427. package/dist/common/serverErrorCounter.cjs +0 -123
  428. package/dist/common/serverErrorCounter.cjs.map +0 -1
  429. package/dist/common/serverErrorCounter.d.cts +0 -23
  430. package/dist/common/serverErrorCounter.d.ts +0 -23
  431. package/dist/common/serverErrorCounter.js +0 -98
  432. package/dist/common/serverErrorCounter.js.map +0 -1
  433. package/dist/common/spanCollector.cjs +0 -201
  434. package/dist/common/spanCollector.cjs.map +0 -1
  435. package/dist/common/spanCollector.d.cts +0 -45
  436. package/dist/common/spanCollector.d.ts +0 -45
  437. package/dist/common/spanCollector.js +0 -177
  438. package/dist/common/spanCollector.js.map +0 -1
  439. package/dist/common/tempGzipFile.cjs +0 -127
  440. package/dist/common/tempGzipFile.cjs.map +0 -1
  441. package/dist/common/tempGzipFile.d.cts +0 -19
  442. package/dist/common/tempGzipFile.d.ts +0 -19
  443. package/dist/common/tempGzipFile.js +0 -103
  444. package/dist/common/tempGzipFile.js.map +0 -1
  445. package/dist/common/types.cjs +0 -17
  446. package/dist/common/types.cjs.map +0 -1
  447. package/dist/common/types.d.cts +0 -95
  448. package/dist/common/types.d.ts +0 -95
  449. package/dist/common/types.js +0 -1
  450. package/dist/common/types.js.map +0 -1
  451. package/dist/common/validationErrorCounter.cjs +0 -79
  452. package/dist/common/validationErrorCounter.cjs.map +0 -1
  453. package/dist/common/validationErrorCounter.d.cts +0 -20
  454. package/dist/common/validationErrorCounter.d.ts +0 -20
  455. package/dist/common/validationErrorCounter.js +0 -56
  456. package/dist/common/validationErrorCounter.js.map +0 -1
  457. package/dist/elysia/plugin.cjs +0 -242
  458. package/dist/elysia/plugin.cjs.map +0 -1
  459. package/dist/elysia/plugin.d.cts +0 -70
  460. package/dist/elysia/plugin.d.ts +0 -70
  461. package/dist/elysia/plugin.js +0 -219
  462. package/dist/elysia/plugin.js.map +0 -1
  463. package/dist/elysia/utils.cjs +0 -77
  464. package/dist/elysia/utils.cjs.map +0 -1
  465. package/dist/elysia/utils.d.cts +0 -14
  466. package/dist/elysia/utils.d.ts +0 -14
  467. package/dist/elysia/utils.js +0 -54
  468. package/dist/elysia/utils.js.map +0 -1
  469. package/dist/express/utils.cjs +0 -217
  470. package/dist/express/utils.cjs.map +0 -1
  471. package/dist/express/utils.d.cts +0 -37
  472. package/dist/express/utils.d.ts +0 -37
  473. package/dist/express/utils.js +0 -189
  474. package/dist/express/utils.js.map +0 -1
  475. package/dist/fastify/plugin.cjs +0 -319
  476. package/dist/fastify/plugin.cjs.map +0 -1
  477. package/dist/fastify/plugin.d.cts +0 -34
  478. package/dist/fastify/plugin.d.ts +0 -34
  479. package/dist/fastify/plugin.js +0 -284
  480. package/dist/fastify/plugin.js.map +0 -1
  481. package/dist/h3/plugin.cjs +0 -183
  482. package/dist/h3/plugin.cjs.map +0 -1
  483. package/dist/h3/plugin.d.cts +0 -27
  484. package/dist/h3/plugin.d.ts +0 -27
  485. package/dist/h3/plugin.js +0 -159
  486. package/dist/h3/plugin.js.map +0 -1
  487. package/dist/h3/utils.cjs +0 -77
  488. package/dist/h3/utils.cjs.map +0 -1
  489. package/dist/h3/utils.d.cts +0 -14
  490. package/dist/h3/utils.d.ts +0 -14
  491. package/dist/h3/utils.js +0 -54
  492. package/dist/h3/utils.js.map +0 -1
  493. package/dist/hapi/plugin.cjs +0 -212
  494. package/dist/hapi/plugin.cjs.map +0 -1
  495. package/dist/hapi/plugin.d.cts +0 -40
  496. package/dist/hapi/plugin.d.ts +0 -40
  497. package/dist/hapi/plugin.js +0 -188
  498. package/dist/hapi/plugin.js.map +0 -1
  499. package/dist/hapi/utils.cjs +0 -77
  500. package/dist/hapi/utils.cjs.map +0 -1
  501. package/dist/hapi/utils.d.cts +0 -16
  502. package/dist/hapi/utils.d.ts +0 -16
  503. package/dist/hapi/utils.js +0 -53
  504. package/dist/hapi/utils.js.map +0 -1
  505. package/dist/hono/utils.cjs +0 -113
  506. package/dist/hono/utils.cjs.map +0 -1
  507. package/dist/hono/utils.d.cts +0 -16
  508. package/dist/hono/utils.d.ts +0 -16
  509. package/dist/hono/utils.js +0 -88
  510. package/dist/hono/utils.js.map +0 -1
  511. package/dist/loggers/console.cjs +0 -67
  512. package/dist/loggers/console.cjs.map +0 -1
  513. package/dist/loggers/console.d.cts +0 -11
  514. package/dist/loggers/console.d.ts +0 -11
  515. package/dist/loggers/console.js +0 -44
  516. package/dist/loggers/console.js.map +0 -1
  517. package/dist/loggers/hapi.cjs.map +0 -1
  518. package/dist/loggers/hapi.d.cts +0 -12
  519. package/dist/loggers/hapi.d.ts +0 -12
  520. package/dist/loggers/hapi.js +0 -29
  521. package/dist/loggers/hapi.js.map +0 -1
  522. package/dist/loggers/index.cjs.map +0 -1
  523. package/dist/loggers/index.d.cts +0 -13
  524. package/dist/loggers/index.d.ts +0 -13
  525. package/dist/loggers/index.js +0 -13
  526. package/dist/loggers/index.js.map +0 -1
  527. package/dist/loggers/nestjs.cjs +0 -104
  528. package/dist/loggers/nestjs.cjs.map +0 -1
  529. package/dist/loggers/nestjs.d.cts +0 -11
  530. package/dist/loggers/nestjs.d.ts +0 -11
  531. package/dist/loggers/nestjs.js +0 -71
  532. package/dist/loggers/nestjs.js.map +0 -1
  533. package/dist/loggers/pino.cjs +0 -152
  534. package/dist/loggers/pino.cjs.map +0 -1
  535. package/dist/loggers/pino.d.cts +0 -11
  536. package/dist/loggers/pino.d.ts +0 -11
  537. package/dist/loggers/pino.js +0 -119
  538. package/dist/loggers/pino.js.map +0 -1
  539. package/dist/loggers/utils.cjs +0 -64
  540. package/dist/loggers/utils.cjs.map +0 -1
  541. package/dist/loggers/utils.d.cts +0 -6
  542. package/dist/loggers/utils.d.ts +0 -6
  543. package/dist/loggers/utils.js +0 -40
  544. package/dist/loggers/utils.js.map +0 -1
  545. package/dist/loggers/winston.cjs +0 -101
  546. package/dist/loggers/winston.cjs.map +0 -1
  547. package/dist/loggers/winston.d.cts +0 -11
  548. package/dist/loggers/winston.d.ts +0 -11
  549. package/dist/loggers/winston.js +0 -68
  550. package/dist/loggers/winston.js.map +0 -1
  551. package/dist/otel/index.cjs.map +0 -1
  552. package/dist/otel/index.d.cts +0 -2
  553. package/dist/otel/index.d.ts +0 -2
  554. package/dist/otel/index.js +0 -5
  555. package/dist/otel/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/spanCollector.ts"],"sourcesContent":["import {\n context,\n SpanKind,\n SpanStatusCode,\n trace,\n type Tracer,\n} from \"@opentelemetry/api\";\nimport {\n type ReadableSpan,\n type Span,\n SpanProcessor,\n} from \"@opentelemetry/sdk-trace-base\";\n\nimport { ApitallyClient } from \"./client.js\";\n\nexport type SpanData = {\n spanId: string;\n parentSpanId: string | null;\n name: string;\n kind: string;\n startTime: string; // bigint as string\n endTime: string; // bigint as string\n status?: string;\n attributes?: Record<string, unknown>;\n};\n\nexport type SpanHandle = {\n traceId?: string;\n setName: (name: string) => void;\n runInContext: <T>(fn: () => T) => T;\n enterContext: () => void;\n end: () => SpanData[] | undefined;\n};\n\nconst TRACE_MAX_AGE = 5 * 60 * 1000; // 5 minutes\n\nexport default class SpanCollector implements SpanProcessor {\n public enabled: boolean;\n private includedSpanIds: Map<string, Set<string>> = new Map();\n private collectedSpans: Map<string, SpanData[]> = new Map();\n private traceStartTimes: Map<string, number> = new Map();\n private maintainIntervalId?: NodeJS.Timeout;\n private tracer?: Tracer;\n\n constructor(enabled: boolean) {\n this.enabled = enabled;\n\n if (enabled) {\n this.tracer = trace.getTracer(\"apitally\");\n this.maintainIntervalId = setInterval(() => {\n this.maintain();\n }, 60_000);\n }\n }\n\n startSpan(): SpanHandle {\n if (!this.enabled || !this.tracer) {\n return {\n setName: () => void 0,\n runInContext: <T>(fn: () => T): T => {\n return fn();\n },\n enterContext: () => void 0,\n end: () => undefined,\n };\n }\n\n const span = this.tracer.startSpan(\"root\");\n const spanCtx = span.spanContext();\n const traceId = spanCtx.traceId;\n const ctx = trace.setSpan(context.active(), span);\n let ended = false;\n\n this.includedSpanIds.set(traceId, new Set([spanCtx.spanId]));\n this.collectedSpans.set(traceId, []);\n this.traceStartTimes.set(traceId, Date.now());\n\n return {\n traceId,\n setName: (name: string) => {\n span.updateName(name);\n },\n runInContext: <T>(fn: () => T): T => {\n return context.with(ctx, fn);\n },\n enterContext: () => {\n try {\n // Access the global context manager's internal AsyncLocalStorage\n const contextManager = (context as any)._getContextManager?.();\n contextManager?._asyncLocalStorage?.enterWith(ctx);\n } catch {\n // Ignore errors accessing internals\n }\n },\n end: () => {\n if (ended) return;\n span.end();\n ended = true;\n return this.getAndClearSpans(traceId);\n },\n };\n }\n\n private getAndClearSpans(traceId: string): SpanData[] {\n const spans = this.collectedSpans.get(traceId) ?? [];\n this.collectedSpans.delete(traceId);\n this.includedSpanIds.delete(traceId);\n this.traceStartTimes.delete(traceId);\n return spans;\n }\n\n onStart(span: Span): void {\n if (!this.enabled) return;\n\n const ctx = span.spanContext();\n const traceId = ctx.traceId;\n const spanId = ctx.spanId;\n\n const includedSpans = this.includedSpanIds.get(traceId);\n if (!includedSpans) return;\n\n const parentSpanId = span.parentSpanContext?.spanId;\n if (parentSpanId && includedSpans.has(parentSpanId)) {\n includedSpans.add(spanId);\n }\n }\n\n onEnd(span: ReadableSpan): void {\n if (!this.enabled) return;\n\n const ctx = span.spanContext();\n const traceId = ctx.traceId;\n const spanId = ctx.spanId;\n\n const includedSpans = this.includedSpanIds.get(traceId);\n if (!includedSpans || !includedSpans.has(spanId)) return;\n\n const spans = this.collectedSpans.get(traceId);\n if (spans) {\n spans.push(this.serializeSpan(span));\n }\n }\n\n private serializeSpan(span: ReadableSpan): SpanData {\n const ctx = span.spanContext();\n\n const data: SpanData = {\n spanId: ctx.spanId,\n parentSpanId: span.parentSpanContext?.spanId || null,\n name: span.name,\n kind: SpanKind[span.kind] ?? \"INTERNAL\",\n // HrTime is [seconds, nanoseconds], convert to nanoseconds as string to avoid precision loss\n startTime: (\n BigInt(span.startTime[0]) * 1_000_000_000n +\n BigInt(span.startTime[1])\n ).toString(),\n endTime: (\n BigInt(span.endTime[0]) * 1_000_000_000n +\n BigInt(span.endTime[1])\n ).toString(),\n };\n\n if (span.status.code !== SpanStatusCode.UNSET) {\n data.status = SpanStatusCode[span.status.code];\n }\n\n if (span.attributes && Object.keys(span.attributes).length > 0) {\n data.attributes = { ...span.attributes };\n }\n\n return data;\n }\n\n private maintain() {\n const now = Date.now();\n for (const [traceId, startTime] of this.traceStartTimes) {\n if (now - startTime > TRACE_MAX_AGE) {\n this.collectedSpans.delete(traceId);\n this.includedSpanIds.delete(traceId);\n this.traceStartTimes.delete(traceId);\n }\n }\n }\n\n async shutdown(): Promise<void> {\n this.enabled = false;\n this.includedSpanIds.clear();\n this.collectedSpans.clear();\n this.traceStartTimes.clear();\n if (this.maintainIntervalId) {\n clearInterval(this.maintainIntervalId);\n }\n }\n\n async forceFlush(): Promise<void> {\n // Nothing to flush since we collect spans synchronously\n }\n}\n\nexport class ApitallySpanProcessor implements SpanProcessor {\n private getCollector(): SpanCollector | undefined {\n try {\n return ApitallyClient.getInstance().spanCollector;\n } catch {\n return undefined;\n }\n }\n\n onStart(span: Span) {\n this.getCollector()?.onStart(span);\n }\n\n onEnd(span: ReadableSpan) {\n this.getCollector()?.onEnd(span);\n }\n\n async shutdown() {\n this.getCollector()?.shutdown();\n }\n\n async forceFlush() {\n this.getCollector()?.forceFlush();\n }\n}\n\nexport { SpanCollector };\n"],"mappings":";;AAAA,SACEA,SACAC,UACAC,gBACAC,aAEK;AAOP,SAASC,sBAAsB;AAqB/B,MAAMC,gBAAgB,IAAI,KAAK;AAE/B,MAAqBC,iBAArB,MAAqBA,eAAAA;EACZC;EACCC,kBAA4C,oBAAIC,IAAAA;EAChDC,iBAA0C,oBAAID,IAAAA;EAC9CE,kBAAuC,oBAAIF,IAAAA;EAC3CG;EACAC;EAER,YAAYN,SAAkB;AAC5B,SAAKA,UAAUA;AAEf,QAAIA,SAAS;AACX,WAAKM,SAASV,MAAMW,UAAU,UAAA;AAC9B,WAAKF,qBAAqBG,YAAY,MAAA;AACpC,aAAKC,SAAQ;MACf,GAAG,GAAA;IACL;EACF;EAEAC,YAAwB;AACtB,QAAI,CAAC,KAAKV,WAAW,CAAC,KAAKM,QAAQ;AACjC,aAAO;QACLK,SAAS,6BAAM,QAAN;QACTC,cAAc,wBAAIC,OAAAA;AAChB,iBAAOA,GAAAA;QACT,GAFc;QAG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N;","names":["context","SpanKind","SpanStatusCode","trace","ApitallyClient","TRACE_MAX_AGE","SpanCollector","enabled","includedSpanIds","Map","collectedSpans","traceStartTimes","maintainIntervalId","tracer","getTracer","setInterval","maintain","startSpan","setName","runInContext","fn","enterContext","end","undefined","span","spanCtx","spanContext","traceId","ctx","setSpan","active","ended","set","Set","spanId","Date","now","name","updateName","with","contextManager","_getContextManager","_asyncLocalStorage","enterWith","getAndClearSpans","spans","get","delete","onStart","includedSpans","parentSpanId","parentSpanContext","has","add","onEnd","push","serializeSpan","data","kind","startTime","BigInt","toString","endTime","status","code","UNSET","attributes","Object","keys","length","shutdown","clear","clearInterval","forceFlush","ApitallySpanProcessor","getCollector","getInstance","spanCollector"]}
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var tempGzipFile_exports = {};
21
- __export(tempGzipFile_exports, {
22
- TempGzipFile: () => TempGzipFile,
23
- checkWritableFs: () => checkWritableFs,
24
- default: () => TempGzipFile
25
- });
26
- module.exports = __toCommonJS(tempGzipFile_exports);
27
- var import_node_buffer = require("node:buffer");
28
- var import_node_crypto = require("node:crypto");
29
- var import_node_fs = require("node:fs");
30
- var import_promises = require("node:fs/promises");
31
- var import_node_os = require("node:os");
32
- var import_node_path = require("node:path");
33
- var import_node_zlib = require("node:zlib");
34
- const TEMP_DIR = (0, import_node_path.join)((0, import_node_os.tmpdir)(), "apitally");
35
- function checkWritableFs() {
36
- try {
37
- (0, import_node_fs.mkdirSync)(TEMP_DIR, {
38
- recursive: true
39
- });
40
- const testPath = (0, import_node_path.join)(TEMP_DIR, `test_${(0, import_node_crypto.randomUUID)()}`);
41
- (0, import_node_fs.writeFileSync)(testPath, "test");
42
- (0, import_node_fs.unlinkSync)(testPath);
43
- return true;
44
- } catch (error) {
45
- return false;
46
- }
47
- }
48
- __name(checkWritableFs, "checkWritableFs");
49
- const _TempGzipFile = class _TempGzipFile {
50
- uuid;
51
- filePath;
52
- gzip;
53
- writeStream;
54
- readyPromise;
55
- closedPromise;
56
- constructor(name) {
57
- (0, import_node_fs.mkdirSync)(TEMP_DIR, {
58
- recursive: true
59
- });
60
- this.uuid = (0, import_node_crypto.randomUUID)();
61
- this.filePath = (0, import_node_path.join)(TEMP_DIR, `${name}_${this.uuid}.gz`);
62
- this.writeStream = (0, import_node_fs.createWriteStream)(this.filePath);
63
- this.readyPromise = new Promise((resolve, reject) => {
64
- this.writeStream.once("ready", resolve);
65
- this.writeStream.once("error", reject);
66
- });
67
- this.closedPromise = new Promise((resolve, reject) => {
68
- this.writeStream.once("close", resolve);
69
- this.writeStream.once("error", reject);
70
- });
71
- this.gzip = (0, import_node_zlib.createGzip)();
72
- this.gzip.pipe(this.writeStream);
73
- }
74
- get size() {
75
- return this.writeStream.bytesWritten;
76
- }
77
- async writeLines(lines) {
78
- if (lines.length === 0) return;
79
- await this.readyPromise;
80
- const parts = [];
81
- const newline = import_node_buffer.Buffer.from("\n");
82
- for (const line of lines) {
83
- parts.push(line, newline);
84
- }
85
- const combined = import_node_buffer.Buffer.concat(parts);
86
- return new Promise((resolve, reject) => {
87
- this.gzip.write(combined, (error) => {
88
- if (error) {
89
- reject(error);
90
- } else {
91
- resolve();
92
- }
93
- });
94
- });
95
- }
96
- async getContent() {
97
- return new Promise((resolve, reject) => {
98
- (0, import_node_fs.readFile)(this.filePath, (error, data) => {
99
- if (error) {
100
- reject(error);
101
- } else {
102
- resolve(data);
103
- }
104
- });
105
- });
106
- }
107
- async close() {
108
- await new Promise((resolve) => {
109
- this.gzip.end(() => {
110
- resolve();
111
- });
112
- });
113
- await this.closedPromise;
114
- }
115
- async delete() {
116
- await this.close();
117
- await (0, import_promises.unlink)(this.filePath);
118
- }
119
- };
120
- __name(_TempGzipFile, "TempGzipFile");
121
- let TempGzipFile = _TempGzipFile;
122
- // Annotate the CommonJS export names for ESM import in node:
123
- 0 && (module.exports = {
124
- TempGzipFile,
125
- checkWritableFs
126
- });
127
- //# sourceMappingURL=tempGzipFile.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/tempGzipFile.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport { randomUUID } from \"node:crypto\";\nimport {\n createWriteStream,\n mkdirSync,\n readFile,\n unlinkSync,\n writeFileSync,\n WriteStream,\n} from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createGzip, Gzip } from \"node:zlib\";\n\nconst TEMP_DIR = join(tmpdir(), \"apitally\");\n\nexport function checkWritableFs() {\n try {\n mkdirSync(TEMP_DIR, { recursive: true });\n const testPath = join(TEMP_DIR, `test_${randomUUID()}`);\n writeFileSync(testPath, \"test\");\n unlinkSync(testPath);\n return true;\n } catch (error) {\n return false;\n }\n}\n\nexport default class TempGzipFile {\n public uuid: string;\n private filePath: string;\n private gzip: Gzip;\n private writeStream: WriteStream;\n private readyPromise: Promise<void>;\n private closedPromise: Promise<void>;\n\n constructor(name: string) {\n mkdirSync(TEMP_DIR, { recursive: true });\n this.uuid = randomUUID();\n this.filePath = join(TEMP_DIR, `${name}_${this.uuid}.gz`);\n this.writeStream = createWriteStream(this.filePath);\n this.readyPromise = new Promise<void>((resolve, reject) => {\n this.writeStream.once(\"ready\", resolve);\n this.writeStream.once(\"error\", reject);\n });\n this.closedPromise = new Promise<void>((resolve, reject) => {\n this.writeStream.once(\"close\", resolve);\n this.writeStream.once(\"error\", reject);\n });\n this.gzip = createGzip();\n this.gzip.pipe(this.writeStream);\n }\n\n get size() {\n return this.writeStream.bytesWritten;\n }\n\n async writeLines(lines: Buffer[]) {\n if (lines.length === 0) return;\n await this.readyPromise;\n const parts: Buffer[] = [];\n const newline = Buffer.from(\"\\n\");\n for (const line of lines) {\n parts.push(line, newline);\n }\n const combined = Buffer.concat(parts);\n return new Promise<void>((resolve, reject) => {\n this.gzip.write(combined, (error) => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n }\n\n async getContent() {\n return new Promise<Buffer>((resolve, reject) => {\n readFile(this.filePath, (error, data) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n });\n });\n }\n\n async close() {\n await new Promise<void>((resolve) => {\n this.gzip.end(() => {\n resolve();\n });\n });\n await this.closedPromise;\n }\n\n async delete() {\n await this.close();\n await unlink(this.filePath);\n }\n}\n\nexport { TempGzipFile };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAAA,yBAAuB;AACvB,yBAA2B;AAC3B,qBAOO;AACP,sBAAuB;AACvB,qBAAuB;AACvB,uBAAqB;AACrB,uBAAiC;AAEjC,MAAMA,eAAWC,2BAAKC,uBAAAA,GAAU,UAAA;AAEzB,SAASC,kBAAAA;AACd,MAAI;AACFC,kCAAUJ,UAAU;MAAEK,WAAW;IAAK,CAAA;AACtC,UAAMC,eAAWL,uBAAKD,UAAU,YAAQO,+BAAAA,CAAAA,EAAc;AACtDC,sCAAcF,UAAU,MAAA;AACxBG,mCAAWH,QAAAA;AACX,WAAO;EACT,SAASI,OAAO;AACd,WAAO;EACT;AACF;AAVgBP;AAYhB,MAAqBQ,gBAArB,MAAqBA,cAAAA;EACZC;EACCC;EACAC;EACAC;EACAC;EACAC;EAER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TY,iBAAOZ,KAAAA;QACT,OAAO;AACLW,kBAAQqB,IAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF;EAEA,MAAMC,QAAQ;AACZ,UAAM,IAAIvB,QAAc,CAACC,YAAAA;AACvB,WAAKP,KAAK8B,IAAI,MAAA;AACZvB,gBAAAA;MACF,CAAA;IACF,CAAA;AACA,UAAM,KAAKJ;EACb;EAEA,MAAM4B,SAAS;AACb,UAAM,KAAKF,MAAK;AAChB,cAAMG,wBAAO,KAAKjC,QAAQ;EAC5B;AACF;AA1EqBF;AAArB,IAAqBA,eAArB;","names":["TEMP_DIR","join","tmpdir","checkWritableFs","mkdirSync","recursive","testPath","randomUUID","writeFileSync","unlinkSync","error","TempGzipFile","uuid","filePath","gzip","writeStream","readyPromise","closedPromise","name","createWriteStream","Promise","resolve","reject","once","createGzip","pipe","size","bytesWritten","writeLines","lines","length","parts","newline","Buffer","from","line","push","combined","concat","write","getContent","readFile","data","close","end","delete","unlink"]}
@@ -1,19 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
-
3
- declare function checkWritableFs(): boolean;
4
- declare class TempGzipFile {
5
- uuid: string;
6
- private filePath;
7
- private gzip;
8
- private writeStream;
9
- private readyPromise;
10
- private closedPromise;
11
- constructor(name: string);
12
- get size(): number;
13
- writeLines(lines: Buffer[]): Promise<void>;
14
- getContent(): Promise<Buffer<ArrayBufferLike>>;
15
- close(): Promise<void>;
16
- delete(): Promise<void>;
17
- }
18
-
19
- export { TempGzipFile, checkWritableFs, TempGzipFile as default };
@@ -1,19 +0,0 @@
1
- import { Buffer } from 'node:buffer';
2
-
3
- declare function checkWritableFs(): boolean;
4
- declare class TempGzipFile {
5
- uuid: string;
6
- private filePath;
7
- private gzip;
8
- private writeStream;
9
- private readyPromise;
10
- private closedPromise;
11
- constructor(name: string);
12
- get size(): number;
13
- writeLines(lines: Buffer[]): Promise<void>;
14
- getContent(): Promise<Buffer<ArrayBufferLike>>;
15
- close(): Promise<void>;
16
- delete(): Promise<void>;
17
- }
18
-
19
- export { TempGzipFile, checkWritableFs, TempGzipFile as default };
@@ -1,103 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { Buffer as Buffer2 } from "node:buffer";
4
- import { randomUUID } from "node:crypto";
5
- import { createWriteStream, mkdirSync, readFile, unlinkSync, writeFileSync } from "node:fs";
6
- import { unlink } from "node:fs/promises";
7
- import { tmpdir } from "node:os";
8
- import { join } from "node:path";
9
- import { createGzip } from "node:zlib";
10
- const TEMP_DIR = join(tmpdir(), "apitally");
11
- function checkWritableFs() {
12
- try {
13
- mkdirSync(TEMP_DIR, {
14
- recursive: true
15
- });
16
- const testPath = join(TEMP_DIR, `test_${randomUUID()}`);
17
- writeFileSync(testPath, "test");
18
- unlinkSync(testPath);
19
- return true;
20
- } catch (error) {
21
- return false;
22
- }
23
- }
24
- __name(checkWritableFs, "checkWritableFs");
25
- const _TempGzipFile = class _TempGzipFile {
26
- uuid;
27
- filePath;
28
- gzip;
29
- writeStream;
30
- readyPromise;
31
- closedPromise;
32
- constructor(name) {
33
- mkdirSync(TEMP_DIR, {
34
- recursive: true
35
- });
36
- this.uuid = randomUUID();
37
- this.filePath = join(TEMP_DIR, `${name}_${this.uuid}.gz`);
38
- this.writeStream = createWriteStream(this.filePath);
39
- this.readyPromise = new Promise((resolve, reject) => {
40
- this.writeStream.once("ready", resolve);
41
- this.writeStream.once("error", reject);
42
- });
43
- this.closedPromise = new Promise((resolve, reject) => {
44
- this.writeStream.once("close", resolve);
45
- this.writeStream.once("error", reject);
46
- });
47
- this.gzip = createGzip();
48
- this.gzip.pipe(this.writeStream);
49
- }
50
- get size() {
51
- return this.writeStream.bytesWritten;
52
- }
53
- async writeLines(lines) {
54
- if (lines.length === 0) return;
55
- await this.readyPromise;
56
- const parts = [];
57
- const newline = Buffer2.from("\n");
58
- for (const line of lines) {
59
- parts.push(line, newline);
60
- }
61
- const combined = Buffer2.concat(parts);
62
- return new Promise((resolve, reject) => {
63
- this.gzip.write(combined, (error) => {
64
- if (error) {
65
- reject(error);
66
- } else {
67
- resolve();
68
- }
69
- });
70
- });
71
- }
72
- async getContent() {
73
- return new Promise((resolve, reject) => {
74
- readFile(this.filePath, (error, data) => {
75
- if (error) {
76
- reject(error);
77
- } else {
78
- resolve(data);
79
- }
80
- });
81
- });
82
- }
83
- async close() {
84
- await new Promise((resolve) => {
85
- this.gzip.end(() => {
86
- resolve();
87
- });
88
- });
89
- await this.closedPromise;
90
- }
91
- async delete() {
92
- await this.close();
93
- await unlink(this.filePath);
94
- }
95
- };
96
- __name(_TempGzipFile, "TempGzipFile");
97
- let TempGzipFile = _TempGzipFile;
98
- export {
99
- TempGzipFile,
100
- checkWritableFs,
101
- TempGzipFile as default
102
- };
103
- //# sourceMappingURL=tempGzipFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/tempGzipFile.ts"],"sourcesContent":["import { Buffer } from \"node:buffer\";\nimport { randomUUID } from \"node:crypto\";\nimport {\n createWriteStream,\n mkdirSync,\n readFile,\n unlinkSync,\n writeFileSync,\n WriteStream,\n} from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { createGzip, Gzip } from \"node:zlib\";\n\nconst TEMP_DIR = join(tmpdir(), \"apitally\");\n\nexport function checkWritableFs() {\n try {\n mkdirSync(TEMP_DIR, { recursive: true });\n const testPath = join(TEMP_DIR, `test_${randomUUID()}`);\n writeFileSync(testPath, \"test\");\n unlinkSync(testPath);\n return true;\n } catch (error) {\n return false;\n }\n}\n\nexport default class TempGzipFile {\n public uuid: string;\n private filePath: string;\n private gzip: Gzip;\n private writeStream: WriteStream;\n private readyPromise: Promise<void>;\n private closedPromise: Promise<void>;\n\n constructor(name: string) {\n mkdirSync(TEMP_DIR, { recursive: true });\n this.uuid = randomUUID();\n this.filePath = join(TEMP_DIR, `${name}_${this.uuid}.gz`);\n this.writeStream = createWriteStream(this.filePath);\n this.readyPromise = new Promise<void>((resolve, reject) => {\n this.writeStream.once(\"ready\", resolve);\n this.writeStream.once(\"error\", reject);\n });\n this.closedPromise = new Promise<void>((resolve, reject) => {\n this.writeStream.once(\"close\", resolve);\n this.writeStream.once(\"error\", reject);\n });\n this.gzip = createGzip();\n this.gzip.pipe(this.writeStream);\n }\n\n get size() {\n return this.writeStream.bytesWritten;\n }\n\n async writeLines(lines: Buffer[]) {\n if (lines.length === 0) return;\n await this.readyPromise;\n const parts: Buffer[] = [];\n const newline = Buffer.from(\"\\n\");\n for (const line of lines) {\n parts.push(line, newline);\n }\n const combined = Buffer.concat(parts);\n return new Promise<void>((resolve, reject) => {\n this.gzip.write(combined, (error) => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n }\n\n async getContent() {\n return new Promise<Buffer>((resolve, reject) => {\n readFile(this.filePath, (error, data) => {\n if (error) {\n reject(error);\n } else {\n resolve(data);\n }\n });\n });\n }\n\n async close() {\n await new Promise<void>((resolve) => {\n this.gzip.end(() => {\n resolve();\n });\n });\n await this.closedPromise;\n }\n\n async delete() {\n await this.close();\n await unlink(this.filePath);\n }\n}\n\nexport { TempGzipFile };\n"],"mappings":";;AAAA,SAASA,UAAAA,eAAc;AACvB,SAASC,kBAAkB;AAC3B,SACEC,mBACAC,WACAC,UACAC,YACAC,qBAEK;AACP,SAASC,cAAc;AACvB,SAASC,cAAc;AACvB,SAASC,YAAY;AACrB,SAASC,kBAAwB;AAEjC,MAAMC,WAAWF,KAAKD,OAAAA,GAAU,UAAA;AAEzB,SAASI,kBAAAA;AACd,MAAI;AACFT,cAAUQ,UAAU;MAAEE,WAAW;IAAK,CAAA;AACtC,UAAMC,WAAWL,KAAKE,UAAU,QAAQV,WAAAA,CAAAA,EAAc;AACtDK,kBAAcQ,UAAU,MAAA;AACxBT,eAAWS,QAAAA;AACX,WAAO;EACT,SAASC,OAAO;AACd,WAAO;EACT;AACF;AAVgBH;AAYhB,MAAqBI,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,UAAU,CAACH,OAAO4B,SAAAA;AAC9B,YAAI5B,OAAO;AACTW,iBAAOX,KAAAA;QACT,OAAO;AACLU,kBAAQkB,IAAAA;QACV;MACF,CAAA;IACF,CAAA;EACF;EAEA,MAAMC,QAAQ;AACZ,UAAM,IAAIpB,QAAc,CAACC,YAAAA;AACvB,WAAKN,KAAK0B,IAAI,MAAA;AACZpB,gBAAAA;MACF,CAAA;IACF,CAAA;AACA,UAAM,KAAKH;EACb;EAEA,MAAMwB,SAAS;AACb,UAAM,KAAKF,MAAK;AAChB,UAAMrC,OAAO,KAAKW,QAAQ;EAC5B;AACF;AA1EqBF;AAArB,IAAqBA,eAArB;","names":["Buffer","randomUUID","createWriteStream","mkdirSync","readFile","unlinkSync","writeFileSync","unlink","tmpdir","join","createGzip","TEMP_DIR","checkWritableFs","recursive","testPath","error","TempGzipFile","uuid","filePath","gzip","writeStream","readyPromise","closedPromise","name","Promise","resolve","reject","once","pipe","size","bytesWritten","writeLines","lines","length","parts","newline","from","line","push","combined","concat","write","getContent","data","close","end","delete"]}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
17
- //# sourceMappingURL=types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/types.ts"],"sourcesContent":["import { Logger } from \"./logging.js\";\nimport { RequestLoggingConfig } from \"./requestLogger.js\";\n\nexport type ApitallyConfig = {\n clientId: string;\n env?: string;\n requestLogging?: Partial<RequestLoggingConfig>;\n appVersion?: string;\n logger?: Logger;\n\n /** @deprecated Use requestLogging instead */\n requestLoggingConfig?: Partial<RequestLoggingConfig>;\n};\n\nexport type ApitallyConsumer = {\n identifier: string;\n name?: string | null;\n group?: string | null;\n};\n\nexport type PathInfo = {\n method: string;\n path: string;\n};\n\nexport type StartupData = {\n paths: PathInfo[];\n versions: Record<string, string>;\n client: string;\n};\n\nexport type StartupPayload = {\n instance_uuid: string;\n message_uuid: string;\n} & StartupData;\n\nexport type ConsumerMethodPath = {\n consumer?: string | null;\n method: string;\n path: string;\n};\n\nexport type RequestInfo = ConsumerMethodPath & {\n statusCode: number;\n responseTime: number;\n requestSize?: string | number | null;\n responseSize?: string | number | null;\n};\n\nexport type RequestsItem = ConsumerMethodPath & {\n status_code: number;\n request_count: number;\n request_size_sum: number;\n response_size_sum: number;\n response_times: Record<number, number>;\n request_sizes: Record<number, number>;\n response_sizes: Record<number, number>;\n};\n\nexport type ValidationError = {\n loc: string;\n msg: string;\n type: string;\n};\n\nexport type ValidationErrorsItem = ConsumerMethodPath & {\n loc: Array<string>;\n msg: string;\n type: string;\n error_count: number;\n};\n\nexport type ServerError = {\n type: string;\n msg: string;\n traceback: string;\n};\n\nexport type ServerErrorsItem = ConsumerMethodPath & {\n type: string;\n msg: string;\n traceback: string;\n sentry_event_id: string | null;\n error_count: number;\n};\n\nexport type ConsumerItem = ApitallyConsumer;\n\nexport type SyncPayload = {\n timestamp: number;\n instance_uuid: string;\n message_uuid: string;\n requests: Array<RequestsItem>;\n validation_errors: Array<ValidationErrorsItem>;\n server_errors: Array<ServerErrorsItem>;\n consumers: Array<ConsumerItem>;\n resources: {\n cpu_percent: number;\n memory_rss: number;\n } | null;\n};\n"],"mappings":";;;;;;;;;;;;;;AAwFA;;","names":[]}
@@ -1,95 +0,0 @@
1
- import { Logger } from './logging.cjs';
2
- import { RequestLoggingConfig } from './requestLogger.cjs';
3
- import 'winston';
4
- import 'node:buffer';
5
- import 'node:http';
6
- import './spanCollector.cjs';
7
- import '@opentelemetry/sdk-trace-base';
8
- import './tempGzipFile.cjs';
9
-
10
- type ApitallyConfig = {
11
- clientId: string;
12
- env?: string;
13
- requestLogging?: Partial<RequestLoggingConfig>;
14
- appVersion?: string;
15
- logger?: Logger;
16
- /** @deprecated Use requestLogging instead */
17
- requestLoggingConfig?: Partial<RequestLoggingConfig>;
18
- };
19
- type ApitallyConsumer = {
20
- identifier: string;
21
- name?: string | null;
22
- group?: string | null;
23
- };
24
- type PathInfo = {
25
- method: string;
26
- path: string;
27
- };
28
- type StartupData = {
29
- paths: PathInfo[];
30
- versions: Record<string, string>;
31
- client: string;
32
- };
33
- type StartupPayload = {
34
- instance_uuid: string;
35
- message_uuid: string;
36
- } & StartupData;
37
- type ConsumerMethodPath = {
38
- consumer?: string | null;
39
- method: string;
40
- path: string;
41
- };
42
- type RequestInfo = ConsumerMethodPath & {
43
- statusCode: number;
44
- responseTime: number;
45
- requestSize?: string | number | null;
46
- responseSize?: string | number | null;
47
- };
48
- type RequestsItem = ConsumerMethodPath & {
49
- status_code: number;
50
- request_count: number;
51
- request_size_sum: number;
52
- response_size_sum: number;
53
- response_times: Record<number, number>;
54
- request_sizes: Record<number, number>;
55
- response_sizes: Record<number, number>;
56
- };
57
- type ValidationError = {
58
- loc: string;
59
- msg: string;
60
- type: string;
61
- };
62
- type ValidationErrorsItem = ConsumerMethodPath & {
63
- loc: Array<string>;
64
- msg: string;
65
- type: string;
66
- error_count: number;
67
- };
68
- type ServerError = {
69
- type: string;
70
- msg: string;
71
- traceback: string;
72
- };
73
- type ServerErrorsItem = ConsumerMethodPath & {
74
- type: string;
75
- msg: string;
76
- traceback: string;
77
- sentry_event_id: string | null;
78
- error_count: number;
79
- };
80
- type ConsumerItem = ApitallyConsumer;
81
- type SyncPayload = {
82
- timestamp: number;
83
- instance_uuid: string;
84
- message_uuid: string;
85
- requests: Array<RequestsItem>;
86
- validation_errors: Array<ValidationErrorsItem>;
87
- server_errors: Array<ServerErrorsItem>;
88
- consumers: Array<ConsumerItem>;
89
- resources: {
90
- cpu_percent: number;
91
- memory_rss: number;
92
- } | null;
93
- };
94
-
95
- export type { ApitallyConfig, ApitallyConsumer, ConsumerItem, ConsumerMethodPath, PathInfo, RequestInfo, RequestsItem, ServerError, ServerErrorsItem, StartupData, StartupPayload, SyncPayload, ValidationError, ValidationErrorsItem };
@@ -1,95 +0,0 @@
1
- import { Logger } from './logging.js';
2
- import { RequestLoggingConfig } from './requestLogger.js';
3
- import 'winston';
4
- import 'node:buffer';
5
- import 'node:http';
6
- import './spanCollector.js';
7
- import '@opentelemetry/sdk-trace-base';
8
- import './tempGzipFile.js';
9
-
10
- type ApitallyConfig = {
11
- clientId: string;
12
- env?: string;
13
- requestLogging?: Partial<RequestLoggingConfig>;
14
- appVersion?: string;
15
- logger?: Logger;
16
- /** @deprecated Use requestLogging instead */
17
- requestLoggingConfig?: Partial<RequestLoggingConfig>;
18
- };
19
- type ApitallyConsumer = {
20
- identifier: string;
21
- name?: string | null;
22
- group?: string | null;
23
- };
24
- type PathInfo = {
25
- method: string;
26
- path: string;
27
- };
28
- type StartupData = {
29
- paths: PathInfo[];
30
- versions: Record<string, string>;
31
- client: string;
32
- };
33
- type StartupPayload = {
34
- instance_uuid: string;
35
- message_uuid: string;
36
- } & StartupData;
37
- type ConsumerMethodPath = {
38
- consumer?: string | null;
39
- method: string;
40
- path: string;
41
- };
42
- type RequestInfo = ConsumerMethodPath & {
43
- statusCode: number;
44
- responseTime: number;
45
- requestSize?: string | number | null;
46
- responseSize?: string | number | null;
47
- };
48
- type RequestsItem = ConsumerMethodPath & {
49
- status_code: number;
50
- request_count: number;
51
- request_size_sum: number;
52
- response_size_sum: number;
53
- response_times: Record<number, number>;
54
- request_sizes: Record<number, number>;
55
- response_sizes: Record<number, number>;
56
- };
57
- type ValidationError = {
58
- loc: string;
59
- msg: string;
60
- type: string;
61
- };
62
- type ValidationErrorsItem = ConsumerMethodPath & {
63
- loc: Array<string>;
64
- msg: string;
65
- type: string;
66
- error_count: number;
67
- };
68
- type ServerError = {
69
- type: string;
70
- msg: string;
71
- traceback: string;
72
- };
73
- type ServerErrorsItem = ConsumerMethodPath & {
74
- type: string;
75
- msg: string;
76
- traceback: string;
77
- sentry_event_id: string | null;
78
- error_count: number;
79
- };
80
- type ConsumerItem = ApitallyConsumer;
81
- type SyncPayload = {
82
- timestamp: number;
83
- instance_uuid: string;
84
- message_uuid: string;
85
- requests: Array<RequestsItem>;
86
- validation_errors: Array<ValidationErrorsItem>;
87
- server_errors: Array<ServerErrorsItem>;
88
- consumers: Array<ConsumerItem>;
89
- resources: {
90
- cpu_percent: number;
91
- memory_rss: number;
92
- } | null;
93
- };
94
-
95
- export type { ApitallyConfig, ApitallyConsumer, ConsumerItem, ConsumerMethodPath, PathInfo, RequestInfo, RequestsItem, ServerError, ServerErrorsItem, StartupData, StartupPayload, SyncPayload, ValidationError, ValidationErrorsItem };
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var validationErrorCounter_exports = {};
21
- __export(validationErrorCounter_exports, {
22
- ValidationErrorCounter: () => ValidationErrorCounter,
23
- default: () => ValidationErrorCounter
24
- });
25
- module.exports = __toCommonJS(validationErrorCounter_exports);
26
- var import_node_crypto = require("node:crypto");
27
- const _ValidationErrorCounter = class _ValidationErrorCounter {
28
- errorCounts;
29
- errorDetails;
30
- constructor() {
31
- this.errorCounts = /* @__PURE__ */ new Map();
32
- this.errorDetails = /* @__PURE__ */ new Map();
33
- }
34
- addValidationError(validationError) {
35
- const key = this.getKey(validationError);
36
- if (!this.errorDetails.has(key)) {
37
- this.errorDetails.set(key, validationError);
38
- }
39
- this.errorCounts.set(key, (this.errorCounts.get(key) || 0) + 1);
40
- }
41
- getAndResetValidationErrors() {
42
- const data = [];
43
- this.errorCounts.forEach((count, key) => {
44
- const validationError = this.errorDetails.get(key);
45
- if (validationError) {
46
- data.push({
47
- consumer: validationError.consumer || null,
48
- method: validationError.method,
49
- path: validationError.path,
50
- loc: validationError.loc.split(".").filter(Boolean),
51
- msg: validationError.msg,
52
- type: validationError.type,
53
- error_count: count
54
- });
55
- }
56
- });
57
- this.errorCounts.clear();
58
- this.errorDetails.clear();
59
- return data;
60
- }
61
- getKey(validationError) {
62
- const hashInput = [
63
- validationError.consumer || "",
64
- validationError.method.toUpperCase(),
65
- validationError.path,
66
- validationError.loc.split(".").filter(Boolean),
67
- validationError.msg.trim(),
68
- validationError.type
69
- ].join("|");
70
- return (0, import_node_crypto.createHash)("md5").update(hashInput).digest("hex");
71
- }
72
- };
73
- __name(_ValidationErrorCounter, "ValidationErrorCounter");
74
- let ValidationErrorCounter = _ValidationErrorCounter;
75
- // Annotate the CommonJS export names for ESM import in node:
76
- 0 && (module.exports = {
77
- ValidationErrorCounter
78
- });
79
- //# sourceMappingURL=validationErrorCounter.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/common/validationErrorCounter.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\n\nimport {\n ConsumerMethodPath,\n ValidationError,\n ValidationErrorsItem,\n} from \"./types.js\";\n\nexport default class ValidationErrorCounter {\n private errorCounts: Map<string, number>;\n private errorDetails: Map<string, ConsumerMethodPath & ValidationError>;\n\n constructor() {\n this.errorCounts = new Map();\n this.errorDetails = new Map();\n }\n\n public addValidationError(\n validationError: ConsumerMethodPath & ValidationError,\n ) {\n const key = this.getKey(validationError);\n if (!this.errorDetails.has(key)) {\n this.errorDetails.set(key, validationError);\n }\n this.errorCounts.set(key, (this.errorCounts.get(key) || 0) + 1);\n }\n\n public getAndResetValidationErrors() {\n const data: Array<ValidationErrorsItem> = [];\n this.errorCounts.forEach((count, key) => {\n const validationError = this.errorDetails.get(key);\n if (validationError) {\n data.push({\n consumer: validationError.consumer || null,\n method: validationError.method,\n path: validationError.path,\n loc: validationError.loc.split(\".\").filter(Boolean),\n msg: validationError.msg,\n type: validationError.type,\n error_count: count,\n });\n }\n });\n this.errorCounts.clear();\n this.errorDetails.clear();\n return data;\n }\n\n private getKey(validationError: ConsumerMethodPath & ValidationError) {\n const hashInput = [\n validationError.consumer || \"\",\n validationError.method.toUpperCase(),\n validationError.path,\n validationError.loc.split(\".\").filter(Boolean),\n validationError.msg.trim(),\n validationError.type,\n ].join(\"|\");\n return createHash(\"md5\").update(hashInput).digest(\"hex\");\n }\n}\n\nexport { ValidationErrorCounter };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAAA,yBAA2B;AAQ3B,MAAqBA,0BAArB,MAAqBA,wBAAAA;EACXC;EACAC;EAER,cAAc;AACZ,SAAKD,cAAc,oBAAIE,IAAAA;AACvB,SAAKD,eAAe,oBAAIC,IAAAA;EAC1B;EAEOC,mBACLC,iBACA;AACA,UAAMC,MAAM,KAAKC,OAAOF,eAAAA;AACxB,QAAI,CAAC,KAAKH,aAAaM,IAAIF,GAAAA,GAAM;AAC/B,WAAKJ,aAAaO,IAAIH,KAAKD,eAAAA;IAC7B;AACA,SAAKJ,YAAYQ,IAAIH,MAAM,KAAKL,YAAYS,IAAIJ,GAAAA,KAAQ,KAAK,CAAA;EAC/D;EAEOK,8BAA8B;AACnC,UAAMC,OAAoC,CAAA;AAC1C,SAAKX,YAAYY,QAAQ,CAACC,OAAOR,QAAAA;AAC/B,YAAMD,kBAAkB,KAAKH,aAAaQ,IAAIJ,GAAAA;AAC9C,UAAID,iBAAiB;AACnBO,aAAKG,KAAK;UACRC,UAAUX,gBAAgBW,YAAY;UACtCC,QAAQZ,gBAAgBY;UACxBC,MAAMb,gBAAgBa;UACtBC,KAAKd,gBAAgBc,IAAIC,MAAM,GAAA,EAAKC,OAAOC,OAAAA;UAC3CC,KAAKlB,gBAAgBkB;UACrBC,MAAMnB,gBAAgBmB;UACtBC,aAAaX;QACf,CAAA;MACF;IACF,CAAA;AACA,SAAKb,YAAYyB,MAAK;AACtB,SAAKxB,aAAawB,MAAK;AACvB,WAAOd;EACT;EAEQL,OAAOF,iBAAuD;AACpE,UAAMsB,YAAY;MAChBtB,gBAAgBW,YAAY;MAC5BX,gBAAgBY,OAAOW,YAAW;MAClCvB,gBAAgBa;MAChBb,gBAAgBc,IAAIC,MAAM,GAAA,EAAKC,OAAOC,OAAAA;MACtCjB,gBAAgBkB,IAAIM,KAAI;MACxBxB,gBAAgBmB;MAChBM,KAAK,GAAA;AACP,eAAOC,+BAAW,KAAA,EAAOC,OAAOL,SAAAA,EAAWM,OAAO,KAAA;EACpD;AACF;AAnDqBjC;AAArB,IAAqBA,yBAArB;","names":["ValidationErrorCounter","errorCounts","errorDetails","Map","addValidationError","validationError","key","getKey","has","set","get","getAndResetValidationErrors","data","forEach","count","push","consumer","method","path","loc","split","filter","Boolean","msg","type","error_count","clear","hashInput","toUpperCase","trim","join","createHash","update","digest"]}
@@ -1,20 +0,0 @@
1
- import { ConsumerMethodPath, ValidationError, ValidationErrorsItem } from './types.cjs';
2
- import './logging.cjs';
3
- import 'winston';
4
- import './requestLogger.cjs';
5
- import 'node:buffer';
6
- import 'node:http';
7
- import './spanCollector.cjs';
8
- import '@opentelemetry/sdk-trace-base';
9
- import './tempGzipFile.cjs';
10
-
11
- declare class ValidationErrorCounter {
12
- private errorCounts;
13
- private errorDetails;
14
- constructor();
15
- addValidationError(validationError: ConsumerMethodPath & ValidationError): void;
16
- getAndResetValidationErrors(): ValidationErrorsItem[];
17
- private getKey;
18
- }
19
-
20
- export { ValidationErrorCounter, ValidationErrorCounter as default };