@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/extra/operators.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/extra/operators.ts
|
|
2
|
+
export * from "@graphrefly/pure-ts/extra/operators";
|
|
3
|
+
//# sourceMappingURL=operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/operators.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/extra/operators\";\n"],"mappings":";AAEA,cAAc;","names":[]}
|
package/dist/extra/reactive.cjs
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var rn=Object.getOwnPropertyNames;var on=Object.prototype.hasOwnProperty;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var sn=(r,e)=>{for(var n in e)ge(r,n,{get:e[n],enumerable:!0})},an=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of rn(e))!on.call(r,o)&&o!==n&&ge(r,o,{get:()=>e[o],enumerable:!(t=tn(e,o))||t.enumerable});return r};var dn=r=>an(ge({},"__esModule",{value:!0}),r);function Oe(){return j>0||ee}function Ve(){return j>0}function Ce(r){j>0?ne.push(r):r()}function K(r){j+=1;let e=!1;try{r()}catch(n){throw e=!0,n}finally{if(j-=1,j===0)if(e){if(!ee){let n=ne.splice(0);for(let t of n)try{t()}catch{}P.length=0,G.length=0,q.length=0}}else un()}}function un(){let r=!ee;r&&(ee=!0);let e=[],n=0;try{for(;P.length>0||G.length>0||q.length>0||r&&ne.length>0;){if(r&&ne.length>0){let i=ne.splice(0);for(let a of i)try{a()}catch(s){e.push(s)}continue}if(n+=1,n>1e3)throw P.length=0,G.length=0,q.length=0,new Error("batch drain exceeded 1000 iterations \u2014 likely a reactive cycle");let o=(P.length>0?P:G.length>0?G:q).splice(0);for(let i of o)try{i()}catch(a){e.push(a)}}}finally{r&&(ee=!1)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"batch drain: multiple callbacks threw")}function de(r,e,n){if(e.length===0)return;if(e.length===1){let u=n(e[0][0]);if(u<3||!Oe()){r(e);return}(u>=5?q:u===4?G:P).push(()=>r(e));return}let t=e.length,o=t,i=t,a=t,s=0;for(;s<t&&n(e[s][0])<3;)s++;for(o=s;s<t&&n(e[s][0])===3;)s++;for(i=s;s<t&&n(e[s][0])===4;)s++;a=s;let d=Oe();if(o>0){let u=e.slice(0,o);r(u)}if(i>o){let u=e.slice(o,i);d?P.push(()=>r(u)):r(u)}if(a>i){let u=e.slice(i,a);d?G.push(()=>r(u)):r(u)}if(t>a){let u=e.slice(a,t);d?q.push(()=>r(u)):r(u)}}var j,ee,P,G,q,ne,Y=O(()=>{"use strict";j=0,ee=!1,P=[],G=[],q=[],ne=[]});var te,N,R,D,H,B,re,F,I,k,J,ye,ln,_e,cn,fn,ve,De,Ie,Le,Te,U=O(()=>{"use strict";te=Symbol.for("graphrefly/START"),N=Symbol.for("graphrefly/DATA"),R=Symbol.for("graphrefly/DIRTY"),D=Symbol.for("graphrefly/RESOLVED"),H=Symbol.for("graphrefly/INVALIDATE"),B=Symbol.for("graphrefly/PAUSE"),re=Symbol.for("graphrefly/RESUME"),F=Symbol.for("graphrefly/TEARDOWN"),I=Symbol.for("graphrefly/COMPLETE"),k=Symbol.for("graphrefly/ERROR"),J=Object.freeze([R]),ye=Object.freeze([D]),ln=Object.freeze([H]),_e=Object.freeze([te]),cn=Object.freeze([I]),fn=Object.freeze([F]),ve=Object.freeze([J]),De=Object.freeze([ye]),Ie=Object.freeze([ln]),Le=Object.freeze([cn]),Te=Object.freeze([fn])});function Ke(r){r.registerCodec(hn)}var hn,Fe=O(()=>{"use strict";hn={name:"json",version:1,contentType:"application/json",encode(r){let e=JSON.stringify(r);return new TextEncoder().encode(e)},decode(r,e){let n=new TextDecoder().decode(r);return JSON.parse(n)}}});function ue(r){if(r==null)return pn;let{type:e,id:n,...t}=r;return{type:e??"system",id:n??"",...t}}var pn,ze=O(()=>{"use strict";pn={type:"system",id:""}});function oe(){return Math.trunc(performance.now()*1e6)}function Pe(){return Date.now()*1e6}var we=O(()=>{"use strict"});function Ge(r){r.registerMessageType(te,{tier:0,wireCrossing:!1}),r.registerMessageType(R,{tier:1,wireCrossing:!1}),r.registerMessageType(H,{tier:1,wireCrossing:!1,metaPassthrough:!1}),r.registerMessageType(B,{tier:2,wireCrossing:!1}),r.registerMessageType(re,{tier:2,wireCrossing:!1}),r.registerMessageType(N,{tier:3,wireCrossing:!0}),r.registerMessageType(D,{tier:3,wireCrossing:!0}),r.registerMessageType(I,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(k,{tier:4,wireCrossing:!0,metaPassthrough:!1}),r.registerMessageType(F,{tier:5,wireCrossing:!0,metaPassthrough:!1})}var le,He=O(()=>{"use strict";U();le=class{_messageTypes=new Map;_codecs=new Map;_onMessage;_onSubscribe;_defaultVersioning;_defaultHashFn;_inspectorEnabled=!(typeof process<"u"&&process.env?.NODE_ENV==="production");_globalInspector;_rigorRecorder;_frozen=!1;tierOf;constructor(e){this._onMessage=e.onMessage,this._onSubscribe=e.onSubscribe,this._defaultVersioning=e.defaultVersioning,this._defaultHashFn=e.defaultHashFn,this.tierOf=n=>{let t=this._messageTypes.get(n);return t!=null?t.tier:1}}get onMessage(){return this._frozen=!0,this._onMessage}get onSubscribe(){return this._frozen=!0,this._onSubscribe}set onMessage(e){this._assertUnfrozen(),this._onMessage=e}set onSubscribe(e){this._assertUnfrozen(),this._onSubscribe=e}get defaultVersioning(){return this._defaultVersioning}set defaultVersioning(e){this._assertUnfrozen(),this._defaultVersioning=e}get defaultHashFn(){return this._defaultHashFn}set defaultHashFn(e){this._assertUnfrozen(),this._defaultHashFn=e}get inspectorEnabled(){return this._inspectorEnabled}set inspectorEnabled(e){this._inspectorEnabled=e}get globalInspector(){return this._globalInspector}set globalInspector(e){this._globalInspector=e}get rigorRecorder(){return this._rigorRecorder}set rigorRecorder(e){this._rigorRecorder=e}registerMessageType(e,n){return this._assertUnfrozen(),this._messageTypes.set(e,{tier:n.tier,wireCrossing:n.wireCrossing??n.tier>=3,metaPassthrough:n.metaPassthrough??!0}),this}messageTier(e){let n=this._messageTypes.get(e);return n!=null?n.tier:1}isWireCrossing(e){let n=this._messageTypes.get(e);return n!=null?n.wireCrossing:!0}isLocalOnly(e){return!this.isWireCrossing(e)}isMetaPassthrough(e){let n=this._messageTypes.get(e);return n!=null?n.metaPassthrough:!0}isKnownMessageType(e){return this._messageTypes.has(e)}registerCodec(e){return this._assertUnfrozen(),this._codecs.set(e.name,e),this}lookupCodec(e){return this._codecs.get(e)}_isFrozen(){return this._frozen}_assertUnfrozen(){if(this._frozen)throw new Error("GraphReFlyConfig is frozen: a node has already captured this config. Register custom types and set hooks before creating any node.")}}});var X,Be=O(()=>{"use strict";X=class extends Error{actor;action;nodeName;constructor(e,n){super(n??`GuardDenied: action "${String(e.action)}" denied for actor type "${String(e.actor.type)}"`),this.name="GuardDenied",this.actor=e.actor,this.action=e.action,this.nodeName=e.nodeName}get node(){return this.nodeName}}});function xe(r){if(r===void 0)return null;if(typeof r=="number"){if(!Number.isFinite(r))throw new TypeError(`Cannot hash non-finite number: ${r}`);if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw new TypeError(`Cannot hash integer outside safe range (|n| > 2^53-1): ${r}. Cross-language cid parity is not guaranteed for unsafe integers.`);return r}if(typeof r=="string"||typeof r=="boolean"||r===null)return r;if(Array.isArray(r))return r.map(xe);if(typeof r=="object"&&r!==null){let e={};for(let n of Object.keys(r).sort())e[n]=xe(r[n]);return e}return null}function gn(r){let e=bn.encode(r),n=e.length,t=n*8,o=n+9+63&-64,i=new Uint8Array(o);i.set(e),i[n]=128;let a=new DataView(i.buffer);a.setUint32(o-4,t>>>0,!1),a.setUint32(o-8,Math.floor(t/4294967296)>>>0,!1);let s=1779033703,d=3144134277,u=1013904242,c=2773480762,p=1359893119,h=2600822924,f=528734635,m=1541459225,y=new Uint32Array(64),w=(E,M)=>E>>>M|E<<32-M;for(let E=0;E<o;E+=64){for(let g=0;g<16;g++)y[g]=a.getUint32(E+g*4,!1);for(let g=16;g<64;g++){let x=y[g-15],A=y[g-2],S=w(x,7)^w(x,18)^x>>>3,Q=w(A,17)^w(A,19)^A>>>10;y[g]=y[g-16]+S+y[g-7]+Q>>>0}let M=s,V=d,C=u,W=c,l=p,b=h,v=f,T=m;for(let g=0;g<64;g++){let x=w(l,6)^w(l,11)^w(l,25),A=l&b^~l&v,S=T+x+A+mn[g]+y[g]>>>0,Q=w(M,2)^w(M,13)^w(M,22),z=M&V^M&C^V&C,nn=Q+z>>>0;T=v,v=b,b=l,l=W+S>>>0,W=C,C=V,V=M,M=S+nn>>>0}s=s+M>>>0,d=d+V>>>0,u=u+C>>>0,c=c+W>>>0,p=p+l>>>0,h=h+b>>>0,f=f+v>>>0,m=m+T>>>0}let _=E=>E.toString(16).padStart(8,"0");return _(s)+_(d)+_(u)+_(c)+_(p)+_(h)+_(f)+_(m)}function Ne(r){let e=xe(r??null),n=JSON.stringify(e);return gn(n).slice(0,16)}function yn(){let r=globalThis.crypto;if(r?.randomUUID)return r.randomUUID();let e=()=>Math.floor(Math.random()*4294967296).toString(16).padStart(8,"0"),n=e()+e()+e()+e();return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${(parseInt(n.slice(16,17),16)&3|8).toString(16)}${n.slice(17,20)}-${n.slice(20,32)}`}function ke(r,e,n){let t=n?.id??yn();if(r===0)return{id:t,version:0};let i=(n?.hash??Ne)(e);return{id:t,version:0,cid:i,prev:null}}function Ue(r,e,n){r.version+=1,"cid"in r&&(r.prev=r.cid,r.cid=n(e))}var mn,bn,$e=O(()=>{"use strict";mn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),bn=new TextEncoder});function qe(r){return{node:r,unsub:null,prevData:void 0,dirty:!1,involvedThisWave:!1,dataBatch:[],terminal:void 0}}function Me(r){r.prevData=void 0,r.dirty=!1,r.involvedThisWave=!1,r.dataBatch.length=0,r.terminal=void 0}function ce(r){return r.length===0?r:typeof r[0]=="symbol"?[r]:r}function ie(r,e,n){let t=Ye(r)?r:[],o=typeof r=="function"?r:typeof e=="function"?e:void 0,i={};return Ye(r)?i=(Ee(e)?e:n)??{}:Ee(r)?i=r:i=(Ee(e)?e:n)??{},new fe(t,o,i)}var We,je,_n,vn,Ae,fe,Ye,Ee,Re=O(()=>{"use strict";Fe();ze();Y();we();He();Be();U();$e();We=()=>{},je=100;_n=(r,e,n,t)=>{n.direction==="down-in"&&r._onDepMessage(n.depIndex,e)},vn=(r,e,n,t)=>{let o=r;if(o._status==="completed"||o._status==="errored")return;let i=o._cached,a=i===void 0?[_e]:[_e,[N,i]];o._status==="dirty"&&a.push(J),de(e,a,o._config.tierOf)},Ae=new le({onMessage:_n,onSubscribe:vn});Ge(Ae);Ke(Ae);fe=class r{_optsName;_describeKind;meta;_hasMeta;_config;_deps;_sinks=null;_sinkCount=0;_cached;_status;_cleanup;_store={};_waveHasNewData=!1;_hasNewTerminal=!1;_hasCalledFnOnce=!1;_paused=!1;_pendingWave=!1;_isExecutingFn=!1;_pendingRerun=!1;_rerunDepth=0;_dirtyDepCount=0;_batchPendingMessages=null;_pauseLocks=null;_pauseBuffer=null;_fn;_equals;_resubscribable;_resetOnTeardown;_autoComplete;_autoError;_pausable;_partial;_guard;_extraGuards;_hashFn;_versioning;_versioningLevel;_lastMutation;_inspectorHooks;_actions;constructor(e,n,t){this._config=t.config??Ae,this._config.onMessage,this._optsName=t.name,this._describeKind=t.describeKind,this._equals=t.equals??Object.is,this._resubscribable=t.resubscribable??!1,this._resetOnTeardown=t.resetOnTeardown??!1,this._autoComplete=t.completeWhenDepsComplete??!0,this._autoError=t.errorWhenDepsError??!0,this._pausable=t.pausable??!0,this._guard=t.guard,this._fn=n,this._partial=t.partial??!1,this._cached=t.initial!==void 0?t.initial:void 0,this._status=e.length===0&&n==null&&this._cached!==void 0?"settled":"sentinel",this._hashFn=t.versioningHash??this._config.defaultHashFn??Ne;let o=t.versioning??this._config.defaultVersioning;this._versioningLevel=o,this._versioning=o!=null?ke(o,this._cached===void 0?void 0:this._cached,{id:t.versioningId,hash:this._hashFn}):void 0,this._deps=e.map(qe);let i={};for(let[s,d]of Object.entries(t.meta??{})){let u={initial:d,name:`${t.name??"node"}:meta:${s}`,describeKind:"state",config:this._config};t.guard!=null&&(u.guard=t.guard),t.resubscribable===!0&&(u.resubscribable=!0),i[s]=new r([],void 0,u)}Object.freeze(i),this.meta=i,this._hasMeta=Object.keys(i).length>0;let a=this;this._actions={emit(s){a._emit([[N,s]])},down(s){a._emit(ce(s))},up(s){a._emitUp(ce(s))}},this.down=this.down.bind(this),this.up=this.up.bind(this)}get _isTerminal(){return this._status==="completed"||this._status==="errored"}get name(){return this._optsName}get status(){return this._status}get cache(){return this._cached===void 0?void 0:this._cached}get lastMutation(){return this._lastMutation}get v(){return this._versioning}hasGuard(){return this._guard!=null}_applyVersioning(e,n){if(this._isExecutingFn)throw new Error(`Node "${this.name}": _applyVersioning cannot run mid-fn \u2014 call it outside of \`_execFn\` (typically at graph setup time before the first subscribe).`);let t=this._versioningLevel;if(t!=null&&e<=t)return;let o=n?.hash??this._hashFn;o!==this._hashFn&&(this._hashFn=o);let i=this._cached===void 0?void 0:this._cached,a=this._versioning,s=a?.id??n?.id,d=a?.version??0,u=ke(e,i,{id:s,hash:o});u.version=d,this._versioning=u,this._versioningLevel=e}_setInspectorHook(e){return e==null?()=>{}:(this._inspectorHooks==null&&(this._inspectorHooks=new Set),this._inspectorHooks.add(e),()=>{this._inspectorHooks?.delete(e),this._inspectorHooks?.size===0&&(this._inspectorHooks=void 0)})}_pushGuard(e){return this._extraGuards==null&&(this._extraGuards=new Set),this._extraGuards.add(e),()=>{this._extraGuards?.delete(e),this._extraGuards?.size===0&&(this._extraGuards=void 0)}}allowsObserve(e){if(this._guard==null&&this._extraGuards==null)return!0;let n=ue(e);if(this._guard!=null&&!this._guard(n,"observe"))return!1;if(this._extraGuards!=null){for(let t of this._extraGuards)if(!t(n,"observe"))return!1}return!0}_checkGuard(e){if(e?.internal)return;let n=this._guard!=null||this._extraGuards!=null,t=e?.actor!=null;if(!n&&!t)return;let o=ue(e?.actor),i=e?.delivery==="signal"?"signal":"write";if(this._guard!=null&&!this._guard(o,i))throw new X({actor:o,action:i,nodeName:this.name});if(this._extraGuards!=null){for(let a of this._extraGuards)if(!a(o,i))throw new X({actor:o,action:i,nodeName:this.name})}this._lastMutation={actor:o,timestamp_ns:Pe()}}down(e,n){let t=ce(e);t.length!==0&&(this._checkGuard(n),this._emit(t))}emit(e,n){this._checkGuard(n),this._emit([[N,e]])}up(e,n){if(this._deps.length===0)return;let t=ce(e);if(t.length===0)return;this._checkGuard(n);let o=n??{internal:!0};this._validateUpTiers(t);for(let i of this._deps)i.node.up?.(t,o)}_emitUp(e){if(this._deps.length!==0&&e.length!==0){this._validateUpTiers(e);for(let n of this._deps)n.node.up?.(e,{internal:!0})}}_validateUpTiers(e){let n=this._config.tierOf;for(let t of e){let o=n(t[0]);if(o===3||o===4)throw new Error(`Node "${this.name}": tier-${o} messages cannot flow up \u2014 DATA/RESOLVED/COMPLETE/ERROR are downstream-only. Use \`down(...)\` for value delivery; \`up(...)\` is for control signals (DIRTY, INVALIDATE, PAUSE, RESUME, TEARDOWN).`)}}subscribe(e,n){if(n!=null&&this._guard!=null){let d=ue(n);if(!this._guard(d,"observe"))throw new X({actor:d,action:"observe",nodeName:this.name})}let o=this._isTerminal&&this._resubscribable;if(o){this._cached=void 0,this._status="sentinel",this._store={},this._hasCalledFnOnce=!1,this._waveHasNewData=!1,this._hasNewTerminal=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._isExecutingFn=!1,this._rerunDepth=0,this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null;for(let d of this._deps)Me(d);if(this._partial===!1){for(let d of this._deps)if(d.prevData!==void 0||d.dataBatch.length!==0||d.terminal!==void 0||d.dirty)throw new Error(`resubscribable-reset invariant: DepRecord not fully reset for node ${this._optsName??"(anonymous)"}`)}}this._sinkCount+=1;let i;try{i=this._config.onSubscribe(this,e,{sinkCount:this._sinkCount,afterTerminalReset:o},this._actions)}catch(d){throw this._sinkCount-=1,d}this._sinks==null?this._sinks=e:typeof this._sinks=="function"?this._sinks=new Set([this._sinks,e]):this._sinks.add(e);let a=this._isTerminal;if(this._sinkCount===1&&!a)try{this._activate()}catch(d){if(this._sinkCount-=1,this._removeSink(e),this._sinkCount===0&&(this._status="sentinel"),typeof i=="function")try{i()}catch{}throw d}this._status==="sentinel"&&this._cached===void 0&&(this._status="pending");let s=!1;return()=>{s||(s=!0,this._sinkCount-=1,this._removeSink(e),typeof i=="function"&&i(),this._sinks==null&&this._deactivate())}}_removeSink(e){if(this._sinks===e)this._sinks=null;else if(this._sinks!=null&&typeof this._sinks!="function")if(this._sinks.delete(e),this._sinks.size===1){let[n]=this._sinks;this._sinks=n}else this._sinks.size===0&&(this._sinks=null)}_activate(){if(this._deps.length===0){this._fn&&this._execFn();return}this._dirtyDepCount=0;let e=this._deps.length,n=0;try{for(let t=0;t<e;t++){let o=t,i=this._deps[t];i.unsub=We,i.unsub=i.node.subscribe(a=>{if(i.unsub===null)return;let s=this._config.tierOf,d=!1;for(let u of a)s(u[0])>=3&&(d=!0),this._config.onMessage(this,u,{direction:"down-in",depIndex:o},this._actions);d&&this._maybeRunFnOnSettlement()}),n++}}catch(t){this._deps[n].unsub=null;for(let o=0;o<n;o++){let i=this._deps[o];if(i.unsub!=null){let a=i.unsub;i.unsub=null;try{a()}catch{}Me(i)}}throw this._dirtyDepCount=0,t}}_addDep(e){for(let o=0;o<this._deps.length;o++)if(this._deps[o].node===e)return o;let n=this._deps.length,t=qe(e);if(this._deps.push(t),this._sinks==null)return n;t.dirty=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve),t.unsub=We;try{t.unsub=e.subscribe(o=>{if(t.unsub===null)return;let i=this._config.tierOf,a=!1;for(let s of o)i(s[0])>=3&&(a=!0),this._config.onMessage(this,s,{direction:"down-in",depIndex:n},this._actions);a&&this._maybeRunFnOnSettlement()})}catch(o){throw t.unsub=null,this._deps.pop(),this._dirtyDepCount--,o}return n}_deactivate(e=!1){let n=this._cleanup;if(this._cleanup=void 0,typeof n=="function")try{n()}catch(t){this._emit([[k,this._wrapFnError("cleanup threw",t)]])}else if(n!=null&&typeof n=="object"){let t=n.deactivate;if(typeof t=="function")try{t()}catch(o){this._emit([[k,this._wrapFnError("cleanup.deactivate threw",o)]])}}for(let t of this._deps){if(t.unsub!=null){let o=t.unsub;t.unsub=null;try{o()}catch{}}Me(t)}this._waveHasNewData=!1,this._hasNewTerminal=!1,this._hasCalledFnOnce=!1,this._paused=!1,this._pendingWave=!1,this._pendingRerun=!1,this._rerunDepth=0,this._store={},this._dirtyDepCount=0,this._pauseLocks=null,this._pauseBuffer=null,this._fn!=null&&(this._cached=void 0),e||(this._fn!=null||this._deps.length>0)&&(!this._isTerminal||this._resubscribable)&&(this._status="sentinel")}_onDepMessage(e,n){let t=this._deps[e],o=n[0];if(this._inspectorHooks!=null){let i={kind:"dep_message",depIndex:e,message:n};for(let a of this._inspectorHooks)a(i)}if(o!==te){if(o===R){this._depDirtied(t);return}if(o===H){if(this._depInvalidated(t),this._cached===void 0)return;this._emit(Ie);return}if(o===B||o===re){this._emit([n]);return}if(o===F){this._emit(Te);return}if(o===N)this._depSettledAsData(t,n[1]);else if(o===D)this._depSettledAsResolved(t);else if(o===I)this._depSettledAsTerminal(t,!0);else if(o===k)this._depSettledAsTerminal(t,n[1]);else{this._emit([n]);return}if(!this._fn){(o===N||o===D)&&this._emit([n]),(o===I||o===k)&&this._maybeAutoTerminalAfterWave();return}}}_depDirtied(e){e.dirty||(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++,this._status!=="dirty"&&this._emit(ve))}_depSettledAsData(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.involvedThisWave=!0,e.dataBatch.push(n),this._waveHasNewData=!0}_depSettledAsResolved(e){e.dirty&&(e.dirty=!1,this._dirtyDepCount--)}_depSettledAsTerminal(e,n){e.dirty&&(e.dirty=!1,this._dirtyDepCount--),e.terminal=n,e.involvedThisWave=!0,this._hasNewTerminal=!0}_depInvalidated(e){e.prevData=void 0,e.terminal=void 0,e.dataBatch.length=0,e.dirty?e.involvedThisWave=!1:(e.dirty=!0,e.involvedThisWave=!0,this._dirtyDepCount++)}_maybeRunFnOnSettlement(){if(!(this._isTerminal&&!this._resubscribable)&&!(this._dirtyDepCount>0)){if(!this._partial&&!this._hasCalledFnOnce)for(let e=0;e<this._deps.length;e++){let n=this._deps[e];if(n.dataBatch.length===0&&n.prevData===void 0&&n.terminal===void 0){this._maybeAutoTerminalAfterWave();return}}if(this._paused){this._pendingWave=!0;return}if(!this._waveHasNewData&&!this._hasNewTerminal&&this._hasCalledFnOnce){this._clearWaveFlags(),this._emit(De),this._maybeAutoTerminalAfterWave();return}this._fn&&this._execFn(),this._maybeAutoTerminalAfterWave()}}_maybeAutoTerminalAfterWave(){if(this._deps.length===0||this._isTerminal)return;let e=this._deps.find(n=>n.terminal!==void 0&&n.terminal!==!0);if(e!=null){this._autoError&&this._emit([[k,e.terminal]]);return}this._autoComplete&&this._deps.every(n=>n.terminal!==void 0)&&this._emit(Le)}_execFn(){if(!this._fn||this._isTerminal&&!this._resubscribable)return;if(this._isExecutingFn){this._pendingRerun=!0;return}let e=this._cleanup;if(typeof e=="function"){this._cleanup=void 0;try{e()}catch(a){this._emit([[k,this._wrapFnError("cleanup threw",a)]]);return}}else if(e!=null&&typeof e=="object"){let a=e.beforeRun;if(typeof a=="function"){e.beforeRun=void 0;try{a()}catch(s){this._emit([[k,this._wrapFnError("cleanup.beforeRun threw",s)]]);return}}}let n=this._deps.map(a=>a.involvedThisWave?a.dataBatch.length>0?[...a.dataBatch]:[]:void 0),t=this._deps.map(a=>a.prevData);for(let a=0;a<this._deps.length;a++){let s=n[a];s!=null&&s.length>0&&(this._deps[a].prevData=s[s.length-1])}let o=this._deps.map(a=>a.terminal),i={prevData:t,terminalDeps:o,store:this._store};if(this._hasCalledFnOnce=!0,this._clearWaveFlags(),this._inspectorHooks!=null){let a={kind:"run",batchData:n,prevData:t};for(let s of this._inspectorHooks)s(a)}this._isExecutingFn=!0;try{let a=this._fn(n,this._actions,i);if(typeof a=="function")this._cleanup=a;else if(a!=null&&typeof a=="object"){let s=a;(typeof s.beforeRun=="function"||typeof s.deactivate=="function"||typeof s.invalidate=="function")&&(this._cleanup=a)}}catch(a){this._emit([[k,this._wrapFnError("fn threw",a)]])}finally{this._isExecutingFn=!1,this._pendingRerun?(this._pendingRerun=!1,this._rerunDepth+=1,this._rerunDepth>je?(this._rerunDepth=0,this._emit([[k,new Error(`Node "${this.name}": _pendingRerun depth exceeded ${je} \u2014 likely a reactive cycle`)]])):this._maybeRunFnOnSettlement()):this._rerunDepth=0,this._clearWaveFlags()}}_clearWaveFlags(){this._waveHasNewData=!1,this._hasNewTerminal=!1;for(let e of this._deps)e.involvedThisWave=!1,e.dataBatch.length=0}_wrapFnError(e,n){let t=n instanceof Error?n.message:String(n);return new Error(`Node "${this.name}": ${e}: ${t}`,{cause:n})}_frameBatch(e){let n=this._config.tierOf;if(e.length===1)return n(e[0][0])===3&&this._status!=="dirty"?[J,e[0]]:e;let t=!0,o=!1,i=!1,a=-1;for(let d of e){let u=n(d[0]);u<a&&(t=!1),u===3&&(o=!0),d[0]===R&&(i=!0),a=u}let s=e;if(!t){let d=e.map((u,c)=>({m:u,i:c,tier:n(u[0])}));d.sort((u,c)=>u.tier-c.tier||u.i-c.i),s=d.map(u=>u.m)}if(o&&!i&&this._status!=="dirty"){let d=0;for(;d<s.length&&n(s[d][0])===0;)d++;return d===0?[J,...s]:[...s.slice(0,d),J,...s.slice(d)]}return s}_emit(e){if(e.length===0)return;for(let s=0;s<e.length;s++){let d=e[s];if(d[0]===k&&d[1]===void 0)throw new TypeError('[ERROR, payload] requires a non-undefined payload (spec \xA71.2). Pass an Error object or domain tag instead \u2014 e.g. node.down([[ERROR, new Error("reason")]])')}let n=e;if(this._isTerminal&&!this._resubscribable){let s=e.filter(d=>d[0]===F||d[0]===H);if(s.length===0)return;n=s}n=this._frameBatch(n);let o=null;for(let s=0;s<n.length;s++){let d=n[s],u=d[0];if(u!==B&&u!==re){o?.push(d);continue}if(d.length<2)throw new Error(`Node "${this.name}": [[${u===B?"PAUSE":"RESUME"}]] must carry a lockId payload \u2014 bare PAUSE/RESUME is a protocol violation (C0 rule). Use \`[[PAUSE, lockId]]\` / \`[[RESUME, lockId]]\`.`);let c=!0;if(this._pausable!==!1){let p=d[1];if(u===B)this._pauseLocks==null&&(this._pauseLocks=new Set),this._pauseLocks.add(p),this._paused=!0,this._pausable==="resumeAll"&&this._pauseBuffer==null&&(this._pauseBuffer=[]);else if(this._pauseLocks==null||!this._pauseLocks.has(p))c=!1;else if(this._pauseLocks.delete(p),this._pauseLocks.size===0){if(this._paused=!1,this._pauseBuffer!=null&&this._pauseBuffer.length>0){let h=this._pauseBuffer;this._pauseBuffer=[],this._emit(h)}this._pendingWave&&(this._pendingWave=!1,this._maybeRunFnOnSettlement())}}c?o?.push(d):o==null&&(o=n.slice(0,s))}if(o!=null){if(o.length===0)return;n=o}if(this._hasMeta&&n.some(s=>s[0]===F))for(let s of Object.keys(this.meta))try{this.meta[s]._emit(Te)}catch{}let{finalMessages:i,equalsError:a}=this._updateState(n);if(i.length>0&&this._config.inspectorEnabled){let s=this._config.globalInspector;if(s!=null)try{s({kind:"emit",node:this,messages:i})}catch{}}if(i.length>0)if(this._paused&&this._pausable==="resumeAll"&&this._pauseBuffer!=null){let s=this._config.tierOf,d=[];for(let u of i)s(u[0])===3?this._pauseBuffer.push(u):d.push(u);d.length>0&&this._dispatchOrAccumulate(d)}else this._dispatchOrAccumulate(i);a!=null&&this._emit([[k,a]])}_updateState(e){let n=this._config.tierOf,t,o,i=-1,a=0;for(let c of e)n(c[0])===3&&a++;let s=a<=1,d=-1;if(this._versioning!=null&&a>1){for(let c=e.length-1;c>=0;c--)if(e[c][0]===N){d=c;break}}for(let c=0;c<e.length;c++){let p=e[c],h=p[0];if(h===N){if(p.length>=2){let f=!1;if(s&&this._cached!==void 0)try{f=this._equals(this._cached,p[1])}catch(m){o=this._wrapFnError("equals threw",m),i=c;break}if(f){t==null&&(t=e.slice(0,c)),t.push(ye),this._status="resolved";continue}this._cached=p[1],this._versioning!=null&&(d<0||c===d)&&Ue(this._versioning,p[1],this._hashFn)}this._status="settled",t?.push(p)}else if(t?.push(p),h===R)this._status="dirty";else if(h===D)this._status="resolved";else if(h===I){this._status="completed";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"completed",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===k){this._status="errored";{let f=this._config.rigorRecorder;if(f!=null)try{f.onTerminalTransition(this,"errored",this._autoComplete,this._autoError,this._deps.length>0)}catch{}}}else if(h===H){if(this._cached!==void 0){let m=this._config.rigorRecorder;if(m!=null)try{m.onNonVacuousInvalidate(this,this._cached)}catch{}}this._cached=void 0,this._status="dirty";let f=this._cleanup;if(typeof f=="function"){this._cleanup=void 0;try{f()}catch{}}else if(f!=null&&typeof f=="object"){let m=f.invalidate;if(typeof m=="function")try{m()}catch{}}}else h===F&&(this._resetOnTeardown&&(this._cached=void 0),this._deactivate(!0),this._status="sentinel")}let u=i>=0?t??e.slice(0,i):t??e;return o!=null?{finalMessages:u,equalsError:o}:{finalMessages:u}}_deliverToSinks=e=>{if(this._sinks==null)return;if(typeof this._sinks=="function"){this._sinks(e);return}let n=[...this._sinks];for(let t of n)t(e)};_dispatchOrAccumulate(e){if(Ve()){this._batchPendingMessages===null&&(this._batchPendingMessages=[],Ce(()=>this._flushBatchPending()));for(let n of e)this._batchPendingMessages.push(n);return}de(this._deliverToSinks,e,this._config.tierOf)}_flushBatchPending(){let e=this._batchPendingMessages;if(e===null||(this._batchPendingMessages=null,e.length===0))return;let n=this._frameBatch(e);de(this._deliverToSinks,n,this._config.tierOf)}},Ye=r=>Array.isArray(r),Ee=r=>typeof r=="object"&&r!=null&&!Array.isArray(r)});function L(r,e){return ie([],{...e,initial:r})}function $(r,e,n){return ie(r,(o,i,a)=>{let s=o.map((d,u)=>d!=null&&d.length>0?d.at(-1):a.prevData[u]);i.emit(e(s,a))},{describeKind:"derived",...n})}var se=O(()=>{"use strict";Re()});function Ze(r){return r.subscribe(()=>{})}var Qe=O(()=>{"use strict"});var en=O(()=>{"use strict";Qe()});var Rn={};sn(Rn,{NativeIndexBackend:()=>he,NativeListBackend:()=>pe,NativeLogBackend:()=>me,NativeMapBackend:()=>be,mergeReactiveLogs:()=>En,reactiveIndex:()=>xn,reactiveList:()=>Nn,reactiveLog:()=>Mn,reactiveMap:()=>An});module.exports=dn(Rn);Y();U();se();function Je(r,e){if(r===e)return 0;let n=typeof r;if(n===typeof e&&(n==="number"||n==="string"||n==="boolean"||n==="bigint")){let o=r,i=e;return o<i?-1:o>i?1:0}return String(r).localeCompare(String(e))}function Tn(r,e){let n=Je(r[0],e[0]);return n!==0?n:Je(r[1],e[1])}function Xe(r){return[r.secondary,r.primary]}function Z(r,e){let n=Xe(e),t=0,o=r.length;for(;t<o;){let i=t+o>>1;Tn(n,Xe(r[i]))>0?t=i+1:o=i}return t}var he=class{_version=0;_buf=[];_byPrimary=new Map;get version(){return this._version}get size(){return this._buf.length}has(e){return this._byPrimary.has(e)}get(e){return this._byPrimary.get(e)?.value}upsert(e,n,t,o){let i=this._byPrimary.get(e),a={primary:e,secondary:n,value:t};if(i!==void 0&&o?.equals?.(i,a))return!1;if(i!==void 0){let d=Z(this._buf,i);this._buf.splice(d,1)}let s=Z(this._buf,a);return this._buf.splice(s,0,a),this._byPrimary.set(e,a),this._version+=1,i===void 0}upsertMany(e,n){let t=0;try{for(let o of e){let i=this._byPrimary.get(o.primary),a={primary:o.primary,secondary:o.secondary,value:o.value};if(i!==void 0&&n?.equals?.(i,a))continue;if(i!==void 0){let d=Z(this._buf,i);this._buf.splice(d,1)}let s=Z(this._buf,a);this._buf.splice(s,0,a),this._byPrimary.set(o.primary,a),t+=1}}finally{t>0&&(this._version+=1)}return t}delete(e){let n=this._byPrimary.get(e);if(n===void 0)return!1;let t=Z(this._buf,n);return this._buf.splice(t,1),this._byPrimary.delete(e),this._version+=1,!0}deleteMany(e){let n=0;try{for(let t of e){let o=this._byPrimary.get(t);if(o===void 0)continue;let i=Z(this._buf,o);this._buf.splice(i,1),this._byPrimary.delete(t),n+=1}}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._byPrimary.clear(),this._version+=1,e)}toArray(){return[...this._buf]}toPrimaryMap(){let e=new Map;for(let n of this._buf)e.set(n.primary,n.value);return e}};function wn(r){return r.subscribe(()=>{})}function xn(r={}){let{name:e,versioning:n,equals:t,backend:o}=r,i=o??new he;function a(f){return f?.equals!==void 0||t===void 0?f:{...f,equals:t}}let s=L([],{name:e,describeKind:"state",equals:(f,m)=>f===m,...n!=null?{versioning:n}:{}}),d=$([s],([f])=>{let m=f,y=new Map;for(let w of m)y.set(w.primary,w.value);return y},{initial:i.toPrimaryMap(),describeKind:"derived"}),u=wn(d),c=!1;function p(){let f=i.toArray();K(()=>{s.down([[R]]),s.down([[N,f]])})}function h(f){let m=i.version;try{return f()}finally{i.version!==m&&p()}}return{ordered:s,byPrimary:d,has(f){return i.has(f)},get(f){return i.get(f)},get size(){return i.size},upsert(f,m,y,w){return h(()=>i.upsert(f,m,y,a(w)))},upsertMany(f,m){let y=[...f];y.length!==0&&h(()=>i.upsertMany(y,a(m)))},delete(f){h(()=>i.delete(f))},deleteMany(f){let m=[...f];m.length!==0&&h(()=>i.deleteMany(m))},clear(){h(()=>i.clear())},dispose(){c||(c=!0,u())}}}Y();U();se();var pe=class{_version=0;_buf;constructor(e){this._buf=e?[...e]:[]}get version(){return this._version}get size(){return this._buf.length}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._buf.length+e;if(!(n<0||n>=this._buf.length))return this._buf[n]}append(e){this._buf.push(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._buf.length;this._buf.length=n+e.length;for(let t=0;t<e.length;t++)this._buf[n+t]=e[t];this._version+=1}insert(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insert: index ${e} out of range [0, ${this._buf.length}]`);this._buf.splice(e,0,n),this._version+=1}insertMany(e,n){if(!Number.isInteger(e)||e<0||e>this._buf.length)throw new RangeError(`insertMany: index ${e} out of range [0, ${this._buf.length}]`);n.length!==0&&(this._buf.splice(e,0,...n),this._version+=1)}pop(e){if(this._buf.length===0)throw new RangeError("pop from empty list");if(!Number.isInteger(e))throw new RangeError(`pop: index ${e} must be an integer`);let n=e>=0?e:this._buf.length+e;if(n<0||n>=this._buf.length)throw new RangeError(`pop: index ${e} out of range`);let[t]=this._buf.splice(n,1);return this._version+=1,t}clear(){let e=this._buf.length;return e===0?0:(this._buf.length=0,this._version+=1,e)}toArray(){return[...this._buf]}};function Nn(r,e={}){let{name:n,versioning:t,backend:o}=e,i=o??new pe(r),a=L(i.toArray(),{name:n,describeKind:"state",equals:(u,c)=>u===c,...t!=null?{versioning:t}:{}});function s(){let u=i.toArray();K(()=>{a.down([[R]]),a.down([[N,u]])})}function d(u){let c=i.version;try{return u()}finally{i.version!==c&&s()}}return{items:a,get size(){return i.size},at(u){return i.at(u)},append(u){d(()=>i.append(u))},appendMany(u){d(()=>i.appendMany(u))},insert(u,c){d(()=>i.insert(u,c))},insertMany(u,c){d(()=>i.insertMany(u,c))},pop(u=-1){return d(()=>i.pop(u))},clear(){d(()=>i.clear())},dispose(){}}}Y();U();Re();se();en();var me=class{_version=0;_maxSize;_buf;_head=0;_size=0;constructor(e,n){if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(this._maxSize=n,n!==void 0){if(this._buf=new Array(n),e&&e.length>0){let t=Math.min(e.length,n),o=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[o+i];this._size=t}}else this._buf=e?[...e]:[],this._size=this._buf.length}get version(){return this._version}get size(){return this._size}at(e){if(!Number.isInteger(e))return;let n=e>=0?e:this._size+e;if(!(n<0||n>=this._size))return this._maxSize!==void 0?this._buf[(this._head+n)%this._maxSize]:this._buf[n]}append(e){this._rawAppend(e),this._version+=1}appendMany(e){if(e.length===0)return;let n=this._maxSize!==void 0&&e.length>this._maxSize?e.length-this._maxSize:0;for(let t=n;t<e.length;t++)this._rawAppend(e[t]);this._version+=1}clear(){if(this._size===0)return 0;let e=this._size;if(this._maxSize===void 0)this._buf.length=0;else for(let n=0;n<e;n++)this._buf[(this._head+n)%this._maxSize]=void 0;return this._head=0,this._size=0,this._version+=1,e}trimHead(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`trimHead: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return 0;let n=Math.min(e,this._size);if(this._maxSize===void 0)this._buf.splice(0,n);else{for(let t=0;t<n;t++)this._buf[(this._head+t)%this._maxSize]=void 0;this._head=(this._head+n)%this._maxSize}return this._size-=n,this._version+=1,n}slice(e,n){if(!Number.isInteger(e)||e<0)throw new RangeError(`slice: start must be a non-negative integer (got ${e})`);if(n!==void 0&&(!Number.isInteger(n)||n<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${n})`);let t=n===void 0?this._size:Math.min(Math.max(n,0),this._size),o=Math.min(e,this._size);if(o>=t)return[];let i=t-o;if(this._maxSize===void 0)return this._buf.slice(o,t);let a=new Array(i);for(let s=0;s<i;s++)a[s]=this._buf[(this._head+o+s)%this._maxSize];return a}tail(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`tail: n must be a non-negative integer (got ${e})`);if(e===0||this._size===0)return[];let n=Math.min(e,this._size);return this.slice(this._size-n,this._size)}toArray(){if(this._maxSize===void 0)return[...this._buf];let e=new Array(this._size);for(let n=0;n<this._size;n++)e[n]=this._buf[(this._head+n)%this._maxSize];return e}snapshot(){return this.toArray()}restore(e){if(this._maxSize===void 0){this._buf.length=0;for(let n=0;n<e.length;n++)this._buf.push(e[n]);this._size=this._buf.length}else{let n=this._maxSize;for(let i=0;i<n;i++)this._buf[i]=void 0;this._head=0;let t=Math.min(e.length,n),o=e.length-t;for(let i=0;i<t;i++)this._buf[i]=e[o+i];this._size=t}this._version+=1}_rawAppend(e){if(this._maxSize===void 0){this._buf.push(e),this._size=this._buf.length;return}this._size<this._maxSize?(this._buf[(this._head+this._size)%this._maxSize]=e,this._size+=1):(this._buf[this._head]=e,this._head=(this._head+1)%this._maxSize)}};function ae(r){return r.subscribe(()=>{})}var kn=64;function Mn(r,e={}){let{name:n,maxSize:t,versioning:o,guard:i,backend:a}=e,s=a??new me(r,t),d=L(s.toArray(),{name:n,describeKind:"state",equals:(l,b)=>l===b,...o!=null?{versioning:o}:{},...i!=null?{guard:i}:{}});function u(){let l=s.toArray();K(()=>{d.down([[R]],{internal:!0}),d.down([[N,l]],{internal:!0})})}let c=new Map,p=new Map,h=new Map;function f(l,b){return`${l}:${b===void 0?"END":b}`}function m(l){if(l.size<kn)return;let b=l.keys().next();if(b.done)return;let v=l.get(b.value);v!==void 0&&v.dispose(),l.delete(b.value)}function y(l){let b=s.version;try{return l()}finally{s.version!==b&&u()}}function w(l){if(!Number.isInteger(l)||l<0)throw new RangeError(`tail: n must be a non-negative integer (got ${l})`);let b=c.get(l);if(b!==void 0)return c.delete(l),c.set(l,b),b.node;m(c);let v=$([d],([g])=>{let x=g;return l===0||x.length===0?[]:x.slice(Math.max(0,x.length-l))},{initial:s.tail(l),describeKind:"derived"}),T=ae(v);return c.set(l,{node:v,dispose:T}),v}function _(l,b){if(!Number.isInteger(l)||l<0)throw new RangeError(`slice: start must be a non-negative integer (got ${l})`);if(b!==void 0&&(!Number.isInteger(b)||b<0))throw new RangeError(`slice: stop must be a non-negative integer or undefined (got ${b})`);let v=f(l,b),T=p.get(v);if(T!==void 0)return p.delete(v),p.set(v,T),T.node;m(p);let g=$([d],([A])=>{let S=A;return b===void 0?S.slice(l):S.slice(l,b)},{initial:s.slice(l,b),describeKind:"derived"}),x=ae(g);return p.set(v,{node:g,dispose:x}),g}function E(l){let b=h.get(l);if(b!==void 0)return b.node;let v=$([d,l],([g,x])=>{let A=g,S=Math.max(0,Math.trunc(x??0));return A.slice(S)},{initial:[],describeKind:"derived"}),T=ae(v);return h.set(l,{node:v,dispose:T}),v}let M,V;function C(){M===void 0&&(M=ie([d],(l,b,v)=>{let T=l[0],x=T!=null&&T.length>0?T.at(-1):v.prevData[0];if(x==null||x.length===0){b.down([[D]]);return}b.emit(x[x.length-1])},{name:n!=null?`${n}::lastValue`:"lastValue",describeKind:"derived",initial:s.size===0?void 0:s.at(s.size-1)}),V=$([d],([l])=>l.length>0,{name:n!=null?`${n}::hasLatest`:"hasLatest",describeKind:"derived",initial:s.size>0}),ae(M),ae(V))}let W={entries:d,get size(){return s.size},at(l){return s.at(l)},append(l){y(()=>s.append(l))},appendMany(l){l.length!==0&&y(()=>s.appendMany(l))},clear(){y(()=>s.clear())},trimHead(l){y(()=>s.trimHead(l))},withLatest(){return C(),d},get lastValue(){return C(),M},get hasLatest(){return C(),V},view(l){switch(l.kind){case"tail":return w(l.n);case"slice":return _(l.start,l.stop);case"fromCursor":return E(l.cursor)}},attach(l){let b=l.subscribe(v=>{for(let T of v)T[0]===N&&W.append(T[1])});return()=>b()},attachStorage(l){if(l.length===0)return()=>{};let b=new Map;for(let T of l)b.set(T,s.size);(async()=>{for(let T of l)if(typeof T.loadEntries=="function")try{let g=await Promise.resolve(T.loadEntries());g.entries.length>0&&s.size===0&&(s.restore(g.entries),b.set(T,g.entries.length),u());break}catch{}})();let v=d.subscribe(T=>{for(let g of T){if(g[0]!==N)continue;let x=g[1];for(let A of l){let S=b.get(A)??0;if(x.length<S){try{let z=A.appendEntries(x);z instanceof Promise&&z.catch(()=>{})}catch{}b.set(A,x.length);continue}if(x.length===S)continue;let Q=x.slice(S);b.set(A,x.length);try{let z=A.appendEntries(Q);z instanceof Promise&&z.catch(()=>{})}catch{}}}});return()=>v()},disposeAllViews(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()},dispose(){for(let l of c.values())l.dispose();c.clear();for(let l of p.values())l.dispose();p.clear();for(let l of h.values())l.dispose();h.clear()}};return W}var Se=new WeakMap;function En(r){let e=Se.get(r);if(e)return e;let n=r.map(c=>c.cache??[]),t=n.flat(),o=L(t,{name:"mergeReactiveLogs",describeKind:"state",equals:(c,p)=>c===p}),i=r.map((c,p)=>[...n[p]??[]]),a=[];for(let c=0;c<r.length;c++){let p=c,h=r[p].subscribe(f=>{for(let m of f)if(m[0]===N)i[p]=[...m[1]],o.emit(i.flat());else if(m[0]===I){i[p]=[];let y=a[p];y!==void 0&&(a[p]=void 0,y())}else m[0]===k&&o.down([[k,m[1]]])});a.push(h)}let s=Ze(o),d=!1,u={node:o,dispose(){if(!d){d=!0;for(let c of a)c?.();a.length=0,s(),Se.delete(r)}}};return Se.set(r,u),u}Y();we();U();se();var be=class{_version=0;_store=new Map;_maxSize;_defaultTtl;constructor(e={}){let{maxSize:n,defaultTtl:t}=e;if(n!==void 0&&n<1)throw new RangeError("maxSize must be >= 1");if(t!==void 0&&t<=0)throw new RangeError("defaultTtl must be positive");this._maxSize=n,this._defaultTtl=t}get version(){return this._version}get size(){return this._store.size}has(e){let n=this._store.get(e);return n===void 0?!1:this._isExpired(n)?(this._store.delete(e),this._version+=1,!1):(this._touchLru(e,n),!0)}get(e){let n=this._store.get(e);if(n!==void 0){if(this._isExpired(n)){this._store.delete(e),this._version+=1;return}return this._touchLru(e,n),n.value}}set(e,n,t){let o=this._resolveExpiresAt(t);this._store.has(e)&&this._store.delete(e),this._store.set(e,{value:n,expiresAt:o}),this._evictLruWhileOver(),this._version+=1}setMany(e,n){let t=this._resolveExpiresAt(n),o=0;try{for(let[i,a]of e)this._store.has(i)&&this._store.delete(i),this._store.set(i,{value:a,expiresAt:t}),o+=1}finally{o>0&&(this._evictLruWhileOver(),this._version+=1)}}delete(e){let n=this._store.delete(e);return n&&(this._version+=1),n}deleteMany(e){let n=0;try{for(let t of e)this._store.delete(t)&&(n+=1)}finally{n>0&&(this._version+=1)}return n}clear(){let e=this._store.size;return e===0?0:(this._store.clear(),this._version+=1,e)}pruneExpired(){let e=oe(),n=0;for(let[t,o]of this._store)this._isExpired(o,e)&&(this._store.delete(t),n+=1);return n>0&&(this._version+=1),n}toMap(){let e=oe(),n=new Map;for(let[t,o]of this._store)this._isExpired(o,e)||n.set(t,o.value);return n}_resolveExpiresAt(e){let n=e??this._defaultTtl;if(n!==void 0){if(!Number.isFinite(n)||n<=0)throw new RangeError(`MapBackend: ttl must be a positive finite number (got ${n})`);return oe()+n*1e9}}_isExpired(e,n){return e.expiresAt===void 0?!1:(n??oe())>=e.expiresAt}_touchLru(e,n){this._store.delete(e),this._store.set(e,n)}_evictLruWhileOver(){if(this._maxSize!==void 0)for(;this._store.size>this._maxSize;){let e=this._store.keys().next().value;if(e===void 0)break;this._store.delete(e)}}};function An(r={}){let{name:e,maxSize:n,defaultTtl:t,versioning:o,backend:i,retention:a}=r;if(a&&n!==void 0)throw new RangeError("reactiveMap: `maxSize` (LRU) and `retention` (score-based) are mutually exclusive. Pick one eviction policy.");if(a&&a.archiveThreshold===void 0&&a.maxSize===void 0)throw new RangeError("reactiveMap: `retention` requires at least one of `archiveThreshold` or `maxSize` to trigger archival.");let s=i??new be({maxSize:n,defaultTtl:t}),d=L(s.toMap(),{name:e,describeKind:"state",equals:(h,f)=>h===f,...o!=null?{versioning:o}:{}});function u(){let h=s.toMap();K(()=>{d.down([[R]]),d.down([[N,h]])})}function c(){if(!a)return;let h=s.toMap(),f=a.archiveThreshold,m=a.maxSize,y=[];for(let[_,E]of h)y.push({key:_,value:E,score:a.score(_,E)});y.sort((_,E)=>_.score-E.score);let w=new Set;if(f!==void 0)for(let _ of y)if(_.score<f)w.add(_.key);else break;if(m!==void 0&&y.length-w.size>m)for(let _ of y){if(y.length-w.size<=m)break;w.has(_.key)||w.add(_.key)}if(w.size!==0)for(let _ of y)w.has(_.key)&&(a.onArchive?.(_.key,_.value,_.score),s.delete(_.key))}function p(h,f="mutation"){let m=s.version;try{return h()}finally{s.version!==m&&(f==="mutation"&&c(),u())}}return{entries:d,has(h){return p(()=>s.has(h),"read")},get(h){return p(()=>s.get(h),"read")},set(h,f,m){p(()=>s.set(h,f,m?.ttl))},setMany(h,f){p(()=>s.setMany(h,f?.ttl))},delete(h){p(()=>s.delete(h))},deleteMany(h){p(()=>s.deleteMany(h))},clear(){p(()=>s.clear())},pruneExpired(){p(()=>s.pruneExpired())},get size(){return s.size},dispose(){}}}0&&(module.exports={NativeIndexBackend,NativeListBackend,NativeLogBackend,NativeMapBackend,mergeReactiveLogs,reactiveIndex,reactiveList,reactiveLog,reactiveMap});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/extra/reactive.ts
|
|
18
|
+
var reactive_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(reactive_exports);
|
|
20
|
+
__reExport(reactive_exports, require("@graphrefly/pure-ts/extra/reactive"), module.exports);
|
|
21
|
+
//# sourceMappingURL=reactive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/reactive.ts"],"sourcesContent":["// Phase 13.9.A shim — re-export from pure-TS sibling until\n// @graphrefly/native (napi binding) and per-milestone swap-overs land.\nexport * from \"@graphrefly/pure-ts/extra/reactive\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAEA,6BAAc,+CAFd;","names":[]}
|
|
@@ -1,353 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { L as LogBackend, M as MergedReactiveLog, N as NativeLogBackend, a as ReactiveLogBundle, R as ReactiveLogOptions, V as ViewSpec, m as mergeReactiveLogs, r as reactiveLog } from '../reactive-log-DIGdYqQ6.cjs';
|
|
3
|
-
export { M as MapBackend, N as NativeMapBackend, a as NativeMapBackendOptions, R as ReactiveMapBundle, b as ReactiveMapOptions, c as ReactiveMapRetention, r as reactiveMap } from '../reactive-map-CEFGp8TK.cjs';
|
|
4
|
-
import './storage-tiers.cjs';
|
|
5
|
-
|
|
6
|
-
type IndexRow<K, V = unknown> = {
|
|
7
|
-
readonly primary: K;
|
|
8
|
-
readonly secondary: unknown;
|
|
9
|
-
readonly value: V;
|
|
10
|
-
};
|
|
11
|
-
type ReactiveIndexOptions<K, V = unknown> = {
|
|
12
|
-
/** Optional registry name for `describe()` / debugging. */
|
|
13
|
-
name?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Storage backend. Defaults to `NativeIndexBackend` (flat array + parallel `Map<K,IndexRow>`).
|
|
16
|
-
* Users can plug in persistent / B-tree backends via the {@link IndexBackend} interface.
|
|
17
|
-
*/
|
|
18
|
-
backend?: IndexBackend<K, V>;
|
|
19
|
-
/**
|
|
20
|
-
* Optional versioning level for the underlying `ordered` state node. Set at
|
|
21
|
-
* construction time; cannot be changed later. Pass `0` for V0 identity +
|
|
22
|
-
* monotonic version counter, or `1` for V1 + content-addressed cid.
|
|
23
|
-
* (The `byPrimary` derived node inherits through the dep graph.)
|
|
24
|
-
*/
|
|
25
|
-
versioning?: VersioningLevel;
|
|
26
|
-
/**
|
|
27
|
-
* Default row-equality used to short-circuit idempotent upserts. When
|
|
28
|
-
* provided, every `upsert` / `upsertMany` that finds an existing primary
|
|
29
|
-
* compares the stored and candidate rows via `equals(existing, next)` —
|
|
30
|
-
* on `true` the call is a no-op (no version bump, no emission). Per-call
|
|
31
|
-
* `UpsertOptions.equals` overrides this default. Analogous to
|
|
32
|
-
* `NodeOptions.equals` on the core `node()` primitive.
|
|
33
|
-
*/
|
|
34
|
-
equals?: (existing: IndexRow<K, V>, next: IndexRow<K, V>) => boolean;
|
|
35
|
-
};
|
|
36
|
-
type ReactiveIndexBundle<K, V = unknown> = {
|
|
37
|
-
/** Rows sorted by `(secondary, primary)`. */
|
|
38
|
-
readonly ordered: Node<readonly IndexRow<K, V>[]>;
|
|
39
|
-
/** Map from primary key to stored value. */
|
|
40
|
-
readonly byPrimary: Node<ReadonlyMap<K, V>>;
|
|
41
|
-
/** O(1) primary-key existence check. */
|
|
42
|
-
has: (primary: K) => boolean;
|
|
43
|
-
/** O(1) value lookup by primary key. */
|
|
44
|
-
get: (primary: K) => V | undefined;
|
|
45
|
-
/** Number of rows currently in the index (O(1)). */
|
|
46
|
-
readonly size: number;
|
|
47
|
-
/**
|
|
48
|
-
* Upserts a row. When `opts.equals(existing, next)` returns `true` for an
|
|
49
|
-
* existing primary key, the upsert is a no-op (no version bump, no emission).
|
|
50
|
-
* Useful for idempotent writes.
|
|
51
|
-
*
|
|
52
|
-
* @returns `true` if a new row was inserted (primary key was absent),
|
|
53
|
-
* `false` if the primary key was already present (updated in place OR
|
|
54
|
-
* skipped idempotently via `opts.equals`). D5(a).
|
|
55
|
-
*/
|
|
56
|
-
upsert: (primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>) => boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Bulk upsert — emits one snapshot for the whole batch. `opts.equals` applied
|
|
59
|
-
* per-row. No-op if empty or all rows skipped.
|
|
60
|
-
*
|
|
61
|
-
* **Iterable consumption:** Consumes `rows` once (single-pass).
|
|
62
|
-
*/
|
|
63
|
-
upsertMany: (rows: Iterable<{
|
|
64
|
-
primary: K;
|
|
65
|
-
secondary: unknown;
|
|
66
|
-
value: V;
|
|
67
|
-
}>, opts?: UpsertOptions<K, V>) => void;
|
|
68
|
-
delete: (primary: K) => void;
|
|
69
|
-
/**
|
|
70
|
-
* Bulk delete — emits one snapshot for the whole batch. No-op if nothing was removed.
|
|
71
|
-
*
|
|
72
|
-
* **Iterable consumption:** Consumes `primaries` once (single-pass).
|
|
73
|
-
*/
|
|
74
|
-
deleteMany: (primaries: Iterable<K>) => void;
|
|
75
|
-
clear: () => void;
|
|
76
|
-
/**
|
|
77
|
-
* Releases internal keepalive subscriptions (on `byPrimary`) so the bundle
|
|
78
|
-
* can be GC'd. Safe to call more than once (subsequent calls are no-ops).
|
|
79
|
-
* Subsequent mutations after `dispose()` still execute on the backend but
|
|
80
|
-
* `byPrimary` may stop updating if no external subscriber is attached.
|
|
81
|
-
* D6(a).
|
|
82
|
-
*/
|
|
83
|
-
dispose: () => void;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Storage contract for {@link reactiveIndex}. Implementations own the mutable state and
|
|
87
|
-
* expose a monotonic `version` counter that increments on every structural change.
|
|
88
|
-
*
|
|
89
|
-
* The reactive layer reads `version` to decide when to emit; it does not inspect
|
|
90
|
-
* internal representation. Users can plug in B-tree / skip-list / persistent backends
|
|
91
|
-
* without touching the reactive emission logic.
|
|
92
|
-
*
|
|
93
|
-
* @remarks Post-1.0 op-log changesets will extend this interface with a
|
|
94
|
-
* `changesSince(version: number): Iterable<Change>` method. Current consumers
|
|
95
|
-
* should treat all methods here as stable.
|
|
96
|
-
*
|
|
97
|
-
* @category extra
|
|
98
|
-
*/
|
|
99
|
-
/**
|
|
100
|
-
* Optional per-call options for {@link IndexBackend.upsert} and bulk upsert.
|
|
101
|
-
*
|
|
102
|
-
* @category extra
|
|
103
|
-
*/
|
|
104
|
-
type UpsertOptions<K, V> = {
|
|
105
|
-
/**
|
|
106
|
-
* Skip the upsert if an existing row is considered equal to the proposed row.
|
|
107
|
-
* Default: no skip — every upsert advances `version`. Provide for idempotent
|
|
108
|
-
* keys (e.g., `(a, b) => a.secondary === b.secondary && a.value === b.value`).
|
|
109
|
-
*/
|
|
110
|
-
equals?: (existing: IndexRow<K, V>, next: IndexRow<K, V>) => boolean;
|
|
111
|
-
};
|
|
112
|
-
interface IndexBackend<K, V = unknown> {
|
|
113
|
-
/** Monotonic mutation counter; increments on every upsert/delete/clear that changes state. */
|
|
114
|
-
readonly version: number;
|
|
115
|
-
/** Number of rows currently stored. */
|
|
116
|
-
readonly size: number;
|
|
117
|
-
/** O(1) primary-key existence check. */
|
|
118
|
-
has(primary: K): boolean;
|
|
119
|
-
/** Value lookup by primary key. */
|
|
120
|
-
get(primary: K): V | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* Insert or replace a row. Returns `true` if a row was inserted (primary
|
|
123
|
-
* didn't exist), `false` otherwise (updated OR skipped via `opts.equals`).
|
|
124
|
-
*
|
|
125
|
-
* **Atomicity contract:** Either fully succeeds or throws before any state
|
|
126
|
-
* change; `version` advances only on state change.
|
|
127
|
-
*/
|
|
128
|
-
upsert(primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Atomic bulk upsert. Returns the number of rows that caused a state change
|
|
131
|
-
* (inserts + non-skipped updates). Advances `version` at most once.
|
|
132
|
-
* No-op if iterable is empty or all rows skipped by `opts.equals`.
|
|
133
|
-
*
|
|
134
|
-
* **Consumes `rows` once** — pass an array for multi-shot consumers.
|
|
135
|
-
*/
|
|
136
|
-
upsertMany(rows: Iterable<{
|
|
137
|
-
primary: K;
|
|
138
|
-
secondary: unknown;
|
|
139
|
-
value: V;
|
|
140
|
-
}>, opts?: UpsertOptions<K, V>): number;
|
|
141
|
-
/** Remove a row by primary key. Returns `true` if the row existed. Advances `version` only if true. */
|
|
142
|
-
delete(primary: K): boolean;
|
|
143
|
-
/**
|
|
144
|
-
* Atomic bulk delete. Returns count removed. Advances `version` at most once.
|
|
145
|
-
* No-op if no keys were present. Consumes `primaries` once.
|
|
146
|
-
*/
|
|
147
|
-
deleteMany(primaries: Iterable<K>): number;
|
|
148
|
-
/** Remove all rows. Returns the number removed. Advances `version` only if non-zero. */
|
|
149
|
-
clear(): number;
|
|
150
|
-
/** Rows in sorted `(secondary, primary)` order — fresh snapshot suitable for emission. */
|
|
151
|
-
toArray(): readonly IndexRow<K, V>[];
|
|
152
|
-
/** Primary-key → value map — fresh snapshot. */
|
|
153
|
-
toPrimaryMap(): ReadonlyMap<K, V>;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Default flat-array backend. Maintains `buf: IndexRow[]` sorted by `(secondary, primary)`
|
|
157
|
-
* and a parallel `Map<K, IndexRow>` for O(1) primary-key lookup.
|
|
158
|
-
*
|
|
159
|
-
* **Complexity:**
|
|
160
|
-
* - `has`, `get`: O(1)
|
|
161
|
-
* - `upsert`: up to 2× O(log n) bisect (locate old + locate new) + up to 2× O(n) splice (remove-old + insert-new) = O(n)
|
|
162
|
-
* - `upsertMany(k rows)`: O(k log n) bisect + O(k·n) splice worst case; single version bump
|
|
163
|
-
* - `delete`: O(log n) bisect + O(n) splice = O(n)
|
|
164
|
-
* - `deleteMany(k keys)`: O(k log n) + O(k·n) splice worst case; single version bump
|
|
165
|
-
* - `clear`: O(1)
|
|
166
|
-
* - `toArray`, `toPrimaryMap`: O(n)
|
|
167
|
-
*
|
|
168
|
-
* @category extra
|
|
169
|
-
*/
|
|
170
|
-
declare class NativeIndexBackend<K, V = unknown> implements IndexBackend<K, V> {
|
|
171
|
-
private _version;
|
|
172
|
-
private readonly _buf;
|
|
173
|
-
private readonly _byPrimary;
|
|
174
|
-
get version(): number;
|
|
175
|
-
get size(): number;
|
|
176
|
-
has(primary: K): boolean;
|
|
177
|
-
get(primary: K): V | undefined;
|
|
178
|
-
upsert(primary: K, secondary: unknown, value: V, opts?: UpsertOptions<K, V>): boolean;
|
|
179
|
-
upsertMany(rows: Iterable<{
|
|
180
|
-
primary: K;
|
|
181
|
-
secondary: unknown;
|
|
182
|
-
value: V;
|
|
183
|
-
}>, opts?: UpsertOptions<K, V>): number;
|
|
184
|
-
delete(primary: K): boolean;
|
|
185
|
-
deleteMany(primaries: Iterable<K>): number;
|
|
186
|
-
clear(): number;
|
|
187
|
-
toArray(): readonly IndexRow<K, V>[];
|
|
188
|
-
toPrimaryMap(): ReadonlyMap<K, V>;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Creates a reactive index: unique primary key per row, rows sorted by `(secondary, primary)` for ordered scans.
|
|
192
|
-
*
|
|
193
|
-
* @param options - Optional `name` for `describe()` / debugging, and optional `backend` (see {@link IndexBackend}).
|
|
194
|
-
* @returns Bundle with `ordered` (sorted rows), `byPrimary` (map), O(1) `has` / `get` / `size`,
|
|
195
|
-
* imperative `upsert` / `upsertMany` / `delete` / `deleteMany` / `clear`.
|
|
196
|
-
*
|
|
197
|
-
* @remarks
|
|
198
|
-
* **Ordering:** `secondary` and `primary` are compared via a small total order: same primitive `typeof` uses
|
|
199
|
-
* numeric/string/boolean/bigint comparison; mixed or object keys fall back to `String(a).localeCompare(String(b))`
|
|
200
|
-
* (not identical to Python's rich comparison for exotic types).
|
|
201
|
-
*
|
|
202
|
-
* **Backend:** The default {@link NativeIndexBackend} offers O(1) primary-key lookups and O(n) upserts.
|
|
203
|
-
* For scale beyond a few thousand rows, supply a user-pluggable persistent/B-tree backend via the
|
|
204
|
-
* `backend` option — reactive emission semantics are unchanged.
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```ts
|
|
208
|
-
* import { reactiveIndex } from "@graphrefly/graphrefly-ts";
|
|
209
|
-
*
|
|
210
|
-
* const idx = reactiveIndex<string, string>();
|
|
211
|
-
* idx.upsert("id1", 10, "row-a");
|
|
212
|
-
* idx.upsert("id2", 5, "row-b");
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* @category extra
|
|
216
|
-
*/
|
|
217
|
-
declare function reactiveIndex<K, V = unknown>(options?: ReactiveIndexOptions<K, V>): ReactiveIndexBundle<K, V>;
|
|
218
|
-
|
|
219
|
-
type ReactiveListOptions<T> = {
|
|
220
|
-
name?: string;
|
|
221
|
-
/**
|
|
222
|
-
* Storage backend. Defaults to `NativeListBackend` (flat mutable array).
|
|
223
|
-
* Users can plug in persistent / RRB-tree backends via the {@link ListBackend} interface.
|
|
224
|
-
*/
|
|
225
|
-
backend?: ListBackend<T>;
|
|
226
|
-
/**
|
|
227
|
-
* Optional versioning level for the underlying `items` state node. Set at
|
|
228
|
-
* construction time; cannot be changed later. Pass `0` for V0 identity +
|
|
229
|
-
* monotonic version counter, or `1` for V1 + content-addressed cid.
|
|
230
|
-
*/
|
|
231
|
-
versioning?: VersioningLevel;
|
|
232
|
-
};
|
|
233
|
-
type ReactiveListBundle<T> = {
|
|
234
|
-
/** Emits `readonly T[]` on each structural change (two-phase). */
|
|
235
|
-
readonly items: Node<readonly T[]>;
|
|
236
|
-
/** Current entry count (O(1)). */
|
|
237
|
-
readonly size: number;
|
|
238
|
-
/** Positional access (O(1)); supports negative indices (Python-style). Returns `undefined` on out-of-range. */
|
|
239
|
-
at: (index: number) => T | undefined;
|
|
240
|
-
append: (value: T) => void;
|
|
241
|
-
/** Push all values, emit one snapshot. No-op if `values` is empty. */
|
|
242
|
-
appendMany: (values: readonly T[]) => void;
|
|
243
|
-
/** Insert a value at `index`. Throws `RangeError` on out-of-range. */
|
|
244
|
-
insert: (index: number, value: T) => void;
|
|
245
|
-
/** Insert all values at `index` as one bulk op; emits one snapshot. No-op if `values` is empty. */
|
|
246
|
-
insertMany: (index: number, values: readonly T[]) => void;
|
|
247
|
-
/** Remove and return the value at `index` (default: last). Negative indices Python-style. Throws on empty / out-of-range. */
|
|
248
|
-
pop: (index?: number) => T;
|
|
249
|
-
clear: () => void;
|
|
250
|
-
/**
|
|
251
|
-
* Releases any internal keepalive subscriptions so the bundle can be
|
|
252
|
-
* GC'd. `reactiveList` currently holds none (no internal derived nodes),
|
|
253
|
-
* so `dispose()` is a no-op today — exposed for API parity with
|
|
254
|
-
* `reactiveIndex.dispose` / `reactiveMap.dispose` / `reactiveLog.dispose`.
|
|
255
|
-
* Idempotent. D6(a).
|
|
256
|
-
*/
|
|
257
|
-
dispose: () => void;
|
|
258
|
-
};
|
|
259
|
-
/**
|
|
260
|
-
* Storage contract for {@link reactiveList}. Implementations own the mutable state
|
|
261
|
-
* and expose a monotonic `version` counter that increments on every structural change.
|
|
262
|
-
*
|
|
263
|
-
* The reactive layer reads `version` before and after each backend call; when it
|
|
264
|
-
* advances, a snapshot is emitted.
|
|
265
|
-
*
|
|
266
|
-
* @remarks Post-1.0 op-log changesets will extend this interface with a
|
|
267
|
-
* `changesSince(version: number): Iterable<Change>` method. Current consumers
|
|
268
|
-
* should treat all methods here as stable.
|
|
269
|
-
*
|
|
270
|
-
* @category extra
|
|
271
|
-
*/
|
|
272
|
-
interface ListBackend<T> {
|
|
273
|
-
/** Monotonic mutation counter; increments on every structural change. */
|
|
274
|
-
readonly version: number;
|
|
275
|
-
/** Number of items currently stored. */
|
|
276
|
-
readonly size: number;
|
|
277
|
-
/** Positional access; `undefined` on out-of-range. */
|
|
278
|
-
at(index: number): T | undefined;
|
|
279
|
-
/** Append a single value. Advances `version`. */
|
|
280
|
-
append(value: T): void;
|
|
281
|
-
/** Append a batch. Advances `version` once. No-op if empty. */
|
|
282
|
-
appendMany(values: readonly T[]): void;
|
|
283
|
-
/** Insert at index; throws `RangeError` on out-of-range `0 <= index <= size`. Advances `version`. */
|
|
284
|
-
insert(index: number, value: T): void;
|
|
285
|
-
/** Bulk insert at index; throws on out-of-range. Advances `version` once. No-op if `values` empty. */
|
|
286
|
-
insertMany(index: number, values: readonly T[]): void;
|
|
287
|
-
/** Remove and return value at index; throws on empty / out-of-range. Advances `version`. */
|
|
288
|
-
pop(index: number): T;
|
|
289
|
-
/** Clear all entries. Returns count removed. Advances `version` only if non-zero. */
|
|
290
|
-
clear(): number;
|
|
291
|
-
/** Full snapshot as a fresh array. */
|
|
292
|
-
toArray(): readonly T[];
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Default mutable-array backend.
|
|
296
|
-
*
|
|
297
|
-
* **Complexity:**
|
|
298
|
-
* - `at`, `size`: O(1)
|
|
299
|
-
* - `append`: O(1) amortized
|
|
300
|
-
* - `appendMany(values)`, `insertMany(index, values)`: O(n + k) where k = values.length
|
|
301
|
-
* - `insert`, `pop` (middle): O(n) due to splice
|
|
302
|
-
* - `pop` (last): O(1)
|
|
303
|
-
* - `clear`: O(1)
|
|
304
|
-
* - `toArray`: O(n)
|
|
305
|
-
*
|
|
306
|
-
* @category extra
|
|
307
|
-
*/
|
|
308
|
-
declare class NativeListBackend<T> implements ListBackend<T> {
|
|
309
|
-
private _version;
|
|
310
|
-
private readonly _buf;
|
|
311
|
-
constructor(initial?: readonly T[]);
|
|
312
|
-
get version(): number;
|
|
313
|
-
get size(): number;
|
|
314
|
-
at(index: number): T | undefined;
|
|
315
|
-
append(value: T): void;
|
|
316
|
-
appendMany(values: readonly T[]): void;
|
|
317
|
-
insert(index: number, value: T): void;
|
|
318
|
-
insertMany(index: number, values: readonly T[]): void;
|
|
319
|
-
pop(index: number): T;
|
|
320
|
-
clear(): number;
|
|
321
|
-
toArray(): readonly T[];
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Creates a reactive list with immutable array snapshots.
|
|
325
|
-
*
|
|
326
|
-
* @param initial - Optional initial items (copied).
|
|
327
|
-
* @param options - Optional `name` for `describe()` / debugging, or pluggable `backend`.
|
|
328
|
-
* @returns Bundle with `items` (state node), `size` / `at`, `append` / `appendMany` / `insert` /
|
|
329
|
-
* `insertMany` / `pop` / `clear`.
|
|
330
|
-
*
|
|
331
|
-
* @remarks
|
|
332
|
-
* **No `maxSize`:** insert/pop-anywhere semantics make eviction-under-cap ambiguous.
|
|
333
|
-
* For bounded append-heavy workloads use `reactiveLog` (head-trim is well-defined for
|
|
334
|
-
* append-only).
|
|
335
|
-
*
|
|
336
|
-
* **Backend:** Default {@link NativeListBackend}. For persistent / RRB-tree semantics
|
|
337
|
-
* supply a custom {@link ListBackend}. If you provide a `backend`, `initial` is ignored
|
|
338
|
-
* — seed the backend directly.
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* ```ts
|
|
342
|
-
* import { reactiveList } from "@graphrefly/graphrefly-ts";
|
|
343
|
-
*
|
|
344
|
-
* const list = reactiveList<string>(["a"], { name: "queue" });
|
|
345
|
-
* list.append("b");
|
|
346
|
-
* list.insertMany(1, ["x", "y"]);
|
|
347
|
-
* ```
|
|
348
|
-
*
|
|
349
|
-
* @category extra
|
|
350
|
-
*/
|
|
351
|
-
declare function reactiveList<T>(initial?: readonly T[], options?: ReactiveListOptions<T>): ReactiveListBundle<T>;
|
|
352
|
-
|
|
353
|
-
export { type IndexBackend, type IndexRow, type ListBackend, NativeIndexBackend, NativeListBackend, type ReactiveIndexBundle, type ReactiveIndexOptions, type ReactiveListBundle, type ReactiveListOptions, type UpsertOptions, reactiveIndex, reactiveList };
|
|
1
|
+
export * from '@graphrefly/pure-ts/extra/reactive';
|