@graphrefly/graphrefly 0.26.0 → 0.28.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-B-5zmAUv.d.cts +180 -0
- package/dist/cascading-D9WG1-9L.d.ts +180 -0
- package/dist/chunk-2FOAM3OR.js +1 -0
- package/dist/chunk-2PMCKKRK.js +1 -0
- package/dist/chunk-3JXNEPCD.js +2 -0
- package/dist/chunk-3R5HFPX7.js +78 -0
- package/dist/chunk-4GKB4OUJ.js +1 -0
- package/dist/chunk-4VVTGLXJ.js +1 -0
- package/dist/chunk-5QDBSZBV.js +1 -0
- package/dist/chunk-6QZNQS5B.js +1 -0
- package/dist/chunk-6V3SEX2I.js +1 -0
- package/dist/chunk-76A3HVQE.js +9 -0
- package/dist/chunk-7H6LGFUG.js +64 -0
- package/dist/chunk-CK2E7BTU.js +1 -0
- package/dist/chunk-CKCSDI7T.js +6 -0
- package/dist/chunk-CRXTH3SH.js +1 -0
- package/dist/chunk-CWLN3X3N.js +1 -0
- package/dist/chunk-D7A7DBE4.js +1 -0
- package/dist/chunk-DBGGMN3D.js +1 -0
- package/dist/chunk-DQA3UIQ2.js +1 -0
- package/dist/chunk-ERLIRFPA.js +1 -0
- package/dist/chunk-ESMPEKEV.js +1 -0
- package/dist/chunk-ETWTCCJI.js +1 -0
- package/dist/chunk-FNYWM6JC.js +1 -0
- package/dist/chunk-GHJJR5P4.js +1 -0
- package/dist/chunk-GPW2V3RE.js +1 -0
- package/dist/chunk-I6VIH3VA.js +1 -0
- package/dist/chunk-K2GNMCQT.js +1 -0
- package/dist/chunk-LBTDSCCO.js +3 -0
- package/dist/chunk-LQ3Y5NJS.js +1 -0
- package/dist/chunk-MIQTDPY4.js +5 -0
- package/dist/chunk-MTTAAPCK.js +1 -0
- package/dist/chunk-OAWLCNJJ.js +1 -0
- package/dist/chunk-OBKQQA5I.js +1 -0
- package/dist/chunk-OYHGKYQM.js +1 -0
- package/dist/chunk-PIOGHC63.js +1 -0
- package/dist/chunk-QWAPKG3O.js +2 -0
- package/dist/chunk-QYADASLV.js +1 -0
- package/dist/chunk-RHESUC3V.js +43 -0
- package/dist/chunk-S35VARIR.js +1 -0
- package/dist/chunk-SC3U7ETD.js +1 -0
- package/dist/chunk-U3AICJKU.js +1 -0
- package/dist/chunk-UMBIDLJ4.js +1 -0
- package/dist/chunk-UPHHLMHE.js +1 -0
- package/dist/chunk-UPXUCFMX.js +1 -0
- package/dist/chunk-UWJE5FQA.js +18 -0
- package/dist/chunk-V6YQICXZ.js +1 -0
- package/dist/chunk-VIMF6LGM.js +1 -0
- package/dist/chunk-VJLMUKOI.js +1 -0
- package/dist/chunk-VPYBOXVT.js +1 -0
- package/dist/chunk-VTPVOGHH.js +1 -0
- package/dist/chunk-WQ2BN6X6.js +1 -0
- package/dist/chunk-XAUNPIMX.js +1 -0
- package/dist/chunk-Y2EMPB3I.js +1 -0
- package/dist/chunk-Z4HDAS2Q.js +1 -0
- package/dist/chunk-ZB5EHBIO.js +1 -0
- package/dist/chunk-ZV2DXV5A.js +23 -0
- package/dist/compat/index.cjs +14 -7656
- package/dist/compat/index.d.cts +15 -14
- package/dist/compat/index.d.ts +15 -14
- package/dist/compat/index.js +1 -49
- 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 +14 -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 -82
- 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 +6 -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-B-xqw4Kk.d.cts +69 -0
- package/dist/composite-BhbKHbOS.d.ts +69 -0
- package/dist/core/index.cjs +1 -2271
- package/dist/core/index.d.cts +4 -3
- package/dist/core/index.d.ts +4 -3
- 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 +23 -9971
- package/dist/extra/index.d.cts +13 -5
- package/dist/extra/index.d.ts +13 -5
- package/dist/extra/index.js +1 -375
- 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 +6 -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-6tZ5jEzr.d.cts → graph-BZGRXwOm.d.ts} +134 -31
- package/dist/{graph-DQ69XU0g.d.ts → graph-D48Qw9Cg.d.cts} +134 -31
- package/dist/index-8FSVk4Uf.d.ts +135 -0
- package/dist/index-9oDeHH2u.d.cts +291 -0
- package/dist/index-B0c4cmIO.d.ts +207 -0
- package/dist/{index-CDAjUFIv.d.ts → index-B1AmmSlb.d.ts} +1 -1
- package/dist/{index-Bd_fwmLf.d.cts → index-B2pwesl9.d.cts} +1 -1
- package/dist/index-BHvIquRZ.d.ts +1957 -0
- package/dist/{index-CPgZ5wRl.d.ts → index-BVHOrDwO.d.ts} +1 -1
- package/dist/{index-DrISNAOm.d.ts → index-BWJV63ti.d.ts} +1 -1
- package/dist/{index-B_IP40nB.d.cts → index-B_agccPe.d.cts} +1 -1
- package/dist/index-BgyGlizc.d.ts +163 -0
- package/dist/index-BpA5c4G9.d.ts +357 -0
- package/dist/index-BpIFjILY.d.cts +357 -0
- package/dist/{index-qldRdbQw.d.ts → index-Bqachn9_.d.ts} +1 -1
- package/dist/index-Btib9rsU.d.ts +607 -0
- package/dist/{index-BYOHF0zP.d.ts → index-BwM9BEkt.d.ts} +1 -1
- package/dist/index-BxJ86YZZ.d.cts +105 -0
- package/dist/index-C73n7lo-.d.cts +251 -0
- package/dist/index-CEXXwWVH.d.cts +192 -0
- package/dist/index-CHEswufn.d.cts +163 -0
- package/dist/{index-xdGjv0nO.d.ts → index-CMn8S8Hw.d.ts} +1 -1
- package/dist/{index-QBpffFW-.d.cts → index-CRO83MmV.d.cts} +1 -1
- package/dist/{index-BjI6ty9z.d.ts → index-CloUk1kY.d.ts} +9 -9
- package/dist/index-CpgYhnrG.d.ts +291 -0
- package/dist/{index-CUyrtuOf.d.cts → index-Cyojz0AE.d.cts} +1 -1
- package/dist/{demo-shell-DEp-nMTl.d.ts → index-CzobVSMr.d.ts} +14 -14
- package/dist/index-Czq6ynh8.d.ts +143 -0
- package/dist/index-D-YB-Vl3.d.ts +195 -0
- package/dist/index-DAlweici.d.ts +231 -0
- package/dist/index-DEwTb_fm.d.cts +1957 -0
- package/dist/{index-DFhjO4Gg.d.cts → index-DL-rYJrx.d.cts} +1 -1
- package/dist/index-DP4ZTkdw.d.ts +139 -0
- package/dist/{index-BeIdBfcb.d.cts → index-DUqMOlKZ.d.cts} +200 -2366
- package/dist/{index-Bxb5ZYc9.d.cts → index-D_NwnRYS.d.cts} +1 -1
- package/dist/index-DaLJvH8Z.d.ts +105 -0
- package/dist/index-DcXZBF5a.d.cts +135 -0
- package/dist/index-DfyOkTvs.d.ts +321 -0
- package/dist/{index-CmnuOibw.d.ts → index-DiOXyAwt.d.ts} +1 -1
- package/dist/index-DpHe5e0Q.d.ts +186 -0
- package/dist/index-DraikLjn.d.ts +86 -0
- package/dist/{index-BEfE8H_G.d.cts → index-DxsnAMWD.d.cts} +9 -9
- package/dist/index-DyxjtScX.d.cts +207 -0
- package/dist/index-HDpJe9hX.d.ts +251 -0
- package/dist/index-O6TgGUBV.d.cts +195 -0
- package/dist/{index-B4MP_8V_.d.cts → index-Oi8d8w4R.d.cts} +1 -1
- package/dist/{index-BW1z3BN9.d.ts → index-ROpQmGjE.d.ts} +30 -6
- package/dist/index-RukJ4DLS.d.cts +607 -0
- package/dist/{index-DdD5MVDL.d.ts → index-ZftwfxJM.d.ts} +200 -2366
- package/dist/{index-CuYwdKO-.d.ts → index-cByzxQIC.d.cts} +10 -195
- package/dist/index-dtN7YA2x.d.cts +143 -0
- package/dist/{index-C8mdwMXc.d.cts → index-fM6y00vT.d.cts} +30 -6
- package/dist/{index-_oMEWlDq.d.cts → index-m-yHof5p.d.ts} +10 -195
- package/dist/index-pXrDMpRO.d.cts +231 -0
- package/dist/index-rHJSKsU8.d.cts +186 -0
- package/dist/index-rX8HBM5h.d.cts +321 -0
- package/dist/{index-CUwyr1Kk.d.cts → index-rnwQly8X.d.cts} +147 -20
- package/dist/index-sm373fsH.d.ts +192 -0
- package/dist/index-tbf2gKHd.d.cts +139 -0
- package/dist/{demo-shell-26p5fVxn.d.cts → index-u15meRxL.d.cts} +14 -14
- package/dist/{index-eJ6T_qGM.d.ts → index-umtoWT8K.d.ts} +147 -20
- package/dist/index-vscRDkjW.d.cts +86 -0
- package/dist/index.cjs +150 -24142
- package/dist/index.d.cts +69 -3756
- package/dist/index.d.ts +69 -3756
- package/dist/index.js +1 -7292
- package/dist/{meta-C0-8XW6Q.d.cts → meta-Cgj6zeji.d.cts} +5 -5
- package/dist/{meta-BGqSZ7mt.d.ts → meta-CwesDrMD.d.ts} +5 -5
- package/dist/{node-C_IBuvX2.d.cts → node-Cc1TniY8.d.cts} +36 -9
- package/dist/{node-C_IBuvX2.d.ts → node-Cc1TniY8.d.ts} +36 -9
- package/dist/{observable-DCk45RH5.d.ts → observable-Ct-gJ9jI.d.ts} +1 -1
- package/dist/{observable-Crr1jgzx.d.cts → observable-glXQoGj2.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 +91 -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 +6 -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 +6 -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 +7 -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 +6 -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 +83 -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 +6 -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 +48 -0
- package/dist/patterns/harness/index.d.cts +8 -0
- package/dist/patterns/harness/index.d.ts +8 -0
- package/dist/patterns/harness/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +6 -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 +6 -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 +6 -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 +6 -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 +6 -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 +7 -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 +6 -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 +8 -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 +14 -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-BaOQefHu.d.cts → reactive-layout-CpYb5qLP.d.cts} +2 -2
- package/dist/{reactive-layout-D9gejYXE.d.ts → reactive-layout-D8u4wuUR.d.ts} +2 -2
- package/dist/reactive-log-DPzuUDj5.d.cts +190 -0
- package/dist/reactive-log-YuH9VYN8.d.ts +190 -0
- package/dist/reactive-map-CdbNoSgP.d.ts +238 -0
- package/dist/reactive-map-DUeRmb9d.d.cts +238 -0
- package/dist/resilience-Ba5-b4WD.d.cts +493 -0
- package/dist/resilience-CGRzhnD3.d.ts +493 -0
- package/dist/resilience-QAHKANT5.js +1 -0
- package/dist/sugar-BV0htudb.d.cts +205 -0
- package/dist/sugar-Dtyrq2_q.d.ts +205 -0
- package/dist/topology-tree-CYHOwQZ_.d.ts +25 -0
- package/dist/topology-tree-DROUdq5B.d.cts +25 -0
- package/dist/types-O3GzJY2U.d.cts +401 -0
- package/dist/types-u64Ose53.d.ts +401 -0
- package/package.json +267 -7
- package/dist/chunk-3ZWCKRHX.js +0 -117
- package/dist/chunk-3ZWCKRHX.js.map +0 -1
- package/dist/chunk-6LDQFTYS.js +0 -102
- package/dist/chunk-6LDQFTYS.js.map +0 -1
- package/dist/chunk-7TAQJHQV.js +0 -103
- package/dist/chunk-7TAQJHQV.js.map +0 -1
- package/dist/chunk-AMCG74RZ.js +0 -7000
- package/dist/chunk-AMCG74RZ.js.map +0 -1
- package/dist/chunk-BVZYTZ5H.js +0 -599
- package/dist/chunk-BVZYTZ5H.js.map +0 -1
- package/dist/chunk-FQMKGR6L.js +0 -330
- package/dist/chunk-FQMKGR6L.js.map +0 -1
- package/dist/chunk-HXZEYDUR.js +0 -94
- package/dist/chunk-HXZEYDUR.js.map +0 -1
- package/dist/chunk-IZYUSJC7.js +0 -1369
- package/dist/chunk-IZYUSJC7.js.map +0 -1
- package/dist/chunk-J22W6HV3.js +0 -107
- package/dist/chunk-J22W6HV3.js.map +0 -1
- package/dist/chunk-JSCT3CR4.js +0 -38
- package/dist/chunk-JSCT3CR4.js.map +0 -1
- package/dist/chunk-JYXEWPH4.js +0 -62
- package/dist/chunk-JYXEWPH4.js.map +0 -1
- package/dist/chunk-LCE3GF5P.js +0 -866
- package/dist/chunk-LCE3GF5P.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-OHISZPOJ.js +0 -97
- package/dist/chunk-OHISZPOJ.js.map +0 -1
- package/dist/chunk-PHOUUNK7.js +0 -2291
- package/dist/chunk-PHOUUNK7.js.map +0 -1
- package/dist/chunk-RB6QPHJ7.js +0 -393
- package/dist/chunk-RB6QPHJ7.js.map +0 -1
- package/dist/chunk-SN4YWWYO.js +0 -171
- package/dist/chunk-SN4YWWYO.js.map +0 -1
- package/dist/chunk-SX52TAR4.js +0 -110
- package/dist/chunk-SX52TAR4.js.map +0 -1
- package/dist/chunk-THTWHNU4.js +0 -2712
- package/dist/chunk-THTWHNU4.js.map +0 -1
- package/dist/chunk-VYPWMZ6H.js +0 -98
- package/dist/chunk-VYPWMZ6H.js.map +0 -1
- package/dist/chunk-XGPU467M.js +0 -136
- package/dist/chunk-XGPU467M.js.map +0 -1
- package/dist/chunk-ZQMEI34O.js +0 -713
- package/dist/chunk-ZQMEI34O.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-C0ZXMaXO.d.cts +0 -392
- package/dist/index-CY2TljO4.d.ts +0 -392
- package/dist/index.cjs.map +0 -1
- package/dist/index.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/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/storage-BMycWEh2.d.ts +0 -190
- package/dist/storage-DiqWHzVI.d.cts +0 -190
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { a as Node, V as VersioningLevel } from './node-Cc1TniY8.js';
|
|
2
|
+
|
|
3
|
+
type ReactiveLogOptions<T> = {
|
|
4
|
+
name?: string;
|
|
5
|
+
maxSize?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Optional versioning level for the underlying `entries` state node. Set
|
|
8
|
+
* at construction time; cannot be changed later. Pass `0` for V0 identity
|
|
9
|
+
* + monotonic version counter, or `1` for V1 + content-addressed cid.
|
|
10
|
+
*/
|
|
11
|
+
versioning?: VersioningLevel;
|
|
12
|
+
/**
|
|
13
|
+
* Storage backend. Defaults to `NativeLogBackend` (ring buffer if `maxSize` is set,
|
|
14
|
+
* flat array otherwise). Users can plug in persistent / RRB-tree backends via
|
|
15
|
+
* the {@link LogBackend} interface.
|
|
16
|
+
*/
|
|
17
|
+
backend?: LogBackend<T>;
|
|
18
|
+
};
|
|
19
|
+
type ReactiveLogBundle<T> = {
|
|
20
|
+
/** Emits `readonly T[]` on each append/clear/trim (two-phase). */
|
|
21
|
+
readonly entries: Node<readonly T[]>;
|
|
22
|
+
/** Current entry count (O(1)). */
|
|
23
|
+
readonly size: number;
|
|
24
|
+
/** Positional access (O(1)); returns `undefined` on out-of-range. Supports negative indices (Python-style). */
|
|
25
|
+
at: (index: number) => T | undefined;
|
|
26
|
+
append: (value: T) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Push all values, emit one snapshot. No-op if `values` is empty.
|
|
29
|
+
* **Iterable consumption:** `values` is a `readonly T[]` — safe to pass arrays.
|
|
30
|
+
*/
|
|
31
|
+
appendMany: (values: readonly T[]) => void;
|
|
32
|
+
clear: () => void;
|
|
33
|
+
/** Remove the first `n` entries (clamped to `size`). Throws on non-integer or negative `n`. */
|
|
34
|
+
trimHead: (n: number) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Last `n` entries (or fewer) as a derived reactive view. Memoized with
|
|
37
|
+
* an LRU cache (default cap 64) — repeat calls with the same `n` return
|
|
38
|
+
* the same node. Throws on non-integer or negative `n`.
|
|
39
|
+
*
|
|
40
|
+
* **LRU eviction contract (D3(b)):** when a 65th distinct `n` is passed,
|
|
41
|
+
* the least-recently-used cached view is evicted and its keepalive is
|
|
42
|
+
* disposed. External holders of the evicted node will NOT receive further
|
|
43
|
+
* updates — re-call `tail(n)` for a fresh node, or dispose proactively
|
|
44
|
+
* via {@link disposeTail} / {@link disposeAllViews}. To avoid surprise:
|
|
45
|
+
* resolve `tail(n)` at the point of use rather than caching the returned
|
|
46
|
+
* node across many distinct `n`s.
|
|
47
|
+
*/
|
|
48
|
+
tail: (n: number) => Node<readonly T[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Reactive view of `entries.slice(start, stop)` — non-negative integer
|
|
51
|
+
* `start`, non-negative integer `stop` (exclusive) or `undefined` (to end).
|
|
52
|
+
* Memoized with an LRU cache (default cap 64) — repeat calls with the
|
|
53
|
+
* same `(start, stop)` return the same node.
|
|
54
|
+
*
|
|
55
|
+
* Throws on non-integer `start`, negative `start`, non-integer `stop`, or
|
|
56
|
+
* negative `stop` (P4 — the backend cannot cheaply honor JS-style
|
|
57
|
+
* negative `stop` without scanning length; disallowed for a consistent
|
|
58
|
+
* contract between backend, derived recomputation, and cached initial).
|
|
59
|
+
*
|
|
60
|
+
* **LRU eviction contract (D3(b)):** same as {@link tail} — past 64
|
|
61
|
+
* distinct `(start, stop)` pairs, the oldest cached view is evicted and
|
|
62
|
+
* its keepalive disposed. External holders stop receiving updates.
|
|
63
|
+
*/
|
|
64
|
+
slice: (start: number, stop?: number) => Node<readonly T[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Releases the cached `tail(n)` view if present (disposes its keepalive
|
|
67
|
+
* subscription). Subsequent `tail(n)` calls create a fresh node. No-op if
|
|
68
|
+
* `n` was not cached. Returns `true` if a view was disposed.
|
|
69
|
+
*/
|
|
70
|
+
disposeTail: (n: number) => boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Releases the cached `slice(start, stop?)` view if present. No-op if not cached.
|
|
73
|
+
*/
|
|
74
|
+
disposeSlice: (start: number, stop?: number) => boolean;
|
|
75
|
+
/** Releases all cached tail/slice views and their keepalive subscriptions. */
|
|
76
|
+
disposeAllViews: () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Releases all internal keepalive subscriptions so the bundle can be
|
|
79
|
+
* GC'd — currently equivalent to {@link disposeAllViews}, but exposed as
|
|
80
|
+
* a uniform API across all reactive data structures for lifecycle
|
|
81
|
+
* symmetry (mirrors `reactiveMap.dispose` / `reactiveList.dispose` /
|
|
82
|
+
* `reactiveIndex.dispose`). Idempotent. D6(a).
|
|
83
|
+
*/
|
|
84
|
+
dispose: () => void;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Storage contract for {@link reactiveLog}. Implementations own the mutable state and
|
|
88
|
+
* expose a monotonic `version` counter that increments on every structural change.
|
|
89
|
+
*
|
|
90
|
+
* The reactive layer reads `version` to decide when to emit; it does not inspect
|
|
91
|
+
* internal representation. Users can plug in persistent / ring-buffer / skip-list
|
|
92
|
+
* backends without touching the reactive emission logic.
|
|
93
|
+
*
|
|
94
|
+
* @remarks Post-1.0 op-log changesets will extend this interface with a
|
|
95
|
+
* `changesSince(version: number): Iterable<Change>` method. Current consumers
|
|
96
|
+
* should treat all methods here as stable.
|
|
97
|
+
*
|
|
98
|
+
* @category extra
|
|
99
|
+
*/
|
|
100
|
+
interface LogBackend<T> {
|
|
101
|
+
/** Monotonic mutation counter; increments on every append/trim/clear that changes state. */
|
|
102
|
+
readonly version: number;
|
|
103
|
+
/** Number of entries currently stored. */
|
|
104
|
+
readonly size: number;
|
|
105
|
+
/** O(1) positional access; returns `undefined` on out-of-range. */
|
|
106
|
+
at(index: number): T | undefined;
|
|
107
|
+
/** Append a value. Applies `maxSize` head-drop if configured. Advances `version`. */
|
|
108
|
+
append(value: T): void;
|
|
109
|
+
/** Append a batch; advances `version` once. No-op if `values.length === 0`. */
|
|
110
|
+
appendMany(values: readonly T[]): void;
|
|
111
|
+
/** Remove all entries. Returns count removed. Advances `version` only if non-zero. */
|
|
112
|
+
clear(): number;
|
|
113
|
+
/** Remove the first `n` entries (clamped). Returns count removed. Throws on negative `n`. */
|
|
114
|
+
trimHead(n: number): number;
|
|
115
|
+
/** Fresh snapshot array for `[start, stop)`. Throws on negative `start`. */
|
|
116
|
+
slice(start: number, stop?: number): readonly T[];
|
|
117
|
+
/** Last `n` entries as a fresh array. Throws on negative `n`. */
|
|
118
|
+
tail(n: number): readonly T[];
|
|
119
|
+
/** Full snapshot as a fresh array. */
|
|
120
|
+
toArray(): readonly T[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Default append-only log backend.
|
|
124
|
+
*
|
|
125
|
+
* - When `maxSize` is set: uses a **ring buffer** with `_head` index and circular
|
|
126
|
+
* modular arithmetic. Append and trim become O(1); snapshot is O(size) unrolling.
|
|
127
|
+
* - When `maxSize` is unset: uses a flat array with standard push/splice.
|
|
128
|
+
*
|
|
129
|
+
* `appendMany` pre-trims oversize input: if `values.length > maxSize`, only the
|
|
130
|
+
* tail of `values` is pushed (the rest would be immediately evicted).
|
|
131
|
+
*
|
|
132
|
+
* @category extra
|
|
133
|
+
*/
|
|
134
|
+
declare class NativeLogBackend<T> implements LogBackend<T> {
|
|
135
|
+
private _version;
|
|
136
|
+
private readonly _maxSize?;
|
|
137
|
+
private readonly _buf;
|
|
138
|
+
private _head;
|
|
139
|
+
private _size;
|
|
140
|
+
constructor(initial?: readonly T[], maxSize?: number);
|
|
141
|
+
get version(): number;
|
|
142
|
+
get size(): number;
|
|
143
|
+
at(index: number): T | undefined;
|
|
144
|
+
append(value: T): void;
|
|
145
|
+
appendMany(values: readonly T[]): void;
|
|
146
|
+
clear(): number;
|
|
147
|
+
trimHead(n: number): number;
|
|
148
|
+
slice(start: number, stop?: number): readonly T[];
|
|
149
|
+
tail(n: number): readonly T[];
|
|
150
|
+
toArray(): readonly T[];
|
|
151
|
+
/** Internal append without version bump — used by `appendMany`. */
|
|
152
|
+
private _rawAppend;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Creates an append-only reactive log with immutable array snapshots.
|
|
156
|
+
*
|
|
157
|
+
* @param initial - Optional seed entries (copied; pre-trimmed to `maxSize` if set).
|
|
158
|
+
* @param options - `name`, `maxSize`, and optional pluggable `backend`.
|
|
159
|
+
* @returns Bundle with `entries` (state node), `append`/`appendMany`/`clear`/`trimHead`,
|
|
160
|
+
* `size` / `at`, and memoized derived views `tail(n)` / `slice(start, stop?)`.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* **Backend:** The default {@link NativeLogBackend} uses a ring buffer when `maxSize`
|
|
164
|
+
* is set (O(1) append + trim) and a flat array otherwise. For persistent/structural-
|
|
165
|
+
* sharing semantics plug in a custom {@link LogBackend}.
|
|
166
|
+
*
|
|
167
|
+
* **`initial` + custom `backend` (F5):** When you supply `options.backend`, the
|
|
168
|
+
* `initial` argument is IGNORED — seed the backend yourself before passing it in.
|
|
169
|
+
* The `initial` seed only applies to the default `NativeLogBackend`.
|
|
170
|
+
*
|
|
171
|
+
* **Memoized views:** {@link ReactiveLogBundle.tail} and {@link ReactiveLogBundle.slice}
|
|
172
|
+
* cache derived nodes per-argument. Repeat calls with the same `n` / `(start, stop)`
|
|
173
|
+
* return the same node, bounding keepalive-subscription count to one per unique argument.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* import { reactiveLog } from "@graphrefly/graphrefly-ts";
|
|
178
|
+
*
|
|
179
|
+
* const lg = reactiveLog<number>([1, 2], { name: "audit", maxSize: 100 });
|
|
180
|
+
* lg.append(3);
|
|
181
|
+
* lg.entries.subscribe((msgs) => console.log(msgs));
|
|
182
|
+
* const last5 = lg.tail(5); // derived node
|
|
183
|
+
* const window = lg.slice(10, 20); // derived node
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @category extra
|
|
187
|
+
*/
|
|
188
|
+
declare function reactiveLog<T>(initial?: readonly T[], options?: ReactiveLogOptions<T>): ReactiveLogBundle<T>;
|
|
189
|
+
|
|
190
|
+
export { type LogBackend as L, NativeLogBackend as N, type ReactiveLogBundle as R, type ReactiveLogOptions as a, reactiveLog as r };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { a as Node, V as VersioningLevel, N as NodeOptions } from './node-Cc1TniY8.js';
|
|
2
|
+
|
|
3
|
+
type ReactiveMapOptions<K, V> = {
|
|
4
|
+
/** Optional registry name for `describe()` / debugging. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* LRU cap. When set, evicts least-recently-used keys after inserts that exceed this size.
|
|
8
|
+
* Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
|
|
9
|
+
*/
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Default TTL in seconds. Used when `set`/`setMany` omits per-call `ttl`.
|
|
13
|
+
* Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
|
|
14
|
+
*/
|
|
15
|
+
defaultTtl?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Storage backend. Defaults to `NativeMapBackend`. Users can plug in persistent
|
|
18
|
+
* (HAMT / Immutable.js) or shared-state backends via the {@link MapBackend} interface.
|
|
19
|
+
*/
|
|
20
|
+
backend?: MapBackend<K, V>;
|
|
21
|
+
/**
|
|
22
|
+
* Optional versioning level for the underlying `entries` state node. Set at
|
|
23
|
+
* construction time; cannot be changed later. Pass `0` for V0 identity +
|
|
24
|
+
* monotonic version counter, or `1` for V1 + content-addressed cid.
|
|
25
|
+
*/
|
|
26
|
+
versioning?: VersioningLevel;
|
|
27
|
+
} & Omit<NodeOptions, "initial" | "describeKind" | "equals" | "versioning">;
|
|
28
|
+
type ReactiveMapBundle<K, V> = {
|
|
29
|
+
/** Emits `ReadonlyMap<K, V>` on each structural change (two-phase). */
|
|
30
|
+
entries: Node<ReadonlyMap<K, V>>;
|
|
31
|
+
/**
|
|
32
|
+
* Checks existence. O(1) for live keys. If the key is expired, prunes it AND
|
|
33
|
+
* emits a snapshot so the reactive surface stays consistent with the return
|
|
34
|
+
* value. Reads on expired keys are therefore **observable side effects**.
|
|
35
|
+
*
|
|
36
|
+
* **LRU touch (F4):** When `maxSize` is configured, a live-key `has` also
|
|
37
|
+
* marks the entry as most-recently-used — which rearranges internal insertion
|
|
38
|
+
* order without bumping `version` or emitting. If you care about iteration
|
|
39
|
+
* order in a downstream subscriber, rely on the `entries` snapshot (a fresh
|
|
40
|
+
* `ReadonlyMap` per mutation) rather than iterating the backend directly.
|
|
41
|
+
*/
|
|
42
|
+
has: (key: K) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Gets value. O(1) for live keys. If the key is expired, prunes it AND emits
|
|
45
|
+
* a snapshot. Reads on expired keys are therefore **observable side effects**.
|
|
46
|
+
*
|
|
47
|
+
* **LRU touch (F4):** When `maxSize` is configured, a live-key `get` also
|
|
48
|
+
* marks the entry as most-recently-used (no version bump, no emission). See
|
|
49
|
+
* `has` for the full note on iteration order.
|
|
50
|
+
*/
|
|
51
|
+
get: (key: K) => V | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Sets value with optional TTL (seconds). Throws on `ttl <= 0`. Applies LRU eviction
|
|
54
|
+
* if `maxSize` is set. Always emits.
|
|
55
|
+
*/
|
|
56
|
+
set: (key: K, value: V, opts?: {
|
|
57
|
+
ttl?: number;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Bulk set — emits one snapshot for the whole batch. Applies `opts.ttl` (falls back
|
|
61
|
+
* to `defaultTtl`) to every entry. No-op if `entries` is empty.
|
|
62
|
+
*
|
|
63
|
+
* **Iterable consumption:** Consumes `entries` once (single-pass). Pass an array
|
|
64
|
+
* or `Set` for multi-shot consumers. If the iterator throws mid-iteration,
|
|
65
|
+
* entries already applied remain committed and a snapshot IS emitted (via the
|
|
66
|
+
* wrapper's finally-block).
|
|
67
|
+
*/
|
|
68
|
+
setMany: (entries: Iterable<readonly [K, V]>, opts?: {
|
|
69
|
+
ttl?: number;
|
|
70
|
+
}) => void;
|
|
71
|
+
delete: (key: K) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Bulk delete — emits one snapshot. No-op if no keys were present.
|
|
74
|
+
*
|
|
75
|
+
* **Iterable consumption:** Consumes `keys` once (single-pass).
|
|
76
|
+
*/
|
|
77
|
+
deleteMany: (keys: Iterable<K>) => void;
|
|
78
|
+
clear: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Current entry count — O(1), **pure read** (no emission). May include
|
|
81
|
+
* expired entries on TTL maps until a mutation or explicit
|
|
82
|
+
* `pruneExpired()` / `has(key)` / `get(key)` prunes them. Call
|
|
83
|
+
* `pruneExpired()` first if you need a live count.
|
|
84
|
+
*/
|
|
85
|
+
readonly size: number;
|
|
86
|
+
/** Explicitly prunes all expired entries. Emits if any were removed. */
|
|
87
|
+
pruneExpired: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Releases any internal keepalive subscriptions so the bundle can be
|
|
90
|
+
* GC'd. `reactiveMap` currently holds none (the `entries` node lives only
|
|
91
|
+
* as long as external subscribers keep it alive), so `dispose()` is a
|
|
92
|
+
* no-op today — exposed for API parity with `reactiveIndex.dispose` /
|
|
93
|
+
* `reactiveList.dispose` / `reactiveLog.dispose`. Idempotent. D6(a).
|
|
94
|
+
*/
|
|
95
|
+
dispose: () => void;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Storage contract for {@link reactiveMap}. Implementations own the mutable state,
|
|
99
|
+
* including optional TTL and LRU semantics, and expose a monotonic `version` counter
|
|
100
|
+
* that increments on every change to visible state.
|
|
101
|
+
*
|
|
102
|
+
* The reactive layer reads `version` before and after each backend call; when it
|
|
103
|
+
* advances, a snapshot is emitted. Reads (`has`, `get`) may internally prune the
|
|
104
|
+
* target key if expired and advance `version` — in which case the layer emits so
|
|
105
|
+
* subscribers see state consistent with the read's return value.
|
|
106
|
+
*
|
|
107
|
+
* @remarks Post-1.0 op-log changesets will extend this interface with a
|
|
108
|
+
* `changesSince(version: number): Iterable<Change>` method. Current consumers
|
|
109
|
+
* should treat all methods here as stable.
|
|
110
|
+
*
|
|
111
|
+
* @category extra
|
|
112
|
+
*/
|
|
113
|
+
interface MapBackend<K, V> {
|
|
114
|
+
/** Monotonic mutation counter; increments on every visible state change. */
|
|
115
|
+
readonly version: number;
|
|
116
|
+
/** Raw entry count (may include expired entries until a read / prune removes them). */
|
|
117
|
+
readonly size: number;
|
|
118
|
+
/** Checks existence. May prune target key if expired; advances `version` if pruned. */
|
|
119
|
+
has(key: K): boolean;
|
|
120
|
+
/** Gets value. May prune target key if expired; advances `version` if pruned. */
|
|
121
|
+
get(key: K): V | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Sets a value with optional TTL (seconds). Throws `RangeError` if `ttl <= 0`.
|
|
124
|
+
* Applies LRU eviction if `maxSize` is configured. Advances `version`.
|
|
125
|
+
*
|
|
126
|
+
* **Atomicity contract:** Either fully succeeds or throws before any state
|
|
127
|
+
* change; `version` advances only on success.
|
|
128
|
+
*/
|
|
129
|
+
set(key: K, value: V, ttl?: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Atomic bulk set. Pre-validates TTL once, then applies all entries. Advances
|
|
132
|
+
* `version` at most once (even for N entries). No-op if iterable is empty.
|
|
133
|
+
*
|
|
134
|
+
* **Consumes `entries` once** — pass an array if you want repeatability.
|
|
135
|
+
*
|
|
136
|
+
* **Atomicity contract:** TTL validation throws before any mutation. If the
|
|
137
|
+
* iterable itself throws mid-iteration, entries committed before the throw
|
|
138
|
+
* remain persisted AND `version` is bumped once (surfaced via finally) so
|
|
139
|
+
* the reactive wrapper emits a snapshot reflecting the partial state. "At
|
|
140
|
+
* most once" invariant is preserved.
|
|
141
|
+
*/
|
|
142
|
+
setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
|
|
143
|
+
/** Removes a key. Returns `true` if the key existed. Advances `version` only if true. */
|
|
144
|
+
delete(key: K): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Atomic bulk delete. Returns count removed. Advances `version` at most once
|
|
147
|
+
* (even for N keys). No-op if no keys were present. Consumes `keys` once.
|
|
148
|
+
*/
|
|
149
|
+
deleteMany(keys: Iterable<K>): number;
|
|
150
|
+
/** Removes all entries. Returns count removed. Advances `version` only if non-zero. */
|
|
151
|
+
clear(): number;
|
|
152
|
+
/** Removes all expired entries. Returns count removed. Advances `version` only if non-zero. */
|
|
153
|
+
pruneExpired(): number;
|
|
154
|
+
/** Fresh snapshot of non-expired entries (does NOT mutate state). */
|
|
155
|
+
toMap(): ReadonlyMap<K, V>;
|
|
156
|
+
}
|
|
157
|
+
type NativeMapBackendOptions = {
|
|
158
|
+
maxSize?: number;
|
|
159
|
+
/** Default TTL in seconds. */
|
|
160
|
+
defaultTtl?: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Default `Map<K, {value, expiresAt}>` backend with optional per-key TTL and LRU cap.
|
|
164
|
+
*
|
|
165
|
+
* **Complexity:**
|
|
166
|
+
* - `has`, `get`, `delete`, `size`: O(1)
|
|
167
|
+
* - `set`: O(1) amortized (LRU touch + eviction)
|
|
168
|
+
* - `pruneExpired`, `toMap`: O(n)
|
|
169
|
+
*
|
|
170
|
+
* LRU order uses native `Map` insertion order. `get` / `has` on a live key "touches"
|
|
171
|
+
* it by delete-then-reinsert (moving it to the end). This touch does NOT advance
|
|
172
|
+
* `version` — it's an internal optimization; the externally visible snapshot
|
|
173
|
+
* preserves iteration order as of the last mutation. **Note:** because touch
|
|
174
|
+
* reorders the internal `_store` without emitting, an in-process consumer iterating
|
|
175
|
+
* `_store` directly (custom subclasses) could observe changing order; external
|
|
176
|
+
* subscribers only see `toMap()` snapshots which are defensively copied and stable.
|
|
177
|
+
*
|
|
178
|
+
* @category extra
|
|
179
|
+
*/
|
|
180
|
+
declare class NativeMapBackend<K, V> implements MapBackend<K, V> {
|
|
181
|
+
private _version;
|
|
182
|
+
private readonly _store;
|
|
183
|
+
private readonly _maxSize?;
|
|
184
|
+
private readonly _defaultTtl?;
|
|
185
|
+
constructor(options?: NativeMapBackendOptions);
|
|
186
|
+
get version(): number;
|
|
187
|
+
get size(): number;
|
|
188
|
+
has(key: K): boolean;
|
|
189
|
+
get(key: K): V | undefined;
|
|
190
|
+
set(key: K, value: V, ttl?: number): void;
|
|
191
|
+
setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
|
|
192
|
+
delete(key: K): boolean;
|
|
193
|
+
deleteMany(keys: Iterable<K>): number;
|
|
194
|
+
clear(): number;
|
|
195
|
+
pruneExpired(): number;
|
|
196
|
+
toMap(): ReadonlyMap<K, V>;
|
|
197
|
+
private _resolveExpiresAt;
|
|
198
|
+
private _isExpired;
|
|
199
|
+
private _touchLru;
|
|
200
|
+
private _evictLruWhileOver;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Creates a reactive `Map` with optional per-key TTL and optional LRU max size.
|
|
204
|
+
*
|
|
205
|
+
* @param options - `name`, `maxSize`, `defaultTtl` (seconds), or custom `backend`.
|
|
206
|
+
* @returns `ReactiveMapBundle` — imperative methods (`has`/`get`/`set`/`setMany`/`delete`/
|
|
207
|
+
* `deleteMany`/`clear`/`pruneExpired`), reactive `entries` node, and O(1)-ish `size`.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* **TTL:** Expiry is checked on `get`, `has`, `size`, `pruneExpired`, and before each
|
|
211
|
+
* snapshot emission (expired keys are pruned first). Reads that discover expired keys
|
|
212
|
+
* emit a snapshot so subscribers see state consistent with the read's return value.
|
|
213
|
+
* There is no background timer; monotonic-clock expiry is immune to wall-clock changes.
|
|
214
|
+
*
|
|
215
|
+
* **LRU:** Uses native `Map` insertion order — `get` / `has` refreshes position via
|
|
216
|
+
* delete-then-reinsert; under `maxSize` pressure the first key in iteration order is
|
|
217
|
+
* evicted. LRU touching does NOT trigger emission (internal optimization).
|
|
218
|
+
*
|
|
219
|
+
* **Backend:** The default {@link NativeMapBackend} owns LRU/TTL. For persistent /
|
|
220
|
+
* HAMT / shared-state semantics plug in a custom {@link MapBackend}. `maxSize` and
|
|
221
|
+
* `defaultTtl` on the options object are only applied to the default backend — if
|
|
222
|
+
* you supply `backend`, configure those on your backend directly.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* import { reactiveMap } from "@graphrefly/graphrefly-ts";
|
|
227
|
+
*
|
|
228
|
+
* const m = reactiveMap<string, number>({ name: "cache", maxSize: 100, defaultTtl: 60 });
|
|
229
|
+
* m.set("x", 1);
|
|
230
|
+
* m.setMany([["y", 2], ["z", 3]]);
|
|
231
|
+
* m.entries.subscribe((msgs) => { console.log(msgs); });
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @category extra
|
|
235
|
+
*/
|
|
236
|
+
declare function reactiveMap<K, V>(options?: ReactiveMapOptions<K, V>): ReactiveMapBundle<K, V>;
|
|
237
|
+
|
|
238
|
+
export { type MapBackend as M, NativeMapBackend as N, type ReactiveMapBundle as R, type ReactiveMapOptions as a, type NativeMapBackendOptions as b, reactiveMap as r };
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { a as Node, V as VersioningLevel, N as NodeOptions } from './node-Cc1TniY8.cjs';
|
|
2
|
+
|
|
3
|
+
type ReactiveMapOptions<K, V> = {
|
|
4
|
+
/** Optional registry name for `describe()` / debugging. */
|
|
5
|
+
name?: string;
|
|
6
|
+
/**
|
|
7
|
+
* LRU cap. When set, evicts least-recently-used keys after inserts that exceed this size.
|
|
8
|
+
* Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
|
|
9
|
+
*/
|
|
10
|
+
maxSize?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Default TTL in seconds. Used when `set`/`setMany` omits per-call `ttl`.
|
|
13
|
+
* Forwarded to the default `NativeMapBackend`. Ignored if a custom `backend` is provided.
|
|
14
|
+
*/
|
|
15
|
+
defaultTtl?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Storage backend. Defaults to `NativeMapBackend`. Users can plug in persistent
|
|
18
|
+
* (HAMT / Immutable.js) or shared-state backends via the {@link MapBackend} interface.
|
|
19
|
+
*/
|
|
20
|
+
backend?: MapBackend<K, V>;
|
|
21
|
+
/**
|
|
22
|
+
* Optional versioning level for the underlying `entries` state node. Set at
|
|
23
|
+
* construction time; cannot be changed later. Pass `0` for V0 identity +
|
|
24
|
+
* monotonic version counter, or `1` for V1 + content-addressed cid.
|
|
25
|
+
*/
|
|
26
|
+
versioning?: VersioningLevel;
|
|
27
|
+
} & Omit<NodeOptions, "initial" | "describeKind" | "equals" | "versioning">;
|
|
28
|
+
type ReactiveMapBundle<K, V> = {
|
|
29
|
+
/** Emits `ReadonlyMap<K, V>` on each structural change (two-phase). */
|
|
30
|
+
entries: Node<ReadonlyMap<K, V>>;
|
|
31
|
+
/**
|
|
32
|
+
* Checks existence. O(1) for live keys. If the key is expired, prunes it AND
|
|
33
|
+
* emits a snapshot so the reactive surface stays consistent with the return
|
|
34
|
+
* value. Reads on expired keys are therefore **observable side effects**.
|
|
35
|
+
*
|
|
36
|
+
* **LRU touch (F4):** When `maxSize` is configured, a live-key `has` also
|
|
37
|
+
* marks the entry as most-recently-used — which rearranges internal insertion
|
|
38
|
+
* order without bumping `version` or emitting. If you care about iteration
|
|
39
|
+
* order in a downstream subscriber, rely on the `entries` snapshot (a fresh
|
|
40
|
+
* `ReadonlyMap` per mutation) rather than iterating the backend directly.
|
|
41
|
+
*/
|
|
42
|
+
has: (key: K) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Gets value. O(1) for live keys. If the key is expired, prunes it AND emits
|
|
45
|
+
* a snapshot. Reads on expired keys are therefore **observable side effects**.
|
|
46
|
+
*
|
|
47
|
+
* **LRU touch (F4):** When `maxSize` is configured, a live-key `get` also
|
|
48
|
+
* marks the entry as most-recently-used (no version bump, no emission). See
|
|
49
|
+
* `has` for the full note on iteration order.
|
|
50
|
+
*/
|
|
51
|
+
get: (key: K) => V | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Sets value with optional TTL (seconds). Throws on `ttl <= 0`. Applies LRU eviction
|
|
54
|
+
* if `maxSize` is set. Always emits.
|
|
55
|
+
*/
|
|
56
|
+
set: (key: K, value: V, opts?: {
|
|
57
|
+
ttl?: number;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Bulk set — emits one snapshot for the whole batch. Applies `opts.ttl` (falls back
|
|
61
|
+
* to `defaultTtl`) to every entry. No-op if `entries` is empty.
|
|
62
|
+
*
|
|
63
|
+
* **Iterable consumption:** Consumes `entries` once (single-pass). Pass an array
|
|
64
|
+
* or `Set` for multi-shot consumers. If the iterator throws mid-iteration,
|
|
65
|
+
* entries already applied remain committed and a snapshot IS emitted (via the
|
|
66
|
+
* wrapper's finally-block).
|
|
67
|
+
*/
|
|
68
|
+
setMany: (entries: Iterable<readonly [K, V]>, opts?: {
|
|
69
|
+
ttl?: number;
|
|
70
|
+
}) => void;
|
|
71
|
+
delete: (key: K) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Bulk delete — emits one snapshot. No-op if no keys were present.
|
|
74
|
+
*
|
|
75
|
+
* **Iterable consumption:** Consumes `keys` once (single-pass).
|
|
76
|
+
*/
|
|
77
|
+
deleteMany: (keys: Iterable<K>) => void;
|
|
78
|
+
clear: () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Current entry count — O(1), **pure read** (no emission). May include
|
|
81
|
+
* expired entries on TTL maps until a mutation or explicit
|
|
82
|
+
* `pruneExpired()` / `has(key)` / `get(key)` prunes them. Call
|
|
83
|
+
* `pruneExpired()` first if you need a live count.
|
|
84
|
+
*/
|
|
85
|
+
readonly size: number;
|
|
86
|
+
/** Explicitly prunes all expired entries. Emits if any were removed. */
|
|
87
|
+
pruneExpired: () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Releases any internal keepalive subscriptions so the bundle can be
|
|
90
|
+
* GC'd. `reactiveMap` currently holds none (the `entries` node lives only
|
|
91
|
+
* as long as external subscribers keep it alive), so `dispose()` is a
|
|
92
|
+
* no-op today — exposed for API parity with `reactiveIndex.dispose` /
|
|
93
|
+
* `reactiveList.dispose` / `reactiveLog.dispose`. Idempotent. D6(a).
|
|
94
|
+
*/
|
|
95
|
+
dispose: () => void;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Storage contract for {@link reactiveMap}. Implementations own the mutable state,
|
|
99
|
+
* including optional TTL and LRU semantics, and expose a monotonic `version` counter
|
|
100
|
+
* that increments on every change to visible state.
|
|
101
|
+
*
|
|
102
|
+
* The reactive layer reads `version` before and after each backend call; when it
|
|
103
|
+
* advances, a snapshot is emitted. Reads (`has`, `get`) may internally prune the
|
|
104
|
+
* target key if expired and advance `version` — in which case the layer emits so
|
|
105
|
+
* subscribers see state consistent with the read's return value.
|
|
106
|
+
*
|
|
107
|
+
* @remarks Post-1.0 op-log changesets will extend this interface with a
|
|
108
|
+
* `changesSince(version: number): Iterable<Change>` method. Current consumers
|
|
109
|
+
* should treat all methods here as stable.
|
|
110
|
+
*
|
|
111
|
+
* @category extra
|
|
112
|
+
*/
|
|
113
|
+
interface MapBackend<K, V> {
|
|
114
|
+
/** Monotonic mutation counter; increments on every visible state change. */
|
|
115
|
+
readonly version: number;
|
|
116
|
+
/** Raw entry count (may include expired entries until a read / prune removes them). */
|
|
117
|
+
readonly size: number;
|
|
118
|
+
/** Checks existence. May prune target key if expired; advances `version` if pruned. */
|
|
119
|
+
has(key: K): boolean;
|
|
120
|
+
/** Gets value. May prune target key if expired; advances `version` if pruned. */
|
|
121
|
+
get(key: K): V | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Sets a value with optional TTL (seconds). Throws `RangeError` if `ttl <= 0`.
|
|
124
|
+
* Applies LRU eviction if `maxSize` is configured. Advances `version`.
|
|
125
|
+
*
|
|
126
|
+
* **Atomicity contract:** Either fully succeeds or throws before any state
|
|
127
|
+
* change; `version` advances only on success.
|
|
128
|
+
*/
|
|
129
|
+
set(key: K, value: V, ttl?: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Atomic bulk set. Pre-validates TTL once, then applies all entries. Advances
|
|
132
|
+
* `version` at most once (even for N entries). No-op if iterable is empty.
|
|
133
|
+
*
|
|
134
|
+
* **Consumes `entries` once** — pass an array if you want repeatability.
|
|
135
|
+
*
|
|
136
|
+
* **Atomicity contract:** TTL validation throws before any mutation. If the
|
|
137
|
+
* iterable itself throws mid-iteration, entries committed before the throw
|
|
138
|
+
* remain persisted AND `version` is bumped once (surfaced via finally) so
|
|
139
|
+
* the reactive wrapper emits a snapshot reflecting the partial state. "At
|
|
140
|
+
* most once" invariant is preserved.
|
|
141
|
+
*/
|
|
142
|
+
setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
|
|
143
|
+
/** Removes a key. Returns `true` if the key existed. Advances `version` only if true. */
|
|
144
|
+
delete(key: K): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Atomic bulk delete. Returns count removed. Advances `version` at most once
|
|
147
|
+
* (even for N keys). No-op if no keys were present. Consumes `keys` once.
|
|
148
|
+
*/
|
|
149
|
+
deleteMany(keys: Iterable<K>): number;
|
|
150
|
+
/** Removes all entries. Returns count removed. Advances `version` only if non-zero. */
|
|
151
|
+
clear(): number;
|
|
152
|
+
/** Removes all expired entries. Returns count removed. Advances `version` only if non-zero. */
|
|
153
|
+
pruneExpired(): number;
|
|
154
|
+
/** Fresh snapshot of non-expired entries (does NOT mutate state). */
|
|
155
|
+
toMap(): ReadonlyMap<K, V>;
|
|
156
|
+
}
|
|
157
|
+
type NativeMapBackendOptions = {
|
|
158
|
+
maxSize?: number;
|
|
159
|
+
/** Default TTL in seconds. */
|
|
160
|
+
defaultTtl?: number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Default `Map<K, {value, expiresAt}>` backend with optional per-key TTL and LRU cap.
|
|
164
|
+
*
|
|
165
|
+
* **Complexity:**
|
|
166
|
+
* - `has`, `get`, `delete`, `size`: O(1)
|
|
167
|
+
* - `set`: O(1) amortized (LRU touch + eviction)
|
|
168
|
+
* - `pruneExpired`, `toMap`: O(n)
|
|
169
|
+
*
|
|
170
|
+
* LRU order uses native `Map` insertion order. `get` / `has` on a live key "touches"
|
|
171
|
+
* it by delete-then-reinsert (moving it to the end). This touch does NOT advance
|
|
172
|
+
* `version` — it's an internal optimization; the externally visible snapshot
|
|
173
|
+
* preserves iteration order as of the last mutation. **Note:** because touch
|
|
174
|
+
* reorders the internal `_store` without emitting, an in-process consumer iterating
|
|
175
|
+
* `_store` directly (custom subclasses) could observe changing order; external
|
|
176
|
+
* subscribers only see `toMap()` snapshots which are defensively copied and stable.
|
|
177
|
+
*
|
|
178
|
+
* @category extra
|
|
179
|
+
*/
|
|
180
|
+
declare class NativeMapBackend<K, V> implements MapBackend<K, V> {
|
|
181
|
+
private _version;
|
|
182
|
+
private readonly _store;
|
|
183
|
+
private readonly _maxSize?;
|
|
184
|
+
private readonly _defaultTtl?;
|
|
185
|
+
constructor(options?: NativeMapBackendOptions);
|
|
186
|
+
get version(): number;
|
|
187
|
+
get size(): number;
|
|
188
|
+
has(key: K): boolean;
|
|
189
|
+
get(key: K): V | undefined;
|
|
190
|
+
set(key: K, value: V, ttl?: number): void;
|
|
191
|
+
setMany(entries: Iterable<readonly [K, V]>, ttl?: number): void;
|
|
192
|
+
delete(key: K): boolean;
|
|
193
|
+
deleteMany(keys: Iterable<K>): number;
|
|
194
|
+
clear(): number;
|
|
195
|
+
pruneExpired(): number;
|
|
196
|
+
toMap(): ReadonlyMap<K, V>;
|
|
197
|
+
private _resolveExpiresAt;
|
|
198
|
+
private _isExpired;
|
|
199
|
+
private _touchLru;
|
|
200
|
+
private _evictLruWhileOver;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Creates a reactive `Map` with optional per-key TTL and optional LRU max size.
|
|
204
|
+
*
|
|
205
|
+
* @param options - `name`, `maxSize`, `defaultTtl` (seconds), or custom `backend`.
|
|
206
|
+
* @returns `ReactiveMapBundle` — imperative methods (`has`/`get`/`set`/`setMany`/`delete`/
|
|
207
|
+
* `deleteMany`/`clear`/`pruneExpired`), reactive `entries` node, and O(1)-ish `size`.
|
|
208
|
+
*
|
|
209
|
+
* @remarks
|
|
210
|
+
* **TTL:** Expiry is checked on `get`, `has`, `size`, `pruneExpired`, and before each
|
|
211
|
+
* snapshot emission (expired keys are pruned first). Reads that discover expired keys
|
|
212
|
+
* emit a snapshot so subscribers see state consistent with the read's return value.
|
|
213
|
+
* There is no background timer; monotonic-clock expiry is immune to wall-clock changes.
|
|
214
|
+
*
|
|
215
|
+
* **LRU:** Uses native `Map` insertion order — `get` / `has` refreshes position via
|
|
216
|
+
* delete-then-reinsert; under `maxSize` pressure the first key in iteration order is
|
|
217
|
+
* evicted. LRU touching does NOT trigger emission (internal optimization).
|
|
218
|
+
*
|
|
219
|
+
* **Backend:** The default {@link NativeMapBackend} owns LRU/TTL. For persistent /
|
|
220
|
+
* HAMT / shared-state semantics plug in a custom {@link MapBackend}. `maxSize` and
|
|
221
|
+
* `defaultTtl` on the options object are only applied to the default backend — if
|
|
222
|
+
* you supply `backend`, configure those on your backend directly.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* import { reactiveMap } from "@graphrefly/graphrefly-ts";
|
|
227
|
+
*
|
|
228
|
+
* const m = reactiveMap<string, number>({ name: "cache", maxSize: 100, defaultTtl: 60 });
|
|
229
|
+
* m.set("x", 1);
|
|
230
|
+
* m.setMany([["y", 2], ["z", 3]]);
|
|
231
|
+
* m.entries.subscribe((msgs) => { console.log(msgs); });
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @category extra
|
|
235
|
+
*/
|
|
236
|
+
declare function reactiveMap<K, V>(options?: ReactiveMapOptions<K, V>): ReactiveMapBundle<K, V>;
|
|
237
|
+
|
|
238
|
+
export { type MapBackend as M, NativeMapBackend as N, type ReactiveMapBundle as R, type ReactiveMapOptions as a, type NativeMapBackendOptions as b, reactiveMap as r };
|