@noy-db/hub 0.2.0-pre.9 → 0.3.0-pre.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -3
- package/dist/aggregate/index.d.ts +5 -2
- package/dist/aggregate/index.js +25 -16
- package/dist/aggregate/index.js.map +1 -1
- package/dist/api-TX2EX2FX.js +20 -0
- package/dist/as/index.d.ts +6 -0
- package/dist/as/index.js +30 -0
- package/dist/at/index.d.ts +4 -0
- package/dist/at/index.js +1 -0
- package/dist/attestation/index.d.ts +14 -47
- package/dist/attestation/index.js +60 -10
- package/dist/attestation/index.js.map +1 -1
- package/dist/backup-R7NTDFKY.js +225 -0
- package/dist/backup-R7NTDFKY.js.map +1 -0
- package/dist/blobs/index.d.ts +5 -8
- package/dist/blobs/index.js +25 -12
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.d.ts +15 -70
- package/dist/bundle/index.js +45 -476
- package/dist/bundle/index.js.map +1 -1
- package/dist/{ulid-CJ8RzRrm.d.ts → bundle-D6GxiUfq.d.ts} +31 -86
- package/dist/by/index.d.ts +1 -0
- package/dist/by/index.js +11 -0
- package/dist/cargo/index.d.ts +7 -0
- package/dist/cargo/index.js +95 -0
- package/dist/chunk-2OV5NVE7.js +95 -0
- package/dist/chunk-2OV5NVE7.js.map +1 -0
- package/dist/chunk-2OZXVKVP.js +367 -0
- package/dist/chunk-2OZXVKVP.js.map +1 -0
- package/dist/{chunk-HNRHLRDC.js → chunk-2REPHKET.js} +6 -5
- package/dist/chunk-2REPHKET.js.map +1 -0
- package/dist/{chunk-PE2FR4J3.js → chunk-3JXPAHOZ.js} +17 -17
- package/dist/chunk-3JXPAHOZ.js.map +1 -0
- package/dist/{chunk-H2X3ISXG.js → chunk-3MATJ6O4.js} +7 -7
- package/dist/chunk-3MATJ6O4.js.map +1 -0
- package/dist/{chunk-PP6W64Y3.js → chunk-3OPY6MK2.js} +132 -3
- package/dist/chunk-3OPY6MK2.js.map +1 -0
- package/dist/{chunk-T7JEBOGN.js → chunk-3QSIU3UT.js} +49 -71
- package/dist/chunk-3QSIU3UT.js.map +1 -0
- package/dist/{chunk-ZYWZWG6G.js → chunk-4OMCIY6F.js} +32 -12
- package/dist/chunk-4OMCIY6F.js.map +1 -0
- package/dist/chunk-4Q6HSHHL.js +90 -0
- package/dist/chunk-4Q6HSHHL.js.map +1 -0
- package/dist/chunk-5I35DOHK.js +94 -0
- package/dist/chunk-5I35DOHK.js.map +1 -0
- package/dist/chunk-5VG4IJR7.js +235 -0
- package/dist/chunk-5VG4IJR7.js.map +1 -0
- package/dist/chunk-5YESYH2C.js +155 -0
- package/dist/chunk-5YESYH2C.js.map +1 -0
- package/dist/chunk-6G5ORS5D.js +202 -0
- package/dist/chunk-6G5ORS5D.js.map +1 -0
- package/dist/{chunk-VTKGMEPP.js → chunk-6P5XCKSD.js} +13 -3
- package/dist/chunk-6P5XCKSD.js.map +1 -0
- package/dist/{chunk-J66GRPNH.js → chunk-6S7T6WC4.js} +2 -2
- package/dist/chunk-6S7T6WC4.js.map +1 -0
- package/dist/{chunk-U26HQ6KJ.js → chunk-7BWJHO2A.js} +4 -4
- package/dist/chunk-7BWJHO2A.js.map +1 -0
- package/dist/chunk-7P2SDJG3.js +279 -0
- package/dist/chunk-7P2SDJG3.js.map +1 -0
- package/dist/chunk-ANB77BVV.js +150 -0
- package/dist/chunk-ANB77BVV.js.map +1 -0
- package/dist/chunk-AURFOK3D.js +35 -0
- package/dist/chunk-AURFOK3D.js.map +1 -0
- package/dist/chunk-BKARNZJN.js +382 -0
- package/dist/chunk-BKARNZJN.js.map +1 -0
- package/dist/{chunk-3BFJOWSU.js → chunk-BQISD5ZV.js} +35 -7
- package/dist/chunk-BQISD5ZV.js.map +1 -0
- package/dist/{chunk-2GLDA55J.js → chunk-BUAQ7YI3.js} +260 -135
- package/dist/chunk-BUAQ7YI3.js.map +1 -0
- package/dist/{chunk-2WUSG3IT.js → chunk-CB7CWSKW.js} +5 -5
- package/dist/chunk-CB7CWSKW.js.map +1 -0
- package/dist/chunk-CHFZDSE4.js +1 -0
- package/dist/{aggregate/index.cjs → chunk-DFVUTGT2.js} +206 -222
- package/dist/chunk-DFVUTGT2.js.map +1 -0
- package/dist/chunk-DJ7KIPLV.js +23 -0
- package/dist/chunk-DJ7KIPLV.js.map +1 -0
- package/dist/chunk-DSKDQP3G.js +14066 -0
- package/dist/chunk-DSKDQP3G.js.map +1 -0
- package/dist/{chunk-5T22KDPN.js → chunk-DV4HUP5G.js} +10 -8
- package/dist/chunk-DV4HUP5G.js.map +1 -0
- package/dist/chunk-EOXAAJTY.js +621 -0
- package/dist/chunk-EOXAAJTY.js.map +1 -0
- package/dist/chunk-ET67AY6B.js +74 -0
- package/dist/chunk-ET67AY6B.js.map +1 -0
- package/dist/chunk-F4CEK5YM.js +123 -0
- package/dist/chunk-F4CEK5YM.js.map +1 -0
- package/dist/chunk-FORYWFN6.js +130 -0
- package/dist/chunk-FORYWFN6.js.map +1 -0
- package/dist/{chunk-JWRVQKRZ.js → chunk-FRP6D2DM.js} +21 -20
- package/dist/chunk-FRP6D2DM.js.map +1 -0
- package/dist/chunk-FUOE7UUV.js +341 -0
- package/dist/chunk-FUOE7UUV.js.map +1 -0
- package/dist/chunk-G4JYND6L.js +42 -0
- package/dist/chunk-G4JYND6L.js.map +1 -0
- package/dist/{chunk-53XBRIRT.js → chunk-G6XV4H65.js} +9 -9
- package/dist/chunk-G6XV4H65.js.map +1 -0
- package/dist/chunk-GHVIKOHT.js +1 -0
- package/dist/{chunk-PX35GA7L.js → chunk-GNMXXTMN.js} +11 -9
- package/dist/chunk-GNMXXTMN.js.map +1 -0
- package/dist/chunk-GYGLAVCX.js +19 -0
- package/dist/chunk-GYGLAVCX.js.map +1 -0
- package/dist/chunk-HPWKV3YB.js +21 -0
- package/dist/chunk-HPWKV3YB.js.map +1 -0
- package/dist/chunk-HY3AUMFI.js +41 -0
- package/dist/chunk-HY3AUMFI.js.map +1 -0
- package/dist/chunk-HYR4WZZ3.js +69 -0
- package/dist/chunk-HYR4WZZ3.js.map +1 -0
- package/dist/chunk-I7FD46FF.js +9 -0
- package/dist/chunk-I7FD46FF.js.map +1 -0
- package/dist/{chunk-TFBP23BX.js → chunk-ICXIFFYZ.js} +66 -7
- package/dist/chunk-ICXIFFYZ.js.map +1 -0
- package/dist/{chunk-TV3YZ35S.js → chunk-IGJCYUT5.js} +17 -8
- package/dist/chunk-IGJCYUT5.js.map +1 -0
- package/dist/{chunk-F3GDRNUT.js → chunk-IVLTXX4W.js} +36 -68
- package/dist/chunk-IVLTXX4W.js.map +1 -0
- package/dist/{chunk-DONMZAD2.js → chunk-J4LPNIGK.js} +62 -169
- package/dist/chunk-J4LPNIGK.js.map +1 -0
- package/dist/chunk-JJZ2LW6T.js +36 -0
- package/dist/chunk-JJZ2LW6T.js.map +1 -0
- package/dist/chunk-JK733I5V.js +23 -0
- package/dist/chunk-JK733I5V.js.map +1 -0
- package/dist/{chunk-3YPCK6JX.js → chunk-KJ2BCBTL.js} +181 -422
- package/dist/chunk-KJ2BCBTL.js.map +1 -0
- package/dist/chunk-KNZB6JMR.js +129 -0
- package/dist/chunk-KNZB6JMR.js.map +1 -0
- package/dist/{chunk-OIF6LZUR.js → chunk-KPZS5QAQ.js} +30 -11
- package/dist/chunk-KPZS5QAQ.js.map +1 -0
- package/dist/chunk-LB7FD65R.js +163 -0
- package/dist/chunk-LB7FD65R.js.map +1 -0
- package/dist/{chunk-DO7C2TOG.js → chunk-LEJIKBBB.js} +3 -3
- package/dist/{chunk-DO7C2TOG.js.map → chunk-LEJIKBBB.js.map} +1 -1
- package/dist/{chunk-O3VZPBZG.js → chunk-LL2NIVUR.js} +56 -13
- package/dist/chunk-LL2NIVUR.js.map +1 -0
- package/dist/chunk-LP7BEXCT.js +32 -0
- package/dist/chunk-LP7BEXCT.js.map +1 -0
- package/dist/chunk-MCHVVJIA.js +968 -0
- package/dist/chunk-MCHVVJIA.js.map +1 -0
- package/dist/chunk-NO272T7Q.js +194 -0
- package/dist/chunk-NO272T7Q.js.map +1 -0
- package/dist/{chunk-22DWZL57.js → chunk-NUEQU36L.js} +70 -267
- package/dist/chunk-NUEQU36L.js.map +1 -0
- package/dist/chunk-O45M6LDB.js +38 -0
- package/dist/chunk-O45M6LDB.js.map +1 -0
- package/dist/chunk-OBKWYKYC.js +117 -0
- package/dist/chunk-OBKWYKYC.js.map +1 -0
- package/dist/{chunk-DJHHA6XH.js → chunk-OHHKHSJP.js} +50 -20
- package/dist/chunk-OHHKHSJP.js.map +1 -0
- package/dist/chunk-OT76OZL6.js +45 -0
- package/dist/chunk-OT76OZL6.js.map +1 -0
- package/dist/chunk-OVYRLHPE.js +150 -0
- package/dist/chunk-OVYRLHPE.js.map +1 -0
- package/dist/{chunk-ML236QKC.js → chunk-OXCSVM3B.js} +5 -5
- package/dist/chunk-OXCSVM3B.js.map +1 -0
- package/dist/chunk-P33LUIML.js +205 -0
- package/dist/chunk-P33LUIML.js.map +1 -0
- package/dist/{chunk-DL3HWOQ5.js → chunk-PLS64NCS.js} +10 -8
- package/dist/chunk-PLS64NCS.js.map +1 -0
- package/dist/{chunk-SYMWGEET.js → chunk-PS2NEWEX.js} +3 -3
- package/dist/chunk-PS2NEWEX.js.map +1 -0
- package/dist/chunk-PY4KJPYU.js +9 -0
- package/dist/chunk-PY4KJPYU.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-QA2KUPCP.js +45 -0
- package/dist/chunk-QA2KUPCP.js.map +1 -0
- package/dist/chunk-QOC3VYL2.js +30 -0
- package/dist/chunk-QOC3VYL2.js.map +1 -0
- package/dist/{chunk-BVRYKATC.js → chunk-QSFOZUYL.js} +62 -34
- package/dist/chunk-QSFOZUYL.js.map +1 -0
- package/dist/chunk-RHK32N73.js +30 -0
- package/dist/chunk-RHK32N73.js.map +1 -0
- package/dist/{chunk-K3DK3NU5.js → chunk-RW3Y22MW.js} +20 -5
- package/dist/chunk-RW3Y22MW.js.map +1 -0
- package/dist/{chunk-B6PB7JLN.js → chunk-S7VFUQM2.js} +541 -6
- package/dist/chunk-S7VFUQM2.js.map +1 -0
- package/dist/chunk-SVLR4POP.js +64 -0
- package/dist/chunk-SVLR4POP.js.map +1 -0
- package/dist/chunk-T7WSLRAU.js +49 -0
- package/dist/chunk-T7WSLRAU.js.map +1 -0
- package/dist/{chunk-WPLVTJ5D.js → chunk-TAKWLZZX.js} +285 -63
- package/dist/chunk-TAKWLZZX.js.map +1 -0
- package/dist/chunk-THNJ3IKU.js +17 -0
- package/dist/chunk-THNJ3IKU.js.map +1 -0
- package/dist/{chunk-XJFLDA7A.js → chunk-TMBXVJKT.js} +9 -6
- package/dist/chunk-TMBXVJKT.js.map +1 -0
- package/dist/chunk-TWKKOM55.js +54 -0
- package/dist/chunk-TWKKOM55.js.map +1 -0
- package/dist/chunk-U3WZCU7E.js +14 -0
- package/dist/chunk-U3WZCU7E.js.map +1 -0
- package/dist/{chunk-Z6FNBOTC.js → chunk-UF362QVH.js} +15 -17
- package/dist/chunk-UF362QVH.js.map +1 -0
- package/dist/chunk-UN4FVIBH.js +135 -0
- package/dist/chunk-UN4FVIBH.js.map +1 -0
- package/dist/chunk-VEAVKDDB.js +29 -0
- package/dist/chunk-VEAVKDDB.js.map +1 -0
- package/dist/chunk-VEPTFUJY.js +29 -0
- package/dist/chunk-VEPTFUJY.js.map +1 -0
- package/dist/chunk-VJV7GKQK.js +662 -0
- package/dist/chunk-VJV7GKQK.js.map +1 -0
- package/dist/{chunk-2QR2PQTT.js → chunk-VQNJ7UZL.js} +5 -3
- package/dist/chunk-VQNJ7UZL.js.map +1 -0
- package/dist/chunk-VQRAIPYF.js +50 -0
- package/dist/chunk-VQRAIPYF.js.map +1 -0
- package/dist/{chunk-DFMLEQZB.js → chunk-VRIYFLBA.js} +5 -10
- package/dist/chunk-VRIYFLBA.js.map +1 -0
- package/dist/chunk-VWM3DAVB.js +265 -0
- package/dist/chunk-VWM3DAVB.js.map +1 -0
- package/dist/{chunk-NONAAENK.js → chunk-VWRRVE6D.js} +11 -4
- package/dist/chunk-VWRRVE6D.js.map +1 -0
- package/dist/chunk-VYYM3MEN.js +98 -0
- package/dist/chunk-VYYM3MEN.js.map +1 -0
- package/dist/chunk-WBJIQSLL.js +167 -0
- package/dist/chunk-WBJIQSLL.js.map +1 -0
- package/dist/chunk-WIGQB62E.js +164 -0
- package/dist/chunk-WIGQB62E.js.map +1 -0
- package/dist/{chunk-EMIGCR7X.js → chunk-WXSYDNBT.js} +2 -2
- package/dist/chunk-WXSYDNBT.js.map +1 -0
- package/dist/chunk-WZSCE6RM.js +466 -0
- package/dist/chunk-WZSCE6RM.js.map +1 -0
- package/dist/chunk-XGDAPN6M.js +255 -0
- package/dist/chunk-XGDAPN6M.js.map +1 -0
- package/dist/{chunk-QODLLGQ7.js → chunk-XH7XP3OL.js} +372 -37
- package/dist/chunk-XH7XP3OL.js.map +1 -0
- package/dist/chunk-XREOISSI.js +40 -0
- package/dist/chunk-XREOISSI.js.map +1 -0
- package/dist/chunk-XUBPSPKD.js +164 -0
- package/dist/chunk-XUBPSPKD.js.map +1 -0
- package/dist/chunk-Y3A5CB5G.js +247 -0
- package/dist/chunk-Y3A5CB5G.js.map +1 -0
- package/dist/{chunk-I5FOWO4J.js → chunk-YCXCR7VG.js} +52 -73
- package/dist/chunk-YCXCR7VG.js.map +1 -0
- package/dist/{chunk-A3JMGXPG.js → chunk-YMUGBZN2.js} +2 -2
- package/dist/chunk-YMUGBZN2.js.map +1 -0
- package/dist/chunk-YMVQD5Q5.js +453 -0
- package/dist/chunk-YMVQD5Q5.js.map +1 -0
- package/dist/chunk-YN5IAHN6.js +32 -0
- package/dist/chunk-YN5IAHN6.js.map +1 -0
- package/dist/{chunk-FZU343FL.js → chunk-ZJADGNYF.js} +2 -2
- package/dist/chunk-ZJADGNYF.js.map +1 -0
- package/dist/chunk-ZYJ55N7N.js +86 -0
- package/dist/chunk-ZYJ55N7N.js.map +1 -0
- package/dist/classified/index.d.ts +16 -0
- package/dist/classified/index.js +40 -0
- package/dist/classified-marker-H6YSHYNK.js +24 -0
- package/dist/classified-marker-H6YSHYNK.js.map +1 -0
- package/dist/collection-facade-LVD22JLM.js +39 -0
- package/dist/computed-EXDMQODG.js +11 -0
- package/dist/consent/index.d.ts +4 -7
- package/dist/consent/index.js +13 -5
- package/dist/consent/index.js.map +1 -1
- package/dist/crdt/index.d.ts +5 -2
- package/dist/crdt/index.js +3 -2
- package/dist/crdt/index.js.map +1 -1
- package/dist/dead-filter-HQIE2YG7.js +28 -0
- package/dist/dead-filter-HQIE2YG7.js.map +1 -0
- package/dist/decrypt-partition-IHtxEnTi.d.ts +21 -0
- package/dist/delegation-BJP73GAP.js +25 -0
- package/dist/derivations/index.d.ts +6 -9
- package/dist/derivations/index.js +18 -6
- package/dist/derive-BME7HDWO.js +21 -0
- package/dist/{dev-unlock-B4kDxep_.d.ts → dev-unlock-Bmm2pgJ0.d.ts} +1 -1
- package/dist/discriminant-BN9REW3o.d.ts +60 -0
- package/dist/enclave-NHORSWSF.js +125 -0
- package/dist/executor-FE6X4LFX.js +9 -0
- package/dist/executor-KSHKRJXP.js +25 -0
- package/dist/executor-ZHTJJICG.js +9 -0
- package/dist/export-accessible-DACHM5VT.js +23 -0
- package/dist/extract-partition-RNENZZ4T.js +36 -0
- package/dist/fanout-sidecar-OFWN3NM7.js +74 -0
- package/dist/fanout-sidecar-OFWN3NM7.js.map +1 -0
- package/dist/fence-watcher-DHQ775JB.js +69 -0
- package/dist/fence-watcher-DHQ775JB.js.map +1 -0
- package/dist/find-BNGBJNKP.js +11 -0
- package/dist/forget/index.d.ts +36 -0
- package/dist/forget/index.js +25 -0
- package/dist/forget/index.js.map +1 -0
- package/dist/guards/index.d.ts +12 -9
- package/dist/guards/index.js +12 -5
- package/dist/{hash-DdpVypUp.d.cts → hash-DAJjMsCE.d.ts} +10 -1
- package/dist/history/index.d.ts +5 -8
- package/dist/history/index.js +25 -12
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.d.ts +25 -8
- package/dist/i18n/index.js +137 -29
- package/dist/i18n/index.js.map +1 -1
- package/dist/in/index.d.ts +4 -0
- package/dist/in/index.js +1 -0
- package/dist/in/index.js.map +1 -0
- package/dist/index-B9QdHytu.d.ts +123 -0
- package/dist/index-DjWbxsjb.d.ts +23579 -0
- package/dist/index-qwuNvO2B.d.ts +144 -0
- package/dist/index.d.ts +1179 -449
- package/dist/index.js +2524 -312
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.d.ts +5 -3
- package/dist/indexing/index.js +6 -5
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-NDI4CVZU.js +19 -0
- package/dist/issue-NDI4CVZU.js.map +1 -0
- package/dist/json-schema-I22JCYCG.js +44 -0
- package/dist/json-schema-I22JCYCG.js.map +1 -0
- package/dist/lazy/index.d.ts +20 -0
- package/dist/lazy/index.js +12 -0
- package/dist/lazy/index.js.map +1 -0
- package/dist/ledger-6NDS2EO4.js +42 -0
- package/dist/ledger-6NDS2EO4.js.map +1 -0
- package/dist/liberate-HN3RIGIP.js +24 -0
- package/dist/liberate-HN3RIGIP.js.map +1 -0
- package/dist/link-set-SJB2MVJV.js +31 -0
- package/dist/link-set-SJB2MVJV.js.map +1 -0
- package/dist/materialized-views/index.d.ts +23 -20
- package/dist/materialized-views/index.js +26 -12
- package/dist/mime-magic-bBj5OgUC.d.ts +103 -0
- package/dist/noydb-BWF6EPIR.js +66 -0
- package/dist/noydb-BWF6EPIR.js.map +1 -0
- package/dist/on/index.d.ts +4 -0
- package/dist/on/index.js +17 -0
- package/dist/on/index.js.map +1 -0
- package/dist/overlay-views/index.d.ts +26 -11
- package/dist/overlay-views/index.js +7 -6
- package/dist/periods/index.d.ts +4 -7
- package/dist/periods/index.js +27 -9
- package/dist/pod/index.d.ts +62 -0
- package/dist/pod/index.js +67 -0
- package/dist/pod/index.js.map +1 -0
- package/dist/policy-WGNAG5H6.js +41 -0
- package/dist/policy-WGNAG5H6.js.map +1 -0
- package/dist/portability/index.d.ts +19 -0
- package/dist/portability/index.js +43 -0
- package/dist/portability/index.js.map +1 -0
- package/dist/post-register-CWKBQRC7.js +55 -0
- package/dist/post-register-CWKBQRC7.js.map +1 -0
- package/dist/{public-envelope-BW6OXORV.js → public-envelope-EJLVIFX7.js} +6 -5
- package/dist/public-envelope-EJLVIFX7.js.map +1 -0
- package/dist/query/index.d.ts +4 -3
- package/dist/query/index.js +24 -13
- package/dist/read-only-facade-CHCKSEPD.js +8 -0
- package/dist/read-only-facade-CHCKSEPD.js.map +1 -0
- package/dist/register-SBIX7TVV.js +23 -0
- package/dist/register-SBIX7TVV.js.map +1 -0
- package/dist/registry-3EQG6OOE.js +18 -0
- package/dist/registry-3EQG6OOE.js.map +1 -0
- package/dist/registry-CA327ACV.js +9 -0
- package/dist/registry-CA327ACV.js.map +1 -0
- package/dist/registry-E7OXOTSV.js +19 -0
- package/dist/registry-E7OXOTSV.js.map +1 -0
- package/dist/registry-VW6P6A3J.js +8 -0
- package/dist/registry-VW6P6A3J.js.map +1 -0
- package/dist/request-withdrawal-KAH2AAXC.js +31 -0
- package/dist/request-withdrawal-KAH2AAXC.js.map +1 -0
- package/dist/reveal-R3JLHMUF.js +38 -0
- package/dist/reveal-R3JLHMUF.js.map +1 -0
- package/dist/revoke-IXLOJ3IH.js +24 -0
- package/dist/revoke-IXLOJ3IH.js.map +1 -0
- package/dist/satellites/index.d.ts +4 -0
- package/dist/satellites/index.js +8 -0
- package/dist/satellites/index.js.map +1 -0
- package/dist/sealed-record/index.d.ts +68 -0
- package/dist/sealed-record/index.js +71 -0
- package/dist/sealed-record/index.js.map +1 -0
- package/dist/session/index.d.ts +5 -8
- package/dist/session/index.js +13 -5
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.d.ts +4 -7
- package/dist/shadow/index.js +4 -3
- package/dist/shadow/index.js.map +1 -1
- package/dist/signer-Y46N2GJ3.js +25 -0
- package/dist/signer-Y46N2GJ3.js.map +1 -0
- package/dist/snapshots/index.d.ts +5 -8
- package/dist/snapshots/index.js +19 -11
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-6ZDBTQT7.js → stale-Z7IW6RIL.js} +3 -2
- package/dist/stale-Z7IW6RIL.js.map +1 -0
- package/dist/storage-ADNP2UWI.js +23 -0
- package/dist/storage-ADNP2UWI.js.map +1 -0
- package/dist/store-coordination-provider-DTDMI6VL.js +142 -0
- package/dist/store-coordination-provider-DTDMI6VL.js.map +1 -0
- package/dist/subject-index-CyOgGMJL.d.ts +380 -0
- package/dist/sync/index.d.ts +3 -6
- package/dist/sync/index.js +13 -6
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.d.ts +46 -10
- package/dist/team/index.js +35 -18
- package/dist/tiers/index.d.ts +4 -0
- package/dist/tiers/index.js +39 -0
- package/dist/tiers/index.js.map +1 -0
- package/dist/to/index.d.ts +4 -0
- package/dist/to/index.js +16 -0
- package/dist/to/index.js.map +1 -0
- package/dist/transition-guard-DI-krBsZ.d.ts +165 -0
- package/dist/tx/index.d.ts +22 -9
- package/dist/tx/index.js +13 -8
- package/dist/tx/index.js.map +1 -1
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ulid-DRH25k3y.d.ts +66 -0
- package/dist/ulid-PTAIMDG4.js +10 -0
- package/dist/ulid-PTAIMDG4.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +7 -2
- package/dist/util/index.js.map +1 -1
- package/dist/validators-BUcli5Nh.d.ts +101 -0
- package/dist/vault-diff-Z2DUayMe.d.ts +147 -0
- package/dist/verify-JPF2YR5E.js +139 -0
- package/dist/verify-JPF2YR5E.js.map +1 -0
- package/dist/walk-XYA2O3LW.js +241 -0
- package/dist/walk-XYA2O3LW.js.map +1 -0
- package/dist/with/index.d.ts +37 -0
- package/dist/with/index.js +31 -0
- package/dist/with/index.js.map +1 -0
- package/dist/{with-materialized-view-BLkQxoQN.d.ts → with-materialized-view-BUmzlXue.d.ts} +1 -1
- package/dist/{with-overlayed-view-CRsSEwHR.d.ts → with-overlayed-view-m4FaXXTO.d.ts} +2 -3
- package/dist/with-rollup-DEKGI9vb.d.ts +47 -0
- package/dist/withdraw-accessible-WLV4MTEN.js +28 -0
- package/dist/withdraw-accessible-WLV4MTEN.js.map +1 -0
- package/dist/zod-HAJM7LMS.js +14763 -0
- package/dist/zod-HAJM7LMS.js.map +1 -0
- package/package.json +122 -202
- package/dist/aggregate/index.cjs.map +0 -1
- package/dist/aggregate/index.d.cts +0 -38
- package/dist/attestation/index.cjs +0 -305
- package/dist/attestation/index.cjs.map +0 -1
- package/dist/attestation/index.d.cts +0 -52
- package/dist/blobs/index.cjs +0 -1480
- package/dist/blobs/index.cjs.map +0 -1
- package/dist/blobs/index.d.cts +0 -46
- package/dist/bundle/index.cjs +0 -19264
- package/dist/bundle/index.cjs.map +0 -1
- package/dist/bundle/index.d.cts +0 -176
- package/dist/chunk-22DWZL57.js.map +0 -1
- package/dist/chunk-2GLDA55J.js.map +0 -1
- package/dist/chunk-2QR2PQTT.js.map +0 -1
- package/dist/chunk-2WUSG3IT.js.map +0 -1
- package/dist/chunk-3BFJOWSU.js.map +0 -1
- package/dist/chunk-3YPCK6JX.js.map +0 -1
- package/dist/chunk-53XBRIRT.js.map +0 -1
- package/dist/chunk-5T22KDPN.js.map +0 -1
- package/dist/chunk-5XHKQ56N.js +0 -340
- package/dist/chunk-5XHKQ56N.js.map +0 -1
- package/dist/chunk-6CME4UEK.js +0 -10329
- package/dist/chunk-6CME4UEK.js.map +0 -1
- package/dist/chunk-6STK5TQP.js +0 -139
- package/dist/chunk-6STK5TQP.js.map +0 -1
- package/dist/chunk-A3JMGXPG.js.map +0 -1
- package/dist/chunk-B6PB7JLN.js.map +0 -1
- package/dist/chunk-BVRYKATC.js.map +0 -1
- package/dist/chunk-DE6GKS6G.js +0 -79
- package/dist/chunk-DE6GKS6G.js.map +0 -1
- package/dist/chunk-DFMLEQZB.js.map +0 -1
- package/dist/chunk-DJHHA6XH.js.map +0 -1
- package/dist/chunk-DL3HWOQ5.js.map +0 -1
- package/dist/chunk-DONMZAD2.js.map +0 -1
- package/dist/chunk-EMIGCR7X.js.map +0 -1
- package/dist/chunk-F3GDRNUT.js.map +0 -1
- package/dist/chunk-FZU343FL.js.map +0 -1
- package/dist/chunk-H2X3ISXG.js.map +0 -1
- package/dist/chunk-HNRHLRDC.js.map +0 -1
- package/dist/chunk-I5FOWO4J.js.map +0 -1
- package/dist/chunk-J66GRPNH.js.map +0 -1
- package/dist/chunk-JWRVQKRZ.js.map +0 -1
- package/dist/chunk-K3DK3NU5.js.map +0 -1
- package/dist/chunk-ML236QKC.js.map +0 -1
- package/dist/chunk-NONAAENK.js.map +0 -1
- package/dist/chunk-O3VZPBZG.js.map +0 -1
- package/dist/chunk-OIF6LZUR.js.map +0 -1
- package/dist/chunk-OQ6PIGHA.js +0 -19
- package/dist/chunk-OQ6PIGHA.js.map +0 -1
- package/dist/chunk-PE2FR4J3.js.map +0 -1
- package/dist/chunk-PP6W64Y3.js.map +0 -1
- package/dist/chunk-PX35GA7L.js.map +0 -1
- package/dist/chunk-QEILDE6R.js +0 -793
- package/dist/chunk-QEILDE6R.js.map +0 -1
- package/dist/chunk-QODLLGQ7.js.map +0 -1
- package/dist/chunk-RAZ4OVLL.js +0 -51
- package/dist/chunk-RAZ4OVLL.js.map +0 -1
- package/dist/chunk-SYMWGEET.js.map +0 -1
- package/dist/chunk-T7JEBOGN.js.map +0 -1
- package/dist/chunk-TFBP23BX.js.map +0 -1
- package/dist/chunk-TV3YZ35S.js.map +0 -1
- package/dist/chunk-U26HQ6KJ.js.map +0 -1
- package/dist/chunk-UF3BUNQZ.js +0 -1
- package/dist/chunk-UMLVJTYV.js +0 -20
- package/dist/chunk-UMLVJTYV.js.map +0 -1
- package/dist/chunk-VTKGMEPP.js.map +0 -1
- package/dist/chunk-W6EQLGMB.js +0 -100
- package/dist/chunk-W6EQLGMB.js.map +0 -1
- package/dist/chunk-WIRRPTFH.js +0 -17
- package/dist/chunk-WIRRPTFH.js.map +0 -1
- package/dist/chunk-WPLVTJ5D.js.map +0 -1
- package/dist/chunk-XJFLDA7A.js.map +0 -1
- package/dist/chunk-Z6FNBOTC.js.map +0 -1
- package/dist/chunk-ZYWZWG6G.js.map +0 -1
- package/dist/consent/index.cjs +0 -204
- package/dist/consent/index.cjs.map +0 -1
- package/dist/consent/index.d.cts +0 -25
- package/dist/crdt/index.cjs +0 -152
- package/dist/crdt/index.cjs.map +0 -1
- package/dist/crdt/index.d.cts +0 -30
- package/dist/crypto-HTZ4FJOP.js +0 -44
- package/dist/delegation-RI54P6I5.js +0 -17
- package/dist/derivations/index.cjs +0 -351
- package/dist/derivations/index.cjs.map +0 -1
- package/dist/derivations/index.d.cts +0 -72
- package/dist/dev-unlock-BIoEFbwm.d.cts +0 -263
- package/dist/executor-5PNY7LGW.js +0 -8
- package/dist/executor-B4QIYGZX.js +0 -8
- package/dist/executor-BWXXDQ7K.js +0 -11
- package/dist/fanout-sidecar-OKPMMPLG.js +0 -51
- package/dist/fanout-sidecar-OKPMMPLG.js.map +0 -1
- package/dist/guards/index.cjs +0 -322
- package/dist/guards/index.cjs.map +0 -1
- package/dist/guards/index.d.cts +0 -31
- package/dist/hash-HJqD14vS.d.ts +0 -63
- package/dist/history/index.cjs +0 -1222
- package/dist/history/index.cjs.map +0 -1
- package/dist/history/index.d.cts +0 -63
- package/dist/i18n/index.cjs +0 -1100
- package/dist/i18n/index.cjs.map +0 -1
- package/dist/i18n/index.d.cts +0 -39
- package/dist/index-4fBVt8j9.d.cts +0 -2387
- package/dist/index-D8I_pyJD.d.ts +0 -2387
- package/dist/index.cjs +0 -24487
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -776
- package/dist/indexing/index.cjs +0 -742
- package/dist/indexing/index.cjs.map +0 -1
- package/dist/indexing/index.d.cts +0 -36
- package/dist/issue-VGDPP4B5.js +0 -12
- package/dist/lazy-builder-7tIpFyWN.d.ts +0 -304
- package/dist/lazy-builder-wY4pMCEe.d.cts +0 -304
- package/dist/ledger-TMRZYNVJ.js +0 -33
- package/dist/materialized-views/index.cjs +0 -854
- package/dist/materialized-views/index.cjs.map +0 -1
- package/dist/materialized-views/index.d.cts +0 -186
- package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
- package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
- package/dist/noydb-G725ZSZG.js +0 -34
- package/dist/overlay-views/index.cjs +0 -359
- package/dist/overlay-views/index.cjs.map +0 -1
- package/dist/overlay-views/index.d.cts +0 -82
- package/dist/periods/index.cjs +0 -1041
- package/dist/periods/index.cjs.map +0 -1
- package/dist/periods/index.d.cts +0 -22
- package/dist/predicate-BSAGEyu5.d.cts +0 -209
- package/dist/predicate-BSAGEyu5.d.ts +0 -209
- package/dist/query/index.cjs +0 -2375
- package/dist/query/index.cjs.map +0 -1
- package/dist/query/index.d.cts +0 -3
- package/dist/read-only-facade-ITU6L7BL.js +0 -7
- package/dist/registry-3QP3YKQS.js +0 -8
- package/dist/registry-DKEXOJVO.js +0 -7
- package/dist/registry-OJIOSBV6.js +0 -10
- package/dist/registry-USRVT6YF.js +0 -8
- package/dist/revoke-JCC7N56X.js +0 -17
- package/dist/session/index.cjs +0 -495
- package/dist/session/index.cjs.map +0 -1
- package/dist/session/index.d.cts +0 -46
- package/dist/shadow/index.cjs +0 -133
- package/dist/shadow/index.cjs.map +0 -1
- package/dist/shadow/index.d.cts +0 -17
- package/dist/signer-72QAUSVW.js +0 -18
- package/dist/snapshots/index.cjs +0 -937
- package/dist/snapshots/index.cjs.map +0 -1
- package/dist/snapshots/index.d.cts +0 -28
- package/dist/store/index.cjs +0 -1083
- package/dist/store/index.cjs.map +0 -1
- package/dist/store/index.d.cts +0 -492
- package/dist/store/index.d.ts +0 -492
- package/dist/store/index.js +0 -37
- package/dist/strategy-BSxFXGzb.d.cts +0 -110
- package/dist/strategy-BSxFXGzb.d.ts +0 -110
- package/dist/strategy-DSTrsZ8t.d.cts +0 -601
- package/dist/strategy-DSTrsZ8t.d.ts +0 -601
- package/dist/sync/index.cjs +0 -1062
- package/dist/sync/index.cjs.map +0 -1
- package/dist/sync/index.d.cts +0 -43
- package/dist/team/index.cjs +0 -2798
- package/dist/team/index.cjs.map +0 -1
- package/dist/team/index.d.cts +0 -118
- package/dist/tx/index.cjs +0 -544
- package/dist/tx/index.cjs.map +0 -1
- package/dist/tx/index.d.cts +0 -21
- package/dist/types-Df28QFKb.d.ts +0 -12818
- package/dist/types-DyXYr8rE.d.cts +0 -12818
- package/dist/ulid-COREQ2RQ.js +0 -9
- package/dist/ulid-Drr7ykr6.d.cts +0 -603
- package/dist/util/index.cjs +0 -230
- package/dist/util/index.cjs.map +0 -1
- package/dist/util/index.d.cts +0 -77
- package/dist/with-derivation-DFnFByiQ.d.ts +0 -13
- package/dist/with-derivation-DU3Sjazm.d.cts +0 -13
- package/dist/with-guard-ByyxmEe7.d.cts +0 -18
- package/dist/with-guard-qube6BMI.d.ts +0 -18
- package/dist/with-materialized-view-BmEToIR1.d.cts +0 -27
- package/dist/with-overlayed-view-BMsQQbWm.d.cts +0 -13
- /package/dist/{chunk-UF3BUNQZ.js.map → api-TX2EX2FX.js.map} +0 -0
- /package/dist/{store → as}/index.js.map +0 -0
- /package/dist/{crypto-HTZ4FJOP.js.map → at/index.js.map} +0 -0
- /package/dist/{delegation-RI54P6I5.js.map → by/index.js.map} +0 -0
- /package/dist/{executor-5PNY7LGW.js.map → cargo/index.js.map} +0 -0
- /package/dist/{executor-B4QIYGZX.js.map → chunk-CHFZDSE4.js.map} +0 -0
- /package/dist/{executor-BWXXDQ7K.js.map → chunk-GHVIKOHT.js.map} +0 -0
- /package/dist/{issue-VGDPP4B5.js.map → chunk-PZ5AY32C.js.map} +0 -0
- /package/dist/{ledger-TMRZYNVJ.js.map → classified/index.js.map} +0 -0
- /package/dist/{noydb-G725ZSZG.js.map → collection-facade-LVD22JLM.js.map} +0 -0
- /package/dist/{public-envelope-BW6OXORV.js.map → computed-EXDMQODG.js.map} +0 -0
- /package/dist/{read-only-facade-ITU6L7BL.js.map → delegation-BJP73GAP.js.map} +0 -0
- /package/dist/{registry-3QP3YKQS.js.map → derive-BME7HDWO.js.map} +0 -0
- /package/dist/{registry-DKEXOJVO.js.map → enclave-NHORSWSF.js.map} +0 -0
- /package/dist/{registry-OJIOSBV6.js.map → executor-FE6X4LFX.js.map} +0 -0
- /package/dist/{registry-USRVT6YF.js.map → executor-KSHKRJXP.js.map} +0 -0
- /package/dist/{revoke-JCC7N56X.js.map → executor-ZHTJJICG.js.map} +0 -0
- /package/dist/{signer-72QAUSVW.js.map → export-accessible-DACHM5VT.js.map} +0 -0
- /package/dist/{stale-6ZDBTQT7.js.map → extract-partition-RNENZZ4T.js.map} +0 -0
- /package/dist/{ulid-COREQ2RQ.js.map → find-BNGBJNKP.js.map} +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openEnvelopeJson
|
|
3
|
+
} from "./chunk-MCHVVJIA.js";
|
|
4
|
+
import {
|
|
5
|
+
encrypt
|
|
6
|
+
} from "./chunk-3OPY6MK2.js";
|
|
7
|
+
import {
|
|
8
|
+
NOYDB_FORMAT_VERSION
|
|
9
|
+
} from "./chunk-YN5IAHN6.js";
|
|
10
|
+
import {
|
|
11
|
+
ConflictError,
|
|
12
|
+
SequenceContentionError,
|
|
13
|
+
SequenceNotEnabledError,
|
|
14
|
+
SequenceOfflineError,
|
|
15
|
+
ValidationError
|
|
16
|
+
} from "./chunk-S7VFUQM2.js";
|
|
17
|
+
|
|
18
|
+
// src/with-commit/sequence/strategy.ts
|
|
19
|
+
var NO_SEQUENCE = {
|
|
20
|
+
createStore() {
|
|
21
|
+
throw new SequenceNotEnabledError();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/with-commit/sequence/index.ts
|
|
26
|
+
var SEQUENCE_COLLECTION = "_sequences";
|
|
27
|
+
var MAX_NEXT_ATTEMPTS = 16;
|
|
28
|
+
var SEQ_FORMAT_TOKEN = /\{([^{}]*)\}/g;
|
|
29
|
+
var SEQ_PAD_TOKEN = /^seq:0(\d+)$/;
|
|
30
|
+
var SEQ_PARTITION_TOKEN = /^partition\.(\d+)$/;
|
|
31
|
+
function compileSequenceFormat(format, series, partition) {
|
|
32
|
+
const parts = partition ?? [];
|
|
33
|
+
for (const m of format.matchAll(SEQ_FORMAT_TOKEN)) {
|
|
34
|
+
const token = m[1] ?? "";
|
|
35
|
+
if (token === "seq") continue;
|
|
36
|
+
if (SEQ_PAD_TOKEN.test(token)) continue;
|
|
37
|
+
const partMatch = SEQ_PARTITION_TOKEN.exec(token);
|
|
38
|
+
if (partMatch) {
|
|
39
|
+
const idx = Number(partMatch[1]);
|
|
40
|
+
if (idx >= parts.length) {
|
|
41
|
+
throw new ValidationError(
|
|
42
|
+
`sequence("${series}"): format token "{${token}}" references partition index ${idx}, but only ${parts.length} partition component(s) were supplied.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
throw new ValidationError(
|
|
48
|
+
`sequence("${series}"): format contains unknown token "{${token}}". Accepted tokens: {seq}, {seq:0N}, {partition.i}.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return (serial) => format.replace(SEQ_FORMAT_TOKEN, (full, token) => {
|
|
52
|
+
if (token === "seq") return String(serial);
|
|
53
|
+
const padMatch = SEQ_PAD_TOKEN.exec(token);
|
|
54
|
+
if (padMatch) return String(serial).padStart(Number(padMatch[1]), "0");
|
|
55
|
+
const partMatch = SEQ_PARTITION_TOKEN.exec(token);
|
|
56
|
+
if (partMatch) return String(parts[Number(partMatch[1])]);
|
|
57
|
+
return full;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function resolveSequenceKey(series, opts) {
|
|
61
|
+
const partition = opts?.partition;
|
|
62
|
+
if (!partition || partition.length === 0) return series;
|
|
63
|
+
const parts = partition.map((p) => {
|
|
64
|
+
if (typeof p === "number" && !Number.isFinite(p)) {
|
|
65
|
+
throw new ValidationError(`sequence partition component must be a finite number, got ${p}`);
|
|
66
|
+
}
|
|
67
|
+
const s = String(p);
|
|
68
|
+
if (s === "") {
|
|
69
|
+
throw new ValidationError("sequence partition component must not be empty");
|
|
70
|
+
}
|
|
71
|
+
return encodeURIComponent(s);
|
|
72
|
+
});
|
|
73
|
+
return `${series}\0${parts.join("/")}`;
|
|
74
|
+
}
|
|
75
|
+
async function sleepBackoff(attempt) {
|
|
76
|
+
const ceil = Math.min(2 ** attempt, 32);
|
|
77
|
+
const ms = Math.floor(Math.random() * ceil);
|
|
78
|
+
await new Promise((r) => setTimeout(r, ms));
|
|
79
|
+
}
|
|
80
|
+
var SequenceStore = class {
|
|
81
|
+
adapter;
|
|
82
|
+
vault;
|
|
83
|
+
encrypted;
|
|
84
|
+
getDEK;
|
|
85
|
+
actor;
|
|
86
|
+
/**
|
|
87
|
+
* Memoized DEK promise. The `_sequences` collection DEK is created on
|
|
88
|
+
* first access; without sharing one promise, a burst of concurrent
|
|
89
|
+
* `next()` calls would each trigger DEK creation and diverge (one
|
|
90
|
+
* writer's ciphertext unreadable by another). One shared promise → one
|
|
91
|
+
* DEK.
|
|
92
|
+
*/
|
|
93
|
+
dekPromise = null;
|
|
94
|
+
constructor(opts) {
|
|
95
|
+
this.adapter = opts.adapter;
|
|
96
|
+
this.vault = opts.vault;
|
|
97
|
+
this.encrypted = opts.encrypted;
|
|
98
|
+
this.getDEK = opts.getDEK;
|
|
99
|
+
this.actor = opts.actor;
|
|
100
|
+
}
|
|
101
|
+
/** A handle bound to one sequence name. */
|
|
102
|
+
handle(name) {
|
|
103
|
+
return {
|
|
104
|
+
next: () => this.next(name),
|
|
105
|
+
peek: () => this.peek(name),
|
|
106
|
+
seedTo: (n) => this.seedTo(name, n)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
assertOnline() {
|
|
110
|
+
if (this.adapter.capabilities?.casAtomic !== true) {
|
|
111
|
+
throw new SequenceOfflineError();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
dek() {
|
|
115
|
+
if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION);
|
|
116
|
+
return this.dekPromise;
|
|
117
|
+
}
|
|
118
|
+
async read(name) {
|
|
119
|
+
const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name);
|
|
120
|
+
if (!env) return { env: null, value: 0 };
|
|
121
|
+
const json = this.encrypted ? await openEnvelopeJson(env, await this.dek()) : env._data;
|
|
122
|
+
const state = JSON.parse(json);
|
|
123
|
+
return { env, value: state.value };
|
|
124
|
+
}
|
|
125
|
+
async encryptState(state, version) {
|
|
126
|
+
const json = JSON.stringify(state);
|
|
127
|
+
if (!this.encrypted) {
|
|
128
|
+
return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
|
|
129
|
+
}
|
|
130
|
+
const { iv, data } = await encrypt(json, await this.dek());
|
|
131
|
+
return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data, _by: this.actor };
|
|
132
|
+
}
|
|
133
|
+
async peek(name) {
|
|
134
|
+
return (await this.read(name)).value;
|
|
135
|
+
}
|
|
136
|
+
async next(name) {
|
|
137
|
+
this.assertOnline();
|
|
138
|
+
let lastConflict;
|
|
139
|
+
for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {
|
|
140
|
+
const { env, value } = await this.read(name);
|
|
141
|
+
const nextValue = value + 1;
|
|
142
|
+
const expectedVersion = env?._v ?? 0;
|
|
143
|
+
const envelope = await this.encryptState({ value: nextValue }, expectedVersion + 1);
|
|
144
|
+
try {
|
|
145
|
+
await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion);
|
|
146
|
+
return nextValue;
|
|
147
|
+
} catch (err) {
|
|
148
|
+
if (err instanceof ConflictError) {
|
|
149
|
+
lastConflict = err;
|
|
150
|
+
if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
throw err;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
void lastConflict;
|
|
157
|
+
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
158
|
+
}
|
|
159
|
+
async seedTo(name, n) {
|
|
160
|
+
this.assertOnline();
|
|
161
|
+
if (n <= 0) return;
|
|
162
|
+
let lastConflict;
|
|
163
|
+
for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {
|
|
164
|
+
const { env, value } = await this.read(name);
|
|
165
|
+
if (value >= n) return;
|
|
166
|
+
const expectedVersion = env?._v ?? 0;
|
|
167
|
+
const envelope = await this.encryptState({ value: n }, expectedVersion + 1);
|
|
168
|
+
try {
|
|
169
|
+
await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion);
|
|
170
|
+
return;
|
|
171
|
+
} catch (err) {
|
|
172
|
+
if (err instanceof ConflictError) {
|
|
173
|
+
lastConflict = err;
|
|
174
|
+
if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
throw err;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
void lastConflict;
|
|
181
|
+
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/with-commit/sequence/active.ts
|
|
186
|
+
function withSequence() {
|
|
187
|
+
return {
|
|
188
|
+
createStore(opts) {
|
|
189
|
+
return new SequenceStore(opts);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export {
|
|
195
|
+
withSequence,
|
|
196
|
+
NO_SEQUENCE,
|
|
197
|
+
SEQUENCE_COLLECTION,
|
|
198
|
+
compileSequenceFormat,
|
|
199
|
+
resolveSequenceKey,
|
|
200
|
+
SequenceStore
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=chunk-6G5ORS5D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-commit/sequence/strategy.ts","../src/with-commit/sequence/index.ts","../src/with-commit/sequence/active.ts"],"sourcesContent":["/**\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 type { NoydbStore, EncryptedEnvelope } from '../../kernel/types.js'\nimport { NOYDB_FORMAT_VERSION } from '../../kernel/types.js'\nimport { encrypt, openEnvelopeJson, type EnclaveKey } from '../../kernel/enclave/index.js'\nimport { ConflictError, 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(state: SequenceState, version: number): Promise<EncryptedEnvelope> {\n const json = JSON.stringify(state)\n if (!this.encrypted) {\n return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: new Date().toISOString(), _iv: '', _data: json, _by: this.actor }\n }\n const { iv, data } = await encrypt(json, await this.dek())\n return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: new Date().toISOString(), _iv: iv, _data: 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({ 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 (err instanceof ConflictError) {\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({ 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 (err instanceof ConflictError) {\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","/**\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"],"mappings":";;;;;;;;;;;;;;;;;;AA4BO,IAAM,cAAgC;AAAA,EAC3C,cAA6B;AAC3B,UAAM,IAAI,wBAAwB;AAAA,EACpC;AACF;;;ACAO,IAAM,sBAAsB;AAKnC,IAAM,oBAAoB;AA2D1B,IAAM,mBAAmB;AACzB,IAAM,gBAAgB;AACtB,IAAM,sBAAsB;AAQrB,SAAS,sBACd,QACA,QACA,WAC4B;AAC5B,QAAM,QAAQ,aAAa,CAAC;AAC5B,aAAW,KAAK,OAAO,SAAS,gBAAgB,GAAG;AACjD,UAAM,QAAQ,EAAE,CAAC,KAAK;AACtB,QAAI,UAAU,MAAO;AACrB,QAAI,cAAc,KAAK,KAAK,EAAG;AAC/B,UAAM,YAAY,oBAAoB,KAAK,KAAK;AAChD,QAAI,WAAW;AACb,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W;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,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;AAC1E,UAAI;AACF,cAAM,KAAK,QAAQ,IAAI,KAAK,OAAO,qBAAqB,MAAM,UAAU,eAAe;AACvF;AAAA,MACF,SAAS,KAAK;AACZ,YAAI,eAAe,eAAe;AAChC,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;;;ACrTO,SAAS,eAAiC;AAC/C,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,aAAO,IAAI,cAAc,IAAI;AAAA,IAC/B;AAAA,EACF;AACF;","names":[]}
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
OverlayBaseIsVirtualError,
|
|
3
3
|
OverlayCollectionUnavailableError,
|
|
4
4
|
OverlayNameCollisionError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S7VFUQM2.js";
|
|
6
6
|
|
|
7
|
-
// src/overlay-views/registry.ts
|
|
7
|
+
// src/with-formula/overlay-views/registry.ts
|
|
8
8
|
var OverlayedViewRegistry = class {
|
|
9
9
|
_byName = /* @__PURE__ */ new Map();
|
|
10
10
|
/**
|
|
@@ -37,6 +37,16 @@ var OverlayedViewRegistry = class {
|
|
|
37
37
|
isOverlay(name) {
|
|
38
38
|
return this._byName.has(name);
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* All registered overlay strategies as a flat array.
|
|
42
|
+
* Each strategy carries `name`, `base`, and `overlay` fields that
|
|
43
|
+
* `describeOverlays()` in the introspection walker reads directly.
|
|
44
|
+
*
|
|
45
|
+
* Used by `dumpSchema()` to populate the `overlayViews` map.
|
|
46
|
+
*/
|
|
47
|
+
all() {
|
|
48
|
+
return [...this._byName.values()];
|
|
49
|
+
}
|
|
40
50
|
/**
|
|
41
51
|
* Resolve the `rowKey` function for an overlay's base MV. Returns
|
|
42
52
|
* `undefined` if the base isn't an MV (raw source collection) or
|
|
@@ -58,4 +68,4 @@ var OverlayedViewRegistry = class {
|
|
|
58
68
|
export {
|
|
59
69
|
OverlayedViewRegistry
|
|
60
70
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-6P5XCKSD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-formula/overlay-views/registry.ts"],"sourcesContent":["import {\n OverlayBaseIsVirtualError,\n OverlayCollectionUnavailableError,\n OverlayNameCollisionError,\n} from '../../kernel/errors.js'\nimport type { MaterializedViewRegistry } from '../materialized-views/registry.js'\nimport type { OverlayedViewStrategy } from './types.js'\n\n/**\n * Vault-internal registry of overlay strategies. Resolves the base\n * MV's `rowKey` lazily so virtual-collection writes can derive ids\n * from the row.\n *\n * @internal\n */\nexport class OverlayedViewRegistry {\n private readonly _byName = new Map<string, OverlayedViewStrategy>()\n\n /**\n * Register an overlay. Validates name uniqueness, base concreteness,\n * and overlay availability AGAINST the MV registry — overlays\n * declared without the MV registry context skip cross-registry\n * checks but still validate self-consistency.\n */\n register(\n spec: OverlayedViewStrategy,\n options: {\n isOverlayName?: (name: string) => boolean\n isMVOutput?: (name: string) => boolean\n isKnownCollection?: (name: string) => boolean\n },\n ): void {\n const { isOverlayName, isMVOutput, isKnownCollection } = options\n\n // 1. Virtual name must not collide with an MV output or a concrete\n // source collection. Concrete-source detection is best-effort:\n // if `isKnownCollection` is supplied, a hit there + no MV match\n // is treated as a collision.\n if (isMVOutput?.(spec.name) || isOverlayName?.(spec.name)) {\n throw new OverlayNameCollisionError(spec.name)\n }\n // (We don't check isKnownCollection for `name` collision because\n // virtual names are typically NOT pre-existing — they're created\n // by the overlay declaration itself. Future versions may tighten.)\n\n // 2. base must be concrete: NOT another overlay's virtual name.\n if (isOverlayName?.(spec.base)) {\n throw new OverlayBaseIsVirtualError(spec.name, spec.base)\n }\n\n // 3. overlay must be available: a real, vault-known collection\n // that is NOT an MV output (since MVs own their outputs).\n if (isMVOutput?.(spec.overlay)) {\n throw new OverlayCollectionUnavailableError(spec.name, spec.overlay)\n }\n // Best-effort known-collection check — when the vault can answer\n // it. Unknown collections aren't a hard failure (the overlay may\n // be implicitly created on first write), so we only throw on the\n // MV-output case above.\n void isKnownCollection\n\n this._byName.set(spec.name, spec)\n }\n\n byName(name: string): OverlayedViewStrategy | undefined {\n return this._byName.get(name)\n }\n\n /** All overlay virtual names. */\n names(): ReadonlySet<string> {\n return new Set(this._byName.keys())\n }\n\n isOverlay(name: string): boolean {\n return this._byName.has(name)\n }\n\n /**\n * All registered overlay strategies as a flat array.\n * Each strategy carries `name`, `base`, and `overlay` fields that\n * `describeOverlays()` in the introspection walker reads directly.\n *\n * Used by `dumpSchema()` to populate the `overlayViews` map.\n */\n all(): ReadonlyArray<OverlayedViewStrategy> {\n return [...this._byName.values()]\n }\n\n /**\n * Resolve the `rowKey` function for an overlay's base MV. Returns\n * `undefined` if the base isn't an MV (raw source collection) or\n * if the MV registry isn't supplied. Used by the virtual-collection\n * proxy to derive ids from `put(record)` calls.\n */\n resolveBaseRowKey(\n name: string,\n mvRegistry: MaterializedViewRegistry | null,\n ): ((row: Record<string, unknown>) => string) | undefined {\n const spec = this._byName.get(name)\n if (!spec || !mvRegistry) return undefined\n // The base might be an MV's `output.collection` OR the MV's `name`\n // (when no output.collection is declared). Search by both.\n for (const reg of mvRegistry.all()) {\n if (reg.outputCollection === spec.base || reg.spec.name === spec.base) {\n return (row) => reg.spec.rowKey(row)\n }\n }\n return undefined\n }\n}\n"],"mappings":";;;;;;;AAeO,IAAM,wBAAN,MAA4B;AAAA,EAChB,UAAU,oB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]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/crdt/crdt.ts
|
|
1
|
+
// src/with-commit/crdt/crdt.ts
|
|
2
2
|
function resolveCrdtSnapshot(state) {
|
|
3
3
|
switch (state._crdt) {
|
|
4
4
|
case "lww-map": {
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
buildLwwMapState,
|
|
109
109
|
buildRgaState
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-6S7T6WC4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-commit/crdt/crdt.ts"],"sourcesContent":["/**\n * CRDT state types, merge logic, and build helpers.\n * per-collection CRDT mode: 'lww-map' | 'rga' | 'yjs'\n *\n * The encrypted envelope wraps the CRDT state (not the resolved snapshot).\n * Adapters only ever see ciphertext. `collection.get(id)` returns the\n * resolved snapshot; `collection.getRaw(id)` returns the full CRDT state.\n */\n\n// Hoisted to kernel/types.ts (C3 — enclave self-containment: record-codec.ts\n// consumes this as a spine-owned contract type). Re-exported here so existing\n// importers of this module are unaffected.\nimport type { CrdtState } from '../../kernel/types.js'\nexport type { CrdtMode, CrdtState } from '../../kernel/types.js'\n\n// ─── State shapes ─────────────────────────────────────────────────────\n\n/**\n * Per-field last-write-wins registers.\n * Each field carries its latest value and the ISO timestamp of the last write.\n * Merge: for each field, keep the entry with the lexicographically higher `ts`.\n */\nexport interface LwwMapState {\n readonly _crdt: 'lww-map'\n readonly fields: Record<string, { readonly v: unknown; readonly ts: string }>\n}\n\n/**\n * Simplified Replicated Growable Array.\n * Items are assigned stable NID (noy-db id) strings on first insertion.\n * Deleted items are tracked as tombstones so concurrent removals commute.\n *\n * The resolved snapshot is the ordered list of non-tombstoned `v` values.\n */\nexport interface RgaState {\n readonly _crdt: 'rga'\n readonly items: ReadonlyArray<{ readonly nid: string; readonly v: unknown }>\n readonly tombstones: readonly string[]\n}\n\n/**\n * Yjs binary state marker. `update` is base64(Y.encodeStateAsUpdate()).\n * Core stores and retrieves the blob opaquely. `@noy-db/yjs` is responsible\n * for encoding, decoding, and merging via `Y.mergeUpdates`.\n * Core falls back to last-write-wins (higher `_v`) for conflict resolution.\n */\nexport interface YjsState {\n readonly _crdt: 'yjs'\n /** base64-encoded Y.encodeStateAsUpdate() bytes. */\n readonly update: string\n}\n\n// ─── Snapshot resolution ──────────────────────────────────────────────\n\n/**\n * Resolve a CRDT state into the end-user record snapshot.\n *\n * - `lww-map` → `Record<string, unknown>` (field values extracted from registers)\n * - `rga` → `unknown[]` (non-tombstoned items in insertion order)\n * - `yjs` → `string` (base64 update blob; use @noy-db/yjs for a Y.Doc)\n */\nexport function resolveCrdtSnapshot(state: CrdtState): unknown {\n switch (state._crdt) {\n case 'lww-map': {\n const result: Record<string, unknown> = {}\n for (const [field, reg] of Object.entries(state.fields)) {\n result[field] = reg.v\n }\n return result\n }\n case 'rga': {\n const dead = new Set(state.tombstones)\n return state.items.filter(i => !dead.has(i.nid)).map(i => i.v)\n }\n case 'yjs':\n return state.update\n }\n}\n\n// ─── CRDT merge ───────────────────────────────────────────────────────\n\n/**\n * Merge two CRDT states produced by concurrent writes.\n * Called by the collection-level conflict resolver registered with SyncEngine.\n *\n * For `yjs`: core cannot merge Yjs without importing the `yjs` package.\n * The caller must handle that case by falling back to the higher-`_v` envelope.\n */\nexport function mergeCrdtStates(a: CrdtState, b: CrdtState): CrdtState {\n // Mismatched modes shouldn't happen in practice — same collection, same schema.\n if (a._crdt !== b._crdt) return a\n\n switch (a._crdt) {\n case 'lww-map':\n return mergeLwwMap(a, b as LwwMapState)\n case 'rga':\n return mergeRga(a, b as RgaState)\n case 'yjs':\n // Signal to caller that Yjs merge is needed externally\n return a\n }\n}\n\nfunction mergeLwwMap(a: LwwMapState, b: LwwMapState): LwwMapState {\n const merged: Record<string, { v: unknown; ts: string }> = {}\n const allFields = new Set([...Object.keys(a.fields), ...Object.keys(b.fields)])\n for (const field of allFields) {\n const fa = a.fields[field]\n const fb = b.fields[field]\n if (!fa) { merged[field] = fb! }\n else if (!fb) { merged[field] = fa }\n else { merged[field] = fa.ts >= fb.ts ? fa : fb }\n }\n return { _crdt: 'lww-map', fields: merged }\n}\n\nfunction mergeRga(a: RgaState, b: RgaState): RgaState {\n // Union tombstones from both sides\n const allTombstones = new Set([...a.tombstones, ...b.tombstones])\n // Union items by nid: start with a's ordering, append b-only items\n const seenNids = new Set(a.items.map(i => i.nid))\n const merged: Array<{ nid: string; v: unknown }> = [\n ...a.items,\n ...b.items.filter(i => !seenNids.has(i.nid)),\n ]\n return { _crdt: 'rga', items: merged, tombstones: [...allTombstones] }\n}\n\n// ─── Build helpers ────────────────────────────────────────────────────\n\n/**\n * Build (or update) an lww-map state from a new record.\n *\n * All fields in the new record win at timestamp `now`.\n * Fields present in the existing state but absent from the new record\n * are preserved (they were written by another device).\n */\nexport function buildLwwMapState(\n record: Record<string, unknown>,\n existing: LwwMapState | undefined,\n now: string,\n): LwwMapState {\n const fields: Record<string, { v: unknown; ts: string }> = {}\n\n // New record fields all get the current timestamp — this device wins for these\n for (const [field, value] of Object.entries(record)) {\n fields[field] = { v: value, ts: now }\n }\n\n // Preserve fields from the existing state that aren't in the new record\n if (existing) {\n for (const [field, reg] of Object.entries(existing.fields)) {\n if (!(field in fields)) {\n fields[field] = reg\n }\n }\n }\n\n return { _crdt: 'lww-map', fields }\n}\n\n/**\n * Build (or update) an RGA state from a new array.\n *\n * Existing items are matched to new elements by deep-equality of their `v`.\n * Unmatched existing items are tombstoned. New elements that have no existing\n * match get a fresh NID via `generateNid()`.\n */\nexport function buildRgaState(\n arr: unknown[],\n existing: RgaState | undefined,\n generateNid: () => string,\n): RgaState {\n // Build an index from JSON(v) → existing item so we can match by value\n const existingByValue = new Map<string, { nid: string; v: unknown }>()\n if (existing) {\n for (const item of existing.items) {\n // Only add first occurrence per value to avoid double-matching\n const key = JSON.stringify(item.v)\n if (!existingByValue.has(key)) existingByValue.set(key, item)\n }\n }\n\n const usedNids = new Set<string>()\n const newItems: Array<{ nid: string; v: unknown }> = []\n\n for (const el of arr) {\n const key = JSON.stringify(el)\n const match = existingByValue.get(key)\n if (match && !usedNids.has(match.nid)) {\n // Reuse existing NID to preserve cross-device identity\n newItems.push(match)\n usedNids.add(match.nid)\n } else {\n // New element — assign a fresh NID\n const nid = generateNid()\n newItems.push({ nid, v: el })\n usedNids.add(nid)\n }\n }\n\n // Elements in the existing state that aren't in the new array → tombstone.\n // Tombstoned items are kept in the items array to preserve ordering for\n // cross-device merge — the resolved snapshot filters them out.\n const tombstones: string[] = existing ? [...existing.tombstones] : []\n const extraItems: Array<{ nid: string; v: unknown }> = []\n if (existing) {\n for (const item of existing.items) {\n if (!usedNids.has(item.nid)) {\n if (!tombstones.includes(item.nid)) tombstones.push(item.nid)\n extraItems.push(item) // retain in items for ordering\n }\n }\n }\n\n // Final items: live items in new order, then tombstoned extras at the end\n const items = [...newItems, ...extraItems]\n\n return { _crdt: 'rga', items, tombstones }\n}\n"],"mappings":";AA6DO,SAAS,oBAAoB,OAA2B;AAC7D,UAAQ,MAAM,OAAO;AAAA,IACnB,KAAK,WAAW;AACd,YAAM,SAAkC,CAAC;AACzC,iBAAW,CAAC,OAAO,GAAG,KAAK,OAAO,QAAQ,MAAM,MAAM,GAAG;AACvD,eAAO,KAAK,IAAI,IAAI;AAAA,MACtB;AACA,aAAO;AAAA,IACT;AAAA,IACA,KAAK,OAAO;AACV,YAAM,OAAO,IAAI,IAAI,MAAM,UAAU;AACrC,aAAO,MAAM,MAAM,OAAO,OAAK,CAAC,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,OAAK,EAAE,CAAC;AAAA,IAC/D;AAAA,IACA,KAAK;AACH,aAAO,MAAM;AAAA,EACjB;AACF;AAWO,SAAS,gBAAgB,GAAc,GAAyB;AAErE,MAAI,EAAE,UAAU,EAAE,MAAO,QAAO;AAEhC,UAAQ,EAAE,OAAO;AAAA,IACf,KAAK;AACH,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U;AAEzC,SAAO,EAAE,OAAO,OAAO,OAAO,WAAW;AAC3C;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TierNotGrantedError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S7VFUQM2.js";
|
|
4
4
|
|
|
5
|
-
// src/team/tiers.ts
|
|
5
|
+
// src/with-party/team/tiers.ts
|
|
6
6
|
function dekKey(collection, tier) {
|
|
7
7
|
if (tier <= 0) return collection;
|
|
8
8
|
return `${collection}#${tier}`;
|
|
@@ -20,7 +20,7 @@ function effectiveClearance(keyring, collection) {
|
|
|
20
20
|
}
|
|
21
21
|
function assertTierAccess(keyring, collection, tier) {
|
|
22
22
|
if (tier <= 0) return;
|
|
23
|
-
if (keyring.role === "owner" || keyring.role === "admin") return;
|
|
23
|
+
if (keyring.role === "owner" || keyring.role === "admin" || keyring.role === "custodian") return;
|
|
24
24
|
if (!keyring.deks.has(dekKey(collection, tier))) {
|
|
25
25
|
throw new TierNotGrantedError(collection, tier);
|
|
26
26
|
}
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
effectiveClearance,
|
|
32
32
|
assertTierAccess
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-7BWJHO2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/with-party/team/tiers.ts"],"sourcesContent":["/**\n * Hierarchical access — tier-aware keyring helpers.\n *\n * The keyring's existing `deks: Map<string, CryptoKey>` is keyed by\n * collection name. extends the key space:\n *\n * `'invoices'` — tier-0 DEK (unchanged from v0.x)\n * `'invoices#1'` — tier-1 DEK\n * `'invoices#2'` — tier-2 DEK\n *\n * Tier 0 keeps the bare collection name so any keyring written\n * before tiers existed loads without migration. Tiers ≥ 1 use `#N`\n * suffixes that\n * would be invalid as user-supplied collection names (see\n * `ReservedCollectionNameError` — `#` is reserved).\n *\n * @module\n */\n\nimport type { UnlockedKeyring } from './keyring.js'\nimport { TierNotGrantedError } from '../../kernel/errors.js'\n\n/** Canonical DEK key for a given collection + tier. Tier 0 → bare name. */\nexport function dekKey(collection: string, tier: number): string {\n if (tier <= 0) return collection\n return `${collection}#${tier}`\n}\n\n/**\n * Returns the user's effective clearance for a given collection: the\n * maximum tier for which their keyring holds a DEK. Falls back to 0\n * when the user has only the tier-0 DEK (or none — the getDEK caller\n * will raise separately).\n */\nexport function effectiveClearance(keyring: UnlockedKeyring, collection: string): number {\n let max = 0\n const prefix = `${collection}#`\n for (const key of keyring.deks.keys()) {\n if (!key.startsWith(prefix)) continue\n const suffix = key.slice(prefix.length)\n const n = Number.parseInt(suffix, 10)\n if (Number.isFinite(n) && n > max) max = n\n }\n return max\n}\n\n/**\n * Assert the caller is cleared for the requested tier. Owners and\n * admins always pass (they can mint any new tier DEK on demand);\n * other roles must already hold the tier DEK — via a prior grant or\n * an active delegation — otherwise this throws `TierNotGrantedError`.\n *\n * This gate runs BEFORE `getDEK()` on the mutation path so a\n * non-cleared operator never has the opportunity to silently\n * auto-create a tier DEK they shouldn't have.\n */\nexport function assertTierAccess(\n keyring: UnlockedKeyring,\n collection: string,\n tier: number,\n): void {\n if (tier <= 0) return\n // FR-6: custodian operates every collection at every tier (admin-level\n // operational authority), so it may mint a tier DEK on demand like admin.\n if (keyring.role === 'owner' || keyring.role === 'admin' || keyring.role === 'custodian') return\n if (!keyring.deks.has(dekKey(collection, tier))) {\n throw new TierNotGrantedError(collection, tier)\n }\n}\n"],"mappings":";;;;;AAuBO,SAAS,OAAO,YAAoB,MAAsB;AAC/D,MAAI,QAAQ,EAAG,QAAO;AACtB,SAAO,GAAG,UAAU,IAAI,IAAI;AAC9B;AAQO,SAAS,mBAAmB,SAA0B,YAA4B;AACvF,MAAI,MAAM;AACV,QAAM,SAAS,GAAG,UAAU;AAC5B,aAAW,OAAO,QAAQ,KAAK,KAAK,GAAG;AACrC,QAAI,CAAC,IAAI,WAAW,MAAM,EAAG;AAC7B,UAAM,SAAS,IAAI,MAAM,OAAO,MAAM;AACtC,UAAM,IAAI,OAAO,SAAS,QAAQ,EAAE;AACpC,QAAI,OAAO,SAAS,CAAC,KAAK,IAAI,IAAK,OAAM;AAAA,EAC3C;AACA,SAAO;AACT;AAYO,SAAS,iBACd,SACA,YACA,MACM;AACN,MAAI,QAAQ,EAAG;AAGf,MAAI,QAAQ,SAAS,WAAW,QAAQ,SAAS,WAAW,QAAQ,SAAS,YAAa;AAC1F,MAAI,CAAC,QAAQ,KAAK,IAAI,OAAO,YAAY,IAAI,CAAC,GAAG;AAC/C,UAAM,IAAI,oBAAoB,YAAY,IAAI;AAAA,EAChD;AACF;","names":[]}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertTierAccess,
|
|
3
|
+
dekKey
|
|
4
|
+
} from "./chunk-7BWJHO2A.js";
|
|
5
|
+
import {
|
|
6
|
+
rewrapBodyToDek
|
|
7
|
+
} from "./chunk-MCHVVJIA.js";
|
|
8
|
+
import {
|
|
9
|
+
decrypt,
|
|
10
|
+
encrypt,
|
|
11
|
+
unwrapCek
|
|
12
|
+
} from "./chunk-3OPY6MK2.js";
|
|
13
|
+
import {
|
|
14
|
+
NOYDB_FORMAT_VERSION
|
|
15
|
+
} from "./chunk-YN5IAHN6.js";
|
|
16
|
+
import {
|
|
17
|
+
TierDemoteDeniedError,
|
|
18
|
+
TiersNotEnabledError
|
|
19
|
+
} from "./chunk-S7VFUQM2.js";
|
|
20
|
+
|
|
21
|
+
// src/with-audit/tiers/active.ts
|
|
22
|
+
function withTiers() {
|
|
23
|
+
return {
|
|
24
|
+
async putAtTier(ctx, id, record, tier, opts) {
|
|
25
|
+
const { putAtTier: putAtTier2 } = await import("./tiers/index.js");
|
|
26
|
+
return putAtTier2(ctx, id, record, tier, opts);
|
|
27
|
+
},
|
|
28
|
+
async getAtTier(ctx, id) {
|
|
29
|
+
const { getAtTier: getAtTier2 } = await import("./tiers/index.js");
|
|
30
|
+
return getAtTier2(ctx, id);
|
|
31
|
+
},
|
|
32
|
+
async listAtTier(ctx) {
|
|
33
|
+
const { listAtTier: listAtTier2 } = await import("./tiers/index.js");
|
|
34
|
+
return listAtTier2(ctx);
|
|
35
|
+
},
|
|
36
|
+
async elevate(ctx, id, toTier) {
|
|
37
|
+
const { elevate: elevate2 } = await import("./tiers/index.js");
|
|
38
|
+
return elevate2(ctx, id, toTier);
|
|
39
|
+
},
|
|
40
|
+
async demote(ctx, id, toTier) {
|
|
41
|
+
const { demote: demote2 } = await import("./tiers/index.js");
|
|
42
|
+
return demote2(ctx, id, toTier);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/with-audit/tiers/strategy.ts
|
|
48
|
+
var NO_TIERS = {
|
|
49
|
+
async putAtTier() {
|
|
50
|
+
throw new TiersNotEnabledError();
|
|
51
|
+
},
|
|
52
|
+
async getAtTier() {
|
|
53
|
+
throw new TiersNotEnabledError();
|
|
54
|
+
},
|
|
55
|
+
async listAtTier() {
|
|
56
|
+
throw new TiersNotEnabledError();
|
|
57
|
+
},
|
|
58
|
+
async elevate() {
|
|
59
|
+
throw new TiersNotEnabledError();
|
|
60
|
+
},
|
|
61
|
+
async demote() {
|
|
62
|
+
throw new TiersNotEnabledError();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/with-audit/tiers/index.ts
|
|
67
|
+
function assertTiersEnabled(ctx) {
|
|
68
|
+
if (!ctx.tiers) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
`Collection "${ctx.name}": hierarchical tiers are not enabled. Pass { tiers: [0, 1, 2, \u2026] } to vault.collection() to opt in.`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function assertDeclaredTier(ctx, tier) {
|
|
75
|
+
if (tier < 0 || !Number.isInteger(tier)) {
|
|
76
|
+
throw new Error(`Collection "${ctx.name}": tier must be a non-negative integer, got ${tier}`);
|
|
77
|
+
}
|
|
78
|
+
if (tier === 0) return;
|
|
79
|
+
if (!ctx.tiers || !ctx.tiers.has(tier)) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Collection "${ctx.name}": tier ${tier} is not declared in { tiers: [...] }`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function isElevatorOrOwner(ctx) {
|
|
86
|
+
return ctx.keyring.role === "owner" || ctx.keyring.role === "admin";
|
|
87
|
+
}
|
|
88
|
+
async function putAtTier(ctx, id, record, tier, opts) {
|
|
89
|
+
assertTiersEnabled(ctx);
|
|
90
|
+
assertDeclaredTier(ctx, tier);
|
|
91
|
+
assertTierAccess(ctx.keyring, ctx.name, tier);
|
|
92
|
+
const key = dekKey(ctx.name, tier);
|
|
93
|
+
const dek = await ctx.getDEK(key);
|
|
94
|
+
const existing = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
95
|
+
const version = existing ? existing._v + 1 : 1;
|
|
96
|
+
const json = JSON.stringify(record);
|
|
97
|
+
const { iv, data } = await encrypt(json, dek);
|
|
98
|
+
const envelope = {
|
|
99
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
100
|
+
_v: version,
|
|
101
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
102
|
+
_iv: iv,
|
|
103
|
+
_data: data,
|
|
104
|
+
_by: ctx.keyring.userId,
|
|
105
|
+
...tier > 0 && { _tier: tier },
|
|
106
|
+
...ctx.provenance && opts?.source !== void 0 ? { _source: opts.source, _sourceTs: opts.sourceTs ?? (/* @__PURE__ */ new Date()).toISOString() } : {}
|
|
107
|
+
};
|
|
108
|
+
await ctx.adapter.put(ctx.vault, ctx.name, id, envelope);
|
|
109
|
+
if (tier > 0) {
|
|
110
|
+
ctx.emitCrossTierEvent({
|
|
111
|
+
actor: ctx.keyring.userId,
|
|
112
|
+
collection: ctx.name,
|
|
113
|
+
id,
|
|
114
|
+
tier,
|
|
115
|
+
authorization: opts?.elevation ? "elevation" : "inherent",
|
|
116
|
+
op: "put",
|
|
117
|
+
ts: envelope._ts,
|
|
118
|
+
...opts?.elevation && {
|
|
119
|
+
reason: opts.elevation.reason,
|
|
120
|
+
elevatedFrom: opts.elevation.fromTier
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function getAtTier(ctx, id) {
|
|
126
|
+
assertTiersEnabled(ctx);
|
|
127
|
+
const envelope = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
128
|
+
if (!envelope) return null;
|
|
129
|
+
const tier = envelope._tier ?? 0;
|
|
130
|
+
if (tier === 0) {
|
|
131
|
+
return ctx.codec.decryptRecord(envelope, { id });
|
|
132
|
+
}
|
|
133
|
+
const key = dekKey(ctx.name, tier);
|
|
134
|
+
if (!ctx.keyring.deks.has(key)) {
|
|
135
|
+
if (ctx.tierMode === "ghost") {
|
|
136
|
+
return { _ghost: true, _tier: tier };
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const dek = await ctx.getDEK(key);
|
|
141
|
+
let plaintext;
|
|
142
|
+
let cek;
|
|
143
|
+
if (envelope._cek !== void 0) {
|
|
144
|
+
cek = await unwrapCek(envelope._cek, dek);
|
|
145
|
+
ctx.cekCache?.set(id, cek, 1);
|
|
146
|
+
plaintext = await decrypt(envelope._iv, envelope._data, cek);
|
|
147
|
+
} else {
|
|
148
|
+
plaintext = await decrypt(envelope._iv, envelope._data, dek);
|
|
149
|
+
}
|
|
150
|
+
let record = JSON.parse(plaintext);
|
|
151
|
+
if (envelope._sealed !== void 0) {
|
|
152
|
+
record = await ctx.codec.applySealedSlots(record, envelope._sealed, cek, { id });
|
|
153
|
+
}
|
|
154
|
+
ctx.emitCrossTierEvent({
|
|
155
|
+
actor: ctx.keyring.userId,
|
|
156
|
+
collection: ctx.name,
|
|
157
|
+
id,
|
|
158
|
+
tier,
|
|
159
|
+
authorization: isElevatorOrOwner(ctx) ? "inherent" : "delegation",
|
|
160
|
+
op: "get",
|
|
161
|
+
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
162
|
+
});
|
|
163
|
+
return record;
|
|
164
|
+
}
|
|
165
|
+
async function listAtTier(ctx) {
|
|
166
|
+
assertTiersEnabled(ctx);
|
|
167
|
+
const ids = await ctx.adapter.list(ctx.vault, ctx.name);
|
|
168
|
+
const out = [];
|
|
169
|
+
for (const id of ids) {
|
|
170
|
+
const env = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
171
|
+
if (!env) continue;
|
|
172
|
+
const tier = env._tier ?? 0;
|
|
173
|
+
const readable = tier === 0 || ctx.keyring.deks.has(dekKey(ctx.name, tier));
|
|
174
|
+
if (!readable && ctx.tierMode === "invisibility") continue;
|
|
175
|
+
out.push({ id, tier, readable });
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
async function elevate(ctx, id, toTier) {
|
|
180
|
+
assertTiersEnabled(ctx);
|
|
181
|
+
assertDeclaredTier(ctx, toTier);
|
|
182
|
+
assertTierAccess(ctx.keyring, ctx.name, toTier);
|
|
183
|
+
const envelope = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
184
|
+
if (!envelope) throw new Error(`Record "${id}" not found in collection "${ctx.name}"`);
|
|
185
|
+
const fromTier = envelope._tier ?? 0;
|
|
186
|
+
if (toTier === fromTier) return;
|
|
187
|
+
if (toTier < fromTier) {
|
|
188
|
+
throw new Error(`Use demote() to lower the tier of "${id}" from ${fromTier} to ${toTier}`);
|
|
189
|
+
}
|
|
190
|
+
if (fromTier > 0) assertTierAccess(ctx.keyring, ctx.name, fromTier);
|
|
191
|
+
const fromKey = dekKey(ctx.name, fromTier);
|
|
192
|
+
const toKey = dekKey(ctx.name, toTier);
|
|
193
|
+
const fromDek = await ctx.getDEK(fromKey);
|
|
194
|
+
const toDek = await ctx.getDEK(toKey);
|
|
195
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
196
|
+
const body = await rewrapBodyToDek(envelope, fromDek, toDek);
|
|
197
|
+
if (body.cek) ctx.cekCache?.set(id, body.cek, 1);
|
|
198
|
+
const next = {
|
|
199
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
200
|
+
_v: envelope._v + 1,
|
|
201
|
+
_ts: now,
|
|
202
|
+
_iv: body._iv,
|
|
203
|
+
_data: body._data,
|
|
204
|
+
_by: ctx.keyring.userId,
|
|
205
|
+
_tier: toTier,
|
|
206
|
+
_elevatedBy: ctx.keyring.userId,
|
|
207
|
+
...body._cek !== void 0 ? { _cek: body._cek } : {}
|
|
208
|
+
};
|
|
209
|
+
await ctx.adapter.put(ctx.vault, ctx.name, id, next);
|
|
210
|
+
ctx.emitCrossTierEvent({
|
|
211
|
+
actor: ctx.keyring.userId,
|
|
212
|
+
collection: ctx.name,
|
|
213
|
+
id,
|
|
214
|
+
tier: toTier,
|
|
215
|
+
authorization: "elevation",
|
|
216
|
+
op: "elevate",
|
|
217
|
+
ts: now
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
async function demote(ctx, id, toTier) {
|
|
221
|
+
assertTiersEnabled(ctx);
|
|
222
|
+
if (toTier < 0) throw new Error(`Cannot demote to negative tier ${toTier}`);
|
|
223
|
+
const envelope = await ctx.adapter.get(ctx.vault, ctx.name, id);
|
|
224
|
+
if (!envelope) throw new Error(`Record "${id}" not found in collection "${ctx.name}"`);
|
|
225
|
+
const fromTier = envelope._tier ?? 0;
|
|
226
|
+
if (toTier === fromTier) return;
|
|
227
|
+
if (toTier > fromTier) {
|
|
228
|
+
throw new Error(`Use elevate() to raise the tier of "${id}" from ${fromTier} to ${toTier}`);
|
|
229
|
+
}
|
|
230
|
+
const isOwner = ctx.keyring.role === "owner";
|
|
231
|
+
const isOriginalElevator = envelope._elevatedBy === ctx.keyring.userId;
|
|
232
|
+
if (!isOwner && !isOriginalElevator) {
|
|
233
|
+
throw new TierDemoteDeniedError(id, fromTier);
|
|
234
|
+
}
|
|
235
|
+
assertTierAccess(ctx.keyring, ctx.name, fromTier);
|
|
236
|
+
if (toTier > 0) assertDeclaredTier(ctx, toTier);
|
|
237
|
+
const fromDek = await ctx.getDEK(dekKey(ctx.name, fromTier));
|
|
238
|
+
const toDek = await ctx.getDEK(dekKey(ctx.name, toTier));
|
|
239
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
240
|
+
const body = await rewrapBodyToDek(envelope, fromDek, toDek);
|
|
241
|
+
if (body.cek) ctx.cekCache?.set(id, body.cek, 1);
|
|
242
|
+
const next = {
|
|
243
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
244
|
+
_v: envelope._v + 1,
|
|
245
|
+
_ts: now,
|
|
246
|
+
_iv: body._iv,
|
|
247
|
+
_data: body._data,
|
|
248
|
+
_by: ctx.keyring.userId,
|
|
249
|
+
...toTier > 0 && { _tier: toTier },
|
|
250
|
+
...body._cek !== void 0 ? { _cek: body._cek } : {}
|
|
251
|
+
};
|
|
252
|
+
await ctx.adapter.put(ctx.vault, ctx.name, id, next);
|
|
253
|
+
ctx.emitCrossTierEvent({
|
|
254
|
+
actor: ctx.keyring.userId,
|
|
255
|
+
collection: ctx.name,
|
|
256
|
+
id,
|
|
257
|
+
tier: fromTier,
|
|
258
|
+
authorization: "elevation",
|
|
259
|
+
op: "demote",
|
|
260
|
+
ts: now
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function classifySealedShred(ctx, live) {
|
|
264
|
+
return ctx.codec.classifySealedShred(live);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export {
|
|
268
|
+
withTiers,
|
|
269
|
+
NO_TIERS,
|
|
270
|
+
assertTiersEnabled,
|
|
271
|
+
assertDeclaredTier,
|
|
272
|
+
putAtTier,
|
|
273
|
+
getAtTier,
|
|
274
|
+
listAtTier,
|
|
275
|
+
elevate,
|
|
276
|
+
demote,
|
|
277
|
+
classifySealedShred
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=chunk-7P2SDJG3.js.map
|