@burdenoff/be-sdk 2026.1110.2 → 2026.1110.4

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 (497) hide show
  1. package/configs/eslint/index.js +1 -1
  2. package/configs/tsconfig/tsconfig.json +1 -1
  3. package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
  4. package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
  5. package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
  6. package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
  7. package/dist/activity/index.d.ts +165 -0
  8. package/dist/activity/index.js +389 -0
  9. package/dist/activity/index.js.map +1 -0
  10. package/dist/ai-credits/index.d.ts +2 -3
  11. package/dist/ai-credits/index.js +3 -4
  12. package/dist/ai-credits/index.js.map +1 -1
  13. package/dist/ai-credits-xxfwGpHS.js +546 -0
  14. package/dist/ai-credits-xxfwGpHS.js.map +1 -0
  15. package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
  16. package/dist/auth/index.d.ts +2 -77
  17. package/dist/auth/index.js +3 -7
  18. package/dist/auth/index.js.map +1 -1
  19. package/dist/auth-C5ctwSLp.js +228 -0
  20. package/dist/auth-C5ctwSLp.js.map +1 -0
  21. package/dist/bootstrap/index.d.ts +74 -0
  22. package/dist/bootstrap/index.js +282 -0
  23. package/dist/bootstrap/index.js.map +1 -0
  24. package/dist/cache/index.d.ts +2 -3
  25. package/dist/cache/index.js +3 -7
  26. package/dist/cache/index.js.map +1 -1
  27. package/dist/cache-CU0uLwcS.js +1837 -0
  28. package/dist/cache-CU0uLwcS.js.map +1 -0
  29. package/dist/captcha/index.d.ts +2 -1
  30. package/dist/captcha/index.js +3 -3
  31. package/dist/captcha/index.js.map +1 -1
  32. package/dist/captcha-BT7yh1YS.js +77 -0
  33. package/dist/captcha-BT7yh1YS.js.map +1 -0
  34. package/dist/client/internal-client.d.ts +4 -7
  35. package/dist/client/internal-client.js +172 -4
  36. package/dist/client/internal-client.js.map +1 -1
  37. package/dist/client-BgAEvDC2.d.ts +86 -0
  38. package/dist/client-sAJTrb4i.js +565 -0
  39. package/dist/client-sAJTrb4i.js.map +1 -0
  40. package/dist/collector-endpoint-iyQYeI50.js +50 -0
  41. package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
  42. package/dist/context/index.d.ts +35 -0
  43. package/dist/context/index.js +283 -0
  44. package/dist/context/index.js.map +1 -0
  45. package/dist/crypto/index.d.ts +2 -1
  46. package/dist/crypto/index.js +3 -3
  47. package/dist/crypto/index.js.map +1 -1
  48. package/dist/crypto-DO9fM0FO.js +145 -0
  49. package/dist/crypto-DO9fM0FO.js.map +1 -0
  50. package/dist/database/index.d.ts +104 -108
  51. package/dist/database/index.js +468 -6
  52. package/dist/database/index.js.map +1 -1
  53. package/dist/dataloader/index.d.ts +2 -1
  54. package/dist/dataloader/index.js +3 -3
  55. package/dist/dataloader/index.js.map +1 -1
  56. package/dist/dataloader-DwpT3YoS.js +294 -0
  57. package/dist/dataloader-DwpT3YoS.js.map +1 -0
  58. package/dist/deployed-environment-p_Tdl3sT.js +38 -0
  59. package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
  60. package/dist/dist-BGKdXVy3.js +1718 -0
  61. package/dist/dist-BGKdXVy3.js.map +1 -0
  62. package/dist/env-DdaoGjIt.js +74 -0
  63. package/dist/env-DdaoGjIt.js.map +1 -0
  64. package/dist/event-queue/index.d.ts +2 -7
  65. package/dist/event-queue/index.js +7 -9
  66. package/dist/event-queue/index.js.map +1 -1
  67. package/dist/event-queue-Cw-YJPY_.js +1384 -0
  68. package/dist/event-queue-Cw-YJPY_.js.map +1 -0
  69. package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
  70. package/dist/explicit-activity-scope-DikJ7NAE.js +57 -0
  71. package/dist/explicit-activity-scope-DikJ7NAE.js.map +1 -0
  72. package/dist/export/index.d.ts +2 -2
  73. package/dist/export/index.js +3 -14
  74. package/dist/export/index.js.map +1 -1
  75. package/dist/export-DJXE3Osa.js +642 -0
  76. package/dist/export-DJXE3Osa.js.map +1 -0
  77. package/dist/feature-flags/index.d.ts +2 -10
  78. package/dist/feature-flags/index.js +3 -6
  79. package/dist/feature-flags/index.js.map +1 -1
  80. package/dist/feature-flags-CP1KRgwD.js +422 -0
  81. package/dist/feature-flags-CP1KRgwD.js.map +1 -0
  82. package/dist/files/index.d.ts +2 -3
  83. package/dist/files/index.js +3 -4
  84. package/dist/files/index.js.map +1 -1
  85. package/dist/files-h5U-D2AF.js +830 -0
  86. package/dist/files-h5U-D2AF.js.map +1 -0
  87. package/dist/gateway/index.d.ts +4 -6
  88. package/dist/gateway/index.js +7 -13
  89. package/dist/gateway/index.js.map +1 -1
  90. package/dist/gateway/security/index.d.ts +2 -2
  91. package/dist/gateway/security/index.js +3 -5
  92. package/dist/gateway/security/index.js.map +1 -1
  93. package/dist/gateway-ByVo-n37.js +50 -0
  94. package/dist/gateway-ByVo-n37.js.map +1 -0
  95. package/dist/graph/index.d.ts +3 -10
  96. package/dist/graph/index.js +4 -13
  97. package/dist/graph/index.js.map +1 -1
  98. package/dist/graph-CR7u4lpl.js +2152 -0
  99. package/dist/graph-CR7u4lpl.js.map +1 -0
  100. package/dist/graph-emitter-CdOXP7Tn.js +621 -0
  101. package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
  102. package/dist/graphql/index.d.ts +3 -2
  103. package/dist/graphql/index.js +4 -6
  104. package/dist/graphql/index.js.map +1 -1
  105. package/dist/graphql/services/index.d.ts +2 -24
  106. package/dist/graphql/services/index.js +3 -4
  107. package/dist/graphql/services/index.js.map +1 -1
  108. package/dist/graphql-CUDyhibV.d.ts +21 -0
  109. package/dist/graphql-DHAHHcww.js +161 -0
  110. package/dist/graphql-DHAHHcww.js.map +1 -0
  111. package/dist/i18n/index.d.ts +3 -3
  112. package/dist/i18n/index.js +3 -4
  113. package/dist/i18n/index.js.map +1 -1
  114. package/dist/i18n-BBMYFd0P.js +860 -0
  115. package/dist/i18n-BBMYFd0P.js.map +1 -0
  116. package/dist/import-optional-peer-B82VYxeX.js +18 -0
  117. package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
  118. package/dist/index-3KOZ1zN9.d.ts +233 -0
  119. package/dist/index-ADmsX0BI.d.ts +646 -0
  120. package/dist/index-B2LCaK0R.d.ts +500 -0
  121. package/dist/index-BBqooJ52.d.ts +45 -0
  122. package/dist/index-BGzMYJsm.d.ts +209 -0
  123. package/dist/index-BMIMnp6T.d.ts +8 -0
  124. package/dist/index-BVOL7458.d.ts +10 -0
  125. package/dist/index-BcqQs-Uq.d.ts +69 -0
  126. package/dist/index-BeVtqGO-.d.ts +208 -0
  127. package/dist/index-BiTzGUZP.d.ts +114 -0
  128. package/dist/index-C0qLquY0.d.ts +150 -0
  129. package/dist/index-C5uEKchX.d.ts +60 -0
  130. package/dist/index-CDOqxSIi.d.ts +37 -0
  131. package/dist/index-CG6wj66Y.d.ts +148 -0
  132. package/dist/index-CHwMhK6v.d.ts +63 -0
  133. package/dist/index-CIgoeobA.d.ts +145 -0
  134. package/dist/index-CPQDMSFS.d.ts +103 -0
  135. package/dist/index-CSRcgkVi.d.ts +23 -0
  136. package/dist/index-CTTwo9av.d.ts +102 -0
  137. package/dist/index-CVCyKzhB.d.ts +207 -0
  138. package/dist/index-C_GXXF32.d.ts +704 -0
  139. package/dist/index-CaM9JUcc.d.ts +144 -0
  140. package/dist/index-CliOgq6L.d.ts +203 -0
  141. package/dist/index-Cot73bdh.d.ts +63 -0
  142. package/dist/index-DGgh9DWn.d.ts +59 -0
  143. package/dist/index-DY3dNhMN.d.ts +420 -0
  144. package/dist/index-DqbGqfAy.d.ts +127 -0
  145. package/dist/index-Dt1HJPTX.d.ts +12 -0
  146. package/dist/index-DtI6aBtB.d.ts +22 -0
  147. package/dist/index-FKohsiex.d.ts +38 -0
  148. package/dist/index-FRRaa6h2.d.ts +999 -0
  149. package/dist/index-FbXPfen7.d.ts +132 -0
  150. package/dist/index-MArCb8Aq.d.ts +306 -0
  151. package/dist/index-U_tu3zUl.d.ts +303 -0
  152. package/dist/index-YOShAwkq.d.ts +45 -0
  153. package/dist/index-cmR9k9ga.d.ts +26 -0
  154. package/dist/index-yBSjMY32.d.ts +24 -0
  155. package/dist/index-zd_NPGJo.d.ts +206 -0
  156. package/dist/index.d.ts +106 -609
  157. package/dist/index.js +769 -2590
  158. package/dist/index.js.map +1 -1
  159. package/dist/init/index.d.ts +2 -2
  160. package/dist/init/index.js +3 -16
  161. package/dist/init/index.js.map +1 -1
  162. package/dist/init-CQPFmOOe.js +325 -0
  163. package/dist/init-CQPFmOOe.js.map +1 -0
  164. package/dist/instrumentation/index.d.ts +3 -4
  165. package/dist/instrumentation/index.js +5 -5
  166. package/dist/instrumentation/index.js.map +1 -1
  167. package/dist/instrumentation-xkkmDgJ0.js +1678 -0
  168. package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
  169. package/dist/lake/index.d.ts +50 -54
  170. package/dist/lake/index.js +169 -193
  171. package/dist/lake/index.js.map +1 -1
  172. package/dist/layer/index.d.ts +3 -2
  173. package/dist/layer/index.js +4 -5
  174. package/dist/layer/index.js.map +1 -1
  175. package/dist/layer-BZBZZWeV.d.ts +69 -0
  176. package/dist/layer-Bcix-WCl.js +105 -0
  177. package/dist/layer-Bcix-WCl.js.map +1 -0
  178. package/dist/layer-CEKy6cm8.js +252 -0
  179. package/dist/layer-CEKy6cm8.js.map +1 -0
  180. package/dist/lifecycle/index.d.ts +2 -1
  181. package/dist/lifecycle/index.js +3 -4
  182. package/dist/lifecycle/index.js.map +1 -1
  183. package/dist/lifecycle-DeoLSX0U.js +76 -0
  184. package/dist/lifecycle-DeoLSX0U.js.map +1 -0
  185. package/dist/logger/index.d.ts +2 -3
  186. package/dist/logger/index.js +3 -3
  187. package/dist/logger/index.js.map +1 -1
  188. package/dist/logger-B6rCpb7D.js +290 -0
  189. package/dist/logger-B6rCpb7D.js.map +1 -0
  190. package/dist/metrics/index.d.ts +13 -14
  191. package/dist/metrics/index.js +3 -4
  192. package/dist/metrics/index.js.map +1 -1
  193. package/dist/metrics-BrLwNUrb.js +52 -0
  194. package/dist/metrics-BrLwNUrb.js.map +1 -0
  195. package/dist/metrics-collector-C2eShrlW.js +922 -0
  196. package/dist/metrics-collector-C2eShrlW.js.map +1 -0
  197. package/dist/middleware/index.d.ts +3 -3
  198. package/dist/middleware/index.js +3 -4
  199. package/dist/middleware/index.js.map +1 -1
  200. package/dist/middleware-CUxJVUpD.js +1243 -0
  201. package/dist/middleware-CUxJVUpD.js.map +1 -0
  202. package/dist/middleware-Cq0zFMGp.js +253 -0
  203. package/dist/middleware-Cq0zFMGp.js.map +1 -0
  204. package/dist/notifications/index.d.ts +2 -5
  205. package/dist/notifications/index.js +3 -6
  206. package/dist/notifications/index.js.map +1 -1
  207. package/dist/notifications-DY_i37WN.js +869 -0
  208. package/dist/notifications-DY_i37WN.js.map +1 -0
  209. package/dist/observability/index.d.ts +2 -3
  210. package/dist/observability/index.js +3 -4
  211. package/dist/observability/index.js.map +1 -1
  212. package/dist/observability-DBDXipTU.js +272 -0
  213. package/dist/observability-DBDXipTU.js.map +1 -0
  214. package/dist/payments/index.d.ts +144 -0
  215. package/dist/payments/index.js +404 -0
  216. package/dist/payments/index.js.map +1 -0
  217. package/dist/platform/index.d.ts +2 -1
  218. package/dist/platform/index.js +3 -5
  219. package/dist/platform/index.js.map +1 -1
  220. package/dist/platform-DZwczW7v.js +1510 -0
  221. package/dist/platform-DZwczW7v.js.map +1 -0
  222. package/dist/prisma/generator/index.d.ts +1 -1
  223. package/dist/prisma/generator/index.js +97 -84
  224. package/dist/prisma/generator/index.js.map +1 -1
  225. package/dist/prisma/index.d.ts +4 -7
  226. package/dist/prisma/index.js +5 -12
  227. package/dist/prisma/index.js.map +1 -1
  228. package/dist/prisma-BzOOdt79.js +863 -0
  229. package/dist/prisma-BzOOdt79.js.map +1 -0
  230. package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
  231. package/dist/product-alias/index.d.ts +2 -1
  232. package/dist/product-alias/index.js +3 -3
  233. package/dist/product-alias/index.js.map +1 -1
  234. package/dist/product-alias-BPqtskMq.js +273 -0
  235. package/dist/product-alias-BPqtskMq.js.map +1 -0
  236. package/dist/rate-limit-CBrK_U5H.js +142 -0
  237. package/dist/rate-limit-CBrK_U5H.js.map +1 -0
  238. package/dist/rbac/index.d.ts +2 -122
  239. package/dist/rbac/index.js +3 -6
  240. package/dist/rbac/index.js.map +1 -1
  241. package/dist/rbac-Dvz0YzEt.js +1486 -0
  242. package/dist/rbac-Dvz0YzEt.js.map +1 -0
  243. package/dist/resource-caps/index.d.ts +66 -72
  244. package/dist/resource-caps/index.js +430 -5
  245. package/dist/resource-caps/index.js.map +1 -1
  246. package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
  247. package/dist/sdk-Dju9o-sq.js +124 -0
  248. package/dist/sdk-Dju9o-sq.js.map +1 -0
  249. package/dist/search/index.d.ts +112 -0
  250. package/dist/search/index.js +266 -0
  251. package/dist/search/index.js.map +1 -0
  252. package/dist/security/index.d.ts +2 -0
  253. package/dist/security/index.js +4 -0
  254. package/dist/security/index.js.map +1 -0
  255. package/dist/security/rate-limit/index.d.ts +2 -0
  256. package/dist/security/rate-limit/index.js +4 -0
  257. package/dist/security/rate-limit/index.js.map +1 -0
  258. package/dist/security-DIG-95Ic.js +1647 -0
  259. package/dist/security-DIG-95Ic.js.map +1 -0
  260. package/dist/server/index.d.ts +7 -164
  261. package/dist/server/index.js +2001 -1507
  262. package/dist/server/index.js.map +1 -1
  263. package/dist/service-jwt-Bu-WNA_-.js +80 -0
  264. package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
  265. package/dist/services-BWzfz7vG.js +102 -0
  266. package/dist/services-BWzfz7vG.js.map +1 -0
  267. package/dist/sharding/index.d.ts +41 -44
  268. package/dist/sharding/index.js +156 -137
  269. package/dist/sharding/index.js.map +1 -1
  270. package/dist/sharing/index.d.ts +2 -1
  271. package/dist/sharing/index.js +3 -4
  272. package/dist/sharing/index.js.map +1 -1
  273. package/dist/sharing-CflDsSJ-.js +911 -0
  274. package/dist/sharing-CflDsSJ-.js.map +1 -0
  275. package/dist/stub-BUnfMiAS.js +577 -0
  276. package/dist/stub-BUnfMiAS.js.map +1 -0
  277. package/dist/tags/index.d.ts +2 -3
  278. package/dist/tags/index.js +3 -4
  279. package/dist/tags/index.js.map +1 -1
  280. package/dist/tags-CbijgoqR.js +868 -0
  281. package/dist/{chunk-PBZFAAOM.js.map → tags-CbijgoqR.js.map} +1 -1
  282. package/dist/telemetry/index.d.ts +64 -76
  283. package/dist/telemetry/index.js +369 -201
  284. package/dist/telemetry/index.js.map +1 -1
  285. package/dist/temporal/index.d.ts +2 -148
  286. package/dist/temporal/index.js +3 -5
  287. package/dist/temporal/index.js.map +1 -1
  288. package/dist/temporal-B534uYK8.js +706 -0
  289. package/dist/temporal-B534uYK8.js.map +1 -0
  290. package/dist/tracker/index.d.ts +5 -11
  291. package/dist/tracker/index.js +7 -20
  292. package/dist/tracker/index.js.map +1 -1
  293. package/dist/tracker-PQztSlhJ.js +458 -0
  294. package/dist/tracker-PQztSlhJ.js.map +1 -0
  295. package/dist/translation/index.d.ts +120 -0
  296. package/dist/translation/index.js +573 -0
  297. package/dist/translation/index.js.map +1 -0
  298. package/dist/types/index.d.ts +3 -0
  299. package/dist/types/index.js +90 -0
  300. package/dist/types/index.js.map +1 -0
  301. package/dist/types-BYMYND1L.js +44 -0
  302. package/dist/types-BYMYND1L.js.map +1 -0
  303. package/dist/types-C6EKaS3V.d.ts +106 -0
  304. package/dist/types-CWybW61E.d.ts +323 -0
  305. package/dist/types-C_yfu3XK.d.ts +34 -0
  306. package/dist/types-DgaQqvxo.d.ts +70 -0
  307. package/dist/usage/index.d.ts +2 -213
  308. package/dist/usage/index.js +3 -15
  309. package/dist/usage/index.js.map +1 -1
  310. package/dist/usage-BRqVP3CJ.js +682 -0
  311. package/dist/usage-BRqVP3CJ.js.map +1 -0
  312. package/dist/utils/index.d.ts +2 -1
  313. package/dist/utils/index.js +3 -3
  314. package/dist/utils/index.js.map +1 -1
  315. package/dist/utils-DL85Tnbn.js +500 -0
  316. package/dist/utils-DL85Tnbn.js.map +1 -0
  317. package/dist/validation/index.d.ts +2 -2
  318. package/dist/validation/index.js +3 -3
  319. package/dist/validation/index.js.map +1 -1
  320. package/dist/validation-CPUITdMk.js +762 -0
  321. package/dist/validation-CPUITdMk.js.map +1 -0
  322. package/dist/workspace-extension-COrC0dYi.js +979 -0
  323. package/dist/workspace-extension-COrC0dYi.js.map +1 -0
  324. package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
  325. package/package.json +7 -10
  326. package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
  327. package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
  328. package/dist/chunk-4XIBXZ6J.js +0 -276
  329. package/dist/chunk-4XIBXZ6J.js.map +0 -1
  330. package/dist/chunk-554Z4C2K.js +0 -1006
  331. package/dist/chunk-554Z4C2K.js.map +0 -1
  332. package/dist/chunk-5CAFHK2Z.js +0 -107
  333. package/dist/chunk-5CAFHK2Z.js.map +0 -1
  334. package/dist/chunk-63ZXJ42X.js +0 -451
  335. package/dist/chunk-63ZXJ42X.js.map +0 -1
  336. package/dist/chunk-6XEXJATV.js +0 -304
  337. package/dist/chunk-6XEXJATV.js.map +0 -1
  338. package/dist/chunk-726AR6Q7.js +0 -1532
  339. package/dist/chunk-726AR6Q7.js.map +0 -1
  340. package/dist/chunk-A5F6Z5UE.js +0 -21
  341. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  342. package/dist/chunk-A6DE32ZS.js +0 -1507
  343. package/dist/chunk-A6DE32ZS.js.map +0 -1
  344. package/dist/chunk-AXJDGQPE.js +0 -690
  345. package/dist/chunk-AXJDGQPE.js.map +0 -1
  346. package/dist/chunk-BJQOGOVW.js +0 -602
  347. package/dist/chunk-BJQOGOVW.js.map +0 -1
  348. package/dist/chunk-CFXWH2IS.js +0 -52
  349. package/dist/chunk-CFXWH2IS.js.map +0 -1
  350. package/dist/chunk-DRWH5XCJ.js +0 -876
  351. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  352. package/dist/chunk-E4QNLVY4.js +0 -909
  353. package/dist/chunk-E4QNLVY4.js.map +0 -1
  354. package/dist/chunk-EBDHIL7V.js +0 -774
  355. package/dist/chunk-EBDHIL7V.js.map +0 -1
  356. package/dist/chunk-ELU7VL3E.js +0 -245
  357. package/dist/chunk-ELU7VL3E.js.map +0 -1
  358. package/dist/chunk-FZRODKIN.js +0 -31
  359. package/dist/chunk-FZRODKIN.js.map +0 -1
  360. package/dist/chunk-GCIB76AJ.js +0 -882
  361. package/dist/chunk-GCIB76AJ.js.map +0 -1
  362. package/dist/chunk-HC6MPUIH.js +0 -1571
  363. package/dist/chunk-HC6MPUIH.js.map +0 -1
  364. package/dist/chunk-HNMHPSAM.js +0 -272
  365. package/dist/chunk-HNMHPSAM.js.map +0 -1
  366. package/dist/chunk-HTLEGD3Q.js +0 -1480
  367. package/dist/chunk-HTLEGD3Q.js.map +0 -1
  368. package/dist/chunk-I3KOWRT3.js +0 -89
  369. package/dist/chunk-I3KOWRT3.js.map +0 -1
  370. package/dist/chunk-ID3WR4JS.js +0 -509
  371. package/dist/chunk-ID3WR4JS.js.map +0 -1
  372. package/dist/chunk-JS52ZHTK.js +0 -1346
  373. package/dist/chunk-JS52ZHTK.js.map +0 -1
  374. package/dist/chunk-JVMAQOA3.js +0 -521
  375. package/dist/chunk-JVMAQOA3.js.map +0 -1
  376. package/dist/chunk-KH4TRQCO.js +0 -1063
  377. package/dist/chunk-KH4TRQCO.js.map +0 -1
  378. package/dist/chunk-KJOSPVB2.js +0 -57
  379. package/dist/chunk-KJOSPVB2.js.map +0 -1
  380. package/dist/chunk-KO2ZXZ7W.js +0 -61
  381. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  382. package/dist/chunk-KS2HQCJR.js +0 -56
  383. package/dist/chunk-KS2HQCJR.js.map +0 -1
  384. package/dist/chunk-LA5KPWZ2.js +0 -413
  385. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  386. package/dist/chunk-MESLAC5W.js +0 -574
  387. package/dist/chunk-MESLAC5W.js.map +0 -1
  388. package/dist/chunk-MWPYA2HD.js +0 -94
  389. package/dist/chunk-MWPYA2HD.js.map +0 -1
  390. package/dist/chunk-NUB5GQTU.js +0 -270
  391. package/dist/chunk-NUB5GQTU.js.map +0 -1
  392. package/dist/chunk-OBBCR6WY.js +0 -277
  393. package/dist/chunk-OBBCR6WY.js.map +0 -1
  394. package/dist/chunk-OQDSAOG3.js +0 -1908
  395. package/dist/chunk-OQDSAOG3.js.map +0 -1
  396. package/dist/chunk-OXNCBE7P.js +0 -971
  397. package/dist/chunk-OXNCBE7P.js.map +0 -1
  398. package/dist/chunk-PBZFAAOM.js +0 -941
  399. package/dist/chunk-PN6GIF3R.js +0 -1185
  400. package/dist/chunk-PN6GIF3R.js.map +0 -1
  401. package/dist/chunk-PYD44IHJ.js +0 -728
  402. package/dist/chunk-PYD44IHJ.js.map +0 -1
  403. package/dist/chunk-QVPIACWD.js +0 -679
  404. package/dist/chunk-QVPIACWD.js.map +0 -1
  405. package/dist/chunk-QWNNFE4P.js +0 -41
  406. package/dist/chunk-QWNNFE4P.js.map +0 -1
  407. package/dist/chunk-RU266375.js +0 -327
  408. package/dist/chunk-RU266375.js.map +0 -1
  409. package/dist/chunk-RYTSVGGA.js +0 -1624
  410. package/dist/chunk-RYTSVGGA.js.map +0 -1
  411. package/dist/chunk-RZOFS2BQ.js +0 -225
  412. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  413. package/dist/chunk-SBS4S2PJ.js +0 -100
  414. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  415. package/dist/chunk-SPRG6G6G.js +0 -530
  416. package/dist/chunk-SPRG6G6G.js.map +0 -1
  417. package/dist/chunk-STWFX5E2.js +0 -233
  418. package/dist/chunk-STWFX5E2.js.map +0 -1
  419. package/dist/chunk-UNASM5VJ.js +0 -419
  420. package/dist/chunk-UNASM5VJ.js.map +0 -1
  421. package/dist/chunk-VAT66FJA.js +0 -245
  422. package/dist/chunk-VAT66FJA.js.map +0 -1
  423. package/dist/chunk-VFCMR5GX.js +0 -49
  424. package/dist/chunk-VFCMR5GX.js.map +0 -1
  425. package/dist/chunk-VGAHZKNJ.js +0 -66
  426. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  427. package/dist/chunk-VTJTAAXC.js +0 -627
  428. package/dist/chunk-VTJTAAXC.js.map +0 -1
  429. package/dist/chunk-VXVLKRU6.js +0 -758
  430. package/dist/chunk-VXVLKRU6.js.map +0 -1
  431. package/dist/chunk-WWUU5ETI.js +0 -163
  432. package/dist/chunk-WWUU5ETI.js.map +0 -1
  433. package/dist/chunk-XE4OXN2W.js +0 -10
  434. package/dist/chunk-XE4OXN2W.js.map +0 -1
  435. package/dist/chunk-XOJORS75.js +0 -1853
  436. package/dist/chunk-XOJORS75.js.map +0 -1
  437. package/dist/chunk-YMZEUTD2.js +0 -110
  438. package/dist/chunk-YMZEUTD2.js.map +0 -1
  439. package/dist/chunk-Z77BTSOK.js +0 -617
  440. package/dist/chunk-Z77BTSOK.js.map +0 -1
  441. package/dist/chunk-ZZK3WEDI.js +0 -181
  442. package/dist/chunk-ZZK3WEDI.js.map +0 -1
  443. package/dist/client-CCXpAZ2r.d.ts +0 -89
  444. package/dist/client-DSI_760t.d.ts +0 -36
  445. package/dist/client-JU6T3UPB.js +0 -11
  446. package/dist/client-JU6T3UPB.js.map +0 -1
  447. package/dist/dist-2X4Q7PJA.js +0 -1491
  448. package/dist/dist-2X4Q7PJA.js.map +0 -1
  449. package/dist/env-4UWSUS64.js +0 -4
  450. package/dist/env-4UWSUS64.js.map +0 -1
  451. package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
  452. package/dist/graphql-CMHMQjvd.d.ts +0 -23
  453. package/dist/i18n-Qm2AkPC-.d.ts +0 -33
  454. package/dist/index--yvpa6ay.d.ts +0 -83
  455. package/dist/index-4gKQKZ2B.d.ts +0 -71
  456. package/dist/index-5x0XMKXN.d.ts +0 -149
  457. package/dist/index-B70b5mYS.d.ts +0 -33
  458. package/dist/index-B8KrxO4j.d.ts +0 -755
  459. package/dist/index-BOuDKnqD.d.ts +0 -201
  460. package/dist/index-BTMt4OjA.d.ts +0 -201
  461. package/dist/index-BejbszA7.d.ts +0 -39
  462. package/dist/index-BkeOYZye.d.ts +0 -198
  463. package/dist/index-BuAj5nXg.d.ts +0 -83
  464. package/dist/index-BvkVcW8I.d.ts +0 -349
  465. package/dist/index-CWmH_-RZ.d.ts +0 -247
  466. package/dist/index-CbgWNcus.d.ts +0 -258
  467. package/dist/index-CmfPeQza.d.ts +0 -166
  468. package/dist/index-CmpG-zak.d.ts +0 -607
  469. package/dist/index-CoMKgL-p.d.ts +0 -12
  470. package/dist/index-D8HGwglK.d.ts +0 -541
  471. package/dist/index-DCaVm66D.d.ts +0 -1101
  472. package/dist/index-DE2w7E0d.d.ts +0 -83
  473. package/dist/index-DSOpj8DI.d.ts +0 -17
  474. package/dist/index-DW9q22GH.d.ts +0 -75
  475. package/dist/index-DnjJ9CwI.d.ts +0 -347
  476. package/dist/index-DwMJZ8PP.d.ts +0 -317
  477. package/dist/index-PaojfSdd.d.ts +0 -71
  478. package/dist/index-aHtYvc3i.d.ts +0 -284
  479. package/dist/index-e_18DzAg.d.ts +0 -18
  480. package/dist/index-ffmipXSA.d.ts +0 -55
  481. package/dist/index-joONjwLt.d.ts +0 -33
  482. package/dist/index-kssw5ziY.d.ts +0 -250
  483. package/dist/index-lFffh5-G.d.ts +0 -125
  484. package/dist/index-pxYge_6k.d.ts +0 -79
  485. package/dist/layer-Cv9vSwBx.d.ts +0 -70
  486. package/dist/pino-logger-H4HPW5P6.js +0 -5
  487. package/dist/pino-logger-H4HPW5P6.js.map +0 -1
  488. package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
  489. package/dist/sdk-L75WWUP3.js +0 -156
  490. package/dist/sdk-L75WWUP3.js.map +0 -1
  491. package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
  492. package/dist/types-Bo2wkjSP.d.ts +0 -35
  493. package/dist/types-DVpvrAhd.d.ts +0 -71
  494. package/dist/types-DgJ4lDYA.d.ts +0 -108
  495. package/dist/types-USOv09qy.d.ts +0 -327
  496. package/dist/workspace-guard-NXVYYBVJ.js +0 -5
  497. package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
@@ -0,0 +1,1457 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
2
+ import { a as logger } from "./logger-B6rCpb7D.js";
3
+ import { a as delayQueueKey, c as matchSubject, d as streamKey, i as delayLockKey, l as registryKey, n as boundaryOf, o as dlqKey, r as dedupKey, s as isWildcard, t as RedisStreamsConnection, u as replyKey } from "./RedisStreamsConnection-CY8WySJy.js";
4
+ import { a as unregisterDisposable, i as registerDisposable } from "./lifecycle-DeoLSX0U.js";
5
+ import { a as resolveEventStreamsUrl } from "./env-DdaoGjIt.js";
6
+ import { randomUUID } from "node:crypto";
7
+ import { hostname } from "node:os";
8
+
9
+ // src/event-queue/types/config.ts
10
+ /**
11
+ * Event Queue Configuration Types
12
+ */
13
+ /**
14
+ * Queue type enum
15
+ */
16
+ let QueueType = /* @__PURE__ */ function(QueueType) {
17
+ QueueType["REDIS_STREAMS"] = "redis-streams";
18
+ QueueType["RABBITMQ"] = "rabbitmq";
19
+ QueueType["KAFKA"] = "kafka";
20
+ QueueType["SQS"] = "sqs";
21
+ return QueueType;
22
+ }({});
23
+
24
+ // src/event-queue/implementations/redis-streams/trace-context.ts
25
+ /**
26
+ * W3C trace context propagation for Redis Streams entries.
27
+ *
28
+ * Stream entries carry trace context as ordinary fields (`traceparent`,
29
+ * `tracestate`, `baggage`). When `@opentelemetry/api` isn't installed at the
30
+ * consumer, these helpers degrade to no-ops.
31
+ */
32
+ let otelApiPromise = null;
33
+ async function loadOtelApi() {
34
+ if (otelApiPromise) return otelApiPromise;
35
+ otelApiPromise = (async () => {
36
+ try {
37
+ return await import("./dist-BGKdXVy3.js");
38
+ } catch {
39
+ logger.debug("[redis-streams/trace-context] @opentelemetry/api not available; tracing disabled");
40
+ return null;
41
+ }
42
+ })();
43
+ return otelApiPromise;
44
+ }
45
+ const TRACE_KEYS = [
46
+ "traceparent",
47
+ "tracestate",
48
+ "baggage"
49
+ ];
50
+ /** Inject the active OTel context into a plain record of stream fields. */
51
+ async function injectTraceFields() {
52
+ const api = await loadOtelApi();
53
+ if (!api) return {};
54
+ const carrier = {};
55
+ try {
56
+ api.propagation.inject(api.context.active(), carrier, { set(c, k, v) {
57
+ c[k] = v;
58
+ } });
59
+ } catch (err) {
60
+ logger.debug("[redis-streams/trace-context] inject failed", { error: err instanceof Error ? err.message : String(err) });
61
+ }
62
+ return carrier;
63
+ }
64
+ /** Extract OTel context from stream-entry fields. */
65
+ async function extractTraceContext(fields) {
66
+ const api = await loadOtelApi();
67
+ if (!api) return void 0;
68
+ const carrier = {};
69
+ for (const key of TRACE_KEYS) {
70
+ const value = fields[key];
71
+ if (value) carrier[key] = value;
72
+ }
73
+ try {
74
+ return api.propagation.extract(api.context.active(), carrier, {
75
+ get(c, k) {
76
+ return c[k];
77
+ },
78
+ keys(c) {
79
+ return Object.keys(c);
80
+ }
81
+ });
82
+ } catch {
83
+ return;
84
+ }
85
+ }
86
+ /**
87
+ * Wrap a consumer handler in a CONSUMER-kind span rooted at the carried trace.
88
+ *
89
+ * The handler runs exactly once. If the tracing setup itself fails before the
90
+ * handler started, it runs untraced; a handler failure is always propagated
91
+ * and never retried here (retrying would execute a non-idempotent handler
92
+ * twice for one delivery).
93
+ */
94
+ async function runWithConsumerSpan(subject, fields, handler) {
95
+ const api = await loadOtelApi();
96
+ if (!api) return handler();
97
+ let started = false;
98
+ const once = () => {
99
+ started = true;
100
+ return handler();
101
+ };
102
+ try {
103
+ const parentCtx = await extractTraceContext(fields);
104
+ const tracer = api.trace.getTracer("@burdenoff/be-sdk/redis-streams");
105
+ return await new Promise((resolve, reject) => {
106
+ tracer.startActiveSpan(`redis-streams.consume ${subject}`, {
107
+ kind: 5,
108
+ attributes: {
109
+ "messaging.system": "redis",
110
+ "messaging.destination.name": subject
111
+ }
112
+ }, parentCtx, async (span) => {
113
+ try {
114
+ const result = await once();
115
+ span.setStatus({ code: 1 });
116
+ span.end();
117
+ resolve(result);
118
+ } catch (err) {
119
+ span.recordException(err instanceof Error ? err : new Error(String(err)));
120
+ span.setStatus({
121
+ code: 2,
122
+ message: err instanceof Error ? err.message : String(err)
123
+ });
124
+ span.end();
125
+ reject(err);
126
+ }
127
+ });
128
+ });
129
+ } catch (err) {
130
+ if (started) throw err;
131
+ return handler();
132
+ }
133
+ }
134
+
135
+ // src/event-queue/implementations/redis-streams/settlement.ts
136
+ /** Serializes concurrent operations; only an idempotent XACK may retry after an uncertain response. */
137
+ function messageSettlement(transport) {
138
+ let tail = Promise.resolve();
139
+ let confirmed = false;
140
+ let publication = null;
141
+ let published = false;
142
+ let held = false;
143
+ const serial = (operation) => {
144
+ const result = tail.then(operation);
145
+ tail = result.catch(() => void 0);
146
+ return result;
147
+ };
148
+ const acknowledge = async () => {
149
+ await transport.acknowledge();
150
+ confirmed = true;
151
+ transport.confirmed();
152
+ };
153
+ const settle = (intent, publish) => serial(async () => {
154
+ if (confirmed) return;
155
+ if (held) throw new Error("EVENT_SETTLEMENT_PUBLICATION_UNKNOWN");
156
+ if (publication && intent !== publication && intent !== "ACK") throw new Error("EVENT_SETTLEMENT_INTENT_CONFLICT");
157
+ publication ??= intent;
158
+ if (publish && !published) {
159
+ publication = intent;
160
+ held = true;
161
+ try {
162
+ await publish();
163
+ published = true;
164
+ held = false;
165
+ } catch {
166
+ throw new Error("EVENT_SETTLEMENT_PUBLICATION_UNKNOWN");
167
+ }
168
+ }
169
+ await acknowledge();
170
+ });
171
+ return {
172
+ ack: () => settle("ACK"),
173
+ nak: (delay = 0) => {
174
+ if (!Number.isSafeInteger(delay) || delay < 0) return Promise.reject(/* @__PURE__ */ new Error("EVENT_SETTLEMENT_DELAY_INVALID"));
175
+ if (delay === 0) return serial(async () => {
176
+ if (held) throw new Error("EVENT_SETTLEMENT_PUBLICATION_UNKNOWN");
177
+ if (publication && !confirmed) throw new Error("EVENT_SETTLEMENT_INTENT_CONFLICT");
178
+ });
179
+ return settle(`DELAY:${delay}`, () => transport.delay(delay));
180
+ },
181
+ term: (reason) => settle(`TERM:${reason ?? "explicit"}`, () => transport.terminate(reason))
182
+ };
183
+ }
184
+
185
+ // src/event-queue/implementations/dispatch-limiter.ts
186
+ /**
187
+ * Bounded dispatch for event-queue consumers.
188
+ *
189
+ * A {@link DispatchLimiter} hands out at most `concurrency` slots. A consumer
190
+ * loop acquires a slot before it starts a handler and the slot is released
191
+ * when the handler settles, so no more than `concurrency` handlers of one
192
+ * subscription run at the same time. `drain()` waits for every started
193
+ * handler, bounded by a timeout, which is what graceful shutdown needs.
194
+ *
195
+ * Shared by the Redis Streams and in-memory consumers so both transports
196
+ * dispatch with the same semantics.
197
+ */
198
+ /** Validates a `concurrency` value; `undefined` yields the default of 1. */
199
+ function resolveConcurrency(value, label = "concurrency") {
200
+ if (value === void 0) return 1;
201
+ if (!Number.isInteger(value) || value < 1) throw new Error(`[event-queue] ${label} must be a positive integer, got ${String(value)}`);
202
+ return value;
203
+ }
204
+ /** Validates a `drainTimeoutMs` value; `undefined` yields `fallbackMs`. */
205
+ function resolveDrainTimeout(value, fallbackMs) {
206
+ if (value === void 0) return fallbackMs;
207
+ if (!Number.isFinite(value) || value < 0) throw new Error(`[event-queue] drainTimeoutMs must be a non-negative number, got ${String(value)}`);
208
+ return value;
209
+ }
210
+ var DispatchLimiter = class {
211
+ concurrency;
212
+ active = 0;
213
+ waiters = [];
214
+ running = /* @__PURE__ */ new Set();
215
+ constructor(concurrency) {
216
+ this.concurrency = concurrency;
217
+ resolveConcurrency(concurrency);
218
+ }
219
+ /** Slots not currently held. */
220
+ get freeSlots() {
221
+ return this.concurrency - this.active;
222
+ }
223
+ /** Handlers started through {@link run} that have not settled yet. */
224
+ get inFlight() {
225
+ return this.running.size;
226
+ }
227
+ /** Waits for a slot and takes it. Waiters are served in FIFO order. */
228
+ acquire() {
229
+ if (this.active < this.concurrency) {
230
+ this.active++;
231
+ return Promise.resolve();
232
+ }
233
+ return new Promise((resolve) => {
234
+ this.waiters.push(() => {
235
+ this.active++;
236
+ resolve();
237
+ });
238
+ });
239
+ }
240
+ /** Takes a slot only if one is free right now. */
241
+ tryAcquire() {
242
+ if (this.active >= this.concurrency) return false;
243
+ this.active++;
244
+ return true;
245
+ }
246
+ /** Returns a slot taken with {@link acquire} or {@link tryAcquire} that was not passed to {@link run}. */
247
+ release() {
248
+ if (this.active === 0) return;
249
+ this.active--;
250
+ this.waiters.shift()?.();
251
+ }
252
+ /**
253
+ * Runs `task` on a slot the caller already holds and releases the slot when
254
+ * the task settles. The task must handle its own errors; a rejection is
255
+ * swallowed here so one failure never affects its siblings.
256
+ */
257
+ run(task) {
258
+ const promise = Promise.resolve().then(task).catch(() => void 0).finally(() => {
259
+ this.running.delete(promise);
260
+ this.release();
261
+ });
262
+ this.running.add(promise);
263
+ }
264
+ /**
265
+ * Waits for every running task, at most `timeoutMs`. Resolves `true` when
266
+ * everything settled in time and `false` on timeout (the tasks keep running).
267
+ */
268
+ async drain(timeoutMs) {
269
+ if (this.running.size === 0) return true;
270
+ let timer;
271
+ const timedOut = new Promise((resolve) => {
272
+ timer = setTimeout(() => resolve(false), timeoutMs);
273
+ timer.unref?.();
274
+ });
275
+ const settled = (async () => {
276
+ while (this.running.size > 0) await Promise.allSettled([...this.running]);
277
+ return true;
278
+ })();
279
+ try {
280
+ return await Promise.race([settled, timedOut]);
281
+ } finally {
282
+ if (timer) clearTimeout(timer);
283
+ }
284
+ }
285
+ };
286
+
287
+ // src/event-queue/implementations/redis-streams/RedisStreamsEventConsumer.ts
288
+ /**
289
+ * Redis Streams implementation of IEventConsumer.
290
+ *
291
+ * One ioredis client per active subscription handles `XREADGROUP BLOCK` in a
292
+ * background loop, with a small ZSET-based delay queue draining NAK'd messages
293
+ * back into the stream when their delay expires.
294
+ *
295
+ * Dispatch is bounded per subscription by `concurrency` (default 1, serial).
296
+ * Every entry this process has read and not yet settled is "held": a heartbeat
297
+ * re-claims held ids with `XCLAIM … JUSTID` every ackWait/2 so their idle time
298
+ * never reaches ackWait, which keeps this process's and other replicas' sweeps
299
+ * away from live work. The sweep only reclaims entries idle longer than
300
+ * ackWait that are not held here, re-dispatches them through the same bounded
301
+ * dispatcher while their delivery count is within maxDeliver, and
302
+ * dead-letters them past it. Unsubscribe and disconnect stop reading, wait for
303
+ * in-flight handlers (bounded by `drainTimeoutMs`) and only then close.
304
+ *
305
+ * A delayed nak re-adds the payload as a new stream entry, which starts with a
306
+ * fresh delivery count. The attempts already used travel with it in the
307
+ * `delivery-attempts` field, so `getDeliveryAttempt()` keeps counting and the
308
+ * entry is dead-lettered once it would exceed maxDeliver (BOFF-11323).
309
+ */
310
+ const DEFAULT_BLOCK_MS = 5e3;
311
+ const DEFAULT_BATCH = 10;
312
+ const REGISTRY_REFRESH_MS = 1e4;
313
+ const DEFAULT_ACK_WAIT_MS = 3e4;
314
+ const DEFAULT_MAX_DELIVER = 3;
315
+ const SWEEP_INTERVAL_MS = 15e3;
316
+ const SWEEP_BATCH = 50;
317
+ const HEARTBEAT_MIN_INTERVAL_MS = 250;
318
+ const HEARTBEAT_CHUNK = 100;
319
+ const DELAYQ_INTERVAL_MS = 1e3;
320
+ /**
321
+ * Field carried by an entry that a delayed nak re-added: how many deliveries
322
+ * the message had already used before it was parked. Read back by parseEntry.
323
+ */
324
+ const DELIVERY_ATTEMPTS_FIELD = "delivery-attempts";
325
+ function parsePendingRows(reply) {
326
+ if (!Array.isArray(reply)) return [];
327
+ const rows = [];
328
+ for (const row of reply) {
329
+ if (!Array.isArray(row)) continue;
330
+ const id = row[0];
331
+ const deliveries = Number(row[3]);
332
+ if (typeof id !== "string" || !Number.isFinite(deliveries)) continue;
333
+ rows.push({
334
+ id,
335
+ deliveries
336
+ });
337
+ }
338
+ return rows;
339
+ }
340
+ function parseClaimedEntries(reply) {
341
+ const out = /* @__PURE__ */ new Map();
342
+ if (!Array.isArray(reply)) return out;
343
+ for (const entry of reply) {
344
+ if (!Array.isArray(entry)) continue;
345
+ const id = entry[0];
346
+ const fields = entry[1];
347
+ if (typeof id !== "string" || !Array.isArray(fields)) continue;
348
+ out.set(id, fields.filter((f) => typeof f === "string"));
349
+ }
350
+ return out;
351
+ }
352
+ function errorMessage(err) {
353
+ return err instanceof Error ? err.message : String(err);
354
+ }
355
+ /** Deliveries used before a delayed nak re-added this entry; 0 for an entry published normally. */
356
+ function priorAttempts(fields) {
357
+ const raw = fields[DELIVERY_ATTEMPTS_FIELD];
358
+ if (raw === void 0) return 0;
359
+ const n = Number(raw);
360
+ return Number.isSafeInteger(n) && n > 0 ? n : 0;
361
+ }
362
+ /** A subscription's maxDeliver, falling back to the consumer's; rejects anything but a positive integer. */
363
+ function resolveMaxDeliver(value, fallback) {
364
+ if (value === void 0) return fallback;
365
+ if (!Number.isInteger(value) || value < 1) throw new Error(`[RedisStreamsEventConsumer] maxDeliver must be a positive integer, got ${String(value)}`);
366
+ return value;
367
+ }
368
+ var RedisStreamsSubscription = class {
369
+ subject;
370
+ unsubscribeFn;
371
+ id = randomUUID();
372
+ active = true;
373
+ receivedCount = 0;
374
+ processedCount = 0;
375
+ failedCount = 0;
376
+ lastActivity = (/* @__PURE__ */ new Date()).toISOString();
377
+ constructor(subject, unsubscribeFn) {
378
+ this.subject = subject;
379
+ this.unsubscribeFn = unsubscribeFn;
380
+ }
381
+ async unsubscribe() {
382
+ if (!this.active) return;
383
+ this.active = false;
384
+ await this.unsubscribeFn();
385
+ }
386
+ isActive() {
387
+ return this.active;
388
+ }
389
+ getStats() {
390
+ return {
391
+ messagesReceived: this.receivedCount,
392
+ messagesProcessed: this.processedCount,
393
+ messagesFailed: this.failedCount,
394
+ lastActivity: this.lastActivity
395
+ };
396
+ }
397
+ recordReceived() {
398
+ this.receivedCount++;
399
+ this.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
400
+ }
401
+ recordProcessed() {
402
+ this.processedCount++;
403
+ this.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
404
+ }
405
+ recordFailed() {
406
+ this.failedCount++;
407
+ this.lastActivity = (/* @__PURE__ */ new Date()).toISOString();
408
+ }
409
+ };
410
+ var RedisStreamsEventConsumer = class {
411
+ shutdownName;
412
+ connection;
413
+ subscriptions = [];
414
+ subscriptionLoops = /* @__PURE__ */ new Set();
415
+ keyPrefix;
416
+ consumerName;
417
+ group;
418
+ maxDeliver;
419
+ ackWaitMs;
420
+ /** XREADGROUP COUNT for serial subscriptions (historical name; not a concurrency limit). */
421
+ maxConcurrent;
422
+ concurrency;
423
+ drainTimeoutMs;
424
+ consumedCount = 0;
425
+ failedCount = 0;
426
+ lastActivity = null;
427
+ stopped = false;
428
+ sweepTimer = null;
429
+ delayqTimer = null;
430
+ heartbeatTimer = null;
431
+ /** stream -> the subscription loop consuming it (used to re-dispatch reclaimed entries). */
432
+ workers = /* @__PURE__ */ new Map();
433
+ /** Every stream loop a subscription started, for drain and cleanup. */
434
+ subWorkers = /* @__PURE__ */ new Map();
435
+ /** stream -> ids read by this process and not yet settled by their handler. */
436
+ held = /* @__PURE__ */ new Map();
437
+ /** Blocking clients per subscription, closed on unsubscribe to abort a pending XREADGROUP BLOCK. */
438
+ blockingClients = /* @__PURE__ */ new Map();
439
+ settlements = /* @__PURE__ */ new Map();
440
+ retainedSerializedFieldsBytes = 0;
441
+ knownStreams = /* @__PURE__ */ new Map();
442
+ constructor(config) {
443
+ this.connection = new RedisStreamsConnection({
444
+ type: "redis-streams",
445
+ url: config.url ?? process.env["REDIS_URL"] ?? "redis://localhost:6379",
446
+ user: config.user,
447
+ password: config.password,
448
+ name: config.name,
449
+ connectionTimeout: config.connectionTimeout,
450
+ keyScope: config.keyScope
451
+ });
452
+ this.keyPrefix = config.keyPrefix ?? process.env["REDIS_STREAMS_KEY_PREFIX"] ?? "boff:events";
453
+ this.group = config.consumer || config.name || "default-consumer";
454
+ this.consumerName = `${this.group}:${hostname()}:${process.pid}`;
455
+ this.maxDeliver = config.maxDeliver ?? DEFAULT_MAX_DELIVER;
456
+ this.ackWaitMs = config.ackWait ? Math.max(1e3, Math.round(config.ackWait / 1e6)) : DEFAULT_ACK_WAIT_MS;
457
+ this.maxConcurrent = config.maxConcurrent ?? 5;
458
+ this.concurrency = resolveConcurrency(config.concurrency);
459
+ this.drainTimeoutMs = resolveDrainTimeout(config.drainTimeoutMs, this.ackWaitMs);
460
+ this.shutdownName = `redis-streams-consumer:${config.name ?? this.group}`;
461
+ registerDisposable(this);
462
+ }
463
+ /** Close underlying connections on graceful shutdown. */
464
+ dispose() {
465
+ return this.disconnect();
466
+ }
467
+ async connect() {
468
+ await this.connection.connect();
469
+ if (!this.sweepTimer) {
470
+ const t = setInterval(() => {
471
+ this.sweepPending().catch((err) => {
472
+ logger.debug("[RedisStreamsEventConsumer] sweep error", { error: err instanceof Error ? err.message : String(err) });
473
+ });
474
+ }, SWEEP_INTERVAL_MS);
475
+ t.unref?.();
476
+ this.sweepTimer = t;
477
+ }
478
+ if (!this.delayqTimer) {
479
+ const t = setInterval(() => {
480
+ this.drainDelayQueues().catch(() => void 0);
481
+ }, DELAYQ_INTERVAL_MS);
482
+ t.unref?.();
483
+ this.delayqTimer = t;
484
+ }
485
+ if (!this.heartbeatTimer) {
486
+ const t = setInterval(() => {
487
+ this.heartbeat().catch(() => void 0);
488
+ }, Math.max(HEARTBEAT_MIN_INTERVAL_MS, Math.floor(this.ackWaitMs / 2)));
489
+ t.unref?.();
490
+ this.heartbeatTimer = t;
491
+ }
492
+ }
493
+ /**
494
+ * Stops reading, waits for in-flight handlers (bounded by `drainTimeoutMs`)
495
+ * so they can still ack, then closes the connection. The heartbeat keeps
496
+ * running during the drain so live entries are not reclaimed meanwhile.
497
+ */
498
+ async disconnect() {
499
+ unregisterDisposable(this);
500
+ this.stopped = true;
501
+ if (this.sweepTimer) clearInterval(this.sweepTimer);
502
+ if (this.delayqTimer) clearInterval(this.delayqTimer);
503
+ this.sweepTimer = null;
504
+ this.delayqTimer = null;
505
+ await this.unsubscribeAll();
506
+ if (this.heartbeatTimer) clearInterval(this.heartbeatTimer);
507
+ this.heartbeatTimer = null;
508
+ await this.connection.disconnect();
509
+ }
510
+ isConnected() {
511
+ return this.connection.isConnected();
512
+ }
513
+ async healthCheck() {
514
+ try {
515
+ const t0 = Date.now();
516
+ return {
517
+ status: await this.connection.ping() === "PONG" ? "healthy" : "degraded",
518
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
519
+ connected: this.isConnected(),
520
+ latencyMs: Date.now() - t0,
521
+ details: {
522
+ type: "redis-streams",
523
+ subscriptions: this.subscriptions.length
524
+ }
525
+ };
526
+ } catch (err) {
527
+ return {
528
+ status: "unhealthy",
529
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
530
+ connected: false,
531
+ details: { type: "redis-streams" },
532
+ error: err instanceof Error ? err.message : String(err)
533
+ };
534
+ }
535
+ }
536
+ async getStatistics() {
537
+ return Promise.resolve({
538
+ messagesConsumed: this.consumedCount,
539
+ messagesFailed: this.failedCount,
540
+ messagesPublished: 0,
541
+ activeConsumers: this.subscriptions.length,
542
+ lastActivity: this.lastActivity?.toISOString() ?? null,
543
+ details: {
544
+ type: "redis-streams",
545
+ group: this.group
546
+ }
547
+ });
548
+ }
549
+ async ensureStream(_config) {
550
+ return Promise.resolve();
551
+ }
552
+ async ensureConsumer(_config) {
553
+ return Promise.resolve();
554
+ }
555
+ async subscribe(opts) {
556
+ await this.connect();
557
+ const concurrency = resolveConcurrency(opts.options?.concurrency ?? this.concurrency);
558
+ const drainTimeoutMs = resolveDrainTimeout(opts.options?.drainTimeoutMs, this.drainTimeoutMs);
559
+ const maxDeliver = resolveMaxDeliver(opts.options?.maxDeliver, this.maxDeliver);
560
+ const limiter = () => new DispatchLimiter(concurrency);
561
+ const sub = new RedisStreamsSubscription(opts.subject, async () => {
562
+ this.subscriptions = this.subscriptions.filter((s) => s !== sub);
563
+ this.abortReads(sub);
564
+ await this.drainSubscription(sub, opts.subject, drainTimeoutMs);
565
+ this.releaseStreams(sub);
566
+ });
567
+ this.subscriptions.push(sub);
568
+ const startId = this.resolveStartId(opts.options?.deliverPolicy);
569
+ const wildcard = isWildcard(opts.subject);
570
+ const handlerFn = opts.handler;
571
+ if (opts.options?.stream) {
572
+ const stream = streamKey(opts.options.stream, {
573
+ prefix: this.keyPrefix,
574
+ scope: this.connection.keyScope
575
+ });
576
+ await this.ensureGroup(stream, startId);
577
+ this.knownStreams.set(stream, opts.subject);
578
+ const subjectFilter = wildcard ? opts.subject : null;
579
+ const filteredHandler = subjectFilter ? async (evt) => {
580
+ if (matchSubject(subjectFilter, evt.subject)) await handlerFn(evt);
581
+ else await evt.ack();
582
+ } : handlerFn;
583
+ this.spawnLoop(sub, stream, opts.subject, filteredHandler, limiter(), maxDeliver);
584
+ return sub;
585
+ }
586
+ if (!wildcard) {
587
+ const stream = streamKey(opts.subject, {
588
+ prefix: this.keyPrefix,
589
+ scope: this.connection.keyScope
590
+ });
591
+ await this.ensureGroup(stream, startId);
592
+ this.knownStreams.set(stream, opts.subject);
593
+ this.spawnLoop(sub, stream, opts.subject, handlerFn, limiter(), maxDeliver);
594
+ } else {
595
+ const boundary = boundaryOf(opts.subject);
596
+ const refresh = async () => {
597
+ const subjects = await this.connection.getClient().smembers(registryKey(boundary, this.connection.keyScope));
598
+ for (const s of subjects) {
599
+ if (!matchSubject(opts.subject, s)) continue;
600
+ const stream = streamKey(s, {
601
+ prefix: this.keyPrefix,
602
+ scope: this.connection.keyScope
603
+ });
604
+ if (this.knownStreams.has(stream)) continue;
605
+ await this.ensureGroup(stream, startId);
606
+ this.knownStreams.set(stream, s);
607
+ this.spawnLoop(sub, stream, s, handlerFn, limiter(), maxDeliver);
608
+ }
609
+ };
610
+ await refresh();
611
+ const t = setInterval(() => {
612
+ if (this.stopped || !sub.isActive()) {
613
+ clearInterval(t);
614
+ return;
615
+ }
616
+ refresh().catch(() => void 0);
617
+ }, REGISTRY_REFRESH_MS);
618
+ t.unref?.();
619
+ }
620
+ return sub;
621
+ }
622
+ async subscribeMultiple(subjects, handler, options) {
623
+ const out = [];
624
+ for (const subject of subjects) out.push(await this.subscribe({
625
+ subject,
626
+ handler,
627
+ options
628
+ }));
629
+ return out;
630
+ }
631
+ async pull(opts) {
632
+ await this.connect();
633
+ const stream = streamKey(opts.subject, {
634
+ prefix: this.keyPrefix,
635
+ scope: this.connection.keyScope
636
+ });
637
+ await this.ensureGroup(stream, "$");
638
+ const raw = await this.connection.getClient().xreadgroup("GROUP", this.group, this.consumerName, "COUNT", opts.batch ?? DEFAULT_BATCH, "BLOCK", opts.timeout ?? DEFAULT_BLOCK_MS, "STREAMS", stream, ">");
639
+ if (!raw) return [];
640
+ const out = [];
641
+ for (const [streamName, entries] of raw) for (const [id, rawFields] of entries) {
642
+ const parsed = this.parseEntry(streamName, id, rawFields);
643
+ out.push(this.toAcknowledgeable(streamName, id, parsed));
644
+ }
645
+ return out;
646
+ }
647
+ async unsubscribeAll() {
648
+ await Promise.all([...this.subscriptions].map((sub) => sub.unsubscribe()));
649
+ this.subscriptions = [];
650
+ this.subscriptionLoops.clear();
651
+ }
652
+ getSubscriptions() {
653
+ return [...this.subscriptions];
654
+ }
655
+ async processDLQ(handler) {
656
+ await this.connect();
657
+ const client = this.connection.getClient();
658
+ const dlqGroup = `${this.group}-dlq`;
659
+ for (const [stream] of this.knownStreams) {
660
+ const dlq = dlqKey(stream, this.connection.keyScope);
661
+ try {
662
+ await client.xgroup("CREATE", dlq, dlqGroup, "0", "MKSTREAM");
663
+ } catch {}
664
+ const res = await client.xreadgroup("GROUP", dlqGroup, this.consumerName, "COUNT", 50, "BLOCK", 100, "STREAMS", dlq, ">");
665
+ if (!res) continue;
666
+ for (const [, entries] of res) for (const [id, rawFields] of entries) {
667
+ const parsed = this.parseEntry(dlq, id, rawFields);
668
+ const evt = this.toAcknowledgeable(dlq, id, parsed, dlqGroup);
669
+ try {
670
+ await handler(evt);
671
+ } catch (err) {
672
+ logger.error("[RedisStreamsEventConsumer] DLQ handler error", { error: err instanceof Error ? err.message : String(err) });
673
+ }
674
+ }
675
+ }
676
+ }
677
+ async listSubjects(_stream) {
678
+ await this.connect();
679
+ const client = this.connection.getClient();
680
+ const seen = /* @__PURE__ */ new Set();
681
+ for (const subject of this.knownStreams.values()) {
682
+ const members = await client.smembers(registryKey(boundaryOf(subject), this.connection.keyScope));
683
+ for (const m of members) seen.add(m);
684
+ }
685
+ return [...seen];
686
+ }
687
+ resolveStartId(policy) {
688
+ switch (policy) {
689
+ case "all": return "0";
690
+ case "new": return "$";
691
+ case "last": return "$";
692
+ default: return "$";
693
+ }
694
+ }
695
+ async ensureGroup(stream, startId) {
696
+ const client = this.connection.getClient();
697
+ try {
698
+ await client.xgroup("CREATE", stream, this.group, startId, "MKSTREAM");
699
+ logger.debug("[RedisStreamsEventConsumer] group created", {
700
+ stream,
701
+ group: this.group,
702
+ startId
703
+ });
704
+ } catch (err) {
705
+ if (!(err instanceof Error ? err.message : String(err)).includes("BUSYGROUP")) throw err;
706
+ }
707
+ }
708
+ heldFor(stream) {
709
+ let ids = this.held.get(stream);
710
+ if (!ids) {
711
+ ids = /* @__PURE__ */ new Set();
712
+ this.held.set(stream, ids);
713
+ }
714
+ return ids;
715
+ }
716
+ /** Closes the subscription's blocking clients so a pending XREADGROUP BLOCK returns now. */
717
+ abortReads(sub) {
718
+ for (const client of this.blockingClients.get(sub) ?? []) try {
719
+ client.disconnect();
720
+ } catch {}
721
+ }
722
+ /** Waits for the in-flight handlers of every stream loop of `sub`, at most `timeoutMs` in total. */
723
+ async drainSubscription(sub, subject, timeoutMs) {
724
+ const limiters = (this.subWorkers.get(sub) ?? []).map(({ worker }) => worker.limiter);
725
+ if ((await Promise.all(limiters.map((l) => l.drain(timeoutMs)))).every(Boolean)) return;
726
+ logger.warn("[RedisStreamsEventConsumer] drain timed out; unfinished entries stay pending for reclaim", {
727
+ subject,
728
+ inFlight: limiters.reduce((sum, l) => sum + l.inFlight, 0),
729
+ drainTimeoutMs: timeoutMs
730
+ });
731
+ }
732
+ /** Forgets the streams a finished subscription consumed so the sweep and heartbeat stop touching them. */
733
+ releaseStreams(sub) {
734
+ for (const { stream, worker } of this.subWorkers.get(sub) ?? []) {
735
+ if (this.workers.get(stream) !== worker) continue;
736
+ this.workers.delete(stream);
737
+ this.knownStreams.delete(stream);
738
+ this.held.delete(stream);
739
+ }
740
+ this.subWorkers.delete(sub);
741
+ this.blockingClients.delete(sub);
742
+ }
743
+ spawnLoop(sub, stream, subject, handler, limiter, maxDeliver) {
744
+ const worker = {
745
+ sub,
746
+ subject,
747
+ handler,
748
+ limiter,
749
+ maxDeliver,
750
+ queued: 0
751
+ };
752
+ this.workers.set(stream, worker);
753
+ const started = this.subWorkers.get(sub) ?? [];
754
+ started.push({
755
+ stream,
756
+ worker
757
+ });
758
+ this.subWorkers.set(sub, started);
759
+ this.runLoop(stream, worker).catch((err) => {
760
+ logger.error("[RedisStreamsEventConsumer] loop crashed", {
761
+ stream,
762
+ error: errorMessage(err)
763
+ });
764
+ });
765
+ }
766
+ isRunning(worker) {
767
+ return !this.stopped && worker.sub.isActive();
768
+ }
769
+ async runLoop(stream, worker) {
770
+ const client = await this.connection.makeBlockingClient();
771
+ let clients = this.blockingClients.get(worker.sub);
772
+ if (!clients) {
773
+ clients = /* @__PURE__ */ new Set();
774
+ this.blockingClients.set(worker.sub, clients);
775
+ }
776
+ clients.add(client);
777
+ try {
778
+ while (this.isRunning(worker)) {
779
+ await worker.limiter.acquire();
780
+ if (!this.isRunning(worker)) {
781
+ worker.limiter.release();
782
+ break;
783
+ }
784
+ const entries = await this.readBatch(client, stream, worker);
785
+ if (entries.length === 0) {
786
+ worker.limiter.release();
787
+ continue;
788
+ }
789
+ await this.dispatchBatch(stream, worker, entries);
790
+ }
791
+ } finally {
792
+ clients.delete(client);
793
+ try {
794
+ client.disconnect();
795
+ } catch {}
796
+ }
797
+ }
798
+ /**
799
+ * One XREADGROUP. A serial subscription reads `maxConcurrent` (the batch
800
+ * size); a parallel one reads only as many entries as it has slots for.
801
+ * Read errors are logged and yield an empty batch.
802
+ */
803
+ async readBatch(client, stream, worker) {
804
+ const { limiter } = worker;
805
+ const count = limiter.concurrency === 1 ? this.maxConcurrent : 1 + limiter.freeSlots;
806
+ try {
807
+ return (await client.xreadgroup("GROUP", this.group, this.consumerName, "COUNT", count, "BLOCK", DEFAULT_BLOCK_MS, "STREAMS", stream, ">") ?? []).flatMap(([, batch]) => batch);
808
+ } catch (err) {
809
+ if (!this.isRunning(worker)) return [];
810
+ const msg = errorMessage(err);
811
+ if (msg.includes("NOGROUP")) {
812
+ await this.ensureGroup(stream, "$");
813
+ return [];
814
+ }
815
+ logger.warn("[RedisStreamsEventConsumer] read error", {
816
+ stream,
817
+ error: msg
818
+ });
819
+ await new Promise((res) => setTimeout(res, 1e3));
820
+ return [];
821
+ }
822
+ }
823
+ /**
824
+ * Starts each entry of a batch on its own slot, in stream order. The caller
825
+ * already holds the slot for the first entry. Every entry is held (and so
826
+ * heartbeated) from the moment it is read until its handler settles.
827
+ */
828
+ async dispatchBatch(stream, worker, entries) {
829
+ const { limiter } = worker;
830
+ const held = this.heldFor(stream);
831
+ for (const [id] of entries) held.add(id);
832
+ for (let index = 0; index < entries.length; index++) {
833
+ if (index > 0) await limiter.acquire();
834
+ if (!this.isRunning(worker)) {
835
+ limiter.release();
836
+ for (const [rest] of entries.slice(index)) held.delete(rest);
837
+ return;
838
+ }
839
+ const [id, rawFields] = entries[index] ?? ["", []];
840
+ limiter.run(() => this.dispatchEntry(worker, stream, id, rawFields, 1).finally(() => held.delete(id)));
841
+ }
842
+ }
843
+ /**
844
+ * Runs one entry's handler. Never rejects: a throw is logged and the entry
845
+ * nak'd (left pending). `streamDeliveries` is the entry's own delivery count
846
+ * in the group (1 on a first read); an entry a delayed nak re-added past the
847
+ * subscription's maxDeliver is dead-lettered without running the handler.
848
+ */
849
+ async dispatchEntry(worker, stream, id, rawFields, streamDeliveries) {
850
+ const { sub, subject, handler } = worker;
851
+ sub.recordReceived();
852
+ this.consumedCount++;
853
+ this.lastActivity = /* @__PURE__ */ new Date();
854
+ let evt = null;
855
+ let fields = {};
856
+ try {
857
+ const parsed = this.parseEntry(stream, id, rawFields, streamDeliveries);
858
+ if (parsed.deliveryCount > worker.maxDeliver) {
859
+ await this.deadLetter(stream, parsed);
860
+ return;
861
+ }
862
+ fields = parsed.fields;
863
+ evt = this.toAcknowledgeable(stream, id, parsed);
864
+ const event = evt;
865
+ await runWithConsumerSpan(subject, fields, () => handler(event));
866
+ sub.recordProcessed();
867
+ } catch (err) {
868
+ sub.recordFailed();
869
+ this.failedCount++;
870
+ logger.error("[RedisStreamsEventConsumer] handler error", {
871
+ subject,
872
+ id,
873
+ error: errorMessage(err)
874
+ });
875
+ if (evt) try {
876
+ await evt.nak();
877
+ } catch {}
878
+ }
879
+ }
880
+ /** Resets the idle time of every held entry without bumping its delivery count. */
881
+ async heartbeat() {
882
+ if (this.held.size === 0) return;
883
+ const client = this.connection.getClient();
884
+ for (const [stream, ids] of this.held) {
885
+ if (ids.size === 0) continue;
886
+ const list = [...ids];
887
+ try {
888
+ for (let i = 0; i < list.length; i += HEARTBEAT_CHUNK) await client.xclaim(stream, this.group, this.consumerName, 0, ...list.slice(i, i + HEARTBEAT_CHUNK), "JUSTID");
889
+ } catch (err) {
890
+ logger.debug("[RedisStreamsEventConsumer] heartbeat error", {
891
+ stream,
892
+ error: errorMessage(err)
893
+ });
894
+ }
895
+ }
896
+ }
897
+ /**
898
+ * `streamDeliveries` is the entry's delivery count in the group (1 on a
899
+ * first read); attempts used before a delayed nak re-added it are added on.
900
+ */
901
+ parseEntry(stream, id, rawFields, streamDeliveries = 1) {
902
+ const fields = {};
903
+ for (let i = 0; i + 1 < rawFields.length; i += 2) {
904
+ const key = rawFields[i];
905
+ const val = rawFields[i + 1];
906
+ if (key === void 0 || val === void 0) continue;
907
+ fields[key] = val;
908
+ }
909
+ let data;
910
+ try {
911
+ data = JSON.parse(fields["payload"] ?? "null");
912
+ } catch {
913
+ data = fields["payload"];
914
+ }
915
+ let metadata;
916
+ try {
917
+ metadata = JSON.parse(fields["metadata"] ?? "{}");
918
+ } catch {
919
+ metadata = { correlationId: fields["correlation-id"] ?? "" };
920
+ }
921
+ if (!metadata.correlationId) metadata.correlationId = fields["correlation-id"] ?? "";
922
+ return {
923
+ id,
924
+ stream,
925
+ subject: fields["subject"] ?? "",
926
+ data,
927
+ metadata,
928
+ timestamp: fields["timestamp"] ?? (/* @__PURE__ */ new Date()).toISOString(),
929
+ fields,
930
+ deliveryCount: priorAttempts(fields) + streamDeliveries
931
+ };
932
+ }
933
+ toAcknowledgeable(stream, id, parsed, group = this.group) {
934
+ const actions = this.settlement(stream, id, parsed, group);
935
+ return {
936
+ id,
937
+ subject: parsed.subject,
938
+ data: parsed.data,
939
+ metadata: parsed.metadata,
940
+ timestamp: parsed.timestamp,
941
+ ack: actions.ack,
942
+ nak: actions.nak,
943
+ term: () => actions.term(),
944
+ isRedelivered() {
945
+ return parsed.deliveryCount > 1;
946
+ },
947
+ getDeliveryAttempt() {
948
+ return parsed.deliveryCount;
949
+ }
950
+ };
951
+ }
952
+ settlement(stream, id, parsed, group) {
953
+ const key = JSON.stringify([
954
+ stream,
955
+ group,
956
+ id
957
+ ]);
958
+ const existing = this.settlements.get(key);
959
+ if (existing) {
960
+ existing.entry.deliveryCount = Math.max(existing.entry.deliveryCount, parsed.deliveryCount);
961
+ return existing.actions;
962
+ }
963
+ const serializedFieldsBytes = new TextEncoder().encode(JSON.stringify(parsed.fields)).byteLength;
964
+ if (this.settlements.size >= 1e4 || this.retainedSerializedFieldsBytes + serializedFieldsBytes > 67108864) throw new Error("EVENT_SETTLEMENT_CAPACITY_HELD");
965
+ const actions = messageSettlement({
966
+ acknowledge: async () => {
967
+ await this.connection.getClient().xack(stream, group, id);
968
+ },
969
+ delay: async (milliseconds) => {
970
+ const score = Date.now() + milliseconds;
971
+ if (!Number.isSafeInteger(score)) throw new Error("EVENT_SETTLEMENT_DELAY_INVALID");
972
+ const carried = {
973
+ ...parsed.fields,
974
+ [DELIVERY_ATTEMPTS_FIELD]: String(parsed.deliveryCount)
975
+ };
976
+ await this.connection.getClient().zadd(delayQueueKey(stream, this.connection.keyScope), score, `${id}|${JSON.stringify(carried)}`);
977
+ },
978
+ terminate: async (reason) => {
979
+ const flat = [];
980
+ for (const [k, v] of Object.entries(parsed.fields)) flat.push(k, v);
981
+ if (reason) flat.push("dlq-reason", reason, "dlq-deliveries", String(parsed.deliveryCount));
982
+ await this.connection.getClient().xadd(dlqKey(stream, this.connection.keyScope), "MAXLEN", "~", 1e4, "*", ...flat);
983
+ },
984
+ confirmed: () => {
985
+ const retained = this.settlements.get(key);
986
+ if (retained) this.retainedSerializedFieldsBytes -= retained.serializedFieldsBytes;
987
+ this.settlements.delete(key);
988
+ }
989
+ });
990
+ this.settlements.set(key, {
991
+ actions,
992
+ entry: parsed,
993
+ serializedFieldsBytes
994
+ });
995
+ this.retainedSerializedFieldsBytes += serializedFieldsBytes;
996
+ return actions;
997
+ }
998
+ /**
999
+ * Reclaims entries idle longer than ackWait that this process is not
1000
+ * handling. Within maxDeliver they are re-dispatched through the stream's
1001
+ * bounded dispatcher; past it they are dead-lettered.
1002
+ */
1003
+ async sweepPending() {
1004
+ if (this.stopped || this.knownStreams.size === 0) return;
1005
+ for (const [stream] of this.knownStreams) try {
1006
+ await this.sweepStream(stream);
1007
+ } catch (err) {
1008
+ const msg = errorMessage(err);
1009
+ if (msg.includes("NOGROUP")) continue;
1010
+ logger.debug("[RedisStreamsEventConsumer] sweep iteration error", {
1011
+ stream,
1012
+ error: msg
1013
+ });
1014
+ }
1015
+ }
1016
+ async sweepStream(stream) {
1017
+ const client = this.connection.getClient();
1018
+ const rows = parsePendingRows(await client.xpending(stream, this.group, "IDLE", this.ackWaitMs, "-", "+", SWEEP_BATCH));
1019
+ const worker = this.workers.get(stream);
1020
+ const live = worker && this.isRunning(worker) ? worker : void 0;
1021
+ const maxDeliver = live?.maxDeliver ?? this.maxDeliver;
1022
+ const picked = this.pickReclaimable(stream, rows, live, maxDeliver);
1023
+ if (picked.length === 0) return;
1024
+ const claimed = parseClaimedEntries(await client.xclaim(stream, this.group, this.consumerName, this.ackWaitMs, ...picked.map((r) => r.id)));
1025
+ for (const row of picked) {
1026
+ const rawFields = claimed.get(row.id);
1027
+ if (!rawFields) continue;
1028
+ const streamDeliveries = row.deliveries + 1;
1029
+ const parsed = this.parseEntry(stream, row.id, rawFields, streamDeliveries);
1030
+ if (parsed.deliveryCount > maxDeliver) await this.deadLetter(stream, parsed);
1031
+ else if (live) this.redispatch(stream, live, row.id, rawFields, streamDeliveries);
1032
+ }
1033
+ }
1034
+ /**
1035
+ * Chooses which idle entries to claim: never one this process is handling;
1036
+ * every one past maxDeliver (to dead-letter it); and, within maxDeliver, no
1037
+ * more than the live dispatcher can run alongside what it already runs, so
1038
+ * a replica never hoards reclaimed work it cannot start soon.
1039
+ */
1040
+ pickReclaimable(stream, rows, live, maxDeliver) {
1041
+ const held = this.held.get(stream);
1042
+ let budget = live ? live.limiter.concurrency - live.limiter.inFlight - live.queued : 0;
1043
+ const picked = [];
1044
+ for (const row of rows) {
1045
+ if (held?.has(row.id)) continue;
1046
+ if (row.deliveries + 1 > maxDeliver) picked.push(row);
1047
+ else if (budget > 0) {
1048
+ budget--;
1049
+ picked.push(row);
1050
+ }
1051
+ }
1052
+ return picked;
1053
+ }
1054
+ async deadLetter(stream, parsed) {
1055
+ const { id, deliveryCount } = parsed;
1056
+ try {
1057
+ await this.settlement(stream, id, parsed, this.group).term("max-deliver-exceeded");
1058
+ logger.warn("[RedisStreamsEventConsumer] message moved to DLQ", {
1059
+ stream,
1060
+ id,
1061
+ deliveryCount
1062
+ });
1063
+ } catch (err) {
1064
+ logger.debug("[RedisStreamsEventConsumer] dead-letter failed; retried on next sweep", {
1065
+ stream,
1066
+ id,
1067
+ error: errorMessage(err)
1068
+ });
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Runs a reclaimed entry on the stream's dispatcher. It is held (and so
1073
+ * heartbeated) while it waits for a slot; if the subscription stops first
1074
+ * it is left pending for another replica.
1075
+ */
1076
+ redispatch(stream, worker, id, rawFields, streamDeliveries) {
1077
+ const held = this.heldFor(stream);
1078
+ held.add(id);
1079
+ worker.queued++;
1080
+ worker.limiter.acquire().then(() => {
1081
+ worker.queued--;
1082
+ if (!this.isRunning(worker)) {
1083
+ worker.limiter.release();
1084
+ held.delete(id);
1085
+ return;
1086
+ }
1087
+ worker.limiter.run(() => this.dispatchEntry(worker, stream, id, rawFields, streamDeliveries).finally(() => held.delete(id)));
1088
+ });
1089
+ }
1090
+ async drainDelayQueues() {
1091
+ if (this.stopped || this.knownStreams.size === 0) return;
1092
+ const client = this.connection.getClient();
1093
+ for (const [stream] of this.knownStreams) {
1094
+ const lockKey = delayLockKey(stream, this.connection.keyScope);
1095
+ if (await client.set(lockKey, this.consumerName, "NX", "EX", 30).catch(() => null) !== "OK") continue;
1096
+ try {
1097
+ const due = await client.zrangebyscore(delayQueueKey(stream, this.connection.keyScope), 0, Date.now(), "LIMIT", 0, 50);
1098
+ for (const member of due) {
1099
+ const split = member.indexOf("|");
1100
+ if (split < 0) continue;
1101
+ const payload = member.slice(split + 1);
1102
+ let fields = {};
1103
+ try {
1104
+ fields = JSON.parse(payload);
1105
+ } catch {
1106
+ continue;
1107
+ }
1108
+ const flat = [];
1109
+ for (const [k, v] of Object.entries(fields)) flat.push(k, v);
1110
+ await client.xadd(stream, "MAXLEN", "~", 1e5, "*", ...flat);
1111
+ await client.zrem(delayQueueKey(stream, this.connection.keyScope), member);
1112
+ }
1113
+ } finally {
1114
+ await client.del(lockKey).catch(() => void 0);
1115
+ }
1116
+ }
1117
+ }
1118
+ };
1119
+
1120
+ // src/event-queue/implementations/redis-streams/serialize.ts
1121
+ /**
1122
+ * Serialization helpers for the Redis Streams backend.
1123
+ *
1124
+ * @module event-queue/implementations/redis-streams/serialize
1125
+ */
1126
+ /**
1127
+ * `JSON.stringify` that does not throw on BigInt values.
1128
+ *
1129
+ * Event payloads frequently originate from Prisma rows, which expose BigInt
1130
+ * columns (e.g. counters / durations) as native `bigint`. The standard
1131
+ * `JSON.stringify` throws `TypeError: Do not know how to serialize a BigInt`,
1132
+ * which would drop the entire event — an entity would then silently never reach
1133
+ * the graph / search index. We serialize BigInt as its decimal string so the
1134
+ * value is preserved and the event is published.
1135
+ */
1136
+ function safeStringify(value) {
1137
+ return JSON.stringify(value ?? null, (_key, val) => typeof val === "bigint" ? val.toString() : val);
1138
+ }
1139
+
1140
+ // src/event-queue/implementations/redis-streams/RedisStreamsEventPublisher.ts
1141
+ /**
1142
+ * Redis Streams implementation of IEventPublisher.
1143
+ *
1144
+ * Each subject is its own stream (`boff:events:<subject-with-colons>`); MAXLEN
1145
+ * trimming keeps each stream bounded; dedup is enforced by `SET NX EX` on a
1146
+ * per-message-id key before XADD.
1147
+ */
1148
+ var RedisStreamsEventPublisher = class {
1149
+ config;
1150
+ connection;
1151
+ publishCount = 0;
1152
+ lastPublishTime = null;
1153
+ maxLen;
1154
+ dedupTtl;
1155
+ keyPrefix;
1156
+ shutdownName;
1157
+ constructor(config) {
1158
+ this.config = config;
1159
+ this.connection = new RedisStreamsConnection(config);
1160
+ this.maxLen = config.maxLen ?? parseInt(process.env["REDIS_STREAMS_MAXLEN"] ?? "100000", 10);
1161
+ this.dedupTtl = config.dedupTtlSeconds ?? parseInt(process.env["REDIS_STREAMS_DEDUP_TTL"] ?? "120", 10);
1162
+ this.keyPrefix = config.keyPrefix ?? process.env["REDIS_STREAMS_KEY_PREFIX"] ?? "boff:events";
1163
+ this.shutdownName = `redis-streams-publisher:${config.name ?? "default"}`;
1164
+ registerDisposable(this);
1165
+ }
1166
+ /** Close underlying connections on graceful shutdown. */
1167
+ dispose() {
1168
+ return this.disconnect();
1169
+ }
1170
+ async connect() {
1171
+ await this.connection.connect();
1172
+ }
1173
+ async disconnect() {
1174
+ unregisterDisposable(this);
1175
+ await this.connection.disconnect();
1176
+ }
1177
+ isConnected() {
1178
+ return this.connection.isConnected();
1179
+ }
1180
+ async healthCheck() {
1181
+ try {
1182
+ const t0 = Date.now();
1183
+ return {
1184
+ status: await this.connection.ping() === "PONG" ? "healthy" : "degraded",
1185
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1186
+ connected: this.isConnected(),
1187
+ latencyMs: Date.now() - t0,
1188
+ details: {
1189
+ type: "redis-streams",
1190
+ url: this.config.url
1191
+ }
1192
+ };
1193
+ } catch (err) {
1194
+ return {
1195
+ status: "unhealthy",
1196
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1197
+ connected: false,
1198
+ details: { type: "redis-streams" },
1199
+ error: err instanceof Error ? err.message : String(err)
1200
+ };
1201
+ }
1202
+ }
1203
+ async getStatistics() {
1204
+ return {
1205
+ messagesPublished: this.publishCount,
1206
+ messagesConsumed: 0,
1207
+ messagesFailed: 0,
1208
+ activePublishers: 1,
1209
+ activeConsumers: 0,
1210
+ lastActivity: this.lastPublishTime?.toISOString() ?? null,
1211
+ details: { type: "redis-streams" }
1212
+ };
1213
+ }
1214
+ async ensureStream(_config) {
1215
+ return Promise.resolve();
1216
+ }
1217
+ async publish(options) {
1218
+ return this.publishInternal(options);
1219
+ }
1220
+ async publishInternal(opts) {
1221
+ await this.connect();
1222
+ const client = this.connection.getClient();
1223
+ const streamName = opts.options?.stream ?? opts.subject;
1224
+ const stream = streamKey(streamName, {
1225
+ prefix: this.keyPrefix,
1226
+ scope: this.connection.keyScope
1227
+ });
1228
+ const msgId = opts.options?.messageId ?? randomUUID();
1229
+ const correlationId = opts.metadata?.correlationId ?? randomUUID();
1230
+ if (this.config.enableDeduplication === true || opts.options?.messageId !== void 0) {
1231
+ if (await client.set(dedupKey(stream, msgId, this.connection.keyScope), "1", "NX", "EX", this.dedupTtl) !== "OK") {
1232
+ logger.debug("[RedisStreamsEventPublisher] dedup hit; skipping publish", {
1233
+ subject: opts.subject,
1234
+ msgId
1235
+ });
1236
+ return msgId;
1237
+ }
1238
+ }
1239
+ const trace = await injectTraceFields();
1240
+ const fields = {
1241
+ "msg-id": msgId,
1242
+ subject: opts.subject,
1243
+ "correlation-id": correlationId,
1244
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1245
+ priority: opts.options?.priority ?? this.config.defaultPriority ?? "normal",
1246
+ source: opts.metadata?.source ?? this.config.name ?? "unknown",
1247
+ payload: safeStringify(opts.data ?? null),
1248
+ metadata: safeStringify(opts.metadata ?? {}),
1249
+ ...trace
1250
+ };
1251
+ if (opts.metadata?.userId) fields["user-id"] = String(opts.metadata.userId);
1252
+ if (opts.metadata?.workspaceId) fields["workspace-id"] = String(opts.metadata.workspaceId);
1253
+ if (opts.metadata?.tenantId) fields["tenant-id"] = String(opts.metadata.tenantId);
1254
+ const flat = [];
1255
+ for (const [k, v] of Object.entries(fields)) flat.push(k, v);
1256
+ const id = await client.xadd(stream, "MAXLEN", "~", this.maxLen, "*", ...flat);
1257
+ client.sadd(registryKey(boundaryOf(opts.subject), this.connection.keyScope), opts.subject).catch(() => void 0);
1258
+ this.publishCount++;
1259
+ this.lastPublishTime = /* @__PURE__ */ new Date();
1260
+ logger.debug("[RedisStreamsEventPublisher] published", {
1261
+ subject: opts.subject,
1262
+ stream,
1263
+ id
1264
+ });
1265
+ return id;
1266
+ }
1267
+ async publishBatch(events) {
1268
+ const out = [];
1269
+ for (const e of events) out.push(await this.publishInternal(e));
1270
+ return out;
1271
+ }
1272
+ /**
1273
+ * Emulated request/response: writer XADDs onto its own subject, then
1274
+ * blocks on a one-shot reply stream keyed by correlationId.
1275
+ */
1276
+ async publishWithAck(opts) {
1277
+ await this.connect();
1278
+ const client = this.connection.getClient();
1279
+ const correlationId = opts.metadata?.correlationId ?? randomUUID();
1280
+ const reply = replyKey(correlationId, this.connection.keyScope);
1281
+ await this.publishInternal({
1282
+ subject: opts.subject,
1283
+ data: opts.data,
1284
+ metadata: {
1285
+ ...opts.metadata,
1286
+ correlationId,
1287
+ replyTo: reply
1288
+ }
1289
+ });
1290
+ const timeoutMs = opts.timeout ?? 5e3;
1291
+ const t0 = Date.now();
1292
+ while (Date.now() - t0 < timeoutMs) {
1293
+ const entries = await client.xrange(reply, "-", "+");
1294
+ if (Array.isArray(entries) && entries.length > 0) {
1295
+ const last = entries[entries.length - 1];
1296
+ if (!last) break;
1297
+ const rawFields = last[1];
1298
+ const payloadIdx = rawFields.indexOf("payload");
1299
+ const payload = payloadIdx >= 0 ? rawFields[payloadIdx + 1] : "{}";
1300
+ await client.del(reply);
1301
+ return JSON.parse(payload ?? "{}");
1302
+ }
1303
+ await new Promise((res) => setTimeout(res, 50));
1304
+ }
1305
+ await client.del(reply).catch(() => void 0);
1306
+ throw new Error(`[RedisStreamsEventPublisher] publishWithAck timed out for subject=${opts.subject}`);
1307
+ }
1308
+ /** Internal helper used by the consumer's reply path. */
1309
+ async sendReply(correlationId, data) {
1310
+ await this.connect();
1311
+ const client = this.connection.getClient();
1312
+ const key = replyKey(correlationId, this.connection.keyScope);
1313
+ await client.xadd(key, "*", "payload", safeStringify(data ?? null));
1314
+ await client.expire(key, 60);
1315
+ }
1316
+ };
1317
+
1318
+ // src/event-queue/factory/EventQueueFactory.ts
1319
+ /**
1320
+ * Event Queue Factory
1321
+ *
1322
+ * Single-backend wrapper around the Redis Streams publisher/consumer.
1323
+ * NATS support was removed on 2026-05-16 — Redis is the canonical fleet
1324
+ * event-bus. Other backends (RabbitMQ, Kafka, SQS) are listed in
1325
+ * `QueueType` for future extension; today only `redis-streams` is wired.
1326
+ */
1327
+ var EventQueueFactory_exports = /* @__PURE__ */ __exportAll({ EventQueueFactory: () => EventQueueFactory });
1328
+ const DEFAULT_STREAMS_URL = "redis://localhost:6379";
1329
+ function streamsUrlFromEnv() {
1330
+ return resolveEventStreamsUrl() ?? DEFAULT_STREAMS_URL;
1331
+ }
1332
+ /**
1333
+ * Reads an optional integer env var. Unset or empty yields `undefined` (the
1334
+ * consumer default applies); anything else is parsed and validated by the
1335
+ * consumer, so a malformed value fails fast at startup instead of silently
1336
+ * falling back.
1337
+ */
1338
+ function optionalIntEnv(name) {
1339
+ const raw = process.env[name];
1340
+ if (raw === void 0 || raw.trim() === "") return void 0;
1341
+ return Number(raw.trim());
1342
+ }
1343
+ function redactConnectionUrl(url) {
1344
+ if (!url) return url;
1345
+ try {
1346
+ const rendered = new URL(url).toString();
1347
+ const authorityStart = rendered.indexOf("//") + 2;
1348
+ const authorityEnd = rendered.indexOf("@", authorityStart);
1349
+ if (authorityStart < 2 || authorityEnd < 0) return rendered;
1350
+ return `${rendered.slice(0, authorityStart)}:***@${rendered.slice(authorityEnd + 1)}`;
1351
+ } catch {
1352
+ const schemeEnd = url.indexOf("://");
1353
+ if (schemeEnd < 0) return url;
1354
+ const authorityStart = schemeEnd + 3;
1355
+ const authorityEnd = url.indexOf("@", authorityStart);
1356
+ if (authorityEnd < 0) return url;
1357
+ return `${url.slice(0, authorityStart)}:***@${url.slice(authorityEnd + 1)}`;
1358
+ }
1359
+ }
1360
+ /**
1361
+ * Factory for creating event queue instances
1362
+ */
1363
+ var EventQueueFactory = class EventQueueFactory {
1364
+ /**
1365
+ * Create an event publisher based on configuration
1366
+ */
1367
+ static createPublisher(config) {
1368
+ logger.info("[EventQueueFactory] Creating event publisher", {
1369
+ type: config.type,
1370
+ url: redactConnectionUrl(config.url)
1371
+ });
1372
+ if (config.type === "redis-streams") return new RedisStreamsEventPublisher(config);
1373
+ throw new Error(`Unsupported queue type: ${config.type}. NATS was retired on 2026-05-16; use 'redis-streams'.`);
1374
+ }
1375
+ /**
1376
+ * Create an event consumer based on configuration
1377
+ */
1378
+ static createConsumer(config) {
1379
+ logger.info("[EventQueueFactory] Creating event consumer", {
1380
+ type: config.type,
1381
+ url: redactConnectionUrl(config.url),
1382
+ stream: config.stream,
1383
+ consumer: config.consumer
1384
+ });
1385
+ if (config.type === "redis-streams") return new RedisStreamsEventConsumer(config);
1386
+ throw new Error(`Unsupported queue type: ${config.type}. NATS was retired on 2026-05-16; use 'redis-streams'.`);
1387
+ }
1388
+ /**
1389
+ * Create a publisher from environment variables.
1390
+ * Reads `REDIS_STREAMS_URL` (else `REDIS_URL`), `REDIS_PASSWORD`, and
1391
+ * standard queue options.
1392
+ */
1393
+ static createPublisherFromEnv() {
1394
+ return EventQueueFactory.createPublisher({
1395
+ type: "redis-streams",
1396
+ url: streamsUrlFromEnv(),
1397
+ password: process.env["REDIS_PASSWORD"],
1398
+ name: process.env["QUEUE_CLIENT_NAME"] ?? process.env["SERVICE_NAME"] ?? "be-sdk-publisher",
1399
+ enableDeduplication: process.env["QUEUE_ENABLE_DEDUPLICATION"] === "true",
1400
+ defaultPriority: process.env["QUEUE_DEFAULT_PRIORITY"] ?? "normal"
1401
+ });
1402
+ }
1403
+ /**
1404
+ * Create a consumer from environment variables.
1405
+ */
1406
+ static createConsumerFromEnv(stream, consumer) {
1407
+ return EventQueueFactory.createConsumer({
1408
+ type: "redis-streams",
1409
+ url: streamsUrlFromEnv(),
1410
+ password: process.env["REDIS_PASSWORD"],
1411
+ name: process.env["QUEUE_CLIENT_NAME"] ?? process.env["SERVICE_NAME"] ?? consumer,
1412
+ stream,
1413
+ consumer,
1414
+ maxConcurrent: process.env["QUEUE_MAX_CONCURRENT"] ? parseInt(process.env["QUEUE_MAX_CONCURRENT"], 10) : 5,
1415
+ concurrency: optionalIntEnv("QUEUE_CONCURRENCY"),
1416
+ drainTimeoutMs: optionalIntEnv("QUEUE_DRAIN_TIMEOUT_MS"),
1417
+ maxDeliver: process.env["QUEUE_MAX_DELIVER"] ? parseInt(process.env["QUEUE_MAX_DELIVER"], 10) : 3,
1418
+ ackWait: process.env["QUEUE_ACK_WAIT"] ? parseInt(process.env["QUEUE_ACK_WAIT"], 10) * 1e9 : 3e10
1419
+ });
1420
+ }
1421
+ /**
1422
+ * Create a publisher for a specific layer.
1423
+ * The layer is preserved on the publisher name; otherwise identical to
1424
+ * `createPublisherFromEnv()`.
1425
+ */
1426
+ static createPublisherForLayer(_layer, serviceName) {
1427
+ return EventQueueFactory.createPublisher({
1428
+ type: "redis-streams",
1429
+ url: streamsUrlFromEnv(),
1430
+ password: process.env["REDIS_PASSWORD"],
1431
+ name: serviceName,
1432
+ enableDeduplication: process.env["QUEUE_ENABLE_DEDUPLICATION"] === "true",
1433
+ defaultPriority: process.env["QUEUE_DEFAULT_PRIORITY"] ?? "normal"
1434
+ });
1435
+ }
1436
+ /**
1437
+ * Create a consumer for a specific layer.
1438
+ */
1439
+ static createConsumerForLayer(_layer, serviceName, stream, consumer) {
1440
+ return EventQueueFactory.createConsumer({
1441
+ type: "redis-streams",
1442
+ url: streamsUrlFromEnv(),
1443
+ password: process.env["REDIS_PASSWORD"],
1444
+ name: serviceName,
1445
+ stream,
1446
+ consumer,
1447
+ maxConcurrent: process.env["QUEUE_MAX_CONCURRENT"] ? parseInt(process.env["QUEUE_MAX_CONCURRENT"], 10) : 5,
1448
+ concurrency: optionalIntEnv("QUEUE_CONCURRENCY"),
1449
+ drainTimeoutMs: optionalIntEnv("QUEUE_DRAIN_TIMEOUT_MS"),
1450
+ maxDeliver: process.env["QUEUE_MAX_DELIVER"] ? parseInt(process.env["QUEUE_MAX_DELIVER"], 10) : 3,
1451
+ ackWait: process.env["QUEUE_ACK_WAIT"] ? parseInt(process.env["QUEUE_ACK_WAIT"], 10) * 1e9 : 3e10
1452
+ });
1453
+ }
1454
+ };
1455
+
1456
+ export { RedisStreamsEventConsumer as a, resolveDrainTimeout as c, safeStringify as i, QueueType as l, EventQueueFactory_exports as n, DispatchLimiter as o, RedisStreamsEventPublisher as r, resolveConcurrency as s, EventQueueFactory as t };
1457
+ //# sourceMappingURL=EventQueueFactory-9NGZV9jl.js.map