@graphrefly/graphrefly 0.43.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 -4
- package/dist/core/index.d.ts +1 -4
- 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 -950
- package/dist/extra/operators.d.ts +1 -950
- 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 -96
- package/dist/index.d.ts +45 -96
- 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 -21
- package/dist/patterns/ai/index.d.ts +1 -21
- 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 -14
- package/dist/patterns/harness/index.d.ts +1 -14
- 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 -9
- package/dist/patterns/orchestration/index.d.ts +1 -9
- package/dist/patterns/orchestration/index.js +3 -1
- package/dist/patterns/orchestration/index.js.map +1 -0
- package/dist/patterns/process/index.cjs +21 -1
- 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-CH-_VwG9.d.cts +0 -199
- package/dist/cascading-OgKQZjsa.d.ts +0 -199
- package/dist/chunk-35JTVPOX.js +0 -1
- package/dist/chunk-3G5U5QNE.js +0 -5
- package/dist/chunk-3XDYJRYU.js +0 -1
- package/dist/chunk-4I45FVQS.js +0 -1
- package/dist/chunk-4VVTGLXJ.js +0 -1
- package/dist/chunk-4YAN45KM.js +0 -1
- package/dist/chunk-5QDBSZBV.js +0 -1
- package/dist/chunk-626TESAC.js +0 -3
- package/dist/chunk-6HOSXQKF.js +0 -1
- package/dist/chunk-6QZNQS5B.js +0 -1
- package/dist/chunk-C72GO4IZ.js +0 -1
- package/dist/chunk-CE72X3WO.js +0 -1
- package/dist/chunk-CK2E7BTU.js +0 -1
- package/dist/chunk-CLD3F4R5.js +0 -1
- package/dist/chunk-CUNIRONA.js +0 -1
- package/dist/chunk-D27JNOLZ.js +0 -1
- package/dist/chunk-D5RFJOZ2.js +0 -1
- package/dist/chunk-EBW4V6JN.js +0 -1
- package/dist/chunk-ESMPEKEV.js +0 -1
- package/dist/chunk-F3IGTWCQ.js +0 -1
- package/dist/chunk-F672GV32.js +0 -1
- package/dist/chunk-FDQGFWLF.js +0 -1
- package/dist/chunk-FG4TKHMC.js +0 -1
- package/dist/chunk-GPW2V3RE.js +0 -1
- package/dist/chunk-I7IGYPSL.js +0 -1
- package/dist/chunk-INQD2KRQ.js +0 -1
- package/dist/chunk-JNWRYDJN.js +0 -1
- package/dist/chunk-JQFH2DV6.js +0 -1
- package/dist/chunk-K2Q24F5T.js +0 -1
- package/dist/chunk-KGKJCHEK.js +0 -1
- package/dist/chunk-KRH66M4O.js +0 -1
- package/dist/chunk-KVV66NN2.js +0 -1
- package/dist/chunk-L6NSJVJZ.js +0 -1
- package/dist/chunk-LYCLF26R.js +0 -1
- package/dist/chunk-NNKJUORL.js +0 -1
- package/dist/chunk-NON4NLIC.js +0 -45
- package/dist/chunk-O2BLLH7M.js +0 -18
- package/dist/chunk-OCKEEPRJ.js +0 -2
- package/dist/chunk-OFZG3TB3.js +0 -9
- package/dist/chunk-OYJKFY7V.js +0 -1
- package/dist/chunk-P6C4WHZO.js +0 -5
- package/dist/chunk-PT7W5FCD.js +0 -5
- package/dist/chunk-Q4U3A3L5.js +0 -1
- package/dist/chunk-QE4IGY7I.js +0 -61
- package/dist/chunk-QYADASLV.js +0 -1
- package/dist/chunk-QYVXF7GW.js +0 -1
- package/dist/chunk-S3EEIPO7.js +0 -1
- package/dist/chunk-SUWT3ZON.js +0 -1
- package/dist/chunk-TPKQW72B.js +0 -1
- package/dist/chunk-TSOYJ743.js +0 -1
- package/dist/chunk-TZQPPQEQ.js +0 -1
- package/dist/chunk-V5A7M7RJ.js +0 -1
- package/dist/chunk-VIMF6LGM.js +0 -1
- package/dist/chunk-VJLMUKOI.js +0 -1
- package/dist/chunk-VN6RDSK2.js +0 -1
- package/dist/chunk-VNC3TMVY.js +0 -1
- package/dist/chunk-VOPGGIL7.js +0 -1
- package/dist/chunk-VQ4A6T2A.js +0 -1
- package/dist/chunk-XG62INFA.js +0 -1
- package/dist/chunk-Y4NI3X7O.js +0 -84
- package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
- package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
- package/dist/decay-2ZukgQ4o.d.cts +0 -112
- package/dist/decay-CdEBmDIs.d.ts +0 -112
- package/dist/fallback-CqYVLL6X.d.ts +0 -250
- package/dist/fallback-Ctlj2tMY.d.cts +0 -250
- package/dist/graph-7VguS7a4.d.ts +0 -1668
- package/dist/graph-C4SHb3Ly.d.cts +0 -1668
- package/dist/index-0rKFCVFp.d.cts +0 -557
- package/dist/index-B-i4_g3k.d.ts +0 -651
- package/dist/index-B5iz82A3.d.cts +0 -2655
- package/dist/index-BAOD98JD.d.cts +0 -754
- package/dist/index-BG0BN3PB.d.ts +0 -44
- package/dist/index-BJX94aud.d.cts +0 -34
- package/dist/index-BP8a88zx.d.ts +0 -385
- package/dist/index-BTQtTb_H.d.cts +0 -301
- package/dist/index-BVpm6noz.d.cts +0 -36
- package/dist/index-Bc41FuHp.d.cts +0 -291
- package/dist/index-BdGtBX-X.d.cts +0 -515
- package/dist/index-Bf7eqeSF.d.ts +0 -113
- package/dist/index-BiX1Nkgx.d.cts +0 -1844
- package/dist/index-BoLv_OfD.d.cts +0 -651
- package/dist/index-BojK2fwH.d.cts +0 -299
- package/dist/index-BsT7F2et.d.ts +0 -291
- package/dist/index-BwLvVVsy.d.cts +0 -189
- package/dist/index-C59mYFKp.d.ts +0 -121
- package/dist/index-C7O6r5fV.d.ts +0 -37
- package/dist/index-C9kSENB4.d.cts +0 -127
- package/dist/index-C9pjcz3l.d.cts +0 -209
- package/dist/index-CAC_rNzm.d.ts +0 -189
- package/dist/index-CCq87F7t.d.ts +0 -127
- package/dist/index-CDXc9zKM.d.cts +0 -26
- package/dist/index-CJK1JkYy.d.ts +0 -36
- package/dist/index-CLon-IWF.d.cts +0 -374
- package/dist/index-COD1kVoS.d.cts +0 -468
- package/dist/index-CPT7C_f1.d.ts +0 -374
- package/dist/index-CQG3D1cp.d.ts +0 -468
- package/dist/index-CZQXo5tH.d.ts +0 -209
- package/dist/index-CZjOhcBy.d.cts +0 -113
- package/dist/index-ChOyVLKm.d.cts +0 -86
- package/dist/index-CvrqGfNS.d.ts +0 -34
- package/dist/index-D-AEQVLo.d.ts +0 -2655
- package/dist/index-D4Y1cMG0.d.ts +0 -26
- package/dist/index-DBHK8O6H.d.ts +0 -301
- package/dist/index-DBevwHj_.d.ts +0 -515
- package/dist/index-DIOoAZUX.d.ts +0 -45
- package/dist/index-DSZ3ZCHF.d.ts +0 -3402
- package/dist/index-Dgs8zcj7.d.ts +0 -102
- package/dist/index-Dh_HJ82K.d.ts +0 -299
- package/dist/index-Dhc7a7Xo.d.cts +0 -102
- package/dist/index-Dmqp7KjD.d.ts +0 -86
- package/dist/index-Dn-wI9g4.d.ts +0 -231
- package/dist/index-Du7u1lSf.d.cts +0 -385
- package/dist/index-DwigL4lY.d.ts +0 -1844
- package/dist/index-DyR7eU5S.d.cts +0 -779
- package/dist/index-JZUPJIJy.d.ts +0 -779
- package/dist/index-K0_0eR8g.d.ts +0 -557
- package/dist/index-O16yXPK4.d.cts +0 -3402
- package/dist/index-O7fucFrU.d.cts +0 -121
- package/dist/index-RV_yDjOX.d.cts +0 -198
- package/dist/index-cm1GNcWE.d.ts +0 -754
- package/dist/index-f5IivDUX.d.cts +0 -37
- package/dist/index-hHcaFlJX.d.cts +0 -45
- package/dist/index-tJoTcnHh.d.cts +0 -231
- package/dist/index-wAzD9yVj.d.ts +0 -198
- package/dist/index-z96luz5O.d.cts +0 -44
- package/dist/meta-BgVAsg9j.d.ts +0 -102
- package/dist/meta-vE8bxW1E.d.cts +0 -102
- package/dist/node-ClS5yC-B.d.cts +0 -1347
- package/dist/node-ClS5yC-B.d.ts +0 -1347
- package/dist/observable-BsBzUrcI.d.ts +0 -36
- package/dist/observable-DLGPPtb8.d.cts +0 -36
- package/dist/pipeline-graph-DPqKDk59.d.cts +0 -137
- package/dist/pipeline-graph-loP57TBA.d.ts +0 -137
- package/dist/reactive-layout-Dsvob4zD.d.cts +0 -183
- package/dist/reactive-layout-v7KPvxoc.d.ts +0 -183
- package/dist/reactive-log-B00laMSQ.d.cts +0 -223
- package/dist/reactive-log-BezYsbA_.d.ts +0 -223
- package/dist/reactive-map-48mnZ-nu.d.cts +0 -296
- package/dist/reactive-map-BVVPdvmi.d.ts +0 -296
- package/dist/resilience-YIWPK4YC.js +0 -1
- package/dist/sugar-DLwvMr3F.d.ts +0 -223
- package/dist/sugar-DyVGtczU.d.cts +0 -223
- package/dist/topology-tree-BNGvuG82.d.ts +0 -25
- package/dist/topology-tree-BSdfSwMi.d.cts +0 -25
- package/dist/types-B1jDWVsM.d.cts +0 -442
- package/dist/types-DkzUUs0H.d.ts +0 -442
package/dist/chunk-VOPGGIL7.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as B}from"./chunk-4VVTGLXJ.js";import{c as h}from"./chunk-35JTVPOX.js";import{m as k}from"./chunk-V5A7M7RJ.js";import{D as N,F as w,G as P,o as U}from"./chunk-LYCLF26R.js";import{a as A,b as p,c as W,d as m,i as a,j as b}from"./chunk-CK2E7BTU.js";function c(d){return{describeKind:"derived",...d}}function S(d){return{describeKind:"derived",partial:!0,...d}}function Z(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}for(let o of n)e.emit(i(o))},{...c(s),meta:{...h("map"),...s?.meta??{}}})}function V(d,i,s){return N([d],(t,e)=>{let n=t[0];if(n==null||n.length===0){e.down([[m]]);return}let o=!1;for(let r of n)i(r)&&(e.emit(r),o=!0);o||e.down([[m]])},{...c(s),meta:{...h("filter"),...s?.meta??{}}})}function $(d,i,s,t){return N([d],(e,n,o)=>{"acc"in o.store||(o.store.acc=s);let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u),n.emit(o.store.acc)},{...c(t),initial:s,resetOnTeardown:!0,meta:{...h("scan",{initial:s}),...t?.meta??{}}})}function ee(d,i,s,t){return N([d],(e,n,o)=>{if("acc"in o.store||(o.store.acc=s),o.terminalDeps[0]===!0){n.emit(o.store.acc),n.down([[a]]);return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)o.store.acc=i(o.store.acc,u)},{...c(t),completeWhenDepsComplete:!1,meta:{...h("reduce",{initial:s}),...t?.meta??{}}})}function C(d,i,s){return i<=0?N([d],(t,e,n)=>{n.store.completed||(n.store.completed=!0,e.down([[a]]))},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}}):N([d],(t,e,n)=>{if("taken"in n.store||(n.store.taken=0),n.store.done){e.down([[m]]);return}if(n.terminalDeps[0]===!0){n.store.done=!0,e.down([[a]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o)if(n.store.taken++,e.emit(r),n.store.taken>=i){n.store.done=!0,e.down([[a]]);return}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("take",{count:i}),...s?.meta??{}}})}function K(d,i,s){return N([d],(t,e,n)=>{"skipped"in n.store||(n.store.skipped=0);let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.skipped++,n.store.skipped<=i||(e.emit(u),r=!0);r||e.down([[m]])},c(s))}function ne(d,i,s){return N([d],(t,e,n)=>{if(n.store.done){e.down([[m]]);return}let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}for(let r of o){if(!i(r)){n.store.done=!0,e.down([[a]]);return}e.emit(r)}},{...c(s),completeWhenDepsComplete:!1})}function te(d,i,s){let t=s?.predicate??(o=>o[0]===p),{predicate:e,...n}=s??{};return w(o=>{let r=!1,u=d.subscribe(l=>{if(!r)for(let T of l){if(r)return;T[0]===p?o.emit(T[1]):(T[0]===a||T[0]===b)&&(r=!0,o.down([T]))}}),f=i.subscribe(l=>{if(!r)for(let T of l){if(r)return;if(t(T)){r=!0,o.down([[a]]);return}}});return()=>{u(),f()}},c(n))}function oe(d,i){return C(d,1,i)}function re(d,i){let{defaultValue:s,...t}=i??{},e=i!=null&&Object.hasOwn(i,"defaultValue");return N([d],(n,o,r)=>{if(r.terminalDeps[0]===!0){r.store.has?o.emit(r.store.latest):e&&o.emit(s),o.down([[a]]);return}let u=n[0];if(u==null||u.length===0){o.down([[m]]);return}r.store.latest=u.at(-1),r.store.has=!0},{...c(t),completeWhenDepsComplete:!1})}function se(d,i,s){return C(V(d,i,s),1,s)}function ie(d,i,s){return C(K(d,i,s),1,s)}function ue(d,i,s){if(typeof i=="function")return N([d],(e,n)=>{let o=e[0];if(o==null||o.length===0){n.down([[m]]);return}for(let r of o)i(r),n.emit(r)},{...c(s),meta:{...h("tap"),...s?.meta??{}}});let t=i;return N([d],(e,n,o)=>{if(o.terminalDeps[0]!==void 0){o.terminalDeps[0]===!0?(t.complete?.(),n.down([[a]])):(t.error?.(o.terminalDeps[0]),n.down([[b,o.terminalDeps[0]]]));return}let r=e[0];if(r==null||r.length===0){n.down([[m]]);return}for(let u of r)t.data?.(u),n.emit(u)},{...c(s),completeWhenDepsComplete:!1,meta:{...h("tap"),...s?.meta??{}}})}function q(d,i,s){let t=s?.where??(n=>n!=null),e=!1;return N([d],(n,o)=>{let r=n[0];if(r==null||r.length===0){o.down([[m]]);return}for(let u of r)!e&&t(u)&&(e=!0,i(u)),o.emit(u)},c(s))}var fe=q;function de(d,i=Object.is,s){return N([d],(t,e,n)=>{let o=t[0];if(o==null||o.length===0){e.down([[m]]);return}let r=!1;for(let u of o)n.store.hasPrev&&i(n.store.prev,u)||(n.store.prev=u,n.store.hasPrev=!0,e.emit(u),r=!0);r||e.down([[m]])},{...c(s),meta:{...h("distinctUntilChanged"),...s?.meta??{}}})}function le(d,i){return N([d],(s,t,e)=>{let n=s[0];if(n==null||n.length===0){t.down([[m]]);return}let o=!1;for(let r of n)if(!e.store.hasPrev)e.store.prev=r,e.store.hasPrev=!0;else{let u=[e.store.prev,r];e.store.prev=r,t.emit(u),o=!0}o||t.down([[m]])},c(i))}function F(...d){let i=[...d];return P(i,s=>s,{...c(),equals:(s,t)=>{if(s.length!==t.length)return!1;for(let e=0;e<s.length;e++)if(!Object.is(s[e],t[e]))return!1;return!0}})}function ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[0],r=t[1],u=r!=null&&r.length>0?r.at(-1):n.prevData[1];if(o!=null&&o.length>0){if(!(r!=null&&r.length>0)&&n.prevData[1]===void 0){e.down([[m]]);return}for(let f of o)e.emit([f,u])}else e.down([[m]])},{...S(s),meta:{...h("withLatestFrom"),...s?.meta??{}}})}function ce(...d){return d.length===0?w(i=>{i.down([[a]])},{...c(),meta:{...h("merge")}}):w(i=>{let s=d.length,t=0,e=[];for(let n of d){let o=n.subscribe(r=>{for(let u of r)u[0]===p?i.emit(u[1]):u[0]===a?(t+=1,t>=s&&i.down([[a]])):u[0]===b&&i.down([u])});e.push(o)}return()=>{for(let n of e)n()}},{...c(),meta:{...h("merge")}})}function Te(...d){let i=d.length;return i===0?w(s=>{s.emit([]),s.down([[a]])},c()):w(s=>{let t=Array.from({length:i},()=>[]),e=i;function n(){for(;t.every(r=>r.length>0);){let r=t.map(u=>u.shift());s.emit(r)}}let o=[];for(let r=0;r<i;r++){let u=r,f=d[r].subscribe(l=>{for(let T of l)T[0]===p?(t[u].push(T[1]),n()):T[0]===a?(e-=1,(e===0||t[u].length===0)&&s.down([[a]])):T[0]===b&&s.down([T])});o.push(f)}return()=>{for(let r of o)r()}},c())}function pe(d,i,s){return w(t=>{let e=0,n=[],o,r;return r=i.subscribe(u=>{for(let f of u)e===0?f[0]===p?n.push(f[1]):f[0]===b&&t.down([f]):f[0]===p?t.emit(f[1]):(f[0]===a||f[0]===b)&&t.down([f])}),o=d.subscribe(u=>{for(let f of u)if(e===0)if(f[0]===p)t.emit(f[1]);else if(f[0]===a){e=1;for(let l of n)t.emit(l);n.length=0}else f[0]===b&&t.down([f])}),()=>{o?.(),r?.()}},c(s))}function me(...d){return d.length===0?w(i=>{i.down([[a]])},c()):d.length===1?N([d[0]],(i,s)=>{let t=i[0];if(t==null||t.length===0){s.down([[m]]);return}for(let e of t)s.emit(e)},c()):w(i=>{let s=null,t=[];for(let e=0;e<d.length;e++){let n=e,o=d[e].subscribe(r=>{for(let u of r){if(s!==null&&n!==s)return;u[0]===p?(s===null&&(s=n),i.emit(u[1])):(u[0]===a||u[0]===b)&&(s===null||n===s)&&i.down([u])}});t.push(o)}return()=>{for(let e of t)e()}},c())}function I(d,i,s){let t,e=!1,n=()=>{e||(e=!0,s())};return t=d.subscribe(o=>{let r=!1,u=!1;for(let f of o)f[0]!==A&&(f[0]===p?i.emit(f[1]):f[0]===a?r=!0:f[0]===b?(u=!0,i.down([f])):(f[0]===W||f[0]===m)&&i.down([f]));u?(t?.(),t=void 0,n()):r&&n()}),()=>{t?.(),t=void 0}}function be(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return n(),t=I(k(i(f[f.length-1])),r,()=>{n(),e&&r.down([[a]])}),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1,meta:{...h("switchMap"),...s?.meta??{}}})}function we(d,i,s){let t,e=!1;function n(){t?.(),t=void 0}return N([d],(o,r,u)=>{if(u.terminalDeps[0]!=null&&u.terminalDeps[0]!==!0){n();return}if(u.terminalDeps[0]===!0){e=!0,t||r.down([[a]]);return}let f=o[0];if(!(f==null||f.length===0))return t===void 0?t=I(k(i(f[0])),r,()=>{n(),e&&r.down([[a]])}):r.down([[m]]),{deactivate:()=>{n(),e=!1}}},{...c(s),completeWhenDepsComplete:!1})}function Ne(d,i,s){let{maxBuffer:t,...e}=s??{},n=[],o,r=!1,u;function f(){o?.(),o=void 0}function l(){if(!u||o!==void 0)return;if(n.length===0){r&&u.down([[a]]);return}let v=n.shift();o=I(k(i(v)),u,()=>{f(),l()})}function T(v){t&&t>0&&n.length>=t&&n.shift(),n.push(v),l()}return N([d],(v,x,E)=>{if(u=x,E.terminalDeps[0]!=null&&E.terminalDeps[0]!==!0){f(),n.length=0;return}if(E.terminalDeps[0]===!0){r=!0,l();return}let R=v[0];if(!(R==null||R.length===0)){for(let g of R)T(g);return{deactivate:()=>{f(),n.length=0,r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}function L(d,i,s){let{concurrent:t,...e}=s??{},n=t!=null&&t>0?t:Number.POSITIVE_INFINITY,o=0,r=!1,u=new Set,f=[],l;function T(){r&&o===0&&f.length===0&&l&&l.down([[a]])}function v(g){if(!l)return;o++;let O;O=I(k(i(g)),l,()=>{O&&u.delete(O),o--,x(),T()}),u.add(O)}function x(){for(;f.length>0&&o<n;)v(f.shift())}function E(g){o<n?v(g):f.push(g)}function R(){for(let g of u)g();u.clear(),o=0,f.length=0}return N([d],(g,O,y)=>{if(l=O,y.terminalDeps[0]!=null&&y.terminalDeps[0]!==!0){R();return}if(y.terminalDeps[0]===!0){r=!0,T();return}let D=g[0];if(!(D==null||D.length===0)){for(let M of D)E(M);return{deactivate:()=>{R(),r=!1}}}},{...c(e),completeWhenDepsComplete:!1})}var he=L;function ve(d,i,s){return w(t=>{let e=new Set;function n(){for(let r of e)clearTimeout(r);e.clear()}let o=d.subscribe(r=>{for(let u of r)if(u[0]===p){let f=setTimeout(()=>{e.delete(f),t.emit(u[1])},i);e.add(f)}else if(u[0]===a){let f=setTimeout(()=>{e.delete(f),t.down([[a]])},i);e.add(f)}else u[0]===b&&(n(),t.down([u]))});return()=>{o(),n()}},c(s))}function _(d,i,s){return w(t=>{let e,n;function o(){e!==void 0&&(clearTimeout(e),e=void 0)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(o(),n=f[1],e=setTimeout(()=>{e=void 0,t.emit(n)},i)):f[0]===a?(e!==void 0&&(o(),t.emit(n)),t.down([[a]])):f[0]===b&&(o(),t.down([f]))});return()=>{r(),o()}},{...c(s),meta:{...h("debounce",{ms:i}),...s?.meta??{}}})}function j(d,i,s){let{leading:t,trailing:e,...n}=s??{},o=t!==!1,r=e===!0,u=i*1e6;return w(f=>{let l,T=-1/0,v,x=!1;function E(){l!==void 0&&(clearTimeout(l),l=void 0)}let R=d.subscribe(g=>{for(let O of g)if(O[0]===p){let y=O[1],D=U();if(o&&D-T>=u)T=D,f.emit(y),E(),r&&(l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},i));else if(r&&(v=y,x=!0,l===void 0)){let M=(D-T)/1e6;l=setTimeout(()=>{l=void 0,x&&(T=U(),f.emit(v),x=!1)},Math.max(0,i-M))}}else(O[0]===a||O[0]===b)&&(E(),f.down([O]))});return()=>{R(),E()}},{...c(n),meta:{...h("throttle",{ms:i,leading:o,trailing:r}),...n.meta??{}}})}function ge(d,i,s){return w(t=>{let e,n=!1,o=!1,r=d.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e={v:l[1]}:l[0]===b?(n=!0,t.down([l])):l[0]===a&&(o=!0,e=void 0)}}),u=i.subscribe(f=>{if(!n)for(let l of f){if(n)return;l[0]===p?e!==void 0&&!o&&t.emit(e.v):l[0]===b?(n=!0,t.down([l])):l[0]===a&&(n=!0,t.down([[a]]))}});return()=>{r(),u()}},c(s))}function Oe(d,i,s){return w(t=>{let e,n,o=!1;function r(){e!==void 0&&(clearTimeout(e),e=void 0)}let u=d.subscribe(f=>{for(let l of f)l[0]===p?(n=l[1],o=!0,r(),e=setTimeout(()=>{e=void 0,o&&(o=!1,t.emit(n))},i)):(l[0]===a||l[0]===b)&&(r(),t.down([l]))});return()=>{u(),r()}},c(s))}function xe(d,i,s){let{with:t,...e}=s??{},n=t??new Error("timeout");return w(o=>{let r;function u(){clearTimeout(r),r=setTimeout(()=>{r=void 0,o.down([[b,n]])},i)}u();let f=d.subscribe(l=>{for(let T of l)T[0]===p?(u(),o.emit(T[1])):(T[0]===a||T[0]===b)&&(clearTimeout(r),o.down([T]))});return()=>{f(),clearTimeout(r)}},c(e))}function Ee(d,i,s){return w(t=>{let e=[],n=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&t.down([u])}),o=i.subscribe(r=>{for(let u of r)u[0]===p?e.length>0&&(t.emit([...e]),e.length=0):u[0]===a?t.down([[a]]):u[0]===b&&t.down([u])});return()=>{n(),o(),e.length=0}},c(s))}function Re(d,i,s){if(i<=0)throw new RangeError("bufferCount expects count > 0");return w(t=>{let e=[],n=d.subscribe(o=>{for(let r of o)r[0]===p?(e.push(r[1]),e.length>=i&&t.emit(e.splice(0,e.length))):r[0]===a?(e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):r[0]===b&&t.down([r])});return()=>{n(),e.length=0}},c(s))}function De(d,i,s){if(i<=0)throw new RangeError("windowCount expects count > 0");return w(t=>{let e,n=0;function o(){let u=w(f=>(e=f.down.bind(f),()=>{e=void 0}),c());n=0,t.emit(u)}let r=d.subscribe(u=>{for(let f of u)f[0]===p?(e||o(),e?.([[p,f[1]]]),n+=1,n>=i&&(e?.([[a]]),e=void 0)):f[0]===a?(e?.([[a]]),e=void 0,t.down([[a]])):f[0]===b&&(e?.([f]),e=void 0,t.down([f]))});return()=>{r(),e?.([[a]]),e=void 0}},c(s))}function ye(d,i,s){return w(t=>{let e=[],n=setInterval(()=>{e.length>0&&(t.emit([...e]),e.length=0)},i),o=d.subscribe(r=>{for(let u of r)u[0]===p?e.push(u[1]):u[0]===a?(clearInterval(n),e.length>0&&t.emit([...e]),e.length=0,t.down([[a]])):u[0]===b&&(clearInterval(n),t.down([u]))});return()=>{o(),clearInterval(n),e.length=0}},{...c(s),meta:{...h("bufferTime",{ms:i}),...s?.meta??{}}})}function ke(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}o();let r=setInterval(()=>{n(),o()},i),u=d.subscribe(f=>{for(let l of f)l[0]===p?e?.([[p,l[1]]]):l[0]===a?(clearInterval(r),n(),t.down([[a]])):l[0]===b&&(clearInterval(r),e?.([l]),n(),t.down([l]))});return()=>{u(),clearInterval(r),n()}},c(s))}function Ue(d,i,s){return w(t=>{let e;function n(){e?.([[a]]),e=void 0}function o(){let f=w(l=>(e=l.down.bind(l),()=>{e=void 0}),c());t.emit(f)}let r=d.subscribe(f=>{for(let l of f)l[0]===p?(e||o(),e?.([[p,l[1]]])):l[0]===a?(n(),t.down([[a]])):l[0]===b&&(e?.([l]),e=void 0,t.down([l]))}),u=i.subscribe(f=>{for(let l of f)l[0]===p&&(n(),o())});return()=>{r(),u(),n()}},c(s))}function Ie(d,i){return w((s,t)=>{"n"in t.store||(t.store.n=0);let e=setInterval(()=>{s.emit(t.store.n),t.store.n=t.store.n+1},d);return()=>clearInterval(e)},c(i))}function Me(d,i,s){if(i<=0)throw new RangeError("repeat expects count > 0");return w(t=>{let e=i,n,o=()=>{n?.(),n=d.subscribe(r=>{let u=!1,f=[];for(let l of r)l[0]===a?u=!0:f.push(l);f.length>0&&t.down(f),u&&(n?.(),n=void 0,e-=1,e>0?o():t.down([[a]]))})};return o(),()=>{n?.()}},c(s))}function Ce(d,i){return N([d],(s,t)=>{let e=s[0];if(e==null||e.length===0){t.down([[m]]);return}for(let n of e)t.emit(n)},c(i))}function Y(d,i,s){return w(t=>{let e=d.subscribe(n=>{for(let o of n)if(o[0]===p)t.emit(o[1]);else if(o[0]===b)try{t.emit(i(o[1]))}catch(r){t.down([[b,r]])}else o[0]===a&&t.down([[a]])});return()=>{e()}},c(s))}function Ae(d,i,s){return N([d,i],(t,e,n)=>{let o=t[1];if(!(o!=null&&o.length>0?o.at(-1):n.prevData[1])){e.down([[m]]);return}let u=t[0];if(u!=null&&u.length>0){for(let f of u)e.emit(f);return}if(o!=null&&o.length>0&&n.prevData[0]!==void 0){e.emit(n.prevData[0]);return}e.down([[m]])},S(s))}var We=F,Pe=_,Be=j,Se=Y;export{Z as a,V as b,$ as c,ee as d,C as e,K as f,ne as g,te as h,oe as i,re as j,se as k,ie as l,ue as m,q as n,fe as o,de as p,le as q,F as r,ae as s,ce as t,Te as u,pe as v,me as w,be as x,we as y,Ne as z,L as A,he as B,ve as C,_ as D,j as E,ge as F,Oe as G,xe as H,Ee as I,Re as J,De as K,ye as L,ke as M,Ue as N,Ie as O,Me as P,Ce as Q,Y as R,Ae as S,We as T,Pe as U,Be as V,Se as W};
|
package/dist/chunk-VQ4A6T2A.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as M,f as re,g as se,h as oe,i as ae}from"./chunk-FDQGFWLF.js";import{a as ee}from"./chunk-L6NSJVJZ.js";import{j as ne}from"./chunk-626TESAC.js";import{b as te}from"./chunk-35JTVPOX.js";import{b as J}from"./chunk-JQFH2DV6.js";import{C as V}from"./chunk-V5A7M7RJ.js";import{D as X,E as Y,G as j,p as W,t as D}from"./chunk-LYCLF26R.js";import{b as Q}from"./chunk-CK2E7BTU.js";import{b as le}from"./chunk-QYADASLV.js";var ye={};le(ye,{CqrsGraph:()=>F,cqrs:()=>me,cqrsEventKeyOf:()=>he,dispatchKeyOf:()=>ve,sagaInvocationKeyOf:()=>fe});var I=class extends Error{constructor(e,n){super(e,n),this.name=this.constructor.name}},N=class extends I{constructor(n,t){super(`Duplicate ${n} registration: "${t}"`);this.kind=n;this.registrationName=t}},B=class extends I{constructor(n,t,r){super(`Command "${n}" emitted undeclared event "${t}". Declared emits: [${r.join(", ")}]`);this.commandName=n;this.eventName=t;this.declaredEmits=r}},K=class extends I{constructor(n,t,r){super(`Optimistic concurrency conflict on aggregate "${n}": expected version ${t}, got ${r}`);this.aggregateId=n;this.expected=t;this.actual=r}},H=class extends I{constructor(n){super(`Unknown command: "${n}". Register with command() first.`);this.commandName=n}},O=class extends I{constructor(n,t){super(`Command handler "${n}" threw: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.commandName=n}};var P=class extends I{constructor(n,t){super(`Projection "${n}" rebuild failed: ${t instanceof Error?t.message:String(t)}`,{cause:t});this.projectionName=n}};var ue=D((o,e)=>{o("write"),o("signal"),e("observe")}),pe=D((o,e)=>{o("observe"),o("signal"),e("write")}),ie=D((o,e)=>{o("observe"),o("signal"),e("write")});function $(o,e){return ee("cqrs",o,e)}function de(o){if(o===null||typeof o!="object"||Object.isFrozen(o))return o;for(let e of Object.keys(o))de(o[e]);return Object.freeze(o)}var he=o=>`${o.type}::${o.aggregateId??"__default__"}`,ve=o=>o.commandName,fe=o=>o.eventType,F=class extends ne{_eventLogs=new Map;_eventLogsByAggregate=new Map;_aggregateVersions=new Map;_aggregateLru=new Map;_commandRegs=new Map;_projections=new Set;_sagas=new Set;_keepaliveDisposers=[];_seq=0;_retainedLimit;_freezeCommandPayload;_freezeEventPayload;_maxAggregates;_dispatchSeqCursor;dispatches;audit;aggregateEvictions;constructor(e,n={}){super(e,n.graph),this._retainedLimit=n.retainedLimit??1024,this._freezeCommandPayload=n.freezeCommandPayload??!0,this._freezeEventPayload=n.freezeEventPayload??!0,this._maxAggregates=n.maxAggregates??1e4,this.dispatches=M({name:"dispatches",retainedLimit:this._retainedLimit,graph:this}),this.audit=this.dispatches,this.aggregateEvictions=M({name:"aggregateEvictions",retainedLimit:this._retainedLimit,graph:this}),this._dispatchSeqCursor=oe(this,"dispatch_seq",0)}aggregateVersion(e,n){return this._aggregateVersions.get(`${e}::${n}`)??0}_touchAggregate(e){this._aggregateLru.delete(e),this._aggregateLru.set(e,!0)}_enforceAggregateLru(){for(;this._aggregateLru.size>this._maxAggregates;){let e=this._aggregateLru.keys().next();if(e.done)break;let n=e.value;this._aggregateLru.delete(n);let t=n.indexOf("::");if(t<0)continue;let r=n.slice(0,t),s=n.slice(t+2),a=this._aggregateVersions.get(n)??0;this._aggregateVersions.delete(n);let d=this._eventLogsByAggregate.get(r);d&&(d.delete(s),d.size===0&&this._eventLogsByAggregate.delete(r)),this.aggregateEvictions.append({aggregateId:s,type:r,lastVersion:a,t_ns:W()})}}destroy(){for(let e of this._keepaliveDisposers)e();this._keepaliveDisposers.length=0,super.destroy()}_attachedEventTiers=[];_attachedTierDisposers=new Map;attachEventStorage(e){this._attachedEventTiers.push(e);for(let[n,t]of this._eventLogs){let r=t.log.attachStorage(e),s=this._attachedTierDisposers.get(n);s||(s=[],this._attachedTierDisposers.set(n,s)),s.push(r)}for(let[n,t]of this._eventLogsByAggregate)for(let[r,s]of t){let a=`${n}::${r}`,d=s.log.attachStorage(e),u=this._attachedTierDisposers.get(a);u||(u=[],this._attachedTierDisposers.set(a,u)),u.push(d)}return()=>{let n=this._attachedEventTiers.indexOf(e);n>=0&&this._attachedEventTiers.splice(n,1)}}_autoWireStreamStorage(e,n){if(this._attachedEventTiers.length===0)return;let t=this._attachedTierDisposers.get(e);t||(t=[],this._attachedTierDisposers.set(e,t));for(let r of this._attachedEventTiers)t.push(n.attachStorage(r))}event(e,n){if(n!==void 0)return this._ensureAggregateStream(e,n).node;let t=this._eventLogs.get(e);if(t)return t.node;let r=J([],{name:e,versioning:0,maxSize:this._retainedLimit});r.withLatest();let s=r.entries,a=j([s],([d])=>d,{name:e,describeKind:"state",meta:$("event",{event_name:e}),guard:ie,initial:s.cache});return this.add(a,{name:e}),this._keepaliveDisposers.push(V(a)),this._eventLogs.set(e,{log:r,node:a}),this._autoWireStreamStorage(e,r),a}_ensureAggregateStream(e,n){this._eventLogs.has(e)||this.event(e);let t=this._eventLogsByAggregate.get(e);t||(t=new Map,this._eventLogsByAggregate.set(e,t));let r=`${e}::${n}`;this._touchAggregate(r);let s=t.get(n);if(s)return s;let a=`${e}_${n.replace(/[^a-zA-Z0-9_-]/g,"_")}`,d=J([],{name:a,versioning:0,maxSize:this._retainedLimit});d.withLatest();let u=d.entries,i=j([u],([T])=>T,{name:a,describeKind:"state",meta:$("event_aggregate",{event_name:e,aggregate_id:n}),guard:ie,initial:u.cache}),g=a,h=0;for(;this.nameOf(this.resolveOptional(g)??i)===g&&(h+=1,g=`${a}_${h}`,this.resolveOptional(g)!==void 0););try{this.add(i,{name:g})}catch{}this._keepaliveDisposers.push(V(i));let w={log:d,node:i};return t.set(n,w),this._autoWireStreamStorage(`${e}::${n}`,d),this._enforceAggregateLru(),w}resolveOptional(e){try{return this.resolve(e)}catch{return}}_appendEvent(e,n,t){let r=this._eventLogs.get(e);if(r||(this.event(e),r=this._eventLogs.get(e)),r.node.status==="completed"||r.node.status==="errored")throw new Error(`Cannot dispatch to terminated event stream "${e}" (status: ${r.node.status}).`);let s,a;if(t?.aggregateId!==void 0){let g=`${e}::${t.aggregateId}`;s=(this._aggregateVersions.get(g)??0)+1,this._aggregateVersions.set(g,s),a=this._ensureAggregateStream(e,t.aggregateId)}let d=r.log.entries.v,u=this._freezeEventPayload?de(n):n,i={type:e,payload:u,timestampNs:W(),seq:++this._seq,...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...s!==void 0?{aggregateVersion:s}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...t?.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{},...d!=null?{v0:{id:d.id,version:d.version}}:{}};return r.log.append(i),a&&a.log.append(i),i}command(e,n){if(this._commandRegs.has(e))throw new N("command",e);let t=typeof n=="function"?{handler:n}:n,r=Y(void 0,{name:e,describeKind:"state",meta:{...$("command",{command_name:e}),error:null},guard:ue});if(this.add(r,{name:e}),this._commandRegs.set(e,{handler:t.handler,...t.emits!==void 0?{emits:t.emits}:{},...t.handlerVersion!==void 0?{handlerVersion:t.handlerVersion}:{}}),t.emits)for(let s of t.emits)this._eventLogs.has(s)||this.event(s);return r}dispatch(e,n,t){let r=this._commandRegs.get(e);if(!r)throw new H(e);if(t?.aggregateId!==void 0&&t.expectedAggregateVersion!==void 0&&r.emits!==void 0){let i=0;for(let g of r.emits){let h=this._aggregateVersions.get(`${g}::${t.aggregateId}`);h!==void 0&&h>i&&(i=h)}if(i!==t.expectedAggregateVersion)throw new K(t.aggregateId,t.expectedAggregateVersion,i)}let s=this.resolve(e),a=[],d=!1,u=i=>{s.emit(i,{internal:!0});try{r.handler(i,{emit:(g,h)=>{if(r.emits!==void 0&&!r.emits.includes(g))throw new B(e,g,r.emits);a.push(g),this._appendEvent(g,h,{...t?.aggregateId!==void 0?{aggregateId:t.aggregateId}:{},...t?.correlationId!==void 0?{correlationId:t.correlationId}:{},...t?.causationId!==void 0?{causationId:t.causationId}:{},...t?.metadata!==void 0?{metadata:Object.freeze({...t.metadata})}:{},...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}})}}),s.meta.error.emit(null,{internal:!0})}catch(g){throw d=!0,g}};try{se(u,{audit:this.dispatches,seq:this._dispatchSeqCursor,freeze:this._freezeCommandPayload,onSuccess:([i],g,{t_ns:h,seq:w})=>({commandName:e,payload:i,outcome:"success",emittedEvents:[...a],t_ns:h,seq:w??0,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}),onFailure:([i],g,{t_ns:h,seq:w,errorType:T})=>{let p=g instanceof O?g:new O(e,g);return{commandName:e,payload:i,outcome:"failure",error:p,errorType:T,emittedEvents:[...a],t_ns:h,seq:w??0,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{}}}})(n)}catch(i){throw d&&s.meta.error.emit(i,{internal:!0}),i}}projection(e){let{name:n,events:t,reducer:r,initial:s}=e,a=e.mode??"scan",d=e.freezeInputs??!0,u=e.snapshot,i=t.map(l=>(this._eventLogs.has(l)||this.event(l),this._eventLogs.get(l).node));function g(l){l.sort((c,v)=>c.timestampNs-v.timestampNs||c.seq-v.seq||(c.aggregateId??"").localeCompare(v.aggregateId??""))}function h(l){let c=[];for(let v of l)c.push(...v);return g(c),c}let w=i.map(l=>l.cache??[]),T=h(w),p=d?Object.freeze(T):T,m=0,y=s;a==="scan"&&T.length>0&&(y=r(s,p),m=T.length);let E=a==="replay"?r(s,p):y,S=u?.saveDebounceMs??1e3,A=u?.saveEvery??1e3,_,x=0;function R(l){if(u?.save){if(x+=1,x>=A){x=0,_!==void 0&&(clearTimeout(_),_=void 0);let c=u.save(l);c instanceof Promise&&c.catch(()=>{});return}_!==void 0&&clearTimeout(_),_=setTimeout(()=>{_=void 0,x=0;let c=u.save(l);c instanceof Promise&&c.catch(()=>{})},S)}}let k=j(i,l=>{let c=h(l),v;if(a==="replay"){let b=d?Object.freeze(c):c;v=r(s,b)}else{let b=c.slice(m);m=c.length;let f=d?Object.freeze(b):b;v=r(y,f),y=v}return R(v),v},{name:n,describeKind:"derived",meta:$("projection",{projection_name:n,source_events:t}),guard:pe,initial:E});return this.add(k,{name:n}),this._keepaliveDisposers.push(V(k)),this._keepaliveDisposers.push(()=>{_!==void 0&&(clearTimeout(_),_=void 0)}),this._projections.add(n),{node:k,rebuild:async l=>{try{let c=l?.pageSize??1e3,v=l?.fromTier??this._attachedEventTiers[0]?.[0],b=h(i.map(C=>C.cache??[])).length,f=s;if(u?.load){let C=await u.load();C!==void 0&&(f=C)}if(!v||!v.loadEntries){let C=h(i.map(L=>L.cache??[])),q=d?Object.freeze(C):C;f=r(f,q)}else{let C=new Set(t),q,L=!1;for(;!L;){let G=await v.loadEntries({cursor:q,pageSize:c}),U=[...G.entries].filter(ce=>C.has(ce.type));g(U);let ge=d?Object.freeze(U):U;f=r(f,ge),q=G.cursor,L=!q||G.entries.length===0}}if(a==="scan"){let C=h(i.map(L=>L.cache??[])),q=C.slice(b);if(q.length>0){let L=d?Object.freeze(q):q;f=r(f,L)}y=f,m=C.length}return k.emit(f,{internal:!0}),f}catch(c){throw new P(n,c)}},reset:async()=>{try{let l=s;if(u?.load){let f=await u.load();f!==void 0&&(l=f)}let c=h(i.map(f=>f.cache??[])),v=d?Object.freeze(c):c,b=r(l,v);return a==="scan"&&(y=b,m=c.length),k.emit(b,{internal:!0}),b}catch(l){throw new P(n,l)}}}}saga(e,n,t,r={}){let s=n.map(p=>(this._eventLogs.has(p)||this.event(p),this._eventLogs.get(p).node)),a=ae(this,`${e}_cursor`,n,0),d=M({name:`${e}_invocations`,retainedLimit:this._retainedLimit,graph:this}),u=r.aggregateId,i=r.errorPolicy??"advance",g=new Map;for(let p of n){let m=a[p];g.set(p,m.cache??0);let y=m.subscribe(E=>{for(let S of E)S[0]===Q&&g.set(p,S[1])});this._keepaliveDisposers.push(y)}let h=re((p,m)=>{t(p)},{audit:d,freeze:!1,...r.handlerVersion!==void 0?{handlerVersion:r.handlerVersion}:{},onSuccess:([p,m],y,{t_ns:E})=>({eventType:m,outcome:"success",aggregateId:p.aggregateId,event:p,t_ns:E}),onFailure:([p,m],y,{t_ns:E,errorType:S})=>({eventType:m,outcome:"failure",error:y,errorType:S,aggregateId:p.aggregateId,event:p,t_ns:E})}),w={},T=X(s,(p,m)=>{let y=w.n.meta.error;for(let E=0;E<p.length;E++){let S=p[E];if(S==null||S.length===0)continue;let A=S.at(-1);if(!A)continue;let _=n[E],x=a[_],R=g.get(_)??0;if(A.length>R){let k=A.slice(R),z=R;for(let Z of k){let l=Z;if(u!==void 0&&l.aggregateId!==u){z+=1;continue}try{h(l,_),y.emit(null,{internal:!0}),z+=1}catch(c){if(y.emit(c,{internal:!0}),i==="hold")break;z+=1}}x.emit(z)}}},{name:e,describeKind:"effect",meta:{...$("saga",{saga_name:e,source_events:n}),error:null}});return w.n=T,this.add(T,{name:e}),this._keepaliveDisposers.push(V(T)),this._sagas.add(e),{node:T,invocations:d,audit:d,cursors:a}}};function me(o,e){let n=new F(o,e),{factory:t,factoryArgs:r,...s}=e??{};return n.tagFactory("cqrs",te(s)),n}export{he as a,ve as b,fe as c,F as d,me as e,ye as f};
|
package/dist/chunk-XG62INFA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as x,x as w}from"./chunk-V5A7M7RJ.js";import{i as g,j as p}from"./chunk-CK2E7BTU.js";async function k(o){let i=typeof o=="string"?new TextEncoder().encode(o):o,c=await globalThis.crypto.subtle.digest("SHA-256",i),t=new Uint8Array(c),n="";for(let r=0;r<t.length;r++)n+=b[t[r]];return n}var b=new Array(256);for(let o=0;o<256;o++)b[o]=o.toString(16).padStart(2,"0");var m=class extends Error{constructor(c,t){super(`content-addressed lookup miss in read-strict mode: ${c}`);this.key=c;this.context=t;this.name="ContentAddressedMissError"}};function T(o){let i=new Set,c=t=>{if(t===null||typeof t!="object")return t;let n=t;if(i.has(n))return{__cycle:!0};i.add(n);try{if(Array.isArray(t))return t.map(c);let r={};for(let d of Object.keys(t).sort())r[d]=c(t[d]);return r}finally{i.delete(n)}};return JSON.stringify(c(o))}function P(o){let{storage:i,keyContext:c,keyPrefix:t,mode:n="read-write"}=o,r=c??(e=>e);async function d(e){let s=T(r(e)),a=await k(s);return t?`${t}:${a}`:a}return{keyFor:d,async lookup(e){if(n==="write")return;let s=await d(e),a=await i.load(s);if(a===void 0){if(n==="read-strict")throw new m(s,e);return}return a},async store(e,s){if(n==="read")return;let a=await d(e);await i.save(a,s)},async forget(e){if(n==="read"||n==="write"||!i.delete)return;let s=await d(e);await i.delete(s)}}}function K(o,i={}){let c=i.keyFn??(n=>String(n)),t=new Map;return n=>{let r=c(n),d=t.get(r);if(d)return d;let e=o(n),s;e!=null&&typeof e.then=="function"?s=Promise.resolve(e):e!=null&&typeof e=="object"&&"subscribe"in e&&"cache"in e?s=w(e):e!=null&&typeof e=="object"&&Symbol.asyncIterator in e?s=(async()=>{let u=e[Symbol.asyncIterator]();try{let{value:l,done:f}=await u.next();if(f)throw new Error("singleFromAny: factory returned empty async iterable");return l}finally{await u.return?.()}})():e!=null&&typeof e=="object"&&Symbol.iterator in e?s=(async()=>{let u=e[Symbol.iterator]();try{let{value:l,done:f}=u.next();if(f)throw new Error("singleFromAny: factory returned empty iterable");return l}finally{u.return?.()}})():s=Promise.resolve(e);let a,y=()=>{t.get(r)===a&&t.delete(r)};return a=s.then(u=>(y(),u),u=>{throw y(),u}),t.set(r,a),a}}function j(o,i={}){let c=i.keyFn??(n=>String(n)),t=new Map;return n=>{let r=c(n),d=t.get(r);if(d)return d;let e=x(o(n));t.set(r,e);let s=e.subscribe(a=>{for(let y of a)if(y[0]===p||y[0]===g){t.get(r)===e&&t.delete(r),s();return}});return e}}export{k as a,m as b,T as c,P as d,K as e,j as f};
|
package/dist/chunk-Y4NI3X7O.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import{b as X}from"./chunk-CUNIRONA.js";import{h as Q,j as U}from"./chunk-626TESAC.js";import{E as z,F as W,G as Y,H as V}from"./chunk-LYCLF26R.js";import{b as ie}from"./chunk-QYADASLV.js";var he={};ie(he,{compileSpec:()=>ue,decompileSpec:()=>me,extractFnFactory:()=>te,extractSourceFactory:()=>ne,generateCatalogPrompt:()=>oe,isRichFnEntry:()=>T,isRichSourceEntry:()=>I,llmCompose:()=>ye,llmRefine:()=>ae,specDiff:()=>ge,validateSpec:()=>q,validateSpecAgainstCatalog:()=>K});function M(n){let e=n.meta?.factory;return typeof e=="string"?e:void 0}function C(n){let e=n.meta?.factoryArgs;return e!=null&&typeof e=="object"?e:{}}function Z(n){let e=C(n);return"initial"in e?e.initial:n.value}function T(n){return typeof n=="object"&&n!==null&&"factory"in n}function I(n){return typeof n=="object"&&n!==null&&"factory"in n}function te(n){return T(n)?n.factory:n}function ne(n){return I(n)?n.factory:n}function oe(n){let e=[];if(n.fns){let o=new Map;for(let[s,f]of Object.entries(n.fns)){let p=T(f)?f.tags?.[0]??"Other":"Other";o.has(p)||o.set(p,[]),o.get(p).push(ce(s,f))}for(let[s,f]of o)e.push(`${s}:
|
|
2
|
-
${f.join(`
|
|
3
|
-
`)}`)}if(n.sources){let o=[];for(let[s,f]of Object.entries(n.sources))o.push(pe(s,f));o.length>0&&e.push(`Sources:
|
|
4
|
-
${o.join(`
|
|
5
|
-
`)}`)}return e.join(`
|
|
6
|
-
|
|
7
|
-
`)}function ce(n,e){if(!T(e))return`- ${n}`;let o=`- ${n}: ${e.description}`;if(e.configSchema){let s=Object.entries(e.configSchema).map(([f,p])=>{let u=`${f}: ${p.type}`;return p.enum&&(u+=` (${p.enum.join("|")})`),p.required===!1&&(u+="?"),u});o+=`. Config: { ${s.join(", ")} }`}return o}function pe(n,e){if(!I(e))return`- ${n}`;let o=`- ${n}: ${e.description}`;if(e.configSchema){let s=Object.entries(e.configSchema).map(([f,p])=>{let u=`${f}: ${p.type}`;return p.required===!1&&(u+="?"),u});o+=`. Config: { ${s.join(", ")} }`}return o}function K(n,e){let o=[],s=new Set(Object.keys(e.fns??{})),f=new Set(Object.keys(e.sources??{}));for(let[p,u]of Object.entries(n.nodes)){if(u.type==="template")continue;let i=u,r=M(i);if(r==null)continue;let t=i.type==="producer";if(i.type==="state"&&r==="state")continue;if(t){let h=f.has(r),l=s.has(r);if(!h&&!l&&(f.size>0||s.size>0)){let b=J(r,f)??J(r,s);o.push(`Node "${p}": source "${r}" not found in catalog`+(b?`. Did you mean "${b}"?`:""))}}else if(s.size>0&&!s.has(r))if(f.has(r))o.push(`Node "${p}": fn "${r}" is a source, not a function. Use it as a producer source instead, or use a function from: ${[...s].join(", ")}`);else{let h=J(r,s);o.push(`Node "${p}": fn "${r}" not found in catalog`+(h?`. Did you mean "${h}"?`:""))}let m=C(i);if(!t&&e.fns?.[r]){let h=e.fns[r];if(T(h)&&h.configSchema){for(let[l,b]of Object.entries(h.configSchema))if(b.required!==!1&&!(l in m)&&o.push(`Node "${p}": config missing required field "${l}"`),l in m&&b.enum){let S=m[l];b.enum.includes(S)||o.push(`Node "${p}": config.${l} = ${JSON.stringify(S)}, expected one of: ${b.enum.join(", ")}`)}}}if(t&&e.sources?.[r]){let h=e.sources[r];if(I(h)&&h.configSchema){for(let[l,b]of Object.entries(h.configSchema))if(b.required!==!1&&!(l in m)&&o.push(`Node "${p}": config missing required field "${l}"`),l in m&&b.enum){let S=m[l];b.enum.includes(S)||o.push(`Node "${p}": config.${l} = ${JSON.stringify(S)}, expected one of: ${b.enum.join(", ")}`)}}}}if(n.templates)for(let[p,u]of Object.entries(n.templates))for(let[i,r]of Object.entries(u.nodes)){let t=M(r);if(t!=null&&!(r.type==="state"&&t==="state")&&r.type!=="producer"&&s.size>0&&!s.has(t)){let m=J(t,s);o.push(`Template "${p}" node "${i}": fn "${t}" not found in catalog`+(m?`. Did you mean "${m}"?`:""))}}return{valid:o.length===0,errors:o,warnings:[]}}function J(n,e){let o=null,s=1/0,f=n.toLowerCase();for(let p of e){let u=fe(f,p.toLowerCase());u<s&&u<=Math.max(3,Math.floor(n.length/2))&&(s=u,o=p)}return o}function fe(n,e){let o=n.length,s=e.length,f=Array.from({length:o+1},(p,u)=>Array.from({length:s+1},(i,r)=>u===0?r:r===0?u:0));for(let p=1;p<=o;p++)for(let u=1;u<=s;u++)f[p][u]=n[p-1]===e[u-1]?f[p-1][u-1]:1+Math.min(f[p-1][u],f[p][u-1],f[p-1][u-1]);return f[o][s]}var ee=new Set(["state","producer","derived","effect","operator","template"]),de=new Set(["state","producer","derived","effect","operator"]);function q(n){let e=[],o=[];if(n==null||typeof n!="object")return{valid:!1,errors:["GraphSpec must be a non-null object"],warnings:o};let s=n;if((typeof s.name!="string"||s.name.length===0)&&e.push("Missing or empty 'name' field"),s.nodes==null||typeof s.nodes!="object"||Array.isArray(s.nodes))return e.push("Missing or invalid 'nodes' field (must be an object)"),{valid:!1,errors:e,warnings:o};let f=new Set(Object.keys(s.nodes)),p=new Map,u=new Map;if(s.templates!=null&&typeof s.templates=="object"&&!Array.isArray(s.templates)){for(let[i,r]of Object.entries(s.templates))if(r!=null&&typeof r=="object"){let t=r;u.set(i,{params:Array.isArray(t.params)?t.params:[]})}}if(s.templates!=null)if(typeof s.templates!="object"||Array.isArray(s.templates))e.push("'templates' must be an object");else for(let[i,r]of Object.entries(s.templates)){if(r==null||typeof r!="object"){e.push(`Template "${i}": must be an object`);continue}let t=r;if(Array.isArray(t.params)||e.push(`Template "${i}": missing 'params' array`),t.nodes==null||typeof t.nodes!="object"||Array.isArray(t.nodes))e.push(`Template "${i}": missing or invalid 'nodes' object`);else{let m=new Set(Array.isArray(t.params)?t.params:[]),h=new Set(Object.keys(t.nodes));for(let[l,b]of Object.entries(t.nodes)){if(b==null||typeof b!="object"){e.push(`Template "${i}" node "${l}": must be an object`);continue}let S=b;if((typeof S.type!="string"||!de.has(S.type))&&e.push(`Template "${i}" node "${l}": invalid type`),Array.isArray(S.deps))for(let g of S.deps)!h.has(g)&&!m.has(g)&&e.push(`Template "${i}" node "${l}": dep "${g}" is not an inner node or param`)}typeof t.output!="string"?e.push(`Template "${i}": missing 'output' string`):t.nodes[t.output]||e.push(`Template "${i}": output "${t.output}" is not a declared node`)}}for(let[i,r]of Object.entries(s.nodes)){if(r==null||typeof r!="object"){e.push(`Node "${i}": must be an object`);continue}let t=r;if(typeof t.type!="string"||!ee.has(t.type)){e.push(`Node "${i}": invalid type "${String(t.type)}" (expected: ${[...ee].join(", ")})`);continue}if(p.set(i,t.type),t.type==="template")if(typeof t.template!="string"||!u.has(t.template))e.push(`Node "${i}": template "${String(t.template)}" not found in templates`);else if(t.bind==null||typeof t.bind!="object"||Array.isArray(t.bind))e.push(`Node "${i}": template ref requires 'bind' object`);else{let m=u.get(t.template),h=t.bind;for(let l of m.params)l in h||e.push(`Node "${i}": template param "${l}" is not bound (template "${t.template}")`);for(let[,l]of Object.entries(h))typeof l=="string"&&!f.has(l)&&e.push(`Node "${i}": bind target "${l}" does not reference an existing node`)}else{if(Array.isArray(t.deps))for(let m of t.deps)m===i?e.push(`Node "${i}": self-referencing dep`):f.has(m)||e.push(`Node "${i}": dep "${m}" does not reference an existing node`);(t.type==="derived"||t.type==="effect"||t.type==="operator")&&!Array.isArray(t.deps)&&e.push(`Node "${i}": ${t.type} node should have a 'deps' array`)}}if(s.feedback!=null)if(!Array.isArray(s.feedback))e.push("'feedback' must be an array");else for(let i=0;i<s.feedback.length;i++){let r=s.feedback[i];if(r==null||typeof r!="object"){e.push(`Feedback [${i}]: must be an object`);continue}let t=r;typeof t.from!="string"||!f.has(t.from)?e.push(`Feedback [${i}]: 'from' "${String(t.from)}" does not reference an existing node`):p.get(t.from)==="effect"&&o.push(`Feedback [${i}]: 'from' "${t.from}" is an effect node \u2014 effects emit no DATA, so the feedback edge will never fire. Did you mean a derived/state node upstream?`),typeof t.from=="string"&&t.from===t.to&&e.push(`Feedback [${i}]: 'from' and 'to' must be different nodes`),typeof t.to!="string"||!f.has(t.to)?e.push(`Feedback [${i}]: 'to' "${String(t.to)}" does not reference an existing node`):typeof t.to=="string"&&p.get(t.to)!=="state"&&e.push(`Feedback [${i}]: 'to' node "${t.to}" must be a state node (got "${p.get(t.to)??"unknown"}")`)}return{valid:e.length===0,errors:e,warnings:o}}function ue(n,e){let o=q(n);if(!o.valid)throw new Error(`compileSpec: invalid GraphSpec:
|
|
8
|
-
${o.errors.join(`
|
|
9
|
-
`)}`);let s=n.factory,f=n.factoryArgs;if(typeof s=="string"){let a=e?.catalog?.graphFactories?.[s];if(a)return a(f)}let p=e?.catalog??{},u=e?.onMissing??"placeholder",i=new U(n.name),r=n.templates??{},t=K(n,p);if(!t.valid)throw new Error(`compileSpec: catalog validation errors:
|
|
10
|
-
${t.errors.join(`
|
|
11
|
-
`)}`);let m=[],h=(a,d,y)=>{m.push({path:a,kind:d,name:y})},l=a=>{let d=p.fns?.[a];return d?te(d):void 0},b=a=>{let d=p.sources?.[a];return d?ne(d):void 0},S=a=>{if(!a)return;let d={};for(let[y,w]of Object.entries(a))y==="factory"||y==="factoryArgs"||(d[y]=w);return Object.keys(d).length>0?d:void 0},g=new Map,x=[];for(let[a,d]of Object.entries(n.nodes)){if(d.type==="template")continue;let y=d,w=M(y),k=C(y);if(y.type==="state"){let v=Z(y),R=z(v,{name:a,meta:S(y.meta)});i.add(R,{name:a}),g.set(a,R)}else if(y.type==="producer"){let v=w?b(w):void 0,R=w?l(w):void 0;if(v){let N=v(k);i.add(N,{name:a}),g.set(a,N)}else if(R){let N=R([],k);i.add(N,{name:a}),g.set(a,N)}else{w&&h(a,"source",w);let N=W(()=>{},{name:a,meta:{...S(y.meta),_specSource:w}});i.add(N,{name:a}),g.set(a,N)}}else x.push([a,y])}let L=!0,c=new Map(x);for(;c.size>0&&L;){L=!1;for(let[a,d]of[...c.entries()]){let y=d.deps??[];if(!y.every(F=>g.has(F)))continue;let w=y.map(F=>g.get(F)),k=M(d),v=C(d),R=k?l(k):void 0,N;R?N=R(w,v):d.type==="effect"?(k&&h(a,"fn",k),N=V(w,()=>{})):(k&&h(a,"fn",k),N=Y(w,F=>F[0])),i.add(N,{name:a}),g.set(a,N),c.delete(a),L=!0}}if(c.size>0){let a=[...c.keys()].sort().join(", ");throw new Error(`compileSpec: unresolvable deps for nodes: ${a}`)}for(let[a,d]of Object.entries(n.nodes)){if(d.type!=="template")continue;let y=d,w=r[y.template],k=new U(a),v=new Map,R=[];for(let[$,j]of Object.entries(w.nodes)){let P=(j.deps??[]).map(A=>A.startsWith("$")&&y.bind[A]?y.bind[A]:A),H={...j,deps:P},G=M(j),E=C(j);if(j.type==="state"){let A=Z(j),_=z(A,{name:$,meta:S(j.meta)});k.add(_,{name:$}),v.set($,_)}else if(j.type==="producer"){let A=G?b(G):void 0,_=G?l(G):void 0;if(A){let O=A(E);k.add(O,{name:$}),v.set($,O)}else if(_){let O=_([],E);k.add(O,{name:$}),v.set($,O)}else{G&&h(`${a}.${$}`,"source",G);let O=W(()=>{},{name:$,meta:{...S(j.meta),_specSource:G}});k.add(O,{name:$}),v.set($,O)}}else R.push([$,H])}let N=!0,F=new Map(R);for(;F.size>0&&N;){N=!1;for(let[$,j]of[...F.entries()]){let P=j.deps??[];if(!P.every(D=>v.has(D)||g.has(D)))continue;let G=P.map(D=>v.get(D)??g.get(D)),E=M(j),A=C(j),_=E?l(E):void 0,O;_?O=_(G,A):j.type==="effect"?(E&&h(`${a}.${$}`,"fn",E),O=V(G,()=>{})):(E&&h(`${a}.${$}`,"fn",E),O=Y(G,D=>D[0])),k.add(O,{name:$}),v.set($,O),F.delete($),N=!0}}if(F.size>0){let $=[...F.keys()].sort().join(", ");throw new Error(`compileSpec: template "${y.template}" has unresolvable deps: ${$}`)}i.mount(a,k);let B=`${a}::${w.output}`;g.set(a,i.resolve(B));try{let $=i.resolve(B);$.meta._templateName?.emit(y.template),$.meta._templateBind?.emit(y.bind)}catch{}}for(let a of n.feedback??[])X(i,a.from,a.to,{maxIterations:a.maxIterations});if(m.length>0){if(u==="error"){let a=m.map(d=>` - ${d.path}: missing ${d.kind} "${d.name}"`);throw new Error(`compileSpec: ${m.length} catalog entr${m.length===1?"y":"ies"} missing \u2014 pass them via opts.catalog or set opts.onMissing to "warn"/"placeholder":
|
|
12
|
-
${a.join(`
|
|
13
|
-
`)}`)}if(u==="warn"){let a=e?.onWarn??(d=>console.warn(d));for(let d of m)a(`compileSpec: ${d.path} references missing ${d.kind} "${d.name}" \u2014 substituted placeholder`)}}return i}var le=new Set(["reduction","reduction_type","_specFn","_specSource","_templateName","_templateBind","feedbackFrom","feedbackTo","_internal"]);function me(n){let e=n.describe({detail:"spec"}),o=`::${Q}::`,s=/^__feedback_(?!effect_)(.+)$/,f=[],p=new Set;for(let[r,t]of Object.entries(e.nodes))t.meta?.factory!=null&&!r.includes("::")&&p.add(r);let u={};for(let[r,t]of Object.entries(e.nodes)){if(r.includes(o))continue;let m=r.indexOf("::");if(m>0&&p.has(r.slice(0,m)))continue;if(s.exec(r)){let g=t.meta;g?.feedbackFrom&&g?.feedbackTo&&f.push({from:g.feedbackFrom,to:g.feedbackTo,...g.maxIterations?{maxIterations:g.maxIterations}:{}});continue}if(t.meta?._internal||r.startsWith("__feedback_effect_")||r.startsWith("__bridge_"))continue;let l=t.meta,b=l;if(l&&Object.keys(l).length>0){let g={};for(let[x,L]of Object.entries(l))le.has(x)||(g[x]=L);g.factory==="withStatus"?(delete g.status,delete g.error):g.factory==="withBreaker"?delete g.breakerState:g.factory==="verifiable"&&delete g.sourceVersion,b=Object.keys(g).length>0?g:void 0}let S={...t};b===void 0?delete S.meta:S.meta=b,u[r]=S}let i={...e,nodes:u};return delete i.expand,f.length>0&&(i.feedback=f),i}function ge(n,e){let o=[];n.name!==e.name&&o.push({type:"changed",path:"name",detail:`"${n.name}" \u2192 "${e.name}"`});let s=new Set(Object.keys(n.nodes)),f=new Set(Object.keys(e.nodes));for(let c of f)if(!s.has(c)){let a=e.nodes[c];o.push({type:"added",path:`nodes.${c}`,detail:`type: ${a.type}`})}for(let c of s)f.has(c)||o.push({type:"removed",path:`nodes.${c}`});for(let c of s){if(!f.has(c))continue;let a=n.nodes[c],d=e.nodes[c];if(JSON.stringify(a)!==JSON.stringify(d)){let y=[];a.type!==d.type&&y.push(`type: ${a.type} \u2192 ${d.type}`),JSON.stringify(a.deps)!==JSON.stringify(d.deps)&&y.push("deps changed");let w=a.type==="template"?void 0:M(a),k=d.type==="template"?void 0:M(d);w!==k&&y.push(`fn: ${w} \u2192 ${k}`);let v=a.type==="template"?void 0:C(a),R=d.type==="template"?void 0:C(d);JSON.stringify(v)!==JSON.stringify(R)&&y.push("config changed"),o.push({type:"changed",path:`nodes.${c}`,detail:y.join("; ")||"modified"})}}let p=n.templates??{},u=e.templates??{},i=new Set(Object.keys(p)),r=new Set(Object.keys(u));for(let c of r)i.has(c)||o.push({type:"added",path:`templates.${c}`});for(let c of i)r.has(c)||o.push({type:"removed",path:`templates.${c}`});for(let c of i)r.has(c)&&JSON.stringify(p[c])!==JSON.stringify(u[c])&&o.push({type:"changed",path:`templates.${c}`,detail:"template definition changed"});let t=n.feedback??[],m=e.feedback??[],h=new Set(t.map(c=>`${c.from}->${c.to}`)),l=new Set(m.map(c=>`${c.from}->${c.to}`));for(let c of m){let a=`${c.from}->${c.to}`;h.has(a)||o.push({type:"added",path:`feedback.${a}`,detail:`maxIterations: ${c.maxIterations??10}`})}for(let c of t){let a=`${c.from}->${c.to}`;l.has(a)||o.push({type:"removed",path:`feedback.${a}`})}for(let c of t){let a=`${c.from}->${c.to}`,d=m.find(y=>y.from===c.from&&y.to===c.to);d&&JSON.stringify(c)!==JSON.stringify(d)&&o.push({type:"changed",path:`feedback.${a}`,detail:`maxIterations: ${c.maxIterations??10} \u2192 ${d.maxIterations??10}`})}let b=o.filter(c=>c.type==="added").length,S=o.filter(c=>c.type==="removed").length,g=o.filter(c=>c.type==="changed").length,x=[];b&&x.push(`${b} added`),S&&x.push(`${S} removed`),g&&x.push(`${g} changed`);let L=x.length>0?x.join(", "):"no changes";return{entries:o,summary:L}}var se=`You are a graph architect for GraphReFly, a reactive graph protocol.
|
|
14
|
-
|
|
15
|
-
Given a natural-language description, produce a JSON GraphSpec with this structure:
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
"name": "<graph_name>",
|
|
19
|
-
"nodes": {
|
|
20
|
-
"<node_name>": {
|
|
21
|
-
"type": "state" | "derived" | "producer" | "effect",
|
|
22
|
-
"deps": ["<dep_node_name>", ...],
|
|
23
|
-
"value": <initial_value>,
|
|
24
|
-
"meta": {
|
|
25
|
-
"factory": "<catalog_factory_name>",
|
|
26
|
-
"factoryArgs": { ... },
|
|
27
|
-
"description": "<purpose>"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"<template_instance>": {
|
|
31
|
-
"type": "template",
|
|
32
|
-
"template": "<template_name>",
|
|
33
|
-
"bind": { "$param": "node_name" }
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"templates": {
|
|
37
|
-
"<template_name>": {
|
|
38
|
-
"params": ["$param1", "$param2"],
|
|
39
|
-
"nodes": { ... },
|
|
40
|
-
"output": "<output_node>"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"feedback": [
|
|
44
|
-
{ "from": "<condition_node>", "to": "<state_node>", "maxIterations": 10 }
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Rules:
|
|
49
|
-
- "state" nodes hold user/LLM-writable values (knobs). Stamp the initial value
|
|
50
|
-
in "meta.factoryArgs.initial" (or as the top-level "value" field \u2014 both work).
|
|
51
|
-
- "derived" nodes compute from deps using a catalog function named in
|
|
52
|
-
"meta.factory"; pass any config via "meta.factoryArgs".
|
|
53
|
-
- "effect" nodes produce side effects from deps; same meta.factory shape as derived.
|
|
54
|
-
- "producer" nodes generate values from a catalog source named in "meta.factory";
|
|
55
|
-
pass any config via "meta.factoryArgs".
|
|
56
|
-
- Use "templates" when the same subgraph pattern repeats (e.g., per-source resilience).
|
|
57
|
-
- Use "feedback" for bounded cycles where a derived value writes back to a state node.
|
|
58
|
-
- meta.description is required for every node.
|
|
59
|
-
- Return ONLY valid JSON, no markdown fences or commentary.`;function re(n){let e=n.match(/^```(?:json)?\s*([\s\S]*?)\s*```[\s\S]*$/);return e?e[1]:n}async function ye(n,e,o){let s=se,f=o?.catalogDescription??(o?.catalog?oe(o.catalog):void 0);f&&(s+=`
|
|
60
|
-
|
|
61
|
-
Available catalog (use ONLY these names):
|
|
62
|
-
${f}`),o?.systemPromptExtra&&(s+=`
|
|
63
|
-
|
|
64
|
-
${o.systemPromptExtra}`);let p=[{role:"system",content:s},{role:"user",content:n}],r=(await e.invoke(p,{model:o?.model,temperature:o?.temperature??0,maxTokens:o?.maxTokens})).content.trim();r.startsWith("```")&&(r=re(r));let t;try{t=JSON.parse(r)}catch{throw new Error(`llmCompose: LLM response is not valid JSON: ${r.slice(0,200)}`)}let m=q(t);if(!m.valid)throw new Error(`llmCompose: invalid GraphSpec:
|
|
65
|
-
${m.errors.join(`
|
|
66
|
-
`)}`);let h=t;if(o?.catalog){let l=o.maxAutoRefine??0;for(let b=0;b<=l;b++){let S=K(h,o.catalog);if(S.valid)break;if(b===l)throw new Error(`llmCompose: catalog validation failed after ${l} refine attempts:
|
|
67
|
-
${S.errors.join(`
|
|
68
|
-
`)}`);h=await ae(h,`Fix these catalog errors:
|
|
69
|
-
${S.errors.join(`
|
|
70
|
-
`)}
|
|
71
|
-
|
|
72
|
-
Use ONLY functions and sources from the catalog.`,e,{...o,catalogDescription:f})}}return h}async function ae(n,e,o,s){let f=se;s?.catalogDescription&&(f+=`
|
|
73
|
-
|
|
74
|
-
Available catalog:
|
|
75
|
-
${s.catalogDescription}`),s?.systemPromptExtra&&(f+=`
|
|
76
|
-
|
|
77
|
-
${s.systemPromptExtra}`);let p=[{role:"system",content:f},{role:"user",content:`Current GraphSpec:
|
|
78
|
-
${JSON.stringify(n,null,2)}
|
|
79
|
-
|
|
80
|
-
Modification request: ${e}
|
|
81
|
-
|
|
82
|
-
Return the complete modified GraphSpec as JSON.`}],r=(await o.invoke(p,{model:s?.model,temperature:s?.temperature??0,maxTokens:s?.maxTokens})).content.trim();r.startsWith("```")&&(r=re(r));let t;try{t=JSON.parse(r)}catch{throw new Error(`llmRefine: LLM response is not valid JSON: ${r.slice(0,200)}`)}let m=q(t);if(!m.valid)throw new Error(`llmRefine: invalid GraphSpec:
|
|
83
|
-
${m.errors.join(`
|
|
84
|
-
`)}`);return t}export{T as a,I as b,te as c,ne as d,oe as e,K as f,q as g,ue as h,me as i,ge as j,ye as k,ae as l,he as m};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { KvStorageTier } from './extra/storage-tiers.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Content-addressed storage substrate — a generic lookup / store helper over
|
|
5
|
-
* any {@link StorageTier}. Hashes an arbitrary context object via
|
|
6
|
-
* {@link canonicalJson} + sha256 to produce a stable key, then reads or writes
|
|
7
|
-
* the record from the underlying tier.
|
|
8
|
-
*
|
|
9
|
-
* Substrate shared by LLM adapters (`withReplayCache`, `fallbackAdapter`) —
|
|
10
|
-
* the LLM-specific shape (key prefix, `ChatMessage` + `LLMInvokeOptions`
|
|
11
|
-
* context) lives in a thin wrapper inside `patterns/ai/adapters/_internal/`.
|
|
12
|
-
* Any consumer that wants "memoize by content hash over a pluggable tier"
|
|
13
|
-
* (tool result caches, embedding caches, deterministic function memoization,
|
|
14
|
-
* fixtures for replay tests) can use this primitive directly.
|
|
15
|
-
*
|
|
16
|
-
* Universal tier — browser + Node safe. `sha256Hex` is pulled from
|
|
17
|
-
* `core/hash.ts` (Web Crypto), `canonicalJson` is a pure function in this
|
|
18
|
-
* module.
|
|
19
|
-
*
|
|
20
|
-
* @module
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Read / write / read-write / read-strict.
|
|
25
|
-
*
|
|
26
|
-
* - `"read"` — lookups hit storage; misses fall through to the caller.
|
|
27
|
-
* - `"write"` — store only; lookups always return `undefined`.
|
|
28
|
-
* - `"read-write"` — lookups hit storage, misses are writable by the caller.
|
|
29
|
-
* - `"read-strict"` — lookups hit storage, misses throw (no fallthrough).
|
|
30
|
-
* Used by fixture-based replay flows where a missing fixture is a test bug.
|
|
31
|
-
*
|
|
32
|
-
* @category extra
|
|
33
|
-
*/
|
|
34
|
-
type ContentAddressedMode = "read" | "write" | "read-write" | "read-strict";
|
|
35
|
-
/** Error thrown when `read-strict` mode misses. */
|
|
36
|
-
declare class ContentAddressedMissError extends Error {
|
|
37
|
-
readonly key: string;
|
|
38
|
-
readonly context: unknown;
|
|
39
|
-
constructor(key: string, context: unknown);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Options for {@link contentAddressedStorage}.
|
|
43
|
-
*
|
|
44
|
-
* @category extra
|
|
45
|
-
*/
|
|
46
|
-
type ContentAddressedStorageOptions<Ctx> = {
|
|
47
|
-
/** Underlying storage tier (any `KvStorageTier` — memoryKv, fileKv, indexedDbKv). */
|
|
48
|
-
storage: KvStorageTier;
|
|
49
|
-
/**
|
|
50
|
-
* Derive the hashable context from `ctx`. Defaults to `ctx` itself.
|
|
51
|
-
* Use when the caller's `ctx` carries fields that should NOT participate in
|
|
52
|
-
* the key (e.g. an `AbortSignal`, a retry count).
|
|
53
|
-
*/
|
|
54
|
-
keyContext?: (ctx: Ctx) => unknown;
|
|
55
|
-
/**
|
|
56
|
-
* Optional key prefix — applied as `${prefix}:${hex}` so multiple consumers
|
|
57
|
-
* can share one storage tier without collisions.
|
|
58
|
-
*/
|
|
59
|
-
keyPrefix?: string;
|
|
60
|
-
/** Mode — see {@link ContentAddressedMode}. Default `"read-write"`. */
|
|
61
|
-
mode?: ContentAddressedMode;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Handle returned by {@link contentAddressedStorage}.
|
|
65
|
-
*
|
|
66
|
-
* @category extra
|
|
67
|
-
*/
|
|
68
|
-
type ContentAddressedStorage<Ctx, V> = {
|
|
69
|
-
/**
|
|
70
|
-
* Compute the content-addressed key for `ctx` — useful when a caller needs
|
|
71
|
-
* to thread the same key through a singleflight / dedup stage without
|
|
72
|
-
* re-hashing.
|
|
73
|
-
*/
|
|
74
|
-
keyFor(ctx: Ctx): Promise<string>;
|
|
75
|
-
/**
|
|
76
|
-
* Look up a value by hashing `ctx`. In `read-strict` mode, throws
|
|
77
|
-
* {@link ContentAddressedMissError} on miss.
|
|
78
|
-
*/
|
|
79
|
-
lookup(ctx: Ctx): Promise<V | undefined>;
|
|
80
|
-
/** Store `value` under the hash of `ctx`. No-op in `"read"` mode. */
|
|
81
|
-
store(ctx: Ctx, value: V): Promise<void>;
|
|
82
|
-
/** Clear the entry for `ctx`. No-op in `"read"` or `"write"` mode, or when the tier lacks `clear()`. */
|
|
83
|
-
forget(ctx: Ctx): Promise<void>;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Canonical JSON — sorts object keys for stable sha256 while detecting true
|
|
87
|
-
* cycles (not sibling shared refs).
|
|
88
|
-
*
|
|
89
|
-
* We recurse manually with a **path stack** (`seen` contains only the current
|
|
90
|
-
* ancestor chain, not every previously-visited object). On enter we push; on
|
|
91
|
-
* exit we pop. Back-edges to ancestors serialize as `{"__cycle": true}`;
|
|
92
|
-
* siblings that share the same reference serialize normally, producing
|
|
93
|
-
* identical hashes to a freshly-reconstructed equivalent.
|
|
94
|
-
*
|
|
95
|
-
* @category extra
|
|
96
|
-
*/
|
|
97
|
-
declare function canonicalJson(value: unknown): string;
|
|
98
|
-
/**
|
|
99
|
-
* Creates a content-addressed lookup / store handle over `storage`. The key
|
|
100
|
-
* is `sha256Hex(canonicalJson(keyContext(ctx)))`, optionally prefixed by
|
|
101
|
-
* `keyPrefix`.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```ts
|
|
105
|
-
* import { contentAddressedStorage, memoryKv } from "@graphrefly/graphrefly-ts";
|
|
106
|
-
*
|
|
107
|
-
* const cache = contentAddressedStorage<{ query: string }, { answer: string }>({
|
|
108
|
-
* storage: memoryKv(),
|
|
109
|
-
* keyPrefix: "qa",
|
|
110
|
-
* mode: "read-write",
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* const hit = await cache.lookup({ query: "what is graphrefly?" });
|
|
114
|
-
* if (!hit) {
|
|
115
|
-
* const ans = await computeAnswer({ query: "what is graphrefly?" });
|
|
116
|
-
* await cache.store({ query: "what is graphrefly?" }, { answer: ans.text });
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* @category extra
|
|
121
|
-
*/
|
|
122
|
-
declare function contentAddressedStorage<Ctx, V>(opts: ContentAddressedStorageOptions<Ctx>): ContentAddressedStorage<Ctx, V>;
|
|
123
|
-
|
|
124
|
-
export { ContentAddressedMissError as C, type ContentAddressedMode as a, type ContentAddressedStorage as b, type ContentAddressedStorageOptions as c, canonicalJson as d, contentAddressedStorage as e };
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { KvStorageTier } from './extra/storage-tiers.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Content-addressed storage substrate — a generic lookup / store helper over
|
|
5
|
-
* any {@link StorageTier}. Hashes an arbitrary context object via
|
|
6
|
-
* {@link canonicalJson} + sha256 to produce a stable key, then reads or writes
|
|
7
|
-
* the record from the underlying tier.
|
|
8
|
-
*
|
|
9
|
-
* Substrate shared by LLM adapters (`withReplayCache`, `fallbackAdapter`) —
|
|
10
|
-
* the LLM-specific shape (key prefix, `ChatMessage` + `LLMInvokeOptions`
|
|
11
|
-
* context) lives in a thin wrapper inside `patterns/ai/adapters/_internal/`.
|
|
12
|
-
* Any consumer that wants "memoize by content hash over a pluggable tier"
|
|
13
|
-
* (tool result caches, embedding caches, deterministic function memoization,
|
|
14
|
-
* fixtures for replay tests) can use this primitive directly.
|
|
15
|
-
*
|
|
16
|
-
* Universal tier — browser + Node safe. `sha256Hex` is pulled from
|
|
17
|
-
* `core/hash.ts` (Web Crypto), `canonicalJson` is a pure function in this
|
|
18
|
-
* module.
|
|
19
|
-
*
|
|
20
|
-
* @module
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Read / write / read-write / read-strict.
|
|
25
|
-
*
|
|
26
|
-
* - `"read"` — lookups hit storage; misses fall through to the caller.
|
|
27
|
-
* - `"write"` — store only; lookups always return `undefined`.
|
|
28
|
-
* - `"read-write"` — lookups hit storage, misses are writable by the caller.
|
|
29
|
-
* - `"read-strict"` — lookups hit storage, misses throw (no fallthrough).
|
|
30
|
-
* Used by fixture-based replay flows where a missing fixture is a test bug.
|
|
31
|
-
*
|
|
32
|
-
* @category extra
|
|
33
|
-
*/
|
|
34
|
-
type ContentAddressedMode = "read" | "write" | "read-write" | "read-strict";
|
|
35
|
-
/** Error thrown when `read-strict` mode misses. */
|
|
36
|
-
declare class ContentAddressedMissError extends Error {
|
|
37
|
-
readonly key: string;
|
|
38
|
-
readonly context: unknown;
|
|
39
|
-
constructor(key: string, context: unknown);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Options for {@link contentAddressedStorage}.
|
|
43
|
-
*
|
|
44
|
-
* @category extra
|
|
45
|
-
*/
|
|
46
|
-
type ContentAddressedStorageOptions<Ctx> = {
|
|
47
|
-
/** Underlying storage tier (any `KvStorageTier` — memoryKv, fileKv, indexedDbKv). */
|
|
48
|
-
storage: KvStorageTier;
|
|
49
|
-
/**
|
|
50
|
-
* Derive the hashable context from `ctx`. Defaults to `ctx` itself.
|
|
51
|
-
* Use when the caller's `ctx` carries fields that should NOT participate in
|
|
52
|
-
* the key (e.g. an `AbortSignal`, a retry count).
|
|
53
|
-
*/
|
|
54
|
-
keyContext?: (ctx: Ctx) => unknown;
|
|
55
|
-
/**
|
|
56
|
-
* Optional key prefix — applied as `${prefix}:${hex}` so multiple consumers
|
|
57
|
-
* can share one storage tier without collisions.
|
|
58
|
-
*/
|
|
59
|
-
keyPrefix?: string;
|
|
60
|
-
/** Mode — see {@link ContentAddressedMode}. Default `"read-write"`. */
|
|
61
|
-
mode?: ContentAddressedMode;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Handle returned by {@link contentAddressedStorage}.
|
|
65
|
-
*
|
|
66
|
-
* @category extra
|
|
67
|
-
*/
|
|
68
|
-
type ContentAddressedStorage<Ctx, V> = {
|
|
69
|
-
/**
|
|
70
|
-
* Compute the content-addressed key for `ctx` — useful when a caller needs
|
|
71
|
-
* to thread the same key through a singleflight / dedup stage without
|
|
72
|
-
* re-hashing.
|
|
73
|
-
*/
|
|
74
|
-
keyFor(ctx: Ctx): Promise<string>;
|
|
75
|
-
/**
|
|
76
|
-
* Look up a value by hashing `ctx`. In `read-strict` mode, throws
|
|
77
|
-
* {@link ContentAddressedMissError} on miss.
|
|
78
|
-
*/
|
|
79
|
-
lookup(ctx: Ctx): Promise<V | undefined>;
|
|
80
|
-
/** Store `value` under the hash of `ctx`. No-op in `"read"` mode. */
|
|
81
|
-
store(ctx: Ctx, value: V): Promise<void>;
|
|
82
|
-
/** Clear the entry for `ctx`. No-op in `"read"` or `"write"` mode, or when the tier lacks `clear()`. */
|
|
83
|
-
forget(ctx: Ctx): Promise<void>;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Canonical JSON — sorts object keys for stable sha256 while detecting true
|
|
87
|
-
* cycles (not sibling shared refs).
|
|
88
|
-
*
|
|
89
|
-
* We recurse manually with a **path stack** (`seen` contains only the current
|
|
90
|
-
* ancestor chain, not every previously-visited object). On enter we push; on
|
|
91
|
-
* exit we pop. Back-edges to ancestors serialize as `{"__cycle": true}`;
|
|
92
|
-
* siblings that share the same reference serialize normally, producing
|
|
93
|
-
* identical hashes to a freshly-reconstructed equivalent.
|
|
94
|
-
*
|
|
95
|
-
* @category extra
|
|
96
|
-
*/
|
|
97
|
-
declare function canonicalJson(value: unknown): string;
|
|
98
|
-
/**
|
|
99
|
-
* Creates a content-addressed lookup / store handle over `storage`. The key
|
|
100
|
-
* is `sha256Hex(canonicalJson(keyContext(ctx)))`, optionally prefixed by
|
|
101
|
-
* `keyPrefix`.
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```ts
|
|
105
|
-
* import { contentAddressedStorage, memoryKv } from "@graphrefly/graphrefly-ts";
|
|
106
|
-
*
|
|
107
|
-
* const cache = contentAddressedStorage<{ query: string }, { answer: string }>({
|
|
108
|
-
* storage: memoryKv(),
|
|
109
|
-
* keyPrefix: "qa",
|
|
110
|
-
* mode: "read-write",
|
|
111
|
-
* });
|
|
112
|
-
*
|
|
113
|
-
* const hit = await cache.lookup({ query: "what is graphrefly?" });
|
|
114
|
-
* if (!hit) {
|
|
115
|
-
* const ans = await computeAnswer({ query: "what is graphrefly?" });
|
|
116
|
-
* await cache.store({ query: "what is graphrefly?" }, { answer: ans.text });
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* @category extra
|
|
121
|
-
*/
|
|
122
|
-
declare function contentAddressedStorage<Ctx, V>(opts: ContentAddressedStorageOptions<Ctx>): ContentAddressedStorage<Ctx, V>;
|
|
123
|
-
|
|
124
|
-
export { ContentAddressedMissError as C, type ContentAddressedMode as a, type ContentAddressedStorage as b, type ContentAddressedStorageOptions as c, canonicalJson as d, contentAddressedStorage as e };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { N as Node, a as NodeOptions } from './node-ClS5yC-B.cjs';
|
|
2
|
-
import { R as ReactiveMapBundle, b as ReactiveMapOptions } from './reactive-map-48mnZ-nu.cjs';
|
|
3
|
-
import { NodeInput } from './extra/sources.cjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Composite data patterns (roadmap §3.2b).
|
|
7
|
-
*
|
|
8
|
-
* These helpers compose existing primitives (`node`, `switchMap`, `reactiveMap`,
|
|
9
|
-
* `dynamicNode`, `fromAny`) without introducing new protocol semantics.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Verification payload shape is intentionally user-defined.
|
|
14
|
-
*/
|
|
15
|
-
type VerifyValue = unknown;
|
|
16
|
-
type VerifiableOptions<TVerify = VerifyValue> = Omit<NodeOptions, "describeKind" | "initial"> & {
|
|
17
|
-
/** Reactive re-verification trigger. */
|
|
18
|
-
trigger?: NodeInput<unknown>;
|
|
19
|
-
/** Re-run verification whenever `source` settles. */
|
|
20
|
-
autoVerify?: boolean;
|
|
21
|
-
/** Initial verification companion value. */
|
|
22
|
-
initialVerified?: TVerify | null;
|
|
23
|
-
};
|
|
24
|
-
type VerifiableBundle<T, TVerify = VerifyValue> = {
|
|
25
|
-
/** Coerced source node. */
|
|
26
|
-
node: Node<T>;
|
|
27
|
-
/** Latest verification result (`null` before first verification). */
|
|
28
|
-
verified: Node<TVerify | null>;
|
|
29
|
-
/** Effective trigger node used for verification, if any. */
|
|
30
|
-
trigger: Node<unknown> | null;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Composes a value node with a reactive verification companion.
|
|
34
|
-
*
|
|
35
|
-
* Uses `switchMap` so newer triggers cancel stale in-flight verification work.
|
|
36
|
-
*/
|
|
37
|
-
declare function verifiable<T, TVerify = VerifyValue>(source: NodeInput<T>, verifyFn: (value: T) => NodeInput<TVerify>, opts?: VerifiableOptions<TVerify>): VerifiableBundle<T, TVerify>;
|
|
38
|
-
type Extraction<TMem> = {
|
|
39
|
-
upsert: Array<{
|
|
40
|
-
key: string;
|
|
41
|
-
value: TMem;
|
|
42
|
-
}>;
|
|
43
|
-
remove?: string[];
|
|
44
|
-
};
|
|
45
|
-
type DistillOptions<TMem> = {
|
|
46
|
-
score: (mem: TMem, context: unknown) => number;
|
|
47
|
-
cost: (mem: TMem) => number;
|
|
48
|
-
budget?: number;
|
|
49
|
-
evict?: (key: string, mem: TMem) => boolean | Node<boolean>;
|
|
50
|
-
consolidate?: (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
|
|
51
|
-
consolidateTrigger?: NodeInput<unknown>;
|
|
52
|
-
context?: NodeInput<unknown>;
|
|
53
|
-
mapOptions?: ReactiveMapOptions<string, TMem>;
|
|
54
|
-
};
|
|
55
|
-
type DistillBundle<TMem> = {
|
|
56
|
-
store: ReactiveMapBundle<string, TMem>;
|
|
57
|
-
compact: Node<Array<{
|
|
58
|
-
key: string;
|
|
59
|
-
value: TMem;
|
|
60
|
-
score: number;
|
|
61
|
-
}>>;
|
|
62
|
-
size: Node<number>;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Budget-constrained reactive memory composition.
|
|
66
|
-
*
|
|
67
|
-
* **Tier 1.5.4 (Session A.5 lock, 2026-04-27):** `extractFn` receives the
|
|
68
|
-
* source and existing-store as `Node`s. Distill calls `extractFn` ONCE at
|
|
69
|
-
* wiring time and consumes the returned stream of extractions. The user
|
|
70
|
-
* controls reactive composition — wrap with `switchMap` for cancel-on-new-input,
|
|
71
|
-
* `mergeMap` for parallel, `derived` for sync transforms. See COMPOSITION-GUIDE
|
|
72
|
-
* §40 for the recipe.
|
|
73
|
-
*/
|
|
74
|
-
declare function distill<TRaw, TMem>(source: NodeInput<TRaw>, extractFn: (raw: Node<TRaw>, existing: Node<ReadonlyMap<string, TMem>>) => NodeInput<Extraction<TMem>>, opts: DistillOptions<TMem>): DistillBundle<TMem>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Pure exponential-decay utility (Tier 2.2 promotion from `patterns/memory/`).
|
|
78
|
-
*
|
|
79
|
-
* Used by `collection`, `agentMemory`, harness `strategy.ts`, and any
|
|
80
|
-
* downstream consumer that needs decay-with-floor scoring. Promoted to
|
|
81
|
-
* `extra/utils/` because the math has zero domain semantics and is reusable
|
|
82
|
-
* by non-memory primitives (e.g. routing weight decay, retry-attempt aging).
|
|
83
|
-
*
|
|
84
|
-
* @module
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* Default exponential-decay rate corresponding to a 7-day half-life.
|
|
88
|
-
*
|
|
89
|
-
* `Math.LN2 / (7 × 86_400)` ≈ `1.146e-6`. Imported by memory tiers + any
|
|
90
|
-
* consumer that wants the same default cadence as `agentMemory`'s active
|
|
91
|
-
* tier. Tier 4.4 (Wave AM Unit 1) — promoted from
|
|
92
|
-
* `patterns/ai/memory/tiers.ts` so non-memory consumers can share the
|
|
93
|
-
* canonical default without reaching across domains.
|
|
94
|
-
*/
|
|
95
|
-
declare const DEFAULT_DECAY_RATE: number;
|
|
96
|
-
/**
|
|
97
|
-
* Exponential decay with floor: `score = max(minScore, baseScore * exp(-ratePerSecond * ageSeconds))`.
|
|
98
|
-
*
|
|
99
|
-
* Tolerant fallbacks (deliberate for use inside reactive derived fns):
|
|
100
|
-
* - non-finite `baseScore` → `minScore`
|
|
101
|
-
* - non-positive `ageSeconds` (incl. clock skew) → `max(minScore, baseScore)` (no decay)
|
|
102
|
-
* - non-positive `ratePerSecond` → `max(minScore, baseScore)` (no decay; rate=0 disables)
|
|
103
|
-
*
|
|
104
|
-
* Underflow boundary: `Math.exp(-745) === 0`. For very long ages × rates the
|
|
105
|
-
* result clamps to `minScore`; if you need slow decay over years, choose a
|
|
106
|
-
* smaller `ratePerSecond` rather than relying on graceful underflow.
|
|
107
|
-
*
|
|
108
|
-
* Half-life conversion: `ratePerSecond = Math.LN2 / halfLifeSeconds`.
|
|
109
|
-
*/
|
|
110
|
-
declare function decay(baseScore: number, ageSeconds: number, ratePerSecond: number, minScore?: number): number;
|
|
111
|
-
|
|
112
|
-
export { type DistillBundle as D, type Extraction as E, type VerifiableBundle as V, type DistillOptions as a, type VerifiableOptions as b, type VerifyValue as c, decay as d, distill as e, DEFAULT_DECAY_RATE as f, verifiable as v };
|