@noy-db/hub 0.3.0-pre.10 → 0.3.0-pre.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregate/index.js +4 -4
- package/dist/api-3TH2GOFQ.js +20 -0
- package/dist/as/index.js +11 -11
- package/dist/attestation/index.js +18 -18
- package/dist/backup-2WVBIVXW.js +225 -0
- package/dist/blobs/index.js +10 -10
- package/dist/broker/index.js +92 -0
- package/dist/broker/index.js.map +1 -0
- package/dist/bundle/index.js +20 -20
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +30 -30
- package/dist/chunk-2MTRJCBI.js +75 -0
- package/dist/chunk-37WOJQWY.js +404 -0
- package/dist/chunk-3QSOFZQB.js +589 -0
- package/dist/chunk-44IL5G3W.js +99 -0
- package/dist/chunk-45QPICLE.js +69 -0
- package/dist/chunk-4BQXMCE5.js +164 -0
- package/dist/chunk-4GPE63GU.js +111 -0
- package/dist/chunk-4GPE63GU.js.map +1 -0
- package/dist/chunk-5HNX4OD4.js +30 -0
- package/dist/chunk-65VLRG3I.js +54 -0
- package/dist/chunk-6MA575R5.js +59 -0
- package/dist/chunk-6S7ENMRE.js +524 -0
- package/dist/chunk-6S7ENMRE.js.map +1 -0
- package/dist/chunk-7GAXFU2O.js +123 -0
- package/dist/chunk-7QLY64AD.js +202 -0
- package/dist/chunk-7ZOSHEVS.js +235 -0
- package/dist/chunk-AAIIDAUC.js +371 -0
- package/dist/chunk-AAIIDAUC.js.map +1 -0
- package/dist/chunk-AKEOHKMT.js +282 -0
- package/dist/chunk-AKEOHKMT.js.map +1 -0
- package/dist/chunk-APHLCXVC.js +124 -0
- package/dist/chunk-BDEMZD4F.js +129 -0
- package/dist/chunk-BDPAVYGJ.js +662 -0
- package/dist/chunk-BLUT46UP.js +42 -0
- package/dist/chunk-CCIR2OJH.js +778 -0
- package/dist/chunk-CXC3JLAQ.js +155 -0
- package/dist/chunk-CZMCOFEA.js +1221 -0
- package/dist/chunk-DIB2BOIH.js +164 -0
- package/dist/chunk-DJ7MRXNA.js +344 -0
- package/dist/chunk-DJ7MRXNA.js.map +1 -0
- package/dist/chunk-EHW5KTTA.js +150 -0
- package/dist/chunk-EHW5KTTA.js.map +1 -0
- package/dist/chunk-EIZ4YOG2.js +70 -0
- package/dist/chunk-EVHBK7BN.js +515 -0
- package/dist/chunk-EXGDL2UQ.js +74 -0
- package/dist/chunk-F3LGBRSV.js +453 -0
- package/dist/chunk-F44XWXOA.js +392 -0
- package/dist/chunk-FF7S3XDW.js +230 -0
- package/dist/chunk-FJTWLQV3.js +155 -0
- package/dist/chunk-FYNE4WLC.js +36 -0
- package/dist/chunk-FZCGIJEJ.js +1505 -0
- package/dist/chunk-FZCGIJEJ.js.map +1 -0
- package/dist/chunk-GL3JV5EV.js +130 -0
- package/dist/chunk-GXLZXD2W.js +29 -0
- package/dist/chunk-HA6ZQWA2.js +1056 -0
- package/dist/chunk-HA6ZQWA2.js.map +1 -0
- package/dist/chunk-HBBZWEC5.js +686 -0
- package/dist/chunk-HG76BZ6G.js +188 -0
- package/dist/chunk-HGAB325C.js +38 -0
- package/dist/chunk-HIOLCOK3.js +30 -0
- package/dist/chunk-HIOLCOK3.js.map +1 -0
- package/dist/chunk-HK4XTXO4.js +49 -0
- package/dist/chunk-HYG32HCM.js +14 -0
- package/dist/chunk-ILF5GARW.js +135 -0
- package/dist/chunk-INBQ43DI.js +382 -0
- package/dist/chunk-IQIVD7TP.js +247 -0
- package/dist/chunk-J3JIYFYL.js +45 -0
- package/dist/chunk-JC75UBMT.js +32 -0
- package/dist/chunk-JC75UBMT.js.map +1 -0
- package/dist/chunk-JGUZMC3I.js +150 -0
- package/dist/chunk-JRKE5MAZ.js +80 -0
- package/dist/chunk-K2DLLK34.js +255 -0
- package/dist/chunk-KKYEZCQG.js +34 -0
- package/dist/chunk-NAR6IDKH.js +54 -0
- package/dist/chunk-NEYKOESM.js +117 -0
- package/dist/chunk-NM3IFKBL.js +29 -0
- package/dist/chunk-NRYNRSGV.js +99 -0
- package/dist/chunk-NT2ZO4KI.js +59 -0
- package/dist/chunk-P2LJI6JE.js +94 -0
- package/dist/chunk-PH7G7ZI7.js +823 -0
- package/dist/chunk-PN5332SU.js +209 -0
- package/dist/chunk-QF5LGMSV.js +45 -0
- package/dist/chunk-QG5RQQBO.js +367 -0
- package/dist/chunk-QYPDYN23.js +23 -0
- package/dist/chunk-R3NHNVS5.js +478 -0
- package/dist/chunk-R3NHNVS5.js.map +1 -0
- package/dist/chunk-RNXJ2VO6.js +280 -0
- package/dist/chunk-RXTMLYJS.js +97 -0
- package/dist/chunk-S2OWPVSO.js +30 -0
- package/dist/chunk-S7TAPIRS.js +205 -0
- package/dist/chunk-SAL5X5OK.js +40 -0
- package/dist/chunk-SGJGWBSC.js +85 -0
- package/dist/chunk-SIAIYP6G.js +50 -0
- package/dist/chunk-SXPCZ6LL.js +1697 -0
- package/dist/chunk-SXPCZ6LL.js.map +1 -0
- package/dist/chunk-TBNF5DV5.js +261 -0
- package/dist/chunk-TVOHSPVK.js +21 -0
- package/dist/chunk-TVS6BUUR.js +41 -0
- package/dist/chunk-UMC5QZTX.js +86 -0
- package/dist/chunk-US34HTOI.js +367 -0
- package/dist/chunk-VCUQR6ZL.js +621 -0
- package/dist/chunk-VXZNSPJM.js +957 -0
- package/dist/chunk-VXZNSPJM.js.map +1 -0
- package/dist/chunk-WEHIQYQH.js +71 -0
- package/dist/chunk-WHQHTNT7.js +265 -0
- package/dist/chunk-X6Y5MXTH.js +74 -0
- package/dist/chunk-XJ47GS53.js +291 -0
- package/dist/chunk-XS6DLN67.js +95 -0
- package/dist/chunk-Y5TWPBNW.js +91 -0
- package/dist/chunk-YCXKFB7J.js +14181 -0
- package/dist/chunk-YCXKFB7J.js.map +1 -0
- package/dist/chunk-ZHOJOT6S.js +36 -0
- package/dist/chunk-ZL6PRULX.js +167 -0
- package/dist/chunk-ZL6PRULX.js.map +1 -0
- package/dist/classified/index.js +5 -5
- package/dist/classified-marker-M7K3OJPM.js +28 -0
- package/dist/classified-marker-M7K3OJPM.js.map +1 -0
- package/dist/collection-facade-DWA735G2.js +39 -0
- package/dist/computed-ORCGM5JE.js +11 -0
- package/dist/consent/index.js +9 -9
- package/dist/crdt/index.js +1 -1
- package/dist/dead-filter-OV5FGKOG.js +28 -0
- package/dist/delegation-YVSHMIZZ.js +25 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-BUO555L5.js +21 -0
- package/dist/enclave-XXFUKJC6.js +135 -0
- package/dist/executor-6OCCE5VM.js +25 -0
- package/dist/executor-JFVAJY42.js +9 -0
- package/dist/executor-UPSH5O3F.js +9 -0
- package/dist/export-accessible-L4A2QZA5.js +23 -0
- package/dist/extract-partition-ZHQ4RGGM.js +36 -0
- package/dist/fanout-sidecar-IO2KDUWV.js +74 -0
- package/dist/find-ZFZDZQ2U.js +11 -0
- package/dist/forget/index.js +10 -10
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.js +3 -3
- package/dist/history/index.js +11 -11
- package/dist/i18n/index.js +15 -15
- package/dist/index.d.ts +303 -1492
- package/dist/index.js +172 -171
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +5 -5
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-OG4V23SQ.js +19 -0
- package/dist/kernel/best-effort-revert.d.ts +52 -0
- package/dist/kernel/cache/index.d.ts +10 -0
- package/dist/kernel/cache/lru.d.ts +97 -0
- package/dist/kernel/cache/policy.d.ts +32 -0
- package/dist/kernel/collection-config.d.ts +789 -0
- package/dist/kernel/collection.d.ts +1519 -0
- package/dist/kernel/constants.d.ts +18 -0
- package/dist/kernel/debug.d.ts +25 -0
- package/dist/kernel/enclave/broker/proof.d.ts +154 -0
- package/dist/kernel/enclave/classify/bidx.d.ts +77 -0
- package/dist/kernel/enclave/classify/compare.d.ts +10 -0
- package/dist/kernel/enclave/classify/digest.d.ts +8 -0
- package/dist/kernel/enclave/classify/find.d.ts +36 -0
- package/dist/kernel/enclave/classify/kofn.d.ts +7 -0
- package/dist/kernel/enclave/classify/normalize.d.ts +7 -0
- package/dist/kernel/enclave/classify/reveal.d.ts +10 -0
- package/dist/kernel/enclave/classify/vdig.d.ts +39 -0
- package/dist/kernel/enclave/classify/verify.d.ts +33 -0
- package/dist/kernel/enclave/classify/write.d.ts +8 -0
- package/dist/kernel/enclave/crypto.d.ts +263 -0
- package/dist/kernel/enclave/index.d.ts +78 -0
- package/dist/kernel/enclave/record-keys/deterministic.d.ts +54 -0
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +79 -0
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +57 -0
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +301 -0
- package/dist/kernel/enclave/record-keys/sealed-slot.d.ts +14 -0
- package/dist/kernel/enclave/record-keys/sealed-slots.d.ts +123 -0
- package/dist/kernel/enclave/record-keys/sealing.d.ts +70 -0
- package/dist/kernel/enclave/record-keys/tombstone.d.ts +57 -0
- package/dist/kernel/env-check.d.ts +1 -0
- package/dist/kernel/errors.d.ts +1848 -0
- package/dist/kernel/events.d.ts +11 -0
- package/dist/kernel/memory-store.d.ts +17 -0
- package/dist/kernel/mutation.d.ts +14 -0
- package/dist/kernel/noydb.d.ts +826 -0
- package/dist/kernel/paths.d.ts +25 -0
- package/dist/kernel/query/builder.d.ts +520 -0
- package/dist/kernel/query/index.d.ts +31 -0
- package/dist/kernel/query/join.d.ts +205 -0
- package/dist/kernel/query/live.d.ts +111 -0
- package/dist/kernel/query/predicate.d.ts +139 -0
- package/dist/kernel/query/scan-builder.d.ts +334 -0
- package/dist/kernel/refs.d.ts +205 -0
- package/dist/kernel/schema.d.ts +134 -0
- package/dist/kernel/sync-policy.d.ts +188 -0
- package/dist/kernel/types.d.ts +3166 -0
- package/dist/kernel/util/discriminant.d.ts +58 -0
- package/dist/kernel/util/index.d.ts +14 -0
- package/dist/kernel/util/sanitize-filename.d.ts +75 -0
- package/dist/kernel/validation.d.ts +130 -0
- package/dist/kernel/vault.d.ts +1737 -0
- package/dist/kernel/via/compose.d.ts +144 -0
- package/dist/kernel/via/dispatch.d.ts +185 -0
- package/dist/kernel/via/graph-wiring.d.ts +145 -0
- package/dist/kernel/via/graph.d.ts +166 -0
- package/dist/kernel/via/index.d.ts +200 -0
- package/dist/kernel/via/pipeline.d.ts +266 -0
- package/dist/kernel/via/reconcile.d.ts +153 -0
- package/dist/kernel/via/taint-binding.d.ts +66 -0
- package/dist/kernel/write-queue.d.ts +46 -0
- package/dist/ledger-UAQKPWNM.js +42 -0
- package/dist/legacy/bundle.d.ts +30 -0
- package/dist/legacy/kernel.d.ts +33 -0
- package/dist/liberate-GFUQJRK5.js +24 -0
- package/dist/link-set-DGYUOFVD.js +31 -0
- package/dist/materialized-views/index.js +19 -19
- package/dist/noydb-AKH4AMCR.js +67 -0
- package/dist/on/index.js +9 -9
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +12 -12
- package/dist/pod/index.js +11 -11
- package/dist/policy-5POYLI26.js +41 -0
- package/dist/port/as/index.d.ts +26 -0
- package/dist/port/at/index.d.ts +18 -0
- package/dist/port/by/default-provider.d.ts +9 -0
- package/dist/port/by/index.d.ts +17 -0
- package/dist/port/by/types.d.ts +86 -0
- package/dist/port/in/index.d.ts +21 -0
- package/dist/port/on/index.d.ts +27 -0
- package/dist/port/to/index.d.ts +19 -0
- package/dist/port/ui/index.d.ts +21 -0
- package/dist/port/with/blob-strategy.d.ts +81 -0
- package/dist/port/with/broker-strategy.d.ts +84 -0
- package/dist/port/with/capabilities.d.ts +31 -0
- package/dist/port/with/classified-marker.d.ts +9 -0
- package/dist/port/with/classified-strategy.d.ts +62 -0
- package/dist/port/with/computed-strategy.d.ts +19 -0
- package/dist/port/with/i18n-strategy.d.ts +175 -0
- package/dist/port/with/index.d.ts +18 -0
- package/dist/port/with/lazy-strategy.d.ts +48 -0
- package/dist/port/with/lookup-strategy.d.ts +129 -0
- package/dist/port/with/service-bus.d.ts +156 -0
- package/dist/port/with/team-strategy.d.ts +36 -0
- package/dist/port/with/write-hooks.d.ts +34 -0
- package/dist/portability/index.js +8 -8
- package/dist/post-register-LB3P4XQU.js +60 -0
- package/dist/post-register-LB3P4XQU.js.map +1 -0
- package/dist/public-envelope-GOG4LUM7.js +32 -0
- package/dist/purge-scope-FGNNLWHD.js +24 -0
- package/dist/purge-scope-FGNNLWHD.js.map +1 -0
- package/dist/query/index.js +5 -5
- package/dist/register-ZI7YI7US.js +23 -0
- package/dist/registry-DZ2T4LL7.js +9 -0
- package/dist/registry-NVWEQ2GU.js +18 -0
- package/dist/registry-SEKL74ET.js +19 -0
- package/dist/request-withdrawal-ZP3JIRVS.js +31 -0
- package/dist/reveal-NPVROV4D.js +38 -0
- package/dist/revoke-VF6TAJK2.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/seed-VI4FU7UH.js +231 -0
- package/dist/seed-VI4FU7UH.js.map +1 -0
- package/dist/session/index.js +9 -9
- package/dist/shadow/index.js +2 -2
- package/dist/signer-DRDDCCHW.js +25 -0
- package/dist/snapshots/index.js +10 -10
- package/dist/stale-TJXFQKOJ.js +14 -0
- package/dist/storage-GR7KZRH4.js +23 -0
- package/dist/store-coordination-provider-5KDS2RRP.js +142 -0
- package/dist/sync/index.js +9 -9
- package/dist/team/index.js +15 -15
- package/dist/tiers/index.js +10 -10
- package/dist/to/index.js +1 -1
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/verify-QK76NJ4G.js +139 -0
- package/dist/via/blob/active.d.ts +34 -0
- package/dist/via/blob/binding.d.ts +86 -0
- package/dist/via/blob/index.d.ts +34 -0
- package/dist/via/classified/active.d.ts +3 -0
- package/dist/via/classified/binding.d.ts +83 -0
- package/dist/via/classified/config-drift.d.ts +34 -0
- package/dist/via/classified/descriptor.d.ts +66 -0
- package/dist/via/classified/errors.d.ts +19 -0
- package/dist/via/classified/guards.d.ts +23 -0
- package/dist/via/classified/index.d.ts +11 -0
- package/dist/via/classified/presets.d.ts +65 -0
- package/dist/via/classified/resolve.d.ts +9 -0
- package/dist/via/classified/strategy.d.ts +11 -0
- package/dist/via/classified/validators.d.ts +3 -0
- package/dist/via/classified/write.d.ts +4 -0
- package/dist/via/computed/binding.d.ts +34 -0
- package/dist/via/computed/descriptor.d.ts +35 -0
- package/dist/via/i18n/active.d.ts +28 -0
- package/dist/via/i18n/binding.d.ts +36 -0
- package/dist/via/i18n/core.d.ts +267 -0
- package/dist/via/i18n/densify.d.ts +24 -0
- package/dist/via/i18n/dictionary.d.ts +200 -0
- package/dist/via/i18n/index.d.ts +21 -0
- package/dist/via/i18n/policy.d.ts +44 -0
- package/dist/via/i18n/script.d.ts +26 -0
- package/dist/via/i18n/strategy.d.ts +13 -0
- package/dist/via/lookup/active.d.ts +19 -0
- package/dist/via/lookup/binding.d.ts +99 -0
- package/dist/via/lookup/descriptor.d.ts +123 -0
- package/dist/via/lookup/handle.d.ts +220 -0
- package/dist/via/lookup/index.d.ts +17 -0
- package/dist/via/lookup/registry.d.ts +228 -0
- package/dist/via/lookup/snapshot.d.ts +67 -0
- package/dist/via/money/arith.d.ts +68 -0
- package/dist/via/money/binding.d.ts +21 -0
- package/dist/via/money/branded.d.ts +61 -0
- package/dist/via/money/descriptor.d.ts +73 -0
- package/dist/via/money/fixed-point.d.ts +51 -0
- package/dist/via/money/index.d.ts +15 -0
- package/dist/via/money/iso4217.d.ts +6 -0
- package/dist/via/money/money-reducer.d.ts +33 -0
- package/dist/via/money/normalize.d.ts +105 -0
- package/dist/via/money/paths.d.ts +61 -0
- package/dist/via/money/where.d.ts +127 -0
- package/dist/walk-XQCBKSBW.js +241 -0
- package/dist/with/index.js +11 -11
- package/dist/with-audit/attestation/active.d.ts +10 -0
- package/dist/with-audit/attestation/index.d.ts +16 -0
- package/dist/with-audit/attestation/issue.d.ts +29 -0
- package/dist/with-audit/attestation/revoke.d.ts +15 -0
- package/dist/with-audit/attestation/signer.d.ts +33 -0
- package/dist/with-audit/attestation/strategy.d.ts +44 -0
- package/dist/with-audit/attestation/vault-facade.d.ts +62 -0
- package/dist/with-audit/consent/active.d.ts +14 -0
- package/dist/with-audit/consent/consent.d.ts +114 -0
- package/dist/with-audit/consent/index.d.ts +14 -0
- package/dist/with-audit/consent/strategy.d.ts +36 -0
- package/dist/with-audit/forget/active.d.ts +31 -0
- package/dist/with-audit/forget/index.d.ts +28 -0
- package/dist/with-audit/forget/purge-scope.d.ts +54 -0
- package/dist/with-audit/forget/strategy.d.ts +177 -0
- package/dist/with-audit/forget/subject-index.d.ts +83 -0
- package/dist/with-audit/guards/executor.d.ts +26 -0
- package/dist/with-audit/guards/immutable-guard.d.ts +63 -0
- package/dist/with-audit/guards/index.d.ts +10 -0
- package/dist/with-audit/guards/read-only-facade.d.ts +31 -0
- package/dist/with-audit/guards/registry.d.ts +83 -0
- package/dist/with-audit/guards/transition-guard.d.ts +82 -0
- package/dist/with-audit/guards/types.d.ts +134 -0
- package/dist/with-audit/guards/with-guard.d.ts +15 -0
- package/dist/with-audit/periods/active.d.ts +11 -0
- package/dist/with-audit/periods/index.d.ts +18 -0
- package/dist/with-audit/periods/periods.d.ts +417 -0
- package/dist/with-audit/periods/strategy.d.ts +32 -0
- package/dist/with-audit/periods/vault-facade.d.ts +95 -0
- package/dist/with-audit/portability/active.d.ts +11 -0
- package/dist/with-audit/portability/export-accessible.d.ts +46 -0
- package/dist/with-audit/portability/index.d.ts +18 -0
- package/dist/with-audit/portability/request-withdrawal.d.ts +85 -0
- package/dist/with-audit/portability/strategy.d.ts +31 -0
- package/dist/with-audit/portability/withdraw-accessible.d.ts +82 -0
- package/dist/with-audit/sealed-record/active.d.ts +9 -0
- package/dist/with-audit/sealed-record/index.d.ts +55 -0
- package/dist/with-audit/sealed-record/strategy.d.ts +34 -0
- package/dist/with-audit/sealed-record/types.d.ts +27 -0
- package/dist/with-audit/tiers/active.d.ts +9 -0
- package/dist/with-audit/tiers/index.d.ts +122 -0
- package/dist/with-audit/tiers/strategy.d.ts +35 -0
- package/dist/with-cargo/active.d.ts +11 -0
- package/dist/with-cargo/adopt-partition.d.ts +81 -0
- package/dist/with-cargo/decrypt-partition.d.ts +19 -0
- package/dist/with-cargo/describe-extraction.d.ts +33 -0
- package/dist/with-cargo/extract-partition.d.ts +147 -0
- package/dist/with-cargo/index.d.ts +33 -0
- package/dist/with-cargo/strategy.d.ts +30 -0
- package/dist/with-cargo/vault-diff.d.ts +144 -0
- package/dist/with-cargo/walk-closure.d.ts +38 -0
- package/dist/with-commit/crdt/active.d.ts +25 -0
- package/dist/with-commit/crdt/crdt.d.ts +42 -0
- package/dist/with-commit/crdt/index.d.ts +16 -0
- package/dist/with-commit/crdt/strategy.d.ts +25 -0
- package/dist/with-commit/history/active.d.ts +40 -0
- package/dist/with-commit/history/diff.d.ts +23 -0
- package/dist/with-commit/history/history.d.ts +27 -0
- package/dist/with-commit/history/index.d.ts +30 -0
- package/dist/with-commit/history/ledger/constants.d.ts +37 -0
- package/dist/with-commit/history/ledger/entry.d.ts +195 -0
- package/dist/with-commit/history/ledger/hash.d.ts +30 -0
- package/dist/with-commit/history/ledger/index.d.ts +19 -0
- package/dist/with-commit/history/ledger/patch.d.ts +99 -0
- package/dist/with-commit/history/ledger/store.d.ts +335 -0
- package/dist/with-commit/history/strategy.d.ts +126 -0
- package/dist/with-commit/history/time-machine.d.ts +179 -0
- package/dist/with-commit/numbering/descriptor.d.ts +27 -0
- package/dist/with-commit/numbering/index.d.ts +69 -0
- package/dist/with-commit/sequence/active.d.ts +10 -0
- package/dist/with-commit/sequence/index.d.ts +150 -0
- package/dist/with-commit/sequence/strategy.d.ts +26 -0
- package/dist/with-commit/tx/active.d.ts +27 -0
- package/dist/with-commit/tx/dry-run.d.ts +29 -0
- package/dist/with-commit/tx/elevated-handle.d.ts +58 -0
- package/dist/with-commit/tx/index.d.ts +13 -0
- package/dist/with-commit/tx/invariants.d.ts +68 -0
- package/dist/with-commit/tx/strategy.d.ts +23 -0
- package/dist/with-commit/tx/transaction.d.ts +212 -0
- package/dist/with-fork/archive/engine.d.ts +71 -0
- package/dist/with-fork/archive/index.d.ts +23 -0
- package/dist/with-fork/shadow/active.d.ts +6 -0
- package/dist/with-fork/shadow/index.d.ts +14 -0
- package/dist/with-fork/shadow/strategy.d.ts +28 -0
- package/dist/with-fork/shadow/vault-frame.d.ts +93 -0
- package/dist/with-fork/snapshots/active.d.ts +20 -0
- package/dist/with-fork/snapshots/engine.d.ts +36 -0
- package/dist/with-fork/snapshots/index.d.ts +5 -0
- package/dist/with-fork/snapshots/noydb-facade.d.ts +64 -0
- package/dist/with-fork/snapshots/policy.d.ts +23 -0
- package/dist/with-fork/snapshots/scheduler.d.ts +34 -0
- package/dist/with-fork/snapshots/strategy.d.ts +48 -0
- package/dist/with-formula/computed/index.d.ts +48 -0
- package/dist/with-formula/computed/lazy.d.ts +13 -0
- package/dist/with-formula/derivations/executor.d.ts +61 -0
- package/dist/with-formula/derivations/fanout-sidecar.d.ts +75 -0
- package/dist/with-formula/derivations/index.d.ts +6 -0
- package/dist/with-formula/derivations/registry.d.ts +67 -0
- package/dist/with-formula/derivations/stale.d.ts +39 -0
- package/dist/with-formula/derivations/strategy-hash.d.ts +1 -0
- package/dist/with-formula/derivations/types.d.ts +248 -0
- package/dist/with-formula/derivations/with-derivation.d.ts +10 -0
- package/dist/with-formula/derivations/with-rollup.d.ts +34 -0
- package/dist/with-formula/materialized-views/dependency-analyzer.d.ts +58 -0
- package/dist/with-formula/materialized-views/executor.d.ts +71 -0
- package/dist/with-formula/materialized-views/index.d.ts +11 -0
- package/dist/with-formula/materialized-views/query-hash.d.ts +23 -0
- package/dist/with-formula/materialized-views/registry.d.ts +99 -0
- package/dist/with-formula/materialized-views/stale.d.ts +62 -0
- package/dist/with-formula/materialized-views/types.d.ts +318 -0
- package/dist/with-formula/materialized-views/with-materialized-view.d.ts +24 -0
- package/dist/with-formula/overlay-views/index.d.ts +5 -0
- package/dist/with-formula/overlay-views/registry.d.ts +42 -0
- package/dist/with-formula/overlay-views/types.d.ts +97 -0
- package/dist/with-formula/overlay-views/virtual-collection.d.ts +90 -0
- package/dist/with-formula/overlay-views/with-overlayed-view.d.ts +9 -0
- package/dist/with-lookup/aggregate/active.d.ts +33 -0
- package/dist/with-lookup/aggregate/aggregation.d.ts +166 -0
- package/dist/with-lookup/aggregate/canonical-key.d.ts +16 -0
- package/dist/with-lookup/aggregate/groupby.d.ts +280 -0
- package/dist/with-lookup/aggregate/index.d.ts +23 -0
- package/dist/with-lookup/aggregate/reducers.d.ts +257 -0
- package/dist/with-lookup/aggregate/strategy.d.ts +59 -0
- package/dist/with-lookup/embeddings/cosine.d.ts +2 -0
- package/dist/with-lookup/embeddings/descriptor.d.ts +8 -0
- package/dist/with-lookup/embeddings/index.d.ts +3 -0
- package/dist/with-lookup/embeddings/vector-set.d.ts +19 -0
- package/dist/with-lookup/indexing/active.d.ts +30 -0
- package/dist/with-lookup/indexing/collection-facade.d.ts +120 -0
- package/dist/with-lookup/indexing/eager-indexes.d.ts +122 -0
- package/dist/with-lookup/indexing/index.d.ts +27 -0
- package/dist/with-lookup/indexing/lazy-builder.d.ts +102 -0
- package/dist/with-lookup/indexing/persisted-indexes.d.ts +229 -0
- package/dist/with-lookup/indexing/strategy.d.ts +56 -0
- package/dist/with-lookup/indexing/unique-constraints.d.ts +74 -0
- package/dist/with-lookup/search/active.d.ts +10 -0
- package/dist/with-lookup/search/build-docs.d.ts +15 -0
- package/dist/with-lookup/search/collection-facade.d.ts +123 -0
- package/dist/with-lookup/search/fuse.d.ts +22 -0
- package/dist/with-lookup/search/index-store.d.ts +19 -0
- package/dist/with-lookup/search/index.d.ts +19 -0
- package/dist/with-lookup/search/inverted-index.d.ts +47 -0
- package/dist/with-lookup/search/persisted-index-store.d.ts +41 -0
- package/dist/with-lookup/search/retrieve-types.d.ts +29 -0
- package/dist/with-lookup/search/scan.d.ts +28 -0
- package/dist/with-lookup/search/segment.d.ts +15 -0
- package/dist/with-lookup/search/serialize.d.ts +4 -0
- package/dist/with-lookup/search/snippet.d.ts +5 -0
- package/dist/with-lookup/search/strategy.d.ts +37 -0
- package/dist/with-lookup/search/tokenize.d.ts +12 -0
- package/dist/with-party/auth-introspection/index.d.ts +44 -0
- package/dist/with-party/broker/active.d.ts +23 -0
- package/dist/with-party/broker/index.d.ts +28 -0
- package/dist/with-party/broker/seed.d.ts +77 -0
- package/dist/with-party/custody/active.d.ts +10 -0
- package/dist/with-party/custody/index.d.ts +69 -0
- package/dist/with-party/custody/liberate.d.ts +64 -0
- package/dist/with-party/custody/strategy.d.ts +48 -0
- package/dist/with-party/directory/index.d.ts +11 -0
- package/dist/with-party/directory/public-envelope/index.d.ts +12 -0
- package/dist/with-party/directory/public-envelope/schema.d.ts +24 -0
- package/dist/with-party/directory/public-envelope/storage.d.ts +59 -0
- package/dist/with-party/directory/public-envelope/types.d.ts +80 -0
- package/dist/with-party/directory/storage.d.ts +33 -0
- package/dist/with-party/directory/types.d.ts +43 -0
- package/dist/with-party/directory/user-envelope/api.d.ts +201 -0
- package/dist/with-party/directory/user-envelope/index.d.ts +12 -0
- package/dist/with-party/directory/user-envelope/storage.d.ts +54 -0
- package/dist/with-party/directory/visibility.d.ts +47 -0
- package/dist/with-party/policy/engine.d.ts +60 -0
- package/dist/with-party/policy/index.d.ts +15 -0
- package/dist/with-party/policy/noydb-facade.d.ts +39 -0
- package/dist/with-party/policy/presets.d.ts +38 -0
- package/dist/with-party/policy/storage.d.ts +31 -0
- package/dist/with-party/session/active.d.ts +34 -0
- package/dist/with-party/session/dev-unlock.d.ts +128 -0
- package/dist/with-party/session/index.d.ts +23 -0
- package/dist/with-party/session/session-policy.d.ts +92 -0
- package/dist/with-party/session/session.d.ts +131 -0
- package/dist/with-party/session/strategy.d.ts +42 -0
- package/dist/with-party/session/unlock-state.d.ts +47 -0
- package/dist/with-party/sync/index.d.ts +31 -0
- package/dist/with-party/tab-coordination.d.ts +73 -0
- package/dist/with-party/tab-write-relay.d.ts +39 -0
- package/dist/with-party/team/active.d.ts +13 -0
- package/dist/with-party/team/authenticators.d.ts +95 -0
- package/dist/with-party/team/deed.d.ts +97 -0
- package/dist/with-party/team/delegation.d.ts +88 -0
- package/dist/with-party/team/index.d.ts +38 -0
- package/dist/with-party/team/keyring.d.ts +318 -0
- package/dist/with-party/team/magic-link-grant.d.ts +152 -0
- package/dist/with-party/team/managed-passphrase.d.ts +280 -0
- package/dist/with-party/team/noydb-facade.d.ts +484 -0
- package/dist/with-party/team/peer-recover.d.ts +81 -0
- package/dist/with-party/team/presence.d.ts +81 -0
- package/dist/with-party/team/recovery.d.ts +191 -0
- package/dist/with-party/team/reserved-secret-collections.d.ts +41 -0
- package/dist/with-party/team/rotate-recover.d.ts +275 -0
- package/dist/with-party/team/shamir-recovery-provider.d.ts +15 -0
- package/dist/with-party/team/strategy.d.ts +9 -0
- package/dist/with-party/team/sync-active.d.ts +33 -0
- package/dist/with-party/team/sync-credentials.d.ts +113 -0
- package/dist/with-party/team/sync-strategy.d.ts +67 -0
- package/dist/with-party/team/sync-transaction.d.ts +39 -0
- package/dist/with-party/team/sync.d.ts +174 -0
- package/dist/with-party/team/tiers.d.ts +39 -0
- package/dist/with-party/team/wrapped-deks.d.ts +86 -0
- package/dist/with-pod/backup.d.ts +74 -0
- package/dist/with-pod/bundle.d.ts +414 -0
- package/dist/with-pod/format.d.ts +203 -0
- package/dist/with-pod/index.d.ts +20 -0
- package/dist/with-pod/pod-store.d.ts +54 -0
- package/dist/with-pod/ulid.d.ts +64 -0
- package/dist/with-shape/blobs/blob-compaction.d.ts +170 -0
- package/dist/with-shape/blobs/blob-set.d.ts +342 -0
- package/dist/with-shape/blobs/export-blobs.d.ts +110 -0
- package/dist/with-shape/blobs/import-external.d.ts +50 -0
- package/dist/with-shape/blobs/mime-magic.d.ts +48 -0
- package/dist/with-shape/blobs/object-projection.d.ts +70 -0
- package/dist/with-shape/introspection/describe.d.ts +237 -0
- package/dist/with-shape/introspection/field-meta.d.ts +61 -0
- package/dist/with-shape/introspection/fields.d.ts +14 -0
- package/dist/with-shape/introspection/index.d.ts +12 -0
- package/dist/with-shape/introspection/json-schema.d.ts +13 -0
- package/dist/with-shape/introspection/meta.d.ts +22 -0
- package/dist/with-shape/introspection/projection.d.ts +13 -0
- package/dist/with-shape/introspection/types.d.ts +154 -0
- package/dist/with-shape/introspection/walk.d.ts +50 -0
- package/dist/with-shape/links/lazy-handle.d.ts +36 -0
- package/dist/with-shape/links/link-set.d.ts +67 -0
- package/dist/with-shape/links/names.d.ts +65 -0
- package/dist/with-shape/links/vault-facade.d.ts +211 -0
- package/dist/with-shape/persisted-schemas/canonicalize.d.ts +11 -0
- package/dist/with-shape/persisted-schemas/derive.d.ts +29 -0
- package/dist/with-shape/persisted-schemas/index.d.ts +21 -0
- package/dist/with-shape/persisted-schemas/register.d.ts +66 -0
- package/dist/with-shape/persisted-schemas/storage.d.ts +61 -0
- package/dist/with-shape/persisted-schemas/types.d.ts +54 -0
- package/dist/with-shape/satellites/dead-filter.d.ts +21 -0
- package/dist/with-shape/satellites/declare.d.ts +60 -0
- package/dist/with-shape/satellites/existence.d.ts +5 -0
- package/dist/with-shape/satellites/fanout.d.ts +38 -0
- package/dist/with-shape/satellites/forget.d.ts +47 -0
- package/dist/with-shape/satellites/index.d.ts +3 -0
- package/dist/with-shape/satellites/joined.d.ts +19 -0
- package/dist/with-shape/satellites/marker.d.ts +10 -0
- package/dist/with-shape/satellites/migrate-cek.d.ts +26 -0
- package/dist/with-shape/satellites/post-register.d.ts +6 -0
- package/dist/with-shape/satellites/proxy.d.ts +37 -0
- package/dist/with-shape/satellites/raw-target.d.ts +14 -0
- package/dist/with-shape/satellites/registry.d.ts +19 -0
- package/dist/with-shape/satellites/types.d.ts +37 -0
- package/dist/with-shape/satellites/validate.d.ts +17 -0
- package/dist/with-shape/schema-update/client-registry.d.ts +35 -0
- package/dist/with-shape/schema-update/cutover.d.ts +5 -0
- package/dist/with-shape/schema-update/delta.d.ts +2 -0
- package/dist/with-shape/schema-update/dispatch.d.ts +3 -0
- package/dist/with-shape/schema-update/fence-controller.d.ts +62 -0
- package/dist/with-shape/schema-update/fence-watcher.d.ts +37 -0
- package/dist/with-shape/schema-update/fence.d.ts +15 -0
- package/dist/with-shape/schema-update/gate.d.ts +16 -0
- package/dist/with-shape/schema-update/index.d.ts +6 -0
- package/dist/with-shape/schema-update/store-coordination-provider.d.ts +29 -0
- package/dist/with-shape/schema-update/strategies.d.ts +12 -0
- package/dist/with-shape/schema-update/types.d.ts +53 -0
- package/dist/with-store/index.d.ts +15 -0
- package/dist/with-store/lazy/active.d.ts +12 -0
- package/dist/with-store/lazy/index.d.ts +14 -0
- package/dist/with-store/lazy/strategy.d.ts +9 -0
- package/dist/with-store/route-store.d.ts +259 -0
- package/dist/with-store/store-middleware.d.ts +189 -0
- package/dist/withdraw-accessible-FMN4LPJZ.js +28 -0
- package/package.json +47 -43
- package/dist/aggregate/index.d.ts +0 -41
- package/dist/api-TX2EX2FX.js +0 -20
- package/dist/as/index.d.ts +0 -6
- package/dist/at/index.d.ts +0 -4
- package/dist/attestation/index.d.ts +0 -19
- package/dist/backup-R7NTDFKY.js +0 -225
- package/dist/blobs/index.d.ts +0 -43
- package/dist/bundle/index.d.ts +0 -121
- package/dist/bundle-D6GxiUfq.d.ts +0 -548
- package/dist/by/index.d.ts +0 -1
- package/dist/cargo/index.d.ts +0 -7
- package/dist/chunk-2OV5NVE7.js +0 -95
- package/dist/chunk-2OZXVKVP.js +0 -367
- package/dist/chunk-2REPHKET.js +0 -54
- package/dist/chunk-3JXPAHOZ.js +0 -686
- package/dist/chunk-3MATJ6O4.js +0 -367
- package/dist/chunk-3OPY6MK2.js +0 -404
- package/dist/chunk-3QSIU3UT.js +0 -291
- package/dist/chunk-4OMCIY6F.js +0 -99
- package/dist/chunk-5I35DOHK.js +0 -94
- package/dist/chunk-5VG4IJR7.js +0 -235
- package/dist/chunk-5YESYH2C.js +0 -155
- package/dist/chunk-6G5ORS5D.js +0 -202
- package/dist/chunk-6P5XCKSD.js +0 -71
- package/dist/chunk-6S7T6WC4.js +0 -111
- package/dist/chunk-6S7T6WC4.js.map +0 -1
- package/dist/chunk-7BWJHO2A.js +0 -34
- package/dist/chunk-7P2SDJG3.js +0 -279
- package/dist/chunk-7P2SDJG3.js.map +0 -1
- package/dist/chunk-ANB77BVV.js +0 -150
- package/dist/chunk-ANB77BVV.js.map +0 -1
- package/dist/chunk-BKARNZJN.js +0 -382
- package/dist/chunk-BQISD5ZV.js +0 -261
- package/dist/chunk-BUAQ7YI3.js +0 -1697
- package/dist/chunk-BUAQ7YI3.js.map +0 -1
- package/dist/chunk-CB7CWSKW.js +0 -430
- package/dist/chunk-CB7CWSKW.js.map +0 -1
- package/dist/chunk-DFVUTGT2.js +0 -515
- package/dist/chunk-DJ7KIPLV.js +0 -23
- package/dist/chunk-DSKDQP3G.js +0 -14066
- package/dist/chunk-DSKDQP3G.js.map +0 -1
- package/dist/chunk-DV4HUP5G.js +0 -99
- package/dist/chunk-EOXAAJTY.js +0 -621
- package/dist/chunk-ET67AY6B.js +0 -74
- package/dist/chunk-F4CEK5YM.js +0 -123
- package/dist/chunk-FORYWFN6.js +0 -130
- package/dist/chunk-FRP6D2DM.js +0 -91
- package/dist/chunk-FUOE7UUV.js +0 -341
- package/dist/chunk-FUOE7UUV.js.map +0 -1
- package/dist/chunk-G4JYND6L.js +0 -42
- package/dist/chunk-G6XV4H65.js +0 -59
- package/dist/chunk-GNMXXTMN.js +0 -85
- package/dist/chunk-HPWKV3YB.js +0 -21
- package/dist/chunk-HY3AUMFI.js +0 -41
- package/dist/chunk-HYR4WZZ3.js +0 -69
- package/dist/chunk-ICXIFFYZ.js +0 -355
- package/dist/chunk-ICXIFFYZ.js.map +0 -1
- package/dist/chunk-IVLTXX4W.js +0 -280
- package/dist/chunk-J4LPNIGK.js +0 -777
- package/dist/chunk-JJZ2LW6T.js +0 -36
- package/dist/chunk-KJ2BCBTL.js +0 -589
- package/dist/chunk-KNZB6JMR.js +0 -129
- package/dist/chunk-LEJIKBBB.js +0 -124
- package/dist/chunk-LL2NIVUR.js +0 -188
- package/dist/chunk-MCHVVJIA.js +0 -968
- package/dist/chunk-MCHVVJIA.js.map +0 -1
- package/dist/chunk-NUEQU36L.js +0 -392
- package/dist/chunk-O45M6LDB.js +0 -38
- package/dist/chunk-OBKWYKYC.js +0 -117
- package/dist/chunk-OHHKHSJP.js +0 -209
- package/dist/chunk-OT76OZL6.js +0 -45
- package/dist/chunk-OVYRLHPE.js +0 -150
- package/dist/chunk-OXCSVM3B.js +0 -155
- package/dist/chunk-P33LUIML.js +0 -205
- package/dist/chunk-PLS64NCS.js +0 -59
- package/dist/chunk-PS2NEWEX.js +0 -36
- package/dist/chunk-QA2KUPCP.js +0 -45
- package/dist/chunk-QOC3VYL2.js +0 -30
- package/dist/chunk-QSFOZUYL.js +0 -823
- package/dist/chunk-RHK32N73.js +0 -30
- package/dist/chunk-RW3Y22MW.js +0 -97
- package/dist/chunk-S7VFUQM2.js +0 -1484
- package/dist/chunk-S7VFUQM2.js.map +0 -1
- package/dist/chunk-T7WSLRAU.js +0 -49
- package/dist/chunk-TAKWLZZX.js +0 -944
- package/dist/chunk-TAKWLZZX.js.map +0 -1
- package/dist/chunk-TMBXVJKT.js +0 -75
- package/dist/chunk-TWKKOM55.js +0 -54
- package/dist/chunk-U3WZCU7E.js +0 -14
- package/dist/chunk-UF362QVH.js +0 -70
- package/dist/chunk-UN4FVIBH.js +0 -135
- package/dist/chunk-VEAVKDDB.js +0 -29
- package/dist/chunk-VEPTFUJY.js +0 -29
- package/dist/chunk-VJV7GKQK.js +0 -662
- package/dist/chunk-VQRAIPYF.js +0 -50
- package/dist/chunk-VRIYFLBA.js +0 -74
- package/dist/chunk-VWM3DAVB.js +0 -265
- package/dist/chunk-VWRRVE6D.js +0 -80
- package/dist/chunk-WBJIQSLL.js +0 -167
- package/dist/chunk-WBJIQSLL.js.map +0 -1
- package/dist/chunk-WIGQB62E.js +0 -164
- package/dist/chunk-WZSCE6RM.js +0 -466
- package/dist/chunk-WZSCE6RM.js.map +0 -1
- package/dist/chunk-XGDAPN6M.js +0 -255
- package/dist/chunk-XH7XP3OL.js +0 -1221
- package/dist/chunk-XREOISSI.js +0 -40
- package/dist/chunk-XUBPSPKD.js +0 -164
- package/dist/chunk-Y3A5CB5G.js +0 -247
- package/dist/chunk-YCXCR7VG.js +0 -230
- package/dist/chunk-YMVQD5Q5.js +0 -453
- package/dist/chunk-YN5IAHN6.js +0 -32
- package/dist/chunk-YN5IAHN6.js.map +0 -1
- package/dist/chunk-ZYJ55N7N.js +0 -86
- package/dist/classified/index.d.ts +0 -16
- package/dist/classified-marker-H6YSHYNK.js +0 -24
- package/dist/classified-marker-H6YSHYNK.js.map +0 -1
- package/dist/collection-facade-LVD22JLM.js +0 -39
- package/dist/computed-EXDMQODG.js +0 -11
- package/dist/consent/index.d.ts +0 -22
- package/dist/crdt/index.d.ts +0 -33
- package/dist/dead-filter-HQIE2YG7.js +0 -28
- package/dist/decrypt-partition-IHtxEnTi.d.ts +0 -21
- package/dist/delegation-BJP73GAP.js +0 -25
- package/dist/derivations/index.d.ts +0 -69
- package/dist/derive-BME7HDWO.js +0 -21
- package/dist/dev-unlock-Bmm2pgJ0.d.ts +0 -263
- package/dist/discriminant-BN9REW3o.d.ts +0 -60
- package/dist/enclave-NHORSWSF.js +0 -125
- package/dist/executor-FE6X4LFX.js +0 -9
- package/dist/executor-KSHKRJXP.js +0 -25
- package/dist/executor-ZHTJJICG.js +0 -9
- package/dist/export-accessible-DACHM5VT.js +0 -23
- package/dist/extract-partition-RNENZZ4T.js +0 -36
- package/dist/fanout-sidecar-OFWN3NM7.js +0 -74
- package/dist/find-BNGBJNKP.js +0 -11
- package/dist/forget/index.d.ts +0 -36
- package/dist/guards/index.d.ts +0 -34
- package/dist/hash-DAJjMsCE.d.ts +0 -72
- package/dist/history/index.d.ts +0 -60
- package/dist/i18n/index.d.ts +0 -56
- package/dist/in/index.d.ts +0 -4
- package/dist/index-B9QdHytu.d.ts +0 -123
- package/dist/index-DjWbxsjb.d.ts +0 -23579
- package/dist/index-qwuNvO2B.d.ts +0 -144
- package/dist/indexing/index.d.ts +0 -38
- package/dist/issue-NDI4CVZU.js +0 -19
- package/dist/lazy/index.d.ts +0 -20
- package/dist/ledger-6NDS2EO4.js +0 -42
- package/dist/liberate-HN3RIGIP.js +0 -24
- package/dist/link-set-SJB2MVJV.js +0 -31
- package/dist/materialized-views/index.d.ts +0 -189
- package/dist/mime-magic-bBj5OgUC.d.ts +0 -103
- package/dist/noydb-BWF6EPIR.js +0 -66
- package/dist/on/index.d.ts +0 -4
- package/dist/overlay-views/index.d.ts +0 -97
- package/dist/periods/index.d.ts +0 -19
- package/dist/pod/index.d.ts +0 -62
- package/dist/policy-WGNAG5H6.js +0 -41
- package/dist/portability/index.d.ts +0 -19
- package/dist/post-register-CWKBQRC7.js +0 -55
- package/dist/post-register-CWKBQRC7.js.map +0 -1
- package/dist/public-envelope-EJLVIFX7.js +0 -32
- package/dist/query/index.d.ts +0 -4
- package/dist/register-SBIX7TVV.js +0 -23
- package/dist/registry-3EQG6OOE.js +0 -18
- package/dist/registry-CA327ACV.js +0 -9
- package/dist/registry-E7OXOTSV.js +0 -19
- package/dist/request-withdrawal-KAH2AAXC.js +0 -31
- package/dist/reveal-R3JLHMUF.js +0 -38
- package/dist/revoke-IXLOJ3IH.js +0 -24
- package/dist/satellites/index.d.ts +0 -4
- package/dist/sealed-record/index.d.ts +0 -68
- package/dist/session/index.d.ts +0 -43
- package/dist/shadow/index.d.ts +0 -14
- package/dist/signer-Y46N2GJ3.js +0 -25
- package/dist/snapshots/index.d.ts +0 -25
- package/dist/stale-Z7IW6RIL.js +0 -14
- package/dist/storage-ADNP2UWI.js +0 -23
- package/dist/store-coordination-provider-DTDMI6VL.js +0 -142
- package/dist/subject-index-CyOgGMJL.d.ts +0 -380
- package/dist/sync/index.d.ts +0 -40
- package/dist/team/index.d.ts +0 -154
- package/dist/tiers/index.d.ts +0 -4
- package/dist/to/index.d.ts +0 -4
- package/dist/transition-guard-DI-krBsZ.d.ts +0 -165
- package/dist/tx/index.d.ts +0 -34
- package/dist/ui/index.d.ts +0 -4
- package/dist/ulid-DRH25k3y.d.ts +0 -66
- package/dist/util/index.d.ts +0 -79
- package/dist/validators-BUcli5Nh.d.ts +0 -101
- package/dist/vault-diff-Z2DUayMe.d.ts +0 -147
- package/dist/verify-JPF2YR5E.js +0 -139
- package/dist/walk-XYA2O3LW.js +0 -241
- package/dist/with/index.d.ts +0 -37
- package/dist/with-materialized-view-BUmzlXue.d.ts +0 -27
- package/dist/with-overlayed-view-m4FaXXTO.d.ts +0 -12
- package/dist/with-rollup-DEKGI9vb.d.ts +0 -47
- package/dist/withdraw-accessible-WLV4MTEN.js +0 -28
- /package/dist/{api-TX2EX2FX.js.map → api-3TH2GOFQ.js.map} +0 -0
- /package/dist/{backup-R7NTDFKY.js.map → backup-2WVBIVXW.js.map} +0 -0
- /package/dist/{chunk-TMBXVJKT.js.map → chunk-2MTRJCBI.js.map} +0 -0
- /package/dist/{chunk-3OPY6MK2.js.map → chunk-37WOJQWY.js.map} +0 -0
- /package/dist/{chunk-KJ2BCBTL.js.map → chunk-3QSOFZQB.js.map} +0 -0
- /package/dist/{chunk-DV4HUP5G.js.map → chunk-44IL5G3W.js.map} +0 -0
- /package/dist/{chunk-HYR4WZZ3.js.map → chunk-45QPICLE.js.map} +0 -0
- /package/dist/{chunk-XUBPSPKD.js.map → chunk-4BQXMCE5.js.map} +0 -0
- /package/dist/{chunk-RHK32N73.js.map → chunk-5HNX4OD4.js.map} +0 -0
- /package/dist/{chunk-2REPHKET.js.map → chunk-65VLRG3I.js.map} +0 -0
- /package/dist/{chunk-G6XV4H65.js.map → chunk-6MA575R5.js.map} +0 -0
- /package/dist/{chunk-F4CEK5YM.js.map → chunk-7GAXFU2O.js.map} +0 -0
- /package/dist/{chunk-6G5ORS5D.js.map → chunk-7QLY64AD.js.map} +0 -0
- /package/dist/{chunk-5VG4IJR7.js.map → chunk-7ZOSHEVS.js.map} +0 -0
- /package/dist/{chunk-LEJIKBBB.js.map → chunk-APHLCXVC.js.map} +0 -0
- /package/dist/{chunk-KNZB6JMR.js.map → chunk-BDEMZD4F.js.map} +0 -0
- /package/dist/{chunk-VJV7GKQK.js.map → chunk-BDPAVYGJ.js.map} +0 -0
- /package/dist/{chunk-G4JYND6L.js.map → chunk-BLUT46UP.js.map} +0 -0
- /package/dist/{chunk-J4LPNIGK.js.map → chunk-CCIR2OJH.js.map} +0 -0
- /package/dist/{chunk-5YESYH2C.js.map → chunk-CXC3JLAQ.js.map} +0 -0
- /package/dist/{chunk-XH7XP3OL.js.map → chunk-CZMCOFEA.js.map} +0 -0
- /package/dist/{chunk-WIGQB62E.js.map → chunk-DIB2BOIH.js.map} +0 -0
- /package/dist/{chunk-UF362QVH.js.map → chunk-EIZ4YOG2.js.map} +0 -0
- /package/dist/{chunk-DFVUTGT2.js.map → chunk-EVHBK7BN.js.map} +0 -0
- /package/dist/{chunk-ET67AY6B.js.map → chunk-EXGDL2UQ.js.map} +0 -0
- /package/dist/{chunk-YMVQD5Q5.js.map → chunk-F3LGBRSV.js.map} +0 -0
- /package/dist/{chunk-NUEQU36L.js.map → chunk-F44XWXOA.js.map} +0 -0
- /package/dist/{chunk-YCXCR7VG.js.map → chunk-FF7S3XDW.js.map} +0 -0
- /package/dist/{chunk-OXCSVM3B.js.map → chunk-FJTWLQV3.js.map} +0 -0
- /package/dist/{chunk-PS2NEWEX.js.map → chunk-FYNE4WLC.js.map} +0 -0
- /package/dist/{chunk-FORYWFN6.js.map → chunk-GL3JV5EV.js.map} +0 -0
- /package/dist/{chunk-VEAVKDDB.js.map → chunk-GXLZXD2W.js.map} +0 -0
- /package/dist/{chunk-3JXPAHOZ.js.map → chunk-HBBZWEC5.js.map} +0 -0
- /package/dist/{chunk-LL2NIVUR.js.map → chunk-HG76BZ6G.js.map} +0 -0
- /package/dist/{chunk-O45M6LDB.js.map → chunk-HGAB325C.js.map} +0 -0
- /package/dist/{chunk-T7WSLRAU.js.map → chunk-HK4XTXO4.js.map} +0 -0
- /package/dist/{chunk-U3WZCU7E.js.map → chunk-HYG32HCM.js.map} +0 -0
- /package/dist/{chunk-UN4FVIBH.js.map → chunk-ILF5GARW.js.map} +0 -0
- /package/dist/{chunk-BKARNZJN.js.map → chunk-INBQ43DI.js.map} +0 -0
- /package/dist/{chunk-Y3A5CB5G.js.map → chunk-IQIVD7TP.js.map} +0 -0
- /package/dist/{chunk-QA2KUPCP.js.map → chunk-J3JIYFYL.js.map} +0 -0
- /package/dist/{chunk-OVYRLHPE.js.map → chunk-JGUZMC3I.js.map} +0 -0
- /package/dist/{chunk-VWRRVE6D.js.map → chunk-JRKE5MAZ.js.map} +0 -0
- /package/dist/{chunk-XGDAPN6M.js.map → chunk-K2DLLK34.js.map} +0 -0
- /package/dist/{chunk-7BWJHO2A.js.map → chunk-KKYEZCQG.js.map} +0 -0
- /package/dist/{chunk-TWKKOM55.js.map → chunk-NAR6IDKH.js.map} +0 -0
- /package/dist/{chunk-OBKWYKYC.js.map → chunk-NEYKOESM.js.map} +0 -0
- /package/dist/{chunk-VEPTFUJY.js.map → chunk-NM3IFKBL.js.map} +0 -0
- /package/dist/{chunk-4OMCIY6F.js.map → chunk-NRYNRSGV.js.map} +0 -0
- /package/dist/{chunk-PLS64NCS.js.map → chunk-NT2ZO4KI.js.map} +0 -0
- /package/dist/{chunk-5I35DOHK.js.map → chunk-P2LJI6JE.js.map} +0 -0
- /package/dist/{chunk-QSFOZUYL.js.map → chunk-PH7G7ZI7.js.map} +0 -0
- /package/dist/{chunk-OHHKHSJP.js.map → chunk-PN5332SU.js.map} +0 -0
- /package/dist/{chunk-OT76OZL6.js.map → chunk-QF5LGMSV.js.map} +0 -0
- /package/dist/{chunk-3MATJ6O4.js.map → chunk-QG5RQQBO.js.map} +0 -0
- /package/dist/{chunk-DJ7KIPLV.js.map → chunk-QYPDYN23.js.map} +0 -0
- /package/dist/{chunk-IVLTXX4W.js.map → chunk-RNXJ2VO6.js.map} +0 -0
- /package/dist/{chunk-RW3Y22MW.js.map → chunk-RXTMLYJS.js.map} +0 -0
- /package/dist/{chunk-QOC3VYL2.js.map → chunk-S2OWPVSO.js.map} +0 -0
- /package/dist/{chunk-P33LUIML.js.map → chunk-S7TAPIRS.js.map} +0 -0
- /package/dist/{chunk-XREOISSI.js.map → chunk-SAL5X5OK.js.map} +0 -0
- /package/dist/{chunk-GNMXXTMN.js.map → chunk-SGJGWBSC.js.map} +0 -0
- /package/dist/{chunk-VQRAIPYF.js.map → chunk-SIAIYP6G.js.map} +0 -0
- /package/dist/{chunk-BQISD5ZV.js.map → chunk-TBNF5DV5.js.map} +0 -0
- /package/dist/{chunk-HPWKV3YB.js.map → chunk-TVOHSPVK.js.map} +0 -0
- /package/dist/{chunk-HY3AUMFI.js.map → chunk-TVS6BUUR.js.map} +0 -0
- /package/dist/{chunk-ZYJ55N7N.js.map → chunk-UMC5QZTX.js.map} +0 -0
- /package/dist/{chunk-2OZXVKVP.js.map → chunk-US34HTOI.js.map} +0 -0
- /package/dist/{chunk-EOXAAJTY.js.map → chunk-VCUQR6ZL.js.map} +0 -0
- /package/dist/{chunk-6P5XCKSD.js.map → chunk-WEHIQYQH.js.map} +0 -0
- /package/dist/{chunk-VWM3DAVB.js.map → chunk-WHQHTNT7.js.map} +0 -0
- /package/dist/{chunk-VRIYFLBA.js.map → chunk-X6Y5MXTH.js.map} +0 -0
- /package/dist/{chunk-3QSIU3UT.js.map → chunk-XJ47GS53.js.map} +0 -0
- /package/dist/{chunk-2OV5NVE7.js.map → chunk-XS6DLN67.js.map} +0 -0
- /package/dist/{chunk-FRP6D2DM.js.map → chunk-Y5TWPBNW.js.map} +0 -0
- /package/dist/{chunk-JJZ2LW6T.js.map → chunk-ZHOJOT6S.js.map} +0 -0
- /package/dist/{collection-facade-LVD22JLM.js.map → collection-facade-DWA735G2.js.map} +0 -0
- /package/dist/{computed-EXDMQODG.js.map → computed-ORCGM5JE.js.map} +0 -0
- /package/dist/{dead-filter-HQIE2YG7.js.map → dead-filter-OV5FGKOG.js.map} +0 -0
- /package/dist/{delegation-BJP73GAP.js.map → delegation-YVSHMIZZ.js.map} +0 -0
- /package/dist/{derive-BME7HDWO.js.map → derive-BUO555L5.js.map} +0 -0
- /package/dist/{enclave-NHORSWSF.js.map → enclave-XXFUKJC6.js.map} +0 -0
- /package/dist/{executor-FE6X4LFX.js.map → executor-6OCCE5VM.js.map} +0 -0
- /package/dist/{executor-KSHKRJXP.js.map → executor-JFVAJY42.js.map} +0 -0
- /package/dist/{executor-ZHTJJICG.js.map → executor-UPSH5O3F.js.map} +0 -0
- /package/dist/{export-accessible-DACHM5VT.js.map → export-accessible-L4A2QZA5.js.map} +0 -0
- /package/dist/{extract-partition-RNENZZ4T.js.map → extract-partition-ZHQ4RGGM.js.map} +0 -0
- /package/dist/{fanout-sidecar-OFWN3NM7.js.map → fanout-sidecar-IO2KDUWV.js.map} +0 -0
- /package/dist/{find-BNGBJNKP.js.map → find-ZFZDZQ2U.js.map} +0 -0
- /package/dist/{issue-NDI4CVZU.js.map → issue-OG4V23SQ.js.map} +0 -0
- /package/dist/{ledger-6NDS2EO4.js.map → ledger-UAQKPWNM.js.map} +0 -0
- /package/dist/{liberate-HN3RIGIP.js.map → liberate-GFUQJRK5.js.map} +0 -0
- /package/dist/{link-set-SJB2MVJV.js.map → link-set-DGYUOFVD.js.map} +0 -0
- /package/dist/{noydb-BWF6EPIR.js.map → noydb-AKH4AMCR.js.map} +0 -0
- /package/dist/{policy-WGNAG5H6.js.map → policy-5POYLI26.js.map} +0 -0
- /package/dist/{public-envelope-EJLVIFX7.js.map → public-envelope-GOG4LUM7.js.map} +0 -0
- /package/dist/{register-SBIX7TVV.js.map → register-ZI7YI7US.js.map} +0 -0
- /package/dist/{registry-3EQG6OOE.js.map → registry-DZ2T4LL7.js.map} +0 -0
- /package/dist/{registry-CA327ACV.js.map → registry-NVWEQ2GU.js.map} +0 -0
- /package/dist/{registry-E7OXOTSV.js.map → registry-SEKL74ET.js.map} +0 -0
- /package/dist/{request-withdrawal-KAH2AAXC.js.map → request-withdrawal-ZP3JIRVS.js.map} +0 -0
- /package/dist/{reveal-R3JLHMUF.js.map → reveal-NPVROV4D.js.map} +0 -0
- /package/dist/{revoke-IXLOJ3IH.js.map → revoke-VF6TAJK2.js.map} +0 -0
- /package/dist/{signer-Y46N2GJ3.js.map → signer-DRDDCCHW.js.map} +0 -0
- /package/dist/{stale-Z7IW6RIL.js.map → stale-TJXFQKOJ.js.map} +0 -0
- /package/dist/{storage-ADNP2UWI.js.map → storage-GR7KZRH4.js.map} +0 -0
- /package/dist/{store-coordination-provider-DTDMI6VL.js.map → store-coordination-provider-5KDS2RRP.js.map} +0 -0
- /package/dist/{verify-JPF2YR5E.js.map → verify-QK76NJ4G.js.map} +0 -0
- /package/dist/{walk-XYA2O3LW.js.map → walk-XQCBKSBW.js.map} +0 -0
- /package/dist/{withdraw-accessible-WLV4MTEN.js.map → withdraw-accessible-FMN4LPJZ.js.map} +0 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `LedgerStore` — read/write access to a compartment's hash-chained
|
|
3
|
+
* audit log.
|
|
4
|
+
*
|
|
5
|
+
* The store is a thin wrapper around the adapter's `_ledger/` internal
|
|
6
|
+
* collection. Every append:
|
|
7
|
+
*
|
|
8
|
+
* 1. Loads the current head (or treats an empty ledger as head = -1)
|
|
9
|
+
* 2. Computes `prevHash` = sha256(canonicalJson(head))
|
|
10
|
+
* 3. Builds the new entry with `index = head.index + 1`
|
|
11
|
+
* 4. Encrypts the entry with the compartment's ledger DEK
|
|
12
|
+
* 5. Writes the encrypted envelope to `_ledger/<paddedIndex>`
|
|
13
|
+
*
|
|
14
|
+
* `verify()` walks the chain from genesis forward and returns
|
|
15
|
+
* `{ ok: true, head }` on success or `{ ok: false, divergedAt }` on the
|
|
16
|
+
* first broken link.
|
|
17
|
+
*
|
|
18
|
+
* ## Thread / concurrency model
|
|
19
|
+
*
|
|
20
|
+
* For we assume a **single writer per vault**. Two
|
|
21
|
+
* concurrent `append()` calls would race on the "read head, write
|
|
22
|
+
* head+1" cycle and could produce a broken chain. The sync engine
|
|
23
|
+
* is the primary concurrent-writer scenario, and it uses
|
|
24
|
+
* optimistic-concurrency via `expectedVersion` on the adapter — but
|
|
25
|
+
* the ledger path has no such guard today. Multi-writer hardening is a
|
|
26
|
+
* follow-up.
|
|
27
|
+
*
|
|
28
|
+
* Single-writer usage IS safe, including across process restarts:
|
|
29
|
+
* `head()` reads the adapter fresh each call, so a crash between the
|
|
30
|
+
* adapter.put of a data record and the ledger append just means the
|
|
31
|
+
* ledger is missing an entry for that record. `verify()` still
|
|
32
|
+
* succeeds; a future `verifyIntegrity()` helper can cross-check the
|
|
33
|
+
* ledger against the data collections to catch the gap.
|
|
34
|
+
*
|
|
35
|
+
* ## Why hide the ledger from `vault.collection()`?
|
|
36
|
+
*
|
|
37
|
+
* The `_ledger` name starts with `_`, matching the existing prefix
|
|
38
|
+
* convention for internal collections (`_keyring`, `_sync`,
|
|
39
|
+
* `_history`). The Vault's public `collection()` method already
|
|
40
|
+
* returns entries for any name, but `loadAll()` filters out
|
|
41
|
+
* underscore-prefixed collections so backups and exports don't leak
|
|
42
|
+
* ledger metadata. We keep the ledger accessible ONLY via
|
|
43
|
+
* `vault.ledger()` to enforce the hash-chain invariants — direct
|
|
44
|
+
* puts via `collection('_ledger')` would bypass the `append()` logic.
|
|
45
|
+
*/
|
|
46
|
+
import type { NoydbStore } from '../../../kernel/types.js';
|
|
47
|
+
import { type EnclaveKey } from '../../../kernel/enclave/index.js';
|
|
48
|
+
import { type LedgerEntry } from './entry.js';
|
|
49
|
+
import type { JsonPatch } from './patch.js';
|
|
50
|
+
import { LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION } from './constants.js';
|
|
51
|
+
import { envelopePayloadHash } from './hash.js';
|
|
52
|
+
export { LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, envelopePayloadHash };
|
|
53
|
+
/**
|
|
54
|
+
* Input shape for `LedgerStore.append()`. The caller supplies the
|
|
55
|
+
* operation metadata; the store fills in `index` and `prevHash`.
|
|
56
|
+
*/
|
|
57
|
+
export interface AppendInput {
|
|
58
|
+
op: LedgerEntry['op'];
|
|
59
|
+
collection: string;
|
|
60
|
+
id: string;
|
|
61
|
+
version: number;
|
|
62
|
+
actor: string;
|
|
63
|
+
payloadHash: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional JSON Patch representing the delta from the previous
|
|
66
|
+
* version to the new version. Present only for `put` operations
|
|
67
|
+
* that had a previous version; omitted for genesis puts and for
|
|
68
|
+
* deletes. When present, `LedgerStore.append` persists the patch
|
|
69
|
+
* in `_ledger_deltas/<paddedIndex>` and records its sha256 hash
|
|
70
|
+
* as the entry's `deltaHash` field.
|
|
71
|
+
*/
|
|
72
|
+
delta?: JsonPatch;
|
|
73
|
+
/**
|
|
74
|
+
* Present only for `op === 'amendment'` — structured audit
|
|
75
|
+
* payload for multi-record repair operations performed via
|
|
76
|
+
* `withTransactions(...)`. Carried through verbatim to the
|
|
77
|
+
* resulting ledger entry.
|
|
78
|
+
*/
|
|
79
|
+
amendment?: LedgerEntry['amendment'];
|
|
80
|
+
/**
|
|
81
|
+
* Optional human-readable tag describing why this mutation happened.
|
|
82
|
+
* Threaded from `collection.put(_, _, { reason })`.
|
|
83
|
+
* Carried verbatim onto the resulting ledger entry's `reason` field;
|
|
84
|
+
* omitted from canonical JSON when undefined.
|
|
85
|
+
*/
|
|
86
|
+
reason?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Result of `LedgerStore.verify()`. On success, `head` is the hash of
|
|
90
|
+
* the last entry — the same value that should be published to any
|
|
91
|
+
* external anchoring service (blockchain, OpenTimestamps, etc.). On
|
|
92
|
+
* failure, `divergedAt` is the 0-based index of the first entry whose
|
|
93
|
+
* recorded `prevHash` does not match the recomputed hash of its
|
|
94
|
+
* predecessor. Entries at `divergedAt` and later are untrustworthy;
|
|
95
|
+
* entries before that index are still valid.
|
|
96
|
+
*/
|
|
97
|
+
export type VerifyResult = {
|
|
98
|
+
readonly ok: true;
|
|
99
|
+
readonly head: string;
|
|
100
|
+
readonly length: number;
|
|
101
|
+
} | {
|
|
102
|
+
readonly ok: false;
|
|
103
|
+
readonly divergedAt: number;
|
|
104
|
+
readonly expected: string;
|
|
105
|
+
readonly actual: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* A LedgerStore is bound to a single vault. Callers obtain one
|
|
109
|
+
* via `vault.ledger()` — there is no public constructor to keep
|
|
110
|
+
* the hash-chain invariants in one place.
|
|
111
|
+
*
|
|
112
|
+
* The class holds no mutable state beyond its dependencies (adapter,
|
|
113
|
+
* vault name, DEK resolver, actor id). Every method reads the
|
|
114
|
+
* adapter fresh so multiple instances against the same vault
|
|
115
|
+
* see each other's writes immediately (at the cost of re-parsing the
|
|
116
|
+
* ledger on every head() / verify() call; acceptable at scale).
|
|
117
|
+
*/
|
|
118
|
+
export declare class LedgerStore {
|
|
119
|
+
private readonly adapter;
|
|
120
|
+
private readonly vault;
|
|
121
|
+
private readonly encrypted;
|
|
122
|
+
private readonly getDEK;
|
|
123
|
+
private readonly actor;
|
|
124
|
+
/**
|
|
125
|
+
* In-memory cache of the chain head — the most recently appended
|
|
126
|
+
* entry along with its precomputed hash. Without this, every
|
|
127
|
+
* `append()` would re-load every prior entry to recompute the
|
|
128
|
+
* prevHash, making N puts O(N²) — a 1K-record stress test goes from
|
|
129
|
+
* < 100ms to a multi-second timeout.
|
|
130
|
+
*
|
|
131
|
+
* The cache is populated on first read (`append`, `head`, `verify`)
|
|
132
|
+
* and updated in-place on every successful `append`. Single-writer
|
|
133
|
+
* usage (the assumption) keeps it consistent. A second
|
|
134
|
+
* LedgerStore instance writing to the same vault would not
|
|
135
|
+
* see the first instance's appends in its cached state — that's the
|
|
136
|
+
* concurrency caveat documented at the class level.
|
|
137
|
+
*
|
|
138
|
+
* Sentinel `undefined` means "not yet loaded"; an explicit `null`
|
|
139
|
+
* value means "loaded and confirmed empty" — distinguishing these
|
|
140
|
+
* matters because an empty ledger is a valid state (genesis prevHash
|
|
141
|
+
* is the empty string), and we don't want to re-scan the adapter
|
|
142
|
+
* just because the chain is freshly initialized.
|
|
143
|
+
*/
|
|
144
|
+
private headCache;
|
|
145
|
+
constructor(opts: {
|
|
146
|
+
adapter: NoydbStore;
|
|
147
|
+
vault: string;
|
|
148
|
+
encrypted: boolean;
|
|
149
|
+
getDEK: (collectionName: string) => Promise<EnclaveKey>;
|
|
150
|
+
actor: string;
|
|
151
|
+
});
|
|
152
|
+
/**
|
|
153
|
+
* Lazily load (or return cached) the current chain head. The cache
|
|
154
|
+
* sentinel is `undefined` until first access; after the first call,
|
|
155
|
+
* the cache holds either a `{ entry, hash }` for non-empty ledgers
|
|
156
|
+
* or `null` for empty ones.
|
|
157
|
+
*/
|
|
158
|
+
private getCachedHead;
|
|
159
|
+
/**
|
|
160
|
+
* Append a new entry to the ledger. Returns the full entry that was
|
|
161
|
+
* written (with its assigned index and computed prevHash) so the
|
|
162
|
+
* caller can use the hash for downstream purposes (e.g., embedding
|
|
163
|
+
* in a verifiable backup).
|
|
164
|
+
*
|
|
165
|
+
* This is the **only** way to add entries. Direct adapter writes to
|
|
166
|
+
* `_ledger/` would bypass the chain math and would be caught by the
|
|
167
|
+
* next `verify()` call as a divergence.
|
|
168
|
+
*
|
|
169
|
+
* ## Multi-writer correctness
|
|
170
|
+
*
|
|
171
|
+
* Append is implemented as an optimistic-CAS retry loop. On every
|
|
172
|
+
* attempt:
|
|
173
|
+
*
|
|
174
|
+
* 1. Read fresh head (cache invalidated on retry).
|
|
175
|
+
* 2. Compute `nextIndex = head.index + 1`, `prevHash = hash(head)`.
|
|
176
|
+
* 3. Encrypt delta payload IN MEMORY (no adapter write yet) so we
|
|
177
|
+
* can compute `deltaHash` before claiming the chain slot.
|
|
178
|
+
* 4. Build + encrypt the entry envelope.
|
|
179
|
+
* 5. `adapter.put(_ledger, paddedIndex, envelope, expectedVersion: 0)`
|
|
180
|
+
* — the `expectedVersion: 0` asserts "this slot must not exist."
|
|
181
|
+
* Stores with `casAtomic: true` honor the CAS check; under
|
|
182
|
+
* contention the second writer's put throws `ConflictError`.
|
|
183
|
+
* 6. On `ConflictError`: invalidate the head cache, sleep with
|
|
184
|
+
* bounded backoff + jitter, retry. After `MAX_APPEND_ATTEMPTS`
|
|
185
|
+
* retries throw {@link LedgerContentionError}.
|
|
186
|
+
* 7. On success: write the delta envelope (if any) at the same
|
|
187
|
+
* index. Update the head cache.
|
|
188
|
+
*
|
|
189
|
+
* Entry-first ordering matters: writing the delta first under
|
|
190
|
+
* contention would orphan delta records at indices the writer never
|
|
191
|
+
* actually claimed. The deltaHash is computed off the encrypted
|
|
192
|
+
* envelope's `_data` field, which doesn't require the envelope to
|
|
193
|
+
* be persisted.
|
|
194
|
+
*
|
|
195
|
+
* Stores with `casAtomic: false` (file, s3, r2 by default) silently
|
|
196
|
+
* accept the `expectedVersion: 0` argument and proceed without a
|
|
197
|
+
* CAS check. Concurrent appends against those stores remain
|
|
198
|
+
* best-effort — pair them with an advisory lock or with sync
|
|
199
|
+
* single-writer discipline.
|
|
200
|
+
*/
|
|
201
|
+
append(input: AppendInput): Promise<LedgerEntry>;
|
|
202
|
+
/**
|
|
203
|
+
* One attempt at the append cycle. Throws `ConflictError` when the
|
|
204
|
+
* CAS check on the entry put fails — `append()` catches that and
|
|
205
|
+
* retries. Any other error propagates to the caller.
|
|
206
|
+
*/
|
|
207
|
+
private appendOnce;
|
|
208
|
+
/**
|
|
209
|
+
* Load a delta payload by its entry index. Returns `null` if the
|
|
210
|
+
* entry at that index doesn't reference a delta (genesis puts and
|
|
211
|
+
* deletes leave the slot empty) or if the delta row is missing
|
|
212
|
+
* (possible after a `pruneHistory` fold).
|
|
213
|
+
*
|
|
214
|
+
* The caller is responsible for deciding what to do with a missing
|
|
215
|
+
* delta — `ledger.reconstruct()` uses it as a "stop walking
|
|
216
|
+
* backward" signal and falls back to the on-disk current value.
|
|
217
|
+
*/
|
|
218
|
+
loadDelta(index: number): Promise<JsonPatch | null>;
|
|
219
|
+
/** Encrypt a JSON Patch into an envelope for storage. Mirrors encryptEntry. */
|
|
220
|
+
private encryptDelta;
|
|
221
|
+
/**
|
|
222
|
+
* Read all entries in ascending-index order. Used internally by
|
|
223
|
+
* `append()`, `head()`, `verify()`, and `entries()`. Decryption is
|
|
224
|
+
* serial because the entries are tiny and the overhead of a Promise
|
|
225
|
+
* pool would dominate at realistic chain lengths (< 100K entries).
|
|
226
|
+
*/
|
|
227
|
+
loadAllEntries(): Promise<LedgerEntry[]>;
|
|
228
|
+
/**
|
|
229
|
+
* Return the current head of the ledger: the last entry, its hash,
|
|
230
|
+
* and the total chain length. `null` on an empty ledger so callers
|
|
231
|
+
* can distinguish "no history yet" from "empty history".
|
|
232
|
+
*/
|
|
233
|
+
head(): Promise<{
|
|
234
|
+
readonly entry: LedgerEntry;
|
|
235
|
+
readonly hash: string;
|
|
236
|
+
readonly length: number;
|
|
237
|
+
} | null>;
|
|
238
|
+
/**
|
|
239
|
+
* Return entries in the requested half-open range `[from, to)`.
|
|
240
|
+
* Defaults: `from = 0`, `to = length`. The indices are clipped to
|
|
241
|
+
* the valid range; no error is thrown for out-of-range queries.
|
|
242
|
+
*/
|
|
243
|
+
entries(opts?: {
|
|
244
|
+
from?: number;
|
|
245
|
+
to?: number;
|
|
246
|
+
}): Promise<LedgerEntry[]>;
|
|
247
|
+
/**
|
|
248
|
+
* Reconstruct a record's state at a given historical version by
|
|
249
|
+
* walking the ledger's delta chain backward from the current state.
|
|
250
|
+
*
|
|
251
|
+
* ## Algorithm
|
|
252
|
+
*
|
|
253
|
+
* Ledger deltas are stored in **reverse** form — each entry's
|
|
254
|
+
* patch describes how to undo that put, transforming the new
|
|
255
|
+
* record back into the previous one. `reconstruct` exploits this
|
|
256
|
+
* by:
|
|
257
|
+
*
|
|
258
|
+
* 1. Finding every ledger entry for `(collection, id)` in the
|
|
259
|
+
* chain, sorted by index ascending.
|
|
260
|
+
* 2. Starting from `current` (the present value of the record,
|
|
261
|
+
* as held by the caller — typically fetched via
|
|
262
|
+
* `Collection.get()`).
|
|
263
|
+
* 3. Walking entries in **descending** index order and applying
|
|
264
|
+
* each entry's reverse patch, stopping when we reach the
|
|
265
|
+
* entry whose version equals `atVersion`.
|
|
266
|
+
*
|
|
267
|
+
* The result is the record as it existed immediately AFTER the
|
|
268
|
+
* put at `atVersion`. To get the state at the genesis put
|
|
269
|
+
* (version 1), the walk runs all the way back through every put
|
|
270
|
+
* after the first.
|
|
271
|
+
*
|
|
272
|
+
* ## Caveats
|
|
273
|
+
*
|
|
274
|
+
* - **Delete entries** break the walk: once we see a delete, the
|
|
275
|
+
* record didn't exist before that point, so there's nothing to
|
|
276
|
+
* reconstruct. We return `null` in that case.
|
|
277
|
+
* - **Missing deltas** (e.g., after `pruneHistory` folds old
|
|
278
|
+
* entries into a base snapshot) also stop the walk. does
|
|
279
|
+
* not ship pruneHistory, so today this only happens if an entry
|
|
280
|
+
* was deleted out-of-band.
|
|
281
|
+
* - The caller MUST pass the correct current value. Passing a
|
|
282
|
+
* mutated object would corrupt the reconstruction — the patch
|
|
283
|
+
* chain is only valid against the exact state that was in
|
|
284
|
+
* effect when the most recent put happened.
|
|
285
|
+
*
|
|
286
|
+
* For, `reconstruct` is the only way to read a historical
|
|
287
|
+
* version via deltas. The legacy `_history` collection still
|
|
288
|
+
* holds full snapshots and `Collection.getVersion()` still reads
|
|
289
|
+
* from there — the two paths coexist until pruneHistory lands in
|
|
290
|
+
* a follow-up and delta becomes the default.
|
|
291
|
+
*/
|
|
292
|
+
reconstruct<T>(collection: string, id: string, current: T, atVersion: number): Promise<T | null>;
|
|
293
|
+
/**
|
|
294
|
+
* Walk the chain from genesis forward and verify every link.
|
|
295
|
+
*
|
|
296
|
+
* Returns `{ ok: true, head, length }` if every entry's `prevHash`
|
|
297
|
+
* matches the recomputed hash of its predecessor (and the genesis
|
|
298
|
+
* entry's `prevHash` is the empty string).
|
|
299
|
+
*
|
|
300
|
+
* Returns `{ ok: false, divergedAt, expected, actual }` on the first
|
|
301
|
+
* mismatch. `divergedAt` is the 0-based index of the BROKEN entry
|
|
302
|
+
* — entries before that index still verify cleanly; entries at and
|
|
303
|
+
* after `divergedAt` are untrustworthy.
|
|
304
|
+
*
|
|
305
|
+
* This method detects:
|
|
306
|
+
* - Mutated entry content (fields changed)
|
|
307
|
+
* - Reordered entries (if any adjacent pair swaps, the prevHash
|
|
308
|
+
* of the second no longer matches)
|
|
309
|
+
* - Inserted entries (the inserted entry's prevHash likely fails,
|
|
310
|
+
* and the following entry's prevHash definitely fails)
|
|
311
|
+
* - Deleted entries (the entry after the deletion sees a wrong
|
|
312
|
+
* prevHash)
|
|
313
|
+
*
|
|
314
|
+
* It does NOT detect:
|
|
315
|
+
* - Tampering with the DATA collections that bypassed the ledger
|
|
316
|
+
* entirely (e.g., an attacker who modifies records without
|
|
317
|
+
* appending matching ledger entries — this is why we also
|
|
318
|
+
* plan a `verifyIntegrity()` helper in a follow-up)
|
|
319
|
+
* - Truncation of the chain at the tail (dropping the last N
|
|
320
|
+
* entries leaves a shorter but still consistent chain). External
|
|
321
|
+
* anchoring of `head.hash` to a trusted service is the defense
|
|
322
|
+
* against this.
|
|
323
|
+
*/
|
|
324
|
+
verify(): Promise<VerifyResult>;
|
|
325
|
+
/**
|
|
326
|
+
* Serialize + encrypt a ledger entry into an EncryptedEnvelope. The
|
|
327
|
+
* envelope's `_v` field is set to `entry.index + 1` so the usual
|
|
328
|
+
* optimistic-concurrency machinery has a reasonable version number
|
|
329
|
+
* to compare against (the ledger is append-only, so concurrent
|
|
330
|
+
* writes should always bump the index).
|
|
331
|
+
*/
|
|
332
|
+
private encryptEntry;
|
|
333
|
+
/** Decrypt an envelope into a LedgerEntry. Throws on bad key / tamper. */
|
|
334
|
+
private decryptEntry;
|
|
335
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strategy seam for the optional history + ledger + time-machine
|
|
3
|
+
* service. Core imports `HistoryStrategy` type-only + `NO_HISTORY`
|
|
4
|
+
* stub; real implementations of `saveHistory`, `LedgerStore`,
|
|
5
|
+
* `VaultInstant`, `computePatch`, `diff` etc. are only reachable via
|
|
6
|
+
* `withHistory()` in `./active.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Applications that don't track per-record versioning, don't need the
|
|
9
|
+
* hash-chained audit ledger, and don't restore to past instants ship
|
|
10
|
+
* none of the ~1,880 LOC behind this seam.
|
|
11
|
+
*
|
|
12
|
+
* Strategy contract:
|
|
13
|
+
*
|
|
14
|
+
* - **saveHistory / pruneHistory / clearHistory** — no-ops under
|
|
15
|
+
* NO_HISTORY. Writes still succeed; no snapshot is captured.
|
|
16
|
+
* - **getHistoryEntries / getVersionEnvelope / diff** — throw under
|
|
17
|
+
* NO_HISTORY. These are read APIs the consumer would only call
|
|
18
|
+
* after explicitly asking for history; the throw guides them to
|
|
19
|
+
* `@noy-db/hub/history`.
|
|
20
|
+
* - **envelopePayloadHash / computePatch** — return empty / `[]`
|
|
21
|
+
* under NO_HISTORY. These are only used inside the
|
|
22
|
+
* `if (this.ledger)` branch, which is itself gated by
|
|
23
|
+
* `buildLedger()` returning null.
|
|
24
|
+
* - **buildLedger** — returns `null` under NO_HISTORY. The Vault's
|
|
25
|
+
* public `vault.ledger()` accessor throws when null.
|
|
26
|
+
* - **buildVaultInstant** — throws under NO_HISTORY. `vault.at()`
|
|
27
|
+
* propagates the throw.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
import type { EncryptedEnvelope, NoydbStore, HistoryOptions, PruneOptions } from '../../kernel/types.js';
|
|
32
|
+
import type { LedgerStore } from './ledger/store.js';
|
|
33
|
+
import type { JsonPatch } from './ledger/patch.js';
|
|
34
|
+
import type { DiffEntry } from './diff.js';
|
|
35
|
+
import type { VaultInstant, VaultEngine } from './time-machine.js';
|
|
36
|
+
import type { EnclaveKey } from '../../kernel/enclave/index.js';
|
|
37
|
+
/**
|
|
38
|
+
* Options accepted by `HistoryStrategy.buildLedger`. Mirrors the
|
|
39
|
+
* `LedgerStore` constructor verbatim — kept in this file so `core`
|
|
40
|
+
* code never imports the LedgerStore module at runtime.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export interface BuildLedgerOptions {
|
|
45
|
+
adapter: NoydbStore;
|
|
46
|
+
vault: string;
|
|
47
|
+
encrypted: boolean;
|
|
48
|
+
getDEK: (collectionName: string) => Promise<EnclaveKey>;
|
|
49
|
+
actor: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export interface HistoryStrategy {
|
|
55
|
+
/**
|
|
56
|
+
* Persist a full encrypted envelope snapshot of the prior version
|
|
57
|
+
* under `_history/{collection}:{id}:{paddedVersion}`. No-op under
|
|
58
|
+
* `NO_HISTORY`.
|
|
59
|
+
*/
|
|
60
|
+
saveHistory(adapter: NoydbStore, vault: string, collection: string, recordId: string, envelope: EncryptedEnvelope): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* List history envelopes for a record, newest first. Throws under
|
|
63
|
+
* `NO_HISTORY` — callers reach this via `collection.history()` /
|
|
64
|
+
* `collection.getVersion()` / `collection.diff()`, which only work
|
|
65
|
+
* with the strategy enabled.
|
|
66
|
+
*/
|
|
67
|
+
getHistoryEntries(adapter: NoydbStore, vault: string, collection: string, recordId: string, options?: HistoryOptions): Promise<EncryptedEnvelope[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch a specific version's envelope. Throws under `NO_HISTORY`.
|
|
70
|
+
*/
|
|
71
|
+
getVersionEnvelope(adapter: NoydbStore, vault: string, collection: string, recordId: string, version: number): Promise<EncryptedEnvelope | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Prune history entries by retention rule. Returns `0` under
|
|
74
|
+
* `NO_HISTORY`.
|
|
75
|
+
*/
|
|
76
|
+
pruneHistory(adapter: NoydbStore, vault: string, collection: string, recordId: string | undefined, options: PruneOptions): Promise<number>;
|
|
77
|
+
/**
|
|
78
|
+
* Clear all history for vault/collection/record. Returns `0` under
|
|
79
|
+
* `NO_HISTORY`.
|
|
80
|
+
*/
|
|
81
|
+
clearHistory(adapter: NoydbStore, vault: string, collection?: string, recordId?: string): Promise<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Crypto-shred (overwrite-to-tombstone) every `_history` version of a
|
|
84
|
+
* record for GDPR erasure. Returns the number of versions newly
|
|
85
|
+
* tombstoned, or `0` under `NO_HISTORY` (no history = nothing to shred).
|
|
86
|
+
*/
|
|
87
|
+
tombstoneHistory(adapter: NoydbStore, vault: string, collection: string, recordId: string, actor: string, encrypted: boolean): Promise<number>;
|
|
88
|
+
/**
|
|
89
|
+
* Compute the SHA-256 hash of an envelope's encrypted payload, used
|
|
90
|
+
* by `LedgerStore.append` to track tamper-evidence. Returns the
|
|
91
|
+
* empty string under `NO_HISTORY` (the call site is gated by
|
|
92
|
+
* `if (this.ledger)`, so the value is never observed).
|
|
93
|
+
*/
|
|
94
|
+
envelopePayloadHash(envelope: EncryptedEnvelope | null): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Compute the JSON patch from `from` → `to`. Returns `[]` under
|
|
97
|
+
* `NO_HISTORY`.
|
|
98
|
+
*/
|
|
99
|
+
computePatch(from: unknown, to: unknown): JsonPatch;
|
|
100
|
+
/**
|
|
101
|
+
* Compute the typed diff between two records. Throws under
|
|
102
|
+
* `NO_HISTORY` — `collection.diff()` is a history-read API.
|
|
103
|
+
*/
|
|
104
|
+
diff(recordA: unknown, recordB: unknown): DiffEntry[];
|
|
105
|
+
/**
|
|
106
|
+
* Construct (or return null) a `LedgerStore` for the vault. Returns
|
|
107
|
+
* `null` under `NO_HISTORY`; the Vault treats null as "no ledger
|
|
108
|
+
* attached" — collection write paths skip the append branch and the
|
|
109
|
+
* public `vault.ledger()` accessor throws.
|
|
110
|
+
*/
|
|
111
|
+
buildLedger(opts: BuildLedgerOptions): LedgerStore | null;
|
|
112
|
+
/**
|
|
113
|
+
* Construct a `VaultInstant` for time-machine reads. Throws under
|
|
114
|
+
* `NO_HISTORY`.
|
|
115
|
+
*/
|
|
116
|
+
buildVaultInstant(engine: VaultEngine, timestamp: string): VaultInstant;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* No-history stub. Snapshots and prune/clear are no-ops; reads and
|
|
120
|
+
* time-machine throw with an actionable message; ledger construction
|
|
121
|
+
* returns null so the write-path's `if (this.ledger)` branch is dead
|
|
122
|
+
* code in the bundle.
|
|
123
|
+
*
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
export declare const NO_HISTORY: HistoryStrategy;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-machine queries — point-in-time reads reconstructed from the
|
|
3
|
+
* existing history + ledger infrastructure.
|
|
4
|
+
*
|
|
5
|
+
* ## Usage
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const vault = await db.openVault('acme', { passphrase })
|
|
9
|
+
* const q1End = vault.at('2026-03-31T23:59:59Z')
|
|
10
|
+
* const invoice = await q1End.collection<Invoice>('invoices').get('inv-001')
|
|
11
|
+
* // → the record as it stood at the close of Q1 2026
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## How it works
|
|
15
|
+
*
|
|
16
|
+
* Every write path already fans out into two persistence lanes:
|
|
17
|
+
*
|
|
18
|
+
* 1. `saveHistory(...)` persists a **full encrypted envelope snapshot**
|
|
19
|
+
* per version under the `_history` collection (one envelope per
|
|
20
|
+
* version, keyed by `{collection}:{id}:{paddedVersion}`). Each
|
|
21
|
+
* envelope carries its own `_ts` (the write timestamp).
|
|
22
|
+
* 2. `ledger.append(...)` appends a hash-chained audit entry that
|
|
23
|
+
* records the `op` (put / delete), `version`, and `ts`.
|
|
24
|
+
*
|
|
25
|
+
* Reconstruction at a target timestamp T is therefore:
|
|
26
|
+
*
|
|
27
|
+
* - Find the newest history envelope for `(collection, id)` whose
|
|
28
|
+
* `_ts ≤ T` — that's the state the record was in at T.
|
|
29
|
+
* - Check the ledger for any `op: 'delete'` entry for the same
|
|
30
|
+
* `(collection, id)` with `entry.ts` in `(latestEnvelope._ts, T]` —
|
|
31
|
+
* if present, the record was deleted before T, so return `null`.
|
|
32
|
+
* - Decrypt the surviving envelope with the current collection DEK
|
|
33
|
+
* (DEKs are per-collection but stable across versions — the same
|
|
34
|
+
* key encrypts v1 and v15 of a record).
|
|
35
|
+
*
|
|
36
|
+
* No delta replay. The existing `history.ts` module already stores
|
|
37
|
+
* complete snapshots; we just pick the right one.
|
|
38
|
+
*
|
|
39
|
+
* ## Read-only contract
|
|
40
|
+
*
|
|
41
|
+
* Every write method on `CollectionInstant` throws
|
|
42
|
+
* {@link ReadOnlyAtInstantError}. A historical view is a *read*
|
|
43
|
+
* surface — mutating the past would require either a branch/shadow
|
|
44
|
+
* mechanism (tracked under shadow vaults) or a rewrite of
|
|
45
|
+
* history, which breaks the ledger's tamper-evidence guarantee.
|
|
46
|
+
*
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
import type { NoydbStore } from '../../kernel/types.js';
|
|
50
|
+
import type { LedgerStore } from './ledger/store.js';
|
|
51
|
+
import { type EnclaveKey } from '../../kernel/enclave/index.js';
|
|
52
|
+
/**
|
|
53
|
+
* Narrow view of a {@link Vault}'s internals that
|
|
54
|
+
* {@link VaultInstant} needs. Passed in by `Vault.at()` rather than
|
|
55
|
+
* constructed here so all crypto + adapter access stays inside the
|
|
56
|
+
* Vault class.
|
|
57
|
+
*
|
|
58
|
+
* Not exported from the public barrel — consumers should get a
|
|
59
|
+
* `VaultInstant` via `vault.at(ts)`, never by constructing one
|
|
60
|
+
* directly.
|
|
61
|
+
*/
|
|
62
|
+
export interface VaultEngine {
|
|
63
|
+
readonly adapter: NoydbStore;
|
|
64
|
+
/** Vault name (the compartment). */
|
|
65
|
+
readonly name: string;
|
|
66
|
+
/**
|
|
67
|
+
* `true` when the vault was opened with a passphrase (the normal
|
|
68
|
+
* case). `false` in plaintext-mode vaults (`encrypt: false`) — in
|
|
69
|
+
* that case `envelope._data` is raw JSON and we skip the DEK lookup.
|
|
70
|
+
*/
|
|
71
|
+
readonly encrypted: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves the DEK used to decrypt a given collection's envelopes.
|
|
74
|
+
* Not called when `encrypted` is false.
|
|
75
|
+
*/
|
|
76
|
+
getDEK(collection: string): Promise<EnclaveKey>;
|
|
77
|
+
/**
|
|
78
|
+
* Lazily-initialised ledger. We consult it to detect deletes that
|
|
79
|
+
* happened between the latest history snapshot and the target
|
|
80
|
+
* timestamp. `null` when history is disabled for this vault — in
|
|
81
|
+
* that case time-machine reads fall back to history-only
|
|
82
|
+
* reconstruction (which may miss deletes).
|
|
83
|
+
*/
|
|
84
|
+
getLedger(): LedgerStore | null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A vault at a fixed instant. Produced by `vault.at(timestamp)`.
|
|
88
|
+
* Carries no session state of its own — every read is a fresh
|
|
89
|
+
* lookup through the vault's adapter.
|
|
90
|
+
*
|
|
91
|
+
* Cheap to construct; safe to throw away. Create one per query.
|
|
92
|
+
*/
|
|
93
|
+
export declare class VaultInstant {
|
|
94
|
+
private readonly engine;
|
|
95
|
+
/** Fully-resolved target timestamp (ISO-8601 UTC). */
|
|
96
|
+
readonly timestamp: string;
|
|
97
|
+
constructor(engine: VaultEngine,
|
|
98
|
+
/** Fully-resolved target timestamp (ISO-8601 UTC). */
|
|
99
|
+
timestamp: string);
|
|
100
|
+
/** Get a point-in-time view of a collection. */
|
|
101
|
+
collection<T = unknown>(name: string): CollectionInstant<T>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A read-only collection view anchored to a past instant.
|
|
105
|
+
*
|
|
106
|
+
* Every write method throws {@link ReadOnlyAtInstantError} — see the
|
|
107
|
+
* module docstring for why. The read surface is intentionally smaller
|
|
108
|
+
* than the live {@link Collection}: `get` and `list` cover the
|
|
109
|
+
* "what did the books look like on date X" use case without pulling
|
|
110
|
+
* in the full query DSL / joins / aggregates at this stage. Follow-up
|
|
111
|
+
* work tracked under.
|
|
112
|
+
*/
|
|
113
|
+
export declare class CollectionInstant<T = unknown> {
|
|
114
|
+
private readonly engine;
|
|
115
|
+
private readonly targetTs;
|
|
116
|
+
readonly name: string;
|
|
117
|
+
constructor(engine: VaultEngine, targetTs: string, name: string);
|
|
118
|
+
/**
|
|
119
|
+
* Return the record as it existed at the target timestamp, or
|
|
120
|
+
* `null` if the record had not been created yet or had already been
|
|
121
|
+
* deleted by then.
|
|
122
|
+
*/
|
|
123
|
+
get(id: string): Promise<T | null>;
|
|
124
|
+
/**
|
|
125
|
+
* IDs of records that existed (had at least one `put` and were not
|
|
126
|
+
* subsequently deleted) at the target timestamp.
|
|
127
|
+
*
|
|
128
|
+
* Implemented as a linear scan over history + ledger. Performance
|
|
129
|
+
* is bounded by total history size (not live-vault size), so the
|
|
130
|
+
* memory-first vault-scale cap (1K–50K records × average history
|
|
131
|
+
* depth) still applies.
|
|
132
|
+
*/
|
|
133
|
+
list(): Promise<string[]>;
|
|
134
|
+
put(_id: string, _record: T): Promise<never>;
|
|
135
|
+
delete(_id: string): Promise<never>;
|
|
136
|
+
update(_id: string, _patch: Partial<T>): Promise<never>;
|
|
137
|
+
/**
|
|
138
|
+
* Return the envelope that represents the record's state at
|
|
139
|
+
* `targetTs`, accounting for deletes. `null` if the record didn't
|
|
140
|
+
* exist at that instant.
|
|
141
|
+
*
|
|
142
|
+
* ## Why we use the ledger as the authoritative timeline
|
|
143
|
+
*
|
|
144
|
+
* The per-version history snapshots saved by `saveHistory()` do
|
|
145
|
+
* carry a `_ts` field, but that timestamp is the moment the
|
|
146
|
+
* snapshot was *captured* (i.e. the instant right before the
|
|
147
|
+
* subsequent overwrite), not the original write time. The ledger,
|
|
148
|
+
* by contrast, records `ts` at the moment of each `put` / `delete`
|
|
149
|
+
* — it's the only source that tracks the real timeline. So:
|
|
150
|
+
*
|
|
151
|
+
* 1. Walk the ledger; find the latest entry for `(collection, id)`
|
|
152
|
+
* with `ts ≤ targetTs`.
|
|
153
|
+
* 2. If that entry is a `delete`, the record was gone at the
|
|
154
|
+
* target instant — return null.
|
|
155
|
+
* 3. Otherwise it's a `put` with a specific `version`. Load the
|
|
156
|
+
* envelope for that version from history, falling back to the
|
|
157
|
+
* live collection for the most recent version.
|
|
158
|
+
*
|
|
159
|
+
* ## Fallback when the ledger is disabled
|
|
160
|
+
*
|
|
161
|
+
* If the vault has history disabled, `getLedger()` returns null and
|
|
162
|
+
* we fall back to comparing envelope `_ts` fields. This is
|
|
163
|
+
* approximate and gets the *last write* right but may confuse the
|
|
164
|
+
* intermediate versions; adopters needing accurate time-machine
|
|
165
|
+
* reads should leave history enabled.
|
|
166
|
+
*/
|
|
167
|
+
private resolveEnvelope;
|
|
168
|
+
private resolveViaLedger;
|
|
169
|
+
private resolveViaEnvelopeTs;
|
|
170
|
+
/**
|
|
171
|
+
* Fetch the envelope for a specific version. The live record (most
|
|
172
|
+
* recent put) lives in the main collection; prior versions live in
|
|
173
|
+
* `_history`. We check live first because the common case after a
|
|
174
|
+
* delete is that we're trying to load the last-live version from
|
|
175
|
+
* history, and skipping live for the current-version case avoids a
|
|
176
|
+
* redundant lookup.
|
|
177
|
+
*/
|
|
178
|
+
private loadVersion;
|
|
179
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category capability
|
|
3
|
+
* Deferred-numbering config descriptor. See
|
|
4
|
+
* docs/superpowers/specs/2026-06-08-sealed-numbering-and-store-clock-design.md.
|
|
5
|
+
*/
|
|
6
|
+
/** A registered deferred-numbering series. */
|
|
7
|
+
export interface DeferredNumberingConfig {
|
|
8
|
+
/** Series name — the key passed to `vault.sequence(series)`. */
|
|
9
|
+
readonly series: string;
|
|
10
|
+
/** Collection holding the records to number. */
|
|
11
|
+
readonly collection: string;
|
|
12
|
+
/** Field on each record where the assigned serial is written. */
|
|
13
|
+
readonly field: string;
|
|
14
|
+
/**
|
|
15
|
+
* Minimum wall-clock age (ms) before an entry is eligible at a pass, in
|
|
16
|
+
* addition to the interval commit-wait. Default 0 — the store-clock
|
|
17
|
+
* interval (`storeLatest ≤ now.earliest`) is the correctness mechanism.
|
|
18
|
+
*/
|
|
19
|
+
readonly settleWindowMs: number;
|
|
20
|
+
}
|
|
21
|
+
/** Declare a deferred-numbering series. Pass the result in `createNoydb({ numbering: [...] })`. */
|
|
22
|
+
export declare function withDeferredNumbering(config: {
|
|
23
|
+
series: string;
|
|
24
|
+
collection: string;
|
|
25
|
+
field: string;
|
|
26
|
+
settleWindowMs?: number;
|
|
27
|
+
}): DeferredNumberingConfig;
|