@noy-db/hub 0.2.0-pre.19 → 0.2.0-pre.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +3 -3
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +5 -5
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +4 -4
- package/dist/attestation/index.d.ts +4 -4
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs +252 -2
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +11 -7
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.cjs +81 -7
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +6 -6
- package/dist/bundle/index.d.ts +6 -6
- package/dist/bundle/index.js +10 -10
- package/dist/{chunk-U7JNBSS3.js → chunk-2XA2ZML4.js} +3 -3
- package/dist/chunk-2XA2ZML4.js.map +1 -0
- package/dist/{chunk-OKOKPYWH.js → chunk-37VGJM3T.js} +2 -2
- package/dist/{chunk-B6E5IRPJ.js → chunk-3HNKR65T.js} +3 -3
- package/dist/{chunk-6KESZO5D.js → chunk-5YTXYPES.js} +5 -5
- package/dist/{chunk-7HD67R6U.js → chunk-6QAZ5O6X.js} +2 -2
- package/dist/{chunk-XPH3FWME.js → chunk-6QE4DUYC.js} +2 -2
- package/dist/{chunk-4ULLGYPA.js → chunk-7MRT7EPB.js} +3 -3
- package/dist/{chunk-KYGGXXT6.js → chunk-7PH4OPBZ.js} +119 -58
- package/dist/chunk-7PH4OPBZ.js.map +1 -0
- package/dist/{chunk-3FSMVWBN.js → chunk-AI4USDRI.js} +4 -4
- package/dist/{chunk-GKQAU52M.js → chunk-BZW5IL43.js} +4 -4
- package/dist/{chunk-NN6IISZO.js → chunk-C2RJVZZL.js} +2 -2
- package/dist/{chunk-VNUE6FHP.js → chunk-C6W5KVDV.js} +3 -3
- package/dist/{chunk-KNKNOJFS.js → chunk-CQYEDODS.js} +3 -3
- package/dist/{chunk-FPHRTW2Z.js → chunk-EYK72OTL.js} +5 -5
- package/dist/{chunk-FBLAWK6A.js → chunk-F5GWNSE2.js} +2 -2
- package/dist/{chunk-Y5J63SMF.js → chunk-F5ILTHMU.js} +5 -5
- package/dist/{chunk-M3FPNTO2.js → chunk-FRRJIUSI.js} +4 -4
- package/dist/chunk-FRRJIUSI.js.map +1 -0
- package/dist/{chunk-Q5MCHUXZ.js → chunk-GJTKMME7.js} +2 -2
- package/dist/{chunk-S22UOMHM.js → chunk-HYJMAV53.js} +6 -6
- package/dist/{chunk-YZE6C3TQ.js → chunk-I3IYTUUI.js} +3 -3
- package/dist/{chunk-5IGWRMEC.js → chunk-IVZWHIEK.js} +5 -5
- package/dist/{chunk-7C6VFNIY.js → chunk-IW4L4X65.js} +2 -2
- package/dist/{chunk-V3VIRTTE.js → chunk-IY24WS2P.js} +3 -3
- package/dist/{chunk-IVP5IVON.js → chunk-J6RGRZOY.js} +2 -2
- package/dist/{chunk-DY3EOJEN.js → chunk-JBBWALNI.js} +2 -2
- package/dist/{chunk-YX333DPS.js → chunk-JDCPRJVS.js} +4 -4
- package/dist/{chunk-E66DSTJP.js → chunk-JOK73NDT.js} +3 -3
- package/dist/{chunk-G4PYA575.js → chunk-JTI57WRT.js} +2 -2
- package/dist/{chunk-OBMYMKGO.js → chunk-JYNH4FIM.js} +4 -4
- package/dist/{chunk-GYAWXHFO.js → chunk-KOAJ3TZM.js} +2 -2
- package/dist/{chunk-X7FJMKT3.js → chunk-MBXKRHSS.js} +2 -2
- package/dist/{chunk-WFK2EVYU.js → chunk-NSXNXLYM.js} +2 -2
- package/dist/{chunk-3Q2AOPLT.js → chunk-NV4IHBZS.js} +5 -5
- package/dist/{chunk-H42KZXNV.js → chunk-O5XKZCUD.js} +5 -5
- package/dist/{chunk-DJF3FXW5.js → chunk-OTWT6BAJ.js} +18 -1
- package/dist/chunk-OTWT6BAJ.js.map +1 -0
- package/dist/{chunk-6OSOE6BY.js → chunk-S45MDEEF.js} +2 -2
- package/dist/{chunk-S3XA7G35.js → chunk-SQKAECUL.js} +2 -2
- package/dist/{chunk-YLRRU72W.js → chunk-SQOK5UM6.js} +2 -2
- package/dist/{chunk-SHIUFIPW.js → chunk-TA6HPKWQ.js} +1 -1
- package/dist/chunk-TA6HPKWQ.js.map +1 -0
- package/dist/{chunk-V5FZWQNN.js → chunk-TAMRU7A2.js} +4 -4
- package/dist/{chunk-PWFTQHYX.js → chunk-TGIJTNM3.js} +2 -2
- package/dist/{chunk-VEIVAYJ7.js → chunk-TNH5SLCD.js} +2 -2
- package/dist/{chunk-IBVTH4JR.js → chunk-TYMDCIQM.js} +4 -4
- package/dist/{chunk-LSIIPKYT.js → chunk-U2XSUCDF.js} +2 -2
- package/dist/{chunk-MI36HL5G.js → chunk-UU6M64HI.js} +4 -4
- package/dist/{chunk-KEDJDWWQ.js → chunk-WE2BUQD2.js} +3 -3
- package/dist/{chunk-OY7RX2VL.js → chunk-WWVJXBOT.js} +256 -8
- package/dist/chunk-WWVJXBOT.js.map +1 -0
- package/dist/{chunk-CYNTFU2D.js → chunk-YPIOFSN3.js} +2 -2
- package/dist/{chunk-PTGQPWMV.js → chunk-ZONKSLF2.js} +2 -2
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-B46VNH6X.js → crypto-456N7UVX.js} +3 -3
- package/dist/{delegation-5HON72PV.js → delegation-DP4COTXB.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +6 -6
- package/dist/derivations/index.d.ts +6 -6
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-BR1rMOS-.d.cts → dev-unlock-CY0HIZA0.d.cts} +1 -1
- package/dist/{dev-unlock-whL49sxV.d.ts → dev-unlock-CpKSkl2c.d.ts} +1 -1
- package/dist/{errors-DL-zTrrF.d.cts → errors-Dkc_fi-S.d.cts} +21 -1
- package/dist/{errors-DL-zTrrF.d.ts → errors-Dkc_fi-S.d.ts} +21 -1
- package/dist/executor-4IEW4KG5.js +8 -0
- package/dist/executor-KYJCJCIN.js +12 -0
- package/dist/executor-W7VIBOBZ.js +8 -0
- package/dist/{fanout-sidecar-DCQWJQ6S.js → fanout-sidecar-YXNAEZ33.js} +2 -2
- package/dist/forget/index.js +4 -4
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +6 -6
- package/dist/guards/index.d.ts +6 -6
- package/dist/guards/index.js +3 -3
- package/dist/{hash-BEUBmmI4.d.cts → hash-BSd0-_L8.d.cts} +1 -1
- package/dist/{hash-Dtb7FwWd.d.ts → hash-BnBQx39y.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +6 -6
- package/dist/history/index.d.ts +6 -6
- package/dist/history/index.js +5 -5
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +5 -5
- package/dist/i18n/index.d.ts +5 -5
- package/dist/i18n/index.js +6 -6
- package/dist/{index-BelbyUwz.d.ts → index-Bm9hIY7t.d.ts} +2 -2
- package/dist/{index-BM7O48Ur.d.cts → index-tZqVB9g5.d.cts} +2 -2
- package/dist/index.cjs +358 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -16
- package/dist/index.d.ts +42 -16
- package/dist/index.js +73 -46
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +4 -4
- package/dist/issue-JXC6T2QR.js +12 -0
- package/dist/{ledger-LS6GXCBP.js → ledger-I7JUYP4L.js} +5 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +6 -6
- package/dist/materialized-views/index.d.ts +6 -6
- package/dist/materialized-views/index.js +8 -8
- package/dist/mime-magic-BnJCGJzB.d.cts +103 -0
- package/dist/mime-magic-CjSyakO4.d.ts +103 -0
- package/dist/noydb-ZZCRF6TE.js +38 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +6 -6
- package/dist/overlay-views/index.d.ts +6 -6
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +5 -5
- package/dist/periods/index.d.ts +5 -5
- package/dist/periods/index.js +5 -5
- package/dist/{public-envelope-AGU6SS4Z.js → public-envelope-5XRTUNKF.js} +4 -4
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +7 -7
- package/dist/registry-ATRHOG5B.js +8 -0
- package/dist/registry-LEHB26TY.js +8 -0
- package/dist/{registry-RDPTFXQ7.js → registry-NWHOLD5M.js} +3 -3
- package/dist/{revoke-IFLXEZA5.js → revoke-5IEK22KT.js} +6 -6
- package/dist/sealed-record/index.cjs.map +1 -1
- package/dist/sealed-record/index.d.cts +1 -1
- package/dist/sealed-record/index.d.ts +1 -1
- package/dist/sealed-record/index.js +2 -2
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +6 -6
- package/dist/session/index.d.ts +6 -6
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +5 -5
- package/dist/shadow/index.d.ts +5 -5
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-UNWOUJAK.js → signer-I6YARZQA.js} +5 -5
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +5 -5
- package/dist/snapshots/index.d.ts +5 -5
- package/dist/snapshots/index.js +4 -4
- package/dist/{stale-NTEV5SLX.js → stale-CPESGAPL.js} +2 -2
- package/dist/{state-vault-TUTFRTOA.js → state-vault-JR3CFGNP.js} +4 -4
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +5 -5
- package/dist/store/index.d.ts +5 -5
- package/dist/store/index.js +2 -2
- package/dist/{strategy-BDxQnnTX.d.ts → strategy-54eIwox5.d.ts} +1 -1
- package/dist/{strategy-C5ol6NdV.d.cts → strategy-WtB-jXYv.d.cts} +1 -1
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +4 -4
- package/dist/sync/index.d.ts +4 -4
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +5 -5
- package/dist/team/index.d.ts +5 -5
- package/dist/team/index.js +8 -8
- package/dist/{transition-guard-C__YeF3_.d.ts → transition-guard-D4bfIAiW.d.ts} +1 -1
- package/dist/{transition-guard-B1N82hMf.d.cts → transition-guard-Dmpqzg-_.d.cts} +1 -1
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +5 -5
- package/dist/tx/index.d.ts +5 -5
- package/dist/tx/index.js +3 -3
- package/dist/{types-CraiZOyO.d.ts → types-DLfWFr6U.d.ts} +374 -139
- package/dist/{types-D-gr5t0G.d.cts → types-DyOI6XZ_.d.cts} +374 -139
- package/dist/{ulid-FFRRHkVf.d.ts → ulid-B2L_aqVA.d.ts} +1 -1
- package/dist/{ulid-DQnSAP5W.d.cts → ulid-LaxfH2tK.d.cts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{vault-group-27EV7KB4.js → vault-group-BB246VIM.js} +7 -7
- package/dist/{with-materialized-view-BboqxyV3.d.cts → with-materialized-view-CeZYGJVf.d.cts} +1 -1
- package/dist/{with-materialized-view-CguCeVcT.d.ts → with-materialized-view-DNULSxoP.d.ts} +1 -1
- package/dist/{with-overlayed-view-DO08u_tx.d.ts → with-overlayed-view-C9joG7UZ.d.ts} +1 -1
- package/dist/{with-overlayed-view-mmsg5Of3.d.cts → with-overlayed-view-kdcPGHih.d.cts} +1 -1
- package/dist/{with-rollup-_TyBzz3T.d.ts → with-rollup-DJDbrxjf.d.ts} +1 -1
- package/dist/{with-rollup-aaxOZcIb.d.cts → with-rollup-s58XAeWO.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-DJF3FXW5.js.map +0 -1
- package/dist/chunk-KYGGXXT6.js.map +0 -1
- package/dist/chunk-M3FPNTO2.js.map +0 -1
- package/dist/chunk-OY7RX2VL.js.map +0 -1
- package/dist/chunk-SHIUFIPW.js.map +0 -1
- package/dist/chunk-U7JNBSS3.js.map +0 -1
- package/dist/executor-44R5CUS2.js +0 -12
- package/dist/executor-AOACUK7Z.js +0 -8
- package/dist/executor-OKFLQCDW.js +0 -8
- package/dist/issue-EPA2PSWP.js +0 -12
- package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
- package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
- package/dist/noydb-BVKFP74P.js +0 -38
- package/dist/registry-ERNAMRDE.js +0 -8
- package/dist/registry-EXTHSXQW.js +0 -8
- /package/dist/{chunk-OKOKPYWH.js.map → chunk-37VGJM3T.js.map} +0 -0
- /package/dist/{chunk-B6E5IRPJ.js.map → chunk-3HNKR65T.js.map} +0 -0
- /package/dist/{chunk-6KESZO5D.js.map → chunk-5YTXYPES.js.map} +0 -0
- /package/dist/{chunk-7HD67R6U.js.map → chunk-6QAZ5O6X.js.map} +0 -0
- /package/dist/{chunk-XPH3FWME.js.map → chunk-6QE4DUYC.js.map} +0 -0
- /package/dist/{chunk-4ULLGYPA.js.map → chunk-7MRT7EPB.js.map} +0 -0
- /package/dist/{chunk-3FSMVWBN.js.map → chunk-AI4USDRI.js.map} +0 -0
- /package/dist/{chunk-GKQAU52M.js.map → chunk-BZW5IL43.js.map} +0 -0
- /package/dist/{chunk-NN6IISZO.js.map → chunk-C2RJVZZL.js.map} +0 -0
- /package/dist/{chunk-VNUE6FHP.js.map → chunk-C6W5KVDV.js.map} +0 -0
- /package/dist/{chunk-KNKNOJFS.js.map → chunk-CQYEDODS.js.map} +0 -0
- /package/dist/{chunk-FPHRTW2Z.js.map → chunk-EYK72OTL.js.map} +0 -0
- /package/dist/{chunk-FBLAWK6A.js.map → chunk-F5GWNSE2.js.map} +0 -0
- /package/dist/{chunk-Y5J63SMF.js.map → chunk-F5ILTHMU.js.map} +0 -0
- /package/dist/{chunk-Q5MCHUXZ.js.map → chunk-GJTKMME7.js.map} +0 -0
- /package/dist/{chunk-S22UOMHM.js.map → chunk-HYJMAV53.js.map} +0 -0
- /package/dist/{chunk-YZE6C3TQ.js.map → chunk-I3IYTUUI.js.map} +0 -0
- /package/dist/{chunk-5IGWRMEC.js.map → chunk-IVZWHIEK.js.map} +0 -0
- /package/dist/{chunk-7C6VFNIY.js.map → chunk-IW4L4X65.js.map} +0 -0
- /package/dist/{chunk-V3VIRTTE.js.map → chunk-IY24WS2P.js.map} +0 -0
- /package/dist/{chunk-IVP5IVON.js.map → chunk-J6RGRZOY.js.map} +0 -0
- /package/dist/{chunk-DY3EOJEN.js.map → chunk-JBBWALNI.js.map} +0 -0
- /package/dist/{chunk-YX333DPS.js.map → chunk-JDCPRJVS.js.map} +0 -0
- /package/dist/{chunk-E66DSTJP.js.map → chunk-JOK73NDT.js.map} +0 -0
- /package/dist/{chunk-G4PYA575.js.map → chunk-JTI57WRT.js.map} +0 -0
- /package/dist/{chunk-OBMYMKGO.js.map → chunk-JYNH4FIM.js.map} +0 -0
- /package/dist/{chunk-GYAWXHFO.js.map → chunk-KOAJ3TZM.js.map} +0 -0
- /package/dist/{chunk-X7FJMKT3.js.map → chunk-MBXKRHSS.js.map} +0 -0
- /package/dist/{chunk-WFK2EVYU.js.map → chunk-NSXNXLYM.js.map} +0 -0
- /package/dist/{chunk-3Q2AOPLT.js.map → chunk-NV4IHBZS.js.map} +0 -0
- /package/dist/{chunk-H42KZXNV.js.map → chunk-O5XKZCUD.js.map} +0 -0
- /package/dist/{chunk-6OSOE6BY.js.map → chunk-S45MDEEF.js.map} +0 -0
- /package/dist/{chunk-S3XA7G35.js.map → chunk-SQKAECUL.js.map} +0 -0
- /package/dist/{chunk-YLRRU72W.js.map → chunk-SQOK5UM6.js.map} +0 -0
- /package/dist/{chunk-V5FZWQNN.js.map → chunk-TAMRU7A2.js.map} +0 -0
- /package/dist/{chunk-PWFTQHYX.js.map → chunk-TGIJTNM3.js.map} +0 -0
- /package/dist/{chunk-VEIVAYJ7.js.map → chunk-TNH5SLCD.js.map} +0 -0
- /package/dist/{chunk-IBVTH4JR.js.map → chunk-TYMDCIQM.js.map} +0 -0
- /package/dist/{chunk-LSIIPKYT.js.map → chunk-U2XSUCDF.js.map} +0 -0
- /package/dist/{chunk-MI36HL5G.js.map → chunk-UU6M64HI.js.map} +0 -0
- /package/dist/{chunk-KEDJDWWQ.js.map → chunk-WE2BUQD2.js.map} +0 -0
- /package/dist/{chunk-CYNTFU2D.js.map → chunk-YPIOFSN3.js.map} +0 -0
- /package/dist/{chunk-PTGQPWMV.js.map → chunk-ZONKSLF2.js.map} +0 -0
- /package/dist/{crypto-B46VNH6X.js.map → crypto-456N7UVX.js.map} +0 -0
- /package/dist/{delegation-5HON72PV.js.map → delegation-DP4COTXB.js.map} +0 -0
- /package/dist/{executor-44R5CUS2.js.map → executor-4IEW4KG5.js.map} +0 -0
- /package/dist/{executor-AOACUK7Z.js.map → executor-KYJCJCIN.js.map} +0 -0
- /package/dist/{executor-OKFLQCDW.js.map → executor-W7VIBOBZ.js.map} +0 -0
- /package/dist/{fanout-sidecar-DCQWJQ6S.js.map → fanout-sidecar-YXNAEZ33.js.map} +0 -0
- /package/dist/{issue-EPA2PSWP.js.map → issue-JXC6T2QR.js.map} +0 -0
- /package/dist/{ledger-LS6GXCBP.js.map → ledger-I7JUYP4L.js.map} +0 -0
- /package/dist/{noydb-BVKFP74P.js.map → noydb-ZZCRF6TE.js.map} +0 -0
- /package/dist/{public-envelope-AGU6SS4Z.js.map → public-envelope-5XRTUNKF.js.map} +0 -0
- /package/dist/{registry-ERNAMRDE.js.map → registry-ATRHOG5B.js.map} +0 -0
- /package/dist/{registry-EXTHSXQW.js.map → registry-LEHB26TY.js.map} +0 -0
- /package/dist/{registry-RDPTFXQ7.js.map → registry-NWHOLD5M.js.map} +0 -0
- /package/dist/{revoke-IFLXEZA5.js.map → revoke-5IEK22KT.js.map} +0 -0
- /package/dist/{signer-UNWOUJAK.js.map → signer-I6YARZQA.js.map} +0 -0
- /package/dist/{stale-NTEV5SLX.js.map → stale-CPESGAPL.js.map} +0 -0
- /package/dist/{state-vault-TUTFRTOA.js.map → state-vault-JR3CFGNP.js.map} +0 -0
- /package/dist/{vault-group-27EV7KB4.js.map → vault-group-BB246VIM.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var init_types = __esm({
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// src/errors.ts
|
|
49
|
-
var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, ReservedVaultNameError, PeriodClosedError, RecordLockedError, FieldFrozenError, IllegalTransitionError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, SequenceContentionError, SequenceOfflineError, NumberingUncertaintyError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, UniqueConstraintError, UnsupportedIndexOptionError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, ScriptViolationError, StaticDictReadonlyError, UnknownDictCodeError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError, UnknownShardError, ShardProvisioningError, DataResidencyError, CrossShardJoinError, VaultTemplateNotFoundError, ForgetStrategyNotConfiguredError, SealedRecordExpiredError, SealedRecordMismatchError, RecordCekNotFoundError;
|
|
49
|
+
var NoydbError, DebugPlaintextError, DebugReservedFieldError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, ReservedVaultNameError, PeriodClosedError, RecordLockedError, FieldFrozenError, IllegalTransitionError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, SequenceContentionError, SequenceOfflineError, NumberingUncertaintyError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, UniqueConstraintError, UnsupportedIndexOptionError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, ScriptViolationError, StaticDictReadonlyError, UnknownDictCodeError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError, UnknownShardError, ShardProvisioningError, DataResidencyError, CrossShardJoinError, VaultTemplateNotFoundError, ForgetStrategyNotConfiguredError, SealedRecordExpiredError, SealedRecordMismatchError, RecordCekNotFoundError;
|
|
50
50
|
var init_errors = __esm({
|
|
51
51
|
"src/errors.ts"() {
|
|
52
52
|
"use strict";
|
|
@@ -59,6 +59,21 @@ var init_errors = __esm({
|
|
|
59
59
|
this.code = code;
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
DebugPlaintextError = class extends NoydbError {
|
|
63
|
+
constructor(message = "debugPlaintext requires encrypt: false") {
|
|
64
|
+
super("DEBUG_PLAINTEXT_REQUIRES_UNENCRYPTED", message);
|
|
65
|
+
this.name = "DebugPlaintextError";
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
DebugReservedFieldError = class extends NoydbError {
|
|
69
|
+
constructor(collection, field) {
|
|
70
|
+
super(
|
|
71
|
+
"DEBUG_RESERVED_FIELD",
|
|
72
|
+
`Record in "${collection}" has reserved field "${field}": the _ prefix is reserved under debugPlaintext mode`
|
|
73
|
+
);
|
|
74
|
+
this.name = "DebugReservedFieldError";
|
|
75
|
+
}
|
|
76
|
+
};
|
|
62
77
|
DecryptionError = class extends NoydbError {
|
|
63
78
|
constructor(message = "Decryption failed") {
|
|
64
79
|
super("DECRYPTION_FAILED", message);
|
|
@@ -6414,6 +6429,8 @@ __export(src_exports, {
|
|
|
6414
6429
|
DIRECTORY_RECORD_ID: () => DIRECTORY_RECORD_ID,
|
|
6415
6430
|
DanglingReferenceError: () => DanglingReferenceError,
|
|
6416
6431
|
DataResidencyError: () => DataResidencyError,
|
|
6432
|
+
DebugPlaintextError: () => DebugPlaintextError,
|
|
6433
|
+
DebugReservedFieldError: () => DebugReservedFieldError,
|
|
6417
6434
|
DecryptionError: () => DecryptionError,
|
|
6418
6435
|
DelegationTargetMissingError: () => DelegationTargetMissingError,
|
|
6419
6436
|
DerivationCapExceededError: () => DerivationCapExceededError,
|
|
@@ -6642,6 +6659,7 @@ __export(src_exports, {
|
|
|
6642
6659
|
hashEntry: () => hashEntry,
|
|
6643
6660
|
i18nText: () => i18nText,
|
|
6644
6661
|
immutableGuard: () => immutableGuard,
|
|
6662
|
+
importExternalObjects: () => importExternalObjects,
|
|
6645
6663
|
inferScripts: () => inferScripts,
|
|
6646
6664
|
isDevUnlockActive: () => isDevUnlockActive,
|
|
6647
6665
|
isDictCollectionName: () => isDictCollectionName,
|
|
@@ -6679,6 +6697,7 @@ __export(src_exports, {
|
|
|
6679
6697
|
lockSchema: () => lockSchema,
|
|
6680
6698
|
magicLinkGrantRecordId: () => magicLinkGrantRecordId,
|
|
6681
6699
|
max: () => max,
|
|
6700
|
+
memoryObjectProjection: () => memoryObjectProjection,
|
|
6682
6701
|
mergeCrdtStates: () => mergeCrdtStates,
|
|
6683
6702
|
mergePolicy: () => mergePolicy,
|
|
6684
6703
|
min: () => min,
|
|
@@ -6703,6 +6722,7 @@ __export(src_exports, {
|
|
|
6703
6722
|
readNoydbBundleHeader: () => readNoydbBundleHeader,
|
|
6704
6723
|
readNoydbBundlePublicEnvelope: () => readNoydbBundlePublicEnvelope,
|
|
6705
6724
|
readPath: () => readPath,
|
|
6725
|
+
readPlaintextRecord: () => readPlaintextRecord,
|
|
6706
6726
|
readPublicEnvelope: () => readPublicEnvelope,
|
|
6707
6727
|
readUserVisibility: () => readUserVisibility,
|
|
6708
6728
|
recoverUser: () => recoverUser,
|
|
@@ -7172,6 +7192,9 @@ var BlobSet = class {
|
|
|
7172
7192
|
userId;
|
|
7173
7193
|
maxBlobBytes;
|
|
7174
7194
|
erasableBlobs;
|
|
7195
|
+
debugPlaintext;
|
|
7196
|
+
objectStore;
|
|
7197
|
+
blobFields;
|
|
7175
7198
|
constructor(opts) {
|
|
7176
7199
|
this.store = opts.store;
|
|
7177
7200
|
this.vault = opts.vault;
|
|
@@ -7182,6 +7205,9 @@ var BlobSet = class {
|
|
|
7182
7205
|
this.userId = opts.userId;
|
|
7183
7206
|
this.maxBlobBytes = opts.maxBlobBytes;
|
|
7184
7207
|
this.erasableBlobs = opts.erasableBlobs === true;
|
|
7208
|
+
this.debugPlaintext = opts.debugPlaintext === true;
|
|
7209
|
+
this.objectStore = opts.objectStore;
|
|
7210
|
+
this.blobFields = opts.blobFields;
|
|
7185
7211
|
}
|
|
7186
7212
|
/**
|
|
7187
7213
|
* Resolve the key the blob's CHUNKS are encrypted under.
|
|
@@ -7569,6 +7595,49 @@ var BlobSet = class {
|
|
|
7569
7595
|
* If overwriting an existing slot, decrements the old eTag's refCount.
|
|
7570
7596
|
*/
|
|
7571
7597
|
async put(slotName, data, opts) {
|
|
7598
|
+
if (this.objectStore && this.blobFields?.[slotName]?.external) {
|
|
7599
|
+
const policy = this.blobFields[slotName];
|
|
7600
|
+
let contentType = opts?.mimeType;
|
|
7601
|
+
if (!contentType) {
|
|
7602
|
+
const detected = detectMagic(data.subarray(0, 16));
|
|
7603
|
+
contentType = detected?.mime ?? "application/octet-stream";
|
|
7604
|
+
}
|
|
7605
|
+
const key = `${this.collection}/${this.recordId}/${slotName}`;
|
|
7606
|
+
const isPublic = policy.public === true;
|
|
7607
|
+
const backlink = await this.buildBacklink(slotName, policy.backlink ?? "opaque-token");
|
|
7608
|
+
await this.objectStore.putObject(key, data, {
|
|
7609
|
+
contentType,
|
|
7610
|
+
public: isPublic,
|
|
7611
|
+
...backlink.userMeta ? { userMeta: backlink.userMeta } : {}
|
|
7612
|
+
});
|
|
7613
|
+
const uploaderUserId2 = opts?.uploadedBy ?? this.userId;
|
|
7614
|
+
let oldETag;
|
|
7615
|
+
await this.casUpdateSlots((slots) => {
|
|
7616
|
+
oldETag = slots[slotName]?.eTag || void 0;
|
|
7617
|
+
const prevMeta = slots[slotName]?.external?.meta;
|
|
7618
|
+
slots[slotName] = {
|
|
7619
|
+
eTag: "",
|
|
7620
|
+
external: {
|
|
7621
|
+
key,
|
|
7622
|
+
contentType,
|
|
7623
|
+
...isPublic ? { public: true } : {},
|
|
7624
|
+
...backlink.token ? { backlink: backlink.token } : {},
|
|
7625
|
+
...prevMeta ? { meta: prevMeta } : {}
|
|
7626
|
+
},
|
|
7627
|
+
filename: slotName,
|
|
7628
|
+
size: data.byteLength,
|
|
7629
|
+
mimeType: contentType,
|
|
7630
|
+
uploadedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7631
|
+
...uploaderUserId2 !== void 0 ? { uploadedBy: uploaderUserId2 } : {}
|
|
7632
|
+
};
|
|
7633
|
+
return slots;
|
|
7634
|
+
});
|
|
7635
|
+
if (oldETag) {
|
|
7636
|
+
await this.releaseRef(oldETag, 1, false).catch(() => {
|
|
7637
|
+
});
|
|
7638
|
+
}
|
|
7639
|
+
return;
|
|
7640
|
+
}
|
|
7572
7641
|
const blobDEK = this.encrypted ? await this.getDEK(BLOB_COLLECTION) : null;
|
|
7573
7642
|
const eTag = blobDEK ? await hmacSha256Hex(blobDEK, data) : await plainSha256Hex(data);
|
|
7574
7643
|
let mimeType = opts?.mimeType;
|
|
@@ -7584,12 +7653,13 @@ var BlobSet = class {
|
|
|
7584
7653
|
} else {
|
|
7585
7654
|
shouldCompress = true;
|
|
7586
7655
|
}
|
|
7656
|
+
if (this.debugPlaintext) shouldCompress = false;
|
|
7587
7657
|
const existingBlob = await this.loadBlobObject(eTag);
|
|
7588
7658
|
if (existingBlob) {
|
|
7589
7659
|
await this.casUpdateRefCount(eTag, 1);
|
|
7590
7660
|
} else {
|
|
7591
7661
|
const { bytes: compressed, algorithm } = shouldCompress ? await compressBytes(data) : { bytes: data, algorithm: "none" };
|
|
7592
|
-
const chunkSize = this.effectiveChunkSize(opts);
|
|
7662
|
+
const chunkSize = this.debugPlaintext ? Math.max(compressed.byteLength, 1) : this.effectiveChunkSize(opts);
|
|
7593
7663
|
const chunkCount = Math.max(1, Math.ceil(compressed.byteLength / chunkSize));
|
|
7594
7664
|
let chunkKey = blobDEK;
|
|
7595
7665
|
let wrappedCek;
|
|
@@ -7654,10 +7724,114 @@ var BlobSet = class {
|
|
|
7654
7724
|
const { slots } = await this.loadSlots();
|
|
7655
7725
|
const slot = slots[slotName];
|
|
7656
7726
|
if (!slot) return null;
|
|
7727
|
+
if (slot.external) {
|
|
7728
|
+
if (!this.objectStore) {
|
|
7729
|
+
throw new NotFoundError(`Blob slot "${slotName}" is external but no objectStore is configured`);
|
|
7730
|
+
}
|
|
7731
|
+
return this.objectStore.getObject(slot.external.key);
|
|
7732
|
+
}
|
|
7657
7733
|
const result = await this.loadBlobObject(slot.eTag);
|
|
7658
7734
|
if (!result) return null;
|
|
7659
7735
|
return this.fetchAllChunks(result.blob);
|
|
7660
7736
|
}
|
|
7737
|
+
/**
|
|
7738
|
+
* A URL to fetch an `external` slot's object directly — presigned
|
|
7739
|
+
* (time-limited) or public, per the projection. Returns `null` if the slot
|
|
7740
|
+
* does not exist. Throws for a non-external slot (use `get()`/`response()`).
|
|
7741
|
+
*/
|
|
7742
|
+
async url(slotName, opts) {
|
|
7743
|
+
const { slots } = await this.loadSlots();
|
|
7744
|
+
const slot = slots[slotName];
|
|
7745
|
+
if (!slot) return null;
|
|
7746
|
+
if (!slot.external) {
|
|
7747
|
+
throw new NotFoundError(`Blob slot "${slotName}" is not external \u2014 url() is only for external fields`);
|
|
7748
|
+
}
|
|
7749
|
+
if (!this.objectStore) {
|
|
7750
|
+
throw new NotFoundError(`Blob slot "${slotName}" is external but no objectStore is configured`);
|
|
7751
|
+
}
|
|
7752
|
+
return this.objectStore.objectUrl(slot.external.key, opts);
|
|
7753
|
+
}
|
|
7754
|
+
/**
|
|
7755
|
+
* Build the backlink stamped onto an external object's metadata — the
|
|
7756
|
+
* self-describing "secondary store" reference back to this record. See
|
|
7757
|
+
* {@link BlobFieldPolicy.backlink}. Returns the `userMeta` to attach and, for
|
|
7758
|
+
* `opaque-token`, the `token` to record on the slot.
|
|
7759
|
+
*/
|
|
7760
|
+
async buildBacklink(slotName, mode) {
|
|
7761
|
+
if (mode === "none") return {};
|
|
7762
|
+
const ref2 = { vault: this.vault, collection: this.collection, record: this.recordId, field: slotName };
|
|
7763
|
+
if (mode === "plain") {
|
|
7764
|
+
return {
|
|
7765
|
+
userMeta: {
|
|
7766
|
+
"noydb-vault": ref2.vault,
|
|
7767
|
+
"noydb-collection": ref2.collection,
|
|
7768
|
+
"noydb-record": ref2.record,
|
|
7769
|
+
"noydb-field": ref2.field
|
|
7770
|
+
}
|
|
7771
|
+
};
|
|
7772
|
+
}
|
|
7773
|
+
if (mode === "encrypted" && this.encrypted) {
|
|
7774
|
+
const dek = await this.getDEK(BLOB_COLLECTION);
|
|
7775
|
+
const { iv, data } = await encrypt(JSON.stringify(ref2), dek);
|
|
7776
|
+
return { userMeta: { "noydb-backlink-enc": `${iv}.${data}` } };
|
|
7777
|
+
}
|
|
7778
|
+
const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
7779
|
+
const token = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
7780
|
+
return { userMeta: { "noydb-backlink": token }, token };
|
|
7781
|
+
}
|
|
7782
|
+
/**
|
|
7783
|
+
* Adopt an EXISTING object in the projection into this slot **without
|
|
7784
|
+
* re-uploading** — used by import/bootstrap to anchor objects already in the
|
|
7785
|
+
* bucket. Writes the external slot record (the catalog entry).
|
|
7786
|
+
*/
|
|
7787
|
+
async adoptExternal(slotName, ref2) {
|
|
7788
|
+
const uploaderUserId = this.userId;
|
|
7789
|
+
await this.casUpdateSlots((slots) => {
|
|
7790
|
+
slots[slotName] = {
|
|
7791
|
+
eTag: "",
|
|
7792
|
+
external: {
|
|
7793
|
+
key: ref2.key,
|
|
7794
|
+
...ref2.contentType ? { contentType: ref2.contentType } : {},
|
|
7795
|
+
...ref2.public ? { public: true } : {},
|
|
7796
|
+
...ref2.backlink ? { backlink: ref2.backlink } : {},
|
|
7797
|
+
...ref2.meta ? { meta: ref2.meta } : {}
|
|
7798
|
+
},
|
|
7799
|
+
filename: slotName,
|
|
7800
|
+
size: ref2.size ?? 0,
|
|
7801
|
+
...ref2.contentType ? { mimeType: ref2.contentType } : {},
|
|
7802
|
+
uploadedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7803
|
+
...uploaderUserId !== void 0 ? { uploadedBy: uploaderUserId } : {}
|
|
7804
|
+
};
|
|
7805
|
+
return slots;
|
|
7806
|
+
});
|
|
7807
|
+
}
|
|
7808
|
+
/**
|
|
7809
|
+
* Merge derived metadata (video `duration`, image `width`/`height`, arbitrary
|
|
7810
|
+
* metatags) into an external slot's secondary metadata store. Typically called
|
|
7811
|
+
* from an AWS-side processing callback (MediaConvert / ffprobe / Rekognition)
|
|
7812
|
+
* once it has probed the object. No-op for a missing or non-external slot.
|
|
7813
|
+
*/
|
|
7814
|
+
async setExternalMeta(slotName, meta) {
|
|
7815
|
+
await this.casUpdateSlots((slots) => {
|
|
7816
|
+
const slot = slots[slotName];
|
|
7817
|
+
if (!slot?.external) return null;
|
|
7818
|
+
slots[slotName] = {
|
|
7819
|
+
...slot,
|
|
7820
|
+
external: { ...slot.external, meta: { ...slot.external.meta, ...meta } }
|
|
7821
|
+
};
|
|
7822
|
+
return slots;
|
|
7823
|
+
});
|
|
7824
|
+
}
|
|
7825
|
+
/**
|
|
7826
|
+
* Read an external slot's synced derived metadata (the secondary store).
|
|
7827
|
+
* Returns `null` for a missing or non-external slot, `{}` if none synced yet.
|
|
7828
|
+
*/
|
|
7829
|
+
async externalMeta(slotName) {
|
|
7830
|
+
const { slots } = await this.loadSlots();
|
|
7831
|
+
const slot = slots[slotName];
|
|
7832
|
+
if (!slot?.external) return null;
|
|
7833
|
+
return slot.external.meta ?? {};
|
|
7834
|
+
}
|
|
7661
7835
|
/**
|
|
7662
7836
|
* List all slot entries for this record.
|
|
7663
7837
|
* Returns metadata only — no chunk data is loaded.
|
|
@@ -7672,12 +7846,19 @@ var BlobSet = class {
|
|
|
7672
7846
|
*/
|
|
7673
7847
|
async delete(slotName) {
|
|
7674
7848
|
let eTagToRelease;
|
|
7849
|
+
let externalKeyToDelete;
|
|
7675
7850
|
await this.casUpdateSlots((slots) => {
|
|
7676
7851
|
if (!(slotName in slots)) return null;
|
|
7677
|
-
|
|
7852
|
+
const slot = slots[slotName];
|
|
7853
|
+
if (slot.external) externalKeyToDelete = slot.external.key;
|
|
7854
|
+
else eTagToRelease = slot.eTag;
|
|
7678
7855
|
delete slots[slotName];
|
|
7679
7856
|
return slots;
|
|
7680
7857
|
});
|
|
7858
|
+
if (externalKeyToDelete && this.objectStore) {
|
|
7859
|
+
await this.objectStore.deleteObject(externalKeyToDelete).catch(() => {
|
|
7860
|
+
});
|
|
7861
|
+
}
|
|
7681
7862
|
if (eTagToRelease) {
|
|
7682
7863
|
await this.releaseRef(eTagToRelease, 1, false).catch(() => {
|
|
7683
7864
|
});
|
|
@@ -7935,6 +8116,91 @@ async function plainSha256Hex(data) {
|
|
|
7935
8116
|
return sha256Hex(data);
|
|
7936
8117
|
}
|
|
7937
8118
|
|
|
8119
|
+
// src/blobs/object-projection.ts
|
|
8120
|
+
function memoryObjectProjection(opts = {}) {
|
|
8121
|
+
const base = opts.baseUrl ?? "memory://objects";
|
|
8122
|
+
const store = /* @__PURE__ */ new Map();
|
|
8123
|
+
return {
|
|
8124
|
+
name: "memory",
|
|
8125
|
+
async putObject(key, bytes, o) {
|
|
8126
|
+
store.set(key, {
|
|
8127
|
+
bytes,
|
|
8128
|
+
contentType: o.contentType,
|
|
8129
|
+
public: o.public === true,
|
|
8130
|
+
...o.userMeta ? { userMeta: o.userMeta } : {}
|
|
8131
|
+
});
|
|
8132
|
+
},
|
|
8133
|
+
async getObject(key) {
|
|
8134
|
+
return store.get(key)?.bytes ?? null;
|
|
8135
|
+
},
|
|
8136
|
+
async deleteObject(key) {
|
|
8137
|
+
store.delete(key);
|
|
8138
|
+
},
|
|
8139
|
+
async headObject(key) {
|
|
8140
|
+
const e = store.get(key);
|
|
8141
|
+
if (!e) return null;
|
|
8142
|
+
return {
|
|
8143
|
+
size: e.bytes.byteLength,
|
|
8144
|
+
contentType: e.contentType,
|
|
8145
|
+
...e.userMeta ? { userMeta: e.userMeta } : {}
|
|
8146
|
+
};
|
|
8147
|
+
},
|
|
8148
|
+
async objectUrl(key, o) {
|
|
8149
|
+
const e = store.get(key);
|
|
8150
|
+
if (e?.public) return `${base}/${key}`;
|
|
8151
|
+
return `${base}/${key}?sig=memory&expires=${o?.expiresInSeconds ?? 900}`;
|
|
8152
|
+
},
|
|
8153
|
+
async putUrl(key, o) {
|
|
8154
|
+
return `${base}/${key}?upload=memory&ct=${encodeURIComponent(o.contentType)}`;
|
|
8155
|
+
},
|
|
8156
|
+
async listPrefix(prefix) {
|
|
8157
|
+
const out = [];
|
|
8158
|
+
for (const [key, e] of store) {
|
|
8159
|
+
if (!key.startsWith(prefix)) continue;
|
|
8160
|
+
out.push({
|
|
8161
|
+
key,
|
|
8162
|
+
meta: { size: e.bytes.byteLength, contentType: e.contentType, ...e.userMeta ? { userMeta: e.userMeta } : {} }
|
|
8163
|
+
});
|
|
8164
|
+
}
|
|
8165
|
+
return out;
|
|
8166
|
+
}
|
|
8167
|
+
};
|
|
8168
|
+
}
|
|
8169
|
+
|
|
8170
|
+
// src/blobs/import-external.ts
|
|
8171
|
+
function defaultDeriveRecordId(key) {
|
|
8172
|
+
const parts = key.split("/");
|
|
8173
|
+
return parts.length >= 2 ? parts[parts.length - 2] ?? null : null;
|
|
8174
|
+
}
|
|
8175
|
+
async function importExternalObjects(args) {
|
|
8176
|
+
const { collection, objectStore, field } = args;
|
|
8177
|
+
const opts = args.options ?? {};
|
|
8178
|
+
const derive = opts.deriveRecordId ?? defaultDeriveRecordId;
|
|
8179
|
+
const makeRecord = opts.makeRecord ?? ((id) => ({ id }));
|
|
8180
|
+
const objects = await objectStore.listPrefix(opts.prefix ?? "");
|
|
8181
|
+
const recordIds = [];
|
|
8182
|
+
let imported = 0;
|
|
8183
|
+
let skipped = 0;
|
|
8184
|
+
for (const { key, meta } of objects) {
|
|
8185
|
+
const recordId4 = derive(key);
|
|
8186
|
+
if (!recordId4) {
|
|
8187
|
+
skipped++;
|
|
8188
|
+
continue;
|
|
8189
|
+
}
|
|
8190
|
+
if (await collection.get(recordId4) == null) {
|
|
8191
|
+
await collection.put(recordId4, makeRecord(recordId4));
|
|
8192
|
+
}
|
|
8193
|
+
await collection.blob(recordId4).adoptExternal(field, {
|
|
8194
|
+
key,
|
|
8195
|
+
...meta.size !== void 0 ? { size: meta.size } : {},
|
|
8196
|
+
...meta.contentType ? { contentType: meta.contentType } : {}
|
|
8197
|
+
});
|
|
8198
|
+
recordIds.push(recordId4);
|
|
8199
|
+
imported++;
|
|
8200
|
+
}
|
|
8201
|
+
return { imported, skipped, recordIds };
|
|
8202
|
+
}
|
|
8203
|
+
|
|
7938
8204
|
// src/store/bundle-store.ts
|
|
7939
8205
|
init_errors();
|
|
7940
8206
|
var BUNDLE_STORE_VERSION = 1;
|
|
@@ -8077,6 +8343,24 @@ function createBundleStore(factory) {
|
|
|
8077
8343
|
return factory;
|
|
8078
8344
|
}
|
|
8079
8345
|
|
|
8346
|
+
// src/debug.ts
|
|
8347
|
+
function readPlaintextRecord(envelope) {
|
|
8348
|
+
if (envelope._iv !== "") {
|
|
8349
|
+
throw new Error(
|
|
8350
|
+
"readPlaintextRecord: envelope is encrypted (non-empty _iv) \u2014 decrypt via the vault, not this helper"
|
|
8351
|
+
);
|
|
8352
|
+
}
|
|
8353
|
+
if (envelope._debug !== void 0) {
|
|
8354
|
+
const record = {};
|
|
8355
|
+
for (const [key, value] of Object.entries(envelope)) {
|
|
8356
|
+
if (!key.startsWith("_")) record[key] = value;
|
|
8357
|
+
}
|
|
8358
|
+
return record;
|
|
8359
|
+
}
|
|
8360
|
+
if (!envelope._data) return null;
|
|
8361
|
+
return JSON.parse(envelope._data);
|
|
8362
|
+
}
|
|
8363
|
+
|
|
8080
8364
|
// src/persisted-schemas/canonicalize.ts
|
|
8081
8365
|
function canonicalize(value) {
|
|
8082
8366
|
if (value === null || typeof value !== "object") {
|
|
@@ -9305,6 +9589,7 @@ init_constants();
|
|
|
9305
9589
|
init_errors();
|
|
9306
9590
|
init_errors();
|
|
9307
9591
|
init_errors();
|
|
9592
|
+
init_errors();
|
|
9308
9593
|
|
|
9309
9594
|
// src/bundle/format.ts
|
|
9310
9595
|
var NOYDB_BUNDLE_MAGIC = new Uint8Array([78, 68, 66, 49]);
|
|
@@ -16629,6 +16914,8 @@ var Collection = class {
|
|
|
16629
16914
|
* reaches the bundle.
|
|
16630
16915
|
*/
|
|
16631
16916
|
blobStrategy;
|
|
16917
|
+
objectStore;
|
|
16918
|
+
blobFields;
|
|
16632
16919
|
aggregateStrategy;
|
|
16633
16920
|
crdtStrategy;
|
|
16634
16921
|
historyStrategy;
|
|
@@ -16906,6 +17193,8 @@ var Collection = class {
|
|
|
16906
17193
|
this.subsystemBus = opts.subsystemBus;
|
|
16907
17194
|
this.activeTxId = opts.activeTxId;
|
|
16908
17195
|
this.blobStrategy = opts.blobStrategy ?? NO_BLOBS;
|
|
17196
|
+
this.objectStore = opts.objectStore;
|
|
17197
|
+
this.blobFields = opts.blobFields;
|
|
16909
17198
|
this.aggregateStrategy = opts.aggregateStrategy ?? NO_AGGREGATE;
|
|
16910
17199
|
this.crdtStrategy = opts.crdtStrategy ?? NO_CRDT;
|
|
16911
17200
|
this.historyStrategy = opts.historyStrategy ?? NO_HISTORY;
|
|
@@ -19046,7 +19335,10 @@ var Collection = class {
|
|
|
19046
19335
|
getDEK: this.getDEK,
|
|
19047
19336
|
encrypted: this.encrypted,
|
|
19048
19337
|
userId: this.keyring.userId,
|
|
19049
|
-
erasableBlobs: this.perRecordCek
|
|
19338
|
+
erasableBlobs: this.perRecordCek,
|
|
19339
|
+
debugPlaintext: this.keyring.debugPlaintext === true,
|
|
19340
|
+
...this.objectStore !== void 0 ? { objectStore: this.objectStore } : {},
|
|
19341
|
+
...this.blobFields !== void 0 ? { blobFields: this.blobFields } : {}
|
|
19050
19342
|
});
|
|
19051
19343
|
}
|
|
19052
19344
|
/** Get all records as encrypted envelopes (for dump). */
|
|
@@ -19432,6 +19724,30 @@ var Collection = class {
|
|
|
19432
19724
|
* path encrypts the body directly under the collection DEK — byte-identical
|
|
19433
19725
|
* to pre-CEK behaviour, so non-adopting collections pay nothing.
|
|
19434
19726
|
*/
|
|
19727
|
+
/**
|
|
19728
|
+
* Build a debug-plaintext envelope: the record's own fields inlined as
|
|
19729
|
+
* top-level keys beside the reserved `_`-metadata, with `_debug: 1` and an
|
|
19730
|
+
* empty `_data`. Lets native store tooling read the record without
|
|
19731
|
+
* unwrapping. Only reached for user collections under `debugPlaintext`
|
|
19732
|
+
* (see {@link encryptRecord}). Rejects `_`-prefixed record fields, which
|
|
19733
|
+
* would collide with the reserved metadata namespace.
|
|
19734
|
+
*/
|
|
19735
|
+
buildDebugEnvelope(record, version) {
|
|
19736
|
+
const rec = record;
|
|
19737
|
+
for (const key of Object.keys(rec)) {
|
|
19738
|
+
if (key.startsWith("_")) throw new DebugReservedFieldError(this.name, key);
|
|
19739
|
+
}
|
|
19740
|
+
return {
|
|
19741
|
+
_noydb: NOYDB_FORMAT_VERSION,
|
|
19742
|
+
_v: version,
|
|
19743
|
+
_ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19744
|
+
_iv: "",
|
|
19745
|
+
_data: "",
|
|
19746
|
+
_by: this.keyring.userId,
|
|
19747
|
+
_debug: NOYDB_FORMAT_VERSION,
|
|
19748
|
+
...rec
|
|
19749
|
+
};
|
|
19750
|
+
}
|
|
19435
19751
|
async encryptJsonString(json, version, cek) {
|
|
19436
19752
|
const by = this.keyring.userId;
|
|
19437
19753
|
if (!this.encrypted) {
|
|
@@ -19469,6 +19785,9 @@ var Collection = class {
|
|
|
19469
19785
|
};
|
|
19470
19786
|
}
|
|
19471
19787
|
async encryptRecord(record, version, cek) {
|
|
19788
|
+
if (!this.encrypted && this.keyring.debugPlaintext === true && !this.name.startsWith("_")) {
|
|
19789
|
+
return this.buildDebugEnvelope(record, version);
|
|
19790
|
+
}
|
|
19472
19791
|
const base = await this.encryptJsonString(JSON.stringify(record), version, cek);
|
|
19473
19792
|
if (!this.deterministicFields || !this.encrypted) return base;
|
|
19474
19793
|
const dek = await this.getDEK(this.name);
|
|
@@ -19809,7 +20128,16 @@ var Collection = class {
|
|
|
19809
20128
|
*/
|
|
19810
20129
|
async decryptJsonString(envelope, id) {
|
|
19811
20130
|
if (isTombstone(envelope, this.encrypted)) return null;
|
|
19812
|
-
if (!this.encrypted)
|
|
20131
|
+
if (!this.encrypted) {
|
|
20132
|
+
if (envelope._debug !== void 0) {
|
|
20133
|
+
const rec = {};
|
|
20134
|
+
for (const [key, value] of Object.entries(envelope)) {
|
|
20135
|
+
if (!key.startsWith("_")) rec[key] = value;
|
|
20136
|
+
}
|
|
20137
|
+
return JSON.stringify(rec);
|
|
20138
|
+
}
|
|
20139
|
+
return envelope._data;
|
|
20140
|
+
}
|
|
19813
20141
|
const dek = await this.getDEK(this.name);
|
|
19814
20142
|
if (envelope._cek !== void 0) {
|
|
19815
20143
|
const cached = id !== void 0 ? this.cekCache?.get(id) : void 0;
|
|
@@ -21335,6 +21663,7 @@ var Vault = class {
|
|
|
21335
21663
|
* call throws with a pointer at `@noy-db/hub/blobs`.
|
|
21336
21664
|
*/
|
|
21337
21665
|
blobStrategy;
|
|
21666
|
+
objectStore;
|
|
21338
21667
|
/** Cold-storage archival strategy (the archive target store). */
|
|
21339
21668
|
archiveStrategy;
|
|
21340
21669
|
/** Per-collection record archival policies. Indexed by collection name. */
|
|
@@ -21580,6 +21909,7 @@ var Vault = class {
|
|
|
21580
21909
|
this.onRegisterConflictResolver = opts.onRegisterConflictResolver;
|
|
21581
21910
|
this.syncAdapter = opts.syncAdapter;
|
|
21582
21911
|
this.blobStrategy = opts.blobStrategy;
|
|
21912
|
+
this.objectStore = opts.objectStore;
|
|
21583
21913
|
this.archiveStrategy = opts.archiveStrategy;
|
|
21584
21914
|
this.indexStrategy = opts.indexStrategy;
|
|
21585
21915
|
this.aggregateStrategy = opts.aggregateStrategy;
|
|
@@ -21763,6 +22093,8 @@ var Vault = class {
|
|
|
21763
22093
|
// collection. `undefined` is intentionally preserved so the
|
|
21764
22094
|
// Collection constructor uses its NO_BLOBS default.
|
|
21765
22095
|
...this.blobStrategy !== void 0 ? { blobStrategy: this.blobStrategy } : {},
|
|
22096
|
+
...this.objectStore !== void 0 ? { objectStore: this.objectStore } : {},
|
|
22097
|
+
...options?.blobFields !== void 0 ? { blobFields: options.blobFields } : {},
|
|
21766
22098
|
...this.indexStrategy !== void 0 ? { indexStrategy: this.indexStrategy } : {},
|
|
21767
22099
|
...this.aggregateStrategy !== void 0 ? { aggregateStrategy: this.aggregateStrategy } : {},
|
|
21768
22100
|
...this.crdtStrategy !== void 0 ? { crdtStrategy: this.crdtStrategy } : {},
|
|
@@ -25528,7 +25860,7 @@ var ROLE_RANK = {
|
|
|
25528
25860
|
admin: 4,
|
|
25529
25861
|
owner: 5
|
|
25530
25862
|
};
|
|
25531
|
-
function createPlaintextKeyring(userId) {
|
|
25863
|
+
function createPlaintextKeyring(userId, debugPlaintext = false) {
|
|
25532
25864
|
return {
|
|
25533
25865
|
userId,
|
|
25534
25866
|
displayName: userId,
|
|
@@ -25537,7 +25869,8 @@ function createPlaintextKeyring(userId) {
|
|
|
25537
25869
|
deks: /* @__PURE__ */ new Map(),
|
|
25538
25870
|
kek: null,
|
|
25539
25871
|
salt: new Uint8Array(0),
|
|
25540
|
-
authenticators: []
|
|
25872
|
+
authenticators: [],
|
|
25873
|
+
...debugPlaintext ? { debugPlaintext } : {}
|
|
25541
25874
|
};
|
|
25542
25875
|
}
|
|
25543
25876
|
var Noydb = class {
|
|
@@ -25614,6 +25947,14 @@ var Noydb = class {
|
|
|
25614
25947
|
_translatorAuditLog = [];
|
|
25615
25948
|
constructor(options) {
|
|
25616
25949
|
this.options = options;
|
|
25950
|
+
if (options.debugPlaintext === true && options.encrypt !== false) {
|
|
25951
|
+
throw new DebugPlaintextError();
|
|
25952
|
+
}
|
|
25953
|
+
if (options.debugPlaintext === true) {
|
|
25954
|
+
console.warn(
|
|
25955
|
+
"[noydb] debugPlaintext is ON \u2014 records are stored UNENCRYPTED and laid out for native store inspection. NEVER use this for production or client data."
|
|
25956
|
+
);
|
|
25957
|
+
}
|
|
25617
25958
|
this.txStrategy = options.txStrategy ?? NO_TX;
|
|
25618
25959
|
this.forgetStrategy = options.forgetStrategy ?? NO_FORGET;
|
|
25619
25960
|
this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
|
|
@@ -25889,6 +26230,7 @@ var Noydb = class {
|
|
|
25889
26230
|
syncAdapter: targets.length > 0 ? targets[0].store : void 0,
|
|
25890
26231
|
historyConfig: this.options.history,
|
|
25891
26232
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
26233
|
+
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
25892
26234
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
25893
26235
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
25894
26236
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
@@ -25935,7 +26277,7 @@ var Noydb = class {
|
|
|
25935
26277
|
const cached = this.vaultCache.get(name);
|
|
25936
26278
|
if (cached) return cached;
|
|
25937
26279
|
if (this.options.encrypt === false) {
|
|
25938
|
-
const keyring2 = createPlaintextKeyring(this.options.user);
|
|
26280
|
+
const keyring2 = createPlaintextKeyring(this.options.user, this.options.debugPlaintext === true);
|
|
25939
26281
|
const comp2 = new Vault({
|
|
25940
26282
|
adapter: this.options.store,
|
|
25941
26283
|
name,
|
|
@@ -25945,6 +26287,7 @@ var Noydb = class {
|
|
|
25945
26287
|
emitter: this.emitter,
|
|
25946
26288
|
historyConfig: this.options.history,
|
|
25947
26289
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
26290
|
+
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
25948
26291
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
25949
26292
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
25950
26293
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
@@ -25976,6 +26319,7 @@ var Noydb = class {
|
|
|
25976
26319
|
encrypted: true,
|
|
25977
26320
|
historyConfig: this.options.history,
|
|
25978
26321
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
26322
|
+
...this.options.objectStore !== void 0 ? { objectStore: this.options.objectStore } : {},
|
|
25979
26323
|
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
25980
26324
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
25981
26325
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
@@ -27676,7 +28020,7 @@ var Noydb = class {
|
|
|
27676
28020
|
*/
|
|
27677
28021
|
async getKeyringInternal(vault, opts = { create: true }) {
|
|
27678
28022
|
if (this.options.encrypt === false) {
|
|
27679
|
-
return createPlaintextKeyring(this.options.user);
|
|
28023
|
+
return createPlaintextKeyring(this.options.user, this.options.debugPlaintext === true);
|
|
27680
28024
|
}
|
|
27681
28025
|
const cached = this.keyringCache.get(vault);
|
|
27682
28026
|
if (cached) return cached;
|
|
@@ -29757,6 +30101,8 @@ function shortJSON(value) {
|
|
|
29757
30101
|
DIRECTORY_RECORD_ID,
|
|
29758
30102
|
DanglingReferenceError,
|
|
29759
30103
|
DataResidencyError,
|
|
30104
|
+
DebugPlaintextError,
|
|
30105
|
+
DebugReservedFieldError,
|
|
29760
30106
|
DecryptionError,
|
|
29761
30107
|
DelegationTargetMissingError,
|
|
29762
30108
|
DerivationCapExceededError,
|
|
@@ -29985,6 +30331,7 @@ function shortJSON(value) {
|
|
|
29985
30331
|
hashEntry,
|
|
29986
30332
|
i18nText,
|
|
29987
30333
|
immutableGuard,
|
|
30334
|
+
importExternalObjects,
|
|
29988
30335
|
inferScripts,
|
|
29989
30336
|
isDevUnlockActive,
|
|
29990
30337
|
isDictCollectionName,
|
|
@@ -30022,6 +30369,7 @@ function shortJSON(value) {
|
|
|
30022
30369
|
lockSchema,
|
|
30023
30370
|
magicLinkGrantRecordId,
|
|
30024
30371
|
max,
|
|
30372
|
+
memoryObjectProjection,
|
|
30025
30373
|
mergeCrdtStates,
|
|
30026
30374
|
mergePolicy,
|
|
30027
30375
|
min,
|
|
@@ -30046,6 +30394,7 @@ function shortJSON(value) {
|
|
|
30046
30394
|
readNoydbBundleHeader,
|
|
30047
30395
|
readNoydbBundlePublicEnvelope,
|
|
30048
30396
|
readPath,
|
|
30397
|
+
readPlaintextRecord,
|
|
30049
30398
|
readPublicEnvelope,
|
|
30050
30399
|
readUserVisibility,
|
|
30051
30400
|
recoverUser,
|