@graphrefly/graphrefly 0.27.0 → 0.29.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.
- package/dist/backoff-HPZMEZNF.js +1 -0
- package/dist/cascading-Bp99ckMJ.d.ts +180 -0
- package/dist/cascading-CcAgRacD.d.cts +180 -0
- package/dist/chunk-22F4K3G7.js +1 -0
- package/dist/chunk-22SVXUPB.js +64 -0
- package/dist/chunk-2GQREQ6C.js +1 -0
- package/dist/chunk-3JXNEPCD.js +2 -0
- package/dist/chunk-4JJCCD5S.js +2 -0
- package/dist/chunk-4OFIQ66T.js +1 -0
- package/dist/chunk-4V4C7K56.js +1 -0
- package/dist/chunk-4VVTGLXJ.js +1 -0
- package/dist/chunk-567NWZ3T.js +1 -0
- package/dist/chunk-5JDE5JHE.js +1 -0
- package/dist/chunk-5QDBSZBV.js +1 -0
- package/dist/chunk-5Z4HDCO6.js +1 -0
- package/dist/chunk-63FFOHLA.js +1 -0
- package/dist/chunk-6QZNQS5B.js +1 -0
- package/dist/chunk-7JDLFI6N.js +1 -0
- package/dist/chunk-7TDOES3L.js +1 -0
- package/dist/chunk-A7IAQQ63.js +1 -0
- package/dist/chunk-AMG5VBHW.js +1 -0
- package/dist/chunk-AUY2YKCO.js +1 -0
- package/dist/chunk-AV3PIDFQ.js +1 -0
- package/dist/chunk-BA5URFYW.js +1 -0
- package/dist/chunk-BKPLTBL5.js +1 -0
- package/dist/chunk-BZP5T4X6.js +1 -0
- package/dist/chunk-CK2E7BTU.js +1 -0
- package/dist/chunk-CSJE2EKV.js +1 -0
- package/dist/chunk-E3AXATVZ.js +9 -0
- package/dist/chunk-ESMPEKEV.js +1 -0
- package/dist/chunk-GJR3P6JG.js +1 -0
- package/dist/chunk-GNCBXARM.js +1 -0
- package/dist/chunk-GPW2V3RE.js +1 -0
- package/dist/chunk-HSIEYSDY.js +1 -0
- package/dist/chunk-I6VIH3VA.js +1 -0
- package/dist/chunk-ISCENNXS.js +1 -0
- package/dist/chunk-JYOUF6UQ.js +1 -0
- package/dist/chunk-KASHOCF5.js +1 -0
- package/dist/chunk-LGSNR4LU.js +5 -0
- package/dist/chunk-LVGBLZM2.js +1 -0
- package/dist/chunk-MGKAO4EK.js +7 -0
- package/dist/chunk-NSG4C6BF.js +23 -0
- package/dist/chunk-OL33ZI6R.js +1 -0
- package/dist/chunk-PCZ35NXD.js +78 -0
- package/dist/chunk-PGMUCUHG.js +43 -0
- package/dist/chunk-QYADASLV.js +1 -0
- package/dist/chunk-RD52SNH2.js +1 -0
- package/dist/chunk-SLMYTGTU.js +1 -0
- package/dist/chunk-TWMEGG45.js +1 -0
- package/dist/chunk-UVJQ35G2.js +1 -0
- package/dist/chunk-VGTCGNRX.js +18 -0
- package/dist/chunk-VIMF6LGM.js +1 -0
- package/dist/chunk-VJLMUKOI.js +1 -0
- package/dist/chunk-VWPRPPKR.js +1 -0
- package/dist/chunk-W4TSQ6RJ.js +1 -0
- package/dist/chunk-WM7H7WTY.js +3 -0
- package/dist/chunk-Y32RJO24.js +1 -0
- package/dist/chunk-Y53B6NS4.js +1 -0
- package/dist/compat/index.cjs +15 -7656
- package/dist/compat/index.d.cts +15 -14
- package/dist/compat/index.d.ts +15 -14
- package/dist/compat/index.js +1 -50
- package/dist/compat/jotai/index.cjs +1 -2048
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -9
- package/dist/compat/nanostores/index.cjs +1 -2175
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -23
- package/dist/compat/nestjs/index.cjs +15 -6782
- package/dist/compat/nestjs/index.d.cts +7 -6
- package/dist/compat/nestjs/index.d.ts +7 -6
- package/dist/compat/nestjs/index.js +1 -83
- package/dist/compat/react/index.cjs +1 -141
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/react/index.js +1 -12
- package/dist/compat/solid/index.cjs +1 -128
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/solid/index.js +1 -12
- package/dist/compat/svelte/index.cjs +1 -131
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/svelte/index.js +1 -12
- package/dist/compat/vue/index.cjs +1 -146
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/vue/index.js +1 -12
- package/dist/compat/zustand/index.cjs +7 -4931
- package/dist/compat/zustand/index.d.cts +5 -5
- package/dist/compat/zustand/index.d.ts +5 -5
- package/dist/compat/zustand/index.js +1 -12
- package/dist/composite-BL-llbnE.d.ts +69 -0
- package/dist/composite-Dze--DaA.d.cts +69 -0
- package/dist/core/index.cjs +1 -2271
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -110
- package/dist/extra/browser.cjs +1 -0
- package/dist/extra/browser.d.cts +3 -0
- package/dist/extra/browser.d.ts +3 -0
- package/dist/extra/browser.js +1 -0
- package/dist/extra/index.cjs +24 -9971
- package/dist/extra/index.d.cts +13 -6
- package/dist/extra/index.d.ts +13 -6
- package/dist/extra/index.js +1 -381
- package/dist/extra/node.cjs +3 -0
- package/dist/extra/node.d.cts +81 -0
- package/dist/extra/node.d.ts +81 -0
- package/dist/extra/node.js +2 -0
- package/dist/extra/operators.cjs +1 -0
- package/dist/extra/operators.d.cts +910 -0
- package/dist/extra/operators.d.ts +910 -0
- package/dist/extra/operators.js +1 -0
- package/dist/extra/reactive.cjs +1 -0
- package/dist/extra/reactive.d.cts +352 -0
- package/dist/extra/reactive.d.ts +352 -0
- package/dist/extra/reactive.js +1 -0
- package/dist/extra/sources.cjs +1 -2486
- package/dist/extra/sources.d.cts +6 -2
- package/dist/extra/sources.d.ts +6 -2
- package/dist/extra/sources.js +1 -57
- package/dist/extra/storage-browser.cjs +1 -0
- package/dist/extra/storage-browser.d.cts +71 -0
- package/dist/extra/storage-browser.d.ts +71 -0
- package/dist/extra/storage-browser.js +1 -0
- package/dist/extra/storage-core.cjs +1 -0
- package/dist/extra/storage-core.d.cts +98 -0
- package/dist/extra/storage-core.d.ts +98 -0
- package/dist/extra/storage-core.js +1 -0
- package/dist/extra/storage-node.cjs +2 -0
- package/dist/extra/storage-node.d.cts +60 -0
- package/dist/extra/storage-node.d.ts +60 -0
- package/dist/extra/storage-node.js +1 -0
- package/dist/fallback-BaTS7vVY.d.cts +258 -0
- package/dist/fallback-eOm3LNxP.d.ts +258 -0
- package/dist/graph/index.cjs +7 -5030
- package/dist/graph/index.d.cts +6 -5
- package/dist/graph/index.d.ts +6 -5
- package/dist/graph/index.js +1 -50
- package/dist/{graph-DNCrvZSn.d.cts → graph-DgohqXK-.d.cts} +151 -32
- package/dist/{graph-CCwGKLCm.d.ts → graph-Qjg9gWHI.d.ts} +151 -32
- package/dist/{index-BwfLUNw4.d.ts → index-2BVuRCI4.d.ts} +173 -2040
- package/dist/{index-BPVt8kqc.d.ts → index-2NvguqQA.d.ts} +10 -195
- package/dist/index-A65LZhoM.d.ts +186 -0
- package/dist/{index-DlLp-2Xn.d.cts → index-B-8FCEua.d.cts} +10 -195
- package/dist/index-B-gqvYel.d.ts +135 -0
- package/dist/index-B2PRuolf.d.cts +86 -0
- package/dist/index-BJqt9EwW.d.ts +231 -0
- package/dist/{index-BHlKbUwO.d.cts → index-BKjT5DiZ.d.cts} +173 -2040
- package/dist/{index-C0svESO4.d.ts → index-BM8BU4q6.d.ts} +1 -1
- package/dist/{index-VdHQMPy1.d.ts → index-BQaEnxBf.d.ts} +1 -1
- package/dist/index-BSfwiy5B.d.ts +192 -0
- package/dist/index-BTSkeCZs.d.cts +291 -0
- package/dist/index-BUVtw1Ay.d.cts +186 -0
- package/dist/index-BUi57v_p.d.ts +163 -0
- package/dist/{messaging-Gt4LPbyA.d.cts → index-BanNUILp.d.cts} +31 -93
- package/dist/{audit-DRlSzBu9.d.ts → index-BayHDRx6.d.cts} +27 -21
- package/dist/{index-B6D3QNSA.d.ts → index-BiyjsZ0m.d.ts} +148 -20
- package/dist/index-BqZ6vB2A.d.ts +2057 -0
- package/dist/{memory-li6FL5RM.d.ts → index-BuVidq3D.d.cts} +26 -26
- package/dist/index-Byh-xTyp.d.ts +105 -0
- package/dist/index-C08QPDcV.d.cts +321 -0
- package/dist/{demo-shell-BDkOptd6.d.ts → index-C66RJiX8.d.ts} +14 -14
- package/dist/index-C8RfjffH.d.ts +291 -0
- package/dist/index-CA1Cu7Ud.d.ts +873 -0
- package/dist/{index-ByQxazQJ.d.cts → index-CABbltIu.d.cts} +1 -1
- package/dist/{index-VHqptjhu.d.cts → index-CHEBsnYv.d.cts} +1 -1
- package/dist/{index-BuEoe-Qu.d.ts → index-CI0yDnLp.d.ts} +9 -9
- package/dist/{index-B9B7_HEY.d.ts → index-CJ45TW-h.d.ts} +1 -1
- package/dist/{index-CO8uBlUh.d.cts → index-CJZKZoo4.d.cts} +148 -20
- package/dist/{index-wEn0eFe8.d.ts → index-CX2tFJL1.d.ts} +1 -1
- package/dist/{index-BaSM3aYt.d.ts → index-CcWOJ6F0.d.ts} +3 -3
- package/dist/{audit-ClmqGOCx.d.cts → index-CiaVoZGo.d.ts} +27 -21
- package/dist/{index-Dzk2hrlR.d.ts → index-Ct5CWc4E.d.ts} +1 -1
- package/dist/index-D38duMCv.d.cts +357 -0
- package/dist/{index-C8oil6M6.d.ts → index-D5XJ2tSx.d.ts} +30 -6
- package/dist/{index-DO_6JN9Z.d.cts → index-D80do5jX.d.cts} +1 -1
- package/dist/index-D9HKAH_-.d.cts +231 -0
- package/dist/index-DBe_8XW5.d.cts +143 -0
- package/dist/{memory-C6Z2tGpC.d.cts → index-DCeTyFlB.d.ts} +26 -26
- package/dist/index-DDy8eeXS.d.ts +321 -0
- package/dist/index-DJ5oNBc8.d.ts +143 -0
- package/dist/{index-CI3DprxP.d.cts → index-DP0_O3ls.d.cts} +30 -6
- package/dist/{demo-shell-Crid1WdR.d.cts → index-DX8xS-yB.d.cts} +14 -14
- package/dist/index-DiZejfCI.d.cts +2057 -0
- package/dist/index-DknyJ2Fu.d.cts +163 -0
- package/dist/index-DoWMs-Kk.d.cts +135 -0
- package/dist/{messaging-XDoYablx.d.ts → index-DuB5aO4-.d.ts} +31 -93
- package/dist/index-DwjJGKxV.d.ts +357 -0
- package/dist/{index-B6EhDnjH.d.cts → index-H_oxVec5.d.cts} +1 -1
- package/dist/{index-3lsddbbS.d.ts → index-IMAHq-ia.d.ts} +1 -1
- package/dist/{index-B1tloyhO.d.cts → index-U1nir7MX.d.cts} +1 -1
- package/dist/index-Vg7tORgk.d.ts +86 -0
- package/dist/index-dig-r2tQ.d.cts +873 -0
- package/dist/{index-CxFrXH4m.d.ts → index-gsT79Xu9.d.ts} +1 -1
- package/dist/{index-D8wS_PeY.d.cts → index-i99Ka8s7.d.cts} +9 -9
- package/dist/index-iKkyJosF.d.cts +105 -0
- package/dist/{index-Xi3u0HCQ.d.cts → index-jleeotBT.d.cts} +1 -1
- package/dist/{index-DVGiGFGT.d.cts → index-kykKWwV-.d.cts} +3 -3
- package/dist/index-vgcLF5TH.d.cts +192 -0
- package/dist/{index-DYme44FM.d.cts → index-y1RllPn4.d.cts} +1 -1
- package/dist/index.cjs +151 -24142
- package/dist/index.d.cts +69 -2099
- package/dist/index.d.ts +69 -2099
- package/dist/index.js +1 -3868
- package/dist/{meta-CbznRPYJ.d.ts → meta-CX7YsOzp.d.cts} +5 -5
- package/dist/{meta-BxCA7rcr.d.cts → meta-CckhhFRd.d.ts} +5 -5
- package/dist/{node-BmerH3kS.d.cts → node-Dd6wHSib.d.cts} +71 -11
- package/dist/{node-BmerH3kS.d.ts → node-Dd6wHSib.d.ts} +71 -11
- package/dist/{observable-BgGUwcqp.d.ts → observable-BZJgo616.d.ts} +1 -1
- package/dist/{observable-DJt_AxzQ.d.cts → observable-kwzpLvbi.d.cts} +1 -1
- package/dist/patterns/ai/browser.cjs +25 -0
- package/dist/patterns/ai/browser.d.cts +127 -0
- package/dist/patterns/ai/browser.d.ts +127 -0
- package/dist/patterns/ai/browser.js +3 -0
- package/dist/patterns/ai/index.cjs +92 -0
- package/dist/patterns/ai/index.d.cts +17 -0
- package/dist/patterns/ai/index.d.ts +17 -0
- package/dist/patterns/ai/index.js +1 -0
- package/dist/patterns/ai/node.cjs +2 -0
- package/dist/patterns/ai/node.d.cts +58 -0
- package/dist/patterns/ai/node.d.ts +58 -0
- package/dist/patterns/ai/node.js +1 -0
- package/dist/patterns/audit/index.cjs +7 -0
- package/dist/patterns/audit/index.d.cts +6 -0
- package/dist/patterns/audit/index.d.ts +6 -0
- package/dist/patterns/audit/index.js +1 -0
- package/dist/patterns/cqrs/index.cjs +7 -0
- package/dist/patterns/cqrs/index.d.cts +5 -0
- package/dist/patterns/cqrs/index.d.ts +5 -0
- package/dist/patterns/cqrs/index.js +1 -0
- package/dist/patterns/demo-shell/index.cjs +8 -0
- package/dist/patterns/demo-shell/index.d.cts +6 -0
- package/dist/patterns/demo-shell/index.d.ts +6 -0
- package/dist/patterns/demo-shell/index.js +1 -0
- package/dist/patterns/domain-templates/index.cjs +7 -0
- package/dist/patterns/domain-templates/index.d.cts +5 -0
- package/dist/patterns/domain-templates/index.d.ts +5 -0
- package/dist/patterns/domain-templates/index.js +1 -0
- package/dist/patterns/graphspec/index.cjs +84 -0
- package/dist/patterns/graphspec/index.d.cts +7 -0
- package/dist/patterns/graphspec/index.d.ts +7 -0
- package/dist/patterns/graphspec/index.js +1 -0
- package/dist/patterns/guarded-execution/index.cjs +7 -0
- package/dist/patterns/guarded-execution/index.d.cts +7 -0
- package/dist/patterns/guarded-execution/index.d.ts +7 -0
- package/dist/patterns/guarded-execution/index.js +1 -0
- package/dist/patterns/harness/index.cjs +49 -0
- package/dist/patterns/harness/index.d.cts +11 -0
- package/dist/patterns/harness/index.d.ts +11 -0
- package/dist/patterns/harness/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +7 -0
- package/dist/patterns/job-queue/index.d.cts +5 -0
- package/dist/patterns/job-queue/index.d.ts +5 -0
- package/dist/patterns/job-queue/index.js +1 -0
- package/dist/patterns/lens/index.cjs +7 -0
- package/dist/patterns/lens/index.d.cts +7 -0
- package/dist/patterns/lens/index.d.ts +7 -0
- package/dist/patterns/lens/index.js +1 -0
- package/dist/patterns/memory/index.cjs +7 -0
- package/dist/patterns/memory/index.d.cts +5 -0
- package/dist/patterns/memory/index.d.ts +5 -0
- package/dist/patterns/memory/index.js +1 -0
- package/dist/patterns/messaging/index.cjs +7 -0
- package/dist/patterns/messaging/index.d.cts +5 -0
- package/dist/patterns/messaging/index.d.ts +5 -0
- package/dist/patterns/messaging/index.js +1 -0
- package/dist/patterns/orchestration/index.cjs +7 -0
- package/dist/patterns/orchestration/index.d.cts +6 -0
- package/dist/patterns/orchestration/index.d.ts +6 -0
- package/dist/patterns/orchestration/index.js +1 -0
- package/dist/patterns/reactive-layout/index.cjs +8 -6444
- package/dist/patterns/reactive-layout/index.d.cts +6 -6
- package/dist/patterns/reactive-layout/index.d.ts +6 -6
- package/dist/patterns/reactive-layout/index.js +1 -56
- package/dist/patterns/reduction/index.cjs +7 -0
- package/dist/patterns/reduction/index.d.cts +5 -0
- package/dist/patterns/reduction/index.d.ts +5 -0
- package/dist/patterns/reduction/index.js +1 -0
- package/dist/patterns/refine-loop/index.cjs +9 -0
- package/dist/patterns/refine-loop/index.d.cts +7 -0
- package/dist/patterns/refine-loop/index.d.ts +7 -0
- package/dist/patterns/refine-loop/index.js +1 -0
- package/dist/patterns/resilient-pipeline/index.cjs +1 -0
- package/dist/patterns/resilient-pipeline/index.d.cts +7 -0
- package/dist/patterns/resilient-pipeline/index.d.ts +7 -0
- package/dist/patterns/resilient-pipeline/index.js +1 -0
- package/dist/patterns/surface/index.cjs +15 -0
- package/dist/patterns/surface/index.d.cts +8 -0
- package/dist/patterns/surface/index.d.ts +8 -0
- package/dist/patterns/surface/index.js +1 -0
- package/dist/{reactive-layout-u5Ulnqag.d.ts → reactive-layout-BkBwVvwm.d.ts} +2 -2
- package/dist/{reactive-layout-MQP--J3F.d.cts → reactive-layout-PiFwVaWS.d.cts} +2 -2
- package/dist/reactive-log-1QTyx10a.d.ts +190 -0
- package/dist/reactive-log-BiVoSxke.d.cts +190 -0
- package/dist/{composite-aUCvjZVR.d.ts → reactive-map-CwO_COHy.d.cts} +2 -67
- package/dist/{composite-C7PcQvcs.d.cts → reactive-map-FeuTVAJb.d.ts} +2 -67
- package/dist/resilience-CBfYJW5C.d.ts +493 -0
- package/dist/resilience-XRUF267O.js +1 -0
- package/dist/resilience-uBz4yvYB.d.cts +493 -0
- package/dist/{sugar-CCOxXK1e.d.ts → sugar-CY-MCfZ9.d.ts} +17 -15
- package/dist/{sugar-D02n5JjF.d.cts → sugar-DHttV0LX.d.cts} +17 -15
- package/dist/topology-tree-CVjt2gp7.d.cts +25 -0
- package/dist/topology-tree-one6oSKY.d.ts +25 -0
- package/dist/types-O3GzJY2U.d.cts +401 -0
- package/dist/types-u64Ose53.d.ts +401 -0
- package/package.json +252 -22
- package/dist/ai-CaR_912Q.d.cts +0 -1033
- package/dist/ai-WlRltJV7.d.ts +0 -1033
- package/dist/chunk-3ZWCKRHX.js +0 -117
- package/dist/chunk-3ZWCKRHX.js.map +0 -1
- package/dist/chunk-7TAQJHQV.js +0 -103
- package/dist/chunk-7TAQJHQV.js.map +0 -1
- package/dist/chunk-APFNLIRG.js +0 -62
- package/dist/chunk-APFNLIRG.js.map +0 -1
- package/dist/chunk-AT5LKYNL.js +0 -395
- package/dist/chunk-AT5LKYNL.js.map +0 -1
- package/dist/chunk-BQ6RQQFF.js +0 -5087
- package/dist/chunk-BQ6RQQFF.js.map +0 -1
- package/dist/chunk-BVZYTZ5H.js +0 -599
- package/dist/chunk-BVZYTZ5H.js.map +0 -1
- package/dist/chunk-DST5DKZS.js +0 -1371
- package/dist/chunk-DST5DKZS.js.map +0 -1
- package/dist/chunk-GTE6PWRZ.js +0 -866
- package/dist/chunk-GTE6PWRZ.js.map +0 -1
- package/dist/chunk-HXZEYDUR.js +0 -94
- package/dist/chunk-HXZEYDUR.js.map +0 -1
- package/dist/chunk-J22W6HV3.js +0 -107
- package/dist/chunk-J22W6HV3.js.map +0 -1
- package/dist/chunk-J2VBW3DZ.js +0 -302
- package/dist/chunk-J2VBW3DZ.js.map +0 -1
- package/dist/chunk-JSCT3CR4.js +0 -38
- package/dist/chunk-JSCT3CR4.js.map +0 -1
- package/dist/chunk-JWBCY4NC.js +0 -330
- package/dist/chunk-JWBCY4NC.js.map +0 -1
- package/dist/chunk-K2AUJHVP.js +0 -2251
- package/dist/chunk-K2AUJHVP.js.map +0 -1
- package/dist/chunk-MJ2NKQQL.js +0 -119
- package/dist/chunk-MJ2NKQQL.js.map +0 -1
- package/dist/chunk-N6UR7YVY.js +0 -198
- package/dist/chunk-N6UR7YVY.js.map +0 -1
- package/dist/chunk-NC6S43JJ.js +0 -456
- package/dist/chunk-NC6S43JJ.js.map +0 -1
- package/dist/chunk-OFVJBJXR.js +0 -98
- package/dist/chunk-OFVJBJXR.js.map +0 -1
- package/dist/chunk-OHISZPOJ.js +0 -97
- package/dist/chunk-OHISZPOJ.js.map +0 -1
- package/dist/chunk-OU5CQKNW.js +0 -102
- package/dist/chunk-OU5CQKNW.js.map +0 -1
- package/dist/chunk-PF7GRZMW.js +0 -2712
- package/dist/chunk-PF7GRZMW.js.map +0 -1
- package/dist/chunk-PHOUUNK7.js +0 -2291
- package/dist/chunk-PHOUUNK7.js.map +0 -1
- package/dist/chunk-RNHBMHKA.js +0 -1665
- package/dist/chunk-RNHBMHKA.js.map +0 -1
- package/dist/chunk-SX52TAR4.js +0 -110
- package/dist/chunk-SX52TAR4.js.map +0 -1
- package/dist/chunk-VYPWMZ6H.js +0 -98
- package/dist/chunk-VYPWMZ6H.js.map +0 -1
- package/dist/chunk-WBZOVTYK.js +0 -171
- package/dist/chunk-WBZOVTYK.js.map +0 -1
- package/dist/chunk-WKNUIZOY.js +0 -354
- package/dist/chunk-WKNUIZOY.js.map +0 -1
- package/dist/chunk-X3VMZYBT.js +0 -713
- package/dist/chunk-X3VMZYBT.js.map +0 -1
- package/dist/chunk-X5R3GL6H.js +0 -525
- package/dist/chunk-X5R3GL6H.js.map +0 -1
- package/dist/chunk-XGPU467M.js +0 -136
- package/dist/chunk-XGPU467M.js.map +0 -1
- package/dist/compat/index.cjs.map +0 -1
- package/dist/compat/index.js.map +0 -1
- package/dist/compat/jotai/index.cjs.map +0 -1
- package/dist/compat/jotai/index.js.map +0 -1
- package/dist/compat/nanostores/index.cjs.map +0 -1
- package/dist/compat/nanostores/index.js.map +0 -1
- package/dist/compat/nestjs/index.cjs.map +0 -1
- package/dist/compat/nestjs/index.js.map +0 -1
- package/dist/compat/react/index.cjs.map +0 -1
- package/dist/compat/react/index.js.map +0 -1
- package/dist/compat/solid/index.cjs.map +0 -1
- package/dist/compat/solid/index.js.map +0 -1
- package/dist/compat/svelte/index.cjs.map +0 -1
- package/dist/compat/svelte/index.js.map +0 -1
- package/dist/compat/vue/index.cjs.map +0 -1
- package/dist/compat/vue/index.js.map +0 -1
- package/dist/compat/zustand/index.cjs.map +0 -1
- package/dist/compat/zustand/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.js.map +0 -1
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/patterns/ai.cjs +0 -7930
- package/dist/patterns/ai.cjs.map +0 -1
- package/dist/patterns/ai.d.cts +0 -10
- package/dist/patterns/ai.d.ts +0 -10
- package/dist/patterns/ai.js +0 -71
- package/dist/patterns/ai.js.map +0 -1
- package/dist/patterns/audit.cjs +0 -5805
- package/dist/patterns/audit.cjs.map +0 -1
- package/dist/patterns/audit.d.cts +0 -6
- package/dist/patterns/audit.d.ts +0 -6
- package/dist/patterns/audit.js +0 -29
- package/dist/patterns/audit.js.map +0 -1
- package/dist/patterns/demo-shell.cjs +0 -5604
- package/dist/patterns/demo-shell.cjs.map +0 -1
- package/dist/patterns/demo-shell.d.cts +0 -6
- package/dist/patterns/demo-shell.d.ts +0 -6
- package/dist/patterns/demo-shell.js +0 -15
- package/dist/patterns/demo-shell.js.map +0 -1
- package/dist/patterns/memory.cjs +0 -5283
- package/dist/patterns/memory.cjs.map +0 -1
- package/dist/patterns/memory.d.cts +0 -5
- package/dist/patterns/memory.d.ts +0 -5
- package/dist/patterns/memory.js +0 -20
- package/dist/patterns/memory.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/storage-CMjUUuxn.d.ts +0 -190
- package/dist/storage-DdWlZo6U.d.cts +0 -190
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { a as Node } from './node-Dd6wHSib.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Backoff strategies for {@link retry} (roadmap §3.1). Delays are in **nanoseconds**.
|
|
5
|
+
*
|
|
6
|
+
* Convention: all graphrefly-ts timestamps and durations use nanoseconds (`_ns` suffix).
|
|
7
|
+
* 1 second = 1_000_000_000 ns, 1 ms = 1_000_000 ns.
|
|
8
|
+
*/
|
|
9
|
+
declare const NS_PER_MS = 1000000;
|
|
10
|
+
declare const NS_PER_SEC = 1000000000;
|
|
11
|
+
type JitterMode = "none" | "full" | "equal";
|
|
12
|
+
type BackoffPreset = "constant" | "linear" | "exponential" | "fibonacci" | "decorrelatedJitter";
|
|
13
|
+
/** `(attempt, error?, previousDelayNs?) => delayNs | null` — `null` means zero delay. */
|
|
14
|
+
type BackoffStrategy = (attempt: number, error?: unknown, prevDelayNs?: number | null) => number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Builds a strategy that always returns the same delay in nanoseconds.
|
|
17
|
+
*
|
|
18
|
+
* @param delayNs - Non-negative delay in nanoseconds; values below zero are clamped to zero.
|
|
19
|
+
* @returns `BackoffStrategy` for use with {@link retry} or custom timers.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { constant, retry, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
24
|
+
*
|
|
25
|
+
* const out = retry(source, { count: 3, backoff: constant(0.25 * NS_PER_SEC) });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @category extra
|
|
29
|
+
*/
|
|
30
|
+
declare function constant(delayNs: number): BackoffStrategy;
|
|
31
|
+
/**
|
|
32
|
+
* Builds linear backoff: `baseNs + stepNs * attempt` (`stepNs` defaults to `baseNs`).
|
|
33
|
+
*
|
|
34
|
+
* @param baseNs - Base delay in nanoseconds (clamped non-negative).
|
|
35
|
+
* @param stepNs - Added per retry attempt in nanoseconds (clamped non-negative).
|
|
36
|
+
* @returns `BackoffStrategy` for {@link retry}.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { linear, retry, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
41
|
+
*
|
|
42
|
+
* // Attempt 0 → 1 s, attempt 1 → 2 s, attempt 2 → 3 s …
|
|
43
|
+
* const out = retry(source, { count: 4, backoff: linear(NS_PER_SEC) });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @category extra
|
|
47
|
+
*/
|
|
48
|
+
declare function linear(baseNs: number, stepNs?: number): BackoffStrategy;
|
|
49
|
+
type ExponentialBackoffOptions = {
|
|
50
|
+
baseNs?: number;
|
|
51
|
+
factor?: number;
|
|
52
|
+
maxDelayNs?: number;
|
|
53
|
+
jitter?: JitterMode;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Builds exponential backoff in nanoseconds, capped by `maxDelayNs`, with optional jitter.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Base, factor, cap, and jitter mode.
|
|
59
|
+
* @returns `BackoffStrategy` for {@link retry}.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* **Jitter:** `"full"` spreads delay across `[0, delay]`; `"equal"` uses `[delay/2, delay]`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { exponential, retry, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
67
|
+
*
|
|
68
|
+
* // 100 ms → 200 ms → 400 ms … capped at 30 s, with full jitter
|
|
69
|
+
* const out = retry(source, {
|
|
70
|
+
* count: 5,
|
|
71
|
+
* backoff: exponential({ baseNs: 100 * NS_PER_SEC / 1000, jitter: "full" }),
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @category extra
|
|
76
|
+
*/
|
|
77
|
+
declare function exponential(options?: ExponentialBackoffOptions): BackoffStrategy;
|
|
78
|
+
/**
|
|
79
|
+
* Builds Fibonacci-scaled delays: `1, 2, 3, 5, … × baseNs`, capped at `maxDelayNs`.
|
|
80
|
+
*
|
|
81
|
+
* @param baseNs - Multiplier applied to the Fibonacci unit (default `100ms` in nanoseconds).
|
|
82
|
+
* @param maxDelayNs - Upper bound in nanoseconds (default `30s`).
|
|
83
|
+
* @returns `BackoffStrategy` for {@link retry}.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* import { fibonacci, retry, NS_PER_MS } from "@graphrefly/graphrefly-ts";
|
|
88
|
+
*
|
|
89
|
+
* // Delays: 100 ms, 200 ms, 300 ms, 500 ms, 800 ms … (× 100 ms base)
|
|
90
|
+
* const out = retry(source, { count: 5, backoff: fibonacci(100 * NS_PER_MS) });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @category extra
|
|
94
|
+
*/
|
|
95
|
+
declare function fibonacci(baseNs?: number, maxDelayNs?: number): BackoffStrategy;
|
|
96
|
+
/**
|
|
97
|
+
* Decorrelated jitter (AWS-recommended): `random(baseNs, min(maxNs, lastDelay * 3))`.
|
|
98
|
+
*
|
|
99
|
+
* Stateless — uses `prevDelayNs` (passed by the consumer) instead of closure state.
|
|
100
|
+
* Safe to share across concurrent retry sequences.
|
|
101
|
+
*
|
|
102
|
+
* @param baseNs - Floor of the random range (default `100ms` in nanoseconds).
|
|
103
|
+
* @param maxNs - Ceiling cap (default `30s` in nanoseconds).
|
|
104
|
+
* @returns `BackoffStrategy` for {@link retry}.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* import { decorrelatedJitter, retry, NS_PER_MS, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
109
|
+
*
|
|
110
|
+
* const out = retry(source, {
|
|
111
|
+
* count: 6,
|
|
112
|
+
* backoff: decorrelatedJitter(100 * NS_PER_MS, 10 * NS_PER_SEC),
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @category extra
|
|
117
|
+
*/
|
|
118
|
+
declare function decorrelatedJitter(baseNs?: number, maxNs?: number): BackoffStrategy;
|
|
119
|
+
/**
|
|
120
|
+
* Decorator that caps any strategy at `maxAttempts`. Returns `null` (stop retrying) after the cap.
|
|
121
|
+
*
|
|
122
|
+
* @param strategy - Inner strategy to wrap.
|
|
123
|
+
* @param maxAttempts - Maximum number of attempts (inclusive).
|
|
124
|
+
* @returns Wrapped `BackoffStrategy`.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { withMaxAttempts, exponential } from "@graphrefly/graphrefly-ts";
|
|
129
|
+
*
|
|
130
|
+
* const capped = withMaxAttempts(exponential(), 3);
|
|
131
|
+
* capped(3); // null — no more retries beyond attempt 3
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @category extra
|
|
135
|
+
*/
|
|
136
|
+
declare function withMaxAttempts(strategy: BackoffStrategy, maxAttempts: number): BackoffStrategy;
|
|
137
|
+
/**
|
|
138
|
+
* Maps a preset name to a concrete {@link BackoffStrategy} with library-default parameters.
|
|
139
|
+
*
|
|
140
|
+
* @param name - One of `constant`, `linear`, `exponential`, `fibonacci`, or `decorrelatedJitter`.
|
|
141
|
+
* @returns Configured strategy with default parameters.
|
|
142
|
+
* @throws Error when `name` is not a known preset.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* import { resolveBackoffPreset, retry } from "@graphrefly/graphrefly-ts";
|
|
147
|
+
*
|
|
148
|
+
* const out = retry(source, { count: 3, backoff: resolveBackoffPreset("exponential") });
|
|
149
|
+
* // Equivalent to retry(source, { count: 3, backoff: exponential() })
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @category extra
|
|
153
|
+
*/
|
|
154
|
+
declare function resolveBackoffPreset(name: BackoffPreset): BackoffStrategy;
|
|
155
|
+
|
|
156
|
+
type RetryOptions = {
|
|
157
|
+
/** Max retry attempts after each terminal `ERROR` (not counting the first failure). */
|
|
158
|
+
count?: number;
|
|
159
|
+
/** Delay between attempts; strategies use **nanoseconds**. */
|
|
160
|
+
backoff?: BackoffStrategy | BackoffPreset;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Resubscribes to the upstream node after each terminal `ERROR`, after an optional delay.
|
|
164
|
+
*
|
|
165
|
+
* @param source - Upstream node (should use `resubscribable: true`).
|
|
166
|
+
* @param opts - `count` caps attempts; `backoff` supplies delay in **nanoseconds** (or a preset name).
|
|
167
|
+
* @returns Node that retries on error.
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
* **Resubscribable sources:** The upstream should use `resubscribable: true` if it must emit again after `ERROR`.
|
|
171
|
+
* **Protocol:** Forwards unknown message tuples unchanged; handles `DIRTY`, `DATA`, `RESOLVED`, `COMPLETE`, `ERROR`.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* import { ERROR, NS_PER_SEC, pipe, producer, retry, constant } from "@graphrefly/graphrefly-ts";
|
|
176
|
+
*
|
|
177
|
+
* const src = producer(
|
|
178
|
+
* (a) => {
|
|
179
|
+
* a.down([[ERROR, new Error("x")]]);
|
|
180
|
+
* },
|
|
181
|
+
* { resubscribable: true },
|
|
182
|
+
* );
|
|
183
|
+
* const out = retry(src, { count: 2, backoff: constant(0.25 * NS_PER_SEC) });
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @category extra
|
|
187
|
+
*/
|
|
188
|
+
declare function retry<T>(source: Node<T>, opts?: RetryOptions): Node<T>;
|
|
189
|
+
/**
|
|
190
|
+
* Options for {@link retrySource}. Superset of {@link RetryOptions} with an
|
|
191
|
+
* optional `initial` forwarded to the outer node cache.
|
|
192
|
+
*
|
|
193
|
+
* @category extra
|
|
194
|
+
*/
|
|
195
|
+
type RetrySourceOptions<T> = RetryOptions & {
|
|
196
|
+
/** Initial cache value for the outer node (forwarded to `NodeOptions.initial`). */
|
|
197
|
+
initial?: T;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Fresh-instance variant of {@link retry}: invokes the `factory` to build a
|
|
201
|
+
* new `Node<T>` on every connect / reconnect. Unlike {@link retry}, which
|
|
202
|
+
* re-subscribes to the same node (requiring `resubscribable: true`), this
|
|
203
|
+
* creates a new source per attempt — ideal for producers that capture
|
|
204
|
+
* per-attempt resources (sockets, clients, file handles) that become unusable
|
|
205
|
+
* after an error.
|
|
206
|
+
*
|
|
207
|
+
* Synchronous exceptions thrown by `factory` are treated as terminal ERROR
|
|
208
|
+
* and run through the same retry pipeline as inner-node ERROR.
|
|
209
|
+
*
|
|
210
|
+
* @param factory - Called to build a fresh source per attempt.
|
|
211
|
+
* @param opts - `count` caps attempts; `backoff` supplies delay (ns) or preset.
|
|
212
|
+
* @returns Node that retries by rebuilding the source.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* import { NS_PER_SEC, exponential, retrySource, fromWebSocket } from "@graphrefly/graphrefly-ts";
|
|
217
|
+
*
|
|
218
|
+
* // Each reconnect opens a fresh WebSocket:
|
|
219
|
+
* const connected$ = retrySource(
|
|
220
|
+
* () => fromWebSocket(new WebSocket("wss://example/stream")),
|
|
221
|
+
* { count: 10, backoff: exponential({ baseNs: 1 * NS_PER_SEC }) },
|
|
222
|
+
* );
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* @category extra
|
|
226
|
+
*/
|
|
227
|
+
declare function retrySource<T>(factory: () => Node<T>, opts?: RetrySourceOptions<T>): Node<T>;
|
|
228
|
+
type CircuitState = "closed" | "open" | "half-open";
|
|
229
|
+
/**
|
|
230
|
+
* Thrown when {@link withBreaker} is configured with `onOpen: "error"` and the breaker rejects work.
|
|
231
|
+
*
|
|
232
|
+
* @category extra
|
|
233
|
+
*/
|
|
234
|
+
declare class CircuitOpenError extends Error {
|
|
235
|
+
name: string;
|
|
236
|
+
constructor();
|
|
237
|
+
}
|
|
238
|
+
interface CircuitBreakerOptions {
|
|
239
|
+
/** Number of consecutive failures before opening. Default: 5. */
|
|
240
|
+
failureThreshold?: number;
|
|
241
|
+
/** Base cooldown in nanoseconds before transitioning to half-open. Default: 30s. */
|
|
242
|
+
cooldownNs?: number;
|
|
243
|
+
/** Backoff strategy for cooldown escalation across consecutive open cycles. Overrides `cooldownNs` when provided. */
|
|
244
|
+
cooldown?: BackoffStrategy;
|
|
245
|
+
/** Max trial requests allowed in half-open state. Default: 1. */
|
|
246
|
+
halfOpenMax?: number;
|
|
247
|
+
/** Clock function returning nanoseconds (for testability). Default: `monotonicNs`. */
|
|
248
|
+
now?: () => number;
|
|
249
|
+
}
|
|
250
|
+
interface CircuitBreaker {
|
|
251
|
+
/** Whether a request should be allowed through. Triggers open→half-open transition when cooldown expires. */
|
|
252
|
+
canExecute(): boolean;
|
|
253
|
+
/** Record a successful execution. Resets to closed. */
|
|
254
|
+
recordSuccess(): void;
|
|
255
|
+
/** Record a failed execution. May transition to open. */
|
|
256
|
+
recordFailure(error?: unknown): void;
|
|
257
|
+
/** Current circuit state (read-only, does not trigger transitions). */
|
|
258
|
+
readonly state: CircuitState;
|
|
259
|
+
/** Number of consecutive failures in the current closed period. */
|
|
260
|
+
readonly failureCount: number;
|
|
261
|
+
/** Manually reset to closed state, clearing all counters. */
|
|
262
|
+
reset(): void;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Factory for a synchronous circuit breaker with `closed`, `open`, and `half-open` states.
|
|
266
|
+
*
|
|
267
|
+
* Supports escalating cooldown via an optional {@link BackoffStrategy} — each consecutive
|
|
268
|
+
* open→half-open→open cycle increments the backoff attempt.
|
|
269
|
+
*
|
|
270
|
+
* @param options - Threshold, cooldown, half-open limit, and optional clock override.
|
|
271
|
+
* @returns {@link CircuitBreaker} instance.
|
|
272
|
+
*
|
|
273
|
+
* @remarks
|
|
274
|
+
* **Timing:** Uses `monotonicNs()` by default (nanoseconds). Override `now` for tests.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* import { circuitBreaker, exponential, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
279
|
+
*
|
|
280
|
+
* const b = circuitBreaker({
|
|
281
|
+
* failureThreshold: 3,
|
|
282
|
+
* cooldown: exponential({ baseNs: 1 * NS_PER_SEC }),
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @category extra
|
|
287
|
+
*/
|
|
288
|
+
declare function circuitBreaker(options?: CircuitBreakerOptions): CircuitBreaker;
|
|
289
|
+
type WithBreakerBundle<T> = {
|
|
290
|
+
node: Node<T>;
|
|
291
|
+
breakerState: Node<CircuitState>;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Returns a unary wrapper that gates upstream `DATA` through a {@link CircuitBreaker}.
|
|
295
|
+
*
|
|
296
|
+
* @param breaker - Shared breaker instance (typically one per resource).
|
|
297
|
+
* @param options - `onOpen: "skip"` emits `RESOLVED` when open; `"error"` emits {@link CircuitOpenError}.
|
|
298
|
+
* @returns Function mapping `Node<T>` to `{ node, breakerState }` companion nodes.
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* **Success path:** `COMPLETE` calls {@link CircuitBreaker.recordSuccess}. **Failure path:** upstream `ERROR` calls {@link CircuitBreaker.recordFailure} and is forwarded.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* import { state, withBreaker, circuitBreaker } from "@graphrefly/graphrefly-ts";
|
|
306
|
+
*
|
|
307
|
+
* const b = circuitBreaker({ failureThreshold: 2 });
|
|
308
|
+
* const s = state(1);
|
|
309
|
+
* const { node, breakerState } = withBreaker(b)(s);
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @category extra
|
|
313
|
+
*/
|
|
314
|
+
declare function withBreaker<T>(breaker: CircuitBreaker, options?: {
|
|
315
|
+
onOpen?: "skip" | "error";
|
|
316
|
+
}): (source: Node<T>) => WithBreakerBundle<T>;
|
|
317
|
+
interface TokenBucket {
|
|
318
|
+
/** Number of tokens currently available (after refill). */
|
|
319
|
+
available(): number;
|
|
320
|
+
/** Try to consume `cost` tokens. Returns `true` if successful. */
|
|
321
|
+
tryConsume(cost?: number): boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Return `cost` tokens to the bucket (capped at capacity). Used when a
|
|
324
|
+
* multi-bucket admission fails partway — e.g., `adaptiveRateLimiter`
|
|
325
|
+
* consumes from an rpm bucket, then a tpm bucket; if tpm fails, call
|
|
326
|
+
* `rpmBucket.putBack(requestCost)` so the rpm slot isn't wasted.
|
|
327
|
+
* No-op for non-positive `cost`.
|
|
328
|
+
*/
|
|
329
|
+
putBack(cost?: number): void;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Token-bucket meter (capacity + refill rate per second). Use with {@link rateLimiter} or custom gates.
|
|
333
|
+
*
|
|
334
|
+
* @param capacity - Maximum tokens (must be positive).
|
|
335
|
+
* @param refillPerSecond - Tokens added per elapsed second (non-negative).
|
|
336
|
+
* @returns {@link TokenBucket} instance.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```ts
|
|
340
|
+
* import { tokenBucket } from "@graphrefly/graphrefly-ts";
|
|
341
|
+
*
|
|
342
|
+
* const bucket = tokenBucket(10, 2); // capacity 10, refill 2 tokens/sec
|
|
343
|
+
* bucket.tryConsume(3); // true — 7 tokens remaining
|
|
344
|
+
* bucket.available(); // ~7 (plus any elapsed refill)
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* @category extra
|
|
348
|
+
*/
|
|
349
|
+
declare function tokenBucket(capacity: number, refillPerSecond: number): TokenBucket;
|
|
350
|
+
type RateLimiterOverflowPolicy = "drop-oldest" | "drop-newest" | "error";
|
|
351
|
+
type RateLimiterOptions = {
|
|
352
|
+
/** Maximum `DATA` emissions per window (must be > 0). */
|
|
353
|
+
maxEvents: number;
|
|
354
|
+
/** Window length in nanoseconds (must be > 0). */
|
|
355
|
+
windowNs: number;
|
|
356
|
+
/** Cap on items queued while waiting for token refill (must be >= 1). Unbounded if omitted. */
|
|
357
|
+
maxBuffer?: number;
|
|
358
|
+
/** Overflow policy when `maxBuffer` is exceeded. Default: `"drop-newest"`. */
|
|
359
|
+
onOverflow?: RateLimiterOverflowPolicy;
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Thrown by {@link rateLimiter} when `onOverflow: "error"` and the pending buffer is full.
|
|
363
|
+
*
|
|
364
|
+
* @category extra
|
|
365
|
+
*/
|
|
366
|
+
declare class RateLimiterOverflowError extends Error {
|
|
367
|
+
name: string;
|
|
368
|
+
constructor(maxBuffer: number);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Token-bucket rate limiter: at most `maxEvents` `DATA` values per `windowNs`.
|
|
372
|
+
*
|
|
373
|
+
* Uses {@link tokenBucket} internally (capacity = `maxEvents`, refill = `maxEvents / windowSeconds`).
|
|
374
|
+
* Excess items are queued FIFO until a token is available. The queue may be bounded via
|
|
375
|
+
* `maxBuffer` with a configurable overflow policy.
|
|
376
|
+
*
|
|
377
|
+
* @param source - Upstream node.
|
|
378
|
+
* @param opts - Rate + optional bounded-buffer configuration.
|
|
379
|
+
* @returns Node that emits DATA at most `maxEvents` per `windowNs`.
|
|
380
|
+
*
|
|
381
|
+
* @remarks
|
|
382
|
+
* **Terminal:** `COMPLETE` / `ERROR` cancel the refill timer, drop the pending queue, and propagate.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```ts
|
|
386
|
+
* import { rateLimiter, state, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
387
|
+
*
|
|
388
|
+
* const src = state(0);
|
|
389
|
+
* // Allow at most 5 DATA values per second; queue up to 100 excess items, drop newest beyond.
|
|
390
|
+
* const limited = rateLimiter(src, { maxEvents: 5, windowNs: NS_PER_SEC, maxBuffer: 100 });
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @category extra
|
|
394
|
+
*/
|
|
395
|
+
declare function rateLimiter<T>(source: Node<T>, opts: RateLimiterOptions): Node<T>;
|
|
396
|
+
type StatusValue = "pending" | "active" | "completed" | "errored";
|
|
397
|
+
type WithStatusBundle<T> = {
|
|
398
|
+
node: Node<T>;
|
|
399
|
+
status: Node<StatusValue>;
|
|
400
|
+
error: Node<unknown | null>;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* Wraps `src` with `status` and `error` {@link state} companions for UI or meta snapshots.
|
|
404
|
+
*
|
|
405
|
+
* @param src - Upstream node to mirror.
|
|
406
|
+
* @param options - `initialStatus` defaults to `"pending"`.
|
|
407
|
+
* @returns `{ node, status, error }` where `error` holds the last `ERROR` payload.
|
|
408
|
+
*
|
|
409
|
+
* @remarks
|
|
410
|
+
* **Recovery:** After `errored`, the next `DATA` clears `error` and sets `active` inside {@link batch} (matches graphrefly-py).
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* import { withStatus, state } from "@graphrefly/graphrefly-ts";
|
|
415
|
+
*
|
|
416
|
+
* const src = state<number>(0);
|
|
417
|
+
* const { node, status, error } = withStatus(src);
|
|
418
|
+
*
|
|
419
|
+
* status.subscribe((msgs) => console.log("status:", msgs));
|
|
420
|
+
* src.down([[DATA, 42]]); // status → "active"
|
|
421
|
+
* ```
|
|
422
|
+
*
|
|
423
|
+
* @category extra
|
|
424
|
+
*/
|
|
425
|
+
declare function withStatus<T>(src: Node<T>, options?: {
|
|
426
|
+
initialStatus?: StatusValue;
|
|
427
|
+
}): WithStatusBundle<T>;
|
|
428
|
+
/**
|
|
429
|
+
* Thrown by {@link timeout} when no `DATA` arrives within the deadline.
|
|
430
|
+
*
|
|
431
|
+
* @category extra
|
|
432
|
+
*/
|
|
433
|
+
declare class TimeoutError extends Error {
|
|
434
|
+
name: string;
|
|
435
|
+
constructor(ns: number);
|
|
436
|
+
}
|
|
437
|
+
/** Inputs accepted by {@link fallback}. */
|
|
438
|
+
type FallbackInput<T> = T | Node<T> | PromiseLike<T> | AsyncIterable<T>;
|
|
439
|
+
/**
|
|
440
|
+
* On upstream terminal `ERROR`, switch to a fallback source instead of propagating the error.
|
|
441
|
+
*
|
|
442
|
+
* Accepts any of:
|
|
443
|
+
* - **scalar value** — emits `[[DATA, fb], [COMPLETE]]`
|
|
444
|
+
* - **`Node<T>`** — subscribes and forwards all messages (push-on-subscribe delivers current cache)
|
|
445
|
+
* - **`Promise<T>` / thenable** — resolves into a one-shot `DATA` then `COMPLETE` (via {@link fromAny})
|
|
446
|
+
* - **`AsyncIterable<T>`** — streams each yielded value as `DATA`, then `COMPLETE` (via {@link fromAny})
|
|
447
|
+
*
|
|
448
|
+
* Non-`Node` inputs are routed through {@link fromAny} so the fallback participates in the
|
|
449
|
+
* reactive protocol uniformly. Bare strings, arrays, and other synchronous scalars are treated
|
|
450
|
+
* as single values (NOT split into characters / elements) to avoid the `fromAny`-on-string
|
|
451
|
+
* iteration gotcha.
|
|
452
|
+
*
|
|
453
|
+
* Composes naturally with {@link retry}:
|
|
454
|
+
* `pipe(source, retry({count:3}), fallback("default"))`.
|
|
455
|
+
*
|
|
456
|
+
* @param source - Upstream node.
|
|
457
|
+
* @param fb - Fallback value, node, promise, or async iterable.
|
|
458
|
+
* @returns Node that replaces errors with the fallback.
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* import { fallback, throwError } from "@graphrefly/graphrefly-ts";
|
|
463
|
+
*
|
|
464
|
+
* const safe = fallback(throwError(new Error("boom")), "default");
|
|
465
|
+
* safe.cache; // "default" after subscribe
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* @category extra
|
|
469
|
+
*/
|
|
470
|
+
declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>): Node<T>;
|
|
471
|
+
/**
|
|
472
|
+
* Emits `ERROR` with {@link TimeoutError} if no `DATA` arrives within the deadline.
|
|
473
|
+
*
|
|
474
|
+
* The timer starts on subscription and resets on each `DATA`. `DIRTY` does NOT reset
|
|
475
|
+
* the timer. Terminal messages (`COMPLETE`/`ERROR`) cancel the timer.
|
|
476
|
+
*
|
|
477
|
+
* @param source - Upstream node.
|
|
478
|
+
* @param timeoutNs - Deadline in nanoseconds.
|
|
479
|
+
* @returns Node that errors on timeout.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```ts
|
|
483
|
+
* import { timeout, never, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
484
|
+
*
|
|
485
|
+
* const t = timeout(never(), 5 * NS_PER_SEC);
|
|
486
|
+
* // After 5 seconds with no DATA: [[ERROR, TimeoutError]]
|
|
487
|
+
* ```
|
|
488
|
+
*
|
|
489
|
+
* @category extra
|
|
490
|
+
*/
|
|
491
|
+
declare function timeout<T>(source: Node<T>, timeoutNs: number): Node<T>;
|
|
492
|
+
|
|
493
|
+
export { withStatus as A, type BackoffPreset as B, type CircuitState as C, type ExponentialBackoffOptions as E, type FallbackInput as F, type JitterMode as J, NS_PER_MS as N, type RateLimiterOptions as R, type StatusValue as S, TimeoutError as T, type WithBreakerBundle as W, type CircuitBreakerOptions as a, type RetryOptions as b, NS_PER_SEC as c, type BackoffStrategy as d, type CircuitBreaker as e, CircuitOpenError as f, RateLimiterOverflowError as g, type RateLimiterOverflowPolicy as h, type RetrySourceOptions as i, type TokenBucket as j, type WithStatusBundle as k, circuitBreaker as l, constant as m, decorrelatedJitter as n, exponential as o, fallback as p, fibonacci as q, linear as r, rateLimiter as s, resolveBackoffPreset as t, retry as u, retrySource as v, timeout as w, tokenBucket as x, withBreaker as y, withMaxAttempts as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-OL33ZI6R.js";import"./chunk-ESMPEKEV.js";import"./chunk-4VVTGLXJ.js";import"./chunk-KASHOCF5.js";import"./chunk-W4TSQ6RJ.js";import"./chunk-CK2E7BTU.js";import"./chunk-QYADASLV.js";export{c as CircuitOpenError,g as RateLimiterOverflowError,j as TimeoutError,d as circuitBreaker,k as fallback,h as rateLimiter,a as retry,b as retrySource,l as timeout,f as tokenBucket,e as withBreaker,i as withStatus};
|