autotel 3.6.0 → 3.7.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 (602) hide show
  1. package/dist/attribute-redacting-processor-DtTS9xxh.d.cts +175 -0
  2. package/dist/attribute-redacting-processor-DtTS9xxh.d.cts.map +1 -0
  3. package/dist/attribute-redacting-processor-DtTS9xxh.d.ts +175 -0
  4. package/dist/attribute-redacting-processor-DtTS9xxh.d.ts.map +1 -0
  5. package/dist/attribute-redacting-processor.cjs +374 -33
  6. package/dist/attribute-redacting-processor.cjs.map +1 -1
  7. package/dist/attribute-redacting-processor.d.cts +2 -207
  8. package/dist/attribute-redacting-processor.d.ts +2 -207
  9. package/dist/attribute-redacting-processor.js +368 -2
  10. package/dist/attribute-redacting-processor.js.map +1 -1
  11. package/dist/attributes-D3etyRVc.cjs +713 -0
  12. package/dist/attributes-D3etyRVc.cjs.map +1 -0
  13. package/dist/attributes-ksn4HVbd.js +600 -0
  14. package/dist/attributes-ksn4HVbd.js.map +1 -0
  15. package/dist/attributes.cjs +21 -85
  16. package/dist/attributes.d.cts +2 -20
  17. package/dist/attributes.d.ts +2 -20
  18. package/dist/attributes.js +3 -5
  19. package/dist/auto.cjs +50 -28
  20. package/dist/auto.cjs.map +1 -1
  21. package/dist/auto.d.cts +1 -2
  22. package/dist/auto.d.ts +1 -2
  23. package/dist/auto.js +49 -23
  24. package/dist/auto.js.map +1 -1
  25. package/dist/business-baggage.cjs +357 -13
  26. package/dist/business-baggage.cjs.map +1 -1
  27. package/dist/business-baggage.d.cts +106 -139
  28. package/dist/business-baggage.d.cts.map +1 -0
  29. package/dist/business-baggage.d.ts +106 -139
  30. package/dist/business-baggage.d.ts.map +1 -0
  31. package/dist/business-baggage.js +357 -2
  32. package/dist/business-baggage.js.map +1 -1
  33. package/dist/canonical-log-line-processor--RlFDHhm.cjs +377 -0
  34. package/dist/canonical-log-line-processor--RlFDHhm.cjs.map +1 -0
  35. package/dist/canonical-log-line-processor-BcRuAdRk.d.ts +147 -0
  36. package/dist/canonical-log-line-processor-BcRuAdRk.d.ts.map +1 -0
  37. package/dist/canonical-log-line-processor-DbBQT5vY.js +366 -0
  38. package/dist/canonical-log-line-processor-DbBQT5vY.js.map +1 -0
  39. package/dist/canonical-log-line-processor-xvjMgtpF.d.cts +147 -0
  40. package/dist/canonical-log-line-processor-xvjMgtpF.d.cts.map +1 -0
  41. package/dist/config.cjs +118 -22
  42. package/dist/config.cjs.map +1 -1
  43. package/dist/config.d.cts +33 -45
  44. package/dist/config.d.cts.map +1 -0
  45. package/dist/config.d.ts +33 -45
  46. package/dist/config.d.ts.map +1 -0
  47. package/dist/config.js +116 -3
  48. package/dist/config.js.map +1 -1
  49. package/dist/correlated-events-Bzh5y-UB.js +28 -0
  50. package/dist/correlated-events-Bzh5y-UB.js.map +1 -0
  51. package/dist/correlated-events-kSwLo3mi.cjs +34 -0
  52. package/dist/correlated-events-kSwLo3mi.cjs.map +1 -0
  53. package/dist/correlation-id.cjs +11 -54
  54. package/dist/correlation-id.d.cts +6 -5
  55. package/dist/correlation-id.d.cts.map +1 -0
  56. package/dist/correlation-id.d.ts +6 -5
  57. package/dist/correlation-id.d.ts.map +1 -0
  58. package/dist/correlation-id.js +3 -17
  59. package/dist/db.cjs +244 -209
  60. package/dist/db.cjs.map +1 -1
  61. package/dist/db.d.cts +28 -26
  62. package/dist/db.d.cts.map +1 -0
  63. package/dist/db.d.ts +28 -26
  64. package/dist/db.d.ts.map +1 -0
  65. package/dist/db.js +243 -207
  66. package/dist/db.js.map +1 -1
  67. package/dist/decorators.cjs +39 -66
  68. package/dist/decorators.cjs.map +1 -1
  69. package/dist/decorators.d.cts +10 -37
  70. package/dist/decorators.d.cts.map +1 -0
  71. package/dist/decorators.d.ts +10 -37
  72. package/dist/decorators.d.ts.map +1 -0
  73. package/dist/decorators.js +38 -64
  74. package/dist/decorators.js.map +1 -1
  75. package/dist/define-event-CreknLm3.d.ts +25 -0
  76. package/dist/define-event-CreknLm3.d.ts.map +1 -0
  77. package/dist/define-event-HZRizPwz.d.cts +25 -0
  78. package/dist/define-event-HZRizPwz.d.cts.map +1 -0
  79. package/dist/drain-pipeline.cjs +111 -9
  80. package/dist/drain-pipeline.cjs.map +1 -1
  81. package/dist/drain-pipeline.d.cts +27 -32
  82. package/dist/drain-pipeline.d.cts.map +1 -0
  83. package/dist/drain-pipeline.d.ts +27 -32
  84. package/dist/drain-pipeline.d.ts.map +1 -0
  85. package/dist/drain-pipeline.js +111 -2
  86. package/dist/drain-pipeline.js.map +1 -1
  87. package/dist/enrichers.cjs +59 -66
  88. package/dist/enrichers.cjs.map +1 -1
  89. package/dist/enrichers.d.cts +15 -13
  90. package/dist/enrichers.d.cts.map +1 -0
  91. package/dist/enrichers.d.ts +15 -13
  92. package/dist/enrichers.d.ts.map +1 -0
  93. package/dist/enrichers.js +58 -65
  94. package/dist/enrichers.js.map +1 -1
  95. package/dist/event-Dlqr4ZNL.cjs +778 -0
  96. package/dist/event-Dlqr4ZNL.cjs.map +1 -0
  97. package/dist/event-_58ryBjh.js +761 -0
  98. package/dist/event-_58ryBjh.js.map +1 -0
  99. package/dist/event-subscriber-D1XLkPzi.d.cts +223 -0
  100. package/dist/event-subscriber-D1XLkPzi.d.cts.map +1 -0
  101. package/dist/event-subscriber-D1XLkPzi.d.ts +223 -0
  102. package/dist/event-subscriber-D1XLkPzi.d.ts.map +1 -0
  103. package/dist/event-subscriber.cjs +0 -6
  104. package/dist/event-subscriber.d.cts +2 -221
  105. package/dist/event-subscriber.d.ts +2 -221
  106. package/dist/event-subscriber.js +1 -3
  107. package/dist/event-testing-BqRnI0z4.d.cts +106 -0
  108. package/dist/event-testing-BqRnI0z4.d.cts.map +1 -0
  109. package/dist/event-testing-CfFs3to2.d.ts +106 -0
  110. package/dist/event-testing-CfFs3to2.d.ts.map +1 -0
  111. package/dist/event-testing.cjs +93 -17
  112. package/dist/event-testing.cjs.map +1 -1
  113. package/dist/event-testing.d.cts +2 -110
  114. package/dist/event-testing.d.ts +2 -110
  115. package/dist/event-testing.js +91 -2
  116. package/dist/event-testing.js.map +1 -1
  117. package/dist/event.cjs +5 -37
  118. package/dist/event.d.cts +295 -340
  119. package/dist/event.d.cts.map +1 -0
  120. package/dist/event.d.ts +295 -340
  121. package/dist/event.d.ts.map +1 -0
  122. package/dist/event.js +3 -21
  123. package/dist/exporters.cjs +12 -16
  124. package/dist/exporters.d.cts +86 -111
  125. package/dist/exporters.d.cts.map +1 -0
  126. package/dist/exporters.d.ts +86 -111
  127. package/dist/exporters.d.ts.map +1 -0
  128. package/dist/exporters.js +4 -4
  129. package/dist/filtering-span-processor-B8R8B7Uk.d.cts +59 -0
  130. package/dist/filtering-span-processor-B8R8B7Uk.d.cts.map +1 -0
  131. package/dist/filtering-span-processor-B8R8B7Uk.d.ts +59 -0
  132. package/dist/filtering-span-processor-B8R8B7Uk.d.ts.map +1 -0
  133. package/dist/filtering-span-processor.cjs +49 -9
  134. package/dist/filtering-span-processor.cjs.map +1 -1
  135. package/dist/filtering-span-processor.d.cts +2 -80
  136. package/dist/filtering-span-processor.d.ts +2 -80
  137. package/dist/filtering-span-processor.js +49 -2
  138. package/dist/filtering-span-processor.js.map +1 -1
  139. package/dist/functional-BGkT8J-h.js +1265 -0
  140. package/dist/functional-BGkT8J-h.js.map +1 -0
  141. package/dist/functional-C4CzoVrX.cjs +1312 -0
  142. package/dist/functional-C4CzoVrX.cjs.map +1 -0
  143. package/dist/functional.cjs +11 -57
  144. package/dist/functional.d.cts +96 -97
  145. package/dist/functional.d.cts.map +1 -0
  146. package/dist/functional.d.ts +96 -97
  147. package/dist/functional.d.ts.map +1 -0
  148. package/dist/functional.js +3 -20
  149. package/dist/http.cjs +276 -176
  150. package/dist/http.cjs.map +1 -1
  151. package/dist/http.d.cts +17 -37
  152. package/dist/http.d.cts.map +1 -0
  153. package/dist/http.d.ts +17 -37
  154. package/dist/http.d.ts.map +1 -0
  155. package/dist/http.js +275 -174
  156. package/dist/http.js.map +1 -1
  157. package/dist/index-CX0aG1Uh.d.ts +708 -0
  158. package/dist/index-CX0aG1Uh.d.ts.map +1 -0
  159. package/dist/index-DIWZFKUS.d.cts +708 -0
  160. package/dist/index-DIWZFKUS.d.cts.map +1 -0
  161. package/dist/index.cjs +1049 -1172
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +401 -551
  164. package/dist/index.d.cts.map +1 -0
  165. package/dist/index.d.ts +401 -551
  166. package/dist/index.d.ts.map +1 -0
  167. package/dist/index.js +912 -714
  168. package/dist/index.js.map +1 -1
  169. package/dist/init-CNp-ee80.d.cts +1157 -0
  170. package/dist/init-CNp-ee80.d.cts.map +1 -0
  171. package/dist/init-Ch6t7MNI.js +1015 -0
  172. package/dist/init-Ch6t7MNI.js.map +1 -0
  173. package/dist/init-DJQOdVlN.d.ts +1157 -0
  174. package/dist/init-DJQOdVlN.d.ts.map +1 -0
  175. package/dist/init-DvapOXCc.cjs +1092 -0
  176. package/dist/init-DvapOXCc.cjs.map +1 -0
  177. package/dist/instrumentation.cjs +159 -185
  178. package/dist/instrumentation.cjs.map +1 -1
  179. package/dist/instrumentation.d.cts +42 -40
  180. package/dist/instrumentation.d.cts.map +1 -0
  181. package/dist/instrumentation.d.ts +42 -40
  182. package/dist/instrumentation.d.ts.map +1 -0
  183. package/dist/instrumentation.js +158 -183
  184. package/dist/instrumentation.js.map +1 -1
  185. package/dist/logger-BauSUhUv.d.cts +313 -0
  186. package/dist/logger-BauSUhUv.d.cts.map +1 -0
  187. package/dist/logger-BauSUhUv.d.ts +313 -0
  188. package/dist/logger-BauSUhUv.d.ts.map +1 -0
  189. package/dist/logger.cjs +225 -25
  190. package/dist/logger.cjs.map +1 -1
  191. package/dist/logger.d.cts +2 -348
  192. package/dist/logger.d.ts +2 -348
  193. package/dist/logger.js +204 -4
  194. package/dist/logger.js.map +1 -1
  195. package/dist/messaging-adapters.cjs +292 -187
  196. package/dist/messaging-adapters.cjs.map +1 -1
  197. package/dist/messaging-adapters.d.cts +28 -66
  198. package/dist/messaging-adapters.d.cts.map +1 -0
  199. package/dist/messaging-adapters.d.ts +28 -66
  200. package/dist/messaging-adapters.d.ts.map +1 -0
  201. package/dist/messaging-adapters.js +291 -185
  202. package/dist/messaging-adapters.js.map +1 -1
  203. package/dist/messaging-testing.cjs +306 -372
  204. package/dist/messaging-testing.cjs.map +1 -1
  205. package/dist/messaging-testing.d.cts +194 -223
  206. package/dist/messaging-testing.d.cts.map +1 -0
  207. package/dist/messaging-testing.d.ts +194 -223
  208. package/dist/messaging-testing.d.ts.map +1 -0
  209. package/dist/messaging-testing.js +305 -371
  210. package/dist/messaging-testing.js.map +1 -1
  211. package/dist/messaging.cjs +757 -36
  212. package/dist/messaging.cjs.map +1 -1
  213. package/dist/messaging.d.cts +603 -644
  214. package/dist/messaging.d.cts.map +1 -0
  215. package/dist/messaging.d.ts +603 -644
  216. package/dist/messaging.d.ts.map +1 -0
  217. package/dist/messaging.js +756 -21
  218. package/dist/messaging.js.map +1 -1
  219. package/dist/metric-helpers.cjs +27 -27
  220. package/dist/metric-helpers.cjs.map +1 -1
  221. package/dist/metric-helpers.d.cts +4 -2
  222. package/dist/metric-helpers.d.cts.map +1 -0
  223. package/dist/metric-helpers.d.ts +4 -2
  224. package/dist/metric-helpers.d.ts.map +1 -0
  225. package/dist/metric-helpers.js +24 -4
  226. package/dist/metric-helpers.js.map +1 -1
  227. package/dist/metric-testing-DXdK3-Q3.d.ts +106 -0
  228. package/dist/metric-testing-DXdK3-Q3.d.ts.map +1 -0
  229. package/dist/metric-testing-MxvzChDp.d.cts +106 -0
  230. package/dist/metric-testing-MxvzChDp.d.cts.map +1 -0
  231. package/dist/metric-testing.cjs +93 -17
  232. package/dist/metric-testing.cjs.map +1 -1
  233. package/dist/metric-testing.d.cts +2 -110
  234. package/dist/metric-testing.d.ts +2 -110
  235. package/dist/metric-testing.js +91 -2
  236. package/dist/metric-testing.js.map +1 -1
  237. package/dist/metric.cjs +306 -22
  238. package/dist/metric.cjs.map +1 -1
  239. package/dist/metric.d.cts +170 -198
  240. package/dist/metric.d.cts.map +1 -0
  241. package/dist/metric.d.ts +170 -198
  242. package/dist/metric.d.ts.map +1 -0
  243. package/dist/metric.js +277 -7
  244. package/dist/metric.js.map +1 -1
  245. package/dist/node-require-DF5QBX6z.cjs +99 -0
  246. package/dist/node-require-DF5QBX6z.cjs.map +1 -0
  247. package/dist/node-require-Db1oDpLj.js +88 -0
  248. package/dist/node-require-Db1oDpLj.js.map +1 -0
  249. package/dist/operation-context-C-2hmmtP.js +59 -0
  250. package/dist/operation-context-C-2hmmtP.js.map +1 -0
  251. package/dist/operation-context-n4_obUwq.cjs +70 -0
  252. package/dist/operation-context-n4_obUwq.cjs.map +1 -0
  253. package/dist/parse-error.cjs +55 -9
  254. package/dist/parse-error.cjs.map +1 -1
  255. package/dist/parse-error.d.cts +12 -10
  256. package/dist/parse-error.d.cts.map +1 -0
  257. package/dist/parse-error.d.ts +12 -10
  258. package/dist/parse-error.d.ts.map +1 -0
  259. package/dist/parse-error.js +55 -2
  260. package/dist/parse-error.js.map +1 -1
  261. package/dist/pretty-console-exporter-CMzlrRNg.cjs +232 -0
  262. package/dist/pretty-console-exporter-CMzlrRNg.cjs.map +1 -0
  263. package/dist/pretty-console-exporter-DqKl_q9z.js +227 -0
  264. package/dist/pretty-console-exporter-DqKl_q9z.js.map +1 -0
  265. package/dist/processors.cjs +13 -17
  266. package/dist/processors.d.cts +3 -171
  267. package/dist/processors.d.ts +3 -171
  268. package/dist/processors.js +4 -4
  269. package/dist/register.cjs +35 -6
  270. package/dist/register.cjs.map +1 -1
  271. package/dist/register.d.cts +1 -2
  272. package/dist/register.d.ts +1 -2
  273. package/dist/register.js +36 -3
  274. package/dist/register.js.map +1 -1
  275. package/dist/registry-DfXA3R1L.js +184 -0
  276. package/dist/registry-DfXA3R1L.js.map +1 -0
  277. package/dist/registry-JZg2J3RZ.cjs +334 -0
  278. package/dist/registry-JZg2J3RZ.cjs.map +1 -0
  279. package/dist/sampling-CR0Va1VB.d.ts +351 -0
  280. package/dist/sampling-CR0Va1VB.d.ts.map +1 -0
  281. package/dist/sampling-DfYhDJij.d.cts +351 -0
  282. package/dist/sampling-DfYhDJij.d.cts.map +1 -0
  283. package/dist/sampling.cjs +452 -60
  284. package/dist/sampling.cjs.map +1 -1
  285. package/dist/sampling.d.cts +2 -379
  286. package/dist/sampling.d.ts +2 -379
  287. package/dist/sampling.js +441 -5
  288. package/dist/sampling.js.map +1 -1
  289. package/dist/security-schema.cjs +65 -46
  290. package/dist/security-schema.cjs.map +1 -1
  291. package/dist/security-schema.d.cts +23 -26
  292. package/dist/security-schema.d.cts.map +1 -0
  293. package/dist/security-schema.d.ts +23 -26
  294. package/dist/security-schema.d.ts.map +1 -0
  295. package/dist/security-schema.js +64 -45
  296. package/dist/security-schema.js.map +1 -1
  297. package/dist/semantic-conventions-FhSxv-bK.d.cts +32 -0
  298. package/dist/semantic-conventions-FhSxv-bK.d.cts.map +1 -0
  299. package/dist/semantic-conventions-FhSxv-bK.d.ts +32 -0
  300. package/dist/semantic-conventions-FhSxv-bK.d.ts.map +1 -0
  301. package/dist/semantic-conventions.cjs +15 -26
  302. package/dist/semantic-conventions.cjs.map +1 -1
  303. package/dist/semantic-conventions.d.cts +2 -29
  304. package/dist/semantic-conventions.d.ts +2 -29
  305. package/dist/semantic-conventions.js +12 -3
  306. package/dist/semantic-conventions.js.map +1 -1
  307. package/dist/semantic-helpers.cjs +440 -39
  308. package/dist/semantic-helpers.cjs.map +1 -1
  309. package/dist/semantic-helpers.d.cts +38 -45
  310. package/dist/semantic-helpers.d.cts.map +1 -0
  311. package/dist/semantic-helpers.d.ts +38 -45
  312. package/dist/semantic-helpers.d.ts.map +1 -0
  313. package/dist/semantic-helpers.js +438 -20
  314. package/dist/semantic-helpers.js.map +1 -1
  315. package/dist/span-name-normalizer-8ZOGJuwv.d.cts +70 -0
  316. package/dist/span-name-normalizer-8ZOGJuwv.d.cts.map +1 -0
  317. package/dist/span-name-normalizer-8ZOGJuwv.d.ts +70 -0
  318. package/dist/span-name-normalizer-8ZOGJuwv.d.ts.map +1 -0
  319. package/dist/span-name-normalizer.cjs +95 -17
  320. package/dist/span-name-normalizer.cjs.map +1 -1
  321. package/dist/span-name-normalizer.d.cts +2 -94
  322. package/dist/span-name-normalizer.d.ts +2 -94
  323. package/dist/span-name-normalizer.js +93 -2
  324. package/dist/span-name-normalizer.js.map +1 -1
  325. package/dist/stable-hash-BNTMrmdB.cjs +28 -0
  326. package/dist/stable-hash-BNTMrmdB.cjs.map +1 -0
  327. package/dist/stable-hash-Cg5cT34Q.js +23 -0
  328. package/dist/stable-hash-Cg5cT34Q.js.map +1 -0
  329. package/dist/structured-error-9--cxBay.js +143 -0
  330. package/dist/structured-error-9--cxBay.js.map +1 -0
  331. package/dist/structured-error-CHg7DoIQ.cjs +178 -0
  332. package/dist/structured-error-CHg7DoIQ.cjs.map +1 -0
  333. package/dist/tail-sampling-processor.cjs +26 -13
  334. package/dist/tail-sampling-processor.cjs.map +1 -1
  335. package/dist/tail-sampling-processor.d.cts +11 -23
  336. package/dist/tail-sampling-processor.d.cts.map +1 -0
  337. package/dist/tail-sampling-processor.d.ts +11 -23
  338. package/dist/tail-sampling-processor.d.ts.map +1 -0
  339. package/dist/tail-sampling-processor.js +27 -6
  340. package/dist/tail-sampling-processor.js.map +1 -1
  341. package/dist/test-span-collector.cjs +70 -72
  342. package/dist/test-span-collector.cjs.map +1 -1
  343. package/dist/test-span-collector.d.cts +25 -43
  344. package/dist/test-span-collector.d.cts.map +1 -0
  345. package/dist/test-span-collector.d.ts +25 -43
  346. package/dist/test-span-collector.d.ts.map +1 -0
  347. package/dist/test-span-collector.js +69 -70
  348. package/dist/test-span-collector.js.map +1 -1
  349. package/dist/testing.cjs +389 -278
  350. package/dist/testing.cjs.map +1 -1
  351. package/dist/testing.d.cts +39 -62
  352. package/dist/testing.d.cts.map +1 -0
  353. package/dist/testing.d.ts +39 -62
  354. package/dist/testing.d.ts.map +1 -0
  355. package/dist/testing.js +386 -265
  356. package/dist/testing.js.map +1 -1
  357. package/dist/trace-context-Cijqoi6e.d.cts +212 -0
  358. package/dist/trace-context-Cijqoi6e.d.cts.map +1 -0
  359. package/dist/trace-context-Cijqoi6e.d.ts +212 -0
  360. package/dist/trace-context-Cijqoi6e.d.ts.map +1 -0
  361. package/dist/trace-helpers.cjs +634 -54
  362. package/dist/trace-helpers.cjs.map +1 -1
  363. package/dist/trace-helpers.d.cts +17 -49
  364. package/dist/trace-helpers.d.cts.map +1 -0
  365. package/dist/trace-helpers.d.ts +17 -49
  366. package/dist/trace-helpers.d.ts.map +1 -0
  367. package/dist/trace-helpers.js +624 -3
  368. package/dist/trace-helpers.js.map +1 -1
  369. package/dist/tracer-provider.cjs +227 -16
  370. package/dist/tracer-provider.cjs.map +1 -1
  371. package/dist/tracer-provider.d.cts +5 -4
  372. package/dist/tracer-provider.d.cts.map +1 -0
  373. package/dist/tracer-provider.d.ts +5 -4
  374. package/dist/tracer-provider.d.ts.map +1 -0
  375. package/dist/tracer-provider.js +227 -2
  376. package/dist/tracer-provider.js.map +1 -1
  377. package/dist/track-3HY4NGV-.cjs +1212 -0
  378. package/dist/track-3HY4NGV-.cjs.map +1 -0
  379. package/dist/track-nsKVy-pj.js +1111 -0
  380. package/dist/track-nsKVy-pj.js.map +1 -0
  381. package/dist/validate.cjs +178 -115
  382. package/dist/validate.cjs.map +1 -1
  383. package/dist/validate.d.cts +40 -64
  384. package/dist/validate.d.cts.map +1 -0
  385. package/dist/validate.d.ts +40 -64
  386. package/dist/validate.d.ts.map +1 -0
  387. package/dist/validate.js +177 -113
  388. package/dist/validate.js.map +1 -1
  389. package/dist/validation-attributes.cjs +42 -17
  390. package/dist/validation-attributes.cjs.map +1 -1
  391. package/dist/validation-attributes.d.cts +13 -20
  392. package/dist/validation-attributes.d.cts.map +1 -0
  393. package/dist/validation-attributes.d.ts +13 -20
  394. package/dist/validation-attributes.d.ts.map +1 -0
  395. package/dist/validation-attributes.js +40 -2
  396. package/dist/validation-attributes.js.map +1 -1
  397. package/dist/webhook.cjs +286 -256
  398. package/dist/webhook.cjs.map +1 -1
  399. package/dist/webhook.d.cts +157 -192
  400. package/dist/webhook.d.cts.map +1 -0
  401. package/dist/webhook.d.ts +157 -192
  402. package/dist/webhook.d.ts.map +1 -0
  403. package/dist/webhook.js +285 -254
  404. package/dist/webhook.js.map +1 -1
  405. package/dist/workflow-distributed.cjs +498 -412
  406. package/dist/workflow-distributed.cjs.map +1 -1
  407. package/dist/workflow-distributed.d.cts +163 -173
  408. package/dist/workflow-distributed.d.cts.map +1 -0
  409. package/dist/workflow-distributed.d.ts +163 -173
  410. package/dist/workflow-distributed.d.ts.map +1 -0
  411. package/dist/workflow-distributed.js +497 -410
  412. package/dist/workflow-distributed.js.map +1 -1
  413. package/dist/workflow.cjs +405 -40
  414. package/dist/workflow.cjs.map +1 -1
  415. package/dist/workflow.d.cts +78 -131
  416. package/dist/workflow.d.cts.map +1 -0
  417. package/dist/workflow.d.ts +78 -131
  418. package/dist/workflow.d.ts.map +1 -0
  419. package/dist/workflow.js +403 -21
  420. package/dist/workflow.js.map +1 -1
  421. package/dist/yaml-config-B3dQ82GR.cjs +272 -0
  422. package/dist/yaml-config-B3dQ82GR.cjs.map +1 -0
  423. package/dist/yaml-config.cjs +5 -24
  424. package/dist/yaml-config.d.cts +30 -64
  425. package/dist/yaml-config.d.cts.map +1 -0
  426. package/dist/yaml-config.d.ts +30 -64
  427. package/dist/yaml-config.d.ts.map +1 -0
  428. package/dist/yaml-config.js +226 -7
  429. package/dist/yaml-config.js.map +1 -1
  430. package/package.json +4 -4
  431. package/src/index.ts +3 -0
  432. package/src/request-logger.test.ts +53 -1
  433. package/src/request-logger.ts +58 -0
  434. package/src/validate.test.ts +3 -1
  435. package/src/validate.ts +9 -3
  436. package/dist/attributes.cjs.map +0 -1
  437. package/dist/attributes.js.map +0 -1
  438. package/dist/chunk-2ZKEORFN.cjs +0 -14
  439. package/dist/chunk-2ZKEORFN.cjs.map +0 -1
  440. package/dist/chunk-3QXBFGKP.js +0 -344
  441. package/dist/chunk-3QXBFGKP.js.map +0 -1
  442. package/dist/chunk-454CH4OV.js +0 -744
  443. package/dist/chunk-454CH4OV.js.map +0 -1
  444. package/dist/chunk-4A53YIAX.js +0 -180
  445. package/dist/chunk-4A53YIAX.js.map +0 -1
  446. package/dist/chunk-4IFSYQVX.js +0 -337
  447. package/dist/chunk-4IFSYQVX.js.map +0 -1
  448. package/dist/chunk-4P6ZOARG.cjs +0 -33
  449. package/dist/chunk-4P6ZOARG.cjs.map +0 -1
  450. package/dist/chunk-55ER2KD5.js +0 -228
  451. package/dist/chunk-55ER2KD5.js.map +0 -1
  452. package/dist/chunk-5ZN622AO.js +0 -73
  453. package/dist/chunk-5ZN622AO.js.map +0 -1
  454. package/dist/chunk-66YJ66GG.js +0 -1021
  455. package/dist/chunk-66YJ66GG.js.map +0 -1
  456. package/dist/chunk-6S5RUKU3.cjs +0 -347
  457. package/dist/chunk-6S5RUKU3.cjs.map +0 -1
  458. package/dist/chunk-6UQRVUN3.js +0 -222
  459. package/dist/chunk-6UQRVUN3.js.map +0 -1
  460. package/dist/chunk-7552UTQW.js +0 -11
  461. package/dist/chunk-7552UTQW.js.map +0 -1
  462. package/dist/chunk-7EQ4G4SI.cjs +0 -146
  463. package/dist/chunk-7EQ4G4SI.cjs.map +0 -1
  464. package/dist/chunk-7SAWIN74.js +0 -285
  465. package/dist/chunk-7SAWIN74.js.map +0 -1
  466. package/dist/chunk-A4E5AQFK.js +0 -30
  467. package/dist/chunk-A4E5AQFK.js.map +0 -1
  468. package/dist/chunk-ALPYR2GC.js +0 -1061
  469. package/dist/chunk-ALPYR2GC.js.map +0 -1
  470. package/dist/chunk-B7SWBE4P.cjs +0 -799
  471. package/dist/chunk-B7SWBE4P.cjs.map +0 -1
  472. package/dist/chunk-BZHG5IZ4.js +0 -73
  473. package/dist/chunk-BZHG5IZ4.js.map +0 -1
  474. package/dist/chunk-CEAQK2QY.cjs +0 -32
  475. package/dist/chunk-CEAQK2QY.cjs.map +0 -1
  476. package/dist/chunk-CMHVQR6P.js +0 -170
  477. package/dist/chunk-CMHVQR6P.js.map +0 -1
  478. package/dist/chunk-CU6IDACR.cjs +0 -224
  479. package/dist/chunk-CU6IDACR.cjs.map +0 -1
  480. package/dist/chunk-D4TM63S3.js +0 -795
  481. package/dist/chunk-D4TM63S3.js.map +0 -1
  482. package/dist/chunk-DCEDJQGG.js +0 -28
  483. package/dist/chunk-DCEDJQGG.js.map +0 -1
  484. package/dist/chunk-DPSA4QLA.js +0 -344
  485. package/dist/chunk-DPSA4QLA.js.map +0 -1
  486. package/dist/chunk-E6TERL5O.cjs +0 -23
  487. package/dist/chunk-E6TERL5O.cjs.map +0 -1
  488. package/dist/chunk-EE6CPXKH.cjs +0 -164
  489. package/dist/chunk-EE6CPXKH.cjs.map +0 -1
  490. package/dist/chunk-EOFB7XCL.cjs +0 -837
  491. package/dist/chunk-EOFB7XCL.cjs.map +0 -1
  492. package/dist/chunk-ESLWRGAG.cjs +0 -92
  493. package/dist/chunk-ESLWRGAG.cjs.map +0 -1
  494. package/dist/chunk-ESMHTKLJ.cjs +0 -206
  495. package/dist/chunk-ESMHTKLJ.cjs.map +0 -1
  496. package/dist/chunk-FMTHVSYY.cjs +0 -1039
  497. package/dist/chunk-FMTHVSYY.cjs.map +0 -1
  498. package/dist/chunk-FU6R566Y.cjs +0 -236
  499. package/dist/chunk-FU6R566Y.cjs.map +0 -1
  500. package/dist/chunk-GYR5K654.js +0 -91
  501. package/dist/chunk-GYR5K654.js.map +0 -1
  502. package/dist/chunk-HA2WBOGQ.js +0 -57
  503. package/dist/chunk-HA2WBOGQ.js.map +0 -1
  504. package/dist/chunk-HT5JQKN2.js +0 -118
  505. package/dist/chunk-HT5JQKN2.js.map +0 -1
  506. package/dist/chunk-INJD3G4K.cjs +0 -340
  507. package/dist/chunk-INJD3G4K.cjs.map +0 -1
  508. package/dist/chunk-IOYFAFHJ.cjs +0 -95
  509. package/dist/chunk-IOYFAFHJ.cjs.map +0 -1
  510. package/dist/chunk-J5QENANM.js +0 -87
  511. package/dist/chunk-J5QENANM.js.map +0 -1
  512. package/dist/chunk-J7VGRIAJ.js +0 -64
  513. package/dist/chunk-J7VGRIAJ.js.map +0 -1
  514. package/dist/chunk-KFOHQK7X.js +0 -144
  515. package/dist/chunk-KFOHQK7X.js.map +0 -1
  516. package/dist/chunk-KIL5CUN6.js +0 -31
  517. package/dist/chunk-KIL5CUN6.js.map +0 -1
  518. package/dist/chunk-KYXZS3EA.cjs +0 -100
  519. package/dist/chunk-KYXZS3EA.cjs.map +0 -1
  520. package/dist/chunk-LITNXTTT.js +0 -3
  521. package/dist/chunk-LITNXTTT.js.map +0 -1
  522. package/dist/chunk-LVIPBYFE.js +0 -157
  523. package/dist/chunk-LVIPBYFE.js.map +0 -1
  524. package/dist/chunk-M3LFHHTN.cjs +0 -764
  525. package/dist/chunk-M3LFHHTN.cjs.map +0 -1
  526. package/dist/chunk-N25JDZSC.js +0 -95
  527. package/dist/chunk-N25JDZSC.js.map +0 -1
  528. package/dist/chunk-NEIB3TLD.cjs +0 -360
  529. package/dist/chunk-NEIB3TLD.cjs.map +0 -1
  530. package/dist/chunk-NENU7E6V.cjs +0 -344
  531. package/dist/chunk-NENU7E6V.cjs.map +0 -1
  532. package/dist/chunk-NVAI5CCN.cjs +0 -39
  533. package/dist/chunk-NVAI5CCN.cjs.map +0 -1
  534. package/dist/chunk-NZ72VDNY.cjs +0 -4
  535. package/dist/chunk-NZ72VDNY.cjs.map +0 -1
  536. package/dist/chunk-OPPXYVEZ.cjs +0 -131
  537. package/dist/chunk-OPPXYVEZ.cjs.map +0 -1
  538. package/dist/chunk-Q4EULJQY.js +0 -35
  539. package/dist/chunk-Q4EULJQY.js.map +0 -1
  540. package/dist/chunk-QF7ARNUM.js +0 -339
  541. package/dist/chunk-QF7ARNUM.js.map +0 -1
  542. package/dist/chunk-QWW3E3JM.cjs +0 -178
  543. package/dist/chunk-QWW3E3JM.cjs.map +0 -1
  544. package/dist/chunk-R7QYGZUP.cjs +0 -1075
  545. package/dist/chunk-R7QYGZUP.cjs.map +0 -1
  546. package/dist/chunk-RUPKBKUF.js +0 -352
  547. package/dist/chunk-RUPKBKUF.js.map +0 -1
  548. package/dist/chunk-SEO6NAQT.js +0 -14
  549. package/dist/chunk-SEO6NAQT.js.map +0 -1
  550. package/dist/chunk-T4B5LB6E.cjs +0 -66
  551. package/dist/chunk-T4B5LB6E.cjs.map +0 -1
  552. package/dist/chunk-T5WRA76K.cjs +0 -32
  553. package/dist/chunk-T5WRA76K.cjs.map +0 -1
  554. package/dist/chunk-T7JO2TCP.js +0 -1233
  555. package/dist/chunk-T7JO2TCP.js.map +0 -1
  556. package/dist/chunk-TC5ZPWM4.cjs +0 -289
  557. package/dist/chunk-TC5ZPWM4.cjs.map +0 -1
  558. package/dist/chunk-TQ5UWA7S.js +0 -26
  559. package/dist/chunk-TQ5UWA7S.js.map +0 -1
  560. package/dist/chunk-UIKYE2QZ.js +0 -833
  561. package/dist/chunk-UIKYE2QZ.js.map +0 -1
  562. package/dist/chunk-UNPLAVE7.js +0 -21
  563. package/dist/chunk-UNPLAVE7.js.map +0 -1
  564. package/dist/chunk-UY3UYPBZ.cjs +0 -77
  565. package/dist/chunk-UY3UYPBZ.cjs.map +0 -1
  566. package/dist/chunk-V7UBMJAB.cjs +0 -1242
  567. package/dist/chunk-V7UBMJAB.cjs.map +0 -1
  568. package/dist/chunk-VH77IPJN.cjs +0 -358
  569. package/dist/chunk-VH77IPJN.cjs.map +0 -1
  570. package/dist/chunk-VQTCQKHQ.cjs +0 -17
  571. package/dist/chunk-VQTCQKHQ.cjs.map +0 -1
  572. package/dist/chunk-WGWSHJ2N.js +0 -38
  573. package/dist/chunk-WGWSHJ2N.js.map +0 -1
  574. package/dist/chunk-WJH6IYU2.cjs +0 -32
  575. package/dist/chunk-WJH6IYU2.cjs.map +0 -1
  576. package/dist/chunk-YREV3LGG.cjs +0 -61
  577. package/dist/chunk-YREV3LGG.cjs.map +0 -1
  578. package/dist/chunk-YTXEZ4SD.cjs +0 -77
  579. package/dist/chunk-YTXEZ4SD.cjs.map +0 -1
  580. package/dist/chunk-ZNMBW67B.cjs +0 -40
  581. package/dist/chunk-ZNMBW67B.cjs.map +0 -1
  582. package/dist/correlation-id.cjs.map +0 -1
  583. package/dist/correlation-id.js.map +0 -1
  584. package/dist/define-event-BL6Li7CM.d.ts +0 -23
  585. package/dist/define-event-ClP3T1Jx.d.cts +0 -23
  586. package/dist/event-subscriber.cjs.map +0 -1
  587. package/dist/event-subscriber.js.map +0 -1
  588. package/dist/event.cjs.map +0 -1
  589. package/dist/event.js.map +0 -1
  590. package/dist/exporters.cjs.map +0 -1
  591. package/dist/exporters.js.map +0 -1
  592. package/dist/functional.cjs.map +0 -1
  593. package/dist/functional.js.map +0 -1
  594. package/dist/init-DIowiiCh.d.ts +0 -1167
  595. package/dist/init-j-A1zI16.d.cts +0 -1167
  596. package/dist/processors.cjs.map +0 -1
  597. package/dist/processors.js.map +0 -1
  598. package/dist/trace-context-DbGKd1Rn.d.cts +0 -213
  599. package/dist/trace-context-DbGKd1Rn.d.ts +0 -213
  600. package/dist/utils-BahBCFtJ.d.cts +0 -712
  601. package/dist/utils-CLKwaUlG.d.ts +0 -712
  602. package/dist/yaml-config.cjs.map +0 -1
@@ -1,1021 +0,0 @@
1
- import { recordStructuredError } from './chunk-LVIPBYFE.js';
2
- import { getValidationConfig, isInitialized, warnIfNotInitialized, getConfig, getEventsConfig, getLogger } from './chunk-ALPYR2GC.js';
3
- import { getConfig as getConfig$1 } from './chunk-J5QENANM.js';
4
- import { trace, context, propagation } from '@opentelemetry/api';
5
- import { AsyncLocalStorage } from 'async_hooks';
6
-
7
- // src/rate-limiter.ts
8
- var TokenBucketRateLimiter = class {
9
- tokens;
10
- maxTokens;
11
- refillRate;
12
- // tokens per millisecond
13
- lastRefill;
14
- constructor(config) {
15
- this.maxTokens = config.burstCapacity || config.maxEventsPerSecond * 2;
16
- this.tokens = this.maxTokens;
17
- this.refillRate = config.maxEventsPerSecond / 1e3;
18
- this.lastRefill = Date.now();
19
- }
20
- /**
21
- * Try to consume a token (allow an event)
22
- * Returns true if allowed, false if rate limit exceeded
23
- */
24
- tryConsume(count = 1) {
25
- this.refill();
26
- if (this.tokens >= count) {
27
- this.tokens -= count;
28
- return true;
29
- }
30
- return false;
31
- }
32
- /**
33
- * Wait until a token is available (async rate limiting)
34
- * Returns a promise that resolves when the event can be processed
35
- */
36
- async waitForToken(count = 1) {
37
- this.refill();
38
- if (this.tokens >= count) {
39
- this.tokens -= count;
40
- return;
41
- }
42
- const tokensNeeded = count - this.tokens;
43
- const waitMs = Math.ceil(tokensNeeded / this.refillRate);
44
- await new Promise((resolve) => setTimeout(resolve, waitMs));
45
- return this.waitForToken(count);
46
- }
47
- /**
48
- * Refill tokens based on elapsed time
49
- */
50
- refill() {
51
- const now = Date.now();
52
- const elapsed = now - this.lastRefill;
53
- const tokensToAdd = elapsed * this.refillRate;
54
- this.tokens = Math.min(this.maxTokens, this.tokens + tokensToAdd);
55
- this.lastRefill = now;
56
- }
57
- /**
58
- * Get current available tokens (for testing/debugging)
59
- */
60
- getAvailableTokens() {
61
- this.refill();
62
- return Math.floor(this.tokens);
63
- }
64
- /**
65
- * Reset the rate limiter (for testing)
66
- */
67
- reset() {
68
- this.tokens = this.maxTokens;
69
- this.lastRefill = Date.now();
70
- }
71
- };
72
-
73
- // src/event-queue.ts
74
- var DEFAULT_CONFIG = {
75
- maxSize: 5e4,
76
- batchSize: 100,
77
- flushInterval: 1e4,
78
- maxRetries: 3,
79
- rateLimit: {
80
- maxEventsPerSecond: 100,
81
- burstCapacity: 200
82
- }
83
- };
84
- function getSubscriberName(subscriber) {
85
- if (subscriber.name) {
86
- return subscriber.name.toLowerCase();
87
- }
88
- const className = subscriber.constructor?.name || "unknown";
89
- return className.replace(/Subscriber$/i, "").toLowerCase();
90
- }
91
- var EventQueue = class {
92
- queue = [];
93
- flushTimer = null;
94
- config;
95
- subscribers;
96
- rateLimiter;
97
- flushPromise = null;
98
- isShuttingDown = false;
99
- // Metrics
100
- metrics = null;
101
- // Observable callback cleanup functions
102
- observableCleanups = [];
103
- // Subscriber health tracking (for observable gauges)
104
- subscriberHealthy = /* @__PURE__ */ new Map();
105
- constructor(subscribers, config) {
106
- this.subscribers = subscribers;
107
- this.config = { ...DEFAULT_CONFIG, ...config };
108
- this.rateLimiter = this.config.rateLimit ? new TokenBucketRateLimiter(this.config.rateLimit) : null;
109
- for (const subscriber of subscribers) {
110
- const name = getSubscriberName(subscriber);
111
- this.subscriberHealthy.set(name, true);
112
- }
113
- this.initMetrics();
114
- }
115
- /**
116
- * Initialize OTel metrics for queue observability
117
- */
118
- initMetrics() {
119
- const runtimeConfig = getConfig$1();
120
- const meter = runtimeConfig.meter;
121
- const queueSize = meter.createObservableGauge(
122
- "autotel.event_delivery.queue.size",
123
- {
124
- description: "Current number of events in the delivery queue",
125
- unit: "count"
126
- }
127
- );
128
- const queueSizeCallback = (observableResult) => {
129
- observableResult.observe(this.queue.length);
130
- };
131
- queueSize.addCallback(queueSizeCallback);
132
- this.observableCleanups.push(
133
- () => queueSize.removeCallback(queueSizeCallback)
134
- );
135
- const oldestAge = meter.createObservableGauge(
136
- "autotel.event_delivery.queue.oldest_age_ms",
137
- {
138
- description: "Age of the oldest event in the queue in milliseconds",
139
- unit: "ms"
140
- }
141
- );
142
- const oldestAgeCallback = (observableResult) => {
143
- if (this.queue.length > 0) {
144
- const oldest = this.queue[0];
145
- const ageMs = Date.now() - oldest.timestamp;
146
- observableResult.observe(ageMs);
147
- } else {
148
- observableResult.observe(0);
149
- }
150
- };
151
- oldestAge.addCallback(oldestAgeCallback);
152
- this.observableCleanups.push(
153
- () => oldestAge.removeCallback(oldestAgeCallback)
154
- );
155
- const delivered = meter.createCounter(
156
- "autotel.event_delivery.queue.delivered",
157
- {
158
- description: "Number of events successfully delivered to subscribers",
159
- unit: "count"
160
- }
161
- );
162
- const failed = meter.createCounter("autotel.event_delivery.queue.failed", {
163
- description: "Number of events that failed delivery after all retry attempts",
164
- unit: "count"
165
- });
166
- const dropped = meter.createCounter(
167
- "autotel.event_delivery.queue.dropped",
168
- {
169
- description: "Number of events dropped from the queue",
170
- unit: "count"
171
- }
172
- );
173
- const latency = meter.createHistogram(
174
- "autotel.event_delivery.queue.latency_ms",
175
- {
176
- description: "Event delivery latency from enqueue to successful send",
177
- unit: "ms"
178
- }
179
- );
180
- const subscriberHealth = meter.createObservableGauge(
181
- "autotel.event_delivery.subscriber.health",
182
- {
183
- description: "Subscriber health status (1=healthy, 0=unhealthy)",
184
- unit: "1"
185
- }
186
- );
187
- const subscriberHealthCallback = (observableResult) => {
188
- for (const [subscriberName, isHealthy] of this.subscriberHealthy) {
189
- observableResult.observe(isHealthy ? 1 : 0, {
190
- subscriber: subscriberName
191
- });
192
- }
193
- };
194
- subscriberHealth.addCallback(subscriberHealthCallback);
195
- this.observableCleanups.push(
196
- () => subscriberHealth.removeCallback(subscriberHealthCallback)
197
- );
198
- this.metrics = {
199
- queueSize,
200
- oldestAge,
201
- delivered,
202
- failed,
203
- dropped,
204
- latency,
205
- subscriberHealth
206
- };
207
- }
208
- /**
209
- * Record a dropped event with reason and emit debug breadcrumb
210
- */
211
- recordDropped(reason, event, subscriberName) {
212
- const attrs = { reason };
213
- if (subscriberName) {
214
- attrs.subscriber = subscriberName;
215
- }
216
- this.metrics?.dropped.add(1, attrs);
217
- const logLevel = reason === "payload_invalid" ? "error" : "warn";
218
- const logger = getLogger();
219
- if (logLevel === "error") {
220
- logger.error(
221
- {
222
- eventName: event?.name,
223
- subscriber: subscriberName,
224
- reason,
225
- correlationId: event?._correlationId,
226
- traceId: event?._traceId
227
- },
228
- `[autotel] Event dropped: ${reason}`
229
- );
230
- } else {
231
- logger.warn(
232
- {
233
- eventName: event?.name,
234
- subscriber: subscriberName,
235
- reason,
236
- correlationId: event?._correlationId,
237
- traceId: event?._traceId
238
- },
239
- `[autotel] Event dropped: ${reason}`
240
- );
241
- }
242
- }
243
- /**
244
- * Record permanent delivery failure (after all retries exhausted)
245
- * Increments failed counter and logs error
246
- */
247
- recordFailed(event, subscriberName, error) {
248
- this.metrics?.failed.add(1, { subscriber: subscriberName });
249
- this.subscriberHealthy.set(subscriberName, false);
250
- getLogger().error(
251
- {
252
- eventName: event.name,
253
- subscriber: subscriberName,
254
- correlationId: event._correlationId,
255
- traceId: event._traceId,
256
- err: error
257
- },
258
- `[autotel] Event delivery failed after all retries`
259
- );
260
- }
261
- /**
262
- * Mark subscriber as unhealthy on transient failure (without incrementing failed counter)
263
- * Used during retry attempts - only recordFailed should increment the counter
264
- */
265
- markSubscriberUnhealthy(subscriberName) {
266
- this.subscriberHealthy.set(subscriberName, false);
267
- }
268
- /**
269
- * Record successful delivery
270
- */
271
- recordDelivered(event, subscriberName, startTime) {
272
- const latencyMs = Date.now() - startTime;
273
- this.metrics?.delivered.add(1, { subscriber: subscriberName });
274
- this.metrics?.latency.record(latencyMs, { subscriber: subscriberName });
275
- this.subscriberHealthy.set(subscriberName, true);
276
- }
277
- /**
278
- * Enqueue an event for sending
279
- *
280
- * Backpressure policy:
281
- * - Drops oldest event and logs warning if queue is full (same behavior in all environments)
282
- */
283
- enqueue(event) {
284
- if (this.isShuttingDown) {
285
- this.recordDropped("shutdown", event);
286
- return;
287
- }
288
- if (this.queue.length >= this.config.maxSize) {
289
- const droppedEvent = this.queue.shift();
290
- this.recordDropped("rate_limit", droppedEvent);
291
- getLogger().warn(
292
- {
293
- droppedEvent: droppedEvent?.name
294
- },
295
- `[autotel] Events queue full (${this.config.maxSize} events). Dropping oldest event. Events are being produced faster than they can be sent. Check your subscribers or reduce tracking frequency.`
296
- );
297
- }
298
- const enrichedEvent = {
299
- ...event,
300
- _correlationId: event._correlationId || getOrCreateCorrelationId()
301
- };
302
- this.queue.push(enrichedEvent);
303
- this.scheduleBatchFlush();
304
- }
305
- /**
306
- * Schedule a batch flush if not already scheduled
307
- */
308
- scheduleBatchFlush() {
309
- if (this.flushTimer || this.flushPromise) return;
310
- this.flushTimer = setTimeout(() => {
311
- this.flushTimer = null;
312
- void this.flushBatch();
313
- }, this.config.flushInterval);
314
- }
315
- /**
316
- * Flush a batch of events
317
- * Uses promise-based concurrency control to prevent race conditions
318
- */
319
- async flushBatch() {
320
- if (this.queue.length === 0) return;
321
- if (this.flushPromise) {
322
- await this.flushPromise;
323
- return;
324
- }
325
- this.flushPromise = this.doFlushBatch();
326
- try {
327
- await this.flushPromise;
328
- } finally {
329
- this.flushPromise = null;
330
- if (this.queue.length > 0) {
331
- this.scheduleBatchFlush();
332
- }
333
- }
334
- }
335
- /**
336
- * Internal flush implementation
337
- */
338
- async doFlushBatch() {
339
- const batch = this.queue.splice(0, this.config.batchSize);
340
- await this.sendWithRetry(batch, this.config.maxRetries);
341
- }
342
- /**
343
- * Send events with exponential backoff retry
344
- * Tracks per-event, per-subscriber failures so failed counter reflects actual failed deliveries.
345
- * On retry, only failed (event, subscriber) pairs are re-sent to avoid double-counting delivered.
346
- */
347
- async sendWithRetry(events, retriesLeft, subscribersByEventIndex) {
348
- const failedDeliveries = await this.sendToSubscribers(
349
- events,
350
- subscribersByEventIndex
351
- );
352
- if (failedDeliveries.length > 0) {
353
- if (retriesLeft > 0) {
354
- const failedEventIndices = new Set(
355
- failedDeliveries.map((f) => f.eventIndex)
356
- );
357
- const failedEventIndicesOrdered = [...failedEventIndices].sort(
358
- (a, b) => a - b
359
- );
360
- const eventsToRetry = failedEventIndicesOrdered.map(
361
- (i) => events[i]
362
- );
363
- const failedSubscribersByRetryIndex = /* @__PURE__ */ new Map();
364
- for (let j = 0; j < failedEventIndicesOrdered.length; j++) {
365
- const origIndex = failedEventIndicesOrdered[j];
366
- const set = /* @__PURE__ */ new Set();
367
- for (const { eventIndex, subscriberName } of failedDeliveries) {
368
- if (eventIndex === origIndex) set.add(subscriberName);
369
- }
370
- failedSubscribersByRetryIndex.set(j, set);
371
- }
372
- const delay = Math.pow(2, this.config.maxRetries - retriesLeft) * 1e3;
373
- await new Promise((resolve) => setTimeout(resolve, delay));
374
- return this.sendWithRetry(
375
- eventsToRetry,
376
- retriesLeft - 1,
377
- failedSubscribersByRetryIndex
378
- );
379
- } else {
380
- for (const { eventIndex, subscriberName, error } of failedDeliveries) {
381
- const event = events[eventIndex];
382
- if (event) this.recordFailed(event, subscriberName, error);
383
- }
384
- const failedSubscriberNames = [
385
- ...new Set(failedDeliveries.map((f) => f.subscriberName))
386
- ];
387
- getLogger().error(
388
- {
389
- failedSubscribers: failedSubscriberNames,
390
- retriesAttempted: this.config.maxRetries
391
- },
392
- "[autotel] Failed to send events after retries"
393
- );
394
- }
395
- }
396
- }
397
- /**
398
- * Send events to configured subscribers with rate limiting and metrics.
399
- * When subscribersByEventIndex is provided (retry path), only those subscribers are tried per event.
400
- * Returns per-event, per-subscriber failures (empty if all succeeded).
401
- */
402
- async sendToSubscribers(events, subscribersByEventIndex) {
403
- const failedDeliveries = [];
404
- const sendOne = async (event, eventIndex) => {
405
- const subscriberNames = subscribersByEventIndex?.get(eventIndex);
406
- const failures = await this.sendEventToSubscribers(
407
- event,
408
- subscriberNames ?? void 0
409
- );
410
- for (const failure of failures) {
411
- failedDeliveries.push({
412
- eventIndex,
413
- subscriberName: failure.subscriberName,
414
- error: failure.error
415
- });
416
- }
417
- };
418
- if (!this.rateLimiter) {
419
- for (let i = 0; i < events.length; i++) {
420
- const event = events[i];
421
- if (event) await sendOne(event, i);
422
- }
423
- return failedDeliveries;
424
- }
425
- for (let i = 0; i < events.length; i++) {
426
- await this.rateLimiter.waitForToken();
427
- const event = events[i];
428
- if (event) await sendOne(event, i);
429
- }
430
- return failedDeliveries;
431
- }
432
- /**
433
- * Send a single event to subscribers.
434
- * - When subscriberNames is undefined (initial attempt): send to all subscribers.
435
- * - When subscriberNames is provided (retry): send only to those subscribers (never re-send to healthy ones).
436
- * Returns list of subscribers that failed (empty if all succeeded).
437
- */
438
- async sendEventToSubscribers(event, subscriberNames) {
439
- const startTime = event.timestamp;
440
- const failures = [];
441
- const subscribersToTry = subscriberNames === void 0 ? this.subscribers : this.subscribers.filter(
442
- (s) => subscriberNames.has(getSubscriberName(s))
443
- );
444
- const results = await Promise.allSettled(
445
- subscribersToTry.map(async (subscriber) => {
446
- const subscriberName = getSubscriberName(subscriber);
447
- try {
448
- await subscriber.trackEvent(event.name, event.attributes, {
449
- autotel: event.autotel,
450
- schema: event.schema
451
- });
452
- this.recordDelivered(event, subscriberName, startTime);
453
- return { subscriberName, success: true };
454
- } catch (error) {
455
- this.markSubscriberUnhealthy(subscriberName);
456
- return {
457
- subscriberName,
458
- success: false,
459
- error: error instanceof Error ? error : void 0
460
- };
461
- }
462
- })
463
- );
464
- for (const result of results) {
465
- if (result.status === "fulfilled" && !result.value.success) {
466
- failures.push({
467
- subscriberName: result.value.subscriberName,
468
- error: result.value.error
469
- });
470
- }
471
- }
472
- return failures;
473
- }
474
- /**
475
- * Flush all remaining events. Queue remains usable after flush (e.g. for
476
- * auto-flush at root span end). Use shutdown() when tearing down the queue.
477
- */
478
- async flush() {
479
- if (this.flushTimer) {
480
- clearTimeout(this.flushTimer);
481
- this.flushTimer = null;
482
- }
483
- if (this.flushPromise) {
484
- await this.flushPromise;
485
- }
486
- while (this.queue.length > 0) {
487
- await this.doFlushBatch();
488
- }
489
- }
490
- /**
491
- * Flush remaining events and permanently disable the queue (reject new events).
492
- * Use for process/SDK shutdown; use flush() for periodic or span-end drain.
493
- */
494
- async shutdown() {
495
- this.isShuttingDown = true;
496
- await this.flush();
497
- }
498
- /**
499
- * Cleanup observable metric callbacks to prevent memory leaks
500
- * Call this when destroying the EventQueue instance
501
- */
502
- cleanup() {
503
- for (const cleanupFn of this.observableCleanups) {
504
- try {
505
- cleanupFn();
506
- } catch {
507
- }
508
- }
509
- this.observableCleanups = [];
510
- }
511
- /**
512
- * Get queue size (for testing/debugging)
513
- */
514
- size() {
515
- return this.queue.length;
516
- }
517
- /**
518
- * Get subscriber health status (for testing/debugging)
519
- */
520
- getSubscriberHealth() {
521
- return new Map(this.subscriberHealthy);
522
- }
523
- /**
524
- * Check if a specific subscriber is healthy
525
- */
526
- isSubscriberHealthy(subscriberName) {
527
- return this.subscriberHealthy.get(subscriberName.toLowerCase()) ?? true;
528
- }
529
- /**
530
- * Manually mark a subscriber as healthy or unhealthy
531
- * (used for circuit breaker integration)
532
- */
533
- setSubscriberHealth(subscriberName, healthy) {
534
- this.subscriberHealthy.set(subscriberName.toLowerCase(), healthy);
535
- }
536
- };
537
-
538
- // src/validation.ts
539
- var DEFAULT_CONFIG2 = {
540
- maxEventNameLength: 100,
541
- maxAttributeKeyLength: 100,
542
- maxAttributeValueLength: 1e3,
543
- maxAttributeCount: 50,
544
- maxNestingDepth: 3,
545
- sensitivePatterns: [
546
- /password/i,
547
- /secret/i,
548
- /token/i,
549
- /api[_-]?key/i,
550
- /access[_-]?key/i,
551
- /private[_-]?key/i,
552
- /auth/i,
553
- /credential/i,
554
- /ssn/i,
555
- /credit[_-]?card/i
556
- ]
557
- };
558
- var ValidationError = class extends Error {
559
- constructor(message) {
560
- super(message);
561
- this.name = "ValidationError";
562
- }
563
- };
564
- function validateEventName(eventName, config = DEFAULT_CONFIG2) {
565
- if (typeof eventName !== "string") {
566
- throw new ValidationError(
567
- `Event name must be a string, got ${typeof eventName}`
568
- );
569
- }
570
- const trimmed = eventName.trim();
571
- if (trimmed.length === 0) {
572
- throw new ValidationError("Event name cannot be empty");
573
- }
574
- if (trimmed.length > config.maxEventNameLength) {
575
- throw new ValidationError(
576
- `Event name too long (${trimmed.length} chars). Max: ${config.maxEventNameLength}`
577
- );
578
- }
579
- if (!/^[a-zA-Z0-9._-]+$/.test(trimmed)) {
580
- throw new ValidationError(
581
- `Event name contains invalid characters: "${trimmed}". Use only letters, numbers, dots, underscores, and hyphens.`
582
- );
583
- }
584
- return trimmed;
585
- }
586
- function validateAttributes(attributes, config = DEFAULT_CONFIG2) {
587
- if (attributes === void 0 || attributes === null) {
588
- return void 0;
589
- }
590
- if (typeof attributes !== "object" || Array.isArray(attributes)) {
591
- throw new ValidationError("Attributes must be an object");
592
- }
593
- const keys = Object.keys(attributes);
594
- if (keys.length > config.maxAttributeCount) {
595
- throw new ValidationError(
596
- `Too many attributes (${keys.length}). Max: ${config.maxAttributeCount}`
597
- );
598
- }
599
- const sanitized = {};
600
- for (const key of keys) {
601
- if (key.length > config.maxAttributeKeyLength) {
602
- throw new ValidationError(
603
- `Attribute key too long: "${key.slice(0, 20)}..." (${key.length} chars). Max: ${config.maxAttributeKeyLength}`
604
- );
605
- }
606
- const value = attributes[key];
607
- const isSensitive = typeof value === "string" && config.sensitivePatterns.some((pattern) => pattern.test(key));
608
- if (isSensitive) {
609
- sanitized[key] = "[REDACTED]";
610
- continue;
611
- }
612
- sanitized[key] = sanitizeValue(value, config, 1);
613
- }
614
- return sanitized;
615
- }
616
- function sanitizeValue(value, config, depth) {
617
- if (depth > config.maxNestingDepth) {
618
- return "[MAX_DEPTH_EXCEEDED]";
619
- }
620
- if (value === null || value === void 0) {
621
- return value;
622
- }
623
- if (typeof value === "string") {
624
- if (value.length > config.maxAttributeValueLength) {
625
- return value.slice(0, config.maxAttributeValueLength) + "...";
626
- }
627
- return value;
628
- }
629
- if (typeof value === "number" || typeof value === "boolean") {
630
- return value;
631
- }
632
- if (Array.isArray(value)) {
633
- return value.map((item) => sanitizeValue(item, config, depth + 1));
634
- }
635
- if (typeof value === "object") {
636
- try {
637
- JSON.stringify(value);
638
- const sanitized = {};
639
- for (const key in value) {
640
- if (Object.prototype.hasOwnProperty.call(value, key)) {
641
- const nested = value[key];
642
- const isSensitive = typeof nested === "string" && config.sensitivePatterns.some((pattern) => pattern.test(key));
643
- sanitized[key] = isSensitive ? "[REDACTED]" : sanitizeValue(nested, config, depth + 1);
644
- }
645
- }
646
- return sanitized;
647
- } catch {
648
- return "[CIRCULAR]";
649
- }
650
- }
651
- return `[${typeof value}]`;
652
- }
653
- function validateEvent(eventName, attributes, config) {
654
- const fullConfig = { ...DEFAULT_CONFIG2, ...config };
655
- return {
656
- eventName: validateEventName(eventName, fullConfig),
657
- attributes: validateAttributes(attributes, fullConfig)
658
- };
659
- }
660
-
661
- // src/track.ts
662
- var eventsQueue = null;
663
- function buildAutotelContext(span) {
664
- const eventsConfig = getEventsConfig();
665
- const config = getConfig();
666
- const correlationId = getOrCreateCorrelationId();
667
- if (!eventsConfig?.includeTraceContext) {
668
- return {
669
- correlation_id: correlationId
670
- };
671
- }
672
- const autotelContext = {
673
- correlation_id: correlationId
674
- };
675
- const spanContext = span?.spanContext();
676
- if (spanContext) {
677
- autotelContext.trace_id = spanContext.traceId;
678
- autotelContext.span_id = spanContext.spanId;
679
- autotelContext.trace_flags = spanContext.traceFlags.toString(16).padStart(2, "0");
680
- const traceState = spanContext.traceState;
681
- if (traceState) {
682
- try {
683
- if (typeof traceState.serialize === "function") {
684
- const traceStateStr = traceState.serialize();
685
- if (traceStateStr) {
686
- autotelContext.trace_state = traceStateStr;
687
- }
688
- }
689
- } catch {
690
- }
691
- }
692
- if (eventsConfig.traceUrl && config) {
693
- const traceUrl = eventsConfig.traceUrl({
694
- traceId: spanContext.traceId,
695
- spanId: spanContext.spanId,
696
- correlationId,
697
- serviceName: config.service,
698
- environment: config.environment
699
- });
700
- if (traceUrl) {
701
- autotelContext.trace_url = traceUrl;
702
- }
703
- }
704
- } else {
705
- if (eventsConfig.traceUrl && config) {
706
- const traceUrl = eventsConfig.traceUrl({
707
- correlationId,
708
- serviceName: config.service,
709
- environment: config.environment
710
- });
711
- if (traceUrl) {
712
- autotelContext.trace_url = traceUrl;
713
- }
714
- }
715
- }
716
- return autotelContext;
717
- }
718
- function getOrCreateQueue() {
719
- if (!isInitialized()) {
720
- warnIfNotInitialized("track()");
721
- return null;
722
- }
723
- if (!eventsQueue) {
724
- const config = getConfig();
725
- if (!config?.subscribers || config.subscribers.length === 0) {
726
- return null;
727
- }
728
- eventsQueue = new EventQueue(config.subscribers);
729
- }
730
- return eventsQueue;
731
- }
732
- function track(event, data, options) {
733
- const queue = getOrCreateQueue();
734
- if (!queue) return;
735
- const validationConfig = getValidationConfig();
736
- const validated = validateEvent(event, data, validationConfig || void 0);
737
- const span = trace.getActiveSpan();
738
- const enrichedData = span ? {
739
- ...validated.attributes,
740
- traceId: span.spanContext().traceId,
741
- spanId: span.spanContext().spanId
742
- } : validated.attributes;
743
- const autotelContext = buildAutotelContext(span);
744
- queue.enqueue({
745
- name: validated.eventName,
746
- attributes: enrichedData,
747
- timestamp: Date.now(),
748
- autotel: autotelContext,
749
- schema: options?.schema
750
- });
751
- }
752
- function getEventQueue() {
753
- return eventsQueue;
754
- }
755
- function resetEventQueue() {
756
- eventsQueue = null;
757
- }
758
-
759
- // src/trace-context.ts
760
- var contextStorage = new AsyncLocalStorage();
761
- function getContextStorage() {
762
- return contextStorage;
763
- }
764
- function getActiveContextWithBaggage() {
765
- const stored = contextStorage.getStore()?.value;
766
- return stored ?? context.active();
767
- }
768
- function enterOrRun(storage, value) {
769
- const existingStore = storage.getStore();
770
- if (existingStore) {
771
- existingStore.value = value;
772
- return;
773
- }
774
- const boxedValue = { value };
775
- try {
776
- storage.enterWith(boxedValue);
777
- } catch {
778
- storage.run(boxedValue, () => {
779
- });
780
- }
781
- }
782
- function updateActiveContext(newContext) {
783
- enterOrRun(contextStorage, newContext);
784
- const contextWithManager = context;
785
- const manager = contextWithManager._getContextManager?.();
786
- if (!manager) return;
787
- const asyncLocal = manager._asyncLocalStorage ?? void 0;
788
- if (asyncLocal?.enterWith) {
789
- asyncLocal.enterWith(newContext);
790
- return;
791
- }
792
- if (typeof manager.with === "function") {
793
- manager.with(newContext, () => {
794
- });
795
- }
796
- }
797
- function createTraceContext(span) {
798
- const spanContext = span.spanContext();
799
- const existingStored = contextStorage.getStore()?.value;
800
- if (!existingStored) {
801
- const activeContext = context.active();
802
- enterOrRun(contextStorage, activeContext);
803
- }
804
- const baggageHelpers = {
805
- getBaggage(key) {
806
- const activeCtx = context.active();
807
- let baggage = propagation.getBaggage(activeCtx);
808
- if (!baggage) {
809
- const storedContext = contextStorage.getStore()?.value;
810
- if (storedContext) {
811
- baggage = propagation.getBaggage(storedContext);
812
- }
813
- }
814
- return baggage?.getEntry(key)?.value;
815
- },
816
- setBaggage(key, value) {
817
- const activeCtx = context.active();
818
- const storedContext = contextStorage.getStore()?.value;
819
- const currentContext = storedContext ?? activeCtx;
820
- const baggage = propagation.getBaggage(currentContext) ?? propagation.createBaggage();
821
- const updated = baggage.setEntry(key, { value });
822
- const newContext = propagation.setBaggage(currentContext, updated);
823
- updateActiveContext(newContext);
824
- return value;
825
- },
826
- deleteBaggage(key) {
827
- const activeCtx = context.active();
828
- const storedContext = contextStorage.getStore()?.value;
829
- const currentContext = storedContext ?? activeCtx;
830
- const baggage = propagation.getBaggage(currentContext);
831
- if (baggage) {
832
- const updated = baggage.removeEntry(key);
833
- const newContext = propagation.setBaggage(currentContext, updated);
834
- updateActiveContext(newContext);
835
- }
836
- },
837
- getAllBaggage() {
838
- const activeCtx = context.active();
839
- let baggage = propagation.getBaggage(activeCtx);
840
- if (!baggage) {
841
- const storedContext = contextStorage.getStore()?.value;
842
- if (storedContext) {
843
- baggage = propagation.getBaggage(storedContext);
844
- }
845
- }
846
- if (!baggage) {
847
- return /* @__PURE__ */ new Map();
848
- }
849
- const entries = /* @__PURE__ */ new Map();
850
- for (const [key, entry] of baggage.getAllEntries()) {
851
- entries.set(key, entry);
852
- }
853
- return entries;
854
- },
855
- // Typed baggage helpers (used by defineBaggageSchema)
856
- getTypedBaggage: ((namespace) => {
857
- const activeCtx = context.active();
858
- let baggage = propagation.getBaggage(activeCtx);
859
- if (!baggage) {
860
- const storedContext = contextStorage.getStore()?.value;
861
- if (storedContext) {
862
- baggage = propagation.getBaggage(storedContext);
863
- }
864
- }
865
- if (!baggage) return;
866
- const prefix = namespace ? `${namespace}.` : "";
867
- const result = {};
868
- for (const [key, entry] of baggage.getAllEntries()) {
869
- if (namespace && key.startsWith(prefix)) {
870
- const fieldName = key.slice(prefix.length);
871
- result[fieldName] = entry.value;
872
- } else if (!namespace) {
873
- result[key] = entry.value;
874
- }
875
- }
876
- return Object.keys(result).length > 0 ? result : void 0;
877
- }),
878
- setTypedBaggage: ((namespace, value) => {
879
- const activeCtx = context.active();
880
- const storedContext = contextStorage.getStore()?.value;
881
- const currentContext = storedContext ?? activeCtx;
882
- let baggage = propagation.getBaggage(currentContext) ?? propagation.createBaggage();
883
- const prefix = namespace ? `${namespace}.` : "";
884
- for (const [key, val] of Object.entries(value)) {
885
- if (val !== void 0) {
886
- const baggageKey = `${prefix}${key}`;
887
- baggage = baggage.setEntry(baggageKey, { value: String(val) });
888
- }
889
- }
890
- const newContext = propagation.setBaggage(currentContext, baggage);
891
- updateActiveContext(newContext);
892
- })
893
- };
894
- const traceCtx = {
895
- traceId: spanContext.traceId,
896
- spanId: spanContext.spanId,
897
- correlationId: spanContext.traceId.slice(0, 16),
898
- setAttribute: span.setAttribute.bind(span),
899
- setAttributes: span.setAttributes.bind(span),
900
- setStatus: span.setStatus.bind(span),
901
- recordException: span.recordException.bind(span),
902
- addEvent: span.addEvent.bind(span),
903
- addLink: span.addLink.bind(span),
904
- addLinks: span.addLinks.bind(span),
905
- updateName: span.updateName.bind(span),
906
- isRecording: span.isRecording.bind(span),
907
- recordError: (error) => {
908
- const err = error instanceof Error ? error : new Error(String(error));
909
- recordStructuredError(traceCtx, err);
910
- },
911
- track: (event, data) => {
912
- track(event, data);
913
- },
914
- ...baggageHelpers
915
- };
916
- return traceCtx;
917
- }
918
- function defineBaggageSchema(namespace) {
919
- return {
920
- /**
921
- * Get typed baggage from context
922
- * @param ctx - Trace context
923
- * @returns Partial baggage object or undefined if no baggage is set
924
- */
925
- get: (ctx) => {
926
- if (!ctx.getTypedBaggage) return void 0;
927
- return ctx.getTypedBaggage(namespace);
928
- },
929
- /**
930
- * Set typed baggage in context
931
- *
932
- * Note: For proper scoping across async boundaries, use the `with` method instead
933
- *
934
- * @param ctx - Trace context
935
- * @param value - Partial baggage object to set
936
- */
937
- set: (ctx, value) => {
938
- if (!ctx.setTypedBaggage) return;
939
- ctx.setTypedBaggage(namespace, value);
940
- },
941
- /**
942
- * Run a function with typed baggage properly scoped
943
- *
944
- * This is the recommended way to set baggage as it ensures proper
945
- * scoping across async boundaries.
946
- *
947
- * @param ctx - Trace context (can be omitted, will use active context)
948
- * @param value - Partial baggage object to set
949
- * @param fn - Function to execute with the baggage
950
- */
951
- with: (ctxOrValue, valueOrFn, maybeFn) => {
952
- const value = maybeFn ? valueOrFn : ctxOrValue;
953
- const fn = maybeFn || valueOrFn;
954
- const prefix = namespace ? `${namespace}.` : "";
955
- const flatBaggage = {};
956
- for (const [key, val] of Object.entries(value)) {
957
- if (val !== void 0) {
958
- flatBaggage[`${prefix}${key}`] = String(val);
959
- }
960
- }
961
- const currentContext = context.active();
962
- let baggage = propagation.getBaggage(currentContext) ?? propagation.createBaggage();
963
- for (const [key, val] of Object.entries(flatBaggage)) {
964
- baggage = baggage.setEntry(key, { value: val });
965
- }
966
- const newContext = propagation.setBaggage(currentContext, baggage);
967
- return context.with(newContext, fn);
968
- }
969
- };
970
- }
971
-
972
- // src/correlation-id.ts
973
- var correlationStorage = new AsyncLocalStorage();
974
- var CORRELATION_ID_BAGGAGE_KEY = "autotel.correlation_id";
975
- function generateCorrelationId() {
976
- const bytes = new Uint8Array(8);
977
- crypto.getRandomValues(bytes);
978
- return [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
979
- }
980
- function getCorrelationId() {
981
- const storedId = correlationStorage.getStore()?.value;
982
- if (storedId) {
983
- return storedId;
984
- }
985
- const activeContext = context.active();
986
- const baggage = propagation.getBaggage(activeContext);
987
- const baggageEntry = baggage?.getEntry(CORRELATION_ID_BAGGAGE_KEY);
988
- if (baggageEntry?.value) {
989
- return baggageEntry.value;
990
- }
991
- const span = trace.getActiveSpan();
992
- if (span) {
993
- const spanContext = span.spanContext();
994
- return spanContext.traceId.slice(0, 16);
995
- }
996
- return void 0;
997
- }
998
- function getOrCreateCorrelationId() {
999
- return getCorrelationId() ?? generateCorrelationId();
1000
- }
1001
- function runWithCorrelationId(correlationId, fn) {
1002
- return correlationStorage.run({ value: correlationId }, fn);
1003
- }
1004
- function setCorrelationId(correlationId) {
1005
- enterOrRun(correlationStorage, correlationId);
1006
- }
1007
- function setCorrelationIdInBaggage(correlationId) {
1008
- const activeContext = context.active();
1009
- let baggage = propagation.getBaggage(activeContext) ?? propagation.createBaggage();
1010
- baggage = baggage.setEntry(CORRELATION_ID_BAGGAGE_KEY, {
1011
- value: correlationId
1012
- });
1013
- return propagation.setBaggage(activeContext, baggage);
1014
- }
1015
- function getCorrelationStorage() {
1016
- return correlationStorage;
1017
- }
1018
-
1019
- export { CORRELATION_ID_BAGGAGE_KEY, createTraceContext, defineBaggageSchema, enterOrRun, generateCorrelationId, getActiveContextWithBaggage, getContextStorage, getCorrelationId, getCorrelationStorage, getEventQueue, getOrCreateCorrelationId, resetEventQueue, runWithCorrelationId, setCorrelationId, setCorrelationIdInBaggage, track, validateEvent };
1020
- //# sourceMappingURL=chunk-66YJ66GG.js.map
1021
- //# sourceMappingURL=chunk-66YJ66GG.js.map