@noy-db/hub 0.3.0-pre.1 → 0.3.0-pre.11
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 +9 -8
- package/dist/aggregate/index.js.map +1 -1
- package/dist/api-YGMINAET.js +20 -0
- package/dist/as/index.js +12 -6
- package/dist/attestation/index.js +19 -13
- package/dist/attestation/index.js.map +1 -1
- package/dist/backup-XA5STIYQ.js +225 -0
- package/dist/backup-XA5STIYQ.js.map +1 -0
- package/dist/blobs/index.js +12 -6
- package/dist/blobs/index.js.map +1 -1
- package/dist/broker/index.js +92 -0
- package/dist/broker/index.js.map +1 -0
- package/dist/bundle/index.js +21 -15
- package/dist/bundle/index.js.map +1 -1
- package/dist/by/index.js +2 -2
- package/dist/cargo/index.js +32 -26
- package/dist/chunk-25NDNMQ7.js +70 -0
- package/dist/chunk-25NDNMQ7.js.map +1 -0
- package/dist/chunk-2JMMY7HZ.js +188 -0
- package/dist/chunk-2JMMY7HZ.js.map +1 -0
- package/dist/chunk-3CNQ7FQ3.js +430 -0
- package/dist/chunk-3G4KMVUN.js +291 -0
- package/dist/chunk-3G4KMVUN.js.map +1 -0
- package/dist/chunk-3MSQLQNZ.js +74 -0
- package/dist/chunk-45ZZLTFH.js +38 -0
- package/dist/chunk-45ZZLTFH.js.map +1 -0
- package/dist/chunk-4GPE63GU.js +111 -0
- package/dist/chunk-4GPE63GU.js.map +1 -0
- package/dist/chunk-4N5QFSNQ.js +150 -0
- package/dist/chunk-4N5QFSNQ.js.map +1 -0
- package/dist/chunk-4R4Q64W5.js +34 -0
- package/dist/chunk-57V5S7PW.js +130 -0
- package/dist/chunk-57V5S7PW.js.map +1 -0
- package/dist/chunk-5JB73NMC.js +202 -0
- package/dist/chunk-5JB73NMC.js.map +1 -0
- package/dist/chunk-5XIPOCQC.js +155 -0
- package/dist/chunk-5ZOSG3RJ.js +778 -0
- package/dist/chunk-5ZOSG3RJ.js.map +1 -0
- package/dist/chunk-67TNU77I.js +36 -0
- package/dist/chunk-67TNU77I.js.map +1 -0
- package/dist/chunk-6QILBDZU.js +205 -0
- package/dist/chunk-7E67FJ33.js +155 -0
- package/dist/chunk-7ITPJFGC.js +50 -0
- package/dist/chunk-7ITPJFGC.js.map +1 -0
- package/dist/chunk-7NS43EXZ.js +117 -0
- package/dist/chunk-7QIXUSDQ.js +341 -0
- package/dist/chunk-7QIXUSDQ.js.map +1 -0
- package/dist/chunk-7VSGW5KJ.js +74 -0
- package/dist/chunk-7VSGW5KJ.js.map +1 -0
- package/dist/chunk-A2QF4JUE.js +14073 -0
- package/dist/chunk-A2QF4JUE.js.map +1 -0
- package/dist/chunk-A2Y6YFVN.js +209 -0
- package/dist/chunk-AOVDSIL3.js +1221 -0
- package/dist/chunk-AOVDSIL3.js.map +1 -0
- package/dist/chunk-ARSAMO24.js +29 -0
- package/dist/chunk-ARSAMO24.js.map +1 -0
- package/dist/chunk-AWB5JZW6.js +41 -0
- package/dist/chunk-AWB5JZW6.js.map +1 -0
- package/dist/chunk-BCYQA5BK.js +45 -0
- package/dist/chunk-BE7N3AXA.js +621 -0
- package/dist/chunk-BE7N3AXA.js.map +1 -0
- package/dist/chunk-BEIRE5K4.js +164 -0
- package/dist/chunk-BEIRE5K4.js.map +1 -0
- package/dist/chunk-BZO4WCJI.js +86 -0
- package/dist/chunk-BZO4WCJI.js.map +1 -0
- package/dist/chunk-C3YH34IL.js +75 -0
- package/dist/chunk-C3YH34IL.js.map +1 -0
- package/dist/chunk-C7NTK5I3.js +49 -0
- package/dist/chunk-C7NTK5I3.js.map +1 -0
- package/dist/chunk-CB25ONKC.js +129 -0
- package/dist/chunk-CIKY6I4W.js +21 -0
- package/dist/chunk-CKZW6P5V.js +32 -0
- package/dist/chunk-CKZW6P5V.js.map +1 -0
- package/dist/chunk-D26JB3LZ.js +54 -0
- package/dist/chunk-D3EFFFOL.js +59 -0
- package/dist/chunk-D3EFFFOL.js.map +1 -0
- package/dist/chunk-DGH65E7Q.js +466 -0
- package/dist/chunk-DGH65E7Q.js.map +1 -0
- package/dist/chunk-DIRRS7WP.js +42 -0
- package/dist/chunk-DJ3VKYFA.js +150 -0
- package/dist/chunk-DJ3VKYFA.js.map +1 -0
- package/dist/chunk-DMFNPHCX.js +247 -0
- package/dist/chunk-DMFNPHCX.js.map +1 -0
- package/dist/chunk-ELNBMFOS.js +392 -0
- package/dist/chunk-ELNBMFOS.js.map +1 -0
- package/dist/chunk-FH542DDY.js +1505 -0
- package/dist/chunk-FH542DDY.js.map +1 -0
- package/dist/chunk-FQQF23MC.js +45 -0
- package/dist/chunk-FQQF23MC.js.map +1 -0
- package/dist/chunk-FXK4X4BL.js +91 -0
- package/dist/chunk-FXK4X4BL.js.map +1 -0
- package/dist/chunk-GA2QHD6P.js +235 -0
- package/dist/chunk-GA2QHD6P.js.map +1 -0
- package/dist/chunk-GYGLAVCX.js +19 -0
- package/dist/chunk-GYGLAVCX.js.map +1 -0
- package/dist/chunk-H44ZE4IE.js +355 -0
- package/dist/chunk-H6CZSDWK.js +1697 -0
- package/dist/chunk-H6CZSDWK.js.map +1 -0
- package/dist/chunk-H6HM6CVR.js +279 -0
- package/dist/chunk-H6HM6CVR.js.map +1 -0
- package/dist/chunk-HFJIGWJC.js +382 -0
- package/dist/chunk-HUS3J5WM.js +404 -0
- package/dist/chunk-HUS3J5WM.js.map +1 -0
- package/dist/chunk-IDIV5NVH.js +99 -0
- package/dist/chunk-IDIV5NVH.js.map +1 -0
- package/dist/chunk-IGJCYUT5.js +99 -0
- package/dist/chunk-IGJCYUT5.js.map +1 -0
- package/dist/chunk-IGJHJYM6.js +515 -0
- package/dist/chunk-IGJHJYM6.js.map +1 -0
- package/dist/chunk-IP2QBAGS.js +589 -0
- package/dist/chunk-IP2QBAGS.js.map +1 -0
- package/dist/chunk-JK733I5V.js +23 -0
- package/dist/chunk-JK733I5V.js.map +1 -0
- package/dist/chunk-JOQ53DMI.js +255 -0
- package/dist/chunk-JOQ53DMI.js.map +1 -0
- package/dist/chunk-K62IUKOD.js +823 -0
- package/dist/chunk-K62IUKOD.js.map +1 -0
- package/dist/chunk-KPGX66PM.js +230 -0
- package/dist/chunk-KPZS5QAQ.js +151 -0
- package/dist/chunk-KPZS5QAQ.js.map +1 -0
- package/dist/chunk-L2SNBIV7.js +453 -0
- package/dist/chunk-L2SNBIV7.js.map +1 -0
- package/dist/chunk-LP7BEXCT.js +32 -0
- package/dist/chunk-LP7BEXCT.js.map +1 -0
- package/dist/chunk-MCEKIAO4.js +367 -0
- package/dist/chunk-MELR46EF.js +280 -0
- package/dist/chunk-MELR46EF.js.map +1 -0
- package/dist/chunk-MSPNM2OM.js +95 -0
- package/dist/chunk-MSPNM2OM.js.map +1 -0
- package/dist/chunk-NO272T7Q.js +194 -0
- package/dist/chunk-NO272T7Q.js.map +1 -0
- package/dist/chunk-O2DYPAZY.js +23 -0
- package/dist/chunk-ODJWBC5I.js +30 -0
- package/dist/chunk-OEAATWH5.js +686 -0
- package/dist/chunk-OEAATWH5.js.map +1 -0
- package/dist/chunk-OFJ5GPNA.js +71 -0
- package/dist/chunk-OOLO4LQG.js +99 -0
- package/dist/chunk-OOLO4LQG.js.map +1 -0
- package/dist/chunk-P5RY4ZWD.js +662 -0
- package/dist/chunk-P5RY4ZWD.js.map +1 -0
- package/dist/chunk-PR5LC5YX.js +265 -0
- package/dist/chunk-PR5LC5YX.js.map +1 -0
- package/dist/chunk-PXWVF7MC.js +135 -0
- package/dist/chunk-Q3XSMOZM.js +40 -0
- package/dist/chunk-QLLKLFE2.js +94 -0
- package/dist/chunk-QLLKLFE2.js.map +1 -0
- package/dist/chunk-QQJXBZCO.js +1056 -0
- package/dist/chunk-QQJXBZCO.js.map +1 -0
- package/dist/chunk-QYPKGVT4.js +261 -0
- package/dist/chunk-QYPKGVT4.js.map +1 -0
- package/dist/chunk-RKRGDAS7.js +59 -0
- package/dist/chunk-SRVQHVNX.js +164 -0
- package/dist/chunk-SYMS4546.js +29 -0
- package/dist/chunk-SYMS4546.js.map +1 -0
- package/dist/chunk-THNJ3IKU.js +17 -0
- package/dist/chunk-THNJ3IKU.js.map +1 -0
- package/dist/chunk-TPH5EO6L.js +54 -0
- package/dist/chunk-TPH5EO6L.js.map +1 -0
- package/dist/chunk-UFILRICG.js +14 -0
- package/dist/chunk-UTLEAJXC.js +97 -0
- package/dist/chunk-VA4ZWLFY.js +123 -0
- package/dist/chunk-VR24ILCR.js +367 -0
- package/dist/chunk-VYYM3MEN.js +98 -0
- package/dist/chunk-VYYM3MEN.js.map +1 -0
- package/dist/chunk-W5D62AQD.js +944 -0
- package/dist/chunk-W5D62AQD.js.map +1 -0
- package/dist/chunk-WGV4CUZT.js +167 -0
- package/dist/chunk-WGV4CUZT.js.map +1 -0
- package/dist/chunk-WTUNZACT.js +30 -0
- package/dist/chunk-WTUNZACT.js.map +1 -0
- package/dist/chunk-X6CMGUAG.js +69 -0
- package/dist/chunk-X6CMGUAG.js.map +1 -0
- package/dist/chunk-XFXUTFWQ.js +85 -0
- package/dist/chunk-XFXUTFWQ.js.map +1 -0
- package/dist/chunk-XHV25KBM.js +30 -0
- package/dist/chunk-YSXEFGND.js +124 -0
- package/dist/chunk-YXOUQ2H7.js +36 -0
- package/dist/chunk-ZP5PL65C.js +80 -0
- package/dist/classified/index.js +40 -0
- package/dist/classified-marker-LQWWQNIJ.js +24 -0
- package/dist/classified-marker-LQWWQNIJ.js.map +1 -0
- package/dist/collection-facade-YE2O4J4O.js +39 -0
- package/dist/computed-W6MVAMWZ.js +11 -0
- package/dist/consent/index.js +10 -4
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.js +1 -1
- package/dist/dead-filter-4KXZEB3X.js +28 -0
- package/dist/dead-filter-4KXZEB3X.js.map +1 -0
- package/dist/delegation-OPUU3R2E.js +25 -0
- package/dist/derivations/index.js +13 -6
- package/dist/derive-BGUHU663.js +21 -0
- package/dist/enclave-VXAQD4XJ.js +135 -0
- package/dist/executor-GTVSUUBX.js +25 -0
- package/dist/executor-GZWMTOXB.js +9 -0
- package/dist/executor-XXGS4S3K.js +9 -0
- package/dist/export-accessible-BMULIOYB.js +23 -0
- package/dist/extract-partition-JUQTWDXR.js +36 -0
- package/dist/fanout-sidecar-CKYFH33E.js +74 -0
- package/dist/fanout-sidecar-CKYFH33E.js.map +1 -0
- package/dist/fence-watcher-DHQ775JB.js +69 -0
- package/dist/fence-watcher-DHQ775JB.js.map +1 -0
- package/dist/find-XRGCNGNN.js +11 -0
- package/dist/forget/index.js +11 -5
- package/dist/forget/index.js.map +1 -1
- package/dist/guards/index.js +4 -4
- package/dist/history/index.js +12 -6
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +50 -31
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +303 -1400
- package/dist/index.js +1525 -184
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +4 -4
- package/dist/issue-UB6AA5M6.js +19 -0
- package/dist/json-schema-I22JCYCG.js +44 -0
- package/dist/json-schema-I22JCYCG.js.map +1 -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 +781 -0
- package/dist/kernel/collection.d.ts +1505 -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 +818 -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 +3147 -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 +1723 -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 +165 -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/lazy/index.js +12 -0
- package/dist/ledger-FU6GH5EH.js +42 -0
- package/dist/legacy/bundle.d.ts +30 -0
- package/dist/legacy/kernel.d.ts +33 -0
- package/dist/liberate-YUN7W5QG.js +24 -0
- package/dist/link-set-MNADSH5M.js +31 -0
- package/dist/materialized-views/index.js +20 -10
- package/dist/noydb-6JLBZU4U.js +67 -0
- package/dist/on/index.js +10 -4
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +21 -7
- package/dist/pod/index.js +12 -6
- package/dist/policy-JTFOPPUU.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 +128 -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-HAWO3O7O.js +55 -0
- package/dist/post-register-HAWO3O7O.js.map +1 -0
- package/dist/public-envelope-NJVB7LPA.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 +9 -6
- package/dist/read-only-facade-CHCKSEPD.js +8 -0
- package/dist/register-VCKOBWKT.js +23 -0
- package/dist/registry-72UKJ2L4.js +9 -0
- package/dist/registry-BZFLJNEH.js +18 -0
- package/dist/registry-YJEYSYI5.js +19 -0
- package/dist/request-withdrawal-6MJRMFHF.js +31 -0
- package/dist/reveal-BOY7XYFH.js +38 -0
- package/dist/reveal-BOY7XYFH.js.map +1 -0
- package/dist/revoke-4KUNSVJC.js +24 -0
- package/dist/satellites/index.js +8 -0
- package/dist/sealed-record/index.js +13 -7
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/seed-4RRXT42N.js +231 -0
- package/dist/seed-4RRXT42N.js.map +1 -0
- package/dist/session/index.js +10 -4
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.js +2 -2
- package/dist/signer-DDDXP5JD.js +25 -0
- package/dist/signer-DDDXP5JD.js.map +1 -0
- package/dist/snapshots/index.js +11 -5
- package/dist/snapshots/index.js.map +1 -1
- package/dist/stale-NXPT56JA.js +14 -0
- package/dist/stale-NXPT56JA.js.map +1 -0
- package/dist/storage-IR6EEAV2.js +23 -0
- package/dist/storage-IR6EEAV2.js.map +1 -0
- package/dist/store-coordination-provider-HPYVFJCV.js +142 -0
- package/dist/sync/index.js +10 -4
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.js +25 -12
- package/dist/tiers/index.js +11 -5
- package/dist/to/index.js +1 -2
- package/dist/tx/index.js +3 -3
- package/dist/util/index.js +1 -1
- package/dist/verify-66RHOW7N.js +139 -0
- package/dist/verify-66RHOW7N.js.map +1 -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 +219 -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 +106 -0
- package/dist/walk-2RWEOCAS.js +241 -0
- package/dist/walk-2RWEOCAS.js.map +1 -0
- package/dist/with/index.js +12 -6
- 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 +207 -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 +69 -0
- package/dist/with-lookup/indexing/persisted-indexes.d.ts +186 -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 +165 -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 +37 -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/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 +26 -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-CLMZEHQT.js +28 -0
- package/dist/withdraw-accessible-CLMZEHQT.js.map +1 -0
- package/package.json +56 -52
- package/dist/adapter/index.d.ts +0 -5
- package/dist/adapter/index.js +0 -15
- package/dist/aggregate/index.d.ts +0 -42
- package/dist/api-RW3KP7WU.js +0 -14
- package/dist/as/index.d.ts +0 -7
- package/dist/at/index.d.ts +0 -5
- package/dist/attestation/index.d.ts +0 -20
- package/dist/backup-XV3IOEGB.js +0 -217
- package/dist/backup-XV3IOEGB.js.map +0 -1
- package/dist/blobs/index.d.ts +0 -44
- package/dist/bundle/index.d.ts +0 -122
- package/dist/bundle-CH-H06dp.d.ts +0 -548
- package/dist/by/index.d.ts +0 -1
- package/dist/cargo/index.d.ts +0 -9
- package/dist/chunk-26LGBE4T.js +0 -42
- package/dist/chunk-26LGBE4T.js.map +0 -1
- package/dist/chunk-2P2HZEXU.js +0 -233
- package/dist/chunk-2P2HZEXU.js.map +0 -1
- package/dist/chunk-3YFXJ3ZP.js +0 -97
- package/dist/chunk-5LUY7UTV.js +0 -380
- package/dist/chunk-5LUY7UTV.js.map +0 -1
- package/dist/chunk-5N6CZTCY.js +0 -367
- package/dist/chunk-5O3AOPDT.js +0 -992
- package/dist/chunk-5O3AOPDT.js.map +0 -1
- package/dist/chunk-5R3ERCDH.js +0 -239
- package/dist/chunk-5R3ERCDH.js.map +0 -1
- package/dist/chunk-5R5JW2JT.js +0 -12502
- package/dist/chunk-5R5JW2JT.js.map +0 -1
- package/dist/chunk-5TDJ56JE.js +0 -32
- package/dist/chunk-5TDJ56JE.js.map +0 -1
- package/dist/chunk-62QYRORB.js +0 -320
- package/dist/chunk-62QYRORB.js.map +0 -1
- package/dist/chunk-6S7T6WC4.js +0 -111
- package/dist/chunk-6S7T6WC4.js.map +0 -1
- package/dist/chunk-76722EBH.js +0 -451
- package/dist/chunk-76722EBH.js.map +0 -1
- package/dist/chunk-AIWULCUO.js +0 -68
- package/dist/chunk-AIWULCUO.js.map +0 -1
- package/dist/chunk-AQTBSL7R.js +0 -181
- package/dist/chunk-AQTBSL7R.js.map +0 -1
- package/dist/chunk-AXRXJTE2.js +0 -59
- package/dist/chunk-AZAOEIKW.js +0 -155
- package/dist/chunk-BG3SPSR4.js +0 -53
- package/dist/chunk-BG3SPSR4.js.map +0 -1
- package/dist/chunk-BGIZAFY7.js +0 -1
- package/dist/chunk-CMGR4ZEW.js +0 -209
- package/dist/chunk-CWPPNPOH.js +0 -23
- package/dist/chunk-DFEMTNPJ.js +0 -1219
- package/dist/chunk-DFEMTNPJ.js.map +0 -1
- package/dist/chunk-DGDI2D4M.js +0 -79
- package/dist/chunk-DGDI2D4M.js.map +0 -1
- package/dist/chunk-EIZUR2XW.js +0 -36
- package/dist/chunk-FISN7WE4.js +0 -798
- package/dist/chunk-FISN7WE4.js.map +0 -1
- package/dist/chunk-GYGWYIOZ.js +0 -200
- package/dist/chunk-GYGWYIOZ.js.map +0 -1
- package/dist/chunk-HCIPRAGS.js +0 -45
- package/dist/chunk-I2NOIW44.js +0 -83
- package/dist/chunk-I2NOIW44.js.map +0 -1
- package/dist/chunk-I3TIKTJO.js +0 -132
- package/dist/chunk-I3TIKTJO.js.map +0 -1
- package/dist/chunk-IAGBDSCS.js +0 -40
- package/dist/chunk-IELYAOGG.js +0 -78
- package/dist/chunk-IELYAOGG.js.map +0 -1
- package/dist/chunk-IGUYVGGI.js +0 -205
- package/dist/chunk-IO6GRPT6.js +0 -34
- package/dist/chunk-IPB7FTQX.js +0 -273
- package/dist/chunk-IPB7FTQX.js.map +0 -1
- package/dist/chunk-ITNUCOXM.js +0 -148
- package/dist/chunk-ITNUCOXM.js.map +0 -1
- package/dist/chunk-IUEN57TV.js +0 -722
- package/dist/chunk-IUEN57TV.js.map +0 -1
- package/dist/chunk-JNUWZ6D3.js +0 -57
- package/dist/chunk-JNUWZ6D3.js.map +0 -1
- package/dist/chunk-K2WCO3NX.js +0 -1
- package/dist/chunk-KVOXU4T5.js +0 -30
- package/dist/chunk-KXGNJJXB.js +0 -135
- package/dist/chunk-LFLXAY2W.js +0 -414
- package/dist/chunk-LFLXAY2W.js.map +0 -1
- package/dist/chunk-LMTH2RM6.js +0 -129
- package/dist/chunk-LV7M27WM.js +0 -702
- package/dist/chunk-LV7M27WM.js.map +0 -1
- package/dist/chunk-LXQT4WMP.js +0 -684
- package/dist/chunk-LXQT4WMP.js.map +0 -1
- package/dist/chunk-M2YKN37S.js +0 -524
- package/dist/chunk-M2YKN37S.js.map +0 -1
- package/dist/chunk-M6OST55S.js +0 -14
- package/dist/chunk-MD3Y6J3L.js +0 -278
- package/dist/chunk-MD3Y6J3L.js.map +0 -1
- package/dist/chunk-MTMJVJ5W.js +0 -73
- package/dist/chunk-MTMJVJ5W.js.map +0 -1
- package/dist/chunk-NF5JWERG.js +0 -74
- package/dist/chunk-PKHL44ER.js +0 -124
- package/dist/chunk-PSMV73A5.js +0 -117
- package/dist/chunk-Q7SS3IME.js +0 -120
- package/dist/chunk-Q7SS3IME.js.map +0 -1
- package/dist/chunk-QHJW5EXU.js +0 -54
- package/dist/chunk-RUEKROOS.js +0 -80
- package/dist/chunk-RUIMKQTA.js +0 -23
- package/dist/chunk-RUIMKQTA.js.map +0 -1
- package/dist/chunk-SKF73JOP.js +0 -355
- package/dist/chunk-SM3AVUHC.js +0 -42
- package/dist/chunk-SMXWYP24.js +0 -155
- package/dist/chunk-SRB2XEWB.js +0 -148
- package/dist/chunk-SRB2XEWB.js.map +0 -1
- package/dist/chunk-TA66UMI4.js +0 -123
- package/dist/chunk-TEILUWOI.js +0 -664
- package/dist/chunk-TEILUWOI.js.map +0 -1
- package/dist/chunk-TJYQIGAP.js +0 -82
- package/dist/chunk-TJYQIGAP.js.map +0 -1
- package/dist/chunk-UAG5KWVA.js +0 -367
- package/dist/chunk-UDRIWL7A.js +0 -382
- package/dist/chunk-UIU2THRG.js +0 -1937
- package/dist/chunk-UIU2THRG.js.map +0 -1
- package/dist/chunk-UPJNJGGA.js +0 -572
- package/dist/chunk-UPJNJGGA.js.map +0 -1
- package/dist/chunk-UV5MFVO3.js +0 -21
- package/dist/chunk-V7RWQRG7.js +0 -430
- package/dist/chunk-VCTFO5CO.js +0 -71
- package/dist/chunk-VFQGRQIH.js +0 -97
- package/dist/chunk-VFQGRQIH.js.map +0 -1
- package/dist/chunk-WWGT2MDV.js +0 -762
- package/dist/chunk-WWGT2MDV.js.map +0 -1
- package/dist/chunk-WYSO2NIH.js +0 -30
- package/dist/chunk-XXYIOFUB.js +0 -164
- package/dist/chunk-Y22T3KQE.js +0 -261
- package/dist/chunk-Y22T3KQE.js.map +0 -1
- package/dist/chunk-ZCGAHGUS.js +0 -230
- package/dist/chunk-ZYUC53LT.js +0 -1370
- package/dist/chunk-ZYUC53LT.js.map +0 -1
- package/dist/collection-facade-GQAOGJP2.js +0 -33
- package/dist/consent/index.d.ts +0 -23
- package/dist/crdt/index.d.ts +0 -34
- package/dist/decrypt-partition-IHtxEnTi.d.ts +0 -21
- package/dist/delegation-UL5HKLER.js +0 -19
- package/dist/derivations/index.d.ts +0 -70
- package/dist/describe/index.d.ts +0 -1
- package/dist/describe/index.js +0 -1
- package/dist/describe-aBkJR2sd.d.ts +0 -131
- package/dist/dev-unlock-C9Ro3v_O.d.ts +0 -263
- package/dist/discriminant-BN9REW3o.d.ts +0 -60
- package/dist/enclave-UL5LW66V.js +0 -88
- package/dist/executor-2FWQRLMG.js +0 -15
- package/dist/executor-QZ7BXICW.js +0 -9
- package/dist/executor-Z5ZLJVTV.js +0 -9
- package/dist/export-accessible-KRV5W4GH.js +0 -17
- package/dist/extract-partition-GLKBOXFQ.js +0 -30
- package/dist/fanout-sidecar-GF3DJ6KR.js +0 -71
- package/dist/fanout-sidecar-GF3DJ6KR.js.map +0 -1
- package/dist/forget/index.d.ts +0 -36
- package/dist/guards/index.d.ts +0 -35
- package/dist/hash-Cp5uwiox.d.ts +0 -67
- package/dist/history/index.d.ts +0 -61
- package/dist/i18n/index.d.ts +0 -37
- package/dist/in/index.d.ts +0 -5
- package/dist/index-B9QdHytu.d.ts +0 -123
- package/dist/index-BF9_96A5.d.ts +0 -123
- package/dist/index-BzUo1B6n.d.ts +0 -20730
- package/dist/indexing/index.d.ts +0 -39
- package/dist/issue-Y6UVIR43.js +0 -13
- package/dist/kernel/index.d.ts +0 -32
- package/dist/kernel/index.js +0 -53
- package/dist/ledger-RYI35CDS.js +0 -36
- package/dist/liberate-CRPZEV7O.js +0 -18
- package/dist/materialized-views/index.d.ts +0 -173
- package/dist/mime-magic-CGhw37_E.d.ts +0 -103
- package/dist/noydb-367AM4HT.js +0 -50
- package/dist/on/index.d.ts +0 -5
- package/dist/overlay-views/index.d.ts +0 -98
- package/dist/periods/index.d.ts +0 -20
- package/dist/pod/index.d.ts +0 -63
- package/dist/policy-IXK4FVXP.js +0 -41
- package/dist/portability/index.d.ts +0 -20
- package/dist/public-envelope-JHDQCPSX.js +0 -32
- package/dist/query/index.d.ts +0 -5
- package/dist/read-only-facade-5ADRJVTM.js +0 -8
- package/dist/registry-45RJNWGU.js +0 -9
- package/dist/registry-5GRV5VXI.js +0 -13
- package/dist/registry-WEUCHBO4.js +0 -11
- package/dist/request-withdrawal-GBPH2FDY.js +0 -25
- package/dist/revoke-TUFRGI6S.js +0 -18
- package/dist/sealed-record/index.d.ts +0 -69
- package/dist/session/index.d.ts +0 -44
- package/dist/shadow/index.d.ts +0 -15
- package/dist/signer-PNKTBVF7.js +0 -19
- package/dist/snapshots/index.d.ts +0 -26
- package/dist/stale-3JWHNDIY.js +0 -14
- package/dist/store-coordination-provider-3I7XWZZK.js +0 -142
- package/dist/subject-index-O75wKshW.d.ts +0 -362
- package/dist/sync/index.d.ts +0 -41
- package/dist/team/index.d.ts +0 -116
- package/dist/tiers/index.d.ts +0 -5
- package/dist/to/index.d.ts +0 -5
- package/dist/transition-guard-C7ol6oPw.d.ts +0 -165
- package/dist/tx/index.d.ts +0 -35
- package/dist/ui/index.d.ts +0 -1
- package/dist/ulid-DRH25k3y.d.ts +0 -66
- package/dist/util/index.d.ts +0 -79
- package/dist/vault-diff-B5fYNBL7.d.ts +0 -147
- package/dist/with/index.d.ts +0 -38
- package/dist/with-materialized-view-6p0Fk8bL.d.ts +0 -27
- package/dist/with-overlayed-view-BJ6mXGMd.d.ts +0 -12
- package/dist/with-rollup-BvQo3ROo.d.ts +0 -47
- package/dist/withdraw-accessible-FFS46EOD.js +0 -22
- /package/dist/{adapter/index.js.map → api-YGMINAET.js.map} +0 -0
- /package/dist/{chunk-V7RWQRG7.js.map → chunk-3CNQ7FQ3.js.map} +0 -0
- /package/dist/{chunk-NF5JWERG.js.map → chunk-3MSQLQNZ.js.map} +0 -0
- /package/dist/{chunk-IO6GRPT6.js.map → chunk-4R4Q64W5.js.map} +0 -0
- /package/dist/{chunk-SMXWYP24.js.map → chunk-5XIPOCQC.js.map} +0 -0
- /package/dist/{chunk-IGUYVGGI.js.map → chunk-6QILBDZU.js.map} +0 -0
- /package/dist/{chunk-AZAOEIKW.js.map → chunk-7E67FJ33.js.map} +0 -0
- /package/dist/{chunk-PSMV73A5.js.map → chunk-7NS43EXZ.js.map} +0 -0
- /package/dist/{chunk-CMGR4ZEW.js.map → chunk-A2Y6YFVN.js.map} +0 -0
- /package/dist/{chunk-HCIPRAGS.js.map → chunk-BCYQA5BK.js.map} +0 -0
- /package/dist/{chunk-LMTH2RM6.js.map → chunk-CB25ONKC.js.map} +0 -0
- /package/dist/{chunk-UV5MFVO3.js.map → chunk-CIKY6I4W.js.map} +0 -0
- /package/dist/{chunk-QHJW5EXU.js.map → chunk-D26JB3LZ.js.map} +0 -0
- /package/dist/{chunk-SM3AVUHC.js.map → chunk-DIRRS7WP.js.map} +0 -0
- /package/dist/{chunk-SKF73JOP.js.map → chunk-H44ZE4IE.js.map} +0 -0
- /package/dist/{chunk-UDRIWL7A.js.map → chunk-HFJIGWJC.js.map} +0 -0
- /package/dist/{chunk-ZCGAHGUS.js.map → chunk-KPGX66PM.js.map} +0 -0
- /package/dist/{chunk-5N6CZTCY.js.map → chunk-MCEKIAO4.js.map} +0 -0
- /package/dist/{chunk-CWPPNPOH.js.map → chunk-O2DYPAZY.js.map} +0 -0
- /package/dist/{chunk-KVOXU4T5.js.map → chunk-ODJWBC5I.js.map} +0 -0
- /package/dist/{chunk-VCTFO5CO.js.map → chunk-OFJ5GPNA.js.map} +0 -0
- /package/dist/{chunk-KXGNJJXB.js.map → chunk-PXWVF7MC.js.map} +0 -0
- /package/dist/{chunk-IAGBDSCS.js.map → chunk-Q3XSMOZM.js.map} +0 -0
- /package/dist/{chunk-AXRXJTE2.js.map → chunk-RKRGDAS7.js.map} +0 -0
- /package/dist/{chunk-XXYIOFUB.js.map → chunk-SRVQHVNX.js.map} +0 -0
- /package/dist/{chunk-M6OST55S.js.map → chunk-UFILRICG.js.map} +0 -0
- /package/dist/{chunk-3YFXJ3ZP.js.map → chunk-UTLEAJXC.js.map} +0 -0
- /package/dist/{chunk-TA66UMI4.js.map → chunk-VA4ZWLFY.js.map} +0 -0
- /package/dist/{chunk-UAG5KWVA.js.map → chunk-VR24ILCR.js.map} +0 -0
- /package/dist/{chunk-WYSO2NIH.js.map → chunk-XHV25KBM.js.map} +0 -0
- /package/dist/{chunk-PKHL44ER.js.map → chunk-YSXEFGND.js.map} +0 -0
- /package/dist/{chunk-EIZUR2XW.js.map → chunk-YXOUQ2H7.js.map} +0 -0
- /package/dist/{chunk-RUEKROOS.js.map → chunk-ZP5PL65C.js.map} +0 -0
- /package/dist/{describe → classified}/index.js.map +0 -0
- /package/dist/{api-RW3KP7WU.js.map → collection-facade-YE2O4J4O.js.map} +0 -0
- /package/dist/{chunk-BGIZAFY7.js.map → computed-W6MVAMWZ.js.map} +0 -0
- /package/dist/{chunk-K2WCO3NX.js.map → delegation-OPUU3R2E.js.map} +0 -0
- /package/dist/{collection-facade-GQAOGJP2.js.map → derive-BGUHU663.js.map} +0 -0
- /package/dist/{delegation-UL5HKLER.js.map → enclave-VXAQD4XJ.js.map} +0 -0
- /package/dist/{enclave-UL5LW66V.js.map → executor-GTVSUUBX.js.map} +0 -0
- /package/dist/{executor-2FWQRLMG.js.map → executor-GZWMTOXB.js.map} +0 -0
- /package/dist/{executor-QZ7BXICW.js.map → executor-XXGS4S3K.js.map} +0 -0
- /package/dist/{executor-Z5ZLJVTV.js.map → export-accessible-BMULIOYB.js.map} +0 -0
- /package/dist/{export-accessible-KRV5W4GH.js.map → extract-partition-JUQTWDXR.js.map} +0 -0
- /package/dist/{extract-partition-GLKBOXFQ.js.map → find-XRGCNGNN.js.map} +0 -0
- /package/dist/{issue-Y6UVIR43.js.map → issue-UB6AA5M6.js.map} +0 -0
- /package/dist/{kernel → lazy}/index.js.map +0 -0
- /package/dist/{ledger-RYI35CDS.js.map → ledger-FU6GH5EH.js.map} +0 -0
- /package/dist/{liberate-CRPZEV7O.js.map → liberate-YUN7W5QG.js.map} +0 -0
- /package/dist/{noydb-367AM4HT.js.map → link-set-MNADSH5M.js.map} +0 -0
- /package/dist/{policy-IXK4FVXP.js.map → noydb-6JLBZU4U.js.map} +0 -0
- /package/dist/{public-envelope-JHDQCPSX.js.map → policy-JTFOPPUU.js.map} +0 -0
- /package/dist/{read-only-facade-5ADRJVTM.js.map → public-envelope-NJVB7LPA.js.map} +0 -0
- /package/dist/{registry-45RJNWGU.js.map → read-only-facade-CHCKSEPD.js.map} +0 -0
- /package/dist/{registry-5GRV5VXI.js.map → register-VCKOBWKT.js.map} +0 -0
- /package/dist/{registry-WEUCHBO4.js.map → registry-72UKJ2L4.js.map} +0 -0
- /package/dist/{request-withdrawal-GBPH2FDY.js.map → registry-BZFLJNEH.js.map} +0 -0
- /package/dist/{revoke-TUFRGI6S.js.map → registry-YJEYSYI5.js.map} +0 -0
- /package/dist/{signer-PNKTBVF7.js.map → request-withdrawal-6MJRMFHF.js.map} +0 -0
- /package/dist/{stale-3JWHNDIY.js.map → revoke-4KUNSVJC.js.map} +0 -0
- /package/dist/{withdraw-accessible-FFS46EOD.js.map → satellites/index.js.map} +0 -0
- /package/dist/{store-coordination-provider-3I7XWZZK.js.map → store-coordination-provider-HPYVFJCV.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-commit/history/history.ts","../src/with-commit/history/time-machine.ts"],"sourcesContent":["import type { NoydbStore, EncryptedEnvelope, HistoryOptions, PruneOptions } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { isTombstone } from '../../kernel/enclave/index.js'\n\n/**\n * History storage convention:\n * Collection: `_history`\n * ID format: `{collection}:{recordId}:{paddedVersion}`\n * Version is zero-padded to 10 digits for lexicographic sorting.\n */\n\nconst HISTORY_COLLECTION = '_history'\nconst VERSION_PAD = 10\n\nfunction historyId(collection: string, recordId: string, version: number): string {\n return `${collection}:${recordId}:${String(version).padStart(VERSION_PAD, '0')}`\n}\n\n// Unused today, kept for future history-id parsing utilities.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nfunction parseHistoryId(id: string): { collection: string; recordId: string; version: number } | null {\n const lastColon = id.lastIndexOf(':')\n if (lastColon < 0) return null\n const versionStr = id.slice(lastColon + 1)\n const rest = id.slice(0, lastColon)\n const firstColon = rest.indexOf(':')\n if (firstColon < 0) return null\n return {\n collection: rest.slice(0, firstColon),\n recordId: rest.slice(firstColon + 1),\n version: parseInt(versionStr, 10),\n }\n}\n\nfunction matchesPrefix(id: string, collection: string, recordId?: string): boolean {\n if (recordId) {\n return id.startsWith(`${collection}:${recordId}:`)\n }\n return id.startsWith(`${collection}:`)\n}\n\n/** Save a history entry (a complete encrypted envelope snapshot). */\nexport async function saveHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n envelope: EncryptedEnvelope,\n): Promise<void> {\n const id = historyId(collection, recordId, envelope._v)\n await adapter.put(vault, HISTORY_COLLECTION, id, envelope)\n}\n\n/** Get history entries for a record, sorted newest-first. */\nexport async function getHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n options?: HistoryOptions,\n): Promise<EncryptedEnvelope[]> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => matchesPrefix(id, collection, recordId))\n .sort()\n .reverse() // newest first\n\n const entries: EncryptedEnvelope[] = []\n\n for (const id of matchingIds) {\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!envelope) continue\n\n // Apply time filters\n if (options?.from && envelope._ts < options.from) continue\n if (options?.to && envelope._ts > options.to) continue\n\n entries.push(envelope)\n\n if (options?.limit && entries.length >= options.limit) break\n }\n\n return entries\n}\n\n/** Get a specific version's envelope from history. */\nexport async function getVersionEnvelope(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n version: number,\n): Promise<EncryptedEnvelope | null> {\n const id = historyId(collection, recordId, version)\n return adapter.get(vault, HISTORY_COLLECTION, id)\n}\n\n/** Prune history entries. Returns the number of entries deleted. */\nexport async function pruneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string | undefined,\n options: PruneOptions,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds\n .filter(id => recordId ? matchesPrefix(id, collection, recordId) : matchesPrefix(id, collection))\n .sort()\n\n let toDelete: string[] = []\n\n if (options.keepVersions !== undefined) {\n // Keep only the N most recent, delete the rest\n const keep = options.keepVersions\n if (matchingIds.length > keep) {\n toDelete = matchingIds.slice(0, matchingIds.length - keep)\n }\n }\n\n if (options.beforeDate) {\n // Delete entries older than the specified date\n for (const id of matchingIds) {\n if (toDelete.includes(id)) continue\n const envelope = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (envelope && envelope._ts < options.beforeDate) {\n toDelete.push(id)\n }\n }\n }\n\n // Deduplicate\n const uniqueDeletes = [...new Set(toDelete)]\n\n for (const id of uniqueDeletes) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return uniqueDeletes.length\n}\n\n/** Clear all history for a vault, optionally scoped to a collection or record. */\nexport async function clearHistory(\n adapter: NoydbStore,\n vault: string,\n collection?: string,\n recordId?: string,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n let toDelete: string[]\n\n if (collection && recordId) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection, recordId))\n } else if (collection) {\n toDelete = allIds.filter(id => matchesPrefix(id, collection))\n } else {\n toDelete = allIds\n }\n\n for (const id of toDelete) {\n await adapter.delete(vault, HISTORY_COLLECTION, id)\n }\n\n return toDelete.length\n}\n\n/**\n * Crypto-shred every `_history` version of a record. Each non-tombstone\n * history envelope is OVERWRITTEN in place with a tombstone\n * `{ _noydb, _v, _ts: now, _by: actor, _iv: '', _data: '' }` — dropping\n * `_iv`/`_data`/`_cek`/`_det`, so the prior ciphertext (and the wrapped CEK\n * that could decrypt it) is gone everywhere this store reaches. The version\n * counter (`_v`) is preserved so the audit trail still shows \"N versions\n * existed and were erased.\"\n *\n * Overwrite — NOT delete — so the history key itself survives as proof the\n * version existed. Already-tombstoned versions (re-run / idempotent forget)\n * are left untouched and not counted.\n *\n * Returns the number of history versions newly tombstoned.\n */\nexport async function tombstoneHistory(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n recordId: string,\n actor: string,\n encrypted: boolean,\n): Promise<number> {\n const allIds = await adapter.list(vault, HISTORY_COLLECTION)\n const matchingIds = allIds.filter(id => matchesPrefix(id, collection, recordId))\n\n const now = new Date().toISOString()\n let count = 0\n for (const id of matchingIds) {\n const env = await adapter.get(vault, HISTORY_COLLECTION, id)\n if (!env) continue\n // Already a tombstone (no body and no wrapped CEK)? Skip — idempotent.\n if (isTombstone(env, encrypted)) continue\n const tombstone: EncryptedEnvelope = {\n _noydb: NOYDB_FORMAT_VERSION,\n _v: env._v,\n _ts: now,\n _iv: '',\n _data: '',\n ...(actor ? { _by: actor } : {}),\n }\n await adapter.put(vault, HISTORY_COLLECTION, id, tombstone)\n count++\n }\n return count\n}\n","/**\n * Time-machine queries — point-in-time reads reconstructed from the\n * existing history + ledger infrastructure.\n *\n * ## Usage\n *\n * ```ts\n * const vault = await db.openVault('acme', { passphrase })\n * const q1End = vault.at('2026-03-31T23:59:59Z')\n * const invoice = await q1End.collection<Invoice>('invoices').get('inv-001')\n * // → the record as it stood at the close of Q1 2026\n * ```\n *\n * ## How it works\n *\n * Every write path already fans out into two persistence lanes:\n *\n * 1. `saveHistory(...)` persists a **full encrypted envelope snapshot**\n * per version under the `_history` collection (one envelope per\n * version, keyed by `{collection}:{id}:{paddedVersion}`). Each\n * envelope carries its own `_ts` (the write timestamp).\n * 2. `ledger.append(...)` appends a hash-chained audit entry that\n * records the `op` (put / delete), `version`, and `ts`.\n *\n * Reconstruction at a target timestamp T is therefore:\n *\n * - Find the newest history envelope for `(collection, id)` whose\n * `_ts ≤ T` — that's the state the record was in at T.\n * - Check the ledger for any `op: 'delete'` entry for the same\n * `(collection, id)` with `entry.ts` in `(latestEnvelope._ts, T]` —\n * if present, the record was deleted before T, so return `null`.\n * - Decrypt the surviving envelope with the current collection DEK\n * (DEKs are per-collection but stable across versions — the same\n * key encrypts v1 and v15 of a record).\n *\n * No delta replay. The existing `history.ts` module already stores\n * complete snapshots; we just pick the right one.\n *\n * ## Read-only contract\n *\n * Every write method on `CollectionInstant` throws\n * {@link ReadOnlyAtInstantError}. A historical view is a *read*\n * surface — mutating the past would require either a branch/shadow\n * mechanism (tracked under shadow vaults) or a rewrite of\n * history, which breaks the ledger's tamper-evidence guarantee.\n *\n * @module\n */\nimport type { EncryptedEnvelope, NoydbStore } from '../../kernel/types.js'\nimport type { LedgerStore } from './ledger/store.js'\nimport { getHistory } from './history.js'\nimport { decrypt, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { ReadOnlyAtInstantError } from '../../kernel/errors.js'\n\n/**\n * Narrow view of a {@link Vault}'s internals that\n * {@link VaultInstant} needs. Passed in by `Vault.at()` rather than\n * constructed here so all crypto + adapter access stays inside the\n * Vault class.\n *\n * Not exported from the public barrel — consumers should get a\n * `VaultInstant` via `vault.at(ts)`, never by constructing one\n * directly.\n */\nexport interface VaultEngine {\n readonly adapter: NoydbStore\n /** Vault name (the compartment). */\n readonly name: string\n /**\n * `true` when the vault was opened with a passphrase (the normal\n * case). `false` in plaintext-mode vaults (`encrypt: false`) — in\n * that case `envelope._data` is raw JSON and we skip the DEK lookup.\n */\n readonly encrypted: boolean\n /**\n * Resolves the DEK used to decrypt a given collection's envelopes.\n * Not called when `encrypted` is false.\n */\n getDEK(collection: string): Promise<EnclaveKey>\n /**\n * Lazily-initialised ledger. We consult it to detect deletes that\n * happened between the latest history snapshot and the target\n * timestamp. `null` when history is disabled for this vault — in\n * that case time-machine reads fall back to history-only\n * reconstruction (which may miss deletes).\n */\n getLedger(): LedgerStore | null\n}\n\n/**\n * A vault at a fixed instant. Produced by `vault.at(timestamp)`.\n * Carries no session state of its own — every read is a fresh\n * lookup through the vault's adapter.\n *\n * Cheap to construct; safe to throw away. Create one per query.\n */\nexport class VaultInstant {\n constructor(\n private readonly engine: VaultEngine,\n /** Fully-resolved target timestamp (ISO-8601 UTC). */\n public readonly timestamp: string,\n ) {}\n\n /** Get a point-in-time view of a collection. */\n collection<T = unknown>(name: string): CollectionInstant<T> {\n return new CollectionInstant<T>(this.engine, this.timestamp, name)\n }\n}\n\n/**\n * A read-only collection view anchored to a past instant.\n *\n * Every write method throws {@link ReadOnlyAtInstantError} — see the\n * module docstring for why. The read surface is intentionally smaller\n * than the live {@link Collection}: `get` and `list` cover the\n * \"what did the books look like on date X\" use case without pulling\n * in the full query DSL / joins / aggregates at this stage. Follow-up\n * work tracked under.\n */\nexport class CollectionInstant<T = unknown> {\n constructor(\n private readonly engine: VaultEngine,\n private readonly targetTs: string,\n public readonly name: string,\n ) {}\n\n /**\n * Return the record as it existed at the target timestamp, or\n * `null` if the record had not been created yet or had already been\n * deleted by then.\n */\n async get(id: string): Promise<T | null> {\n const envelope = await this.resolveEnvelope(id)\n if (!envelope) return null\n const plaintext = this.engine.encrypted\n ? await decrypt(envelope._iv, envelope._data, await this.engine.getDEK(this.name))\n : envelope._data\n return JSON.parse(plaintext) as T\n }\n\n /**\n * IDs of records that existed (had at least one `put` and were not\n * subsequently deleted) at the target timestamp.\n *\n * Implemented as a linear scan over history + ledger. Performance\n * is bounded by total history size (not live-vault size), so the\n * memory-first vault-scale cap (1K–50K records × average history\n * depth) still applies.\n */\n async list(): Promise<string[]> {\n const historyIds = await collectHistoryIds(this.engine.adapter, this.engine.name, this.name)\n const liveIds = await this.engine.adapter.list(this.engine.name, this.name)\n const candidateIds = new Set<string>([...historyIds, ...liveIds])\n const alive: string[] = []\n for (const id of candidateIds) {\n const env = await this.resolveEnvelope(id)\n if (env) alive.push(id)\n }\n return alive.sort()\n }\n\n // ── write guards ───────────────────────────────────────────────────\n\n async put(_id: string, _record: T): Promise<never> {\n throw new ReadOnlyAtInstantError('put', this.targetTs)\n }\n async delete(_id: string): Promise<never> {\n throw new ReadOnlyAtInstantError('delete', this.targetTs)\n }\n async update(_id: string, _patch: Partial<T>): Promise<never> {\n throw new ReadOnlyAtInstantError('update', this.targetTs)\n }\n\n // ── internals ─────────────────────────────────────────────────────\n\n /**\n * Return the envelope that represents the record's state at\n * `targetTs`, accounting for deletes. `null` if the record didn't\n * exist at that instant.\n *\n * ## Why we use the ledger as the authoritative timeline\n *\n * The per-version history snapshots saved by `saveHistory()` do\n * carry a `_ts` field, but that timestamp is the moment the\n * snapshot was *captured* (i.e. the instant right before the\n * subsequent overwrite), not the original write time. The ledger,\n * by contrast, records `ts` at the moment of each `put` / `delete`\n * — it's the only source that tracks the real timeline. So:\n *\n * 1. Walk the ledger; find the latest entry for `(collection, id)`\n * with `ts ≤ targetTs`.\n * 2. If that entry is a `delete`, the record was gone at the\n * target instant — return null.\n * 3. Otherwise it's a `put` with a specific `version`. Load the\n * envelope for that version from history, falling back to the\n * live collection for the most recent version.\n *\n * ## Fallback when the ledger is disabled\n *\n * If the vault has history disabled, `getLedger()` returns null and\n * we fall back to comparing envelope `_ts` fields. This is\n * approximate and gets the *last write* right but may confuse the\n * intermediate versions; adopters needing accurate time-machine\n * reads should leave history enabled.\n */\n private async resolveEnvelope(id: string): Promise<EncryptedEnvelope | null> {\n const ledger = this.engine.getLedger()\n if (ledger) {\n return this.resolveViaLedger(id, ledger)\n }\n return this.resolveViaEnvelopeTs(id)\n }\n\n private async resolveViaLedger(id: string, ledger: LedgerStore): Promise<EncryptedEnvelope | null> {\n const entries = await ledger.entries()\n // Entries are already ordered by index which is the mutation order.\n let latest: { op: 'put' | 'delete'; version: number } | null = null\n for (const e of entries) {\n if (e.collection !== this.name || e.id !== id) continue\n if (e.ts > this.targetTs) break // entries are time-ordered by index\n // `amendment` + `lifecycle` entries are audit-only summaries — they\n // carry no (collection, id) tuple of their own and would never match\n // the filter above. The narrow here is a type guard, not a runtime\n // skip.\n // `forget` is a subject-erasure summary with empty (collection, id) —\n // never matches the filter above; the narrow is a type guard.\n if (e.op === 'amendment' || e.op === 'lifecycle' || e.op === 'forget') continue\n // `migration` is a record rewrite (cutover) — resolve it like a put.\n latest = { op: e.op === 'migration' ? 'put' : e.op, version: e.version }\n }\n if (!latest) return null\n if (latest.op === 'delete') return null\n return this.loadVersion(id, latest.version)\n }\n\n private async resolveViaEnvelopeTs(id: string): Promise<EncryptedEnvelope | null> {\n const history = await getHistory(\n this.engine.adapter, this.engine.name, this.name, id,\n )\n const live = await this.engine.adapter.get(this.engine.name, this.name, id)\n const byVersion = new Map<number, EncryptedEnvelope>()\n for (const e of history) byVersion.set(e._v, e)\n if (live) byVersion.set(live._v, live)\n const sorted = [...byVersion.values()].sort((a, b) =>\n a._ts < b._ts ? 1 : a._ts > b._ts ? -1 : 0,\n )\n return sorted.find((e) => e._ts <= this.targetTs) ?? null\n }\n\n /**\n * Fetch the envelope for a specific version. The live record (most\n * recent put) lives in the main collection; prior versions live in\n * `_history`. We check live first because the common case after a\n * delete is that we're trying to load the last-live version from\n * history, and skipping live for the current-version case avoids a\n * redundant lookup.\n */\n private async loadVersion(id: string, version: number): Promise<EncryptedEnvelope | null> {\n const live = await this.engine.adapter.get(this.engine.name, this.name, id)\n if (live && live._v === version) return live\n\n // Direct lookup by (collection, id, version) — avoids scanning all history.\n const historyId = `${this.name}:${id}:${String(version).padStart(10, '0')}`\n return await this.engine.adapter.get(this.engine.name, '_history', historyId)\n }\n}\n\n/**\n * Scan the `_history` collection once and collect every distinct\n * `recordId` for the given collection. History keys follow the\n * shape `<collection>:<recordId>:<paddedVersion>`; we split on the\n * last two colons (delimiter-safe because `paddedVersion` is\n * exactly 10 digits).\n */\nasync function collectHistoryIds(\n adapter: NoydbStore,\n vault: string,\n collection: string,\n): Promise<string[]> {\n const all = await adapter.list(vault, '_history')\n const prefix = `${collection}:`\n const seen = new Set<string>()\n for (const key of all) {\n if (!key.startsWith(prefix)) continue\n const lastColon = key.lastIndexOf(':')\n if (lastColon <= prefix.length) continue\n const middle = key.slice(prefix.length, lastColon)\n seen.add(middle)\n }\n return [...seen]\n}\n"],"mappings":";;;;;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O;AAGxC,UAAMA,aAAY,GAAG,KAAK,IAAI,IAAI,EAAE,IAAI,OAAO,OAAO,EAAE,SAAS,IAAI,GAAG,CAAC;AACzE,WAAO,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,OAAO,MAAM,YAAYA,UAAS;AAAA,EAC9E;AACF;AASA,eAAe,kBACb,SACA,OACA,YACmB;AACnB,QAAM,MAAM,MAAM,QAAQ,KAAK,OAAO,UAAU;AAChD,QAAM,SAAS,GAAG,UAAU;AAC5B,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,OAAO,KAAK;AACrB,QAAI,CAAC,IAAI,WAAW,MAAM,EAAG;AAC7B,UAAM,YAAY,IAAI,YAAY,GAAG;AACrC,QAAI,aAAa,OAAO,OAAQ;AAChC,UAAM,SAAS,IAAI,MAAM,OAAO,QAAQ,SAAS;AACjD,SAAK,IAAI,MAAM;AAAA,EACjB;AACA,SAAO,CAAC,GAAG,IAAI;AACjB;","names":["historyId"]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
base64ToBuffer,
|
|
3
|
+
decryptBytesWithAAD,
|
|
4
|
+
encryptBytesWithAAD
|
|
5
|
+
} from "./chunk-HUS3J5WM.js";
|
|
6
|
+
import {
|
|
7
|
+
TamperedError
|
|
8
|
+
} from "./chunk-FH542DDY.js";
|
|
9
|
+
|
|
10
|
+
// src/kernel/enclave/classify/compare.ts
|
|
11
|
+
var subtle = globalThis.crypto.subtle;
|
|
12
|
+
function ctEqualTags(a, b) {
|
|
13
|
+
if (a.length !== 32 || b.length !== 32) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
`ctEqualTags: tags must be exactly 32 bytes (got ${a.length}/${b.length}) \u2014 caller bug; reduce comparands with blindedEqual first`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
let diff = 0;
|
|
19
|
+
for (let i = 0; i < 32; i++) diff |= a[i] ^ b[i];
|
|
20
|
+
return diff === 0;
|
|
21
|
+
}
|
|
22
|
+
async function blindedEqual(a, b) {
|
|
23
|
+
const ke = await subtle.generateKey({ name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
24
|
+
const tagA = new Uint8Array(await subtle.sign("HMAC", ke, a));
|
|
25
|
+
const tagB = new Uint8Array(await subtle.sign("HMAC", ke, b));
|
|
26
|
+
return ctEqualTags(tagA, tagB);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/kernel/enclave/classify/vdig.ts
|
|
30
|
+
var subtle2 = globalThis.crypto.subtle;
|
|
31
|
+
var VDIG_SALT_DOMAIN = "noydb-classify-vdig";
|
|
32
|
+
function buildVdigAad(collection, recordId, field) {
|
|
33
|
+
return new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, recordId, field]));
|
|
34
|
+
}
|
|
35
|
+
async function deriveVdigSlotKey(cek, collection, field) {
|
|
36
|
+
const raw = await subtle2.exportKey("raw", cek);
|
|
37
|
+
const hkdf = await subtle2.importKey("raw", raw, "HKDF", false, ["deriveBits"]);
|
|
38
|
+
const salt = new TextEncoder().encode(VDIG_SALT_DOMAIN);
|
|
39
|
+
const info = new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, field]));
|
|
40
|
+
const bits = await subtle2.deriveBits({ name: "HKDF", hash: "SHA-256", salt, info }, hkdf, 256);
|
|
41
|
+
return subtle2.importKey("raw", bits, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
|
|
42
|
+
}
|
|
43
|
+
async function sealVdigPayload(payload, cek, collection, recordId, field) {
|
|
44
|
+
const key = await deriveVdigSlotKey(cek, collection, field);
|
|
45
|
+
const { iv, data } = await encryptBytesWithAAD(
|
|
46
|
+
new TextEncoder().encode(JSON.stringify(payload)),
|
|
47
|
+
key,
|
|
48
|
+
buildVdigAad(collection, recordId, field)
|
|
49
|
+
);
|
|
50
|
+
return `${iv}:${data}`;
|
|
51
|
+
}
|
|
52
|
+
async function openVdigPayload(blob, cek, collection, recordId, field) {
|
|
53
|
+
const sep = blob.indexOf(":");
|
|
54
|
+
if (sep === -1) throw new TamperedError();
|
|
55
|
+
const ivPart = blob.slice(0, sep);
|
|
56
|
+
const dataPart = blob.slice(sep + 1);
|
|
57
|
+
try {
|
|
58
|
+
base64ToBuffer(ivPart);
|
|
59
|
+
base64ToBuffer(dataPart);
|
|
60
|
+
} catch {
|
|
61
|
+
throw new TamperedError();
|
|
62
|
+
}
|
|
63
|
+
const key = await deriveVdigSlotKey(cek, collection, field);
|
|
64
|
+
const bytes = await decryptBytesWithAAD(
|
|
65
|
+
ivPart,
|
|
66
|
+
dataPart,
|
|
67
|
+
key,
|
|
68
|
+
buildVdigAad(collection, recordId, field)
|
|
69
|
+
);
|
|
70
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/kernel/enclave/classify/kofn.ts
|
|
74
|
+
function evaluateKofN(results, min) {
|
|
75
|
+
if (!Number.isInteger(min) || min < 1 || min > results.length) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`evaluateKofN: min ${min} out of range 1..${results.length} \u2014 caller bug (matchGroup validates bounds up front, before any PBKDF2)`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
let count = 0;
|
|
81
|
+
for (const r of results) {
|
|
82
|
+
if (r) count += 1;
|
|
83
|
+
}
|
|
84
|
+
return count >= min;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
ctEqualTags,
|
|
89
|
+
blindedEqual,
|
|
90
|
+
deriveVdigSlotKey,
|
|
91
|
+
sealVdigPayload,
|
|
92
|
+
openVdigPayload,
|
|
93
|
+
evaluateKofN
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=chunk-MSPNM2OM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kernel/enclave/classify/compare.ts","../src/kernel/enclave/classify/vdig.ts","../src/kernel/enclave/classify/kofn.ts"],"sourcesContent":["/**\n * C2 — fixed-length-tag constant-time comparison (hub-portable; no\n * Node timingSafeEqual). Two mandatory rules (spec §3):\n * 1. Only fixed 32-byte tags are ever compared — ctEqualTags throws on\n * anything else (tag length is structural, never secret-dependent).\n * 2. Every comparand is reduced to a 32-byte tag under a FRESH ephemeral\n * HMAC-SHA256 key before comparison — keyed blinding makes compare\n * timing uncorrelated with underlying values; rule 1 (not blinding)\n * is what removes input-length timing. Length inequality folds into\n * unequal tags — never an early return.\n * @module\n */\nconst subtle = globalThis.crypto.subtle\n\n/** Compare exactly-32-byte tags. XOR-accumulate over all 32 bytes, no early exit. */\nexport function ctEqualTags(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== 32 || b.length !== 32) {\n throw new Error(\n `ctEqualTags: tags must be exactly 32 bytes (got ${a.length}/${b.length}) — caller bug; ` +\n `reduce comparands with blindedEqual first`,\n )\n }\n let diff = 0\n for (let i = 0; i < 32; i++) diff |= (a[i]! ^ b[i]!)\n return diff === 0\n}\n\n/**\n * Blinded equality of arbitrary-length byte strings: fresh K_e per\n * comparison (never stored, never reused), HMAC both sides to 32-byte\n * tags, then ctEqualTags. On the digest path the inputs are already\n * 32-byte PBKDF2 outputs but still route through this reduction so\n * there is exactly ONE comparison construction (spec §3 rule 2).\n */\nexport async function blindedEqual(a: Uint8Array, b: Uint8Array): Promise<boolean> {\n const ke = await subtle.generateKey({ name: 'HMAC', hash: 'SHA-256' }, false, ['sign'])\n const tagA = new Uint8Array(await subtle.sign('HMAC', ke, a as BufferSource))\n const tagB = new Uint8Array(await subtle.sign('HMAC', ke, b as BufferSource))\n return ctEqualTags(tagA, tagB)\n}\n","/**\n * The `_vdig` slot payload + crypto (stage 2, spec §2).\n *\n * A `_vdig[field]` blob is AES-256-GCM `\"iv:data\"` sealed under an\n * HKDF(CEK) slot key with AAD = ['noydb-classify-vdig', collection,\n * recordId, field] (C1 rollback-splice hardening). The AAD is NOT stored —\n * readers reconstruct it. It is deliberately `_v`-independent: C6's\n * carry-forward copies blob bytes verbatim across version bumps; the\n * same-record same-field TEMPORAL rollback residual is detected by the\n * ledger's conditional `_vdig` binding (envelope-body.ts).\n *\n * CEK-ONLY (I3): there is no DEK derivation and no\n * 'noydb-classify-vdig-dek' salt domain — every vdig slot dies with the\n * record's `_cek` (forget() shreds it totally; no vdig-dekResidue class).\n * @module\n */\nimport { encryptBytesWithAAD, decryptBytesWithAAD, base64ToBuffer, type EnclaveKey } from '../crypto.js'\nimport { TamperedError } from '../../errors.js'\n\nconst subtle = globalThis.crypto.subtle\n\nexport const VDIG_SALT_DOMAIN = 'noydb-classify-vdig'\n\nexport interface VdigDigestEntry {\n readonly salt: string // base64 32-byte per-write random salt\n readonly hash: string // base64 32-byte pbkdf2VerifyDigest output\n}\n\nexport interface VdigPayload {\n readonly v: 1\n readonly alg: 'PBKDF2-SHA256'\n readonly iter: number\n readonly cur: VdigDigestEntry & { readonly at: string } // ISO write-time\n /** Previous digests, oldest-first, length ≤ notLastN (cap 8). */\n readonly ring?: readonly VdigDigestEntry[]\n}\n\n/** Injective JSON-array AAD — same collision argument as deriveSealedFieldKey. */\nexport function buildVdigAad(collection: string, recordId: string, field: string): Uint8Array {\n return new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, recordId, field]))\n}\n\n/** HKDF(CEK) → non-extractable AES-256-GCM vdig slot key. CEK-only (I3). */\nexport async function deriveVdigSlotKey(\n cek: EnclaveKey,\n collection: string,\n field: string,\n): Promise<EnclaveKey> {\n const raw = await subtle.exportKey('raw', cek)\n const hkdf = await subtle.importKey('raw', raw, 'HKDF', false, ['deriveBits'])\n const salt = new TextEncoder().encode(VDIG_SALT_DOMAIN)\n const info = new TextEncoder().encode(JSON.stringify([VDIG_SALT_DOMAIN, collection, field]))\n const bits = await subtle.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt, info }, hkdf, 256)\n return subtle.importKey('raw', bits, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt'])\n}\n\nexport async function sealVdigPayload(\n payload: VdigPayload,\n cek: EnclaveKey,\n collection: string,\n recordId: string,\n field: string,\n): Promise<string> {\n const key = await deriveVdigSlotKey(cek, collection, field)\n const { iv, data } = await encryptBytesWithAAD(\n new TextEncoder().encode(JSON.stringify(payload)),\n key,\n buildVdigAad(collection, recordId, field),\n )\n return `${iv}:${data}`\n}\n\n/** Throws TamperedError on any AAD / auth-tag mismatch (C1). */\nexport async function openVdigPayload(\n blob: string,\n cek: EnclaveKey,\n collection: string,\n recordId: string,\n field: string,\n): Promise<VdigPayload> {\n const sep = blob.indexOf(':')\n if (sep === -1) throw new TamperedError()\n const ivPart = blob.slice(0, sep)\n const dataPart = blob.slice(sep + 1)\n try {\n base64ToBuffer(ivPart)\n base64ToBuffer(dataPart)\n } catch {\n throw new TamperedError()\n }\n const key = await deriveVdigSlotKey(cek, collection, field)\n const bytes = await decryptBytesWithAAD(\n ivPart,\n dataPart,\n key,\n buildVdigAad(collection, recordId, field),\n )\n return JSON.parse(new TextDecoder().decode(bytes)) as VdigPayload\n}\n","/**\n * k-of-n aggregate for matchGroup (§3). Deliberately a full scan that\n * never breaks: per-member results must never influence control flow in\n * a way an observer could time or decompose. Returns ONLY the aggregate.\n * @module\n */\nexport function evaluateKofN(results: readonly boolean[], min: number): boolean {\n if (!Number.isInteger(min) || min < 1 || min > results.length) {\n throw new Error(\n `evaluateKofN: min ${min} out of range 1..${results.length} — caller bug ` +\n `(matchGroup validates bounds up front, before any PBKDF2)`,\n )\n }\n let count = 0\n for (const r of results) {\n if (r) count += 1 // no short-circuit — collect, never break\n }\n return count >= min\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAM,SAAS,WAAW,OAAO;AAG1B,SAAS,YAAY,GAAe,GAAwB;AACjE,MAAI,EAAE,WAAW,MAAM,EAAE,WAAW,IAAI;AACtC,UAAM,IAAI;AAAA,MACR,mDAAmD,EAAE,MAAM,IAAI,EAAE,MAAM;AAAA,IAEzE;AAAA,EACF;AACA,MAAI,OAAO;AACX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Bytes = 0;
|
|
7
|
+
hits = 0;
|
|
8
|
+
misses = 0;
|
|
9
|
+
evictions = 0;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
if (options.maxRecords === void 0 && options.maxBytes === void 0) {
|
|
12
|
+
throw new Error("Lru: must specify maxRecords, maxBytes, or both");
|
|
13
|
+
}
|
|
14
|
+
this.maxRecords = options.maxRecords;
|
|
15
|
+
this.maxBytes = options.maxBytes;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Look up a key. Hits promote the entry to most-recently-used; misses
|
|
19
|
+
* return undefined. Both update the running stats counters.
|
|
20
|
+
*/
|
|
21
|
+
get(key) {
|
|
22
|
+
const entry = this.entries.get(key);
|
|
23
|
+
if (!entry) {
|
|
24
|
+
this.misses++;
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
this.entries.delete(key);
|
|
28
|
+
this.entries.set(key, entry);
|
|
29
|
+
this.hits++;
|
|
30
|
+
return entry.value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Insert or update a key. If the key already exists, its size is
|
|
34
|
+
* accounted for and the entry is promoted to MRU. After insertion,
|
|
35
|
+
* eviction runs to maintain both budgets.
|
|
36
|
+
*/
|
|
37
|
+
set(key, value, size) {
|
|
38
|
+
const existing = this.entries.get(key);
|
|
39
|
+
if (existing) {
|
|
40
|
+
this.currentBytes -= existing.size;
|
|
41
|
+
this.entries.delete(key);
|
|
42
|
+
}
|
|
43
|
+
this.entries.set(key, { value, size });
|
|
44
|
+
this.currentBytes += size;
|
|
45
|
+
this.evictUntilUnderBudget();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Remove a key without affecting hit/miss stats. Used by `Collection.delete()`.
|
|
49
|
+
* Returns true if the key was present.
|
|
50
|
+
*/
|
|
51
|
+
remove(key) {
|
|
52
|
+
const existing = this.entries.get(key);
|
|
53
|
+
if (!existing) return false;
|
|
54
|
+
this.currentBytes -= existing.size;
|
|
55
|
+
this.entries.delete(key);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
/** True if the cache currently holds an entry for the given key. */
|
|
59
|
+
has(key) {
|
|
60
|
+
return this.entries.has(key);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Drop every entry. Stats counters survive — call `resetStats()` if you
|
|
64
|
+
* want a clean slate. Used by `Collection.invalidate()` on key rotation.
|
|
65
|
+
*/
|
|
66
|
+
clear() {
|
|
67
|
+
this.entries.clear();
|
|
68
|
+
this.currentBytes = 0;
|
|
69
|
+
}
|
|
70
|
+
/** Reset hit/miss/eviction counters to zero. Does NOT touch entries. */
|
|
71
|
+
resetStats() {
|
|
72
|
+
this.hits = 0;
|
|
73
|
+
this.misses = 0;
|
|
74
|
+
this.evictions = 0;
|
|
75
|
+
}
|
|
76
|
+
/** Snapshot of current cache statistics. Cheap — no copying. */
|
|
77
|
+
stats() {
|
|
78
|
+
return {
|
|
79
|
+
hits: this.hits,
|
|
80
|
+
misses: this.misses,
|
|
81
|
+
evictions: this.evictions,
|
|
82
|
+
size: this.entries.size,
|
|
83
|
+
bytes: this.currentBytes
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Iterate over all currently-cached values. Order is least-recently-used
|
|
88
|
+
* first. Used by tests and devtools — production callers should use
|
|
89
|
+
* `Collection.scan()` instead.
|
|
90
|
+
*/
|
|
91
|
+
*values() {
|
|
92
|
+
for (const entry of this.entries.values()) yield entry.value;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Walk the cache from the LRU end and drop entries until both budgets
|
|
96
|
+
* are satisfied. Called after every `set()`. Single pass — entries are
|
|
97
|
+
* never re-promoted during eviction.
|
|
98
|
+
*/
|
|
99
|
+
evictUntilUnderBudget() {
|
|
100
|
+
while (this.overBudget()) {
|
|
101
|
+
const oldest = this.entries.keys().next();
|
|
102
|
+
if (oldest.done) return;
|
|
103
|
+
const key = oldest.value;
|
|
104
|
+
const entry = this.entries.get(key);
|
|
105
|
+
if (entry) this.currentBytes -= entry.size;
|
|
106
|
+
this.entries.delete(key);
|
|
107
|
+
this.evictions++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
overBudget() {
|
|
111
|
+
if (this.maxRecords !== void 0 && this.entries.size > this.maxRecords) return true;
|
|
112
|
+
if (this.maxBytes !== void 0 && this.currentBytes > this.maxBytes) return true;
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/kernel/cache/policy.ts
|
|
118
|
+
var UNITS = {
|
|
119
|
+
"": 1,
|
|
120
|
+
"B": 1,
|
|
121
|
+
"KB": 1024,
|
|
122
|
+
"MB": 1024 * 1024,
|
|
123
|
+
"GB": 1024 * 1024 * 1024
|
|
124
|
+
// 'TB' deliberately not supported — if you need it, you're not using NOYDB.
|
|
125
|
+
};
|
|
126
|
+
function parseBytes(input) {
|
|
127
|
+
if (typeof input === "number") {
|
|
128
|
+
if (!Number.isFinite(input) || input <= 0) {
|
|
129
|
+
throw new Error(`parseBytes: numeric input must be a positive finite number, got ${String(input)}`);
|
|
130
|
+
}
|
|
131
|
+
return Math.floor(input);
|
|
132
|
+
}
|
|
133
|
+
const trimmed = input.trim();
|
|
134
|
+
if (trimmed === "") {
|
|
135
|
+
throw new Error("parseBytes: empty string is not a valid byte budget");
|
|
136
|
+
}
|
|
137
|
+
const match = /^([0-9]+(?:\.[0-9]+)?)\s*([A-Za-z]*)$/.exec(trimmed);
|
|
138
|
+
if (!match) {
|
|
139
|
+
throw new Error(`parseBytes: invalid byte budget "${input}". Expected format: "1024", "50KB", "50MB", "1GB"`);
|
|
140
|
+
}
|
|
141
|
+
const value = parseFloat(match[1]);
|
|
142
|
+
const unit = (match[2] ?? "").toUpperCase();
|
|
143
|
+
if (!(unit in UNITS)) {
|
|
144
|
+
throw new Error(`parseBytes: unknown unit "${match[2]}" in "${input}". Supported: B, KB, MB, GB`);
|
|
145
|
+
}
|
|
146
|
+
const bytes = Math.floor(value * UNITS[unit]);
|
|
147
|
+
if (bytes <= 0) {
|
|
148
|
+
throw new Error(`parseBytes: byte budget must be > 0, got ${bytes} from "${input}"`);
|
|
149
|
+
}
|
|
150
|
+
return bytes;
|
|
151
|
+
}
|
|
152
|
+
function estimateRecordBytes(record) {
|
|
153
|
+
try {
|
|
154
|
+
return JSON.stringify(record).length;
|
|
155
|
+
} catch {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// src/port/with/lazy-strategy.ts
|
|
161
|
+
function buildLazyCache(collection, cache) {
|
|
162
|
+
if (!cache || cache.maxRecords === void 0 && cache.maxBytes === void 0) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`Collection "${collection}": lazy mode (prefetch: false) requires a cache option with maxRecords and/or maxBytes. An unbounded lazy cache defeats the purpose.`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
const lruOptions = {};
|
|
168
|
+
if (cache.maxRecords !== void 0) lruOptions.maxRecords = cache.maxRecords;
|
|
169
|
+
if (cache.maxBytes !== void 0) lruOptions.maxBytes = parseBytes(cache.maxBytes);
|
|
170
|
+
return new Lru(lruOptions);
|
|
171
|
+
}
|
|
172
|
+
var implicitLazyWarned = false;
|
|
173
|
+
var IMPLICIT_LAZY = {
|
|
174
|
+
createCache(collection, cache) {
|
|
175
|
+
if (!implicitLazyWarned) {
|
|
176
|
+
implicitLazyWarned = true;
|
|
177
|
+
if (!(typeof process !== "undefined" && process.env["NODE_ENV"] === "test")) {
|
|
178
|
+
console.warn(
|
|
179
|
+
`[noy-db] Collection "${collection}": lazy mode (prefetch: false) without the lazy service is deprecated \u2014 pass \`lazyStrategy: withLazy()\` (from "@noy-db/hub/lazy") to createNoydb(). The implicit path will be removed at 1.0.`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return buildLazyCache(collection, cache);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
Lru,
|
|
189
|
+
parseBytes,
|
|
190
|
+
estimateRecordBytes,
|
|
191
|
+
buildLazyCache,
|
|
192
|
+
IMPLICIT_LAZY
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=chunk-NO272T7Q.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kernel/cache/lru.ts","../src/kernel/cache/policy.ts","../src/port/with/lazy-strategy.ts"],"sourcesContent":["/**\n * Generic LRU cache for `Collection`'s lazy hydration mode.\n *\n * Backed by a JavaScript `Map`, which preserves insertion order. Promotion\n * is implemented as `delete()` + `set()` — O(1) on `Map` since both\n * operations are constant-time. Eviction walks the iterator from the front\n * (least recently used) until both budgets are satisfied.\n *\n * ships in-memory only. The cache is never persisted; on collection\n * close every entry is dropped. Persisting cache state is a follow-up\n * once the access patterns from real consumers tell us whether it would\n * pay back the complexity.\n */\n\nexport interface LruEntry<V> {\n /** The cached value. */\n readonly value: V\n /**\n * Approximate decrypted byte size of the entry. Used by the byte-budget\n * eviction path. Callers compute this once at insert time and pass it\n * in — recomputing on every access would dominate the per-record cost.\n */\n readonly size: number\n}\n\nexport interface LruOptions {\n /** Maximum number of entries before eviction. Required if `maxBytes` is unset. */\n maxRecords?: number\n /** Maximum total bytes before eviction. Computed from per-entry `size`. */\n maxBytes?: number\n}\n\nexport interface LruStats {\n /** Total cache hits since construction (or `resetStats()`). */\n hits: number\n /** Total cache misses since construction (or `resetStats()`). */\n misses: number\n /** Total entries evicted since construction (or `resetStats()`). */\n evictions: number\n /** Current number of cached entries. */\n size: number\n /** Current sum of cached entry sizes (in bytes, approximate). */\n bytes: number\n}\n\n/**\n * O(1) LRU cache. Both `get()` and `set()` promote the touched entry to\n * the most-recently-used end. Eviction happens after every insert and\n * walks the front of the Map iterator dropping entries until both\n * budgets are satisfied.\n */\nexport class Lru<K, V> {\n private readonly entries = new Map<K, LruEntry<V>>()\n private readonly maxRecords: number | undefined\n private readonly maxBytes: number | undefined\n private currentBytes = 0\n private hits = 0\n private misses = 0\n private evictions = 0\n\n constructor(options: LruOptions) {\n if (options.maxRecords === undefined && options.maxBytes === undefined) {\n throw new Error('Lru: must specify maxRecords, maxBytes, or both')\n }\n this.maxRecords = options.maxRecords\n this.maxBytes = options.maxBytes\n }\n\n /**\n * Look up a key. Hits promote the entry to most-recently-used; misses\n * return undefined. Both update the running stats counters.\n */\n get(key: K): V | undefined {\n const entry = this.entries.get(key)\n if (!entry) {\n this.misses++\n return undefined\n }\n // Promote: re-insert moves the entry to the end of the iteration order.\n this.entries.delete(key)\n this.entries.set(key, entry)\n this.hits++\n return entry.value\n }\n\n /**\n * Insert or update a key. If the key already exists, its size is\n * accounted for and the entry is promoted to MRU. After insertion,\n * eviction runs to maintain both budgets.\n */\n set(key: K, value: V, size: number): void {\n const existing = this.entries.get(key)\n if (existing) {\n // Update path: subtract the old size before adding the new one.\n this.currentBytes -= existing.size\n this.entries.delete(key)\n }\n this.entries.set(key, { value, size })\n this.currentBytes += size\n this.evictUntilUnderBudget()\n }\n\n /**\n * Remove a key without affecting hit/miss stats. Used by `Collection.delete()`.\n * Returns true if the key was present.\n */\n remove(key: K): boolean {\n const existing = this.entries.get(key)\n if (!existing) return false\n this.currentBytes -= existing.size\n this.entries.delete(key)\n return true\n }\n\n /** True if the cache currently holds an entry for the given key. */\n has(key: K): boolean {\n return this.entries.has(key)\n }\n\n /**\n * Drop every entry. Stats counters survive — call `resetStats()` if you\n * want a clean slate. Used by `Collection.invalidate()` on key rotation.\n */\n clear(): void {\n this.entries.clear()\n this.currentBytes = 0\n }\n\n /** Reset hit/miss/eviction counters to zero. Does NOT touch entries. */\n resetStats(): void {\n this.hits = 0\n this.misses = 0\n this.evictions = 0\n }\n\n /** Snapshot of current cache statistics. Cheap — no copying. */\n stats(): LruStats {\n return {\n hits: this.hits,\n misses: this.misses,\n evictions: this.evictions,\n size: this.entries.size,\n bytes: this.currentBytes,\n }\n }\n\n /**\n * Iterate over all currently-cached values. Order is least-recently-used\n * first. Used by tests and devtools — production callers should use\n * `Collection.scan()` instead.\n */\n *values(): IterableIterator<V> {\n for (const entry of this.entries.values()) yield entry.value\n }\n\n /**\n * Walk the cache from the LRU end and drop entries until both budgets\n * are satisfied. Called after every `set()`. Single pass — entries are\n * never re-promoted during eviction.\n */\n private evictUntilUnderBudget(): void {\n while (this.overBudget()) {\n const oldest = this.entries.keys().next()\n if (oldest.done) return // empty cache; nothing more to evict\n const key = oldest.value\n const entry = this.entries.get(key)\n if (entry) this.currentBytes -= entry.size\n this.entries.delete(key)\n this.evictions++\n }\n }\n\n private overBudget(): boolean {\n if (this.maxRecords !== undefined && this.entries.size > this.maxRecords) return true\n if (this.maxBytes !== undefined && this.currentBytes > this.maxBytes) return true\n return false\n }\n}\n","/**\n * Cache policy helpers — parse human-friendly byte budgets into raw numbers.\n *\n * Accepted shapes (case-insensitive on suffix):\n * number — interpreted as raw bytes\n * '1024' — string of digits, raw bytes\n * '50KB' — kilobytes (×1024)\n * '50MB' — megabytes (×1024²)\n * '1GB' — gigabytes (×1024³)\n *\n * Decimals are accepted (`'1.5GB'` → 1610612736 bytes).\n *\n * Anything else throws — better to fail loud at construction time than\n * to silently treat a typo as 0 bytes (which would evict everything).\n */\n\nconst UNITS: Record<string, number> = {\n '': 1,\n 'B': 1,\n 'KB': 1024,\n 'MB': 1024 * 1024,\n 'GB': 1024 * 1024 * 1024,\n // 'TB' deliberately not supported — if you need it, you're not using NOYDB.\n}\n\n/** Parse a byte budget into a positive integer number of bytes. */\nexport function parseBytes(input: number | string): number {\n if (typeof input === 'number') {\n if (!Number.isFinite(input) || input <= 0) {\n throw new Error(`parseBytes: numeric input must be a positive finite number, got ${String(input)}`)\n }\n return Math.floor(input)\n }\n\n const trimmed = input.trim()\n if (trimmed === '') {\n throw new Error('parseBytes: empty string is not a valid byte budget')\n }\n\n // Accept either a bare number or a number followed by a unit suffix.\n // Regex: optional sign, digits with optional decimal, optional unit.\n const match = /^([0-9]+(?:\\.[0-9]+)?)\\s*([A-Za-z]*)$/.exec(trimmed)\n if (!match) {\n throw new Error(`parseBytes: invalid byte budget \"${input}\". Expected format: \"1024\", \"50KB\", \"50MB\", \"1GB\"`)\n }\n\n const value = parseFloat(match[1]!)\n const unit = (match[2] ?? '').toUpperCase()\n\n if (!(unit in UNITS)) {\n throw new Error(`parseBytes: unknown unit \"${match[2]}\" in \"${input}\". Supported: B, KB, MB, GB`)\n }\n\n const bytes = Math.floor(value * UNITS[unit]!)\n if (bytes <= 0) {\n throw new Error(`parseBytes: byte budget must be > 0, got ${bytes} from \"${input}\"`)\n }\n return bytes\n}\n\n/**\n * Estimate the in-memory byte size of a decrypted record.\n *\n * Uses `JSON.stringify().length` as a stand-in for actual heap usage.\n * It's a deliberate approximation: real V8 heap size includes pointer\n * overhead, hidden classes, and string interning that we can't measure\n * from JavaScript. The JSON length is a stable, monotonic proxy that\n * costs O(record size) per insert — fine when records are typically\n * < 1 KB and the cache eviction is the slow path anyway.\n *\n * Returns `0` (and the caller must treat it as 1 for accounting) if\n * stringification throws on circular references; this is documented\n * but in practice records always come from JSON-decoded envelopes.\n */\nexport function estimateRecordBytes(record: unknown): number {\n try {\n return JSON.stringify(record).length\n } catch {\n return 0\n }\n}\n","/**\n * Lazy-mode capability contract (#267 Track A tail — lazy-mode promoted out\n * of `routing` into its own `lazy` service). Lives on the `/with` port (the\n * one seam the kernel spine may import statically) so `Collection` can hold\n * the back-compat default without a spine→service static import.\n *\n * Lazy mode (`prefetch: false`) skips bulk hydration: reads go per-id\n * against the store and land in a bounded LRU working set. The strategy owns\n * constructing that LRU:\n *\n * - `withLazy()` (`with-store/lazy/active.ts`, subpath `@noy-db/hub/lazy`)\n * is the explicit catalog opt-in — silent, forward-stable.\n * - {@link IMPLICIT_LAZY} is the floor default reached when a collection\n * declares `prefetch: false` WITHOUT `lazyStrategy: withLazy()`. It keeps\n * the pre-#267 behavior byte-for-byte (back-compat delegation, pre-1.0)\n * but emits a one-time deprecation warn outside test env. It will become\n * a throwing stub at 1.0, letting the LRU leave the floor bundle\n * entirely once the per-record-CEK cache stops pinning `Lru` there.\n *\n * The on-demand read/write branches themselves stay kernel-resident (they\n * are `if (this.lazy)` forks on the hot get/put/scan paths); the service\n * seam owns cache construction + budget validation, which is where the\n * opt-in and the future tree-shake win live.\n * @internal\n */\nimport { Lru, parseBytes } from '../../kernel/cache/index.js'\nimport type { CacheOptions } from '../../kernel/collection.js'\n\nexport interface LazyStrategy {\n /**\n * Build the bounded LRU working-set cache for a lazy collection.\n * MUST throw when `cache` declares neither `maxRecords` nor `maxBytes` —\n * an unbounded lazy cache defeats the purpose.\n */\n createCache<V>(collection: string, cache: CacheOptions | undefined): Lru<string, V>\n}\n\n/**\n * Shared budget validation + LRU construction — the one implementation both\n * {@link IMPLICIT_LAZY} and `withLazy()` run, so the two paths cannot drift.\n * @internal\n */\nexport function buildLazyCache<V>(collection: string, cache: CacheOptions | undefined): Lru<string, V> {\n if (!cache || (cache.maxRecords === undefined && cache.maxBytes === undefined)) {\n throw new Error(\n `Collection \"${collection}\": lazy mode (prefetch: false) requires a cache option ` +\n `with maxRecords and/or maxBytes. An unbounded lazy cache defeats the purpose.`,\n )\n }\n const lruOptions: { maxRecords?: number; maxBytes?: number } = {}\n if (cache.maxRecords !== undefined) lruOptions.maxRecords = cache.maxRecords\n if (cache.maxBytes !== undefined) lruOptions.maxBytes = parseBytes(cache.maxBytes)\n return new Lru<string, V>(lruOptions)\n}\n\nlet implicitLazyWarned = false\n\n/**\n * Back-compat default (deprecated): `prefetch: false` without\n * `lazyStrategy: withLazy()`. Identical behavior to the explicit opt-in,\n * plus a one-time deprecation warn (suppressed under NODE_ENV=test,\n * mirroring the listPage fallback warn). @internal\n */\nexport const IMPLICIT_LAZY: LazyStrategy = {\n createCache<V>(collection: string, cache: CacheOptions | undefined): Lru<string, V> {\n if (!implicitLazyWarned) {\n implicitLazyWarned = true\n if (!(typeof process !== 'undefined' && process.env['NODE_ENV'] === 'test')) {\n console.warn(\n `[noy-db] Collection \"${collection}\": lazy mode (prefetch: false) without the lazy ` +\n `service is deprecated — pass \\`lazyStrategy: withLazy()\\` (from \"@noy-db/hub/lazy\") ` +\n `to createNoydb(). The implicit path will be removed at 1.0.`,\n )\n }\n }\n return buildLazyCache<V>(collection, cache)\n },\n}\n"],"mappings":";AAmDO,IAAM,MAAN,MAAgB;AAAA,EACJ,UAAU,oBAAI,IAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACT,eAAe;AAAA,EACf,OAAO;AAAA,EACP,SAAS;AAAA,EACT,YAAY;AAAA,EAEpB,YAAY,SAAqB;AAC/B,QAAI,QAAQ,eAAe,UAAa,QAAQ,aAAa,QAAW;AACtE,YAAM,IAAI,MAAM,iDAAiD;AAAA,IACnE;AACA,SAAK,aAAa,QAAQ;AAC1B,SAAK,WAAW,QAAQ;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,KAAuB;AACzB,UAAM,QAAQ,KAAK,QAAQ,IAAI,GAAG;AAClC,QAAI,CAAC,OAAO;AACV,WAAK;AACL,aAAO;AAAA,IACT;AAEA,SAAK,QAAQ,OAAO,GAAG;AACvB,SAAK,QAAQ,IAAI,KAAK,KAAK;AAC3B,SAAK;AACL,WAAO,MAAM;AAAA,EACf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,KAAQ,OAAU,MAAoB;AACxC,UAAM,WAAW,KAAK,QAAQ,IAAI,GAAG;AACrC,QAAI,UAAU;AAEZ,WAAK,gBAAgB,SAAS;AAC9B,WAAK,QAAQ,OAAO,GAAG;AAAA,IACzB;AACA,SAAK,QAAQ,IAAI,KAAK,EAAE,OAAO,KAAK,CAAC;AACrC,SAAK,gBAAgB;AACrB,SAAK,sBAAsB;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,KAAiB;AACtB,UAAM,WAAW,KAAK,QAAQ,IAAI,GAAG;AACrC,QAAI,CAAC,S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Ae,OAAW,YAAW,aAAa,MAAM;AAClE,MAAI,MAAM,aAAa,OAAW,YAAW,WAAW,WAAW,MAAM,QAAQ;AACjF,SAAO,IAAI,IAAe,UAAU;AACtC;AAEA,IAAI,qBAAqB;AAQlB,IAAM,gBAA8B;AAAA,EACzC,YAAe,YAAoB,OAAiD;AAClF,QAAI,CAAC,oBAAoB;AACvB,2BAAqB;AACrB,UAAI,EAAE,OAAO,YAAY,eAAe,QAAQ,IAAI,UAAU,MAAM,SAAS;AAC3E,gBAAQ;AAAA,UACN,wBAAwB,UAAU;AAAA,QAGpC;AAAA,MACF;AAAA,IACF;AACA,WAAO,eAAkB,YAAY,KAAK;AAAA,EAC5C;AACF;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appendPeriodLedgerEntry,
|
|
3
|
+
assertTsWritable,
|
|
4
|
+
chainAnchor,
|
|
5
|
+
loadPeriods,
|
|
6
|
+
validatePeriodName
|
|
7
|
+
} from "./chunk-FXK4X4BL.js";
|
|
8
|
+
|
|
9
|
+
// src/with-audit/periods/active.ts
|
|
10
|
+
function withPeriods() {
|
|
11
|
+
return {
|
|
12
|
+
loadPeriods,
|
|
13
|
+
chainAnchor,
|
|
14
|
+
assertTsWritable,
|
|
15
|
+
validatePeriodName,
|
|
16
|
+
appendPeriodLedgerEntry
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
withPeriods
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-O2DYPAZY.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PortabilityNotEnabledError
|
|
3
|
+
} from "./chunk-FH542DDY.js";
|
|
4
|
+
|
|
5
|
+
// src/with-audit/portability/strategy.ts
|
|
6
|
+
var NO_PORTABILITY = {
|
|
7
|
+
async exportAccessibleData() {
|
|
8
|
+
throw new PortabilityNotEnabledError();
|
|
9
|
+
},
|
|
10
|
+
async withdrawAccessibleData() {
|
|
11
|
+
throw new PortabilityNotEnabledError();
|
|
12
|
+
},
|
|
13
|
+
async requestWithdrawal() {
|
|
14
|
+
throw new PortabilityNotEnabledError();
|
|
15
|
+
},
|
|
16
|
+
async listWithdrawalRequests() {
|
|
17
|
+
throw new PortabilityNotEnabledError();
|
|
18
|
+
},
|
|
19
|
+
async approveWithdrawal() {
|
|
20
|
+
throw new PortabilityNotEnabledError();
|
|
21
|
+
},
|
|
22
|
+
async rejectWithdrawal() {
|
|
23
|
+
throw new PortabilityNotEnabledError();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
NO_PORTABILITY
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-ODJWBC5I.js.map
|