@noy-db/hub 0.6.0-pre.17 → 0.6.0-pre.18
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/{api-AEIN3KAQ.js → api-FRFEJ6WR.js} +6 -6
- package/dist/attestation/index.js +12 -12
- package/dist/{backup-7X3PFTSI.js → backup-OLBRFYY7.js} +10 -10
- package/dist/{backup-7X3PFTSI.js.map → backup-OLBRFYY7.js.map} +1 -1
- package/dist/blobs/index.js +8 -8
- package/dist/broker/index.js +6 -6
- package/dist/cargo/index.js +26 -26
- package/dist/{chunk-V3OLO4TK.js → chunk-2ION5ZRH.js} +17 -14
- package/dist/chunk-2ION5ZRH.js.map +1 -0
- package/dist/{chunk-466KGOQB.js → chunk-2NE7ILO7.js} +2 -2
- package/dist/{chunk-GWI65NDQ.js → chunk-3KXIGMZ4.js} +2 -2
- package/dist/{chunk-C3YP5KKS.js → chunk-3ODOWQMV.js} +13 -14
- package/dist/chunk-3ODOWQMV.js.map +1 -0
- package/dist/{chunk-X2FXEEQT.js → chunk-3RZ7QLJ4.js} +5 -5
- package/dist/{chunk-5UGEGEIJ.js → chunk-3Y4OFWQJ.js} +1 -1
- package/dist/chunk-3Y4OFWQJ.js.map +1 -0
- package/dist/{chunk-FZ2SSI5R.js → chunk-6AL6O4CS.js} +2 -2
- package/dist/{chunk-67XA44HH.js → chunk-6D3CN2JR.js} +2 -2
- package/dist/{chunk-5VVBZ6E4.js → chunk-6QCXMCLZ.js} +3 -3
- package/dist/{chunk-4GR422R5.js → chunk-7EH322GJ.js} +14 -7
- package/dist/chunk-7EH322GJ.js.map +1 -0
- package/dist/{chunk-AMKCY454.js → chunk-7WD2G6K4.js} +7 -2
- package/dist/{chunk-AMKCY454.js.map → chunk-7WD2G6K4.js.map} +1 -1
- package/dist/{chunk-URVL4EKU.js → chunk-A5QQKWCK.js} +14 -23
- package/dist/chunk-A5QQKWCK.js.map +1 -0
- package/dist/{chunk-2RGQNFJB.js → chunk-AA2WWTS3.js} +9 -7
- package/dist/chunk-AA2WWTS3.js.map +1 -0
- package/dist/{chunk-UKKBKEUI.js → chunk-AA7LM2A3.js} +2 -2
- package/dist/{chunk-SJOK23XT.js → chunk-AIZNLHKN.js} +4 -4
- package/dist/chunk-AIZNLHKN.js.map +1 -0
- package/dist/{chunk-UNR6G3EJ.js → chunk-AMMYIT7F.js} +35 -31
- package/dist/chunk-AMMYIT7F.js.map +1 -0
- package/dist/{chunk-NWPR2V5W.js → chunk-BBU3OD3D.js} +2 -2
- package/dist/{chunk-EEBMKMA7.js → chunk-BVIGGV6D.js} +33 -45
- package/dist/chunk-BVIGGV6D.js.map +1 -0
- package/dist/{chunk-OXRPH6AR.js → chunk-CFTPERGL.js} +14 -11
- package/dist/chunk-CFTPERGL.js.map +1 -0
- package/dist/{chunk-AKFNLRA2.js → chunk-CGQUSSW7.js} +26 -142
- package/dist/chunk-CGQUSSW7.js.map +1 -0
- package/dist/{chunk-JHYISAID.js → chunk-DFFSCYIW.js} +9 -9
- package/dist/{chunk-BMDF4TLU.js → chunk-DKYEVHZH.js} +7 -10
- package/dist/chunk-DKYEVHZH.js.map +1 -0
- package/dist/{chunk-YVOW35HH.js → chunk-DL4GDOWL.js} +4 -6
- package/dist/chunk-DL4GDOWL.js.map +1 -0
- package/dist/{chunk-Z2OFE6IX.js → chunk-DWO55ZWE.js} +13 -22
- package/dist/chunk-DWO55ZWE.js.map +1 -0
- package/dist/{chunk-XTC5EKST.js → chunk-ER3BQCCE.js} +2 -2
- package/dist/{chunk-JU3JKOY5.js → chunk-EWAGI3EM.js} +2 -2
- package/dist/{chunk-OAWVM5L6.js → chunk-EZ3UHHND.js} +13 -15
- package/dist/chunk-EZ3UHHND.js.map +1 -0
- package/dist/{chunk-IEA3TZJE.js → chunk-FDIZHZ3C.js} +29 -47
- package/dist/chunk-FDIZHZ3C.js.map +1 -0
- package/dist/{chunk-7TZTQS4H.js → chunk-FOABWV7L.js} +45 -18
- package/dist/chunk-FOABWV7L.js.map +1 -0
- package/dist/{chunk-QKRJUPAC.js → chunk-FRGF56PD.js} +11 -14
- package/dist/chunk-FRGF56PD.js.map +1 -0
- package/dist/{chunk-N4GAJSRQ.js → chunk-FY33DKPH.js} +2 -2
- package/dist/{chunk-JV2CNEX2.js → chunk-GSRW5MTU.js} +220 -169
- package/dist/chunk-GSRW5MTU.js.map +1 -0
- package/dist/{chunk-C52CJDFO.js → chunk-HJRTFXAA.js} +7 -10
- package/dist/chunk-HJRTFXAA.js.map +1 -0
- package/dist/chunk-HK67PX4J.js +27 -0
- package/dist/chunk-HK67PX4J.js.map +1 -0
- package/dist/{chunk-6JRIYG2C.js → chunk-IN5EZWYQ.js} +13 -14
- package/dist/chunk-IN5EZWYQ.js.map +1 -0
- package/dist/{chunk-QJBXB4WU.js → chunk-ITXPKEDP.js} +23 -29
- package/dist/chunk-ITXPKEDP.js.map +1 -0
- package/dist/{chunk-EMFFWSAD.js → chunk-JYFJNSTW.js} +9 -9
- package/dist/chunk-JYFJNSTW.js.map +1 -0
- package/dist/{chunk-D6E5N2O3.js → chunk-KLVGF2D4.js} +11 -9
- package/dist/{chunk-D6E5N2O3.js.map → chunk-KLVGF2D4.js.map} +1 -1
- package/dist/{chunk-7LLKPODL.js → chunk-LPAGIMXJ.js} +2 -2
- package/dist/{chunk-3JQVA527.js → chunk-LU6NPJWN.js} +3 -3
- package/dist/{chunk-VUQZYVYX.js → chunk-NAAPSNCS.js} +90 -33
- package/dist/chunk-NAAPSNCS.js.map +1 -0
- package/dist/{chunk-DEP24EE3.js → chunk-NFPSC2HL.js} +3 -3
- package/dist/{chunk-JAHIL6WO.js → chunk-NRNTXBHT.js} +7 -10
- package/dist/chunk-NRNTXBHT.js.map +1 -0
- package/dist/{chunk-N7HOHWKF.js → chunk-O4QDBAB6.js} +7 -10
- package/dist/{chunk-N7HOHWKF.js.map → chunk-O4QDBAB6.js.map} +1 -1
- package/dist/{chunk-VQQUOEON.js → chunk-OCCNYGKG.js} +7 -7
- package/dist/{chunk-VEA35MQP.js → chunk-OZD3D2DZ.js} +10 -13
- package/dist/chunk-OZD3D2DZ.js.map +1 -0
- package/dist/{chunk-IRHOQFA7.js → chunk-PBPYQZDW.js} +2 -2
- package/dist/{chunk-FHFMWYGM.js → chunk-PBRIHUQ5.js} +5 -5
- package/dist/{chunk-FHFMWYGM.js.map → chunk-PBRIHUQ5.js.map} +1 -1
- package/dist/{chunk-LUFZPROB.js → chunk-Q67P7S2I.js} +14 -15
- package/dist/chunk-Q67P7S2I.js.map +1 -0
- package/dist/{chunk-ES36R3U2.js → chunk-RAYGDC4A.js} +50 -63
- package/dist/chunk-RAYGDC4A.js.map +1 -0
- package/dist/{chunk-RVTOCAHQ.js → chunk-SQSZRCYT.js} +1 -1
- package/dist/chunk-SQSZRCYT.js.map +1 -0
- package/dist/{chunk-JN64WH3U.js → chunk-T7IR4N2S.js} +1 -1
- package/dist/{chunk-JN64WH3U.js.map → chunk-T7IR4N2S.js.map} +1 -1
- package/dist/{chunk-SDEHNGWW.js → chunk-TNOQNU3R.js} +5 -4
- package/dist/{chunk-SDEHNGWW.js.map → chunk-TNOQNU3R.js.map} +1 -1
- package/dist/{chunk-P5ARVLNW.js → chunk-TXDOMADN.js} +9 -6
- package/dist/chunk-TXDOMADN.js.map +1 -0
- package/dist/{chunk-6VAM5THN.js → chunk-U6D5XTI5.js} +13 -13
- package/dist/{chunk-6VAM5THN.js.map → chunk-U6D5XTI5.js.map} +1 -1
- package/dist/{chunk-APUP2J5M.js → chunk-UE72AQDZ.js} +6 -6
- package/dist/chunk-UIYZ5SOU.js +190 -0
- package/dist/chunk-UIYZ5SOU.js.map +1 -0
- package/dist/{chunk-QC2HGYFX.js → chunk-VXVKEWYC.js} +3 -3
- package/dist/{chunk-BKYQNNO3.js → chunk-X3AXSYBL.js} +198 -132
- package/dist/chunk-X3AXSYBL.js.map +1 -0
- package/dist/{chunk-I7JF5TNL.js → chunk-ZDATYUYG.js} +2 -2
- package/dist/{chunk-WBHQX6ME.js → chunk-ZSOTZ2RZ.js} +12 -13
- package/dist/chunk-ZSOTZ2RZ.js.map +1 -0
- package/dist/{chunk-RGPB25DB.js → chunk-ZVAFJQZB.js} +25 -19
- package/dist/chunk-ZVAFJQZB.js.map +1 -0
- package/dist/classified/index.js +4 -4
- package/dist/{classified-marker-W2PUYC3K.js → classified-marker-GWQTNDSL.js} +3 -3
- package/dist/{collection-facade-CRXN72DU.js → collection-facade-56RTPO4G.js} +12 -12
- package/dist/consent/index.js +4 -4
- package/dist/cover/index.js +9 -2
- package/dist/custody/index.js +6 -6
- package/dist/{dead-filter-MVFQCLXY.js → dead-filter-XP7MPHCJ.js} +2 -2
- package/dist/{delegation-I7XXO5LL.js → delegation-Q3HEAVLA.js} +18 -19
- package/dist/delegation-Q3HEAVLA.js.map +1 -0
- package/dist/derivations/index.js +3 -3
- package/dist/{derive-NL7X2EFT.js → derive-SVDY36ER.js} +4 -4
- package/dist/directory/index.js +5 -5
- package/dist/{dispatch-K3MDLCXG.js → dispatch-MG5KNMWG.js} +5 -5
- package/dist/{dispatch-PY5RUHJF.js → dispatch-RVJQ4BOL.js} +11 -11
- package/dist/{enclave-77K7UDLS.js → enclave-AOZTWFZK.js} +12 -4
- package/dist/{executor-FNGVGDW3.js → executor-FRUVM36Q.js} +12 -12
- package/dist/{export-accessible-QWUYY2OY.js → export-accessible-HDDHZYPM.js} +7 -7
- package/dist/{extract-partition-CGCURVS4.js → extract-partition-TRADP234.js} +12 -12
- package/dist/{fanout-sidecar-JI3MUPQV.js → fanout-sidecar-NZA6J7QB.js} +13 -22
- package/dist/fanout-sidecar-NZA6J7QB.js.map +1 -0
- package/dist/forget/index.js +4 -4
- package/dist/history/index.js +18 -15
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +9 -9
- package/dist/index.d.ts +16 -0
- package/dist/index.js +129 -127
- package/dist/index.js.map +1 -1
- package/dist/introspection/index.js +5 -5
- package/dist/{issue-7IPUNAFA.js → issue-GZQDW5TQ.js} +6 -6
- package/dist/kernel/enclave/index.d.ts +6 -5
- package/dist/kernel/enclave/record-aad.d.ts +79 -7
- package/dist/kernel/enclave/record-envelope.d.ts +54 -7
- package/dist/kernel/enclave/record-keys/envelope-body.d.ts +34 -2
- package/dist/kernel/enclave/record-keys/lifecycle.d.ts +22 -5
- package/dist/kernel/enclave/record-keys/record-codec.d.ts +47 -14
- package/dist/kernel/enclave/record-keys/rekey.d.ts +8 -2
- package/dist/kernel/enclave/record-keys/tombstone.d.ts +3 -3
- package/dist/kernel/merge-authority.d.ts +25 -0
- package/dist/kernel/tier-visibility.d.ts +15 -0
- package/dist/kernel/types.d.ts +8 -0
- package/dist/kernel/vault.d.ts +1 -1
- package/dist/kernel/via/index.d.ts +11 -2
- package/dist/{ledger-3RDSSMGD.js → ledger-KQAJPEMZ.js} +6 -6
- package/dist/liberate-Z2EXJY2S.js +24 -0
- package/dist/{link-set-VJIWWUZO.js → link-set-XKN5V7VM.js} +5 -5
- package/dist/{managed-secret-XGGJ3BC3.js → managed-secret-7WIIVMJ5.js} +11 -3
- package/dist/materialized-views/index.js +14 -14
- package/dist/money/index.js +3 -3
- package/dist/{noydb-CLQP36JR.js → noydb-NPW3C2EX.js} +39 -38
- package/dist/periods/index.js +6 -6
- package/dist/pod/index.js +42 -41
- package/dist/{pod-handle-7BVSWP5B.js → pod-handle-SKDKRPOR.js} +6 -6
- package/dist/{pod-handle-7BVSWP5B.js.map → pod-handle-SKDKRPOR.js.map} +1 -1
- package/dist/policy/index.js +10 -3
- package/dist/port/with/merge-authority.d.ts +52 -0
- package/dist/port/with/strategies.d.ts +2 -0
- package/dist/portability/index.js +6 -6
- package/dist/{post-register-W3T4U57K.js → post-register-CVS7CCJE.js} +4 -4
- package/dist/reduce/index.js +3 -3
- package/dist/{register-YUVC4G27.js → register-GJ6PW4KP.js} +10 -10
- package/dist/{registry-BPKJX562.js → registry-6LUJ5IJW.js} +4 -4
- package/dist/{registry-HRFRBFDV.js → registry-KI77RVK7.js} +4 -4
- package/dist/{request-withdrawal-CXTQLMJK.js → request-withdrawal-LICOUGXG.js} +9 -9
- package/dist/{reveal-G7W7N3AZ.js → reveal-PWM47FQN.js} +3 -3
- package/dist/{revoke-ZX3TZUI6.js → revoke-AWZKZLZB.js} +6 -6
- package/dist/sealed-record/index.js +14 -7
- package/dist/sealed-record/index.js.map +1 -1
- package/dist/search/index.js +3 -3
- package/dist/{seed-2FUULTQV.js → seed-LNTLU2A3.js} +14 -17
- package/dist/seed-LNTLU2A3.js.map +1 -0
- package/dist/sequence/index.js +4 -4
- package/dist/session/index.js +3 -3
- package/dist/{signer-FPUIX63Z.js → signer-JE6NEURY.js} +5 -5
- package/dist/snapshots/index.js +5 -5
- package/dist/{stale-42FPALK2.js → stale-ZWTKUVZX.js} +5 -5
- package/dist/{storage-6QODT6K5.js → storage-WCZOCA46.js} +5 -5
- package/dist/{store-coordination-provider-Y3VXBHPL.js → store-coordination-provider-7H62VO2C.js} +18 -12
- package/dist/store-coordination-provider-7H62VO2C.js.map +1 -0
- package/dist/sync/index.js +5 -5
- package/dist/team/index.js +10 -9
- package/dist/tiers/index.js +6 -5
- package/dist/vault-head/index.js +111 -0
- package/dist/vault-head/index.js.map +1 -0
- package/dist/{walk-5PGJI3ND.js → walk-HSS3NLQ3.js} +6 -6
- package/dist/with-audit/periods/periods.d.ts +1 -1
- package/dist/with-audit/periods/strategy.d.ts +1 -1
- package/dist/with-audit/sealed-record/index.d.ts +13 -0
- package/dist/with-audit/tiers/index.d.ts +17 -2
- package/dist/with-commit/history/history.d.ts +26 -0
- package/dist/with-commit/history/index.d.ts +2 -1
- package/dist/with-commit/history/ledger/store.d.ts +7 -1
- package/dist/with-commit/history/strategy.d.ts +11 -1
- package/dist/with-commit/vault-head/active.d.ts +2 -0
- package/dist/with-commit/vault-head/head.d.ts +28 -0
- package/dist/with-commit/vault-head/index.d.ts +10 -0
- package/dist/with-commit/vault-head/strategy.d.ts +127 -0
- package/dist/with-commit/vault-head/verify.d.ts +50 -0
- package/dist/with-party/directory/cover/storage.d.ts +0 -8
- package/dist/with-party/directory/storage.d.ts +0 -11
- package/dist/with-party/directory/visibility.d.ts +0 -21
- package/dist/with-party/policy/storage.d.ts +0 -10
- package/dist/with-party/team/tiers.d.ts +2 -1
- package/dist/with-sync/engine.d.ts +33 -5
- package/dist/with-sync/strategy.d.ts +3 -0
- package/dist/{withdraw-accessible-PFCQQGNP.js → withdraw-accessible-GHBA4DAA.js} +8 -8
- package/package.json +7 -3
- package/dist/chunk-2RGQNFJB.js.map +0 -1
- package/dist/chunk-4GR422R5.js.map +0 -1
- package/dist/chunk-5UGEGEIJ.js.map +0 -1
- package/dist/chunk-6JRIYG2C.js.map +0 -1
- package/dist/chunk-7TZTQS4H.js.map +0 -1
- package/dist/chunk-AFHQATY4.js +0 -47
- package/dist/chunk-AFHQATY4.js.map +0 -1
- package/dist/chunk-AKFNLRA2.js.map +0 -1
- package/dist/chunk-BKYQNNO3.js.map +0 -1
- package/dist/chunk-BMDF4TLU.js.map +0 -1
- package/dist/chunk-C3YP5KKS.js.map +0 -1
- package/dist/chunk-C52CJDFO.js.map +0 -1
- package/dist/chunk-EEBMKMA7.js.map +0 -1
- package/dist/chunk-EMFFWSAD.js.map +0 -1
- package/dist/chunk-ES36R3U2.js.map +0 -1
- package/dist/chunk-IEA3TZJE.js.map +0 -1
- package/dist/chunk-JAHIL6WO.js.map +0 -1
- package/dist/chunk-JV2CNEX2.js.map +0 -1
- package/dist/chunk-LUFZPROB.js.map +0 -1
- package/dist/chunk-OAWVM5L6.js.map +0 -1
- package/dist/chunk-OXRPH6AR.js.map +0 -1
- package/dist/chunk-P5ARVLNW.js.map +0 -1
- package/dist/chunk-QJBXB4WU.js.map +0 -1
- package/dist/chunk-QKRJUPAC.js.map +0 -1
- package/dist/chunk-RGPB25DB.js.map +0 -1
- package/dist/chunk-RVTOCAHQ.js.map +0 -1
- package/dist/chunk-SJOK23XT.js.map +0 -1
- package/dist/chunk-UNR6G3EJ.js.map +0 -1
- package/dist/chunk-URVL4EKU.js.map +0 -1
- package/dist/chunk-V3OLO4TK.js.map +0 -1
- package/dist/chunk-VEA35MQP.js.map +0 -1
- package/dist/chunk-VUQZYVYX.js.map +0 -1
- package/dist/chunk-WBHQX6ME.js.map +0 -1
- package/dist/chunk-YVOW35HH.js.map +0 -1
- package/dist/chunk-Z2OFE6IX.js.map +0 -1
- package/dist/delegation-I7XXO5LL.js.map +0 -1
- package/dist/fanout-sidecar-JI3MUPQV.js.map +0 -1
- package/dist/liberate-2DNJ7AJ7.js +0 -24
- package/dist/seed-2FUULTQV.js.map +0 -1
- package/dist/store-coordination-provider-Y3VXBHPL.js.map +0 -1
- /package/dist/{api-AEIN3KAQ.js.map → api-FRFEJ6WR.js.map} +0 -0
- /package/dist/{chunk-466KGOQB.js.map → chunk-2NE7ILO7.js.map} +0 -0
- /package/dist/{chunk-GWI65NDQ.js.map → chunk-3KXIGMZ4.js.map} +0 -0
- /package/dist/{chunk-X2FXEEQT.js.map → chunk-3RZ7QLJ4.js.map} +0 -0
- /package/dist/{chunk-FZ2SSI5R.js.map → chunk-6AL6O4CS.js.map} +0 -0
- /package/dist/{chunk-67XA44HH.js.map → chunk-6D3CN2JR.js.map} +0 -0
- /package/dist/{chunk-5VVBZ6E4.js.map → chunk-6QCXMCLZ.js.map} +0 -0
- /package/dist/{chunk-UKKBKEUI.js.map → chunk-AA7LM2A3.js.map} +0 -0
- /package/dist/{chunk-NWPR2V5W.js.map → chunk-BBU3OD3D.js.map} +0 -0
- /package/dist/{chunk-JHYISAID.js.map → chunk-DFFSCYIW.js.map} +0 -0
- /package/dist/{chunk-XTC5EKST.js.map → chunk-ER3BQCCE.js.map} +0 -0
- /package/dist/{chunk-JU3JKOY5.js.map → chunk-EWAGI3EM.js.map} +0 -0
- /package/dist/{chunk-N4GAJSRQ.js.map → chunk-FY33DKPH.js.map} +0 -0
- /package/dist/{chunk-7LLKPODL.js.map → chunk-LPAGIMXJ.js.map} +0 -0
- /package/dist/{chunk-3JQVA527.js.map → chunk-LU6NPJWN.js.map} +0 -0
- /package/dist/{chunk-DEP24EE3.js.map → chunk-NFPSC2HL.js.map} +0 -0
- /package/dist/{chunk-VQQUOEON.js.map → chunk-OCCNYGKG.js.map} +0 -0
- /package/dist/{chunk-IRHOQFA7.js.map → chunk-PBPYQZDW.js.map} +0 -0
- /package/dist/{chunk-APUP2J5M.js.map → chunk-UE72AQDZ.js.map} +0 -0
- /package/dist/{chunk-QC2HGYFX.js.map → chunk-VXVKEWYC.js.map} +0 -0
- /package/dist/{chunk-I7JF5TNL.js.map → chunk-ZDATYUYG.js.map} +0 -0
- /package/dist/{classified-marker-W2PUYC3K.js.map → classified-marker-GWQTNDSL.js.map} +0 -0
- /package/dist/{collection-facade-CRXN72DU.js.map → collection-facade-56RTPO4G.js.map} +0 -0
- /package/dist/{dead-filter-MVFQCLXY.js.map → dead-filter-XP7MPHCJ.js.map} +0 -0
- /package/dist/{derive-NL7X2EFT.js.map → derive-SVDY36ER.js.map} +0 -0
- /package/dist/{dispatch-K3MDLCXG.js.map → dispatch-MG5KNMWG.js.map} +0 -0
- /package/dist/{dispatch-PY5RUHJF.js.map → dispatch-RVJQ4BOL.js.map} +0 -0
- /package/dist/{enclave-77K7UDLS.js.map → enclave-AOZTWFZK.js.map} +0 -0
- /package/dist/{executor-FNGVGDW3.js.map → executor-FRUVM36Q.js.map} +0 -0
- /package/dist/{export-accessible-QWUYY2OY.js.map → export-accessible-HDDHZYPM.js.map} +0 -0
- /package/dist/{extract-partition-CGCURVS4.js.map → extract-partition-TRADP234.js.map} +0 -0
- /package/dist/{issue-7IPUNAFA.js.map → issue-GZQDW5TQ.js.map} +0 -0
- /package/dist/{ledger-3RDSSMGD.js.map → ledger-KQAJPEMZ.js.map} +0 -0
- /package/dist/{liberate-2DNJ7AJ7.js.map → liberate-Z2EXJY2S.js.map} +0 -0
- /package/dist/{link-set-VJIWWUZO.js.map → link-set-XKN5V7VM.js.map} +0 -0
- /package/dist/{managed-secret-XGGJ3BC3.js.map → managed-secret-7WIIVMJ5.js.map} +0 -0
- /package/dist/{noydb-CLQP36JR.js.map → noydb-NPW3C2EX.js.map} +0 -0
- /package/dist/{post-register-W3T4U57K.js.map → post-register-CVS7CCJE.js.map} +0 -0
- /package/dist/{register-YUVC4G27.js.map → register-GJ6PW4KP.js.map} +0 -0
- /package/dist/{registry-BPKJX562.js.map → registry-6LUJ5IJW.js.map} +0 -0
- /package/dist/{registry-HRFRBFDV.js.map → registry-KI77RVK7.js.map} +0 -0
- /package/dist/{request-withdrawal-CXTQLMJK.js.map → request-withdrawal-LICOUGXG.js.map} +0 -0
- /package/dist/{reveal-G7W7N3AZ.js.map → reveal-PWM47FQN.js.map} +0 -0
- /package/dist/{revoke-ZX3TZUI6.js.map → revoke-AWZKZLZB.js.map} +0 -0
- /package/dist/{signer-FPUIX63Z.js.map → signer-JE6NEURY.js.map} +0 -0
- /package/dist/{stale-42FPALK2.js.map → stale-ZWTKUVZX.js.map} +0 -0
- /package/dist/{storage-6QODT6K5.js.map → storage-WCZOCA46.js.map} +0 -0
- /package/dist/{walk-5PGJI3ND.js.map → walk-HSS3NLQ3.js.map} +0 -0
- /package/dist/{withdraw-accessible-PFCQQGNP.js.map → withdraw-accessible-GHBA4DAA.js.map} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NoydbStore, DirtyEntry, ConflictStrategy, CollectionConflictResolver, PushOptions, PullOptions, PushResult, PullResult, SyncStatus, SyncTargetRole } from '../kernel/types.js';
|
|
2
|
+
import type { MergeAuthority } from '../port/with/merge-authority.js';
|
|
2
3
|
import { type PeriodPullSource } from './period-scope.js';
|
|
3
4
|
import type { NoydbEventEmitter } from '../kernel/events.js';
|
|
4
5
|
import type { SyncPolicy } from '../kernel/sync-policy.js';
|
|
@@ -12,6 +13,7 @@ export interface ReservedLookupSource {
|
|
|
12
13
|
}
|
|
13
14
|
/** Sync engine: dirty tracking, push, pull, conflict resolution, scheduling. */
|
|
14
15
|
export declare class SyncEngine {
|
|
16
|
+
private readonly mergeAuthority;
|
|
15
17
|
private readonly local;
|
|
16
18
|
private readonly remote;
|
|
17
19
|
private readonly strategy;
|
|
@@ -101,6 +103,15 @@ export declare class SyncEngine {
|
|
|
101
103
|
syncPolicy?: SyncPolicy;
|
|
102
104
|
role?: SyncTargetRole;
|
|
103
105
|
label?: string;
|
|
106
|
+
/**
|
|
107
|
+
* #1042 — the merge's verify/re-stamp capability. Optional so an engine
|
|
108
|
+
* built without one behaves exactly as before; the Vault supplies it.
|
|
109
|
+
*
|
|
110
|
+
* A closure, not an import: `with-sync` is DEK-free and
|
|
111
|
+
* `check:architecture` enforces that, so the capability arrives already
|
|
112
|
+
* bound to the keys rather than the engine reaching for them.
|
|
113
|
+
*/
|
|
114
|
+
mergeAuthority?: MergeAuthority;
|
|
104
115
|
});
|
|
105
116
|
/** Start the sync scheduler. Called after vault is fully opened. */
|
|
106
117
|
startScheduler(): void;
|
|
@@ -189,11 +200,28 @@ export declare class SyncEngine {
|
|
|
189
200
|
* the remote's (the same-`_v` push tie), re-stamp it at `remote._v + 1`.
|
|
190
201
|
* Without this the loser's next pull sees no delta (`_v`-based
|
|
191
202
|
* detection) and the peers stay silently diverged at the same version.
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
203
|
+
* ## Why this is async, and why it goes through `MergeAuthority` (#1093)
|
|
204
|
+
*
|
|
205
|
+
* It used to be `{ ...winner, _v: remote._v + 1 }` — a metadata restamp on
|
|
206
|
+
* ciphertext the engine cannot decrypt. That spread was the SOLE reason `_v`
|
|
207
|
+
* could not be bound into the AAD: a version rewritten onto a body sealed at
|
|
208
|
+
* a different one produces a record no reader can open.
|
|
209
|
+
*
|
|
210
|
+
* `with-sync` is DEK-free by design and `check:architecture` enforces it, so
|
|
211
|
+
* the re-seal cannot happen here. It happens in the injected authority, which
|
|
212
|
+
* holds the keys. The engine still decides WHICH version to advance to; it
|
|
213
|
+
* simply no longer pretends it can rewrite a sealed body.
|
|
214
|
+
*
|
|
215
|
+
* The authority is ALWAYS present in the product — `kernel/noydb.ts` builds
|
|
216
|
+
* one from the keyring and passes it at both engine-construction sites, and
|
|
217
|
+
* `with-sync/active.ts` is the only place an engine is constructed. The
|
|
218
|
+
* fallback below is reachable only by constructing `SyncEngine` directly,
|
|
219
|
+
* which tests do. It restamps, as before — and would produce an unreadable
|
|
220
|
+
* record if such a test ever held AEAD-sealed envelopes. None do; the
|
|
221
|
+
* fixtures that reach it build their own plaintext ones.
|
|
222
|
+
*
|
|
223
|
+
* The 'merged' branch needs none of this: resolver output is already stamped
|
|
224
|
+
* `max(local, remote) + 1` by whoever built it.
|
|
197
225
|
*/
|
|
198
226
|
private advancePastRemote;
|
|
199
227
|
private applyRemote;
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
import type { NoydbStore, ConflictStrategy, SyncTargetRole } from '../kernel/types.js';
|
|
28
|
+
import type { MergeAuthority } from '../port/with/merge-authority.js';
|
|
28
29
|
import type { NoydbEventEmitter } from '../kernel/events.js';
|
|
29
30
|
import type { SyncPolicy } from '../kernel/sync-policy.js';
|
|
30
31
|
import type { SyncEngine } from './engine.js';
|
|
@@ -47,6 +48,8 @@ export interface BuildSyncEngineOptions {
|
|
|
47
48
|
syncPolicy?: SyncPolicy;
|
|
48
49
|
role?: SyncTargetRole;
|
|
49
50
|
label?: string;
|
|
51
|
+
/** #1042 — the merge's verify/re-stamp capability, bound to the keys by the caller. */
|
|
52
|
+
mergeAuthority?: MergeAuthority;
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
55
|
* @internal
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
freezeSnapshotOnly,
|
|
5
5
|
randomId,
|
|
6
6
|
withdrawAccessibleData
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-TXDOMADN.js";
|
|
8
|
+
import "./chunk-BBU3OD3D.js";
|
|
9
|
+
import "./chunk-TNOQNU3R.js";
|
|
10
|
+
import "./chunk-O4QDBAB6.js";
|
|
11
|
+
import "./chunk-X3AXSYBL.js";
|
|
12
|
+
import "./chunk-ZVAFJQZB.js";
|
|
13
13
|
import "./chunk-FSZPQCDR.js";
|
|
14
14
|
import "./chunk-HVR74IBG.js";
|
|
15
15
|
import "./chunk-RBTZLXZJ.js";
|
|
16
16
|
import "./chunk-LP7BEXCT.js";
|
|
17
17
|
import "./chunk-QTDAPDDV.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-3Y4OFWQJ.js";
|
|
19
19
|
import "./chunk-I64WQSN3.js";
|
|
20
20
|
import "./chunk-PZ5AY32C.js";
|
|
21
21
|
export {
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
randomId,
|
|
26
26
|
withdrawAccessibleData
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=withdraw-accessible-
|
|
28
|
+
//# sourceMappingURL=withdraw-accessible-GHBA4DAA.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noy-db/hub",
|
|
3
|
-
"version": "0.6.0-pre.
|
|
3
|
+
"version": "0.6.0-pre.18",
|
|
4
4
|
"description": "Zero-knowledge, offline-first, encrypted document store — core library with AES-256-GCM, PBKDF2, multi-user keyring, and sync engine",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "vLannaAi <vicio@lanna.ai>",
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
"types": "./dist/with-party/session/index.d.ts",
|
|
38
38
|
"default": "./dist/session/index.js"
|
|
39
39
|
},
|
|
40
|
+
"./vault-head": {
|
|
41
|
+
"types": "./dist/with-commit/vault-head/index.d.ts",
|
|
42
|
+
"default": "./dist/vault-head/index.js"
|
|
43
|
+
},
|
|
40
44
|
"./history": {
|
|
41
45
|
"types": "./dist/with-commit/history/index.d.ts",
|
|
42
46
|
"default": "./dist/history/index.js"
|
|
@@ -211,14 +215,14 @@
|
|
|
211
215
|
"node": ">=22.0.0"
|
|
212
216
|
},
|
|
213
217
|
"dependencies": {
|
|
214
|
-
"@noy-db/attestation": "0.6.0-pre.
|
|
218
|
+
"@noy-db/attestation": "0.6.0-pre.18"
|
|
215
219
|
},
|
|
216
220
|
"devDependencies": {
|
|
217
221
|
"@types/node": "^22.0.0",
|
|
218
222
|
"esbuild": "^0.25.0",
|
|
219
223
|
"zod": "^4.0.0",
|
|
220
224
|
"zod-to-json-schema": "^3.25.2",
|
|
221
|
-
"@noy-db/on-shamir": "0.6.0-pre.
|
|
225
|
+
"@noy-db/on-shamir": "0.6.0-pre.18"
|
|
222
226
|
},
|
|
223
227
|
"peerDependencies": {
|
|
224
228
|
"zod-to-json-schema": "^3.25.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/with-commit/sequence/active.ts","../src/with-commit/sequence/strategy.ts","../src/with-commit/sequence/index.ts"],"sourcesContent":["/**\n * Enable the atomic-sequence capability.\n * Pass to `createNoydb({ sequenceStrategy: withSequence() })` to make\n * `vault.sequence('name').next()` / `.peek()` / `.seedTo()` live. The\n * {@link SequenceStore} CAS engine is statically imported here, so it is pulled\n * into the bundle only when `withSequence()` is referenced (the floor never\n * imports it).\n */\nimport type { SequenceStrategy } from './strategy.js'\nimport { SequenceStore } from './index.js'\n\nexport function withSequence(): SequenceStrategy {\n return {\n createStore(opts) {\n return new SequenceStore(opts)\n },\n }\n}\n","/**\n * Sequence capability strategy — the single on-demand factory the vault routes\n * `vault.sequence()` through to build its atomic-CAS {@link SequenceStore}. The\n * active engine ({@link withSequence}) constructs the real store (kept out of\n * the floor bundle — the store class is reached only via the opt-in\n * `active.ts` chunk); {@link NO_SEQUENCE} throws. The vault always assembles the\n * per-call {@link SequenceStoreOptions} and delegates here, so an un-opted-in\n * caller hits `NO_SEQUENCE`'s throw at `vault.sequence()`.\n *\n * Note: `vault.sequence()` is synchronous, so the factory is a plain (sync)\n * constructor — the engine is tree-shaken by reachability (only `withSequence()`\n * pulls `active.ts`, which statically imports the store), not by a dynamic\n * import. Deferred-numbering series (`withDeferredNumbering`) are a distinct\n * capability and are NOT routed through this strategy.\n * @internal\n */\nimport type { SequenceStore, SequenceStoreOptions } from './index.js'\nimport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport interface SequenceStrategy {\n createStore(opts: SequenceStoreOptions): SequenceStore\n}\n\n/**\n * No-op stub — the floor default. The capability factory throws\n * {@link SequenceNotEnabledError}; opt in with `sequenceStrategy: withSequence()`\n * in createNoydb. @internal\n */\nexport const NO_SEQUENCE: SequenceStrategy = {\n createStore(): SequenceStore {\n throw new SequenceNotEnabledError()\n },\n}\n","/**\n * Atomic sequence primitive — online-coordinated gap-free numbering.\n *\n * `vault.sequence('invoice-2026').next()` returns 1, 2, 3, … with no\n * gaps and no duplicates, even under concurrent callers. Each named\n * sequence is an independent counter record at `_sequences/<name>`,\n * incremented with an optimistic compare-and-swap retry loop — the same\n * proven pattern as the ledger head (`history/ledger/store.ts`).\n *\n * **Explicitly online-only.** Gap-free numbering requires single-authority\n * serialization, which an offline / non-CAS store cannot provide. `next()`\n * throws {@link SequenceOfflineError} unless the backing store advertises\n * `capabilities.casAtomic`. This is a deliberate, honest wall — an offline\n * writer cannot safely allocate a global sequence number.\n *\n * Note on \"gap-free\": the *sequence* is gap-free (each `next()` yields a\n * unique, +1 value). If a caller discards a value without using it, that\n * is a gap in *usage*, not in the sequence — assign each `next()` result\n * to its record in the same operation.\n */\n\nimport { buildRecordEnvelope } from '../../kernel/enclave/index.js'\nimport type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport type { ConflictError} from '../../kernel/errors.js';\nimport { isConflictError, SequenceContentionError, SequenceOfflineError, ValidationError } from '../../kernel/errors.js'\n\n// Capability opt-in seam (S4): `vault.sequence()` builds its CAS store through\n// the sequenceStrategy, so it throws SequenceNotEnabledError unless opted in.\nexport { withSequence } from './active.js'\nexport { NO_SEQUENCE, type SequenceStrategy } from './strategy.js'\nexport { SequenceNotEnabledError } from '../../kernel/errors.js'\n\nexport const SEQUENCE_COLLECTION = '_sequences'\n// A sequence is a single hot CAS row — higher contention than a ledger\n// append. A larger budget + jittered backoff absorbs moderate concurrency;\n// a genuine burst beyond this surfaces SequenceContentionError so the\n// caller can retry / queue (the honest online-only contract).\nconst MAX_NEXT_ATTEMPTS = 16\n\ninterface SequenceState {\n value: number\n}\n\n/** Options for `SequenceHandle.next`. Deferred-numbering series use `for`; the CAS counter ignores all of these. */\nexport interface NextOptions {\n /** Deferred mode: the record id to number. Ignored by the CAS counter. */\n readonly for?: string\n /** Deferred mode: reject after this many ms if still unsealed (reserved; not yet enforced in this slice). */\n readonly timeoutMs?: number\n}\n\n/**\n * Partitioning for a CAS sequence. A partitioned sequence is an\n * independent counter scoped to one tuple of values — e.g.\n * `sequence('invoice', { partition: [2026, 'EU'] })` numbers EU-2026 invoices\n * separately from `[2026, 'US']` and from the bare `invoice` series.\n *\n * Partition components are URI-encoded (so `/`, null bytes and other\n * separators in a value can never collide with the structural separators) and\n * `'/'`-joined, then appended to the series with a null-byte (`\\x00`)\n * separator. The null byte is illegal in a plain series name, which guarantees\n * a partitioned key is always disjoint from any unpartitioned series.\n */\nexport interface SequenceOptions {\n /** Partition tuple. Each component is URI-encoded and `'/'`-joined. */\n readonly partition?: readonly (string | number)[]\n /**\n * Render template for the serial string. When set, `vault.sequence`\n * returns a {@link FormattedSequenceHandle} whose `next()` resolves to\n * `{ serial, formatted }`. Tokens:\n * - `{seq}` — the allocated integer\n * - `{seq:0N}` — zero-padded to width N (e.g. `{seq:04}` → `0001`)\n * - `{partition.i}` — the i-th `partition` component (original value)\n *\n * Any other token, or a `{partition.i}` index beyond the supplied\n * `partition`, throws `ValidationError` at `vault.sequence()` construction.\n * Per-partition reset is inherent: a new partition tuple starts at 1.\n */\n readonly format?: string\n}\n\n/**\n * A formatted sequence handle. Identical to {@link SequenceHandle}\n * except `next()` also returns the rendered `formatted` string. `peek()` /\n * `seedTo()` operate on the underlying integer counter, unchanged.\n */\nexport interface FormattedSequenceHandle {\n /** Allocate the next value and return it with its rendered serial string. */\n next(opts?: NextOptions): Promise<{ serial: number; formatted: string }>\n /** Read the current integer value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /** Set-if-greater on the underlying integer counter. See {@link SequenceHandle.seedTo}. */\n seedTo(n: number): Promise<void>\n}\n\n// Matches a single `{...}` token with no nested braces.\nconst SEQ_FORMAT_TOKEN = /\\{([^{}]*)\\}/g\nconst SEQ_PAD_TOKEN = /^seq:0(\\d+)$/\nconst SEQ_PARTITION_TOKEN = /^partition\\.(\\d+)$/\n\n/**\n * Validate a sequence `format` against the supplied partition and return a\n * pure `(serial) => string` renderer. Eager validation: every token is\n * checked now, so a bad pattern throws `ValidationError` at construction —\n * never at `next()` time.\n */\nexport function compileSequenceFormat(\n format: string,\n series: string,\n partition: readonly (string | number)[] | undefined,\n): (serial: number) => string {\n const parts = partition ?? []\n for (const m of format.matchAll(SEQ_FORMAT_TOKEN)) {\n const token = m[1] ?? ''\n if (token === 'seq') continue\n if (SEQ_PAD_TOKEN.test(token)) continue\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) {\n const idx = Number(partMatch[1])\n if (idx >= parts.length) {\n throw new ValidationError(\n `sequence(\"${series}\"): format token \"{${token}}\" references partition index ${idx}, ` +\n `but only ${parts.length} partition component(s) were supplied.`,\n )\n }\n continue\n }\n throw new ValidationError(\n `sequence(\"${series}\"): format contains unknown token \"{${token}}\". ` +\n `Accepted tokens: {seq}, {seq:0N}, {partition.i}.`,\n )\n }\n return (serial: number): string =>\n format.replace(SEQ_FORMAT_TOKEN, (full, token: string) => {\n if (token === 'seq') return String(serial)\n const padMatch = SEQ_PAD_TOKEN.exec(token)\n if (padMatch) return String(serial).padStart(Number(padMatch[1]), '0')\n const partMatch = SEQ_PARTITION_TOKEN.exec(token)\n if (partMatch) return String(parts[Number(partMatch[1])])\n return full // unreachable — validated above\n })\n}\n\n/**\n * Resolve the CAS storage key for a (series, partition) pair.\n *\n * With no partition the key is `series` verbatim. With a partition the key is\n * `${series}\\x00${parts}` where `parts` is each component passed through\n * `encodeURIComponent(String(part))` and `'/'`-joined. The null-byte separator\n * is illegal in a plain series name, so partitioned keys never collide with\n * unpartitioned ones; URI-encoding keeps any component containing `/` distinct\n * from a multi-component partition.\n *\n * @throws {ValidationError} if any partition component is empty after `String()`\n * or is a non-finite number (`NaN`, `±Infinity`).\n */\nexport function resolveSequenceKey(series: string, opts?: SequenceOptions): string {\n const partition = opts?.partition\n if (!partition || partition.length === 0) return series\n const parts = partition.map((p) => {\n if (typeof p === 'number' && !Number.isFinite(p)) {\n throw new ValidationError(`sequence partition component must be a finite number, got ${p}`)\n }\n const s = String(p)\n if (s === '') {\n throw new ValidationError('sequence partition component must not be empty')\n }\n return encodeURIComponent(s)\n })\n return `${series}\\x00${parts.join('/')}`\n}\n\nexport interface SequenceHandle {\n /** Atomically allocate and return the next value (1, 2, 3, …). Deferred series resolve at the next pass. */\n next(opts?: NextOptions): Promise<number>\n /** Read the current value without allocating. Returns 0 if never used. */\n peek(): Promise<number>\n /**\n * Set-if-greater: advance the counter to at least `n`. A no-op if the\n * current value is already `>= n` (so it never rewinds), and `seedTo(0)` is\n * a no-op. Idempotent and CAS-safe under concurrent `next()` / `seedTo()`.\n *\n * Use after a bundle / CSV import to fast-forward the counter past the\n * highest imported serial, so subsequent `next()` calls cannot re-use a\n * number that is already on a record.\n *\n * Online-only: throws {@link SequenceOfflineError} on a non-CAS store.\n */\n seedTo(n: number): Promise<void>\n}\n\nasync function sleepBackoff(attempt: number): Promise<void> {\n // Exponential backoff with full jitter to break the thundering herd\n // when many writers contend on the same counter row.\n const ceil = Math.min(2 ** attempt, 32)\n const ms = Math.floor(Math.random() * ceil)\n await new Promise((r) => setTimeout(r, ms))\n}\n\n/** Per-call context the vault assembles to build a {@link SequenceStore}. */\nexport interface SequenceStoreOptions {\n adapter: NoydbStore\n vault: string\n encrypted: boolean\n getDEK: (collectionName: string) => Promise<EnclaveKey>\n actor: string\n}\n\nexport class SequenceStore {\n private readonly adapter: NoydbStore\n private readonly vault: string\n private readonly encrypted: boolean\n private readonly getDEK: (collectionName: string) => Promise<EnclaveKey>\n private readonly actor: string\n /**\n * Memoized DEK promise. The `_sequences` collection DEK is created on\n * first access; without sharing one promise, a burst of concurrent\n * `next()` calls would each trigger DEK creation and diverge (one\n * writer's ciphertext unreadable by another). One shared promise → one\n * DEK.\n */\n private dekPromise: Promise<EnclaveKey> | null = null\n\n constructor(opts: SequenceStoreOptions) {\n this.adapter = opts.adapter\n this.vault = opts.vault\n this.encrypted = opts.encrypted\n this.getDEK = opts.getDEK\n this.actor = opts.actor\n }\n\n /** A handle bound to one sequence name. */\n handle(name: string): SequenceHandle {\n return {\n next: () => this.next(name),\n peek: () => this.peek(name),\n seedTo: (n) => this.seedTo(name, n),\n }\n }\n\n private assertOnline(): void {\n if (this.adapter.capabilities?.casAtomic !== true) {\n throw new SequenceOfflineError()\n }\n }\n\n private dek(): Promise<EnclaveKey> {\n if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION)\n return this.dekPromise\n }\n\n private async read(name: string): Promise<{ env: EncryptedEnvelope | null; value: number }> {\n const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name)\n if (!env) return { env: null, value: 0 }\n const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data\n const state = JSON.parse(json) as SequenceState\n return { env, value: state.value }\n }\n\n private async encryptState(name: string, state: SequenceState, version: number): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(state)\n if (!this.encrypted) {\n return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name }, { version, iv: '', data: json, by: this.actor })\n }\n const { iv, data } = await encrypt(json, await this.dek())\n return buildRecordEnvelope({ collection: SEQUENCE_COLLECTION, id: name }, { version, iv, data, by: this.actor })\n }\n\n async peek(name: string): Promise<number> {\n return (await this.read(name)).value\n }\n\n async next(name: string): Promise<number> {\n this.assertOnline()\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n const nextValue = value + 1\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: nextValue }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return nextValue\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n\n async seedTo(name: string, n: number): Promise<void> {\n this.assertOnline()\n if (n <= 0) return // set-if-greater: 0 (and any non-positive seed) is a no-op\n let lastConflict: ConflictError | undefined\n for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {\n const { env, value } = await this.read(name)\n if (value >= n) return // already at or past the floor — no write, idempotent\n const expectedVersion = env?._v ?? 0 // 0 ≡ \"must not yet exist\" (create)\n const envelope = await this.encryptState(name, { value: n }, expectedVersion + 1)\n try {\n await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion)\n return\n } catch (err) {\n if (isConflictError(err)) {\n lastConflict = err\n if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt)\n continue\n }\n throw err\n }\n }\n void lastConflict\n throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWO,SAAS,eAAiC;AAC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AkB,KAAK,MAAM;AACnC,YAAM,WAAW,MAAM,KAAK,aAAa,MAAM,EAAE,OAAO,UAAU,GAAG,kBAAkB,CAAC;AACxF,UAAI;AACF,cAAM,KAAK,QAAQ,IAAI,KAAK,OAAO,qBAAqB,MAAM,UAAU,eAAe;AACvF,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,YAAI,gBAAgB,GAAG,GAAG;AACxB,yBAAe;AACf,cAAI,UAAU,oBAAoB,EAAG,OAAM,aAAa,OAAO;AAC/D;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AACA,SAAK;AACL,UAAM,IAAI,wBAAwB,MAAM,iBAAiB;AAAA,EAC3D;AAAA,EAEA,MAAM,OAAO,MAAc,GAA0B;AACnD,SAAK,aAAa;AAClB,QAAI,KAAK,EAAG;AACZ,QAAI;AACJ,aAAS,UAAU,GAAG,UAAU,mBAAmB,WAAW;AAC5D,YAAM,EAAE,KAAK,MAAM,IAAI,MAAM,KAAK,KAAK,IAAI;AAC3C,UAAI,SAAS,EAAG;AAChB,YAAM,kBAAkB,KAAK,MAAM;AACnC,YAAM,WAAW,MAAM,KAAK,aAAa,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;AAChF,UAAI;AACF,cAAM,KAAK,QAAQ,IAAI,KAAK,OAAO,qBAAqB,MAAM,UAAU,eAAe;AACvF;AAAA,MACF,SAAS,KAAK;AACZ,YAAI,gBAAgB,GAAG,GAAG;AACxB,yBAAe;AACf,cAAI,UAAU,oBAAoB,EAAG,OAAM,aAAa,OAAO;AAC/D;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AACA,SAAK;AACL,UAAM,IAAI,wBAAwB,MAAM,iBAAiB;AAAA,EAC3D;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/with-audit/attestation/issue.ts"],"sourcesContent":["import type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { encrypt, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { AttestationError } from '../../kernel/errors.js'\nimport { generateULID } from '../../with-pod/ulid.js'\nimport { loadOrCreateSigner, ATTESTATIONS_COLLECTION } from './signer.js'\nimport {\n computeFieldHashes, signPayloadCore, encodeQr, bytesToB64url,\n type AttestationFieldSchema, type QrPayload,\n} from '@noy-db/attestation'\n\n/** Everything issueAttestationCore needs from the Vault, injected for testability. */\nexport interface IssueContext {\n readonly store: NoydbStore\n readonly vault: string\n readonly role: string\n /** The _attestations collection DEK (AES-KW-wrapped under KEK by the keyring). */\n getDEK(): Promise<EnclaveKey>\n /** Decrypted source record + its envelope version, or null if absent. */\n readRecord(collection: string, id: string): Promise<{ record: Record<string, unknown>; version: number } | null>\n}\n\nexport interface IssueArgs {\n readonly collection: string\n readonly id: string\n readonly fieldSchema: AttestationFieldSchema\n}\nexport interface IssueResult {\n readonly docId: string\n readonly qr: string\n readonly payload: QrPayload\n readonly keyId: string\n readonly publicKeyB64: string\n}\n\nexport async function issueAttestationCore(ctx: IssueContext, args: IssueArgs): Promise<IssueResult> {\n if (ctx.role !== 'owner') {\n throw new AttestationError(`issueAttestation requires the 'owner' role; caller is '${ctx.role}'. Issuing a signed attestation is the firm's identity operation.`)\n }\n const src = await ctx.readRecord(args.collection, args.id)\n if (!src) throw new AttestationError(`issueAttestation: source record '${args.collection}/${args.id}' not found.`)\n\n const dek = await ctx.getDEK()\n // ONE signer implementation, from signer.ts. Lazily minted + persisted.\n const signer = await loadOrCreateSigner(ctx.store, ctx.vault, () => Promise.resolve(dek))\n\n const saltB64 = bytesToB64url(crypto.getRandomValues(new Uint8Array(16)))\n let fieldHashes: string[]\n try {\n fieldHashes = await computeFieldHashes(saltB64, args.fieldSchema, src.record)\n } catch (e) {\n throw new AttestationError(`issueAttestation: ${(e as Error).message}`)\n }\n const docId = generateULID()\n\n const sig = await signPayloadCore({ v: 1, docId, salt: saltB64, keyId: signer.keyId, fieldHashes }, signer.privateKeyPkcs8B64)\n const payload: QrPayload = { v: 1, docId, salt: saltB64, alg: 'ed25519', keyId: signer.keyId, fieldHashes, sig }\n\n const index = {\n docId, issuedAt: new Date().toISOString(), keyId: signer.keyId,\n fieldPaths: args.fieldSchema.fields.map((f) => f.path),\n sourceRefs: [{ collection: args.collection, id: args.id, version: src.version }],\n }\n const { iv, data } = await encrypt(JSON.stringify(index), dek)\n const env: EncryptedEnvelope = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: index.issuedAt, _iv: iv, _data: data }\n await ctx.store.put(ctx.vault, ATTESTATIONS_COLLECTION, docId, env)\n\n return { docId, qr: encodeQr(payload), payload, keyId: signer.keyId, publicKeyB64: signer.publicKeyB64 }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAMA;AAAA,EACE;AAAA,EAAoB;AAAA,EAAiB;AAAA,EAAU;AAAA,OAE1C;AA0BP,eAAsB,qBAAqB,KAAmB,MAAuC;AACnG,MAAI,IAAI,SAAS,SAAS;AACxB,UAAM,IAAI,iBAAiB,0DAA0D,IAAI,IAAI,mEAAmE;AAAA,EAClK;AACA,QAAM,MAAM,MAAM,IAAI,WAAW,KAAK,YAAY,KAAK,EAAE;AACzD,MAAI,CAAC,IAAK,OAAM,IAAI,iBAAiB,oCAAoC,KAAK,UAAU,IAAI,KAAK,EAAE,cAAc;AAEjH,QAAM,MAAM,MAAM,IAAI,OAAO;AAE7B,QAAM,SAAS,MAAM,mBAAmB,IAAI,OAAO,IAAI,OAAO,MAAM,QAAQ,QAAQ,GAAG,CAAC;AAExF,QAAM,UAAU,cAAc,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;AACxE,MAAI;AACJ,MAAI;AACF,kBAAc,MAAM,mBAAmB,SAAS,KAAK,aAAa,IAAI,MAAM;AAAA,EAC9E,SAAS,GAAG;AACV,UAAM,IAAI,iBAAiB,qBAAsB,EAAY,OAAO,EAAE;AAAA,EACxE;AACA,QAAM,QAA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