@graphrefly/graphrefly 0.44.0 → 0.45.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/README.md +21 -17
- package/dist/compat/index.cjs +20 -10
- package/dist/compat/index.cjs.map +1 -0
- package/dist/compat/index.d.cts +1 -22
- package/dist/compat/index.d.ts +1 -22
- package/dist/compat/index.js +3 -1
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/jotai/index.cjs +21 -1
- package/dist/compat/jotai/index.cjs.map +1 -0
- package/dist/compat/jotai/index.d.cts +1 -2
- package/dist/compat/jotai/index.d.ts +1 -2
- package/dist/compat/jotai/index.js +3 -1
- package/dist/compat/jotai/index.js.map +1 -0
- package/dist/compat/nanostores/index.cjs +21 -1
- package/dist/compat/nanostores/index.cjs.map +1 -0
- package/dist/compat/nanostores/index.d.cts +1 -2
- package/dist/compat/nanostores/index.d.ts +1 -2
- package/dist/compat/nanostores/index.js +3 -1
- package/dist/compat/nanostores/index.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +20 -10
- package/dist/compat/nestjs/index.cjs.map +1 -0
- package/dist/compat/nestjs/index.d.cts +1 -13
- package/dist/compat/nestjs/index.d.ts +1 -13
- package/dist/compat/nestjs/index.js +3 -1
- package/dist/compat/nestjs/index.js.map +1 -0
- package/dist/compat/react/index.cjs +21 -1
- package/dist/compat/react/index.cjs.map +1 -0
- package/dist/compat/react/index.d.cts +1 -2
- package/dist/compat/react/index.d.ts +1 -2
- package/dist/compat/react/index.js +3 -1
- package/dist/compat/react/index.js.map +1 -0
- package/dist/compat/solid/index.cjs +21 -1
- package/dist/compat/solid/index.cjs.map +1 -0
- package/dist/compat/solid/index.d.cts +1 -2
- package/dist/compat/solid/index.d.ts +1 -2
- package/dist/compat/solid/index.js +3 -1
- package/dist/compat/solid/index.js.map +1 -0
- package/dist/compat/svelte/index.cjs +21 -1
- package/dist/compat/svelte/index.cjs.map +1 -0
- package/dist/compat/svelte/index.d.cts +1 -2
- package/dist/compat/svelte/index.d.ts +1 -2
- package/dist/compat/svelte/index.js +3 -1
- package/dist/compat/svelte/index.js.map +1 -0
- package/dist/compat/vue/index.cjs +21 -1
- package/dist/compat/vue/index.cjs.map +1 -0
- package/dist/compat/vue/index.d.cts +1 -3
- package/dist/compat/vue/index.d.ts +1 -3
- package/dist/compat/vue/index.js +3 -1
- package/dist/compat/vue/index.js.map +1 -0
- package/dist/compat/zustand/index.cjs +21 -3
- package/dist/compat/zustand/index.cjs.map +1 -0
- package/dist/compat/zustand/index.d.cts +1 -6
- package/dist/compat/zustand/index.d.ts +1 -6
- package/dist/compat/zustand/index.js +3 -1
- package/dist/compat/zustand/index.js.map +1 -0
- package/dist/core/index.cjs +21 -1
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +1 -3
- package/dist/core/index.d.ts +1 -3
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -0
- package/dist/extra/browser.cjs +21 -1
- package/dist/extra/browser.cjs.map +1 -0
- package/dist/extra/browser.d.cts +1 -4
- package/dist/extra/browser.d.ts +1 -4
- package/dist/extra/browser.js +3 -1
- package/dist/extra/browser.js.map +1 -0
- package/dist/extra/index.cjs +20 -19
- package/dist/extra/index.cjs.map +1 -0
- package/dist/extra/index.d.cts +1 -17
- package/dist/extra/index.d.ts +1 -17
- package/dist/extra/index.js +3 -1
- package/dist/extra/index.js.map +1 -0
- package/dist/extra/node.cjs +21 -2
- package/dist/extra/node.cjs.map +1 -0
- package/dist/extra/node.d.cts +1 -187
- package/dist/extra/node.d.ts +1 -187
- package/dist/extra/node.js +3 -2
- package/dist/extra/node.js.map +1 -0
- package/dist/extra/operators.cjs +21 -1
- package/dist/extra/operators.cjs.map +1 -0
- package/dist/extra/operators.d.cts +1 -958
- package/dist/extra/operators.d.ts +1 -958
- package/dist/extra/operators.js +3 -1
- package/dist/extra/operators.js.map +1 -0
- package/dist/extra/reactive.cjs +21 -1
- package/dist/extra/reactive.cjs.map +1 -0
- package/dist/extra/reactive.d.cts +1 -353
- package/dist/extra/reactive.d.ts +1 -353
- package/dist/extra/reactive.js +3 -1
- package/dist/extra/reactive.js.map +1 -0
- package/dist/extra/render/index.cjs +21 -5
- package/dist/extra/render/index.cjs.map +1 -0
- package/dist/extra/render/index.d.cts +1 -183
- package/dist/extra/render/index.d.ts +1 -183
- package/dist/extra/render/index.js +3 -1
- package/dist/extra/render/index.js.map +1 -0
- package/dist/extra/sources.cjs +21 -3
- package/dist/extra/sources.cjs.map +1 -0
- package/dist/extra/sources.d.cts +1 -584
- package/dist/extra/sources.d.ts +1 -584
- package/dist/extra/sources.js +3 -1
- package/dist/extra/sources.js.map +1 -0
- package/dist/extra/storage-browser.cjs +21 -1
- package/dist/extra/storage-browser.cjs.map +1 -0
- package/dist/extra/storage-browser.d.cts +1 -37
- package/dist/extra/storage-browser.d.ts +1 -37
- package/dist/extra/storage-browser.js +3 -1
- package/dist/extra/storage-browser.js.map +1 -0
- package/dist/extra/storage-core.cjs +21 -1
- package/dist/extra/storage-core.cjs.map +1 -0
- package/dist/extra/storage-core.d.cts +1 -28
- package/dist/extra/storage-core.d.ts +1 -28
- package/dist/extra/storage-core.js +3 -1
- package/dist/extra/storage-core.js.map +1 -0
- package/dist/extra/storage-node.cjs +20 -0
- package/dist/extra/storage-node.cjs.map +1 -0
- package/dist/extra/storage-node.d.cts +1 -2
- package/dist/extra/storage-node.d.ts +1 -2
- package/dist/extra/storage-node.js +3 -0
- package/dist/extra/storage-node.js.map +1 -0
- package/dist/extra/storage-tiers-browser.cjs +21 -1
- package/dist/extra/storage-tiers-browser.cjs.map +1 -0
- package/dist/extra/storage-tiers-browser.d.cts +1 -120
- package/dist/extra/storage-tiers-browser.d.ts +1 -120
- package/dist/extra/storage-tiers-browser.js +3 -1
- package/dist/extra/storage-tiers-browser.js.map +1 -0
- package/dist/extra/storage-tiers-node.cjs +21 -1
- package/dist/extra/storage-tiers-node.cjs.map +1 -0
- package/dist/extra/storage-tiers-node.d.cts +1 -210
- package/dist/extra/storage-tiers-node.d.ts +1 -210
- package/dist/extra/storage-tiers-node.js +3 -1
- package/dist/extra/storage-tiers-node.js.map +1 -0
- package/dist/extra/storage-tiers.cjs +21 -1
- package/dist/extra/storage-tiers.cjs.map +1 -0
- package/dist/extra/storage-tiers.d.cts +1 -412
- package/dist/extra/storage-tiers.d.ts +1 -412
- package/dist/extra/storage-tiers.js +3 -1
- package/dist/extra/storage-tiers.js.map +1 -0
- package/dist/extra/storage-wal.cjs +21 -0
- package/dist/extra/storage-wal.cjs.map +1 -0
- package/dist/extra/storage-wal.d.cts +1 -0
- package/dist/extra/storage-wal.d.ts +1 -0
- package/dist/extra/storage-wal.js +3 -0
- package/dist/extra/storage-wal.js.map +1 -0
- package/dist/graph/index.cjs +21 -7
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +1 -7
- package/dist/graph/index.d.ts +1 -7
- package/dist/graph/index.js +3 -1
- package/dist/graph/index.js.map +1 -0
- package/dist/index.cjs +20 -227
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +45 -95
- package/dist/index.d.ts +45 -95
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -0
- package/dist/patterns/ai/browser.cjs +20 -7
- package/dist/patterns/ai/browser.cjs.map +1 -0
- package/dist/patterns/ai/browser.d.cts +1 -127
- package/dist/patterns/ai/browser.d.ts +1 -127
- package/dist/patterns/ai/browser.js +3 -3
- package/dist/patterns/ai/browser.js.map +1 -0
- package/dist/patterns/ai/index.cjs +20 -73
- package/dist/patterns/ai/index.cjs.map +1 -0
- package/dist/patterns/ai/index.d.cts +1 -20
- package/dist/patterns/ai/index.d.ts +1 -20
- package/dist/patterns/ai/index.js +3 -1
- package/dist/patterns/ai/index.js.map +1 -0
- package/dist/patterns/ai/node.cjs +21 -1
- package/dist/patterns/ai/node.cjs.map +1 -0
- package/dist/patterns/ai/node.d.cts +1 -59
- package/dist/patterns/ai/node.d.ts +1 -59
- package/dist/patterns/ai/node.js +3 -1
- package/dist/patterns/ai/node.js.map +1 -0
- package/dist/patterns/cqrs/index.cjs +21 -3
- package/dist/patterns/cqrs/index.cjs.map +1 -0
- package/dist/patterns/cqrs/index.d.cts +1 -8
- package/dist/patterns/cqrs/index.d.ts +1 -8
- package/dist/patterns/cqrs/index.js +3 -1
- package/dist/patterns/cqrs/index.js.map +1 -0
- package/dist/patterns/demo-shell/index.cjs +21 -5
- package/dist/patterns/demo-shell/index.cjs.map +1 -0
- package/dist/patterns/demo-shell/index.d.cts +1 -7
- package/dist/patterns/demo-shell/index.d.ts +1 -7
- package/dist/patterns/demo-shell/index.js +3 -1
- package/dist/patterns/demo-shell/index.js.map +1 -0
- package/dist/patterns/domain-templates/index.cjs +21 -3
- package/dist/patterns/domain-templates/index.cjs.map +1 -0
- package/dist/patterns/domain-templates/index.d.cts +1 -6
- package/dist/patterns/domain-templates/index.d.ts +1 -6
- package/dist/patterns/domain-templates/index.js +3 -1
- package/dist/patterns/domain-templates/index.js.map +1 -0
- package/dist/patterns/graphspec/index.cjs +21 -86
- package/dist/patterns/graphspec/index.cjs.map +1 -0
- package/dist/patterns/graphspec/index.d.cts +1 -8
- package/dist/patterns/graphspec/index.d.ts +1 -8
- package/dist/patterns/graphspec/index.js +3 -1
- package/dist/patterns/graphspec/index.js.map +1 -0
- package/dist/patterns/harness/index.cjs +21 -48
- package/dist/patterns/harness/index.cjs.map +1 -0
- package/dist/patterns/harness/index.d.cts +1 -13
- package/dist/patterns/harness/index.d.ts +1 -13
- package/dist/patterns/harness/index.js +3 -1
- package/dist/patterns/harness/index.js.map +1 -0
- package/dist/patterns/inspect/index.cjs +21 -3
- package/dist/patterns/inspect/index.cjs.map +1 -0
- package/dist/patterns/inspect/index.d.cts +1 -9
- package/dist/patterns/inspect/index.d.ts +1 -9
- package/dist/patterns/inspect/index.js +3 -1
- package/dist/patterns/inspect/index.js.map +1 -0
- package/dist/patterns/job-queue/index.cjs +21 -3
- package/dist/patterns/job-queue/index.cjs.map +1 -0
- package/dist/patterns/job-queue/index.d.cts +1 -9
- package/dist/patterns/job-queue/index.d.ts +1 -9
- package/dist/patterns/job-queue/index.js +3 -1
- package/dist/patterns/job-queue/index.js.map +1 -0
- package/dist/patterns/memory/index.cjs +21 -3
- package/dist/patterns/memory/index.cjs.map +1 -0
- package/dist/patterns/memory/index.d.cts +1 -8
- package/dist/patterns/memory/index.d.ts +1 -8
- package/dist/patterns/memory/index.js +3 -1
- package/dist/patterns/memory/index.js.map +1 -0
- package/dist/patterns/messaging/index.cjs +21 -3
- package/dist/patterns/messaging/index.cjs.map +1 -0
- package/dist/patterns/messaging/index.d.cts +1 -7
- package/dist/patterns/messaging/index.d.ts +1 -7
- package/dist/patterns/messaging/index.js +3 -1
- package/dist/patterns/messaging/index.js.map +1 -0
- package/dist/patterns/orchestration/index.cjs +21 -3
- package/dist/patterns/orchestration/index.cjs.map +1 -0
- package/dist/patterns/orchestration/index.d.cts +1 -8
- package/dist/patterns/orchestration/index.d.ts +1 -8
- package/dist/patterns/orchestration/index.js +3 -1
- package/dist/patterns/orchestration/index.js.map +1 -0
- package/dist/patterns/process/index.cjs +21 -3
- package/dist/patterns/process/index.cjs.map +1 -0
- package/dist/patterns/process/index.d.cts +1 -10
- package/dist/patterns/process/index.d.ts +1 -10
- package/dist/patterns/process/index.js +3 -1
- package/dist/patterns/process/index.js.map +1 -0
- package/dist/patterns/reactive-layout/index.cjs +21 -4
- package/dist/patterns/reactive-layout/index.cjs.map +1 -0
- package/dist/patterns/reactive-layout/index.d.cts +1 -7
- package/dist/patterns/reactive-layout/index.d.ts +1 -7
- package/dist/patterns/reactive-layout/index.js +3 -1
- package/dist/patterns/reactive-layout/index.js.map +1 -0
- package/dist/patterns/reduction/index.cjs +21 -3
- package/dist/patterns/reduction/index.cjs.map +1 -0
- package/dist/patterns/reduction/index.d.cts +1 -6
- package/dist/patterns/reduction/index.d.ts +1 -6
- package/dist/patterns/reduction/index.js +3 -1
- package/dist/patterns/reduction/index.js.map +1 -0
- package/dist/patterns/surface/index.cjs +21 -13
- package/dist/patterns/surface/index.cjs.map +1 -0
- package/dist/patterns/surface/index.d.cts +1 -9
- package/dist/patterns/surface/index.d.ts +1 -9
- package/dist/patterns/surface/index.js +3 -1
- package/dist/patterns/surface/index.js.map +1 -0
- package/dist/patterns/topology-view/index.cjs +21 -0
- package/dist/patterns/topology-view/index.cjs.map +1 -0
- package/dist/patterns/topology-view/index.d.cts +1 -0
- package/dist/patterns/topology-view/index.d.ts +1 -0
- package/dist/patterns/topology-view/index.js +3 -0
- package/dist/patterns/topology-view/index.js.map +1 -0
- package/dist/testing/index.cjs +21 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +608 -584
- package/dist/backoff-HPZMEZNF.js +0 -1
- package/dist/cascading-BglDkMdX.d.cts +0 -199
- package/dist/cascading-MFgxu7Yo.d.ts +0 -199
- package/dist/chunk-2T7U5EU6.js +0 -1
- package/dist/chunk-3G5U5QNE.js +0 -5
- package/dist/chunk-4VVTGLXJ.js +0 -1
- package/dist/chunk-5M4CCMMD.js +0 -45
- package/dist/chunk-5QDBSZBV.js +0 -1
- package/dist/chunk-5XJ6B66J.js +0 -1
- package/dist/chunk-6QZNQS5B.js +0 -1
- package/dist/chunk-6X7AFUJV.js +0 -9
- package/dist/chunk-7K6PWTDQ.js +0 -1
- package/dist/chunk-7LIAPXJB.js +0 -1
- package/dist/chunk-7WPU3UHQ.js +0 -1
- package/dist/chunk-A5WCQ5NO.js +0 -1
- package/dist/chunk-APPIWSGD.js +0 -84
- package/dist/chunk-BEZWM2SY.js +0 -1
- package/dist/chunk-C72GO4IZ.js +0 -1
- package/dist/chunk-CB676TKJ.js +0 -1
- package/dist/chunk-CE6TI2TL.js +0 -1
- package/dist/chunk-CE72X3WO.js +0 -1
- package/dist/chunk-CK2E7BTU.js +0 -1
- package/dist/chunk-CLVB32RD.js +0 -1
- package/dist/chunk-CRVT7D2P.js +0 -1
- package/dist/chunk-D5RFJOZ2.js +0 -1
- package/dist/chunk-D7GPHKFH.js +0 -1
- package/dist/chunk-DHRX7JX4.js +0 -2
- package/dist/chunk-ESMPEKEV.js +0 -1
- package/dist/chunk-F672GV32.js +0 -1
- package/dist/chunk-FZMYDOWV.js +0 -1
- package/dist/chunk-GHBWHMRZ.js +0 -1
- package/dist/chunk-GLERH466.js +0 -1
- package/dist/chunk-GPW2V3RE.js +0 -1
- package/dist/chunk-HIDYF36O.js +0 -1
- package/dist/chunk-HITNVN6B.js +0 -3
- package/dist/chunk-HY4DJBA7.js +0 -5
- package/dist/chunk-KZIEYVXN.js +0 -1
- package/dist/chunk-L6NSJVJZ.js +0 -1
- package/dist/chunk-N4MQX6JU.js +0 -18
- package/dist/chunk-N7FHEL4D.js +0 -1
- package/dist/chunk-NTEURFZH.js +0 -1
- package/dist/chunk-OIVP6KFV.js +0 -1
- package/dist/chunk-OPHBU3LG.js +0 -1
- package/dist/chunk-OYQOZP2F.js +0 -5
- package/dist/chunk-PTZK576G.js +0 -1
- package/dist/chunk-QYADASLV.js +0 -1
- package/dist/chunk-ST7UXLWR.js +0 -1
- package/dist/chunk-SVY7VUYU.js +0 -1
- package/dist/chunk-TK3NWWD4.js +0 -1
- package/dist/chunk-TSOYJ743.js +0 -1
- package/dist/chunk-UNGSTR4X.js +0 -61
- package/dist/chunk-VIMF6LGM.js +0 -1
- package/dist/chunk-VJLMUKOI.js +0 -1
- package/dist/chunk-VN6RDSK2.js +0 -1
- package/dist/chunk-VV4N5P64.js +0 -1
- package/dist/chunk-W3I423PS.js +0 -1
- package/dist/chunk-WJR24TAG.js +0 -1
- package/dist/chunk-XTGKMHSW.js +0 -1
- package/dist/chunk-YBB7ZGTY.js +0 -1
- package/dist/chunk-Z4NPUARF.js +0 -1
- package/dist/chunk-ZGNQRPDT.js +0 -1
- package/dist/chunk-ZKPSFFKU.js +0 -1
- package/dist/chunk-ZLV5SQSX.js +0 -1
- package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
- package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
- package/dist/decay-BvOWTZ00.d.ts +0 -112
- package/dist/decay-CFlLvXUT.d.cts +0 -112
- package/dist/fallback-74oxi34l.d.cts +0 -250
- package/dist/fallback-DUyyBTBK.d.ts +0 -250
- package/dist/graph-CWvEUQAq.d.cts +0 -1861
- package/dist/graph-D9LFnda9.d.ts +0 -1861
- package/dist/index-5k1T6jl0.d.cts +0 -121
- package/dist/index-9770hRuQ.d.cts +0 -779
- package/dist/index-B-_tFaqV.d.cts +0 -468
- package/dist/index-B17QddL1.d.cts +0 -374
- package/dist/index-B1F8Enjf.d.ts +0 -704
- package/dist/index-B5S8ULbU.d.ts +0 -515
- package/dist/index-B8YnZpIR.d.ts +0 -102
- package/dist/index-BHskSB8v.d.ts +0 -3413
- package/dist/index-BIYAkbAi.d.cts +0 -26
- package/dist/index-BQSKmbuG.d.cts +0 -127
- package/dist/index-BaQaY_IQ.d.cts +0 -231
- package/dist/index-BmZXHqkE.d.ts +0 -36
- package/dist/index-BoJ5JHxI.d.ts +0 -557
- package/dist/index-BocU7pqs.d.ts +0 -779
- package/dist/index-BrPrLl4e.d.cts +0 -86
- package/dist/index-BxNs2HB9.d.cts +0 -1858
- package/dist/index-Byu-OpX_.d.ts +0 -113
- package/dist/index-C1T3d7V-.d.cts +0 -704
- package/dist/index-C5ri2Axc.d.cts +0 -301
- package/dist/index-C5stwKcw.d.cts +0 -44
- package/dist/index-C9l6OEBL.d.ts +0 -26
- package/dist/index-CBBLl_rc.d.ts +0 -127
- package/dist/index-CBGUK09R.d.ts +0 -754
- package/dist/index-CC-AvFTy.d.cts +0 -557
- package/dist/index-CJF1URuX.d.ts +0 -121
- package/dist/index-CK29LV56.d.cts +0 -34
- package/dist/index-CMh5Rz1y.d.ts +0 -385
- package/dist/index-CPQlGA29.d.ts +0 -34
- package/dist/index-CR8QpwX8.d.ts +0 -2680
- package/dist/index-CS0LTlB8.d.cts +0 -385
- package/dist/index-CSOmP7xT.d.cts +0 -291
- package/dist/index-CYq8vAyV.d.ts +0 -291
- package/dist/index-CZ3r5Rxp.d.ts +0 -374
- package/dist/index-CasX6Pfq.d.cts +0 -358
- package/dist/index-CdAlHFEt.d.ts +0 -44
- package/dist/index-CdTelp1M.d.ts +0 -202
- package/dist/index-CeFiHtAg.d.ts +0 -468
- package/dist/index-Cj3WohTd.d.cts +0 -202
- package/dist/index-Climxqsu.d.cts +0 -754
- package/dist/index-Co7uli2l.d.cts +0 -3413
- package/dist/index-CviRnE4K.d.ts +0 -45
- package/dist/index-Cwv0KWcU.d.cts +0 -102
- package/dist/index-CzLVrjxn.d.ts +0 -231
- package/dist/index-D0aciIex.d.cts +0 -209
- package/dist/index-DHen9Klo.d.ts +0 -1858
- package/dist/index-DV_1YuVk.d.cts +0 -221
- package/dist/index-Dc4AYqrJ.d.cts +0 -515
- package/dist/index-Dgl1HpPn.d.ts +0 -86
- package/dist/index-DisjX8a-.d.ts +0 -221
- package/dist/index-UPSiS-X7.d.cts +0 -2680
- package/dist/index-Yq60JP3s.d.ts +0 -209
- package/dist/index-ZVQhLa2i.d.cts +0 -37
- package/dist/index-_6ODbuOu.d.cts +0 -45
- package/dist/index-hcDJ8PSI.d.cts +0 -36
- package/dist/index-nozs3fFC.d.ts +0 -301
- package/dist/index-p09KSrTN.d.ts +0 -358
- package/dist/index-sqkqlb1p.d.ts +0 -37
- package/dist/index-tRCxuAXF.d.cts +0 -113
- package/dist/node-kK3CvTrR.d.cts +0 -1347
- package/dist/node-kK3CvTrR.d.ts +0 -1347
- package/dist/observable-DWjNfLvC.d.ts +0 -36
- package/dist/observable-e3eiPPFy.d.cts +0 -36
- package/dist/pipeline-graph-CIKhynsF.d.cts +0 -142
- package/dist/pipeline-graph-Sgj0gCwn.d.ts +0 -142
- package/dist/reactive-layout-DOTs9P3X.d.ts +0 -183
- package/dist/reactive-layout-DgctbqZo.d.cts +0 -183
- package/dist/reactive-log-BKALbfal.d.ts +0 -223
- package/dist/reactive-log-DIGdYqQ6.d.cts +0 -223
- package/dist/reactive-map-CEFGp8TK.d.cts +0 -296
- package/dist/reactive-map-DS_SIAxv.d.ts +0 -296
- package/dist/resilience-6LYQJAC5.js +0 -1
- package/dist/sugar-DQjFmVqb.d.cts +0 -399
- package/dist/sugar-fhLIE7TT.d.ts +0 -399
- package/dist/topology-tree-Bcz27hpF.d.cts +0 -25
- package/dist/topology-tree-xvaD0fOX.d.ts +0 -25
- package/dist/types-C0_yquda.d.cts +0 -442
- package/dist/types-CWFysE9E.d.ts +0 -442
package/dist/index-B1F8Enjf.d.ts
DELETED
|
@@ -1,704 +0,0 @@
|
|
|
1
|
-
import { N as Node } from './node-kK3CvTrR.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
|
-
/**
|
|
157
|
-
* Resilience utilities — roadmap §3.1 + §3.1c (retry, breaker, rate limit, status,
|
|
158
|
-
* fallback, cache, timeout, budgetGate).
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
type RetryOptions = {
|
|
162
|
-
/**
|
|
163
|
-
* Max retry attempts after each terminal `ERROR` (not counting the first failure).
|
|
164
|
-
*
|
|
165
|
-
* **Required when `backoff` is set.** Pass `Infinity` to opt in to unbounded retries
|
|
166
|
-
* — the explicit value rules out the silent-infinite-budget footgun (a flaky provider
|
|
167
|
-
* + exponential backoff + omitted `count` would previously default to ~2.1B retries).
|
|
168
|
-
*/
|
|
169
|
-
count?: number;
|
|
170
|
-
/** Delay between attempts; strategies use **nanoseconds**. */
|
|
171
|
-
backoff?: BackoffStrategy | BackoffPreset;
|
|
172
|
-
/**
|
|
173
|
-
* Caller-supplied metadata merged into the produced node's `meta` (Tier 5.2
|
|
174
|
-
* D8 widening). Use {@link domainMeta} to tag the layer for `describe()`
|
|
175
|
-
* grouping. The primitive's `factoryTag("retry", …)` always wins against
|
|
176
|
-
* caller keys.
|
|
177
|
-
*/
|
|
178
|
-
meta?: Record<string, unknown>;
|
|
179
|
-
};
|
|
180
|
-
/** Factory-mode-only options. `initial` seeds the outer node's cache before the first attempt. */
|
|
181
|
-
type RetryFactoryOptions<T> = RetryOptions & {
|
|
182
|
-
/** Initial cache value for the outer node before the factory runs the first time. */
|
|
183
|
-
initial?: T;
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Retry operator — two modes selected by the type of `input`:
|
|
187
|
-
*
|
|
188
|
-
* **Source mode** (`input: Node<T>`): resubscribes to the same node after each terminal
|
|
189
|
-
* `ERROR`. The upstream should use `resubscribable: true` if it must emit again after `ERROR`.
|
|
190
|
-
*
|
|
191
|
-
* **Factory mode** (`input: () => Node<T>`): invokes the factory to build a fresh `Node<T>`
|
|
192
|
-
* on every connect / reconnect. Ideal for producers that capture per-attempt resources
|
|
193
|
-
* (sockets, clients, file handles) that become unusable after an error. Synchronous
|
|
194
|
-
* exceptions thrown by the factory are treated as terminal ERROR and run through the
|
|
195
|
-
* same retry pipeline as inner-node ERROR.
|
|
196
|
-
*
|
|
197
|
-
* @param input - Upstream node or factory that returns a fresh node per attempt.
|
|
198
|
-
* @param opts - `count` caps attempts (**required when `backoff` is set**; pass `Infinity` to opt in to unbounded); `backoff` supplies delay in **nanoseconds** (or a preset name); `initial` seeds the outer node cache (factory mode only).
|
|
199
|
-
* @returns Node that retries on error.
|
|
200
|
-
*
|
|
201
|
-
* @throws {RangeError} when `backoff` is provided without an explicit `count` (unbounded-retry footgun guard) or when `count < 0`.
|
|
202
|
-
*
|
|
203
|
-
* @remarks
|
|
204
|
-
* **Protocol:** Forwards unknown message tuples unchanged; handles `DIRTY`, `DATA`, `RESOLVED`, `COMPLETE`, `ERROR`.
|
|
205
|
-
*
|
|
206
|
-
* **Backoff floor:** every scheduled delay is floored at 1ms via `Math.max(1, delayNs / NS_PER_MS)` even when the strategy returns 0ns. This avoids 0-delay re-entrancy on the active stack frame on a tight ERROR loop. Strategies that return `null`/`undefined` stop retrying immediately and forward the original error.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```ts
|
|
210
|
-
* // Source mode — resubscribe the same node:
|
|
211
|
-
* import { ERROR, NS_PER_SEC, producer, retry, constant } from "@graphrefly/graphrefly-ts";
|
|
212
|
-
*
|
|
213
|
-
* const src = producer(
|
|
214
|
-
* (a) => { a.down([[ERROR, new Error("x")]]); },
|
|
215
|
-
* { resubscribable: true },
|
|
216
|
-
* );
|
|
217
|
-
* const out = retry(src, { count: 2, backoff: constant(0.25 * NS_PER_SEC) });
|
|
218
|
-
*
|
|
219
|
-
* // Factory mode — fresh node per attempt (e.g. reconnecting WebSocket):
|
|
220
|
-
* import { NS_PER_SEC, exponential, retry, fromWebSocket } from "@graphrefly/graphrefly-ts";
|
|
221
|
-
*
|
|
222
|
-
* const connected$ = retry(
|
|
223
|
-
* () => fromWebSocket(new WebSocket("wss://example/stream")),
|
|
224
|
-
* { count: 10, backoff: exponential({ baseNs: 1 * NS_PER_SEC }) },
|
|
225
|
-
* );
|
|
226
|
-
* ```
|
|
227
|
-
*
|
|
228
|
-
* @category extra
|
|
229
|
-
*/
|
|
230
|
-
declare function retry<T>(input: Node<T>, opts?: NodeOrValue<RetryOptions>): Node<T>;
|
|
231
|
-
declare function retry<T>(input: () => Node<T>, opts?: NodeOrValue<RetryFactoryOptions<T>>): Node<T>;
|
|
232
|
-
type CircuitState = "closed" | "open" | "half-open";
|
|
233
|
-
/**
|
|
234
|
-
* Thrown when {@link withBreaker} is configured with `onOpen: "error"` and the breaker rejects work.
|
|
235
|
-
*
|
|
236
|
-
* @category extra
|
|
237
|
-
*/
|
|
238
|
-
declare class CircuitOpenError extends Error {
|
|
239
|
-
name: string;
|
|
240
|
-
constructor();
|
|
241
|
-
}
|
|
242
|
-
interface CircuitBreakerOptions {
|
|
243
|
-
/** Number of consecutive failures before opening. Default: 5. */
|
|
244
|
-
failureThreshold?: number;
|
|
245
|
-
/** Base cooldown in nanoseconds before transitioning to half-open. Default: 30s. */
|
|
246
|
-
cooldownNs?: number;
|
|
247
|
-
/** Backoff strategy for cooldown escalation across consecutive open cycles. Overrides `cooldownNs` when provided. */
|
|
248
|
-
cooldown?: BackoffStrategy;
|
|
249
|
-
/** Max trial requests allowed in half-open state. Default: 1. */
|
|
250
|
-
halfOpenMax?: number;
|
|
251
|
-
/**
|
|
252
|
-
* Clock function returning **nanoseconds** with `monotonicNs()` semantics
|
|
253
|
-
* (monotonically non-decreasing; suitable for elapsed-time arithmetic — never
|
|
254
|
-
* use `Date.now()` because wall-clock skew can flip elapsed math negative).
|
|
255
|
-
* Default: `monotonicNs` from `core/clock`. Override for deterministic tests.
|
|
256
|
-
*/
|
|
257
|
-
now?: () => number;
|
|
258
|
-
}
|
|
259
|
-
interface CircuitBreaker {
|
|
260
|
-
/** Whether a request should be allowed through. Triggers open→half-open transition when cooldown expires. */
|
|
261
|
-
canExecute(): boolean;
|
|
262
|
-
/** Record a successful execution. Resets to closed. */
|
|
263
|
-
recordSuccess(): void;
|
|
264
|
-
/** Record a failed execution. May transition to open. */
|
|
265
|
-
recordFailure(error?: unknown): void;
|
|
266
|
-
/**
|
|
267
|
-
* Current circuit state (read-only, does not trigger transitions).
|
|
268
|
-
*
|
|
269
|
-
* **Telemetry:** wrap with {@link withBreaker} to surface this as a reactive
|
|
270
|
-
* `Node<CircuitState>` companion (`bundle.breakerState`) — every state
|
|
271
|
-
* transition (`closed`/`open`/`half-open`) emits to subscribers.
|
|
272
|
-
*/
|
|
273
|
-
readonly state: CircuitState;
|
|
274
|
-
/** Number of consecutive failures in the current closed period. */
|
|
275
|
-
readonly failureCount: number;
|
|
276
|
-
/** Manually reset to closed state, clearing all counters. */
|
|
277
|
-
reset(): void;
|
|
278
|
-
/**
|
|
279
|
-
* Release the reactive-options subscription (Tier 6.5 3.2.4, 2026-04-29).
|
|
280
|
-
* No-op when constructed with static options. Call when retiring a
|
|
281
|
-
* breaker whose options came from a `Node<CircuitBreakerOptions>` to
|
|
282
|
-
* avoid leaking the option-Node subscription.
|
|
283
|
-
*/
|
|
284
|
-
dispose(): void;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Factory for a synchronous circuit breaker with `closed`, `open`, and `half-open` states.
|
|
288
|
-
*
|
|
289
|
-
* Supports escalating cooldown via an optional {@link BackoffStrategy} — each consecutive
|
|
290
|
-
* open→half-open→open cycle increments the backoff attempt.
|
|
291
|
-
*
|
|
292
|
-
* @param options - Threshold, cooldown, half-open limit, and optional clock
|
|
293
|
-
* override; OR a `Node<CircuitBreakerOptions>` carrying the same shape
|
|
294
|
-
* reactively (Tier 6.5 3.2.4).
|
|
295
|
-
* @returns {@link CircuitBreaker} instance.
|
|
296
|
-
*
|
|
297
|
-
* @remarks
|
|
298
|
-
* **Timing:** Uses `monotonicNs()` by default (nanoseconds). Override `now` for tests.
|
|
299
|
-
*
|
|
300
|
-
* **Reactive options (locked semantics, Tier 6.5 3.2.4, 2026-04-29).**
|
|
301
|
-
* When `options` is a `Node<CircuitBreakerOptions>`, the breaker
|
|
302
|
-
* subscribes at construction and re-reads `failureThreshold` /
|
|
303
|
-
* `cooldownNs` / `cooldown` / `halfOpenMax` / `now` on each DATA. **An
|
|
304
|
-
* option swap RESETS the breaker to `"closed"`** with all counters
|
|
305
|
-
* cleared — operators tuning a runaway breaker get a clean baseline.
|
|
306
|
-
* If retaining failure history across re-tunings matters, derive a new
|
|
307
|
-
* breaker per-tuning instead. Call `breaker.dispose()` when retiring to
|
|
308
|
-
* release the option-Node subscription.
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```ts
|
|
312
|
-
* import { circuitBreaker, exponential, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
313
|
-
*
|
|
314
|
-
* const b = circuitBreaker({
|
|
315
|
-
* failureThreshold: 3,
|
|
316
|
-
* cooldown: exponential({ baseNs: 1 * NS_PER_SEC }),
|
|
317
|
-
* });
|
|
318
|
-
* ```
|
|
319
|
-
*
|
|
320
|
-
* @category extra
|
|
321
|
-
*/
|
|
322
|
-
declare function circuitBreaker(options?: NodeOrValue<CircuitBreakerOptions>): CircuitBreaker;
|
|
323
|
-
type WithBreakerBundle<T> = {
|
|
324
|
-
node: Node<T>;
|
|
325
|
-
breakerState: Node<CircuitState>;
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
* Returns a unary wrapper that gates upstream `DATA` through a {@link CircuitBreaker}.
|
|
329
|
-
*
|
|
330
|
-
* @param breaker - Shared breaker instance (typically one per resource).
|
|
331
|
-
* @param options - `onOpen: "skip"` emits `RESOLVED` when open; `"error"` emits {@link CircuitOpenError}.
|
|
332
|
-
* @returns Function mapping `Node<T>` to `{ node, breakerState }` companion nodes.
|
|
333
|
-
*
|
|
334
|
-
* @remarks
|
|
335
|
-
* **Success path:** `COMPLETE` calls {@link CircuitBreaker.recordSuccess}. **Failure path:** upstream `ERROR` calls {@link CircuitBreaker.recordFailure} and is forwarded.
|
|
336
|
-
*
|
|
337
|
-
* **State telemetry:** `breakerState: Node<CircuitState>` is a reactive companion that mirrors `breaker.state` — every transition (`closed`/`open`/`half-open`) emits a `DATA`. Also accessible via `node.meta.breakerState` for `describe()` traversal.
|
|
338
|
-
*
|
|
339
|
-
* @example
|
|
340
|
-
* ```ts
|
|
341
|
-
* import { state, withBreaker, circuitBreaker } from "@graphrefly/graphrefly-ts";
|
|
342
|
-
*
|
|
343
|
-
* const b = circuitBreaker({ failureThreshold: 2 });
|
|
344
|
-
* const s = state(1);
|
|
345
|
-
* const { node, breakerState } = withBreaker(b)(s);
|
|
346
|
-
* ```
|
|
347
|
-
*
|
|
348
|
-
* @category extra
|
|
349
|
-
*/
|
|
350
|
-
declare function withBreaker<T>(breaker: CircuitBreaker, options?: {
|
|
351
|
-
onOpen?: "skip" | "error";
|
|
352
|
-
meta?: Record<string, unknown>;
|
|
353
|
-
}): (source: Node<T>) => WithBreakerBundle<T>;
|
|
354
|
-
interface TokenBucket {
|
|
355
|
-
/**
|
|
356
|
-
* Number of tokens currently available (after refill).
|
|
357
|
-
*
|
|
358
|
-
* **Float-valued.** When `refillPerSecond` is fractional (or `capacity` × elapsed-fraction
|
|
359
|
-
* yields a non-integer), the bucket accumulates fractional refill credit between
|
|
360
|
-
* `tryConsume`s. Consumers should not assume integer tokens — e.g. with
|
|
361
|
-
* `tokenBucket(10, 2.5)` after 100ms of elapsed time `available()` may report `0.25`.
|
|
362
|
-
*/
|
|
363
|
-
available(): number;
|
|
364
|
-
/** Try to consume `cost` tokens. Returns `true` if successful. */
|
|
365
|
-
tryConsume(cost?: number): boolean;
|
|
366
|
-
/**
|
|
367
|
-
* Return `cost` tokens to the bucket (capped at capacity). Used when a
|
|
368
|
-
* multi-bucket admission fails partway — e.g., `adaptiveRateLimiter`
|
|
369
|
-
* consumes from an rpm bucket, then a tpm bucket; if tpm fails, call
|
|
370
|
-
* `rpmBucket.putBack(requestCost)` so the rpm slot isn't wasted.
|
|
371
|
-
* No-op for non-positive `cost`.
|
|
372
|
-
*/
|
|
373
|
-
putBack(cost?: number): void;
|
|
374
|
-
}
|
|
375
|
-
/** Optional configuration for {@link tokenBucket}. */
|
|
376
|
-
interface TokenBucketOptions {
|
|
377
|
-
/**
|
|
378
|
-
* Clock function returning **nanoseconds** with `monotonicNs()` semantics
|
|
379
|
-
* (monotonically non-decreasing). Default: `monotonicNs` from `core/clock`.
|
|
380
|
-
* Override for deterministic tests — eliminates the need for `vi.useFakeTimers`
|
|
381
|
-
* to drive token-refill scheduling.
|
|
382
|
-
*/
|
|
383
|
-
clock?: () => number;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Token-bucket meter (capacity + refill rate per second). Use with {@link rateLimiter} or custom gates.
|
|
387
|
-
*
|
|
388
|
-
* @param capacity - Maximum tokens (must be positive).
|
|
389
|
-
* @param refillPerSecond - Tokens added per elapsed second (non-negative; may be fractional).
|
|
390
|
-
* @param opts - Optional `clock` override for deterministic testing.
|
|
391
|
-
* @returns {@link TokenBucket} instance.
|
|
392
|
-
*
|
|
393
|
-
* @remarks
|
|
394
|
-
* **Float behavior:** the internal token counter is float-valued — fractional refill
|
|
395
|
-
* accumulates between `tryConsume` calls. See {@link TokenBucket.available} for caveats.
|
|
396
|
-
*
|
|
397
|
-
* **Clock injection:** pass `opts.clock` to drive refill scheduling deterministically
|
|
398
|
-
* in tests. The contract matches {@link circuitBreaker}'s `now` option: must return
|
|
399
|
-
* `monotonicNs()`-style nanoseconds, never `Date.now()` (wall-clock skew breaks
|
|
400
|
-
* elapsed math).
|
|
401
|
-
*
|
|
402
|
-
* @example
|
|
403
|
-
* ```ts
|
|
404
|
-
* import { tokenBucket } from "@graphrefly/graphrefly-ts";
|
|
405
|
-
*
|
|
406
|
-
* const bucket = tokenBucket(10, 2); // capacity 10, refill 2 tokens/sec
|
|
407
|
-
* bucket.tryConsume(3); // true — 7 tokens remaining
|
|
408
|
-
* bucket.available(); // ~7 (plus any elapsed refill — float-valued)
|
|
409
|
-
*
|
|
410
|
-
* // Deterministic test:
|
|
411
|
-
* let t = 0;
|
|
412
|
-
* const tb = tokenBucket(5, 1, { clock: () => t });
|
|
413
|
-
* tb.tryConsume(5); // exhausts
|
|
414
|
-
* t = 1_000_000_000; // advance 1s → +1 refill
|
|
415
|
-
* tb.tryConsume(1); // true
|
|
416
|
-
* ```
|
|
417
|
-
*
|
|
418
|
-
* @category extra
|
|
419
|
-
*/
|
|
420
|
-
declare function tokenBucket(capacity: number, refillPerSecond: number, opts?: TokenBucketOptions): TokenBucket;
|
|
421
|
-
type RateLimiterOverflowPolicy = "drop-oldest" | "drop-newest" | "error";
|
|
422
|
-
type RateLimiterOptions = {
|
|
423
|
-
/** Maximum `DATA` emissions per window (must be > 0). */
|
|
424
|
-
maxEvents: number;
|
|
425
|
-
/** Window length in nanoseconds (must be > 0). */
|
|
426
|
-
windowNs: number;
|
|
427
|
-
/**
|
|
428
|
-
* Cap on items queued while waiting for token refill.
|
|
429
|
-
*
|
|
430
|
-
* **Required.** Pass a finite positive integer (>= 1) for a bounded queue, OR
|
|
431
|
-
* the literal `Infinity` to opt in to an unbounded queue (caller acknowledges
|
|
432
|
-
* the unbounded-memory-growth risk on a high-rate source). Omitting this
|
|
433
|
-
* throws at construction time — the silent-unbounded-buffer footgun is the
|
|
434
|
-
* most common rateLimiter mis-configuration.
|
|
435
|
-
*/
|
|
436
|
-
maxBuffer: number;
|
|
437
|
-
/** Overflow policy when `maxBuffer` is exceeded. Default: `"drop-newest"`. */
|
|
438
|
-
onOverflow?: RateLimiterOverflowPolicy;
|
|
439
|
-
/**
|
|
440
|
-
* Caller-supplied metadata merged into the produced node's `meta` (Tier 5.2
|
|
441
|
-
* D8 widening). Use {@link domainMeta} to tag the layer for `describe()` /
|
|
442
|
-
* mermaid grouping (e.g. `domainMeta("resilient", "rate-limit")`). The
|
|
443
|
-
* primitive's own `factoryTag("rateLimiter", opts)` and the `droppedCount`
|
|
444
|
-
* / `rateLimitState` companion seeds always win against caller-supplied
|
|
445
|
-
* keys so the audit trail can't be silently overwritten.
|
|
446
|
-
*/
|
|
447
|
-
meta?: Record<string, unknown>;
|
|
448
|
-
};
|
|
449
|
-
/**
|
|
450
|
-
* Thrown by {@link rateLimiter} when `onOverflow: "error"` and the pending buffer is full.
|
|
451
|
-
*
|
|
452
|
-
* @category extra
|
|
453
|
-
*/
|
|
454
|
-
declare class RateLimiterOverflowError extends Error {
|
|
455
|
-
name: string;
|
|
456
|
-
constructor(maxBuffer: number);
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Combined runtime state surfaced by {@link rateLimiter} alongside `droppedCount`.
|
|
460
|
-
* Tier 5.2 D7 widening — exposes pending-buffer occupancy and a `paused`
|
|
461
|
-
* flag so consumers can render backpressure (UI), feed `lens.health`, or
|
|
462
|
-
* gate downstream effects.
|
|
463
|
-
*/
|
|
464
|
-
type RateLimiterState = {
|
|
465
|
-
/** Cumulative `DATA` items dropped due to overflow since this subscription cycle started. */
|
|
466
|
-
droppedCount: number;
|
|
467
|
-
/** Items currently buffered awaiting a token refill. `0` when the limiter is passing through. */
|
|
468
|
-
pendingCount: number;
|
|
469
|
-
/** `true` when at least one item is queued (the limiter is actively throttling). */
|
|
470
|
-
paused: boolean;
|
|
471
|
-
};
|
|
472
|
-
/** Bundle returned by {@link rateLimiter}. */
|
|
473
|
-
type RateLimiterBundle<T> = {
|
|
474
|
-
/** The throttled stream — at most `maxEvents` `DATA` per `windowNs`. */
|
|
475
|
-
node: Node<T>;
|
|
476
|
-
/**
|
|
477
|
-
* Reactive companion: count of `DATA` items dropped since the producer
|
|
478
|
-
* activated.
|
|
479
|
-
*
|
|
480
|
-
* - Increments on every drop under any overflow policy (`drop-newest`,
|
|
481
|
-
* `drop-oldest`). The `error` policy terminates the stream after a single
|
|
482
|
-
* overflow, so `droppedCount` increments at most once in that path.
|
|
483
|
-
* - **Lifecycle scoping (qa A1 + EC7):** the counter retains its final
|
|
484
|
-
* value through terminal (`COMPLETE` / `ERROR` / `TEARDOWN`) so consumers
|
|
485
|
-
* see the final drop count, not zero. The closure-held counter resets to
|
|
486
|
-
* `0` only when the producer fn re-runs — which only happens on a new
|
|
487
|
-
* subscription cycle, and only if the producer was constructed with
|
|
488
|
-
* `resubscribable: true`. The default `rateLimiter` producer is NOT
|
|
489
|
-
* resubscribable, so a single producer-fn run is the typical lifetime.
|
|
490
|
-
* - Producer-pattern note: this companion is invisible to `describe()`
|
|
491
|
-
* traversal from `node` (effect-mirror limitation; same shape as
|
|
492
|
-
* `withBreaker.breakerState` and `withStatus.status`). Surface it via
|
|
493
|
-
* `node.meta.droppedCount` if you need it in topology snapshots.
|
|
494
|
-
*/
|
|
495
|
-
droppedCount: Node<number>;
|
|
496
|
-
/**
|
|
497
|
-
* Reactive companion: combined `{droppedCount, pendingCount, paused}` view.
|
|
498
|
-
*
|
|
499
|
-
* - `pendingCount` reflects the live buffer occupancy and updates on every
|
|
500
|
-
* push / shift / overflow drop; `paused` is shorthand for
|
|
501
|
-
* `pendingCount > 0`.
|
|
502
|
-
* - Equality-deduped — re-emits only when one of the three fields actually
|
|
503
|
-
* changes (so a busy steady-state where every DATA passes immediately
|
|
504
|
-
* produces one `paused: false` emission, not one per DATA).
|
|
505
|
-
* - **Lifecycle scoping (qa EC7):** same contract as `droppedCount` —
|
|
506
|
-
* retains its final value through terminal; resets to the initial
|
|
507
|
-
* `{droppedCount: 0, pendingCount: 0, paused: false}` only on a new
|
|
508
|
-
* producer-fn run (resubscribable upstream required).
|
|
509
|
-
* - Same producer-pattern caveat as `droppedCount` re: `describe()` visibility.
|
|
510
|
-
*/
|
|
511
|
-
rateLimitState: Node<RateLimiterState>;
|
|
512
|
-
};
|
|
513
|
-
/**
|
|
514
|
-
* Token-bucket rate limiter: at most `maxEvents` `DATA` values per `windowNs`.
|
|
515
|
-
*
|
|
516
|
-
* Uses {@link tokenBucket} internally (capacity = `maxEvents`, refill = `maxEvents / windowSeconds`).
|
|
517
|
-
* Excess items are queued FIFO (in a fixed-capacity {@link RingBuffer} for O(1) push/shift)
|
|
518
|
-
* until a token is available. The queue is bounded by the **required** `maxBuffer` option
|
|
519
|
-
* with a configurable overflow policy.
|
|
520
|
-
*
|
|
521
|
-
* @param source - Upstream node.
|
|
522
|
-
* @param opts - Rate + bounded-buffer configuration. `maxBuffer` is required (use `Infinity` to opt in to unbounded).
|
|
523
|
-
* @returns `{ node, droppedCount }` bundle. Subscribe to `node` for the throttled stream and to `droppedCount` for backpressure pressure.
|
|
524
|
-
*
|
|
525
|
-
* @throws {RangeError} when `maxEvents` / `windowNs` is non-positive, when `maxBuffer` is omitted, or when `maxBuffer` is a finite value < 1.
|
|
526
|
-
*
|
|
527
|
-
* @remarks
|
|
528
|
-
* **Terminal:** `COMPLETE` / `ERROR` cancel the refill timer, drop the pending queue,
|
|
529
|
-
* reset `droppedCount` to `0`, and propagate.
|
|
530
|
-
*
|
|
531
|
-
* @example
|
|
532
|
-
* ```ts
|
|
533
|
-
* import { rateLimiter, state, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
534
|
-
*
|
|
535
|
-
* const src = state(0);
|
|
536
|
-
* // Allow at most 5 DATA values per second; queue up to 100 excess items, drop newest beyond.
|
|
537
|
-
* const { node: limited, droppedCount } = rateLimiter(src, {
|
|
538
|
-
* maxEvents: 5,
|
|
539
|
-
* windowNs: NS_PER_SEC,
|
|
540
|
-
* maxBuffer: 100,
|
|
541
|
-
* });
|
|
542
|
-
* droppedCount.subscribe(([m]) => console.log("dropped so far:", m[1]));
|
|
543
|
-
* ```
|
|
544
|
-
*
|
|
545
|
-
* @category extra
|
|
546
|
-
*/
|
|
547
|
-
declare function rateLimiter<T>(source: Node<T>, opts: NodeOrValue<RateLimiterOptions>): RateLimiterBundle<T>;
|
|
548
|
-
type StatusValue = "pending" | "running" | "completed" | "errored";
|
|
549
|
-
type WithStatusBundle<T> = {
|
|
550
|
-
node: Node<T>;
|
|
551
|
-
status: Node<StatusValue>;
|
|
552
|
-
error: Node<unknown | null>;
|
|
553
|
-
};
|
|
554
|
-
/**
|
|
555
|
-
* Wraps `src` with `status` and `error` {@link state} companions for UI or meta snapshots.
|
|
556
|
-
*
|
|
557
|
-
* @param src - Upstream node to mirror.
|
|
558
|
-
* @param options - `initialStatus` defaults to `"pending"`.
|
|
559
|
-
* @returns `{ node, status, error }` where `out` is the mirrored stream, `status` is a
|
|
560
|
-
* reactive `Node<StatusValue>` (`"pending" | "running" | "completed" | "errored"`),
|
|
561
|
-
* and `error` holds the last `ERROR` payload (cleared to `null` on the next `DATA`
|
|
562
|
-
* after `errored`).
|
|
563
|
-
*
|
|
564
|
-
* @remarks
|
|
565
|
-
* **Lifecycle:** `pending` (no DATA yet) → `running` (on first DATA) → `completed`
|
|
566
|
-
* (on COMPLETE) or `errored` (on ERROR). After `errored`, the next `DATA` clears
|
|
567
|
-
* `error` and re-enters `running` inside a {@link batch} so subscribers see one
|
|
568
|
-
* consistent transition (matches graphrefly-py).
|
|
569
|
-
*
|
|
570
|
-
* **Producer-pattern visibility:** `out` is built via `node([], fn, …)`, so `src`
|
|
571
|
-
* appears as the source dependency in `describe()` traversal but the `status` /
|
|
572
|
-
* `error` companions are mirrored via subscribe-callback effects — they appear
|
|
573
|
-
* under `out.meta.status` / `out.meta.error` (and as `<name>::__meta__::status`
|
|
574
|
-
* paths in `describe()`) rather than as separate top-level edges. Subscribers
|
|
575
|
-
* to `out` see the throttled DATA stream; `status` / `error` companions may not
|
|
576
|
-
* appear as edges in `describe()` if no consumer subscribes to them (per
|
|
577
|
-
* COMPOSITION-GUIDE §1, push-on-subscribe semantics).
|
|
578
|
-
*
|
|
579
|
-
* **Per-subscribe lifecycle (DF8, 2026-04-29 doc lock).** When the wrapped
|
|
580
|
-
* source is `resubscribable: true` and multiple consumers attach in
|
|
581
|
-
* sequence, each new subscription cycle re-runs the producer fn AND
|
|
582
|
-
* re-emits the initial `pending` + `null` companion DATAs. Downstream
|
|
583
|
-
* subscribers to the `status` / `error` companions see thrash:
|
|
584
|
-
* `pending → running → completed → pending → running …`. This is the
|
|
585
|
-
* intended fresh-cycle semantic (each subscription cycle reports its own
|
|
586
|
-
* lifecycle); consumers that need a "stable" status across cycles should
|
|
587
|
-
* derive a snapshot via a separate `state()` mirror rather than depending
|
|
588
|
-
* on the per-cycle reset.
|
|
589
|
-
*
|
|
590
|
-
* @example
|
|
591
|
-
* ```ts
|
|
592
|
-
* import { withStatus, state } from "@graphrefly/graphrefly-ts";
|
|
593
|
-
*
|
|
594
|
-
* const src = state<number>(0);
|
|
595
|
-
* const { node, status, error } = withStatus(src);
|
|
596
|
-
*
|
|
597
|
-
* status.subscribe((msgs) => console.log("status:", msgs));
|
|
598
|
-
* src.down([[DATA, 42]]); // status → "running"
|
|
599
|
-
* ```
|
|
600
|
-
*
|
|
601
|
-
* @category extra
|
|
602
|
-
*/
|
|
603
|
-
declare function withStatus<T>(src: Node<T>, options?: {
|
|
604
|
-
initialStatus?: StatusValue;
|
|
605
|
-
meta?: Record<string, unknown>;
|
|
606
|
-
}): WithStatusBundle<T>;
|
|
607
|
-
/**
|
|
608
|
-
* Thrown by {@link timeout} when no `DATA` arrives within the deadline.
|
|
609
|
-
*
|
|
610
|
-
* @category extra
|
|
611
|
-
*/
|
|
612
|
-
declare class TimeoutError extends Error {
|
|
613
|
-
name: string;
|
|
614
|
-
constructor(ns: number);
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Either a literal value or a reactive Node carrying it. Mirrors
|
|
618
|
-
* {@link FallbackInput}'s precedent for "options that may be reactive."
|
|
619
|
-
*
|
|
620
|
-
* Used by {@link timeout} / {@link retry} / {@link rateLimiter} /
|
|
621
|
-
* {@link circuitBreaker} / {@link budgetGate} to accept reactive option
|
|
622
|
-
* configurations (Tier 6.5 3.2, 2026-04-29). Each primitive subscribes
|
|
623
|
-
* to the option Node via {@link resolveReactiveOption} and rebinds
|
|
624
|
-
* internal state per its locked swap-semantic rule (see each primitive's
|
|
625
|
-
* JSDoc for the rule).
|
|
626
|
-
*
|
|
627
|
-
* @category extra
|
|
628
|
-
*/
|
|
629
|
-
type NodeOrValue<T> = T | Node<T>;
|
|
630
|
-
/** Inputs accepted by {@link fallback}. */
|
|
631
|
-
type FallbackInput<T> = T | Node<T> | PromiseLike<T> | AsyncIterable<T>;
|
|
632
|
-
/**
|
|
633
|
-
* On upstream terminal `ERROR`, switch to a fallback source instead of propagating the error.
|
|
634
|
-
*
|
|
635
|
-
* Accepts any of:
|
|
636
|
-
* - **scalar value** — emits `[[DATA, fb], [COMPLETE]]`
|
|
637
|
-
* - **`Node<T>`** — subscribes and forwards all messages (push-on-subscribe delivers current cache)
|
|
638
|
-
* - **`Promise<T>` / thenable** — resolves into a one-shot `DATA` then `COMPLETE` (via {@link fromAny})
|
|
639
|
-
* - **`AsyncIterable<T>`** — streams each yielded value as `DATA`, then `COMPLETE` (via {@link fromAny})
|
|
640
|
-
*
|
|
641
|
-
* Non-`Node` inputs are routed through {@link fromAny} so the fallback participates in the
|
|
642
|
-
* reactive protocol uniformly. Bare strings, arrays, and other synchronous scalars are treated
|
|
643
|
-
* as single values (NOT split into characters / elements) to avoid the `fromAny`-on-string
|
|
644
|
-
* iteration gotcha.
|
|
645
|
-
*
|
|
646
|
-
* Composes naturally with {@link retry}:
|
|
647
|
-
* `pipe(source, retry({count:3}), fallback("default"))`.
|
|
648
|
-
*
|
|
649
|
-
* @param source - Upstream node.
|
|
650
|
-
* @param fb - Fallback value, node, promise, or async iterable.
|
|
651
|
-
* @returns Node that replaces errors with the fallback.
|
|
652
|
-
*
|
|
653
|
-
* @example
|
|
654
|
-
* ```ts
|
|
655
|
-
* import { fallback, throwError } from "@graphrefly/graphrefly-ts";
|
|
656
|
-
*
|
|
657
|
-
* const safe = fallback(throwError(new Error("boom")), "default");
|
|
658
|
-
* safe.cache; // "default" after subscribe
|
|
659
|
-
* ```
|
|
660
|
-
*
|
|
661
|
-
* @category extra
|
|
662
|
-
*/
|
|
663
|
-
declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>, options?: {
|
|
664
|
-
meta?: Record<string, unknown>;
|
|
665
|
-
}): Node<T>;
|
|
666
|
-
/**
|
|
667
|
-
* Emits `ERROR` with {@link TimeoutError} if no `DATA` arrives within the deadline.
|
|
668
|
-
*
|
|
669
|
-
* The timer starts on subscription and resets on each `DATA`. `DIRTY` does NOT reset
|
|
670
|
-
* the timer. Terminal messages (`COMPLETE`/`ERROR`) cancel the timer.
|
|
671
|
-
*
|
|
672
|
-
* @param source - Upstream node.
|
|
673
|
-
* @param timeoutNs - Deadline in **nanoseconds** (must be > 0), or a
|
|
674
|
-
* `Node<number>` carrying the deadline reactively (Tier 6.5 3.2.1).
|
|
675
|
-
* Internally converted to milliseconds for `setTimeout` scheduling.
|
|
676
|
-
* @returns Node that errors on timeout.
|
|
677
|
-
*
|
|
678
|
-
* @throws {RangeError} when `timeoutNs <= 0`.
|
|
679
|
-
*
|
|
680
|
-
* @remarks
|
|
681
|
-
* **Scheduling:** internally uses {@link ResettableTimer} (raw `setTimeout`) per spec §5.10's resilience-operator carve-out. The deadline is `timeoutNs / NS_PER_MS` ms; sub-millisecond `timeoutNs` values get the same minimum-1ms host-scheduler granularity that `setTimeout` provides.
|
|
682
|
-
*
|
|
683
|
-
* **Reactive `timeoutNs` (locked semantics, Tier 6.5 3.2.1, 2026-04-29).**
|
|
684
|
-
* When `timeoutNs` is a `Node<number>`, each timer-(re)start reads the
|
|
685
|
-
* latest value. An option swap mid-flight applies to the **next** timer
|
|
686
|
-
* window (no in-flight reset) — the active timer keeps its original
|
|
687
|
-
* deadline; the next DATA-driven `startTimer()` call reads the new
|
|
688
|
-
* value. Static-form callers see no behavior change.
|
|
689
|
-
*
|
|
690
|
-
* @example
|
|
691
|
-
* ```ts
|
|
692
|
-
* import { timeout, never, NS_PER_SEC } from "@graphrefly/graphrefly-ts";
|
|
693
|
-
*
|
|
694
|
-
* const t = timeout(never(), 5 * NS_PER_SEC);
|
|
695
|
-
* // After 5 seconds with no DATA: [[ERROR, TimeoutError]]
|
|
696
|
-
* ```
|
|
697
|
-
*
|
|
698
|
-
* @category extra
|
|
699
|
-
*/
|
|
700
|
-
declare function timeout<T>(source: Node<T>, timeoutNs: NodeOrValue<number>, options?: {
|
|
701
|
-
meta?: Record<string, unknown>;
|
|
702
|
-
}): Node<T>;
|
|
703
|
-
|
|
704
|
-
export { type BackoffPreset as B, type CircuitBreaker 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 BackoffStrategy as a, type CircuitBreakerOptions as b, CircuitOpenError as c, type CircuitState as d, NS_PER_SEC as e, RateLimiterOverflowError as f, type RateLimiterOverflowPolicy as g, type RetryOptions as h, type TokenBucket as i, type WithStatusBundle as j, circuitBreaker as k, constant as l, decorrelatedJitter as m, exponential as n, fallback as o, fibonacci as p, linear as q, rateLimiter as r, resolveBackoffPreset as s, retry as t, timeout as u, tokenBucket as v, withBreaker as w, withMaxAttempts as x, withStatus as y };
|