@graphrefly/graphrefly 0.45.0 → 0.46.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 (714) hide show
  1. package/README.md +1 -2
  2. package/dist/_internal-B23BagFd.d.cts +33 -0
  3. package/dist/_internal-B23BagFd.d.ts +33 -0
  4. package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
  5. package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
  6. package/dist/agents-C0Ji9ldU.d.cts +629 -0
  7. package/dist/agents-C9zexT7I.d.ts +629 -0
  8. package/dist/audit-BAXb3VOg.d.ts +246 -0
  9. package/dist/audit-C_bPfkqS.d.cts +246 -0
  10. package/dist/backoff-7KIK3WQW.js +24 -0
  11. package/dist/backoff-7KIK3WQW.js.map +1 -0
  12. package/dist/backoff-Bnb9OoPh.d.cts +6 -0
  13. package/dist/backoff-Bnb9OoPh.d.ts +6 -0
  14. package/dist/base/composition/index.cjs +811 -0
  15. package/dist/base/composition/index.cjs.map +1 -0
  16. package/dist/base/composition/index.d.cts +469 -0
  17. package/dist/base/composition/index.d.ts +469 -0
  18. package/dist/base/composition/index.js +40 -0
  19. package/dist/base/composition/index.js.map +1 -0
  20. package/dist/base/index.cjs +6336 -0
  21. package/dist/base/index.cjs.map +1 -0
  22. package/dist/base/index.d.cts +22 -0
  23. package/dist/base/index.d.ts +22 -0
  24. package/dist/base/index.js +259 -0
  25. package/dist/base/index.js.map +1 -0
  26. package/dist/base/io/index.cjs +3270 -0
  27. package/dist/base/io/index.cjs.map +1 -0
  28. package/dist/base/io/index.d.cts +2245 -0
  29. package/dist/base/io/index.d.ts +2245 -0
  30. package/dist/base/io/index.js +117 -0
  31. package/dist/base/io/index.js.map +1 -0
  32. package/dist/base/meta/index.cjs +43 -0
  33. package/dist/base/meta/index.cjs.map +1 -0
  34. package/dist/base/meta/index.d.cts +45 -0
  35. package/dist/base/meta/index.d.ts +45 -0
  36. package/dist/base/meta/index.js +13 -0
  37. package/dist/base/meta/index.js.map +1 -0
  38. package/dist/base/mutation/index.cjs +200 -0
  39. package/dist/base/mutation/index.cjs.map +1 -0
  40. package/dist/base/mutation/index.d.cts +177 -0
  41. package/dist/base/mutation/index.d.ts +177 -0
  42. package/dist/base/mutation/index.js +22 -0
  43. package/dist/base/mutation/index.js.map +1 -0
  44. package/dist/base/render/index.cjs +1120 -0
  45. package/dist/base/render/index.cjs.map +1 -0
  46. package/dist/base/render/index.d.cts +227 -0
  47. package/dist/base/render/index.d.ts +227 -0
  48. package/dist/base/render/index.js +24 -0
  49. package/dist/base/render/index.js.map +1 -0
  50. package/dist/base/sources/browser/index.cjs +172 -0
  51. package/dist/base/sources/browser/index.cjs.map +1 -0
  52. package/dist/base/sources/browser/index.d.cts +84 -0
  53. package/dist/base/sources/browser/index.d.ts +84 -0
  54. package/dist/base/sources/browser/index.js +151 -0
  55. package/dist/base/sources/browser/index.js.map +1 -0
  56. package/dist/base/sources/event/index.cjs +98 -0
  57. package/dist/base/sources/event/index.cjs.map +1 -0
  58. package/dist/base/sources/event/index.d.cts +91 -0
  59. package/dist/base/sources/event/index.d.ts +91 -0
  60. package/dist/base/sources/event/index.js +13 -0
  61. package/dist/base/sources/event/index.js.map +1 -0
  62. package/dist/base/sources/index.cjs +755 -0
  63. package/dist/base/sources/index.cjs.map +1 -0
  64. package/dist/base/sources/index.d.cts +357 -0
  65. package/dist/base/sources/index.d.ts +357 -0
  66. package/dist/base/sources/index.js +42 -0
  67. package/dist/base/sources/index.js.map +1 -0
  68. package/dist/base/sources/node/index.cjs +320 -0
  69. package/dist/base/sources/node/index.cjs.map +1 -0
  70. package/dist/base/sources/node/index.d.cts +185 -0
  71. package/dist/base/sources/node/index.d.ts +185 -0
  72. package/dist/base/sources/node/index.js +306 -0
  73. package/dist/base/sources/node/index.js.map +1 -0
  74. package/dist/base/utils/index.cjs +37 -0
  75. package/dist/base/utils/index.cjs.map +1 -0
  76. package/dist/base/utils/index.d.cts +37 -0
  77. package/dist/base/utils/index.d.ts +37 -0
  78. package/dist/base/utils/index.js +11 -0
  79. package/dist/base/utils/index.js.map +1 -0
  80. package/dist/base/worker/index.cjs +548 -0
  81. package/dist/base/worker/index.cjs.map +1 -0
  82. package/dist/base/worker/index.d.cts +207 -0
  83. package/dist/base/worker/index.d.ts +207 -0
  84. package/dist/base/worker/index.js +20 -0
  85. package/dist/base/worker/index.js.map +1 -0
  86. package/dist/breaker-C9skL3d8.d.ts +175 -0
  87. package/dist/breaker-ugSdq54q.d.cts +175 -0
  88. package/dist/cascading-CSSbKGrJ.d.ts +199 -0
  89. package/dist/cascading-baGkiihI.d.cts +199 -0
  90. package/dist/chunk-255UCBG4.js +58 -0
  91. package/dist/chunk-255UCBG4.js.map +1 -0
  92. package/dist/chunk-2LO3EL4W.js +1 -0
  93. package/dist/chunk-2LO3EL4W.js.map +1 -0
  94. package/dist/chunk-2OB3CEJS.js +1065 -0
  95. package/dist/chunk-2OB3CEJS.js.map +1 -0
  96. package/dist/chunk-36NMM65U.js +144 -0
  97. package/dist/chunk-36NMM65U.js.map +1 -0
  98. package/dist/chunk-3CEXCBN6.js +1 -0
  99. package/dist/chunk-3CEXCBN6.js.map +1 -0
  100. package/dist/chunk-3MUSLI6E.js +105 -0
  101. package/dist/chunk-3MUSLI6E.js.map +1 -0
  102. package/dist/chunk-3PSLNJDU.js +884 -0
  103. package/dist/chunk-3PSLNJDU.js.map +1 -0
  104. package/dist/chunk-3QZY5BI7.js +92 -0
  105. package/dist/chunk-3QZY5BI7.js.map +1 -0
  106. package/dist/chunk-42FQ27MQ.js +594 -0
  107. package/dist/chunk-42FQ27MQ.js.map +1 -0
  108. package/dist/chunk-4GYMCUDZ.js +1085 -0
  109. package/dist/chunk-4GYMCUDZ.js.map +1 -0
  110. package/dist/chunk-4S53H2KR.js +382 -0
  111. package/dist/chunk-4S53H2KR.js.map +1 -0
  112. package/dist/chunk-4XCHZRUJ.js +128 -0
  113. package/dist/chunk-4XCHZRUJ.js.map +1 -0
  114. package/dist/chunk-5THCXDWY.js +725 -0
  115. package/dist/chunk-5THCXDWY.js.map +1 -0
  116. package/dist/chunk-6XZYT4SW.js +256 -0
  117. package/dist/chunk-6XZYT4SW.js.map +1 -0
  118. package/dist/chunk-7EGRP2VX.js +76 -0
  119. package/dist/chunk-7EGRP2VX.js.map +1 -0
  120. package/dist/chunk-A7KV5UK4.js +150 -0
  121. package/dist/chunk-A7KV5UK4.js.map +1 -0
  122. package/dist/chunk-APY2SS5X.js +156 -0
  123. package/dist/chunk-APY2SS5X.js.map +1 -0
  124. package/dist/chunk-AZDQPQ3V.js +66 -0
  125. package/dist/chunk-AZDQPQ3V.js.map +1 -0
  126. package/dist/chunk-BU3SEFA5.js +90 -0
  127. package/dist/chunk-BU3SEFA5.js.map +1 -0
  128. package/dist/chunk-BXGZFGZ4.js +189 -0
  129. package/dist/chunk-BXGZFGZ4.js.map +1 -0
  130. package/dist/chunk-CGHORL6G.js +579 -0
  131. package/dist/chunk-CGHORL6G.js.map +1 -0
  132. package/dist/chunk-CXANAIZU.js +530 -0
  133. package/dist/chunk-CXANAIZU.js.map +1 -0
  134. package/dist/chunk-CZQHCKKG.js +1 -0
  135. package/dist/chunk-CZQHCKKG.js.map +1 -0
  136. package/dist/chunk-DKNHAICT.js +133 -0
  137. package/dist/chunk-DKNHAICT.js.map +1 -0
  138. package/dist/chunk-DM4OMPWK.js +584 -0
  139. package/dist/chunk-DM4OMPWK.js.map +1 -0
  140. package/dist/chunk-DMSNO6ZB.js +452 -0
  141. package/dist/chunk-DMSNO6ZB.js.map +1 -0
  142. package/dist/chunk-E5OZPDIW.js +229 -0
  143. package/dist/chunk-E5OZPDIW.js.map +1 -0
  144. package/dist/chunk-EVYY4X5A.js +509 -0
  145. package/dist/chunk-EVYY4X5A.js.map +1 -0
  146. package/dist/chunk-FDFD67UO.js +1 -0
  147. package/dist/chunk-FDFD67UO.js.map +1 -0
  148. package/dist/chunk-FMPF42Q4.js +13 -0
  149. package/dist/chunk-FMPF42Q4.js.map +1 -0
  150. package/dist/chunk-FR6RGA3B.js +1277 -0
  151. package/dist/chunk-FR6RGA3B.js.map +1 -0
  152. package/dist/chunk-FW23JYNQ.js +454 -0
  153. package/dist/chunk-FW23JYNQ.js.map +1 -0
  154. package/dist/chunk-GBCENOLN.js +1575 -0
  155. package/dist/chunk-GBCENOLN.js.map +1 -0
  156. package/dist/chunk-HL7HUJIX.js +1 -0
  157. package/dist/chunk-HL7HUJIX.js.map +1 -0
  158. package/dist/chunk-HULCUY35.js +2508 -0
  159. package/dist/chunk-HULCUY35.js.map +1 -0
  160. package/dist/chunk-IHTWQEDR.js +169 -0
  161. package/dist/chunk-IHTWQEDR.js.map +1 -0
  162. package/dist/chunk-IJRR6YAI.js +128 -0
  163. package/dist/chunk-IJRR6YAI.js.map +1 -0
  164. package/dist/chunk-JGFRAFDL.js +221 -0
  165. package/dist/chunk-JGFRAFDL.js.map +1 -0
  166. package/dist/chunk-KIIXR252.js +211 -0
  167. package/dist/chunk-KIIXR252.js.map +1 -0
  168. package/dist/chunk-KN3H5CNT.js +11 -0
  169. package/dist/chunk-KN3H5CNT.js.map +1 -0
  170. package/dist/chunk-KPG3DGLA.js +1 -0
  171. package/dist/chunk-KPG3DGLA.js.map +1 -0
  172. package/dist/chunk-KRNQ6RGQ.js +1 -0
  173. package/dist/chunk-KRNQ6RGQ.js.map +1 -0
  174. package/dist/chunk-LBAJK24K.js +1071 -0
  175. package/dist/chunk-LBAJK24K.js.map +1 -0
  176. package/dist/chunk-MLTPJMH6.js +417 -0
  177. package/dist/chunk-MLTPJMH6.js.map +1 -0
  178. package/dist/chunk-N3SZ7BMH.js +95 -0
  179. package/dist/chunk-N3SZ7BMH.js.map +1 -0
  180. package/dist/chunk-NDUD3IMO.js +540 -0
  181. package/dist/chunk-NDUD3IMO.js.map +1 -0
  182. package/dist/chunk-NY2PYHNC.js +873 -0
  183. package/dist/chunk-NY2PYHNC.js.map +1 -0
  184. package/dist/chunk-O3MT7DYI.js +225 -0
  185. package/dist/chunk-O3MT7DYI.js.map +1 -0
  186. package/dist/chunk-OCUDSN63.js +2386 -0
  187. package/dist/chunk-OCUDSN63.js.map +1 -0
  188. package/dist/chunk-OIWU3NYV.js +199 -0
  189. package/dist/chunk-OIWU3NYV.js.map +1 -0
  190. package/dist/chunk-OO5BM6CJ.js +1153 -0
  191. package/dist/chunk-OO5BM6CJ.js.map +1 -0
  192. package/dist/chunk-OQUIJT7A.js +1 -0
  193. package/dist/chunk-OQUIJT7A.js.map +1 -0
  194. package/dist/chunk-P5LBT622.js +105 -0
  195. package/dist/chunk-P5LBT622.js.map +1 -0
  196. package/dist/chunk-PKGQG5QQ.js +519 -0
  197. package/dist/chunk-PKGQG5QQ.js.map +1 -0
  198. package/dist/chunk-PKPO3JTZ.js +561 -0
  199. package/dist/chunk-PKPO3JTZ.js.map +1 -0
  200. package/dist/chunk-PL5UDIQ5.js +118 -0
  201. package/dist/chunk-PL5UDIQ5.js.map +1 -0
  202. package/dist/chunk-PZWISPIQ.js +432 -0
  203. package/dist/chunk-PZWISPIQ.js.map +1 -0
  204. package/dist/chunk-Q3EYOCZB.js +510 -0
  205. package/dist/chunk-Q3EYOCZB.js.map +1 -0
  206. package/dist/chunk-QMBYUVRL.js +15 -0
  207. package/dist/chunk-QMBYUVRL.js.map +1 -0
  208. package/dist/chunk-RAGGHLCV.js +200 -0
  209. package/dist/chunk-RAGGHLCV.js.map +1 -0
  210. package/dist/chunk-RGL53X5G.js +574 -0
  211. package/dist/chunk-RGL53X5G.js.map +1 -0
  212. package/dist/chunk-RJOG4IJU.js +1039 -0
  213. package/dist/chunk-RJOG4IJU.js.map +1 -0
  214. package/dist/chunk-SOOKUYVM.js +403 -0
  215. package/dist/chunk-SOOKUYVM.js.map +1 -0
  216. package/dist/chunk-T5BN5KG7.js +1 -0
  217. package/dist/chunk-T5BN5KG7.js.map +1 -0
  218. package/dist/chunk-TP7244Y6.js +207 -0
  219. package/dist/chunk-TP7244Y6.js.map +1 -0
  220. package/dist/chunk-TSBFTJKM.js +57 -0
  221. package/dist/chunk-TSBFTJKM.js.map +1 -0
  222. package/dist/chunk-URQ2CBBF.js +143 -0
  223. package/dist/chunk-URQ2CBBF.js.map +1 -0
  224. package/dist/chunk-W2BOPXTI.js +1 -0
  225. package/dist/chunk-W2BOPXTI.js.map +1 -0
  226. package/dist/chunk-WKSWLSCX.js +207 -0
  227. package/dist/chunk-WKSWLSCX.js.map +1 -0
  228. package/dist/chunk-Y52CS6YA.js +88 -0
  229. package/dist/chunk-Y52CS6YA.js.map +1 -0
  230. package/dist/chunk-YCBUWK77.js +92 -0
  231. package/dist/chunk-YCBUWK77.js.map +1 -0
  232. package/dist/chunk-YJ4U2D2C.js +314 -0
  233. package/dist/chunk-YJ4U2D2C.js.map +1 -0
  234. package/dist/chunk-Z4YXAUDN.js +239 -0
  235. package/dist/chunk-Z4YXAUDN.js.map +1 -0
  236. package/dist/chunk-Z6EGP5D7.js +92 -0
  237. package/dist/chunk-Z6EGP5D7.js.map +1 -0
  238. package/dist/compat/index.cjs +3083 -2
  239. package/dist/compat/index.cjs.map +1 -1
  240. package/dist/compat/index.d.cts +116 -1
  241. package/dist/compat/index.d.ts +116 -1
  242. package/dist/compat/index.js +175 -2
  243. package/dist/compat/index.js.map +1 -1
  244. package/dist/compat/jotai/index.cjs +130 -2
  245. package/dist/compat/jotai/index.cjs.map +1 -1
  246. package/dist/compat/jotai/index.d.cts +2 -1
  247. package/dist/compat/jotai/index.d.ts +2 -1
  248. package/dist/compat/jotai/index.js +7 -2
  249. package/dist/compat/jotai/index.js.map +1 -1
  250. package/dist/compat/nanostores/index.cjs +186 -2
  251. package/dist/compat/nanostores/index.cjs.map +1 -1
  252. package/dist/compat/nanostores/index.d.cts +2 -1
  253. package/dist/compat/nanostores/index.d.ts +2 -1
  254. package/dist/compat/nanostores/index.js +21 -2
  255. package/dist/compat/nanostores/index.js.map +1 -1
  256. package/dist/compat/nestjs/index.cjs +2224 -2
  257. package/dist/compat/nestjs/index.cjs.map +1 -1
  258. package/dist/compat/nestjs/index.d.cts +10 -1
  259. package/dist/compat/nestjs/index.d.ts +10 -1
  260. package/dist/compat/nestjs/index.js +77 -2
  261. package/dist/compat/nestjs/index.js.map +1 -1
  262. package/dist/compat/react/index.cjs +95 -2
  263. package/dist/compat/react/index.cjs.map +1 -1
  264. package/dist/compat/react/index.d.cts +2 -1
  265. package/dist/compat/react/index.d.ts +2 -1
  266. package/dist/compat/react/index.js +11 -2
  267. package/dist/compat/react/index.js.map +1 -1
  268. package/dist/compat/solid/index.cjs +82 -2
  269. package/dist/compat/solid/index.cjs.map +1 -1
  270. package/dist/compat/solid/index.d.cts +2 -1
  271. package/dist/compat/solid/index.d.ts +2 -1
  272. package/dist/compat/solid/index.js +11 -2
  273. package/dist/compat/solid/index.js.map +1 -1
  274. package/dist/compat/svelte/index.cjs +85 -2
  275. package/dist/compat/svelte/index.cjs.map +1 -1
  276. package/dist/compat/svelte/index.d.cts +2 -1
  277. package/dist/compat/svelte/index.d.ts +2 -1
  278. package/dist/compat/svelte/index.js +11 -2
  279. package/dist/compat/svelte/index.js.map +1 -1
  280. package/dist/compat/vue/index.cjs +100 -2
  281. package/dist/compat/vue/index.cjs.map +1 -1
  282. package/dist/compat/vue/index.d.cts +3 -1
  283. package/dist/compat/vue/index.d.ts +3 -1
  284. package/dist/compat/vue/index.js +11 -2
  285. package/dist/compat/vue/index.js.map +1 -1
  286. package/dist/compat/zustand/index.cjs +50 -2
  287. package/dist/compat/zustand/index.cjs.map +1 -1
  288. package/dist/compat/zustand/index.d.cts +2 -1
  289. package/dist/compat/zustand/index.d.ts +2 -1
  290. package/dist/compat/zustand/index.js +7 -2
  291. package/dist/compat/zustand/index.js.map +1 -1
  292. package/dist/distill-De6Rnn15.d.cts +48 -0
  293. package/dist/distill-De6Rnn15.d.ts +48 -0
  294. package/dist/external-register-CWyroXb_.d.cts +138 -0
  295. package/dist/external-register-CWyroXb_.d.ts +138 -0
  296. package/dist/fallback-Bx46zqky.d.cts +243 -0
  297. package/dist/fallback-pIWW8A2d.d.ts +243 -0
  298. package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
  299. package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
  300. package/dist/index-5SU_O78r.d.cts +754 -0
  301. package/dist/index-B6pxYJzO.d.cts +36 -0
  302. package/dist/index-B6pxYJzO.d.ts +36 -0
  303. package/dist/index-BFsng6v1.d.cts +44 -0
  304. package/dist/index-BFsng6v1.d.ts +44 -0
  305. package/dist/index-Bg-LwEt-.d.cts +45 -0
  306. package/dist/index-Bg-LwEt-.d.ts +45 -0
  307. package/dist/index-Brp888t0.d.cts +127 -0
  308. package/dist/index-Brp888t0.d.ts +127 -0
  309. package/dist/index-CDfk6jHN.d.cts +37 -0
  310. package/dist/index-CDfk6jHN.d.ts +37 -0
  311. package/dist/index-CEXCtYYJ.d.ts +754 -0
  312. package/dist/index-DLAxYaN5.d.cts +169 -0
  313. package/dist/index-DLAxYaN5.d.ts +169 -0
  314. package/dist/index-DeWbQzMe.d.cts +34 -0
  315. package/dist/index-DeWbQzMe.d.ts +34 -0
  316. package/dist/index-dX9IzPqj.d.cts +86 -0
  317. package/dist/index-dX9IzPqj.d.ts +86 -0
  318. package/dist/index.cjs +25950 -0
  319. package/dist/index.cjs.map +1 -1
  320. package/dist/index.d.cts +56 -42
  321. package/dist/index.d.ts +56 -42
  322. package/dist/index.js +849 -0
  323. package/dist/index.js.map +1 -1
  324. package/dist/layout-types-B5aiHYgk.d.cts +72 -0
  325. package/dist/layout-types-B5aiHYgk.d.ts +72 -0
  326. package/dist/memory-composers-BryDrRBX.d.cts +529 -0
  327. package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
  328. package/dist/observable-BXQoW1P-.d.cts +36 -0
  329. package/dist/observable-BXQoW1P-.d.ts +36 -0
  330. package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
  331. package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
  332. package/dist/presets/ai/index.cjs +4377 -0
  333. package/dist/presets/ai/index.cjs.map +1 -0
  334. package/dist/presets/ai/index.d.cts +98 -0
  335. package/dist/presets/ai/index.d.ts +98 -0
  336. package/dist/presets/ai/index.js +54 -0
  337. package/dist/presets/ai/index.js.map +1 -0
  338. package/dist/presets/harness/index.cjs +5929 -0
  339. package/dist/presets/harness/index.cjs.map +1 -0
  340. package/dist/presets/harness/index.d.cts +566 -0
  341. package/dist/presets/harness/index.d.ts +566 -0
  342. package/dist/presets/harness/index.js +71 -0
  343. package/dist/presets/harness/index.js.map +1 -0
  344. package/dist/presets/index.cjs +9782 -0
  345. package/dist/presets/index.cjs.map +1 -0
  346. package/dist/presets/index.d.cts +28 -0
  347. package/dist/presets/index.d.ts +28 -0
  348. package/dist/presets/index.js +129 -0
  349. package/dist/presets/index.js.map +1 -0
  350. package/dist/presets/inspect/index.cjs +1087 -0
  351. package/dist/presets/inspect/index.cjs.map +1 -0
  352. package/dist/presets/inspect/index.d.cts +172 -0
  353. package/dist/presets/inspect/index.d.ts +172 -0
  354. package/dist/presets/inspect/index.js +21 -0
  355. package/dist/presets/inspect/index.js.map +1 -0
  356. package/dist/presets/resilience/index.cjs +1593 -0
  357. package/dist/presets/resilience/index.cjs.map +1 -0
  358. package/dist/presets/resilience/index.d.cts +205 -0
  359. package/dist/presets/resilience/index.d.ts +205 -0
  360. package/dist/presets/resilience/index.js +18 -0
  361. package/dist/presets/resilience/index.js.map +1 -0
  362. package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
  363. package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
  364. package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
  365. package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
  366. package/dist/retry-BDbRZ_gx.d.ts +125 -0
  367. package/dist/retry-DWuhjvsA.d.cts +125 -0
  368. package/dist/solutions/index.cjs +8200 -0
  369. package/dist/solutions/index.cjs.map +1 -0
  370. package/dist/solutions/index.d.cts +23 -0
  371. package/dist/solutions/index.d.ts +23 -0
  372. package/dist/solutions/index.js +55 -0
  373. package/dist/solutions/index.js.map +1 -0
  374. package/dist/spawnable-5mDY501F.d.cts +746 -0
  375. package/dist/spawnable-D3lR0oQu.d.ts +746 -0
  376. package/dist/status-U-rUI79b.d.cts +84 -0
  377. package/dist/status-U-rUI79b.d.ts +84 -0
  378. package/dist/timeout-U5O4ESK3.js +12 -0
  379. package/dist/timeout-U5O4ESK3.js.map +1 -0
  380. package/dist/types-BB5Lw-pB.d.cts +442 -0
  381. package/dist/types-BB5Lw-pB.d.ts +442 -0
  382. package/dist/types-CJWIMJiZ.d.ts +548 -0
  383. package/dist/types-vCq7ShIm.d.cts +548 -0
  384. package/dist/utils/ai/browser.cjs +2169 -0
  385. package/dist/utils/ai/browser.cjs.map +1 -0
  386. package/dist/utils/ai/browser.d.cts +129 -0
  387. package/dist/utils/ai/browser.d.ts +129 -0
  388. package/dist/utils/ai/browser.js +255 -0
  389. package/dist/utils/ai/browser.js.map +1 -0
  390. package/dist/utils/ai/index.cjs +8468 -0
  391. package/dist/utils/ai/index.cjs.map +1 -0
  392. package/dist/utils/ai/index.d.cts +1777 -0
  393. package/dist/utils/ai/index.d.ts +1777 -0
  394. package/dist/utils/ai/index.js +173 -0
  395. package/dist/utils/ai/index.js.map +1 -0
  396. package/dist/utils/ai/node.cjs +648 -0
  397. package/dist/utils/ai/node.cjs.map +1 -0
  398. package/dist/utils/ai/node.d.cts +57 -0
  399. package/dist/utils/ai/node.d.ts +57 -0
  400. package/dist/utils/ai/node.js +84 -0
  401. package/dist/utils/ai/node.js.map +1 -0
  402. package/dist/utils/cqrs/index.cjs +1036 -0
  403. package/dist/utils/cqrs/index.cjs.map +1 -0
  404. package/dist/utils/cqrs/index.d.cts +438 -0
  405. package/dist/utils/cqrs/index.d.ts +438 -0
  406. package/dist/utils/cqrs/index.js +18 -0
  407. package/dist/utils/cqrs/index.js.map +1 -0
  408. package/dist/utils/demo-shell/index.cjs +865 -0
  409. package/dist/utils/demo-shell/index.cjs.map +1 -0
  410. package/dist/utils/demo-shell/index.d.cts +90 -0
  411. package/dist/utils/demo-shell/index.d.ts +90 -0
  412. package/dist/utils/demo-shell/index.js +13 -0
  413. package/dist/utils/demo-shell/index.js.map +1 -0
  414. package/dist/utils/domain-templates/index.cjs +732 -0
  415. package/dist/utils/domain-templates/index.cjs.map +1 -0
  416. package/dist/utils/domain-templates/index.d.cts +214 -0
  417. package/dist/utils/domain-templates/index.d.ts +214 -0
  418. package/dist/utils/domain-templates/index.js +17 -0
  419. package/dist/utils/domain-templates/index.js.map +1 -0
  420. package/dist/utils/graphspec/index.cjs +1174 -0
  421. package/dist/utils/graphspec/index.cjs.map +1 -0
  422. package/dist/utils/graphspec/index.d.cts +449 -0
  423. package/dist/utils/graphspec/index.d.ts +449 -0
  424. package/dist/utils/graphspec/index.js +35 -0
  425. package/dist/utils/graphspec/index.js.map +1 -0
  426. package/dist/utils/harness/index.cjs +656 -0
  427. package/dist/utils/harness/index.cjs.map +1 -0
  428. package/dist/utils/harness/index.d.cts +542 -0
  429. package/dist/utils/harness/index.d.ts +542 -0
  430. package/dist/utils/harness/index.js +56 -0
  431. package/dist/utils/harness/index.js.map +1 -0
  432. package/dist/utils/index.cjs +17609 -0
  433. package/dist/utils/index.cjs.map +1 -0
  434. package/dist/utils/index.d.cts +96 -0
  435. package/dist/utils/index.d.ts +96 -0
  436. package/dist/utils/index.js +514 -0
  437. package/dist/utils/index.js.map +1 -0
  438. package/dist/utils/inspect/index.cjs +807 -0
  439. package/dist/utils/inspect/index.cjs.map +1 -0
  440. package/dist/utils/inspect/index.d.cts +123 -0
  441. package/dist/utils/inspect/index.d.ts +123 -0
  442. package/dist/utils/inspect/index.js +30 -0
  443. package/dist/utils/inspect/index.js.map +1 -0
  444. package/dist/utils/job-queue/index.cjs +717 -0
  445. package/dist/utils/job-queue/index.cjs.map +1 -0
  446. package/dist/utils/job-queue/index.d.cts +200 -0
  447. package/dist/utils/job-queue/index.d.ts +200 -0
  448. package/dist/utils/job-queue/index.js +18 -0
  449. package/dist/utils/job-queue/index.js.map +1 -0
  450. package/dist/utils/memory/index.cjs +1451 -0
  451. package/dist/utils/memory/index.cjs.map +1 -0
  452. package/dist/utils/memory/index.d.cts +582 -0
  453. package/dist/utils/memory/index.d.ts +582 -0
  454. package/dist/utils/memory/index.js +19 -0
  455. package/dist/utils/memory/index.js.map +1 -0
  456. package/dist/utils/messaging/index.cjs +666 -0
  457. package/dist/utils/messaging/index.cjs.map +1 -0
  458. package/dist/utils/messaging/index.d.cts +562 -0
  459. package/dist/utils/messaging/index.d.ts +562 -0
  460. package/dist/utils/messaging/index.js +50 -0
  461. package/dist/utils/messaging/index.js.map +1 -0
  462. package/dist/utils/orchestration/index.cjs +876 -0
  463. package/dist/utils/orchestration/index.cjs.map +1 -0
  464. package/dist/utils/orchestration/index.d.cts +233 -0
  465. package/dist/utils/orchestration/index.d.ts +233 -0
  466. package/dist/utils/orchestration/index.js +19 -0
  467. package/dist/utils/orchestration/index.js.map +1 -0
  468. package/dist/utils/process/index.cjs +743 -0
  469. package/dist/utils/process/index.cjs.map +1 -0
  470. package/dist/utils/process/index.d.cts +411 -0
  471. package/dist/utils/process/index.d.ts +411 -0
  472. package/dist/utils/process/index.js +14 -0
  473. package/dist/utils/process/index.js.map +1 -0
  474. package/dist/utils/reactive-layout/index.cjs +1607 -0
  475. package/dist/utils/reactive-layout/index.cjs.map +1 -0
  476. package/dist/utils/reactive-layout/index.d.cts +492 -0
  477. package/dist/utils/reactive-layout/index.d.ts +492 -0
  478. package/dist/utils/reactive-layout/index.js +52 -0
  479. package/dist/utils/reactive-layout/index.js.map +1 -0
  480. package/dist/utils/reduction/index.cjs +203 -0
  481. package/dist/utils/reduction/index.cjs.map +1 -0
  482. package/dist/utils/reduction/index.d.cts +102 -0
  483. package/dist/utils/reduction/index.d.ts +102 -0
  484. package/dist/utils/reduction/index.js +14 -0
  485. package/dist/utils/reduction/index.js.map +1 -0
  486. package/dist/utils/resilience/index.cjs +1617 -0
  487. package/dist/utils/resilience/index.cjs.map +1 -0
  488. package/dist/utils/resilience/index.d.cts +9 -0
  489. package/dist/utils/resilience/index.d.ts +9 -0
  490. package/dist/utils/resilience/index.js +44 -0
  491. package/dist/utils/resilience/index.js.map +1 -0
  492. package/dist/utils/surface/index.cjs +1070 -0
  493. package/dist/utils/surface/index.cjs.map +1 -0
  494. package/dist/utils/surface/index.d.cts +240 -0
  495. package/dist/utils/surface/index.d.ts +240 -0
  496. package/dist/utils/surface/index.js +30 -0
  497. package/dist/utils/surface/index.js.map +1 -0
  498. package/dist/utils/topology-view/index.cjs +620 -0
  499. package/dist/utils/topology-view/index.cjs.map +1 -0
  500. package/dist/utils/topology-view/index.d.cts +68 -0
  501. package/dist/utils/topology-view/index.d.ts +68 -0
  502. package/dist/utils/topology-view/index.js +11 -0
  503. package/dist/utils/topology-view/index.js.map +1 -0
  504. package/package.json +293 -237
  505. package/dist/core/index.cjs +0 -21
  506. package/dist/core/index.cjs.map +0 -1
  507. package/dist/core/index.d.cts +0 -1
  508. package/dist/core/index.d.ts +0 -1
  509. package/dist/core/index.js +0 -3
  510. package/dist/core/index.js.map +0 -1
  511. package/dist/extra/browser.cjs +0 -21
  512. package/dist/extra/browser.cjs.map +0 -1
  513. package/dist/extra/browser.d.cts +0 -1
  514. package/dist/extra/browser.d.ts +0 -1
  515. package/dist/extra/browser.js +0 -3
  516. package/dist/extra/browser.js.map +0 -1
  517. package/dist/extra/index.cjs +0 -21
  518. package/dist/extra/index.cjs.map +0 -1
  519. package/dist/extra/index.d.cts +0 -1
  520. package/dist/extra/index.d.ts +0 -1
  521. package/dist/extra/index.js +0 -3
  522. package/dist/extra/index.js.map +0 -1
  523. package/dist/extra/node.cjs +0 -21
  524. package/dist/extra/node.cjs.map +0 -1
  525. package/dist/extra/node.d.cts +0 -1
  526. package/dist/extra/node.d.ts +0 -1
  527. package/dist/extra/node.js +0 -3
  528. package/dist/extra/node.js.map +0 -1
  529. package/dist/extra/operators.cjs +0 -21
  530. package/dist/extra/operators.cjs.map +0 -1
  531. package/dist/extra/operators.d.cts +0 -1
  532. package/dist/extra/operators.d.ts +0 -1
  533. package/dist/extra/operators.js +0 -3
  534. package/dist/extra/operators.js.map +0 -1
  535. package/dist/extra/reactive.cjs +0 -21
  536. package/dist/extra/reactive.cjs.map +0 -1
  537. package/dist/extra/reactive.d.cts +0 -1
  538. package/dist/extra/reactive.d.ts +0 -1
  539. package/dist/extra/reactive.js +0 -3
  540. package/dist/extra/reactive.js.map +0 -1
  541. package/dist/extra/render/index.cjs +0 -21
  542. package/dist/extra/render/index.cjs.map +0 -1
  543. package/dist/extra/render/index.d.cts +0 -1
  544. package/dist/extra/render/index.d.ts +0 -1
  545. package/dist/extra/render/index.js +0 -3
  546. package/dist/extra/render/index.js.map +0 -1
  547. package/dist/extra/sources.cjs +0 -21
  548. package/dist/extra/sources.cjs.map +0 -1
  549. package/dist/extra/sources.d.cts +0 -1
  550. package/dist/extra/sources.d.ts +0 -1
  551. package/dist/extra/sources.js +0 -3
  552. package/dist/extra/sources.js.map +0 -1
  553. package/dist/extra/storage-browser.cjs +0 -21
  554. package/dist/extra/storage-browser.cjs.map +0 -1
  555. package/dist/extra/storage-browser.d.cts +0 -1
  556. package/dist/extra/storage-browser.d.ts +0 -1
  557. package/dist/extra/storage-browser.js +0 -3
  558. package/dist/extra/storage-browser.js.map +0 -1
  559. package/dist/extra/storage-core.cjs +0 -21
  560. package/dist/extra/storage-core.cjs.map +0 -1
  561. package/dist/extra/storage-core.d.cts +0 -1
  562. package/dist/extra/storage-core.d.ts +0 -1
  563. package/dist/extra/storage-core.js +0 -3
  564. package/dist/extra/storage-core.js.map +0 -1
  565. package/dist/extra/storage-node.cjs +0 -21
  566. package/dist/extra/storage-node.cjs.map +0 -1
  567. package/dist/extra/storage-node.d.cts +0 -1
  568. package/dist/extra/storage-node.d.ts +0 -1
  569. package/dist/extra/storage-node.js +0 -3
  570. package/dist/extra/storage-node.js.map +0 -1
  571. package/dist/extra/storage-tiers-browser.cjs +0 -21
  572. package/dist/extra/storage-tiers-browser.cjs.map +0 -1
  573. package/dist/extra/storage-tiers-browser.d.cts +0 -1
  574. package/dist/extra/storage-tiers-browser.d.ts +0 -1
  575. package/dist/extra/storage-tiers-browser.js +0 -3
  576. package/dist/extra/storage-tiers-browser.js.map +0 -1
  577. package/dist/extra/storage-tiers-node.cjs +0 -21
  578. package/dist/extra/storage-tiers-node.cjs.map +0 -1
  579. package/dist/extra/storage-tiers-node.d.cts +0 -1
  580. package/dist/extra/storage-tiers-node.d.ts +0 -1
  581. package/dist/extra/storage-tiers-node.js +0 -3
  582. package/dist/extra/storage-tiers-node.js.map +0 -1
  583. package/dist/extra/storage-tiers.cjs +0 -21
  584. package/dist/extra/storage-tiers.cjs.map +0 -1
  585. package/dist/extra/storage-tiers.d.cts +0 -1
  586. package/dist/extra/storage-tiers.d.ts +0 -1
  587. package/dist/extra/storage-tiers.js +0 -3
  588. package/dist/extra/storage-tiers.js.map +0 -1
  589. package/dist/extra/storage-wal.cjs +0 -21
  590. package/dist/extra/storage-wal.cjs.map +0 -1
  591. package/dist/extra/storage-wal.d.cts +0 -1
  592. package/dist/extra/storage-wal.d.ts +0 -1
  593. package/dist/extra/storage-wal.js +0 -3
  594. package/dist/extra/storage-wal.js.map +0 -1
  595. package/dist/graph/index.cjs +0 -21
  596. package/dist/graph/index.cjs.map +0 -1
  597. package/dist/graph/index.d.cts +0 -1
  598. package/dist/graph/index.d.ts +0 -1
  599. package/dist/graph/index.js +0 -3
  600. package/dist/graph/index.js.map +0 -1
  601. package/dist/patterns/ai/browser.cjs +0 -21
  602. package/dist/patterns/ai/browser.cjs.map +0 -1
  603. package/dist/patterns/ai/browser.d.cts +0 -1
  604. package/dist/patterns/ai/browser.d.ts +0 -1
  605. package/dist/patterns/ai/browser.js +0 -3
  606. package/dist/patterns/ai/browser.js.map +0 -1
  607. package/dist/patterns/ai/index.cjs +0 -21
  608. package/dist/patterns/ai/index.cjs.map +0 -1
  609. package/dist/patterns/ai/index.d.cts +0 -1
  610. package/dist/patterns/ai/index.d.ts +0 -1
  611. package/dist/patterns/ai/index.js +0 -3
  612. package/dist/patterns/ai/index.js.map +0 -1
  613. package/dist/patterns/ai/node.cjs +0 -21
  614. package/dist/patterns/ai/node.cjs.map +0 -1
  615. package/dist/patterns/ai/node.d.cts +0 -1
  616. package/dist/patterns/ai/node.d.ts +0 -1
  617. package/dist/patterns/ai/node.js +0 -3
  618. package/dist/patterns/ai/node.js.map +0 -1
  619. package/dist/patterns/cqrs/index.cjs +0 -21
  620. package/dist/patterns/cqrs/index.cjs.map +0 -1
  621. package/dist/patterns/cqrs/index.d.cts +0 -1
  622. package/dist/patterns/cqrs/index.d.ts +0 -1
  623. package/dist/patterns/cqrs/index.js +0 -3
  624. package/dist/patterns/cqrs/index.js.map +0 -1
  625. package/dist/patterns/demo-shell/index.cjs +0 -21
  626. package/dist/patterns/demo-shell/index.cjs.map +0 -1
  627. package/dist/patterns/demo-shell/index.d.cts +0 -1
  628. package/dist/patterns/demo-shell/index.d.ts +0 -1
  629. package/dist/patterns/demo-shell/index.js +0 -3
  630. package/dist/patterns/demo-shell/index.js.map +0 -1
  631. package/dist/patterns/domain-templates/index.cjs +0 -21
  632. package/dist/patterns/domain-templates/index.cjs.map +0 -1
  633. package/dist/patterns/domain-templates/index.d.cts +0 -1
  634. package/dist/patterns/domain-templates/index.d.ts +0 -1
  635. package/dist/patterns/domain-templates/index.js +0 -3
  636. package/dist/patterns/domain-templates/index.js.map +0 -1
  637. package/dist/patterns/graphspec/index.cjs +0 -21
  638. package/dist/patterns/graphspec/index.cjs.map +0 -1
  639. package/dist/patterns/graphspec/index.d.cts +0 -1
  640. package/dist/patterns/graphspec/index.d.ts +0 -1
  641. package/dist/patterns/graphspec/index.js +0 -3
  642. package/dist/patterns/graphspec/index.js.map +0 -1
  643. package/dist/patterns/harness/index.cjs +0 -21
  644. package/dist/patterns/harness/index.cjs.map +0 -1
  645. package/dist/patterns/harness/index.d.cts +0 -1
  646. package/dist/patterns/harness/index.d.ts +0 -1
  647. package/dist/patterns/harness/index.js +0 -3
  648. package/dist/patterns/harness/index.js.map +0 -1
  649. package/dist/patterns/inspect/index.cjs +0 -21
  650. package/dist/patterns/inspect/index.cjs.map +0 -1
  651. package/dist/patterns/inspect/index.d.cts +0 -1
  652. package/dist/patterns/inspect/index.d.ts +0 -1
  653. package/dist/patterns/inspect/index.js +0 -3
  654. package/dist/patterns/inspect/index.js.map +0 -1
  655. package/dist/patterns/job-queue/index.cjs +0 -21
  656. package/dist/patterns/job-queue/index.cjs.map +0 -1
  657. package/dist/patterns/job-queue/index.d.cts +0 -1
  658. package/dist/patterns/job-queue/index.d.ts +0 -1
  659. package/dist/patterns/job-queue/index.js +0 -3
  660. package/dist/patterns/job-queue/index.js.map +0 -1
  661. package/dist/patterns/memory/index.cjs +0 -21
  662. package/dist/patterns/memory/index.cjs.map +0 -1
  663. package/dist/patterns/memory/index.d.cts +0 -1
  664. package/dist/patterns/memory/index.d.ts +0 -1
  665. package/dist/patterns/memory/index.js +0 -3
  666. package/dist/patterns/memory/index.js.map +0 -1
  667. package/dist/patterns/messaging/index.cjs +0 -21
  668. package/dist/patterns/messaging/index.cjs.map +0 -1
  669. package/dist/patterns/messaging/index.d.cts +0 -1
  670. package/dist/patterns/messaging/index.d.ts +0 -1
  671. package/dist/patterns/messaging/index.js +0 -3
  672. package/dist/patterns/messaging/index.js.map +0 -1
  673. package/dist/patterns/orchestration/index.cjs +0 -21
  674. package/dist/patterns/orchestration/index.cjs.map +0 -1
  675. package/dist/patterns/orchestration/index.d.cts +0 -1
  676. package/dist/patterns/orchestration/index.d.ts +0 -1
  677. package/dist/patterns/orchestration/index.js +0 -3
  678. package/dist/patterns/orchestration/index.js.map +0 -1
  679. package/dist/patterns/process/index.cjs +0 -21
  680. package/dist/patterns/process/index.cjs.map +0 -1
  681. package/dist/patterns/process/index.d.cts +0 -1
  682. package/dist/patterns/process/index.d.ts +0 -1
  683. package/dist/patterns/process/index.js +0 -3
  684. package/dist/patterns/process/index.js.map +0 -1
  685. package/dist/patterns/reactive-layout/index.cjs +0 -21
  686. package/dist/patterns/reactive-layout/index.cjs.map +0 -1
  687. package/dist/patterns/reactive-layout/index.d.cts +0 -1
  688. package/dist/patterns/reactive-layout/index.d.ts +0 -1
  689. package/dist/patterns/reactive-layout/index.js +0 -3
  690. package/dist/patterns/reactive-layout/index.js.map +0 -1
  691. package/dist/patterns/reduction/index.cjs +0 -21
  692. package/dist/patterns/reduction/index.cjs.map +0 -1
  693. package/dist/patterns/reduction/index.d.cts +0 -1
  694. package/dist/patterns/reduction/index.d.ts +0 -1
  695. package/dist/patterns/reduction/index.js +0 -3
  696. package/dist/patterns/reduction/index.js.map +0 -1
  697. package/dist/patterns/surface/index.cjs +0 -21
  698. package/dist/patterns/surface/index.cjs.map +0 -1
  699. package/dist/patterns/surface/index.d.cts +0 -1
  700. package/dist/patterns/surface/index.d.ts +0 -1
  701. package/dist/patterns/surface/index.js +0 -3
  702. package/dist/patterns/surface/index.js.map +0 -1
  703. package/dist/patterns/topology-view/index.cjs +0 -21
  704. package/dist/patterns/topology-view/index.cjs.map +0 -1
  705. package/dist/patterns/topology-view/index.d.cts +0 -1
  706. package/dist/patterns/topology-view/index.d.ts +0 -1
  707. package/dist/patterns/topology-view/index.js +0 -3
  708. package/dist/patterns/topology-view/index.js.map +0 -1
  709. package/dist/testing/index.cjs +0 -21
  710. package/dist/testing/index.cjs.map +0 -1
  711. package/dist/testing/index.d.cts +0 -1
  712. package/dist/testing/index.d.ts +0 -1
  713. package/dist/testing/index.js +0 -3
  714. package/dist/testing/index.js.map +0 -1
@@ -0,0 +1,2245 @@
1
+ import { Message, Node, NodeOptions } from '@graphrefly/pure-ts/core';
2
+ import { SnapshotStorageTier } from '@graphrefly/pure-ts/extra/storage';
3
+ import { GraphCheckpointRecord } from '@graphrefly/pure-ts/graph';
4
+ import { E as EmitTriad, b as ExternalRegister } from '../../external-register-CWyroXb_.cjs';
5
+ import { B as BackoffStrategy, a as BackoffPreset } from '../../backoff-Bnb9OoPh.cjs';
6
+ import { AsyncSourceOpts } from '@graphrefly/pure-ts/extra';
7
+ import { W as WithStatusBundle } from '../../status-U-rUI79b.cjs';
8
+ import { r as retry } from '../../retry-DWuhjvsA.cjs';
9
+ import '../../_internal-B23BagFd.cjs';
10
+
11
+ /**
12
+ * {@link reactiveSink} — canonical sink factory for Wave 5 adapters.
13
+ *
14
+ * Every `to*` adapter in {@link ./adapters.ts} can be expressed as a thin
15
+ * config wrapper around this one factory. It centralizes:
16
+ *
17
+ * - **Transport boundary** — the sole place in the sink layer where a raw
18
+ * Promise / `.then` / `.catch` sits (§5.10 boundary documented here).
19
+ * - **Retry** — delegates to {@link BackoffStrategy} from `backoff.ts`.
20
+ * - **Buffering** — `batchSize` / `flushIntervalMs` with tier-3 flush-on-
21
+ * terminal per spec §5.11. Buffered mode activates when `sendBatch` is
22
+ * supplied or a batching knob is set.
23
+ * - **Backpressure** — bounded internal queue with `drop-oldest` /
24
+ * `drop-newest` / `error` strategies. The `"wait"` strategy is deferred
25
+ * to external composition (`source | valve(...) | reactiveSink(...)`).
26
+ * - **Companions** — `sent` / `failed` / `inFlight` / `errors` (+ `buffered`
27
+ * / `paused` when buffering or backpressure is active). These surface
28
+ * every transport outcome as reactive nodes so downstream operators can
29
+ * build retry fallbacks, dead-letter queues, or SLO gauges without
30
+ * touching callback soup.
31
+ */
32
+
33
+ /**
34
+ * Structured transport-failure record. Every sink routes both recoverable
35
+ * (pre-retry) and terminal (post-exhaustion) failures through this shape.
36
+ *
37
+ * @category extra
38
+ */
39
+ type SinkTransportError = {
40
+ /**
41
+ * Failure stage. Known values: `"serialize"`, `"send"`, `"close"`,
42
+ * `"routing_key"`, `"ack"`, `"retry_exhausted"`. Open to extension for
43
+ * protocol-specific stages.
44
+ */
45
+ stage: string;
46
+ /** The error. */
47
+ error: Error;
48
+ /** Unwrapped DATA value (present for per-record failures). */
49
+ value: unknown;
50
+ /** Full message tuple (present for non-DATA stages like `"close"`). */
51
+ message?: Message;
52
+ /** Attempt number when `retry` is active — `1` = initial send. */
53
+ attempt?: number;
54
+ };
55
+ /**
56
+ * Terminal failure record delivered on the `failed` companion after retries
57
+ * are exhausted (or `shouldRetry` returned `false`).
58
+ *
59
+ * @category extra
60
+ */
61
+ type SinkFailure<T> = {
62
+ value: T;
63
+ error: Error;
64
+ /** Total attempts made, including the initial send. */
65
+ attempts: number;
66
+ };
67
+ /**
68
+ * Handle returned by every Wave 5 sink.
69
+ *
70
+ * @category extra
71
+ */
72
+ type ReactiveSinkHandle<T> = {
73
+ /** Unsubscribe from source, cancel timers, fire `TEARDOWN` on companions. */
74
+ dispose(): void;
75
+ /** Drain buffer + await in-flight sends (buffered mode only). */
76
+ flush?(): Promise<void>;
77
+ /** DATA values that successfully reached the transport. */
78
+ sent: Node<T>;
79
+ /** Values that permanently failed (after any retries). */
80
+ failed: Node<SinkFailure<T> | null>;
81
+ /** Number of pending transport operations. */
82
+ inFlight: Node<number>;
83
+ /** Every transient transport error (pre-retry). Latest-only. */
84
+ errors: Node<SinkTransportError | null>;
85
+ /** Items currently buffered (buffered mode / backpressure only). */
86
+ buffered?: Node<number>;
87
+ /** `true` when a backpressure strategy has dropped / rejected items. */
88
+ paused?: Node<boolean>;
89
+ };
90
+ /**
91
+ * Retry configuration for {@link reactiveSink}.
92
+ *
93
+ * @category extra
94
+ */
95
+ type ReactiveSinkRetryOptions = {
96
+ /** Total attempts including the initial send. Default: `1` (no retry). */
97
+ maxAttempts?: number;
98
+ /** Backoff strategy (ns) or preset name. Default: `"exponential"` when `maxAttempts > 1`. */
99
+ backoff?: BackoffStrategy | BackoffPreset;
100
+ /** Predicate — return `false` to short-circuit retry for a given error. */
101
+ shouldRetry?: (err: Error, attempt: number) => boolean;
102
+ };
103
+ /**
104
+ * Backpressure configuration for {@link reactiveSink}. When omitted, the
105
+ * sink has no internal buffer cap beyond the natural `batchSize` /
106
+ * `flushIntervalMs` limits.
107
+ *
108
+ * @category extra
109
+ */
110
+ type ReactiveSinkBackpressureOptions = {
111
+ /** Hard cap on buffered items; further items trigger `strategy`. Default: `Infinity`. */
112
+ maxBuffer?: number;
113
+ /** Policy when the buffer is full. Default: `"drop-oldest"`. */
114
+ strategy?: "drop-oldest" | "drop-newest" | "error";
115
+ };
116
+ /**
117
+ * Base options shared by every sink built on {@link reactiveSink}.
118
+ *
119
+ * @category extra
120
+ */
121
+ type ReactiveSinkOptions<T> = {
122
+ /** Optional name used for companion node naming. */
123
+ name?: string;
124
+ /** Invoked synchronously for every transient transport error. */
125
+ onTransportError?: (err: SinkTransportError) => void;
126
+ /** Retry configuration. */
127
+ retry?: ReactiveSinkRetryOptions;
128
+ /** Backpressure configuration. */
129
+ backpressure?: ReactiveSinkBackpressureOptions;
130
+ /** Batch size before auto-flush (buffered mode). */
131
+ batchSize?: number;
132
+ /** Flush interval in ms; `0` = write-through (buffered mode). */
133
+ flushIntervalMs?: number;
134
+ /** Optional transform applied before `send` / `sendBatch`. */
135
+ serialize?: (value: T) => unknown;
136
+ /**
137
+ * Reactive stop signal — when this node emits any DATA or terminal, the
138
+ * sink tears down. Gives callers a reactive alternative to the imperative
139
+ * `handle.dispose()` call so teardown can be wired through the graph.
140
+ */
141
+ stopOn?: Node<unknown>;
142
+ /**
143
+ * Optional hook invoked for each upstream non-DATA message (COMPLETE /
144
+ * ERROR / etc.) observed by the sink. Used by adapters like
145
+ * {@link toWebSocket} to close the underlying resource when the source
146
+ * terminates, without the caller having to subscribe twice.
147
+ */
148
+ onUpstreamMessage?: (msg: Message) => void;
149
+ /**
150
+ * Invoked once during `dispose()` after the sink's own cleanup (unsub,
151
+ * final drain, TEARDOWN on companions). Adapters wrap external resources
152
+ * (socket listeners, file handles) by passing their cleanup here —
153
+ * avoids hand-rolling a wrapper around `handle.dispose`.
154
+ */
155
+ onDispose?: () => void;
156
+ /**
157
+ * Ignored — reserved for future parity with `source.pipe(...)` style.
158
+ *
159
+ * @internal
160
+ */
161
+ _reserved?: never;
162
+ };
163
+ /**
164
+ * Full config accepted by {@link reactiveSink}. One of `send` / `sendBatch`
165
+ * is required.
166
+ *
167
+ * @category extra
168
+ */
169
+ type ReactiveSinkConfig<T, Ctx = unknown> = ReactiveSinkOptions<T> & {
170
+ /** Per-record transport call. */
171
+ send?: (value: T, ctx: Ctx) => Promise<void> | void;
172
+ /** Batched transport call. When supplied, buffering activates automatically. */
173
+ sendBatch?: (batch: T[], ctx: Ctx) => Promise<void> | void;
174
+ /** Context object threaded into every `send` / `sendBatch` call. */
175
+ ctx?: Ctx;
176
+ };
177
+ /**
178
+ * Build a reactive sink with retry / buffering / backpressure / observability
179
+ * companions. Every Wave 5 `to*` adapter is a thin config wrapper around
180
+ * this factory.
181
+ *
182
+ * **Modes:**
183
+ * - `send` only, no batching knobs → **per-record write-through**
184
+ * - `send` + `batchSize` or `flushIntervalMs` → **per-record buffered**
185
+ * (buffer drains via repeated `send` calls — one-by-one in order)
186
+ * - `sendBatch` → **batched** (whole chunks handed to the transport)
187
+ *
188
+ * @category extra
189
+ */
190
+ declare function reactiveSink<T, Ctx = unknown>(source: Node<T>, config: ReactiveSinkConfig<T, Ctx>): ReactiveSinkHandle<T>;
191
+
192
+ /**
193
+ * Internal helpers shared by IO sub-files.
194
+ *
195
+ * - `ExtraOpts` / `sourceOpts` — common opts + the `describeKind: "producer"`
196
+ * wrapper used by every producer-shaped IO source.
197
+ * - `SinkHandle` / `BufferedSinkHandle` — public sink handle shapes shared by
198
+ * per-record and buffered sinks across multiple protocols.
199
+ * - `AdapterHandlers` / `AckableMessage` — alias of `EmitTriad` and the
200
+ * manual-ack envelope used by Pulsar / RabbitMQ ingest sub-files.
201
+ * - `AttachStorageGraphLike` — duck-typed graph shape used by
202
+ * `checkpointToS3` / `checkpointToRedis`.
203
+ */
204
+
205
+ type ExtraOpts = Omit<NodeOptions, "describeKind">;
206
+ /** Handle returned by per-record and buffered sinks. */
207
+ type SinkHandle = {
208
+ /** Stop the sink (unsubscribe from source). */
209
+ dispose: () => void;
210
+ /** Reactive node that emits the latest transport error (or `null`). */
211
+ errors: Node<SinkTransportError | null>;
212
+ /** Manually drain the internal buffer (buffered sinks only). */
213
+ flush?: () => Promise<void>;
214
+ };
215
+ /** Handle returned by buffered sinks. `flush()` drains remaining buffer. */
216
+ type BufferedSinkHandle = SinkHandle & {
217
+ /** Manually drain the internal buffer. */
218
+ flush: () => Promise<void>;
219
+ };
220
+ /** Standard handler triple for adapters that accept injected registrations. Alias of {@link EmitTriad}. */
221
+ type AdapterHandlers<T> = EmitTriad<T>;
222
+ /**
223
+ * Message envelope emitted by queue consumers when `autoAck: false`. The
224
+ * caller is responsible for calling `ack()` after successful processing or
225
+ * `nack()` to re-queue / dead-letter. Pairs cleanly with reactive pipelines:
226
+ *
227
+ * ```ts
228
+ * const messages$ = fromPulsar(consumer, { autoAck: false });
229
+ * effect([messages$], ([m]) => {
230
+ * try {
231
+ * process(m.value);
232
+ * m.ack();
233
+ * } catch (err) {
234
+ * m.nack({ requeue: true });
235
+ * }
236
+ * });
237
+ * ```
238
+ *
239
+ * Ack/nack are imperative callbacks (§5.10 boundary) because the underlying
240
+ * SDKs expose them as such. Reactive-all-the-way ack flows can be built by
241
+ * piping `msg.ack` calls into a `reactiveSink` if desired.
242
+ *
243
+ * **Caller contract — must settle every emitted message.** The envelope holds
244
+ * a closure reference to the raw SDK message; unsettled envelopes keep the
245
+ * broker's in-flight window full and leak memory proportional to consumer
246
+ * throughput. Patterns that drop messages (filter, take-first, switchMap
247
+ * discard) must explicitly `nack({ requeue: true })` the discarded ones, or
248
+ * wrap the source to force-settle on teardown.
249
+ *
250
+ * **Ack/nack transport failures.** Both methods route exceptions through
251
+ * the source's `onAckError` option (when provided) — SDK rejections from
252
+ * `acknowledge()`/`negativeAcknowledge()` don't escape as unhandled
253
+ * rejections. Default (no `onAckError`): swallow. The broker handles
254
+ * redelivery on its own timeline.
255
+ *
256
+ * @category extra
257
+ */
258
+ type AckableMessage<T> = {
259
+ /** The wrapped message body. */
260
+ value: T;
261
+ /** Acknowledge successful processing. Safe to call more than once — idempotent. */
262
+ ack(): void;
263
+ /**
264
+ * Negative-acknowledge — signals the broker the message was not processed
265
+ * successfully. `requeue: true` asks the broker to redeliver; `requeue: false`
266
+ * may route to a dead-letter queue (SDK-specific). Omit `requeue` to
267
+ * defer to the SDK's own default.
268
+ */
269
+ nack(opts?: {
270
+ requeue?: boolean;
271
+ }): void;
272
+ };
273
+ /** Duck-typed graph shape consumed by `checkpointToS3` / `checkpointToRedis`. */
274
+ type AttachStorageGraphLike = {
275
+ attachSnapshotStorage: (pairs: readonly {
276
+ snapshot: SnapshotStorageTier<GraphCheckpointRecord>;
277
+ }[], opts?: unknown) => {
278
+ dispose(): void;
279
+ };
280
+ name: string;
281
+ };
282
+
283
+ /**
284
+ * S3 object-storage sink IO — `toS3` buffers upstream `DATA` values and
285
+ * uploads them as NDJSON or JSON objects via the duck-typed
286
+ * {@link S3ClientLike}.
287
+ *
288
+ * `S3ClientLike` is also used by `checkpointToS3` (in `./checkpoint.ts`).
289
+ */
290
+
291
+ /** Duck-typed S3 client (compatible with AWS SDK v3 `S3Client.send(PutObjectCommand(...))`). */
292
+ type S3ClientLike = {
293
+ putObject(params: {
294
+ Bucket: string;
295
+ Key: string;
296
+ Body: string | Uint8Array;
297
+ ContentType?: string;
298
+ }): Promise<unknown>;
299
+ };
300
+ /** Options for {@link toS3}. */
301
+ type ToS3Options<T> = ExtraOpts & {
302
+ /** Output format. Default: `"ndjson"`. */
303
+ format?: "ndjson" | "json";
304
+ /** Generate the S3 key for each batch. Receives `(seq, wallClockNs)`. Default: ISO timestamp + sequence. */
305
+ keyGenerator?: (seq: number, timestampNs: number) => string;
306
+ /** Batch size before auto-flush. Default: `1000`. */
307
+ batchSize?: number;
308
+ /** Flush interval in ms. Default: `10000`. */
309
+ flushIntervalMs?: number;
310
+ /** Transform value before serialization. Default: identity. */
311
+ transform?: (value: T) => unknown;
312
+ onTransportError?: (err: SinkTransportError) => void;
313
+ };
314
+ /**
315
+ * S3 object storage sink — buffers values and uploads as NDJSON or JSON objects.
316
+ *
317
+ * @param source - Upstream node.
318
+ * @param client - S3-compatible client with `putObject()`.
319
+ * @param bucket - S3 bucket name.
320
+ * @param opts - Format, key generation, batching options.
321
+ * @returns `BufferedSinkHandle`.
322
+ *
323
+ * @category extra
324
+ */
325
+ declare function toS3<T>(source: Node<T>, client: S3ClientLike, bucket: string, opts?: ToS3Options<T>): ReactiveSinkHandle<T>;
326
+
327
+ /**
328
+ * Graph checkpoint sinks — `checkpointToS3` and `checkpointToRedis` wire a
329
+ * graph's `attachSnapshotStorage` with an S3- or Redis-backed
330
+ * {@link SnapshotStorageTier}.
331
+ */
332
+
333
+ /** Options for {@link checkpointToS3}. */
334
+ type CheckpointToS3Options = {
335
+ /** S3 key prefix. Default: `"checkpoints/"`. */
336
+ prefix?: string;
337
+ /** Debounce ms on the S3 tier. Default: `500`. */
338
+ debounceMs?: number;
339
+ /** Full snapshot compaction interval. Default: `10`. */
340
+ compactEvery?: number;
341
+ onError?: (error: unknown) => void;
342
+ };
343
+ /**
344
+ * Wires `graph.attachSnapshotStorage()` with an S3-backed tier.
345
+ *
346
+ * @param graph - Graph instance to checkpoint.
347
+ * @param client - S3-compatible client with `putObject()`.
348
+ * @param bucket - S3 bucket name.
349
+ * @param opts - Key prefix, debounce, and compaction options.
350
+ * @returns Dispose handle.
351
+ *
352
+ * @category extra
353
+ */
354
+ declare function checkpointToS3(graph: AttachStorageGraphLike, client: S3ClientLike, bucket: string, opts?: CheckpointToS3Options): {
355
+ dispose(): void;
356
+ };
357
+ /** Duck-typed Redis client for checkpoint storage. */
358
+ type RedisCheckpointClientLike = {
359
+ set(key: string, value: string): Promise<unknown>;
360
+ get(key: string): Promise<string | null>;
361
+ };
362
+ /** Options for {@link checkpointToRedis}. */
363
+ type CheckpointToRedisOptions = {
364
+ /** Key prefix. Default: `"graphrefly:checkpoint:"`. */
365
+ prefix?: string;
366
+ /** Debounce ms on the Redis tier. Default: `500`. */
367
+ debounceMs?: number;
368
+ /** Full snapshot compaction interval. Default: `10`. */
369
+ compactEvery?: number;
370
+ onError?: (error: unknown) => void;
371
+ };
372
+ /**
373
+ * Wires `graph.attachSnapshotStorage()` with a Redis-backed tier.
374
+ *
375
+ * @param graph - Graph instance to checkpoint.
376
+ * @param client - Redis client with `set()`/`get()`.
377
+ * @param opts - Key prefix, debounce, and compaction options.
378
+ * @returns Dispose handle.
379
+ *
380
+ * @category extra
381
+ */
382
+ declare function checkpointToRedis(graph: AttachStorageGraphLike, client: RedisCheckpointClientLike, opts?: CheckpointToRedisOptions): {
383
+ dispose(): void;
384
+ };
385
+
386
+ /**
387
+ * ClickHouse live materialized view IO — `fromClickHouseWatch` polls a query
388
+ * via `fromTimer + switchMap` (reactive timer, switch semantics cancel
389
+ * in-flight queries) and emits one `DATA` per result row per scrape.
390
+ */
391
+
392
+ /** Structured ClickHouse query result row. */
393
+ type ClickHouseRow = Record<string, unknown>;
394
+ /** Duck-typed ClickHouse client. */
395
+ type ClickHouseClientLike = {
396
+ query(opts: {
397
+ query: string;
398
+ format?: string;
399
+ }): Promise<{
400
+ json<T = unknown>(): Promise<T[]>;
401
+ }>;
402
+ };
403
+ /** Options for {@link fromClickHouseWatch}. */
404
+ type FromClickHouseWatchOptions = AsyncSourceOpts & {
405
+ /** Polling interval in nanoseconds. Default: `5 * NS_PER_SEC` (5s). */
406
+ intervalNs?: number;
407
+ /** JSON format to request. Default: `"JSONEachRow"`. */
408
+ format?: string;
409
+ /**
410
+ * Maximum consecutive query errors before terminating the source. Prevents
411
+ * error storms when the database is unavailable. Default: `5`. Set to
412
+ * `Infinity` to keep retrying indefinitely.
413
+ */
414
+ maxConsecutiveErrors?: number;
415
+ };
416
+ /**
417
+ * ClickHouse live materialized view as a reactive source.
418
+ *
419
+ * Polls a ClickHouse query on a reactive timer interval and emits new/changed rows.
420
+ * Uses a timer-driven approach (not busy-wait polling).
421
+ *
422
+ * @param client - ClickHouse client instance (caller owns connection).
423
+ * @param query - SQL query to execute on each interval.
424
+ * @param opts - Polling interval and format options.
425
+ * @returns `Node<ClickHouseRow>` — one `DATA` per result row per scrape.
426
+ *
427
+ * @example
428
+ * ```ts
429
+ * import { createClient } from "@clickhouse/client";
430
+ * import { fromClickHouseWatch } from "@graphrefly/graphrefly-ts";
431
+ *
432
+ * const client = createClient({ url: "http://localhost:8123" });
433
+ * const rows$ = fromClickHouseWatch(client, "SELECT * FROM errors_mv ORDER BY timestamp DESC LIMIT 100");
434
+ * ```
435
+ *
436
+ * @category extra
437
+ */
438
+ declare function fromClickHouseWatch(client: ClickHouseClientLike, query: string, opts?: FromClickHouseWatchOptions): Node<ClickHouseRow>;
439
+
440
+ /**
441
+ * CSV ingest IO — `fromCSV` reads an `AsyncIterable<string>` of CSV chunks
442
+ * (one node per row), and `csvRows` is the stateful operator variant for
443
+ * existing reactive `Node<string>` upstreams. Both share the local
444
+ * `parseCSVLine` helper so quoted fields and embedded delimiters are handled
445
+ * uniformly.
446
+ */
447
+
448
+ /** Parsed CSV row. */
449
+ type CSVRow = Record<string, string>;
450
+ /** Options for {@link fromCSV}. */
451
+ type FromCSVOptions = ExtraOpts & {
452
+ /** Column delimiter. Default: `","`. */
453
+ delimiter?: string;
454
+ /** Whether the first row is a header. Default: `true`. */
455
+ hasHeader?: boolean;
456
+ /** Explicit column names (overrides header row). */
457
+ columns?: string[];
458
+ /** Custom line parser (e.g. wrapping a library like `csv-parse`). Overrides built-in parser + delimiter. */
459
+ parseLine?: (line: string) => string[];
460
+ };
461
+ /**
462
+ * CSV file/stream ingest for batch replay.
463
+ *
464
+ * Reads a CSV from a `ReadableStream<string>` or an `AsyncIterable<string>` of lines,
465
+ * emitting one `DATA` per row. `COMPLETE` after all rows are emitted.
466
+ *
467
+ * @param source - Async iterable of CSV text chunks (lines or multi-line chunks).
468
+ * @param opts - Delimiter, header, and column options.
469
+ * @returns `Node<CSVRow>` — one `DATA` per parsed row.
470
+ *
471
+ * @example
472
+ * ```ts
473
+ * import { createReadStream } from "node:fs";
474
+ * import { fromCSV } from "@graphrefly/graphrefly-ts";
475
+ *
476
+ * const csv$ = fromCSV(createReadStream("data.csv", "utf-8"));
477
+ * ```
478
+ *
479
+ * @category extra
480
+ */
481
+ declare function fromCSV(source: AsyncIterable<string>, opts?: FromCSVOptions): Node<CSVRow>;
482
+ /**
483
+ * Stateful CSV parser operator — takes a `Node<string>` emitting raw text
484
+ * chunks (from any source: {@link fromAsyncIter}, {@link fromHTTPStream},
485
+ * WebSocket, file watcher, etc.) and emits one `DATA` per parsed row.
486
+ *
487
+ * Buffers incomplete lines across chunks. Mirrors {@link fromCSV}'s parsing
488
+ * logic without committing to an async-iterable-only input.
489
+ *
490
+ * @example
491
+ * ```ts
492
+ * import { fromHTTPStream, csvRows } from "@graphrefly/graphrefly-ts";
493
+ * const bytes$ = fromHTTPStream("https://example.com/data.csv");
494
+ * const text$ = decodeText(bytes$); // caller-provided byte→string decoder
495
+ * const rows$ = csvRows(text$, { columns: ["name", "age"] });
496
+ * ```
497
+ *
498
+ * @category extra
499
+ */
500
+ declare function csvRows(source: Node<string>, opts?: FromCSVOptions): Node<CSVRow>;
501
+
502
+ /**
503
+ * Drizzle adapter (5.2b) — `fromDrizzle` runs `query.execute()` and emits one
504
+ * `DATA` containing the full mapped row array, then `COMPLETE`.
505
+ */
506
+
507
+ /**
508
+ * Duck-typed Drizzle query builder result.
509
+ *
510
+ * Drizzle query builders (e.g. `db.select().from(users)`) expose `.execute()`
511
+ * which returns `Promise<T[]>`. This interface captures that contract without
512
+ * depending on `drizzle-orm`.
513
+ */
514
+ type DrizzleQueryLike<T = unknown> = {
515
+ execute(): Promise<T[]>;
516
+ };
517
+ /** Options for {@link fromDrizzle}. */
518
+ type FromDrizzleOptions<T, U = T> = ExtraOpts & {
519
+ /** Map each row to the desired shape. Default: identity cast. */
520
+ mapRow?: (row: T) => U;
521
+ };
522
+ /**
523
+ * One-shot Drizzle query as a reactive source.
524
+ *
525
+ * Calls `query.execute()`, emits one `DATA` per result row, then `COMPLETE`.
526
+ * Compose with `switchMap` + `fromTimer` for periodic re-query.
527
+ *
528
+ * @param query - Drizzle query builder (e.g. `db.select().from(users).where(...)`).
529
+ * @param opts - Row mapper and node options.
530
+ * @returns `Node<U>` — one `DATA` per row, then `COMPLETE`.
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * import { drizzle } from "drizzle-orm/node-postgres";
535
+ * import { fromDrizzle } from "@graphrefly/graphrefly-ts";
536
+ *
537
+ * const db = drizzle(pool);
538
+ * const rows$ = fromDrizzle(db.select().from(users).where(eq(users.active, true)));
539
+ * ```
540
+ *
541
+ * @category extra
542
+ */
543
+ declare function fromDrizzle<T = unknown, U = T>(query: DrizzleQueryLike<T>, opts?: FromDrizzleOptions<T, U>): Node<U[]>;
544
+
545
+ /**
546
+ * HTTP IO — `fromHTTP` (one-shot fetch with `withStatus` companion bundle),
547
+ * `toHTTP` (per-record / buffered sink with retry support), `fromHTTPStream`
548
+ * (raw `Uint8Array` byte stream), `fromHTTPPoll` (interval-driven re-fetch).
549
+ *
550
+ * Uses the platform `fetch` API (Node 18+, browsers, Deno, Bun). Timeouts use
551
+ * `AbortController` driven by `setTimeout` per spec §5.10's resilience-operator
552
+ * carve-out.
553
+ */
554
+
555
+ /**
556
+ * Options for {@link fromHTTP}.
557
+ *
558
+ * @category extra
559
+ */
560
+ interface FromHTTPOptions extends AsyncSourceOpts {
561
+ /** HTTP method. Default: `"GET"`. */
562
+ method?: string;
563
+ /** Request headers. */
564
+ headers?: Record<string, string>;
565
+ /** Request body (for POST/PUT/PATCH). */
566
+ body?: any;
567
+ /** Transform the Response before emitting. Default: `response.json()`. */
568
+ transform?: (response: Response) => any | Promise<any>;
569
+ /** Request timeout in **nanoseconds**. Default: `30s` (30 * NS_PER_SEC). */
570
+ timeoutNs?: number;
571
+ /**
572
+ * When `true`, emit `COMPLETE` after the first successful fetch. Useful for
573
+ * one-shot semantics where downstream wants to know "no more values ever."
574
+ * Default: `false` — the node stays live and replays cached DATA to late
575
+ * subscribers via push-on-subscribe (spec §2.2).
576
+ */
577
+ completeAfterFetch?: boolean;
578
+ /**
579
+ * When `true`, trigger a fresh fetch on each new subscriber instead of
580
+ * sharing one cached result. Default: `false` — one shared fetch whose
581
+ * result is cached and replayed to every subscriber.
582
+ */
583
+ refetchOnSubscribe?: boolean;
584
+ }
585
+ /**
586
+ * Result of {@link fromHTTP}: main source plus status, error, and fetch count companions.
587
+ *
588
+ * @category extra
589
+ */
590
+ type HTTPBundle<T> = WithStatusBundle<T> & {
591
+ /** Number of successful fetches. */
592
+ fetchCount: Node<number>;
593
+ /** Nanosecond wall-clock timestamp of the last successful fetch. */
594
+ lastUpdated: Node<number>;
595
+ /**
596
+ * `true` after at least one successful fetch; stays `true` across
597
+ * resubscribes. Orthogonal to {@link withStatus}'s `active`/`completed`
598
+ * lifecycle — use this as the "fetch done" signal under the default
599
+ * (cached, stays-live) behavior where `withStatus` never transitions to
600
+ * `"completed"` unless `completeAfterFetch: true` is set.
601
+ */
602
+ fetched: Node<boolean>;
603
+ };
604
+ /**
605
+ * Creates a one-shot fetch-based HTTP source with lifecycle tracking.
606
+ *
607
+ * @category extra
608
+ */
609
+ declare function fromHTTP<T = any>(url: string, opts?: FromHTTPOptions): HTTPBundle<T>;
610
+ /** Options for {@link toHTTP}. */
611
+ type ToHTTPOptions<T> = ExtraOpts & {
612
+ /** HTTP method. Default: `"POST"`. */
613
+ method?: string;
614
+ /** Request headers applied to every call. Caller sets Content-Type. */
615
+ headers?: Record<string, string>;
616
+ /** Serialize a value to a request body. Default: `JSON.stringify`. */
617
+ serialize?: (value: T) => string | Uint8Array;
618
+ /** Optional request timeout in nanoseconds. */
619
+ timeoutNs?: number;
620
+ /**
621
+ * Format used when `batchSize` / `flushIntervalMs` is set:
622
+ * - `"json-array"` — body is `JSON.stringify(batch)`
623
+ * - `"ndjson"` — body is newline-delimited JSON.
624
+ * Default: `"json-array"`.
625
+ */
626
+ batchFormat?: "json-array" | "ndjson";
627
+ /** Batch size before auto-flush (buffered mode). */
628
+ batchSize?: number;
629
+ /** Flush interval in ms (buffered mode). */
630
+ flushIntervalMs?: number;
631
+ /** Retry configuration — same shape as {@link ReactiveSinkRetryOptions}. */
632
+ retry?: Parameters<typeof reactiveSink<T>>[1]["retry"];
633
+ onTransportError?: (err: SinkTransportError) => void;
634
+ };
635
+ /**
636
+ * HTTP sink — forwards upstream `DATA` values as HTTP requests.
637
+ *
638
+ * Per-record mode (default, no batching knobs): one request per DATA.
639
+ * Buffered mode (`batchSize` / `flushIntervalMs`): one request per chunk,
640
+ * body is JSON-array or NDJSON depending on `batchFormat`.
641
+ *
642
+ * @param source - Upstream node.
643
+ * @param url - Request URL.
644
+ * @param opts - Serialization, batching, retry options.
645
+ * @returns {@link ReactiveSinkHandle}.
646
+ *
647
+ * @category extra
648
+ */
649
+ declare function toHTTP<T>(source: Node<T>, url: string, opts?: ToHTTPOptions<T>): ReactiveSinkHandle<T>;
650
+ /** Options for {@link fromHTTPStream}. */
651
+ type FromHTTPStreamOptions = ExtraOpts & {
652
+ method?: string;
653
+ headers?: Record<string, string>;
654
+ body?: unknown;
655
+ signal?: AbortSignal;
656
+ };
657
+ /**
658
+ * Streaming HTTP source — emits each chunk from the response body as a
659
+ * `Uint8Array` `DATA`. `COMPLETE` when the stream ends; `ERROR` on non-ok
660
+ * response or fetch failure.
661
+ *
662
+ * Useful for ingesting server-push APIs (LLM streaming, SSE endpoints — pair
663
+ * with {@link fromSSE}, NDJSON endpoints — pair with {@link fromNDJSON}).
664
+ *
665
+ * @category extra
666
+ */
667
+ declare function fromHTTPStream(url: string, opts?: FromHTTPStreamOptions): Node<Uint8Array>;
668
+ /** Options for {@link fromHTTPPoll}. */
669
+ type FromHTTPPollOptions = FromHTTPOptions & {
670
+ /** Poll interval in milliseconds. Default: `5000`. */
671
+ intervalMs?: number;
672
+ };
673
+ /**
674
+ * Repeatedly-fetching HTTP source — a reactive composition of
675
+ * {@link fromTimer} + {@link switchMap} + {@link fromHTTP} that fetches on an
676
+ * interval and emits the latest response. Previous in-flight fetches are
677
+ * cancelled when a new tick arrives (switch semantics).
678
+ *
679
+ * @example
680
+ * ```ts
681
+ * import { fromHTTPPoll } from "@graphrefly/graphrefly-ts";
682
+ * const health$ = fromHTTPPoll<{ ok: boolean }>("https://example.com/health", { intervalMs: 10_000 });
683
+ * ```
684
+ *
685
+ * @category extra
686
+ */
687
+ declare function fromHTTPPoll<T = unknown>(url: string, opts?: FromHTTPPollOptions): Node<T>;
688
+
689
+ /**
690
+ * Kafka IO — `fromKafka` (KafkaJS-compatible consumer source) and
691
+ * `toKafka` (producer sink). Compatible with Pulsar via KoP (Kafka-on-Pulsar).
692
+ */
693
+
694
+ /** Duck-typed Kafka consumer (compatible with kafkajs, confluent-kafka, Pulsar KoP). */
695
+ type KafkaConsumerLike = {
696
+ subscribe(opts: {
697
+ topic: string;
698
+ fromBeginning?: boolean;
699
+ }): Promise<void>;
700
+ run(opts: {
701
+ eachMessage: (payload: {
702
+ topic: string;
703
+ partition: number;
704
+ message: {
705
+ key: Buffer | null;
706
+ value: Buffer | null;
707
+ headers?: Record<string, Buffer | string | undefined>;
708
+ offset: string;
709
+ timestamp: string;
710
+ };
711
+ }) => Promise<void>;
712
+ }): Promise<void>;
713
+ disconnect(): Promise<void>;
714
+ };
715
+ /** Duck-typed Kafka producer. */
716
+ type KafkaProducerLike = {
717
+ send(record: {
718
+ topic: string;
719
+ messages: Array<{
720
+ key?: string | Buffer | null;
721
+ value: string | Buffer | null;
722
+ headers?: Record<string, string | Buffer>;
723
+ }>;
724
+ }): Promise<void>;
725
+ disconnect(): Promise<void>;
726
+ };
727
+ /** Structured Kafka message. */
728
+ type KafkaMessage<T = unknown> = {
729
+ topic: string;
730
+ partition: number;
731
+ key: string | null;
732
+ value: T;
733
+ headers: Record<string, string>;
734
+ offset: string;
735
+ timestamp: string;
736
+ timestampNs: number;
737
+ };
738
+ /** Options for {@link fromKafka}. */
739
+ type FromKafkaOptions = ExtraOpts & {
740
+ /** Start from beginning of topic. Default: `false`. */
741
+ fromBeginning?: boolean;
742
+ /** Deserialize message value. Default: `JSON.parse(buffer.toString())`. */
743
+ deserialize?: (value: Buffer | null) => unknown;
744
+ };
745
+ /**
746
+ * Kafka consumer as a reactive source.
747
+ *
748
+ * Wraps a KafkaJS-compatible consumer. Each message becomes a `DATA` emission.
749
+ * Compatible with Pulsar via KoP (Kafka-on-Pulsar).
750
+ *
751
+ * @param consumer - KafkaJS-compatible consumer instance (caller owns connect/disconnect lifecycle).
752
+ * @param topic - Topic to consume from.
753
+ * @param opts - Deserialization and source options.
754
+ * @returns `Node<KafkaMessage<T>>` — one `DATA` per Kafka message.
755
+ *
756
+ * @example
757
+ * ```ts
758
+ * import { Kafka } from "kafkajs";
759
+ * import { fromKafka } from "@graphrefly/graphrefly-ts";
760
+ *
761
+ * const kafka = new Kafka({ brokers: ["localhost:9092"] });
762
+ * const consumer = kafka.consumer({ groupId: "my-group" });
763
+ * await consumer.connect();
764
+ *
765
+ * const events$ = fromKafka(consumer, "events", { deserialize: (buf) => JSON.parse(buf!.toString()) });
766
+ * ```
767
+ *
768
+ * @category extra
769
+ */
770
+ declare function fromKafka<T = unknown>(consumer: KafkaConsumerLike, topic: string, opts?: FromKafkaOptions): Node<KafkaMessage<T>>;
771
+ /** Options for {@link toKafka}. */
772
+ type ToKafkaOptions<T> = ExtraOpts & {
773
+ /** Serialize value for Kafka. Default: `JSON.stringify`. */
774
+ serialize?: (value: T) => string | Buffer;
775
+ /** Extract message key from value. Default: `null` (no key). */
776
+ keyExtractor?: (value: T) => string | null;
777
+ /** Called on serialization or send failures. */
778
+ onTransportError?: (err: SinkTransportError) => void;
779
+ };
780
+ /**
781
+ * Kafka producer sink — forwards upstream `DATA` to a Kafka topic.
782
+ *
783
+ * @param source - Upstream node to forward.
784
+ * @param kafkaProducer - KafkaJS-compatible producer instance.
785
+ * @param topic - Target topic.
786
+ * @param opts - Serialization and key extraction options.
787
+ * @returns Unsubscribe function.
788
+ *
789
+ * @category extra
790
+ */
791
+ declare function toKafka<T>(source: Node<T>, kafkaProducer: KafkaProducerLike, topic: string, opts?: ToKafkaOptions<T>): ReactiveSinkHandle<T>;
792
+
793
+ /**
794
+ * Kysely adapter (5.2b) — `fromKysely` runs `query.execute()` and emits one
795
+ * `DATA` containing the full mapped row array, then `COMPLETE`.
796
+ */
797
+
798
+ /**
799
+ * Duck-typed Kysely query builder result.
800
+ *
801
+ * Kysely query builders expose `.execute()` which returns `Promise<T[]>`.
802
+ * This interface captures that contract without depending on `kysely`.
803
+ */
804
+ type KyselyQueryLike<T = unknown> = {
805
+ execute(): Promise<T[]>;
806
+ };
807
+ /** Options for {@link fromKysely}. */
808
+ type FromKyselyOptions<T, U = T> = ExtraOpts & {
809
+ /** Map each row to the desired shape. Default: identity cast. */
810
+ mapRow?: (row: T) => U;
811
+ };
812
+ /**
813
+ * One-shot Kysely query as a reactive source.
814
+ *
815
+ * Calls `query.execute()`, emits one `DATA` per result row, then `COMPLETE`.
816
+ * Compose with `switchMap` + `fromTimer` for periodic re-query.
817
+ *
818
+ * @param query - Kysely query builder (e.g. `db.selectFrom("users").selectAll()`).
819
+ * @param opts - Row mapper and node options.
820
+ * @returns `Node<U>` — one `DATA` per row, then `COMPLETE`.
821
+ *
822
+ * @example
823
+ * ```ts
824
+ * import { Kysely, PostgresDialect } from "kysely";
825
+ * import { fromKysely } from "@graphrefly/graphrefly-ts";
826
+ *
827
+ * const db = new Kysely<DB>({ dialect: new PostgresDialect({ pool }) });
828
+ * const rows$ = fromKysely(db.selectFrom("users").selectAll().where("active", "=", true));
829
+ * ```
830
+ *
831
+ * @category extra
832
+ */
833
+ declare function fromKysely<T = unknown, U = T>(query: KyselyQueryLike<T>, opts?: FromKyselyOptions<T, U>): Node<U[]>;
834
+
835
+ /**
836
+ * MCP (Model Context Protocol) IO — `fromMCP` wraps an MCP client's
837
+ * notification surface as a reactive source via `externalProducer`.
838
+ */
839
+
840
+ /**
841
+ * Duck-typed MCP (Model Context Protocol) client — only the notification
842
+ * registration surface is required so callers are not coupled to a specific SDK.
843
+ */
844
+ type MCPClientLike = {
845
+ setNotificationHandler(method: string, handler: (notification: unknown) => void): void;
846
+ };
847
+ /** Options for {@link fromMCP}. */
848
+ type FromMCPOptions = ExtraOpts & {
849
+ /** MCP notification method to subscribe to. Default `"notifications/message"`. */
850
+ method?: string;
851
+ onDisconnect?: (cb: (err?: unknown) => void) => void;
852
+ };
853
+ /**
854
+ * Wraps an MCP client's server-push notifications as a reactive source.
855
+ *
856
+ * @category extra
857
+ */
858
+ declare function fromMCP<T = unknown>(client: MCPClientLike, opts?: FromMCPOptions): Node<T>;
859
+
860
+ /**
861
+ * NATS IO — `fromNATS` (subject-subscription consumer source) and `toNATS`
862
+ * (publish sink). Compatible with `nats.js`-style clients.
863
+ */
864
+
865
+ /** Duck-typed NATS subscription (compatible with nats.js). */
866
+ type NATSSubscriptionLike = AsyncIterable<{
867
+ subject: string;
868
+ data: Uint8Array;
869
+ headers?: {
870
+ get(key: string): string;
871
+ keys(): string[];
872
+ };
873
+ reply?: string;
874
+ sid: number;
875
+ }>;
876
+ /** Duck-typed NATS client (compatible with nats.js). */
877
+ type NATSClientLike = {
878
+ subscribe(subject: string, opts?: {
879
+ queue?: string;
880
+ }): NATSSubscriptionLike;
881
+ publish(subject: string, data?: Uint8Array, opts?: {
882
+ headers?: unknown;
883
+ reply?: string;
884
+ }): void;
885
+ drain(): Promise<void>;
886
+ };
887
+ /** Structured NATS message. */
888
+ type NATSMessage<T = unknown> = {
889
+ subject: string;
890
+ data: T;
891
+ headers: Record<string, string>;
892
+ reply: string | undefined;
893
+ sid: number;
894
+ timestampNs: number;
895
+ };
896
+ /** Options for {@link fromNATS}. */
897
+ type FromNATSOptions = ExtraOpts & {
898
+ /** Queue group name for load balancing. */
899
+ queue?: string;
900
+ /** Deserialize message data. Default: `JSON.parse(textDecoder.decode(data))`. */
901
+ deserialize?: (data: Uint8Array) => unknown;
902
+ };
903
+ /**
904
+ * NATS consumer as a reactive source.
905
+ *
906
+ * Wraps a `nats.js`-compatible client subscription. Each message becomes a `DATA` emission.
907
+ *
908
+ * @param client - NATS client instance (caller owns connect/drain lifecycle).
909
+ * @param subject - Subject to subscribe to (supports wildcards).
910
+ * @param opts - Queue group, deserialization, and source options.
911
+ * @returns `Node<NATSMessage<T>>` — one `DATA` per NATS message.
912
+ *
913
+ * @remarks
914
+ * Teardown sets an internal flag but cannot break the async iterator. The loop
915
+ * exits on the next message or when the subscription is drained/unsubscribed
916
+ * externally. Call `client.drain()` after unsubscribing for prompt cleanup.
917
+ *
918
+ * @example
919
+ * ```ts
920
+ * import { connect } from "nats";
921
+ * import { fromNATS } from "@graphrefly/graphrefly-ts";
922
+ *
923
+ * const nc = await connect({ servers: "localhost:4222" });
924
+ * const events$ = fromNATS(nc, "events.>");
925
+ * ```
926
+ *
927
+ * @category extra
928
+ */
929
+ declare function fromNATS<T = unknown>(client: NATSClientLike, subject: string, opts?: FromNATSOptions): Node<NATSMessage<T>>;
930
+ /** Options for {@link toNATS}. */
931
+ type ToNATSOptions<T> = ExtraOpts & {
932
+ /** Serialize value for NATS. Default: `JSON.stringify` → Uint8Array. */
933
+ serialize?: (value: T) => Uint8Array;
934
+ /** Called on serialization failures. */
935
+ onTransportError?: (err: SinkTransportError) => void;
936
+ };
937
+ /**
938
+ * NATS publisher sink — forwards upstream `DATA` to a NATS subject.
939
+ *
940
+ * @param source - Upstream node to forward.
941
+ * @param client - NATS client instance.
942
+ * @param subject - Target subject.
943
+ * @param opts - Serialization options.
944
+ * @returns Unsubscribe function.
945
+ *
946
+ * @category extra
947
+ */
948
+ declare function toNATS<T>(source: Node<T>, client: NATSClientLike, subject: string, opts?: ToNATSOptions<T>): ReactiveSinkHandle<T>;
949
+
950
+ /**
951
+ * NDJSON (newline-delimited JSON) IO — `fromNDJSON` reads an
952
+ * `AsyncIterable<string>` of NDJSON chunks (one node per line) and
953
+ * `ndjsonRows` is the stateful operator variant for existing reactive
954
+ * `Node<string>` upstreams.
955
+ */
956
+
957
+ /**
958
+ * Stateful NDJSON parser operator — takes a `Node<string>` of raw text chunks
959
+ * and emits one `DATA` per parsed JSON object. Buffers partial lines across
960
+ * chunks.
961
+ *
962
+ * @category extra
963
+ */
964
+ declare function ndjsonRows<T = unknown>(source: Node<string>, opts?: ExtraOpts): Node<T>;
965
+ /** Options for {@link fromNDJSON}. */
966
+ type FromNDJSONOptions = ExtraOpts & {};
967
+ /**
968
+ * Newline-delimited JSON stream ingest for batch replay.
969
+ *
970
+ * Reads an async iterable of text chunks, splits by newline, parses each line
971
+ * as JSON, and emits one `DATA` per parsed object. `COMPLETE` after stream ends.
972
+ *
973
+ * @param source - Async iterable of NDJSON text chunks.
974
+ * @param opts - Optional producer options.
975
+ * @returns `Node<T>` — one `DATA` per JSON line.
976
+ *
977
+ * @example
978
+ * ```ts
979
+ * import { createReadStream } from "node:fs";
980
+ * import { fromNDJSON } from "@graphrefly/graphrefly-ts";
981
+ *
982
+ * const logs$ = fromNDJSON(createReadStream("logs.ndjson", "utf-8"));
983
+ * ```
984
+ *
985
+ * @category extra
986
+ */
987
+ declare function fromNDJSON<T = unknown>(source: AsyncIterable<string>, opts?: FromNDJSONOptions): Node<T>;
988
+
989
+ /**
990
+ * OpenTelemetry (OTLP/HTTP) IO — `fromOTel` exposes traces/metrics/logs as
991
+ * three reactive nodes via `externalBundle`. The caller owns the HTTP server
992
+ * and wires the registrar callback to OTLP routes.
993
+ */
994
+
995
+ /** Structured OTel span. */
996
+ type OTelSpan = {
997
+ traceId: string;
998
+ spanId: string;
999
+ operationName: string;
1000
+ serviceName: string;
1001
+ startTimeNs: number;
1002
+ endTimeNs: number;
1003
+ status: "OK" | "ERROR" | "UNSET";
1004
+ attributes: Record<string, unknown>;
1005
+ events: Array<{
1006
+ name: string;
1007
+ timestampNs: number;
1008
+ attributes?: Record<string, unknown>;
1009
+ }>;
1010
+ };
1011
+ /** Structured OTel metric data point. */
1012
+ type OTelMetric = {
1013
+ name: string;
1014
+ description?: string;
1015
+ unit?: string;
1016
+ type: "gauge" | "sum" | "histogram" | "summary";
1017
+ value: number;
1018
+ attributes: Record<string, unknown>;
1019
+ timestampNs: number;
1020
+ };
1021
+ /** Structured OTel log record. */
1022
+ type OTelLog = {
1023
+ timestampNs: number;
1024
+ severityNumber?: number;
1025
+ severityText?: string;
1026
+ body: unknown;
1027
+ attributes: Record<string, unknown>;
1028
+ traceId?: string;
1029
+ spanId?: string;
1030
+ };
1031
+ /** Registration callback for the OTLP/HTTP receiver. */
1032
+ type OTelRegister = (handlers: {
1033
+ onTraces: (spans: OTelSpan[]) => void;
1034
+ onMetrics: (metrics: OTelMetric[]) => void;
1035
+ onLogs: (logs: OTelLog[]) => void;
1036
+ onError: (err: unknown) => void;
1037
+ }) => (() => void) | undefined;
1038
+ /** Options for {@link fromOTel}. */
1039
+ type FromOTelOptions = ExtraOpts & {};
1040
+ /** Bundle returned by {@link fromOTel}. */
1041
+ type OTelBundle = {
1042
+ traces: Node<OTelSpan>;
1043
+ metrics: Node<OTelMetric>;
1044
+ logs: Node<OTelLog>;
1045
+ /** Unconditional teardown — calls the registrar's cleanup and fires COMPLETE on every channel. */
1046
+ dispose(): void;
1047
+ };
1048
+ /**
1049
+ * OTLP/HTTP receiver — accepts traces, metrics, and logs as separate reactive nodes.
1050
+ *
1051
+ * The caller owns the HTTP server. `fromOTel` receives a `register` callback that
1052
+ * wires OTLP POST endpoints to the three signal handlers. Each signal type gets
1053
+ * its own `Node` so downstream can subscribe selectively.
1054
+ *
1055
+ * @param register - Wires OTLP HTTP routes to `onTraces`, `onMetrics`, `onLogs` handlers.
1056
+ * @param opts - Optional producer options.
1057
+ * @returns {@link OTelBundle} — `{ traces, metrics, logs }` nodes.
1058
+ *
1059
+ * @example
1060
+ * ```ts
1061
+ * import express from "express";
1062
+ * import { fromOTel } from "@graphrefly/graphrefly-ts";
1063
+ *
1064
+ * const app = express();
1065
+ * app.use(express.json());
1066
+ *
1067
+ * const otel = fromOTel(({ onTraces, onMetrics, onLogs }) => {
1068
+ * app.post("/v1/traces", (req, res) => { onTraces(req.body.resourceSpans ?? []); res.sendStatus(200); });
1069
+ * app.post("/v1/metrics", (req, res) => { onMetrics(req.body.resourceMetrics ?? []); res.sendStatus(200); });
1070
+ * app.post("/v1/logs", (req, res) => { onLogs(req.body.resourceLogs ?? []); res.sendStatus(200); });
1071
+ * return () => {};
1072
+ * });
1073
+ * ```
1074
+ *
1075
+ * @category extra
1076
+ */
1077
+ declare function fromOTel(register: OTelRegister, opts?: FromOTelOptions): OTelBundle;
1078
+
1079
+ /**
1080
+ * Prisma adapter (5.2b) — `fromPrisma` runs `model.findMany(args)` and emits
1081
+ * one `DATA` containing the full mapped row array, then `COMPLETE`.
1082
+ */
1083
+
1084
+ /**
1085
+ * Duck-typed Prisma model delegate.
1086
+ *
1087
+ * Compatible with any Prisma model's `findMany` method (e.g. `prisma.user`).
1088
+ * The consumer passes the model delegate directly — no dependency on `@prisma/client`.
1089
+ */
1090
+ type PrismaModelLike<T = unknown> = {
1091
+ findMany(args?: unknown): Promise<T[]>;
1092
+ };
1093
+ /** Options for {@link fromPrisma}. */
1094
+ type FromPrismaOptions<T, U = T> = ExtraOpts & {
1095
+ /** Prisma `findMany` args (where, orderBy, select, include, take, skip, etc.). */
1096
+ args?: unknown;
1097
+ /** Map each row to the desired shape. Default: identity cast. */
1098
+ mapRow?: (row: T) => U;
1099
+ };
1100
+ /**
1101
+ * One-shot Prisma query as a reactive source.
1102
+ *
1103
+ * Calls `model.findMany(args)`, emits one `DATA` per result row, then `COMPLETE`.
1104
+ * Compose with `switchMap` + `fromTimer` for periodic re-query.
1105
+ *
1106
+ * @param model - Prisma model delegate (e.g. `prisma.user`).
1107
+ * @param opts - `findMany` args, row mapper, and node options.
1108
+ * @returns `Node<U>` — one `DATA` per row, then `COMPLETE`.
1109
+ *
1110
+ * @example
1111
+ * ```ts
1112
+ * import { PrismaClient } from "@prisma/client";
1113
+ * import { fromPrisma } from "@graphrefly/graphrefly-ts";
1114
+ *
1115
+ * const prisma = new PrismaClient();
1116
+ * const activeUsers = fromPrisma(prisma.user, {
1117
+ * args: { where: { active: true } },
1118
+ * });
1119
+ * ```
1120
+ *
1121
+ * @category extra
1122
+ */
1123
+ declare function fromPrisma<T = unknown, U = T>(model: PrismaModelLike<T>, opts?: FromPrismaOptions<T, U>): Node<U[]>;
1124
+
1125
+ /**
1126
+ * Prometheus scrape IO — `fromPrometheus` polls a `/metrics` endpoint via
1127
+ * `fromTimer + switchMap` (reactive timer, not bare `setInterval`) and emits
1128
+ * one `DATA` per parsed metric per scrape. `parsePrometheusText` exposes the
1129
+ * exposition-format parser as a pure helper.
1130
+ */
1131
+
1132
+ /** Parsed Prometheus metric. */
1133
+ type PrometheusMetric = {
1134
+ name: string;
1135
+ labels: Record<string, string>;
1136
+ value: number;
1137
+ timestampMs?: number;
1138
+ type?: "counter" | "gauge" | "histogram" | "summary" | "untyped";
1139
+ help?: string;
1140
+ timestampNs: number;
1141
+ };
1142
+ /** Options for {@link fromPrometheus}. */
1143
+ type FromPrometheusOptions = AsyncSourceOpts & {
1144
+ /** Scrape interval in nanoseconds. Default `15 * NS_PER_SEC` (15s). */
1145
+ intervalNs?: number;
1146
+ /** Request headers for the scrape. */
1147
+ headers?: Record<string, string>;
1148
+ /** Request timeout in nanoseconds. Default `10 * NS_PER_SEC` (10s). */
1149
+ timeoutNs?: number;
1150
+ /**
1151
+ * Maximum consecutive scrape errors before terminating the source. Prevents
1152
+ * error storms when the endpoint is down. Default: `1` (terminate on first error — preserves pre-switchMap back-compat). Raise it (or set `Infinity`)
1153
+ * to keep retrying indefinitely.
1154
+ */
1155
+ maxConsecutiveErrors?: number;
1156
+ };
1157
+ /**
1158
+ * Scrapes a Prometheus `/metrics` endpoint on a reactive timer interval.
1159
+ *
1160
+ * Each scrape parses the exposition format and emits one `DATA` per metric line.
1161
+ * Uses `fromTimer` semantics internally (reactive timer source, not polling).
1162
+ *
1163
+ * @param endpoint - URL of the Prometheus metrics endpoint.
1164
+ * @param opts - Scrape interval, headers, timeout.
1165
+ * @returns `Node<PrometheusMetric>` — one `DATA` per metric per scrape.
1166
+ *
1167
+ * @example
1168
+ * ```ts
1169
+ * import { fromPrometheus } from "@graphrefly/graphrefly-ts";
1170
+ *
1171
+ * const prom$ = fromPrometheus("http://localhost:9090/metrics", { intervalNs: 30 * NS_PER_SEC });
1172
+ * ```
1173
+ *
1174
+ * @category extra
1175
+ */
1176
+ declare function fromPrometheus(endpoint: string, opts?: FromPrometheusOptions): Node<PrometheusMetric>;
1177
+ /**
1178
+ * Parses Prometheus exposition format text into structured metrics.
1179
+ *
1180
+ * @category extra
1181
+ */
1182
+ declare function parsePrometheusText(text: string): PrometheusMetric[];
1183
+
1184
+ /**
1185
+ * Apache Pulsar IO — `fromPulsar` (native-client consumer source with optional
1186
+ * manual ack via {@link AckableMessage} envelopes) and `toPulsar` (producer
1187
+ * sink). For Kafka-on-Pulsar (KoP), use the Kafka adapter instead.
1188
+ */
1189
+
1190
+ /** Duck-typed Pulsar consumer (compatible with pulsar-client). */
1191
+ type PulsarConsumerLike = {
1192
+ receive(): Promise<{
1193
+ getData(): Buffer;
1194
+ getMessageId(): {
1195
+ toString(): string;
1196
+ };
1197
+ getPartitionKey(): string;
1198
+ getProperties(): Record<string, string>;
1199
+ getPublishTimestamp(): number;
1200
+ getEventTimestamp(): number;
1201
+ getTopicName(): string;
1202
+ }>;
1203
+ acknowledge(msg: unknown): Promise<void>;
1204
+ close(): Promise<void>;
1205
+ };
1206
+ /** Duck-typed Pulsar producer. */
1207
+ type PulsarProducerLike = {
1208
+ send(msg: {
1209
+ data: Buffer;
1210
+ partitionKey?: string;
1211
+ properties?: Record<string, string>;
1212
+ }): Promise<void>;
1213
+ close(): Promise<void>;
1214
+ };
1215
+ /** Structured Pulsar message. */
1216
+ type PulsarMessage<T = unknown> = {
1217
+ topic: string;
1218
+ messageId: string;
1219
+ key: string;
1220
+ value: T;
1221
+ properties: Record<string, string>;
1222
+ publishTime: number;
1223
+ eventTime: number;
1224
+ timestampNs: number;
1225
+ };
1226
+ /** Options for {@link fromPulsar}. */
1227
+ type FromPulsarOptions = ExtraOpts & {
1228
+ /** Deserialize message data. Default: `JSON.parse(buffer.toString())`. */
1229
+ deserialize?: (data: Buffer) => unknown;
1230
+ /** Acknowledge messages automatically. Default: `true`. */
1231
+ autoAck?: boolean;
1232
+ /**
1233
+ * Routes ack/nack transport failures to the caller. Covers:
1234
+ * - `autoAck: true` — post-emit `acknowledge()` promise rejections.
1235
+ * - `autoAck: false` — envelope `ack()` / `nack()` promise rejections.
1236
+ * Default: swallow (SDK handles redelivery on its own).
1237
+ */
1238
+ onAckError?: (err: Error) => void;
1239
+ };
1240
+ /**
1241
+ * Apache Pulsar consumer as a reactive source (native client).
1242
+ *
1243
+ * Wraps a `pulsar-client`-compatible consumer. Each message becomes a `DATA` emission.
1244
+ * For Kafka-on-Pulsar (KoP), use {@link fromKafka} instead.
1245
+ *
1246
+ * @param consumer - Pulsar consumer instance (caller owns create/close lifecycle).
1247
+ * @param opts - Deserialization and source options.
1248
+ * @returns `Node<PulsarMessage<T>>` — one `DATA` per Pulsar message.
1249
+ *
1250
+ * @remarks
1251
+ * Teardown sets an internal flag but cannot interrupt a pending `consumer.receive()`.
1252
+ * The loop exits on the next message or when the consumer is closed externally.
1253
+ * Callers should call `consumer.close()` after unsubscribing for prompt cleanup.
1254
+ *
1255
+ * @example
1256
+ * ```ts
1257
+ * import Pulsar from "pulsar-client";
1258
+ * import { fromPulsar } from "@graphrefly/graphrefly-ts";
1259
+ *
1260
+ * const client = new Pulsar.Client({ serviceUrl: "pulsar://localhost:6650" });
1261
+ * const consumer = await client.subscribe({ topic: "events", subscription: "my-sub" });
1262
+ * const events$ = fromPulsar(consumer);
1263
+ * ```
1264
+ *
1265
+ * @category extra
1266
+ */
1267
+ declare function fromPulsar<T = unknown>(consumer: PulsarConsumerLike, opts?: FromPulsarOptions & {
1268
+ autoAck?: true;
1269
+ }): Node<PulsarMessage<T>>;
1270
+ declare function fromPulsar<T = unknown>(consumer: PulsarConsumerLike, opts: FromPulsarOptions & {
1271
+ autoAck: false;
1272
+ }): Node<AckableMessage<PulsarMessage<T>>>;
1273
+ /** Options for {@link toPulsar}. */
1274
+ type ToPulsarOptions<T> = ExtraOpts & {
1275
+ /** Serialize value for Pulsar. Default: `JSON.stringify` → Buffer. */
1276
+ serialize?: (value: T) => Buffer;
1277
+ /** Extract partition key from value. Default: none. */
1278
+ keyExtractor?: (value: T) => string | undefined;
1279
+ /** Extract properties from value. */
1280
+ propertiesExtractor?: (value: T) => Record<string, string> | undefined;
1281
+ /** Called on serialization or send failures. */
1282
+ onTransportError?: (err: SinkTransportError) => void;
1283
+ };
1284
+ /**
1285
+ * Pulsar producer sink — forwards upstream `DATA` to a Pulsar topic.
1286
+ *
1287
+ * @param source - Upstream node to forward.
1288
+ * @param pulsarProducer - Pulsar producer instance (caller owns lifecycle).
1289
+ * @param opts - Serialization options.
1290
+ * @returns Unsubscribe function.
1291
+ *
1292
+ * @category extra
1293
+ */
1294
+ declare function toPulsar<T>(source: Node<T>, pulsarProducer: PulsarProducerLike, opts?: ToPulsarOptions<T>): ReactiveSinkHandle<T>;
1295
+
1296
+ /**
1297
+ * RabbitMQ IO — `fromRabbitMQ` (queue-consumer source with optional manual
1298
+ * ack via {@link AckableMessage} envelopes) and `toRabbitMQ` (publisher
1299
+ * sink). Compatible with `amqplib`-style channels.
1300
+ */
1301
+
1302
+ /** Duck-typed RabbitMQ channel (compatible with amqplib). */
1303
+ type RabbitMQChannelLike = {
1304
+ consume(queue: string, onMessage: (msg: {
1305
+ content: Buffer;
1306
+ fields: {
1307
+ routingKey: string;
1308
+ exchange: string;
1309
+ deliveryTag: number;
1310
+ redelivered: boolean;
1311
+ };
1312
+ properties: Record<string, unknown>;
1313
+ } | null) => void, opts?: {
1314
+ noAck?: boolean;
1315
+ }): Promise<{
1316
+ consumerTag: string;
1317
+ }>;
1318
+ cancel(consumerTag: string): Promise<void>;
1319
+ ack(msg: unknown): void;
1320
+ publish(exchange: string, routingKey: string, content: Buffer, opts?: Record<string, unknown>): boolean;
1321
+ sendToQueue(queue: string, content: Buffer, opts?: Record<string, unknown>): boolean;
1322
+ };
1323
+ /** Structured RabbitMQ message. */
1324
+ type RabbitMQMessage<T = unknown> = {
1325
+ queue: string;
1326
+ routingKey: string;
1327
+ exchange: string;
1328
+ content: T;
1329
+ properties: Record<string, unknown>;
1330
+ deliveryTag: number;
1331
+ redelivered: boolean;
1332
+ timestampNs: number;
1333
+ };
1334
+ /** Options for {@link fromRabbitMQ}. */
1335
+ type FromRabbitMQOptions = ExtraOpts & {
1336
+ /** Deserialize message content. Default: `JSON.parse(buffer.toString())`. */
1337
+ deserialize?: (content: Buffer) => unknown;
1338
+ /** Auto-acknowledge messages. Default: `true`. */
1339
+ autoAck?: boolean;
1340
+ /**
1341
+ * Routes envelope ack/nack transport failures (including "SDK exposes no
1342
+ * `nack` method") to the caller. Default: swallow.
1343
+ */
1344
+ onAckError?: (err: Error) => void;
1345
+ };
1346
+ /**
1347
+ * RabbitMQ consumer as a reactive source.
1348
+ *
1349
+ * Wraps an `amqplib`-compatible channel. Each message becomes a `DATA` emission.
1350
+ *
1351
+ * @param channel - AMQP channel instance (caller owns connection/channel lifecycle).
1352
+ * @param queue - Queue to consume from.
1353
+ * @param opts - Deserialization and acknowledgment options.
1354
+ * @returns `Node<RabbitMQMessage<T>>` — one `DATA` per RabbitMQ message.
1355
+ *
1356
+ * @remarks
1357
+ * When `autoAck` is `false`, the adapter opens the channel with `noAck: false`
1358
+ * (broker requires acks) but does not call `channel.ack()`. The caller must ack
1359
+ * messages externally using the `deliveryTag` from the emitted {@link RabbitMQMessage}:
1360
+ * ```ts
1361
+ * channel.ack({ fields: { deliveryTag: msg.deliveryTag } } as any);
1362
+ * ```
1363
+ *
1364
+ * @example
1365
+ * ```ts
1366
+ * import amqplib from "amqplib";
1367
+ * import { fromRabbitMQ } from "@graphrefly/graphrefly-ts";
1368
+ *
1369
+ * const conn = await amqplib.connect("amqp://localhost");
1370
+ * const ch = await conn.createChannel();
1371
+ * await ch.assertQueue("events");
1372
+ * const events$ = fromRabbitMQ(ch, "events");
1373
+ * ```
1374
+ *
1375
+ * @category extra
1376
+ */
1377
+ declare function fromRabbitMQ<T = unknown>(channel: RabbitMQChannelLike, queue: string, opts?: FromRabbitMQOptions & {
1378
+ autoAck?: true;
1379
+ }): Node<RabbitMQMessage<T>>;
1380
+ declare function fromRabbitMQ<T = unknown>(channel: RabbitMQChannelLike, queue: string, opts: FromRabbitMQOptions & {
1381
+ autoAck: false;
1382
+ }): Node<AckableMessage<RabbitMQMessage<T>>>;
1383
+ /** Options for {@link toRabbitMQ}. */
1384
+ type ToRabbitMQOptions<T> = ExtraOpts & {
1385
+ /** Serialize value for RabbitMQ. Default: `Buffer.from(JSON.stringify(value))`. */
1386
+ serialize?: (value: T) => Buffer;
1387
+ /** Extract routing key from value. Default: `""`. */
1388
+ routingKeyExtractor?: (value: T) => string;
1389
+ /** Called on serialization or send failures. */
1390
+ onTransportError?: (err: SinkTransportError) => void;
1391
+ };
1392
+ /**
1393
+ * RabbitMQ producer sink — forwards upstream `DATA` to a RabbitMQ exchange/queue.
1394
+ *
1395
+ * @param source - Upstream node to forward.
1396
+ * @param channel - AMQP channel instance.
1397
+ * @param exchange - Target exchange (use `""` for default exchange + queue routing).
1398
+ * @param opts - Serialization and routing options.
1399
+ * @returns Unsubscribe function.
1400
+ *
1401
+ * @category extra
1402
+ */
1403
+ declare function toRabbitMQ<T>(source: Node<T>, channel: RabbitMQChannelLike, exchange: string, opts?: ToRabbitMQOptions<T>): ReactiveSinkHandle<T>;
1404
+
1405
+ /**
1406
+ * Redis Streams IO — `fromRedisStream` (XREAD-BLOCK consumer source) and
1407
+ * `toRedisStream` (XADD producer sink). Caller owns the Redis client
1408
+ * lifecycle.
1409
+ */
1410
+
1411
+ /** Duck-typed Redis client (compatible with ioredis, redis). */
1412
+ type RedisClientLike = {
1413
+ xadd(key: string, id: string, ...fieldsAndValues: string[]): Promise<string>;
1414
+ xread(...args: Array<string | number>): Promise<Array<[string, Array<[string, string[]]>]> | null>;
1415
+ disconnect(): void;
1416
+ };
1417
+ /** Structured Redis Stream entry. */
1418
+ type RedisStreamEntry<T = unknown> = {
1419
+ id: string;
1420
+ key: string;
1421
+ data: T;
1422
+ timestampNs: number;
1423
+ };
1424
+ /** Options for {@link fromRedisStream}. */
1425
+ type FromRedisStreamOptions = ExtraOpts & {
1426
+ /** Block timeout in ms for XREAD. Default: `5000`. */
1427
+ blockMs?: number;
1428
+ /** Start ID. Default: `"$"` (new entries only). */
1429
+ startId?: string;
1430
+ /** Parse raw Redis hash fields to structured data. Default: parses `data` field as JSON. */
1431
+ parse?: (fields: string[]) => unknown;
1432
+ };
1433
+ /**
1434
+ * Redis Streams consumer as a reactive source.
1435
+ *
1436
+ * Uses XREAD with BLOCK to reactively consume stream entries.
1437
+ *
1438
+ * @param client - ioredis/redis-compatible client (caller owns connection).
1439
+ * @param key - Redis stream key.
1440
+ * @param opts - Block timeout, start ID, and parsing options.
1441
+ * @returns `Node<RedisStreamEntry<T>>` — one `DATA` per stream entry.
1442
+ *
1443
+ * @remarks
1444
+ * **COMPLETE:** This source never emits `COMPLETE` under normal operation — it
1445
+ * is a long-lived stream consumer that runs until teardown or error, same as
1446
+ * Kafka consumers. If you need a bounded read, wrap with `take()` or
1447
+ * `takeUntil()`.
1448
+ *
1449
+ * **Client lifecycle:** The caller owns the Redis client connection. The adapter
1450
+ * does not call `disconnect()` on teardown — the caller is responsible for
1451
+ * closing the connection (same contract as `fromKafka`).
1452
+ *
1453
+ * @category extra
1454
+ */
1455
+ declare function fromRedisStream<T = unknown>(client: RedisClientLike, key: string, opts?: FromRedisStreamOptions): Node<RedisStreamEntry<T>>;
1456
+ /** Options for {@link toRedisStream}. */
1457
+ type ToRedisStreamOptions<T> = ExtraOpts & {
1458
+ /** Serialize value to Redis hash fields. Default: `["data", JSON.stringify(value)]`. */
1459
+ serialize?: (value: T) => string[];
1460
+ /** Max stream length (MAXLEN ~). Default: no trimming. */
1461
+ maxLen?: number;
1462
+ /** Called on serialization or send failures. */
1463
+ onTransportError?: (err: SinkTransportError) => void;
1464
+ };
1465
+ /**
1466
+ * Redis Streams producer sink — forwards upstream `DATA` to a Redis stream.
1467
+ *
1468
+ * @param source - Upstream node to forward.
1469
+ * @param client - ioredis/redis-compatible client.
1470
+ * @param key - Redis stream key.
1471
+ * @param opts - Serialization options.
1472
+ * @returns Unsubscribe function.
1473
+ *
1474
+ * @category extra
1475
+ */
1476
+ declare function toRedisStream<T>(source: Node<T>, client: RedisClientLike, key: string, opts?: ToRedisStreamOptions<T>): ReactiveSinkHandle<T>;
1477
+
1478
+ /**
1479
+ * SQLite IO (roadmap §5.2b) — `fromSqlite` (one-shot synchronous query),
1480
+ * `fromSqliteCursor` (row-by-row streaming via `iterate()`), and `toSqlite`
1481
+ * (insert sink with optional transactional batching).
1482
+ *
1483
+ * Synchronous boundaries: SQLite drivers are typically synchronous
1484
+ * (`better-sqlite3`, `node:sqlite`), so errors propagate immediately rather
1485
+ * than via promise rejection. The duck-typed `SqliteDbLike.query` matches the
1486
+ * project-wide `query(sql, params)` convention used by Postgres/ClickHouse.
1487
+ */
1488
+
1489
+ /**
1490
+ * Duck-typed synchronous SQLite database.
1491
+ *
1492
+ * Compatible with `better-sqlite3` (`.prepare().all()` / `.prepare().run()`)
1493
+ * and Node.js `node:sqlite` `DatabaseSync`. The user wraps their driver behind
1494
+ * this uniform contract — method name `query` matches the project-wide
1495
+ * convention (`PostgresClientLike.query`, `ClickHouseClientLike.query`).
1496
+ */
1497
+ type SqliteDbLike = {
1498
+ query(sql: string, params?: unknown[]): unknown[];
1499
+ };
1500
+ /** Options for {@link fromSqlite}. */
1501
+ type FromSqliteOptions<T> = ExtraOpts & {
1502
+ /** Map a raw row object to the desired type. Default: identity cast. */
1503
+ mapRow?: (row: unknown) => T;
1504
+ /** Bind parameters for the query. */
1505
+ params?: unknown[];
1506
+ };
1507
+ /**
1508
+ * One-shot SQLite query as a reactive source.
1509
+ *
1510
+ * Executes `query` synchronously via `db.query()`, emits **one `DATA` containing
1511
+ * the full result array**, then `COMPLETE`. Downstream flattens with
1512
+ * `mergeAll` / a custom operator if per-row semantics are required — the
1513
+ * array shape is the simpler default and matches how every SQL driver returns
1514
+ * results natively. Use {@link fromSqliteCursor} for streaming row-by-row.
1515
+ *
1516
+ * @param db - SQLite database (caller owns connection).
1517
+ * @param query - SQL string to execute.
1518
+ * @param opts - Row mapper, params, and node options.
1519
+ * @returns `Node<T[]>` — one `DATA` with the full row array, then `COMPLETE`.
1520
+ *
1521
+ * @example
1522
+ * ```ts
1523
+ * import Database from "better-sqlite3";
1524
+ * import { fromSqlite } from "@graphrefly/graphrefly-ts";
1525
+ *
1526
+ * const raw = new Database("app.db");
1527
+ * const db = { query: (sql, params) => raw.prepare(sql).all(...(params ?? [])) };
1528
+ * const rows$ = fromSqlite(db, "SELECT * FROM users WHERE active = ?", { params: [1] });
1529
+ * ```
1530
+ *
1531
+ * @category extra
1532
+ */
1533
+ declare function fromSqlite<T = unknown>(db: SqliteDbLike, query: string, opts?: FromSqliteOptions<T>): Node<T[]>;
1534
+ /**
1535
+ * Duck-typed iterable-capable SQLite database — `iterate(sql, params)` returns
1536
+ * a synchronous iterator over rows, avoiding the "all-rows-in-memory" cost of
1537
+ * `db.query`. Compatible with `better-sqlite3`'s `.prepare().iterate()`.
1538
+ *
1539
+ * @category extra
1540
+ */
1541
+ type SqliteIterableDbLike = {
1542
+ iterate(sql: string, params?: unknown[]): Iterable<unknown>;
1543
+ };
1544
+ /**
1545
+ * Cursor-streaming SQLite query — emits one `DATA` per row from a synchronous
1546
+ * row iterator, then `COMPLETE`. Use when result sets are too large to
1547
+ * materialize fully into an array.
1548
+ *
1549
+ * @category extra
1550
+ */
1551
+ declare function fromSqliteCursor<T = unknown>(db: SqliteIterableDbLike, query: string, opts?: FromSqliteOptions<T>): Node<T>;
1552
+ /** Options for {@link toSqlite}. */
1553
+ type ToSqliteOptions<T> = ExtraOpts & {
1554
+ /** Build SQL + params for an insert. Default: JSON insert into `(data)` column. */
1555
+ toSQL?: (value: T, table: string) => {
1556
+ sql: string;
1557
+ params: unknown[];
1558
+ };
1559
+ onTransportError?: (err: SinkTransportError) => void;
1560
+ /**
1561
+ * When `true`, buffer DATA values and execute all inserts inside a single
1562
+ * `BEGIN`/`COMMIT` transaction when the batch drains. This avoids per-row
1563
+ * fsync overhead and dramatically reduces event-loop blocking for
1564
+ * high-throughput sources. The first insert error stops the batch and
1565
+ * triggers a `ROLLBACK`; the error is reported via `onTransportError`.
1566
+ */
1567
+ batchInsert?: boolean;
1568
+ /** Auto-flush when buffer reaches this size. Default: `1000`. Only applies when `batchInsert` is `true`. */
1569
+ maxBatchSize?: number;
1570
+ /** Periodic flush interval in ms. `0` = no timer (flush on terminal messages only). Default: `0`. Only applies when `batchInsert` is `true`. */
1571
+ flushIntervalMs?: number;
1572
+ };
1573
+ /**
1574
+ * SQLite sink — inserts each upstream `DATA` value as a row.
1575
+ *
1576
+ * Follows the same pattern as {@link toPostgres} / {@link toMongo}. Since SQLite
1577
+ * is synchronous, errors propagate immediately (no `void promise.catch`).
1578
+ *
1579
+ * @param source - Upstream node.
1580
+ * @param db - SQLite database (caller owns connection).
1581
+ * @param table - Target table name.
1582
+ * @param opts - SQL builder and error options.
1583
+ * @returns Unsubscribe function.
1584
+ *
1585
+ * @example
1586
+ * ```ts
1587
+ * import Database from "better-sqlite3";
1588
+ * import { toSqlite, state } from "@graphrefly/graphrefly-ts";
1589
+ *
1590
+ * const raw = new Database("app.db");
1591
+ * const db = { query: (sql, params) => (raw.prepare(sql).run(...(params ?? [])), []) };
1592
+ * const source = state({ name: "Alice", score: 42 });
1593
+ * const unsub = toSqlite(source, db, "events");
1594
+ * ```
1595
+ *
1596
+ * @category extra
1597
+ */
1598
+ declare function toSqlite<T>(source: Node<T>, db: SqliteDbLike, table: string, opts?: ToSqliteOptions<T>): ReactiveSinkHandle<T>;
1599
+
1600
+ /**
1601
+ * Server-Sent Events IO — `toSSE` / `toSSEBytes` (encode any node into the
1602
+ * `text/event-stream` wire format), `toReadableStream` (web-stream sink),
1603
+ * `parseSSEStream` (async-iterator parser), `fromSSE` (line-delimited parser
1604
+ * source).
1605
+ */
1606
+
1607
+ /** Options for {@link toSSE}. */
1608
+ type ToSSEOptions = {
1609
+ /** Custom payload serializer for non-string payloads. Default: `JSON.stringify` fallback to `String(value)`. */
1610
+ serialize?: (value: unknown) => string;
1611
+ /** Event name for DATA tuples. Default: `"data"`. */
1612
+ dataEvent?: string;
1613
+ /** Event name for ERROR tuples. Default: `"error"`. */
1614
+ errorEvent?: string;
1615
+ /** Event name for COMPLETE tuples. Default: `"complete"`. */
1616
+ completeEvent?: string;
1617
+ /** Emit `event: resolved` when RESOLVED arrives. Default: `false`. */
1618
+ includeResolved?: boolean;
1619
+ /** Emit `event: dirty` when DIRTY arrives. Default: `false`. */
1620
+ includeDirty?: boolean;
1621
+ /** Add SSE comment keepalive frames (`: keepalive`) on an interval. Disabled when unset. */
1622
+ keepAliveMs?: number;
1623
+ /** Optional abort signal to terminate the stream early. */
1624
+ signal?: AbortSignal;
1625
+ /** Maps custom message types to SSE event names. */
1626
+ eventNameResolver?: (type: symbol) => string;
1627
+ };
1628
+ /**
1629
+ * Creates a standard Server-Sent Events stream from node messages.
1630
+ *
1631
+ * @category extra
1632
+ */
1633
+ declare function toSSE<T>(source: Node<T>, opts?: ToSSEOptions): ReadableStream<Uint8Array>;
1634
+ /**
1635
+ * Composable variant of {@link toSSE} — emits encoded SSE frames as
1636
+ * `Uint8Array` through a reactive `Node`. Use this when you want to pipe SSE
1637
+ * bytes through the reactive graph (persist to file, tee to multiple streams,
1638
+ * etc.). Wrap with {@link toReadableStream} to expose a `ReadableStream` for
1639
+ * `new Response(...)` use cases.
1640
+ *
1641
+ * @category extra
1642
+ */
1643
+ declare function toSSEBytes<T>(source: Node<T>, opts?: ToSSEOptions): Node<Uint8Array>;
1644
+ /**
1645
+ * Converts a `Node<Uint8Array>` into a WHATWG `ReadableStream<Uint8Array>`.
1646
+ * Useful for composing with `new Response(...)` / `fetch` bodies.
1647
+ *
1648
+ * @category extra
1649
+ */
1650
+ declare function toReadableStream(bytes: Node<Uint8Array>): ReadableStream<Uint8Array>;
1651
+ /** Parsed Server-Sent Event. */
1652
+ type SSEEvent<T = string> = {
1653
+ event: string;
1654
+ data: T;
1655
+ id?: string;
1656
+ retry?: number;
1657
+ };
1658
+ /** Options for {@link fromSSE}. */
1659
+ type FromSSEOptions<T = string> = ExtraOpts & {
1660
+ /** Parse the raw `data:` payload. Default: identity (string). */
1661
+ parse?: (raw: string) => T;
1662
+ };
1663
+ /** Options for {@link parseSSEStream}. */
1664
+ type ParseSSEStreamOptions<T = string> = {
1665
+ /** Parse the raw `data:` payload. Default: identity (string). */
1666
+ parse?: (raw: string) => T;
1667
+ /**
1668
+ * External abort signal. If aborted, the generator returns early after
1669
+ * cancelling the underlying reader / iterator. Does not emit an error —
1670
+ * the generator simply ends.
1671
+ */
1672
+ signal?: AbortSignal;
1673
+ };
1674
+ /**
1675
+ * Parses a Server-Sent Events byte stream into an async-iterator of structured
1676
+ * `{event, data, id, retry}` records. Pure async generator with no reactive
1677
+ * dependency — safe to consume anywhere an `AsyncIterable<SSEEvent>` is
1678
+ * expected (LLM provider adapters, tests, non-reactive transports).
1679
+ *
1680
+ * Handles:
1681
+ * - Arbitrary chunk boundaries (internal text buffer + `TextDecoder` streaming).
1682
+ * - `\n` and `\r\n` line endings.
1683
+ * - `event:` / `data:` (multi-line via repeated fields) / `id:` / `retry:`.
1684
+ * - Comments (`:` prefix).
1685
+ * - Cancels the underlying reader / iterator on external abort or consumer
1686
+ * break, so a quiet stream doesn't leak pending `read()` calls.
1687
+ *
1688
+ * Used internally by {@link fromSSE} (reactive `Node<SSEEvent>`) — exposed as a
1689
+ * pure helper so LLM provider adapters (Anthropic, OpenAI, Google) can parse
1690
+ * their SSE streams without building a reactive node per call.
1691
+ *
1692
+ * @param source - SSE byte source (`ReadableStream`, `Response`, or `AsyncIterable<Uint8Array>`).
1693
+ * @param opts - `{ parse?, signal? }`.
1694
+ * @returns `AsyncGenerator<SSEEvent<T>>` — yields one event per SSE block; returns on stream end / abort.
1695
+ *
1696
+ * @category extra
1697
+ */
1698
+ declare function parseSSEStream<T = string>(source: ReadableStream<Uint8Array> | Response | AsyncIterable<Uint8Array>, opts?: ParseSSEStreamOptions<T>): AsyncGenerator<SSEEvent<T>, void, unknown>;
1699
+ /**
1700
+ * Parses a Server-Sent Events stream into structured `{event, data, id}` records.
1701
+ *
1702
+ * @param source - SSE byte source (`ReadableStream`, `Response`, or `AsyncIterable<Uint8Array>`).
1703
+ * @param opts - Parse function and node options.
1704
+ * @returns `Node<SSEEvent<T>>` — one `DATA` per SSE event; `COMPLETE` on stream end.
1705
+ *
1706
+ * @category extra
1707
+ */
1708
+ declare function fromSSE<T = string>(source: ReadableStream<Uint8Array> | Response | AsyncIterable<Uint8Array>, opts?: FromSSEOptions<T>): Node<SSEEvent<T>>;
1709
+
1710
+ /**
1711
+ * StatsD / DogStatsD IO — `fromStatsD` registrar-based source plus
1712
+ * `parseStatsD` helper for the line format. The caller owns the UDP socket;
1713
+ * the adapter only wires the `emit` triad.
1714
+ */
1715
+
1716
+ /** Parsed StatsD metric. */
1717
+ type StatsDMetric = {
1718
+ name: string;
1719
+ value: number;
1720
+ type: "counter" | "gauge" | "timer" | "histogram" | "set" | "distribution";
1721
+ sampleRate?: number;
1722
+ tags: Record<string, string>;
1723
+ timestampNs: number;
1724
+ };
1725
+ /** Registration callback for StatsD receiver. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
1726
+ type StatsDRegister = ExternalRegister<EmitTriad<StatsDMetric>>;
1727
+ /** Options for {@link fromStatsD}. */
1728
+ type FromStatsDOptions = ExtraOpts & {};
1729
+ /**
1730
+ * StatsD/DogStatsD UDP receiver as a reactive source.
1731
+ *
1732
+ * The caller owns the UDP socket. `fromStatsD` receives a `register` callback
1733
+ * that wires datagrams to the `emit` handler with parsed metrics.
1734
+ *
1735
+ * @param register - Wires socket to emit/error/complete handlers.
1736
+ * @param opts - Optional producer options.
1737
+ * @returns `Node<StatsDMetric>` — one `DATA` per metric line.
1738
+ *
1739
+ * @example
1740
+ * ```ts
1741
+ * import dgram from "node:dgram";
1742
+ * import { fromStatsD, parseStatsD } from "@graphrefly/graphrefly-ts";
1743
+ *
1744
+ * const server = dgram.createSocket("udp4");
1745
+ * const stats$ = fromStatsD(({ emit, error }) => {
1746
+ * server.on("message", (buf) => {
1747
+ * for (const line of buf.toString().split("\\n")) {
1748
+ * if (line.trim()) {
1749
+ * try { emit(parseStatsD(line)); }
1750
+ * catch (e) { error(e); }
1751
+ * }
1752
+ * }
1753
+ * });
1754
+ * server.bind(8125);
1755
+ * return () => server.close();
1756
+ * });
1757
+ * ```
1758
+ *
1759
+ * @category extra
1760
+ */
1761
+ declare function fromStatsD(register: StatsDRegister, opts?: FromStatsDOptions): Node<StatsDMetric>;
1762
+ /**
1763
+ * Parses a raw StatsD/DogStatsD line into a structured {@link StatsDMetric}.
1764
+ *
1765
+ * Format: `metric.name:value|type|@sampleRate|#tag1:val1,tag2:val2`
1766
+ *
1767
+ * @category extra
1768
+ */
1769
+ declare function parseStatsD(line: string): StatsDMetric;
1770
+
1771
+ /**
1772
+ * Syslog (RFC 5424) IO — `fromSyslog` registrar-based source plus
1773
+ * `parseSyslog` helper for the line format. The caller owns the UDP/TCP
1774
+ * socket; the adapter only wires the `emit` triad.
1775
+ */
1776
+
1777
+ /** Parsed syslog message (RFC 5424). */
1778
+ type SyslogMessage = {
1779
+ facility: number;
1780
+ severity: number;
1781
+ timestamp: string;
1782
+ hostname: string;
1783
+ appName: string;
1784
+ procId: string;
1785
+ msgId: string;
1786
+ message: string;
1787
+ timestampNs: number;
1788
+ };
1789
+ /** Registration callback for syslog receiver. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
1790
+ type SyslogRegister = ExternalRegister<EmitTriad<SyslogMessage>>;
1791
+ /** Options for {@link fromSyslog}. */
1792
+ type FromSyslogOptions = ExtraOpts & {};
1793
+ /**
1794
+ * RFC 5424 syslog receiver as a reactive source.
1795
+ *
1796
+ * The caller owns the UDP/TCP socket. `fromSyslog` receives a `register` callback
1797
+ * that wires socket data events to the `emit` handler with parsed syslog messages.
1798
+ *
1799
+ * @param register - Wires socket to emit/error/complete handlers.
1800
+ * @param opts - Optional producer options.
1801
+ * @returns `Node<SyslogMessage>` — one `DATA` per syslog message.
1802
+ *
1803
+ * @example
1804
+ * ```ts
1805
+ * import dgram from "node:dgram";
1806
+ * import { fromSyslog, parseSyslog } from "@graphrefly/graphrefly-ts";
1807
+ *
1808
+ * const server = dgram.createSocket("udp4");
1809
+ * const syslog$ = fromSyslog(({ emit, error }) => {
1810
+ * server.on("message", (buf) => {
1811
+ * try { emit(parseSyslog(buf.toString())); }
1812
+ * catch (e) { error(e); }
1813
+ * });
1814
+ * server.bind(514);
1815
+ * return () => server.close();
1816
+ * });
1817
+ * ```
1818
+ *
1819
+ * @category extra
1820
+ */
1821
+ declare function fromSyslog(register: SyslogRegister, opts?: FromSyslogOptions): Node<SyslogMessage>;
1822
+ /**
1823
+ * Parses a raw RFC 5424 syslog line into a structured {@link SyslogMessage}.
1824
+ *
1825
+ * Format: `<PRI>VERSION TIMESTAMP HOSTNAME APP-NAME PROCID MSGID MSG`
1826
+ *
1827
+ * @category extra
1828
+ */
1829
+ declare function parseSyslog(raw: string): SyslogMessage;
1830
+
1831
+ /**
1832
+ * ClickHouse insert sink IO — `toClickHouse` accumulates upstream `DATA`
1833
+ * values and inserts them in batches via the duck-typed
1834
+ * {@link ClickHouseInsertClientLike}.
1835
+ */
1836
+
1837
+ /** Duck-typed ClickHouse client for batch inserts. */
1838
+ type ClickHouseInsertClientLike = {
1839
+ insert(params: {
1840
+ table: string;
1841
+ values: unknown[];
1842
+ format?: string;
1843
+ }): Promise<void>;
1844
+ };
1845
+ /** Options for {@link toClickHouse}. */
1846
+ type ToClickHouseOptions<T> = ExtraOpts & {
1847
+ /** Batch size before auto-flush. Default: `1000`. */
1848
+ batchSize?: number;
1849
+ /** Flush interval in ms. Default: `5000`. */
1850
+ flushIntervalMs?: number;
1851
+ /** Insert format. Default: `"JSONEachRow"`. */
1852
+ format?: string;
1853
+ /** Transform value before insert. Default: identity. */
1854
+ transform?: (value: T) => unknown;
1855
+ onTransportError?: (err: SinkTransportError) => void;
1856
+ };
1857
+ /**
1858
+ * ClickHouse buffered batch insert sink.
1859
+ *
1860
+ * Accumulates upstream `DATA` values and inserts in batches.
1861
+ *
1862
+ * @param source - Upstream node.
1863
+ * @param client - ClickHouse client with `insert()`.
1864
+ * @param table - Target table name.
1865
+ * @param opts - Batch size, flush interval, and transform options.
1866
+ * @returns `BufferedSinkHandle`.
1867
+ *
1868
+ * @category extra
1869
+ */
1870
+ declare function toClickHouse<T>(source: Node<T>, client: ClickHouseInsertClientLike, table: string, opts?: ToClickHouseOptions<T>): ReactiveSinkHandle<T>;
1871
+
1872
+ /**
1873
+ * File-writer sink IO — `toFile` writes upstream `DATA` to any
1874
+ * `FileWriterLike` (e.g. `fs.createWriteStream`). Buffered or write-through
1875
+ * depending on `flushIntervalMs` / `batchSize`.
1876
+ *
1877
+ * Uses a duck-typed writable so the universal `extra/io` entry stays
1878
+ * browser-safe — the caller injects the Node `fs` writer at the boundary.
1879
+ */
1880
+
1881
+ /** Duck-typed writable file handle (compatible with `fs.createWriteStream`). */
1882
+ type FileWriterLike = {
1883
+ write(data: string | Uint8Array): boolean | undefined;
1884
+ end(): void;
1885
+ };
1886
+ /** Options for {@link toFile}. */
1887
+ type ToFileOptions<T> = ExtraOpts & {
1888
+ /** Serialize a value to a string line. Default: `JSON.stringify(v) + "\n"`. */
1889
+ serialize?: (value: T) => string;
1890
+ /** `"append"` (default) or `"overwrite"` — controls initial file behavior hint. */
1891
+ mode?: "append" | "overwrite";
1892
+ /** Flush interval in ms. `0` = write-through (no buffering). Default: `0`. */
1893
+ flushIntervalMs?: number;
1894
+ /** Buffer size (item count) before auto-flush. Default: `Infinity` (timer only). */
1895
+ batchSize?: number;
1896
+ onTransportError?: (err: SinkTransportError) => void;
1897
+ };
1898
+ /**
1899
+ * File sink — writes upstream `DATA` values to a file-like writable.
1900
+ *
1901
+ * When `flushIntervalMs > 0` or `batchSize` is set, values are buffered and
1902
+ * flushed in batches. Otherwise, each value is written immediately.
1903
+ *
1904
+ * @param source - Upstream node.
1905
+ * @param writer - Writable file handle (e.g. `fs.createWriteStream(path, { flags: "a" })`).
1906
+ * @param opts - Serialization, buffering, and mode options.
1907
+ * @returns `BufferedSinkHandle` with `dispose()` and `flush()`.
1908
+ *
1909
+ * @category extra
1910
+ */
1911
+ declare function toFile<T>(source: Node<T>, writer: FileWriterLike, opts?: ToFileOptions<T>): ReactiveSinkHandle<T>;
1912
+
1913
+ /**
1914
+ * CSV file sink IO — `toCSV` adds CSV row formatting on top of
1915
+ * {@link toFile}. Uses the local `escapeCSVField` helper to quote cells that
1916
+ * contain delimiters / quotes / newlines.
1917
+ */
1918
+
1919
+ /** Options for {@link toCSV}. */
1920
+ type ToCSVOptions<T> = ExtraOpts & {
1921
+ /** Column names. Required — determines header row and field order. */
1922
+ columns: string[];
1923
+ /** Column delimiter. Default: `","`. */
1924
+ delimiter?: string;
1925
+ /** Whether to write a header row on first flush. Default: `true`. */
1926
+ writeHeader?: boolean;
1927
+ /** Extract a cell value from the row object. Default: `String(row[col] ?? "")`. */
1928
+ cellExtractor?: (row: T, column: string) => string;
1929
+ /** Flush interval in ms. Default: `0` (write-through). */
1930
+ flushIntervalMs?: number;
1931
+ /** Buffer size before auto-flush. Default: `Infinity`. */
1932
+ batchSize?: number;
1933
+ onTransportError?: (err: SinkTransportError) => void;
1934
+ };
1935
+ /**
1936
+ * CSV file sink — writes upstream `DATA` as CSV rows.
1937
+ *
1938
+ * @param source - Upstream node.
1939
+ * @param writer - Writable file handle.
1940
+ * @param opts - Column definition, delimiter, and buffering options.
1941
+ * @returns `BufferedSinkHandle`.
1942
+ *
1943
+ * @category extra
1944
+ */
1945
+ declare function toCSV<T>(source: Node<T>, writer: FileWriterLike, opts: ToCSVOptions<T>): ReactiveSinkHandle<T>;
1946
+
1947
+ /**
1948
+ * Grafana Loki sink IO — `toLoki` pushes upstream `DATA` values as log
1949
+ * entries via the duck-typed {@link LokiClientLike} `push()` surface.
1950
+ */
1951
+
1952
+ /** Loki log stream entry. */
1953
+ type LokiStream = {
1954
+ stream: Record<string, string>;
1955
+ values: [string, string][];
1956
+ };
1957
+ /** Duck-typed Loki push client (HTTP push API). */
1958
+ type LokiClientLike = {
1959
+ push(streams: {
1960
+ streams: LokiStream[];
1961
+ }): Promise<unknown>;
1962
+ };
1963
+ /** Options for {@link toLoki}. */
1964
+ type ToLokiOptions<T> = ExtraOpts & {
1965
+ /** Static labels applied to every log entry. */
1966
+ labels?: Record<string, string>;
1967
+ /** Extract the log line from a value. Default: `JSON.stringify(v)`. */
1968
+ toLine?: (value: T) => string;
1969
+ /** Extract additional labels from a value. Default: none. */
1970
+ toLabels?: (value: T) => Record<string, string>;
1971
+ onTransportError?: (err: SinkTransportError) => void;
1972
+ };
1973
+ /**
1974
+ * Grafana Loki sink — pushes upstream `DATA` values as log entries.
1975
+ *
1976
+ * @param source - Upstream node.
1977
+ * @param client - Loki-compatible client with `push()`.
1978
+ * @param opts - Label, serialization, and error options.
1979
+ * @returns Unsubscribe function.
1980
+ *
1981
+ * @category extra
1982
+ */
1983
+ declare function toLoki<T>(source: Node<T>, client: LokiClientLike, opts?: ToLokiOptions<T>): ReactiveSinkHandle<T>;
1984
+
1985
+ /**
1986
+ * MongoDB insert sink IO — `toMongo` inserts each upstream `DATA` value via
1987
+ * the duck-typed {@link MongoCollectionLike} `insertOne()`.
1988
+ */
1989
+
1990
+ /** Duck-typed MongoDB collection (compatible with `mongodb` driver). */
1991
+ type MongoCollectionLike = {
1992
+ insertOne(doc: unknown): Promise<unknown>;
1993
+ };
1994
+ /** Options for {@link toMongo}. */
1995
+ type ToMongoOptions<T> = ExtraOpts & {
1996
+ /** Transform value to a MongoDB document. Default: identity. */
1997
+ toDocument?: (value: T) => unknown;
1998
+ onTransportError?: (err: SinkTransportError) => void;
1999
+ };
2000
+ /**
2001
+ * MongoDB sink — inserts each upstream `DATA` value as a document.
2002
+ *
2003
+ * @param source - Upstream node.
2004
+ * @param collection - MongoDB collection with `insertOne()`.
2005
+ * @param opts - Document transform and error options.
2006
+ * @returns Unsubscribe function.
2007
+ *
2008
+ * @category extra
2009
+ */
2010
+ declare function toMongo<T>(source: Node<T>, collection: MongoCollectionLike, opts?: ToMongoOptions<T>): ReactiveSinkHandle<T>;
2011
+
2012
+ /**
2013
+ * Postgres insert sink IO — `toPostgres` inserts each upstream `DATA` value
2014
+ * via the duck-typed {@link PostgresClientLike} `query()` surface.
2015
+ */
2016
+
2017
+ /** Duck-typed Postgres client (compatible with `pg.Client` / `pg.Pool`). */
2018
+ type PostgresClientLike = {
2019
+ query(sql: string, params?: unknown[]): Promise<unknown>;
2020
+ };
2021
+ /** Options for {@link toPostgres}. */
2022
+ type ToPostgresOptions<T> = ExtraOpts & {
2023
+ /** Build the SQL + params for an insert. Default: JSON insert into `table`. */
2024
+ toSQL?: (value: T, table: string) => {
2025
+ sql: string;
2026
+ params: unknown[];
2027
+ };
2028
+ onTransportError?: (err: SinkTransportError) => void;
2029
+ };
2030
+ /**
2031
+ * PostgreSQL sink — inserts each upstream `DATA` value as a row.
2032
+ *
2033
+ * @param source - Upstream node.
2034
+ * @param client - Postgres client with `query()`.
2035
+ * @param table - Target table name.
2036
+ * @param opts - SQL builder and error options.
2037
+ * @returns Unsubscribe function.
2038
+ *
2039
+ * @category extra
2040
+ */
2041
+ declare function toPostgres<T>(source: Node<T>, client: PostgresClientLike, table: string, opts?: ToPostgresOptions<T>): ReactiveSinkHandle<T>;
2042
+
2043
+ /**
2044
+ * Grafana Tempo sink IO — `toTempo` pushes upstream `DATA` values as trace
2045
+ * spans (OTLP/HTTP shape) via the duck-typed {@link TempoClientLike}.
2046
+ */
2047
+
2048
+ /** Duck-typed Tempo span push client (OTLP/HTTP shape). */
2049
+ type TempoClientLike = {
2050
+ push(payload: {
2051
+ resourceSpans: unknown[];
2052
+ }): Promise<unknown>;
2053
+ };
2054
+ /** Options for {@link toTempo}. */
2055
+ type ToTempoOptions<T> = ExtraOpts & {
2056
+ /** Transform a value into OTLP resourceSpans entries. */
2057
+ toResourceSpans?: (value: T) => unknown[];
2058
+ onTransportError?: (err: SinkTransportError) => void;
2059
+ };
2060
+ /**
2061
+ * Grafana Tempo sink — pushes upstream `DATA` values as trace spans.
2062
+ *
2063
+ * @param source - Upstream node.
2064
+ * @param client - Tempo-compatible client with `push()`.
2065
+ * @param opts - Span transform and error options.
2066
+ * @returns Unsubscribe function.
2067
+ *
2068
+ * @category extra
2069
+ */
2070
+ declare function toTempo<T>(source: Node<T>, client: TempoClientLike, opts?: ToTempoOptions<T>): ReactiveSinkHandle<T>;
2071
+
2072
+ /**
2073
+ * Webhook IO — `fromWebhook` is a thin wrapper over `externalProducer` that
2074
+ * exposes the standard `EmitTriad` (`emit` / `error` / `complete`) callback
2075
+ * shape to the caller's framework integration (Express, Fastify, Hono,
2076
+ * Cloudflare Workers, etc.).
2077
+ */
2078
+
2079
+ /** Registration callback for {@link fromWebhook}. Alias of {@link ExternalRegister} over {@link EmitTriad}. */
2080
+ type WebhookRegister<T> = ExternalRegister<EmitTriad<T>>;
2081
+ /**
2082
+ * Bridges HTTP webhook callbacks into a GraphReFly source.
2083
+ *
2084
+ * The `register` callback wires your runtime/framework callback to GraphReFly and may return a
2085
+ * cleanup function. This keeps the adapter runtime-agnostic while following the same producer
2086
+ * pattern as {@link fromEvent}.
2087
+ *
2088
+ * @param register - Registers webhook handlers (`emit`, `error`, `complete`) and optionally returns cleanup.
2089
+ * @param opts - Optional producer options.
2090
+ * @returns `Node<T>` — webhook payloads as `DATA`; teardown runs returned cleanup.
2091
+ *
2092
+ * @example
2093
+ * ```ts
2094
+ * import express from "express";
2095
+ * import { fromWebhook } from "@graphrefly/graphrefly-ts";
2096
+ *
2097
+ * type HookPayload = { event: string; data: unknown };
2098
+ * const app = express();
2099
+ * app.use(express.json());
2100
+ *
2101
+ * const hook$ = fromWebhook<HookPayload>(({ emit, error }) => {
2102
+ * const handler = (req: express.Request, res: express.Response) => {
2103
+ * try {
2104
+ * emit(req.body as HookPayload);
2105
+ * res.status(200).send("ok");
2106
+ * } catch (e) {
2107
+ * error(e);
2108
+ * res.status(500).send("error");
2109
+ * }
2110
+ * };
2111
+ * app.post("/webhook", handler);
2112
+ * return () => {
2113
+ * // Express has no direct route-removal API in common use.
2114
+ * };
2115
+ * });
2116
+ * ```
2117
+ *
2118
+ * @example Fastify
2119
+ * ```ts
2120
+ * import Fastify from "fastify";
2121
+ * import { fromWebhook } from "@graphrefly/graphrefly-ts";
2122
+ *
2123
+ * const fastify = Fastify();
2124
+ * const hook$ = fromWebhook<any>(({ emit, error }) => {
2125
+ * const handler = async (req: any, reply: any) => {
2126
+ * try {
2127
+ * emit(req.body);
2128
+ * reply.code(200).send({ ok: true });
2129
+ * } catch (e) {
2130
+ * error(e);
2131
+ * reply.code(500).send({ ok: false });
2132
+ * }
2133
+ * };
2134
+ * fastify.post("/webhook", handler);
2135
+ * return () => {};
2136
+ * });
2137
+ * ```
2138
+ *
2139
+ * @category extra
2140
+ */
2141
+ declare function fromWebhook<T = unknown>(register: WebhookRegister<T>, opts?: ExtraOpts): Node<T>;
2142
+
2143
+ /**
2144
+ * WebSocket IO — `fromWebSocket` (DOM-style `WebSocketLike` source / register
2145
+ * variant), `toWebSocket` (sink with optional ack-tracking + retry),
2146
+ * `fromWebSocketReconnect` (`fromWebSocket` wrapped in retry-on-disconnect with
2147
+ * exponential backoff).
2148
+ */
2149
+
2150
+ /** WebSocket-like transport accepted by {@link fromWebSocket} / {@link toWebSocket}. */
2151
+ type WebSocketLike = {
2152
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
2153
+ close(code?: number, reason?: string): void;
2154
+ addEventListener(type: "message" | "error" | "close", listener: (ev: unknown) => void): void;
2155
+ removeEventListener(type: "message" | "error" | "close", listener: (ev: unknown) => void): void;
2156
+ };
2157
+ type WebSocketMessageEventLike = {
2158
+ data: unknown;
2159
+ };
2160
+ type WebSocketRegister<T> = (emit: (payload: T) => void, error: (err: unknown) => void, complete: () => void) => () => void;
2161
+ /**
2162
+ * Wraps a WebSocket as a GraphReFly producer source.
2163
+ *
2164
+ * Incoming socket messages are emitted as `DATA`; socket `error` emits `ERROR`; socket `close`
2165
+ * emits `COMPLETE`. Teardown detaches listeners and optionally closes the socket.
2166
+ *
2167
+ * @category extra
2168
+ */
2169
+ declare function fromWebSocket<T = unknown>(socket: WebSocketLike, opts?: ExtraOpts & {
2170
+ parse?: (payload: unknown, event: unknown) => T;
2171
+ closeOnTeardown?: boolean;
2172
+ }): Node<T>;
2173
+ declare function fromWebSocket<T = unknown>(register: WebSocketRegister<T>, opts?: ExtraOpts & {
2174
+ parse?: (payload: unknown, event: unknown) => T;
2175
+ closeOnTeardown?: boolean;
2176
+ }): Node<T>;
2177
+ /** Options for {@link toWebSocket}. */
2178
+ type ToWebSocketOptions<T> = {
2179
+ /** Serialize DATA payloads before `socket.send(...)`. */
2180
+ serialize?: (value: T) => string | ArrayBufferLike | Blob | ArrayBufferView;
2181
+ /** Close socket when upstream emits COMPLETE. Default: `true`. */
2182
+ closeOnComplete?: boolean;
2183
+ /** Close socket when upstream emits ERROR. Default: `true`. */
2184
+ closeOnError?: boolean;
2185
+ /** Optional close code used when close is triggered by terminal tuples. */
2186
+ closeCode?: number;
2187
+ /** Optional close reason used when close is triggered by terminal tuples. */
2188
+ closeReason?: string;
2189
+ /** Structured callback — uses the unified {@link SinkTransportError} shape. */
2190
+ onTransportError?: (event: SinkTransportError) => void;
2191
+ /** Retry configuration — passed through to {@link reactiveSink}. */
2192
+ retry?: ReactiveSinkHandle<T> extends infer _ ? Parameters<typeof reactiveSink<T>>[1]["retry"] : never;
2193
+ /** Backpressure configuration — passed through to {@link reactiveSink}. */
2194
+ backpressure?: Parameters<typeof reactiveSink<T>>[1]["backpressure"];
2195
+ /** Reactive stop signal — when it emits any DATA / terminal, the sink tears down. */
2196
+ stopOn?: Node<unknown>;
2197
+ };
2198
+ /**
2199
+ * Forwards upstream `DATA` payloads to a WebSocket via `send`.
2200
+ *
2201
+ * Returns a {@link ReactiveSinkHandle} — every transport outcome (including
2202
+ * socket `close` events) surfaces on the `errors` / `failed` / `sent` /
2203
+ * `inFlight` companions.
2204
+ *
2205
+ * @category extra
2206
+ */
2207
+ declare function toWebSocket<T>(source: Node<T>, socket: WebSocketLike, opts?: ToWebSocketOptions<T>): ReactiveSinkHandle<T>;
2208
+ /** Options for {@link fromWebSocketReconnect}. */
2209
+ type FromWebSocketReconnectOptions<T> = ExtraOpts & {
2210
+ /** Optional parser applied to incoming messages. */
2211
+ parse?: (payload: unknown, event: unknown) => T;
2212
+ /** Max reconnect attempts. Default: `Infinity` (implied when `backoff` is set). */
2213
+ maxRetries?: number;
2214
+ /** Backoff strategy (ns) or preset name. Default: `"exponential"`. */
2215
+ backoff?: Parameters<typeof retry>[1] extends infer O ? O extends {
2216
+ backoff?: infer B;
2217
+ } ? B : never : never;
2218
+ /** Close the socket on teardown. Default: `true`. */
2219
+ closeOnTeardown?: boolean;
2220
+ };
2221
+ /**
2222
+ * Reconnecting WebSocket source — each connection attempt calls `factory` to
2223
+ * obtain a fresh {@link WebSocketLike}; on `close` (treated as terminal
2224
+ * `COMPLETE`), {@link retry} rebuilds the inner source and reconnects.
2225
+ *
2226
+ * For transient errors, {@link retry} retries with the configured
2227
+ * backoff. On `maxRetries` exhaustion, terminal `ERROR` propagates.
2228
+ *
2229
+ * @param factory - Invoked per reconnect to create a fresh WebSocket.
2230
+ * @param opts - Parse, retry, and close options.
2231
+ *
2232
+ * @example
2233
+ * ```ts
2234
+ * import { fromWebSocketReconnect } from "@graphrefly/graphrefly-ts";
2235
+ * const ws$ = fromWebSocketReconnect(
2236
+ * () => new WebSocket("wss://example/stream"),
2237
+ * { backoff: "exponential", maxRetries: 10 },
2238
+ * );
2239
+ * ```
2240
+ *
2241
+ * @category extra
2242
+ */
2243
+ declare function fromWebSocketReconnect<T = unknown>(factory: () => WebSocketLike, opts?: FromWebSocketReconnectOptions<T>): Node<T>;
2244
+
2245
+ export { type AckableMessage, type AdapterHandlers, type BufferedSinkHandle, type CSVRow, type CheckpointToRedisOptions, type CheckpointToS3Options, type ClickHouseClientLike, type ClickHouseInsertClientLike, type ClickHouseRow, type DrizzleQueryLike, type FileWriterLike, type FromCSVOptions, type FromClickHouseWatchOptions, type FromDrizzleOptions, type FromHTTPOptions, type FromHTTPPollOptions, type FromHTTPStreamOptions, type FromKafkaOptions, type FromKyselyOptions, type FromMCPOptions, type FromNATSOptions, type FromNDJSONOptions, type FromOTelOptions, type FromPrismaOptions, type FromPrometheusOptions, type FromPulsarOptions, type FromRabbitMQOptions, type FromRedisStreamOptions, type FromSSEOptions, type FromSqliteOptions, type FromStatsDOptions, type FromSyslogOptions, type FromWebSocketReconnectOptions, type HTTPBundle, type KafkaConsumerLike, type KafkaMessage, type KafkaProducerLike, type KyselyQueryLike, type LokiClientLike, type LokiStream, type MCPClientLike, type MongoCollectionLike, type NATSClientLike, type NATSMessage, type NATSSubscriptionLike, type OTelBundle, type OTelLog, type OTelMetric, type OTelRegister, type OTelSpan, type ParseSSEStreamOptions, type PostgresClientLike, type PrismaModelLike, type PrometheusMetric, type PulsarConsumerLike, type PulsarMessage, type PulsarProducerLike, type RabbitMQChannelLike, type RabbitMQMessage, type RedisCheckpointClientLike, type RedisClientLike, type RedisStreamEntry, type S3ClientLike, type SSEEvent, type SinkHandle, type SinkTransportError, type SqliteDbLike, type SqliteIterableDbLike, type StatsDMetric, type StatsDRegister, type SyslogMessage, type SyslogRegister, type TempoClientLike, type ToCSVOptions, type ToClickHouseOptions, type ToFileOptions, type ToHTTPOptions, type ToKafkaOptions, type ToLokiOptions, type ToMongoOptions, type ToNATSOptions, type ToPostgresOptions, type ToPulsarOptions, type ToRabbitMQOptions, type ToRedisStreamOptions, type ToS3Options, type ToSSEOptions, type ToSqliteOptions, type ToTempoOptions, type ToWebSocketOptions, type WebSocketLike, type WebSocketMessageEventLike, type WebSocketRegister, type WebhookRegister, checkpointToRedis, checkpointToS3, csvRows, fromCSV, fromClickHouseWatch, fromDrizzle, fromHTTP, fromHTTPPoll, fromHTTPStream, fromKafka, fromKysely, fromMCP, fromNATS, fromNDJSON, fromOTel, fromPrisma, fromPrometheus, fromPulsar, fromRabbitMQ, fromRedisStream, fromSSE, fromSqlite, fromSqliteCursor, fromStatsD, fromSyslog, fromWebSocket, fromWebSocketReconnect, fromWebhook, ndjsonRows, parsePrometheusText, parseSSEStream, parseStatsD, parseSyslog, toCSV, toClickHouse, toFile, toHTTP, toKafka, toLoki, toMongo, toNATS, toPostgres, toPulsar, toRabbitMQ, toReadableStream, toRedisStream, toS3, toSSE, toSSEBytes, toSqlite, toTempo, toWebSocket };