@noy-db/hub 0.2.0-pre.11 → 0.2.0-pre.13
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 +126 -0
- package/dist/aggregate/index.cjs +289 -12
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +7 -7
- package/dist/aggregate/index.js.map +1 -1
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +3 -3
- package/dist/attestation/index.d.ts +3 -3
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs +28 -0
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +4 -4
- package/dist/blobs/index.d.ts +4 -4
- package/dist/blobs/index.js +5 -5
- package/dist/bundle/index.cjs +2024 -69
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +5 -5
- package/dist/bundle/index.d.ts +5 -5
- package/dist/bundle/index.js +9 -9
- package/dist/{chunk-LSTBFLL2.js → chunk-3OUCWHV6.js} +2 -2
- package/dist/{chunk-7CEGU63S.js → chunk-3XZRRBFW.js} +2 -2
- package/dist/{chunk-RC6SU5NO.js → chunk-4VCQH32J.js} +2 -2
- package/dist/{chunk-ZROPXHJY.js → chunk-4YDZ7JPZ.js} +2 -2
- package/dist/{chunk-IMYKDWB4.js → chunk-5NISHSBO.js} +2 -2
- package/dist/{chunk-ZBBW7YQN.js → chunk-7TEI2K2A.js} +5 -5
- package/dist/{chunk-6T2UDBKG.js → chunk-AYNF7PVX.js} +2 -2
- package/dist/{chunk-QCXNMCHN.js → chunk-C3WRKABE.js} +4 -4
- package/dist/{chunk-GAUEWM7D.js → chunk-CWFQTAD4.js} +4 -4
- package/dist/{chunk-QSOYKKMD.js → chunk-D5Y3HIC6.js} +2 -2
- package/dist/{chunk-R233SLY3.js → chunk-E3DIBDKA.js} +2 -2
- package/dist/chunk-FNVFT4HZ.js +64 -0
- package/dist/chunk-FNVFT4HZ.js.map +1 -0
- package/dist/{chunk-SLV4LAKX.js → chunk-GC4V7RU7.js} +1 -1
- package/dist/chunk-GC4V7RU7.js.map +1 -0
- package/dist/{chunk-5OEJ6GOT.js → chunk-GL3Z7LH7.js} +2 -2
- package/dist/{chunk-YW5DBAPG.js → chunk-GZJ5JBED.js} +4 -4
- package/dist/{chunk-LJXYPGRH.js → chunk-HHZ77DHM.js} +3 -3
- package/dist/{chunk-6MFH4BMK.js → chunk-HQXOEWLZ.js} +4 -4
- package/dist/{chunk-RYIL3PI2.js → chunk-ILWQGTNH.js} +2 -2
- package/dist/{chunk-3DGHRDCX.js → chunk-J67BP5EP.js} +3 -3
- package/dist/{chunk-PVUUIWHY.js → chunk-JPOQMXGT.js} +10 -3
- package/dist/chunk-JPOQMXGT.js.map +1 -0
- package/dist/{chunk-RRNA5GKT.js → chunk-JWFNOD2T.js} +2 -2
- package/dist/{chunk-BDV7INMP.js → chunk-KHQ3N5AB.js} +4 -4
- package/dist/{chunk-JQ4NEJJ6.js → chunk-KJF7EPUE.js} +3 -3
- package/dist/{chunk-FO3UEG4S.js → chunk-KKB42D3Q.js} +2 -2
- package/dist/{chunk-26NK23DZ.js → chunk-M6KXHRIA.js} +3 -3
- package/dist/{chunk-DAP2XL7Q.js → chunk-NIUXQDWD.js} +2 -2
- package/dist/{chunk-6YLPHBKR.js → chunk-NJMKHRQI.js} +145 -11
- package/dist/chunk-NJMKHRQI.js.map +1 -0
- package/dist/{chunk-O6EJ6WTI.js → chunk-NKGY3C53.js} +87 -2
- package/dist/chunk-NKGY3C53.js.map +1 -0
- package/dist/{chunk-CXJG63MA.js → chunk-NP6EZT44.js} +20 -6
- package/dist/chunk-NP6EZT44.js.map +1 -0
- package/dist/{chunk-Y26YV5R3.js → chunk-O2JW656W.js} +3 -3
- package/dist/{chunk-MPOLUAMI.js → chunk-P5MW7BG2.js} +665 -60
- package/dist/chunk-P5MW7BG2.js.map +1 -0
- package/dist/{chunk-TGALXXLV.js → chunk-PW26DAXS.js} +3 -3
- package/dist/{chunk-V2PZC6AW.js → chunk-QAWCVWCX.js} +5 -5
- package/dist/{chunk-CH22FZHT.js → chunk-QFYVGJLI.js} +2 -2
- package/dist/{chunk-YM7LFCG7.js → chunk-QIVFGU2M.js} +3 -3
- package/dist/{chunk-CXFOITNS.js → chunk-SJ24GHID.js} +2 -2
- package/dist/{chunk-EBVBE7UK.js → chunk-SOU42FGB.js} +5 -5
- package/dist/{chunk-YVZRTCGG.js → chunk-SYSKC237.js} +6 -6
- package/dist/{chunk-77DWLQRY.js → chunk-TDECYU4Y.js} +31 -3
- package/dist/chunk-TDECYU4Y.js.map +1 -0
- package/dist/{chunk-73YLDCNF.js → chunk-TEQGXA7L.js} +5 -5
- package/dist/{chunk-PC6ZEDRL.js → chunk-UNQEWORI.js} +2 -2
- package/dist/{chunk-PC3ZZBTO.js → chunk-VAK6NQAK.js} +5 -5
- package/dist/{chunk-GKI4SDP7.js → chunk-WQKZIQIL.js} +4 -4
- package/dist/chunk-YWBHS25M.js +783 -0
- package/dist/chunk-YWBHS25M.js.map +1 -0
- package/dist/chunk-ZC7J6ZYV.js +7 -0
- package/dist/chunk-ZC7J6ZYV.js.map +1 -0
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +4 -4
- package/dist/consent/index.d.ts +4 -4
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-2CRLG4F4.js → crypto-YXH6SAOW.js} +3 -3
- package/dist/{delegation-ZTRT2PRV.js → delegation-K5ERUH6A.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +5 -5
- package/dist/derivations/index.d.ts +5 -5
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-BH6y3Hx0.d.ts → dev-unlock-BW0GNBEV.d.ts} +1 -1
- package/dist/{dev-unlock-H1Xwxc3U.d.cts → dev-unlock-a7SOtaV0.d.cts} +1 -1
- package/dist/executor-AVJ7UEWA.js +8 -0
- package/dist/executor-IQO3KGXQ.js +11 -0
- package/dist/executor-VT7TKGE4.js +8 -0
- package/dist/{fanout-sidecar-F3ZRFU4H.js → fanout-sidecar-N6OJX6QR.js} +2 -2
- package/dist/guards/index.cjs +53 -1
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +12 -6
- package/dist/guards/index.d.ts +12 -6
- package/dist/guards/index.js +5 -3
- package/dist/{hash-_sDFvtmX.d.cts → hash-B0cLQcq_.d.cts} +1 -1
- package/dist/{hash-D89JdDbj.d.ts → hash-uMNIAAW8.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +5 -5
- package/dist/history/index.d.ts +5 -5
- package/dist/history/index.js +5 -5
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +4 -4
- package/dist/i18n/index.d.ts +4 -4
- package/dist/i18n/index.js +6 -6
- package/dist/immutable-guard-B0h-ipLz.d.ts +67 -0
- package/dist/immutable-guard-BZIcYhYX.d.cts +67 -0
- package/dist/index-CUVOMtgg.d.cts +1216 -0
- package/dist/index-Cqzp4tt9.d.ts +1216 -0
- package/dist/index.cjs +2200 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -13
- package/dist/index.d.ts +55 -13
- package/dist/index.js +95 -44
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +2 -2
- package/dist/issue-ZH27C23Y.js +12 -0
- package/dist/{ledger-NYCGJX2D.js → ledger-64TTQMRS.js} +5 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +5 -6
- package/dist/materialized-views/index.d.ts +5 -6
- package/dist/materialized-views/index.js +6 -6
- package/dist/noydb-O76SKBST.js +35 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +5 -5
- package/dist/overlay-views/index.d.ts +5 -5
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +4 -4
- package/dist/periods/index.d.ts +4 -4
- package/dist/periods/index.js +5 -5
- package/dist/{public-envelope-QOXZEHKH.js → public-envelope-MHG6YVXW.js} +4 -4
- package/dist/query/index.cjs +382 -17
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +4 -4
- package/dist/registry-2PKBQDCH.js +8 -0
- package/dist/registry-4VXFKCBJ.js +8 -0
- package/dist/{registry-ST2VNFZC.js → registry-PV4G3OPA.js} +3 -3
- package/dist/{revoke-RT7QYB4G.js → revoke-5BOLVJ3N.js} +6 -6
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +5 -5
- package/dist/session/index.d.ts +5 -5
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +4 -4
- package/dist/shadow/index.d.ts +4 -4
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-QNU66JF5.js → signer-GRIYBA22.js} +5 -5
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +4 -4
- package/dist/snapshots/index.d.ts +4 -4
- package/dist/snapshots/index.js +4 -4
- package/dist/{stale-VKXSXJF4.js → stale-LZYMMDDS.js} +2 -2
- package/dist/state-vault-QFJWU23A.js +147 -0
- package/dist/state-vault-QFJWU23A.js.map +1 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +4 -4
- package/dist/store/index.d.ts +4 -4
- package/dist/store/index.js +2 -2
- package/dist/strategy-CrS7PnbE.d.cts +2048 -0
- package/dist/strategy-CrS7PnbE.d.ts +2048 -0
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +3 -3
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +4 -4
- package/dist/team/index.d.ts +4 -4
- package/dist/team/index.js +8 -8
- package/dist/tx/index.cjs +8 -1
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +4 -4
- package/dist/tx/index.d.ts +4 -4
- package/dist/tx/index.js +3 -3
- package/dist/{types-DiSXn3a4.d.cts → types-CDwSSXiI.d.cts} +709 -6
- package/dist/{types-CD8mc8zR.d.ts → types-pax34sec.d.ts} +709 -6
- package/dist/{ulid-DQ1hcJvZ.d.cts → ulid-7bCSgIgb.d.cts} +1 -1
- package/dist/{ulid-8p83wbR4.d.ts → ulid-C_t4hL3d.d.ts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/vault-group-UO4YUZOG.js +493 -0
- package/dist/vault-group-UO4YUZOG.js.map +1 -0
- package/dist/{with-derivation-DWMTpgEH.d.ts → with-derivation-BjdOxUBn.d.ts} +1 -1
- package/dist/{with-derivation-CVT7-dUt.d.cts → with-derivation-D8wFlb6V.d.cts} +1 -1
- package/dist/{with-materialized-view-BTTU3BNK.d.cts → with-materialized-view-5QMF1rS_.d.cts} +1 -1
- package/dist/{with-materialized-view-X0CoL8-L.d.ts → with-materialized-view-DJb-HO65.d.ts} +1 -1
- package/dist/{with-overlayed-view-DQjO_DSG.d.ts → with-overlayed-view-CkqTefbz.d.ts} +1 -1
- package/dist/{with-overlayed-view-DcacRRsS.d.cts → with-overlayed-view-DDNflPvC.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-2LPPNWF6.js +0 -340
- package/dist/chunk-2LPPNWF6.js.map +0 -1
- package/dist/chunk-6YLPHBKR.js.map +0 -1
- package/dist/chunk-77DWLQRY.js.map +0 -1
- package/dist/chunk-C3WE6UJY.js +0 -19
- package/dist/chunk-C3WE6UJY.js.map +0 -1
- package/dist/chunk-CXJG63MA.js.map +0 -1
- package/dist/chunk-MPOLUAMI.js.map +0 -1
- package/dist/chunk-O6EJ6WTI.js.map +0 -1
- package/dist/chunk-PVUUIWHY.js.map +0 -1
- package/dist/chunk-SLV4LAKX.js.map +0 -1
- package/dist/executor-S76VN45G.js +0 -8
- package/dist/executor-UCXLIGLW.js +0 -11
- package/dist/executor-ZCNZJMGR.js +0 -8
- package/dist/index-B8bjExET.d.cts +0 -2434
- package/dist/index-DfUbNad8.d.ts +0 -2434
- package/dist/issue-IVTVSKWW.js +0 -12
- package/dist/noydb-SH4RLE47.js +0 -34
- package/dist/registry-UFIK7CSR.js +0 -8
- package/dist/registry-ZGYYSM5I.js +0 -8
- package/dist/strategy-CT2LCKAX.d.cts +0 -613
- package/dist/strategy-CT2LCKAX.d.ts +0 -613
- package/dist/with-guard-BRvt53da.d.ts +0 -18
- package/dist/with-guard-Dx2zZnTA.d.cts +0 -18
- /package/dist/{chunk-LSTBFLL2.js.map → chunk-3OUCWHV6.js.map} +0 -0
- /package/dist/{chunk-7CEGU63S.js.map → chunk-3XZRRBFW.js.map} +0 -0
- /package/dist/{chunk-RC6SU5NO.js.map → chunk-4VCQH32J.js.map} +0 -0
- /package/dist/{chunk-ZROPXHJY.js.map → chunk-4YDZ7JPZ.js.map} +0 -0
- /package/dist/{chunk-IMYKDWB4.js.map → chunk-5NISHSBO.js.map} +0 -0
- /package/dist/{chunk-ZBBW7YQN.js.map → chunk-7TEI2K2A.js.map} +0 -0
- /package/dist/{chunk-6T2UDBKG.js.map → chunk-AYNF7PVX.js.map} +0 -0
- /package/dist/{chunk-QCXNMCHN.js.map → chunk-C3WRKABE.js.map} +0 -0
- /package/dist/{chunk-GAUEWM7D.js.map → chunk-CWFQTAD4.js.map} +0 -0
- /package/dist/{chunk-QSOYKKMD.js.map → chunk-D5Y3HIC6.js.map} +0 -0
- /package/dist/{chunk-R233SLY3.js.map → chunk-E3DIBDKA.js.map} +0 -0
- /package/dist/{chunk-5OEJ6GOT.js.map → chunk-GL3Z7LH7.js.map} +0 -0
- /package/dist/{chunk-YW5DBAPG.js.map → chunk-GZJ5JBED.js.map} +0 -0
- /package/dist/{chunk-LJXYPGRH.js.map → chunk-HHZ77DHM.js.map} +0 -0
- /package/dist/{chunk-6MFH4BMK.js.map → chunk-HQXOEWLZ.js.map} +0 -0
- /package/dist/{chunk-RYIL3PI2.js.map → chunk-ILWQGTNH.js.map} +0 -0
- /package/dist/{chunk-3DGHRDCX.js.map → chunk-J67BP5EP.js.map} +0 -0
- /package/dist/{chunk-RRNA5GKT.js.map → chunk-JWFNOD2T.js.map} +0 -0
- /package/dist/{chunk-BDV7INMP.js.map → chunk-KHQ3N5AB.js.map} +0 -0
- /package/dist/{chunk-JQ4NEJJ6.js.map → chunk-KJF7EPUE.js.map} +0 -0
- /package/dist/{chunk-FO3UEG4S.js.map → chunk-KKB42D3Q.js.map} +0 -0
- /package/dist/{chunk-26NK23DZ.js.map → chunk-M6KXHRIA.js.map} +0 -0
- /package/dist/{chunk-DAP2XL7Q.js.map → chunk-NIUXQDWD.js.map} +0 -0
- /package/dist/{chunk-Y26YV5R3.js.map → chunk-O2JW656W.js.map} +0 -0
- /package/dist/{chunk-TGALXXLV.js.map → chunk-PW26DAXS.js.map} +0 -0
- /package/dist/{chunk-V2PZC6AW.js.map → chunk-QAWCVWCX.js.map} +0 -0
- /package/dist/{chunk-CH22FZHT.js.map → chunk-QFYVGJLI.js.map} +0 -0
- /package/dist/{chunk-YM7LFCG7.js.map → chunk-QIVFGU2M.js.map} +0 -0
- /package/dist/{chunk-CXFOITNS.js.map → chunk-SJ24GHID.js.map} +0 -0
- /package/dist/{chunk-EBVBE7UK.js.map → chunk-SOU42FGB.js.map} +0 -0
- /package/dist/{chunk-YVZRTCGG.js.map → chunk-SYSKC237.js.map} +0 -0
- /package/dist/{chunk-73YLDCNF.js.map → chunk-TEQGXA7L.js.map} +0 -0
- /package/dist/{chunk-PC6ZEDRL.js.map → chunk-UNQEWORI.js.map} +0 -0
- /package/dist/{chunk-PC3ZZBTO.js.map → chunk-VAK6NQAK.js.map} +0 -0
- /package/dist/{chunk-GKI4SDP7.js.map → chunk-WQKZIQIL.js.map} +0 -0
- /package/dist/{crypto-2CRLG4F4.js.map → crypto-YXH6SAOW.js.map} +0 -0
- /package/dist/{delegation-ZTRT2PRV.js.map → delegation-K5ERUH6A.js.map} +0 -0
- /package/dist/{executor-S76VN45G.js.map → executor-AVJ7UEWA.js.map} +0 -0
- /package/dist/{executor-UCXLIGLW.js.map → executor-IQO3KGXQ.js.map} +0 -0
- /package/dist/{executor-ZCNZJMGR.js.map → executor-VT7TKGE4.js.map} +0 -0
- /package/dist/{fanout-sidecar-F3ZRFU4H.js.map → fanout-sidecar-N6OJX6QR.js.map} +0 -0
- /package/dist/{issue-IVTVSKWW.js.map → issue-ZH27C23Y.js.map} +0 -0
- /package/dist/{ledger-NYCGJX2D.js.map → ledger-64TTQMRS.js.map} +0 -0
- /package/dist/{noydb-SH4RLE47.js.map → noydb-O76SKBST.js.map} +0 -0
- /package/dist/{public-envelope-QOXZEHKH.js.map → public-envelope-MHG6YVXW.js.map} +0 -0
- /package/dist/{registry-ST2VNFZC.js.map → registry-2PKBQDCH.js.map} +0 -0
- /package/dist/{registry-UFIK7CSR.js.map → registry-4VXFKCBJ.js.map} +0 -0
- /package/dist/{registry-ZGYYSM5I.js.map → registry-PV4G3OPA.js.map} +0 -0
- /package/dist/{revoke-RT7QYB4G.js.map → revoke-5BOLVJ3N.js.map} +0 -0
- /package/dist/{signer-QNU66JF5.js.map → signer-GRIYBA22.js.map} +0 -0
- /package/dist/{stale-VKXSXJF4.js.map → stale-LZYMMDDS.js.map} +0 -0
|
@@ -1,40 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
STATE_VAULT_NAME
|
|
3
|
+
} from "./chunk-ZC7J6ZYV.js";
|
|
1
4
|
import {
|
|
2
5
|
resolveSchema
|
|
3
6
|
} from "./chunk-EMIGCR7X.js";
|
|
4
7
|
import {
|
|
5
8
|
TxContext,
|
|
6
9
|
revertExecuted
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-M6KXHRIA.js";
|
|
8
11
|
import {
|
|
9
12
|
OverlayedCollection
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3XZRRBFW.js";
|
|
11
14
|
import {
|
|
12
15
|
LazyQuery,
|
|
13
16
|
decodeIdxId,
|
|
14
17
|
encodeIdxId
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-D5Y3HIC6.js";
|
|
16
19
|
import {
|
|
17
20
|
SCHEMAS_COLLECTION,
|
|
18
21
|
loadPersistedSchema,
|
|
19
22
|
resolveManagedSecret,
|
|
20
23
|
savePersistedSchema,
|
|
21
24
|
saveSealedPassphrase
|
|
22
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-HHZ77DHM.js";
|
|
23
26
|
import {
|
|
24
27
|
loadPublicEnvelope,
|
|
25
28
|
readPublicEnvelope,
|
|
26
29
|
savePublicEnvelope,
|
|
27
30
|
validatePublicEnvelopeInput
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KJF7EPUE.js";
|
|
29
32
|
import {
|
|
30
33
|
PERIODS_COLLECTION
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-J67BP5EP.js";
|
|
32
35
|
import {
|
|
33
36
|
getAtPath,
|
|
34
37
|
isDictCollectionName,
|
|
35
38
|
resolvePolicy,
|
|
36
39
|
setAtPathInPlace
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-7TEI2K2A.js";
|
|
38
41
|
import {
|
|
39
42
|
ManagedRecoveryNotEnrolledError,
|
|
40
43
|
PolicyDeniedError,
|
|
@@ -56,11 +59,11 @@ import {
|
|
|
56
59
|
saveShamirRecoveryEntries,
|
|
57
60
|
updateAuthenticator,
|
|
58
61
|
writeMagicLinkGrant
|
|
59
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-SYSKC237.js";
|
|
60
63
|
import {
|
|
61
64
|
assertTierAccess,
|
|
62
65
|
dekKey
|
|
63
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-SJ24GHID.js";
|
|
64
67
|
import {
|
|
65
68
|
USER_ENVELOPE_COLLECTION,
|
|
66
69
|
assertKeyringOpenAllowed,
|
|
@@ -85,7 +88,7 @@ import {
|
|
|
85
88
|
rotateKeys,
|
|
86
89
|
saveUserEnvelope,
|
|
87
90
|
updateKeyringIdentity
|
|
88
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-C3WRKABE.js";
|
|
89
92
|
import {
|
|
90
93
|
INDEXED_STORE_POLICY
|
|
91
94
|
} from "./chunk-2QR2PQTT.js";
|
|
@@ -95,18 +98,20 @@ import {
|
|
|
95
98
|
import {
|
|
96
99
|
LEDGER_COLLECTION,
|
|
97
100
|
LEDGER_DELTAS_COLLECTION
|
|
98
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-HQXOEWLZ.js";
|
|
99
102
|
import {
|
|
100
103
|
sha256Hex as sha256Hex2
|
|
101
104
|
} from "./chunk-Z6FNBOTC.js";
|
|
102
105
|
import {
|
|
103
106
|
NO_AGGREGATE,
|
|
104
107
|
Query,
|
|
105
|
-
ScanBuilder
|
|
106
|
-
|
|
108
|
+
ScanBuilder,
|
|
109
|
+
decodeMoneyFields,
|
|
110
|
+
quantizeMoneyFields
|
|
111
|
+
} from "./chunk-NJMKHRQI.js";
|
|
107
112
|
import {
|
|
108
113
|
canonicalGroupKey
|
|
109
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-YWBHS25M.js";
|
|
110
115
|
import {
|
|
111
116
|
readPath
|
|
112
117
|
} from "./chunk-TV3YZ35S.js";
|
|
@@ -114,17 +119,17 @@ import {
|
|
|
114
119
|
EXPORT_AUDIT_COLLECTION,
|
|
115
120
|
createExportBlobsHandle,
|
|
116
121
|
runCompaction
|
|
117
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-TDECYU4Y.js";
|
|
118
123
|
import {
|
|
119
124
|
NOYDB_BACKUP_VERSION,
|
|
120
125
|
NOYDB_FORMAT_VERSION
|
|
121
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-GC4V7RU7.js";
|
|
122
127
|
import {
|
|
123
128
|
decrypt,
|
|
124
129
|
encrypt,
|
|
125
130
|
encryptDeterministic,
|
|
126
131
|
sha256Hex
|
|
127
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-E3DIBDKA.js";
|
|
128
133
|
import {
|
|
129
134
|
AlreadyElevatedError,
|
|
130
135
|
AttestationError,
|
|
@@ -141,20 +146,25 @@ import {
|
|
|
141
146
|
MigrationRequiredError,
|
|
142
147
|
NoAccessError,
|
|
143
148
|
NoydbError,
|
|
149
|
+
NumberingUncertaintyError,
|
|
144
150
|
PermissionDeniedError,
|
|
145
151
|
QuiesceTimeoutError,
|
|
146
152
|
ReadOnlyError,
|
|
147
153
|
ReservedCollectionNameError,
|
|
154
|
+
ReservedVaultNameError,
|
|
148
155
|
SchemaFenceError,
|
|
149
156
|
SchemaValidationError,
|
|
157
|
+
SequenceContentionError,
|
|
158
|
+
SequenceOfflineError,
|
|
150
159
|
StoreCapabilityError,
|
|
151
160
|
TierDemoteDeniedError,
|
|
152
161
|
TierNotGrantedError,
|
|
153
162
|
TranslatorNotConfiguredError,
|
|
154
163
|
UniqueConstraintError,
|
|
155
164
|
UnsupportedIndexOptionError,
|
|
156
|
-
ValidationError
|
|
157
|
-
|
|
165
|
+
ValidationError,
|
|
166
|
+
VaultTemplateNotFoundError
|
|
167
|
+
} from "./chunk-NKGY3C53.js";
|
|
158
168
|
|
|
159
169
|
// src/policy/storage.ts
|
|
160
170
|
var META_COLLECTION = "_meta";
|
|
@@ -329,6 +339,34 @@ var NO_CRDT = {
|
|
|
329
339
|
}
|
|
330
340
|
};
|
|
331
341
|
|
|
342
|
+
// src/computed/index.ts
|
|
343
|
+
var ComputedFieldError = class extends NoydbError {
|
|
344
|
+
constructor(field, id, cause) {
|
|
345
|
+
super(
|
|
346
|
+
"COMPUTED_FIELD",
|
|
347
|
+
`computed field "${field}" threw for record "${id}": ` + (cause instanceof Error ? cause.message : String(cause))
|
|
348
|
+
);
|
|
349
|
+
this.field = field;
|
|
350
|
+
this.id = id;
|
|
351
|
+
this.cause = cause;
|
|
352
|
+
this.name = "ComputedFieldError";
|
|
353
|
+
}
|
|
354
|
+
field;
|
|
355
|
+
id;
|
|
356
|
+
cause;
|
|
357
|
+
};
|
|
358
|
+
function evalComputedFields(record, computed, id) {
|
|
359
|
+
const out = { ...record };
|
|
360
|
+
for (const [field, fn] of Object.entries(computed)) {
|
|
361
|
+
try {
|
|
362
|
+
out[field] = fn(out);
|
|
363
|
+
} catch (cause) {
|
|
364
|
+
throw new ComputedFieldError(field, id, cause);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return out;
|
|
368
|
+
}
|
|
369
|
+
|
|
332
370
|
// src/i18n/strategy.ts
|
|
333
371
|
function notEnabled(op) {
|
|
334
372
|
return new Error(
|
|
@@ -769,7 +807,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
|
769
807
|
}
|
|
770
808
|
const sourceWithId = { ...source, id };
|
|
771
809
|
if (DerivationExecutor === null) {
|
|
772
|
-
({ DerivationExecutor } = await import("./executor-
|
|
810
|
+
({ DerivationExecutor } = await import("./executor-AVJ7UEWA.js"));
|
|
773
811
|
}
|
|
774
812
|
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
775
813
|
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
@@ -962,6 +1000,18 @@ var Collection = class {
|
|
|
962
1000
|
* fields when a locale is requested.
|
|
963
1001
|
*/
|
|
964
1002
|
dictKeyFields;
|
|
1003
|
+
/**
|
|
1004
|
+
* Money field descriptors keyed by field path. Declared via the
|
|
1005
|
+
* `moneyFields` collection option: `put()` quantizes to a scaled-int
|
|
1006
|
+
* string, `get()`/`list()` decode back. Mutable so {@link _applyMoneyFields}
|
|
1007
|
+
* can attach descriptors to a collection MV-analysis pre-created.
|
|
1008
|
+
*/
|
|
1009
|
+
moneyFields;
|
|
1010
|
+
/**
|
|
1011
|
+
* Computed scalar fields, evaluated first on every `put()`. Mutable for
|
|
1012
|
+
* the same MV-pre-creation reconcile as {@link moneyFields}.
|
|
1013
|
+
*/
|
|
1014
|
+
computed;
|
|
965
1015
|
/**
|
|
966
1016
|
* Async callback provided by the Vault that resolves a dict key
|
|
967
1017
|
* to its label for a given locale. Used by the locale-read path for
|
|
@@ -1103,6 +1153,8 @@ var Collection = class {
|
|
|
1103
1153
|
this.joinResolver = opts.joinResolver;
|
|
1104
1154
|
this.i18nFields = opts.i18nFields;
|
|
1105
1155
|
this.dictKeyFields = opts.dictKeyFields;
|
|
1156
|
+
this.moneyFields = opts.moneyFields;
|
|
1157
|
+
this.computed = opts.computed;
|
|
1106
1158
|
this.dictLabelResolver = opts.dictLabelResolver;
|
|
1107
1159
|
this.i18nPutValidator = opts.i18nPutValidator;
|
|
1108
1160
|
this.autoTranslateHook = opts.autoTranslateHook;
|
|
@@ -1227,6 +1279,19 @@ var Collection = class {
|
|
|
1227
1279
|
getSchema() {
|
|
1228
1280
|
return this.schema;
|
|
1229
1281
|
}
|
|
1282
|
+
/**
|
|
1283
|
+
* @internal — attach money descriptors post-construction. MV dependency
|
|
1284
|
+
* analysis auto-creates a source collection (without options) during
|
|
1285
|
+
* `openVault`, before the user's `collection(name, { moneyFields })`
|
|
1286
|
+
* declaration; this reconciles that ordering. First-wins. Not public.
|
|
1287
|
+
*/
|
|
1288
|
+
_applyMoneyFields(moneyFields) {
|
|
1289
|
+
if (this.moneyFields === void 0) this.moneyFields = moneyFields;
|
|
1290
|
+
}
|
|
1291
|
+
/** @internal — attach computed fields post-construction. See {@link _applyMoneyFields}. */
|
|
1292
|
+
_applyComputed(computed) {
|
|
1293
|
+
if (this.computed === void 0) this.computed = computed;
|
|
1294
|
+
}
|
|
1230
1295
|
/**
|
|
1231
1296
|
* Get a single record by ID.
|
|
1232
1297
|
*
|
|
@@ -1248,7 +1313,7 @@ var Collection = class {
|
|
|
1248
1313
|
}
|
|
1249
1314
|
}
|
|
1250
1315
|
if (this.materializedViewSource !== void 0) {
|
|
1251
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
1316
|
+
const { resolveStaleMVOnRead } = await import("./stale-LZYMMDDS.js");
|
|
1252
1317
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
1253
1318
|
}
|
|
1254
1319
|
let record;
|
|
@@ -1398,7 +1463,7 @@ var Collection = class {
|
|
|
1398
1463
|
existingRecord = null;
|
|
1399
1464
|
}
|
|
1400
1465
|
}
|
|
1401
|
-
|
|
1466
|
+
const gateEvent = {
|
|
1402
1467
|
op: existingEnv ? "update" : "create",
|
|
1403
1468
|
vault: this.vault,
|
|
1404
1469
|
collection: this.name,
|
|
@@ -1408,12 +1473,20 @@ var Collection = class {
|
|
|
1408
1473
|
existingVersion: existingEnv?._v ?? 0,
|
|
1409
1474
|
existingTs: existingEnv?._ts,
|
|
1410
1475
|
userId: this.keyring.userId,
|
|
1411
|
-
role: this.keyring.role
|
|
1412
|
-
|
|
1476
|
+
role: this.keyring.role,
|
|
1477
|
+
...this.computed !== void 0 ? { computedFieldNames: new Set(Object.keys(this.computed)) } : {}
|
|
1478
|
+
};
|
|
1479
|
+
await this.subsystemBus.dispatchGate("beforePut", gateEvent);
|
|
1480
|
+
}
|
|
1481
|
+
if (this.computed !== void 0) {
|
|
1482
|
+
record = evalComputedFields(record, this.computed, id);
|
|
1413
1483
|
}
|
|
1414
1484
|
if (this.schema !== void 0) {
|
|
1415
1485
|
record = await validateSchemaInput(this.schema, record, `put(${id})`);
|
|
1416
1486
|
}
|
|
1487
|
+
if (this.moneyFields) {
|
|
1488
|
+
record = quantizeMoneyFields(record, this.moneyFields);
|
|
1489
|
+
}
|
|
1417
1490
|
if (this.i18nFields) {
|
|
1418
1491
|
const obj = record;
|
|
1419
1492
|
for (const [field, descriptor] of Object.entries(this.i18nFields)) {
|
|
@@ -1637,7 +1710,7 @@ var Collection = class {
|
|
|
1637
1710
|
if (mode === "eager") {
|
|
1638
1711
|
if (executor === null) {
|
|
1639
1712
|
;
|
|
1640
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
1713
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-IQO3KGXQ.js"));
|
|
1641
1714
|
}
|
|
1642
1715
|
await executor.refresh(reg, {
|
|
1643
1716
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -1646,7 +1719,7 @@ var Collection = class {
|
|
|
1646
1719
|
});
|
|
1647
1720
|
} else if (mode === "lazy") {
|
|
1648
1721
|
if (staleHelpers === null) {
|
|
1649
|
-
staleHelpers = await import("./stale-
|
|
1722
|
+
staleHelpers = await import("./stale-LZYMMDDS.js");
|
|
1650
1723
|
}
|
|
1651
1724
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
1652
1725
|
}
|
|
@@ -1675,7 +1748,7 @@ var Collection = class {
|
|
|
1675
1748
|
const mode = typeof spec.lifecycle === "string" ? spec.lifecycle : spec.lifecycle.mode;
|
|
1676
1749
|
if (mode === "eager") {
|
|
1677
1750
|
if (DerivationExecutor === null) {
|
|
1678
|
-
({ DerivationExecutor } = await import("./executor-
|
|
1751
|
+
({ DerivationExecutor } = await import("./executor-AVJ7UEWA.js"));
|
|
1679
1752
|
}
|
|
1680
1753
|
const sourceWithId = { ...incoming, id };
|
|
1681
1754
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
@@ -1694,7 +1767,7 @@ var Collection = class {
|
|
|
1694
1767
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
1695
1768
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
1696
1769
|
if (out.kind === "array") {
|
|
1697
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
1770
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
1698
1771
|
const prior = await loadFanoutSidecar(
|
|
1699
1772
|
this.adapter,
|
|
1700
1773
|
this.vault,
|
|
@@ -1987,7 +2060,7 @@ var Collection = class {
|
|
|
1987
2060
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
1988
2061
|
if (outSpec.shape !== "array") continue;
|
|
1989
2062
|
if (helpers === null) {
|
|
1990
|
-
helpers = await import("./fanout-sidecar-
|
|
2063
|
+
helpers = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
1991
2064
|
}
|
|
1992
2065
|
const sidecar = await helpers.loadFanoutSidecar(
|
|
1993
2066
|
this.adapter,
|
|
@@ -2027,7 +2100,7 @@ var Collection = class {
|
|
|
2027
2100
|
if (mode === "eager") {
|
|
2028
2101
|
if (executor === null) {
|
|
2029
2102
|
;
|
|
2030
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2103
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-IQO3KGXQ.js"));
|
|
2031
2104
|
}
|
|
2032
2105
|
await executor.refresh(reg, {
|
|
2033
2106
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -2036,7 +2109,7 @@ var Collection = class {
|
|
|
2036
2109
|
});
|
|
2037
2110
|
} else if (mode === "lazy") {
|
|
2038
2111
|
if (staleHelpers === null) {
|
|
2039
|
-
staleHelpers = await import("./stale-
|
|
2112
|
+
staleHelpers = await import("./stale-LZYMMDDS.js");
|
|
2040
2113
|
}
|
|
2041
2114
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
2042
2115
|
}
|
|
@@ -2059,14 +2132,22 @@ var Collection = class {
|
|
|
2059
2132
|
);
|
|
2060
2133
|
}
|
|
2061
2134
|
if (this.materializedViewSource !== void 0) {
|
|
2062
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2135
|
+
const { resolveStaleMVOnRead } = await import("./stale-LZYMMDDS.js");
|
|
2063
2136
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2064
2137
|
}
|
|
2065
2138
|
await this.ensureHydrated();
|
|
2066
2139
|
const records = [...this.cache.values()].map((e) => e.record);
|
|
2067
|
-
if (!
|
|
2140
|
+
if (!this.hasReadTransforms()) return records;
|
|
2068
2141
|
return Promise.all(records.map((r) => this.applyLocaleToRecord(r, locale)));
|
|
2069
2142
|
}
|
|
2143
|
+
/**
|
|
2144
|
+
* @internal — whether any read-side record transform is registered
|
|
2145
|
+
* (money decode, i18nText resolution, dictKey labels). Gates the
|
|
2146
|
+
* no-transform fast path in {@link list}.
|
|
2147
|
+
*/
|
|
2148
|
+
hasReadTransforms() {
|
|
2149
|
+
return this.moneyFields !== void 0 && Object.keys(this.moneyFields).length > 0 || this.i18nFields !== void 0 && Object.keys(this.i18nFields).length > 0 || this.dictKeyFields !== void 0 && Object.keys(this.dictKeyFields).length > 0;
|
|
2150
|
+
}
|
|
2070
2151
|
// ─── Bulk operations ─────────────────────────────────────
|
|
2071
2152
|
/**
|
|
2072
2153
|
* Put many records in one call. Each item is processed sequentially
|
|
@@ -2235,7 +2316,8 @@ var Collection = class {
|
|
|
2235
2316
|
// fields. The Query builder consults these when present and falls
|
|
2236
2317
|
// back to a linear scan otherwise.
|
|
2237
2318
|
getIndexes: () => this.getIndexes(),
|
|
2238
|
-
lookupById: (id) => this.cache.get(id)?.record
|
|
2319
|
+
lookupById: (id) => this.cache.get(id)?.record,
|
|
2320
|
+
...this.moneyFields ? { moneyFields: this.moneyFields } : {}
|
|
2239
2321
|
};
|
|
2240
2322
|
const resolver = this.joinResolver;
|
|
2241
2323
|
const leftCollection = this.name;
|
|
@@ -2571,7 +2653,8 @@ var Collection = class {
|
|
|
2571
2653
|
pageSize,
|
|
2572
2654
|
[],
|
|
2573
2655
|
[],
|
|
2574
|
-
joinContext
|
|
2656
|
+
joinContext,
|
|
2657
|
+
this.moneyFields
|
|
2575
2658
|
);
|
|
2576
2659
|
}
|
|
2577
2660
|
/** Decrypt a page of envelopes returned by `adapter.listPage`. */
|
|
@@ -2917,10 +3000,14 @@ var Collection = class {
|
|
|
2917
3000
|
async applyLocaleToRecord(record, localeOpts) {
|
|
2918
3001
|
const hasI18n = this.i18nFields && Object.keys(this.i18nFields).length > 0;
|
|
2919
3002
|
const hasDict = this.dictKeyFields && Object.keys(this.dictKeyFields).length > 0;
|
|
2920
|
-
|
|
3003
|
+
const hasMoney = this.moneyFields && Object.keys(this.moneyFields).length > 0;
|
|
3004
|
+
if (!hasI18n && !hasDict && !hasMoney) return record;
|
|
2921
3005
|
const locale = localeOpts?.locale ?? this.defaultLocale;
|
|
2922
|
-
if (!locale) return record;
|
|
2923
3006
|
let result = record;
|
|
3007
|
+
if (hasMoney && this.moneyFields) {
|
|
3008
|
+
result = decodeMoneyFields(result, this.moneyFields, typeof locale === "string" ? locale : void 0);
|
|
3009
|
+
}
|
|
3010
|
+
if (!locale) return result;
|
|
2924
3011
|
if (hasI18n && this.i18nFields) {
|
|
2925
3012
|
result = this.i18nStrategy.applyI18nLocale(result, this.i18nFields, locale, localeOpts?.fallback);
|
|
2926
3013
|
}
|
|
@@ -3616,6 +3703,318 @@ function valuesMatch(stored, live) {
|
|
|
3616
3703
|
}
|
|
3617
3704
|
}
|
|
3618
3705
|
|
|
3706
|
+
// src/archive/engine.ts
|
|
3707
|
+
function isHeld(policy, record) {
|
|
3708
|
+
if (!policy.legalHold) return false;
|
|
3709
|
+
try {
|
|
3710
|
+
return policy.legalHold(record);
|
|
3711
|
+
} catch {
|
|
3712
|
+
return true;
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
async function runArchive(ctx, options = {}) {
|
|
3716
|
+
const maxArchives = options.maxArchives ?? Infinity;
|
|
3717
|
+
const dryRun = options.dryRun === true;
|
|
3718
|
+
let archived = 0;
|
|
3719
|
+
let held = 0;
|
|
3720
|
+
let scanned = 0;
|
|
3721
|
+
const byCollection = {};
|
|
3722
|
+
outer: for (const collection of ctx.collectionsWithPolicy()) {
|
|
3723
|
+
const policy = ctx.getPolicy(collection);
|
|
3724
|
+
if (!policy) continue;
|
|
3725
|
+
byCollection[collection] = { archived: 0, held: 0 };
|
|
3726
|
+
for (const id of await ctx.listRecordIds(collection)) {
|
|
3727
|
+
if (archived >= maxArchives) break outer;
|
|
3728
|
+
const record = await ctx.getRecord(collection, id).catch(() => null);
|
|
3729
|
+
if (record === null) continue;
|
|
3730
|
+
scanned += 1;
|
|
3731
|
+
let eligible = false;
|
|
3732
|
+
try {
|
|
3733
|
+
eligible = policy.archiveWhen(record);
|
|
3734
|
+
} catch {
|
|
3735
|
+
eligible = false;
|
|
3736
|
+
}
|
|
3737
|
+
if (!eligible) continue;
|
|
3738
|
+
if (isHeld(policy, record)) {
|
|
3739
|
+
held += 1;
|
|
3740
|
+
byCollection[collection].held += 1;
|
|
3741
|
+
continue;
|
|
3742
|
+
}
|
|
3743
|
+
if (!dryRun) {
|
|
3744
|
+
const env = await ctx.getEnvelope(collection, id);
|
|
3745
|
+
if (!env) continue;
|
|
3746
|
+
await ctx.archiveStore.put(ctx.vaultId, collection, id, env);
|
|
3747
|
+
await ctx.removeFromPrimary(collection, id);
|
|
3748
|
+
}
|
|
3749
|
+
archived += 1;
|
|
3750
|
+
byCollection[collection].archived += 1;
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
return { archived, held, scanned, byCollection };
|
|
3754
|
+
}
|
|
3755
|
+
async function runRestore(ctx, collection, id) {
|
|
3756
|
+
const env = await ctx.archiveStore.get(ctx.vaultId, collection, id);
|
|
3757
|
+
if (!env) return false;
|
|
3758
|
+
await ctx.restoreToPrimary(collection, id, env);
|
|
3759
|
+
await ctx.archiveStore.delete(ctx.vaultId, collection, id);
|
|
3760
|
+
return true;
|
|
3761
|
+
}
|
|
3762
|
+
async function runListArchived(ctx, collection) {
|
|
3763
|
+
const collections = collection ? [collection] : ctx.collectionsWithPolicy();
|
|
3764
|
+
const out = [];
|
|
3765
|
+
for (const c of collections) {
|
|
3766
|
+
const ids = await ctx.archiveStore.list(ctx.vaultId, c);
|
|
3767
|
+
for (const id of ids) out.push({ collection: c, id });
|
|
3768
|
+
}
|
|
3769
|
+
return out;
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
// src/archive/index.ts
|
|
3773
|
+
function withArchive(opts) {
|
|
3774
|
+
return { store: opts.store };
|
|
3775
|
+
}
|
|
3776
|
+
|
|
3777
|
+
// src/sequence/index.ts
|
|
3778
|
+
var SEQUENCE_COLLECTION = "_sequences";
|
|
3779
|
+
var MAX_NEXT_ATTEMPTS = 16;
|
|
3780
|
+
async function sleepBackoff(attempt) {
|
|
3781
|
+
const ceil = Math.min(2 ** attempt, 32);
|
|
3782
|
+
const ms = Math.floor(Math.random() * ceil);
|
|
3783
|
+
await new Promise((r) => setTimeout(r, ms));
|
|
3784
|
+
}
|
|
3785
|
+
var SequenceStore = class {
|
|
3786
|
+
adapter;
|
|
3787
|
+
vault;
|
|
3788
|
+
encrypted;
|
|
3789
|
+
getDEK;
|
|
3790
|
+
actor;
|
|
3791
|
+
/**
|
|
3792
|
+
* Memoized DEK promise. The `_sequences` collection DEK is created on
|
|
3793
|
+
* first access; without sharing one promise, a burst of concurrent
|
|
3794
|
+
* `next()` calls would each trigger DEK creation and diverge (one
|
|
3795
|
+
* writer's ciphertext unreadable by another). One shared promise → one
|
|
3796
|
+
* DEK.
|
|
3797
|
+
*/
|
|
3798
|
+
dekPromise = null;
|
|
3799
|
+
constructor(opts) {
|
|
3800
|
+
this.adapter = opts.adapter;
|
|
3801
|
+
this.vault = opts.vault;
|
|
3802
|
+
this.encrypted = opts.encrypted;
|
|
3803
|
+
this.getDEK = opts.getDEK;
|
|
3804
|
+
this.actor = opts.actor;
|
|
3805
|
+
}
|
|
3806
|
+
/** A handle bound to one sequence name. */
|
|
3807
|
+
handle(name) {
|
|
3808
|
+
return {
|
|
3809
|
+
next: () => this.next(name),
|
|
3810
|
+
peek: () => this.peek(name)
|
|
3811
|
+
};
|
|
3812
|
+
}
|
|
3813
|
+
assertOnline() {
|
|
3814
|
+
if (this.adapter.capabilities?.casAtomic !== true) {
|
|
3815
|
+
throw new SequenceOfflineError();
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
dek() {
|
|
3819
|
+
if (!this.dekPromise) this.dekPromise = this.getDEK(SEQUENCE_COLLECTION);
|
|
3820
|
+
return this.dekPromise;
|
|
3821
|
+
}
|
|
3822
|
+
async read(name) {
|
|
3823
|
+
const env = await this.adapter.get(this.vault, SEQUENCE_COLLECTION, name);
|
|
3824
|
+
if (!env) return { env: null, value: 0 };
|
|
3825
|
+
const json = this.encrypted ? await decrypt(env._iv, env._data, await this.dek()) : env._data;
|
|
3826
|
+
const state = JSON.parse(json);
|
|
3827
|
+
return { env, value: state.value };
|
|
3828
|
+
}
|
|
3829
|
+
async encryptState(state, version) {
|
|
3830
|
+
const json = JSON.stringify(state);
|
|
3831
|
+
if (!this.encrypted) {
|
|
3832
|
+
return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
|
|
3833
|
+
}
|
|
3834
|
+
const { iv, data } = await encrypt(json, await this.dek());
|
|
3835
|
+
return { _noydb: NOYDB_FORMAT_VERSION, _v: version, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data, _by: this.actor };
|
|
3836
|
+
}
|
|
3837
|
+
async peek(name) {
|
|
3838
|
+
return (await this.read(name)).value;
|
|
3839
|
+
}
|
|
3840
|
+
async next(name) {
|
|
3841
|
+
this.assertOnline();
|
|
3842
|
+
let lastConflict;
|
|
3843
|
+
for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {
|
|
3844
|
+
const { env, value } = await this.read(name);
|
|
3845
|
+
const nextValue = value + 1;
|
|
3846
|
+
const expectedVersion = env?._v ?? 0;
|
|
3847
|
+
const envelope = await this.encryptState({ value: nextValue }, expectedVersion + 1);
|
|
3848
|
+
try {
|
|
3849
|
+
await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion);
|
|
3850
|
+
return nextValue;
|
|
3851
|
+
} catch (err) {
|
|
3852
|
+
if (err instanceof ConflictError) {
|
|
3853
|
+
lastConflict = err;
|
|
3854
|
+
if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt);
|
|
3855
|
+
continue;
|
|
3856
|
+
}
|
|
3857
|
+
throw err;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
void lastConflict;
|
|
3861
|
+
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
3862
|
+
}
|
|
3863
|
+
};
|
|
3864
|
+
|
|
3865
|
+
// src/numbering/index.ts
|
|
3866
|
+
var NUMBERING_HEAD_COLLECTION = "_numbering_head";
|
|
3867
|
+
var NUMBERING_PENDING_COLLECTION = "_numbering_pending";
|
|
3868
|
+
var DeferredNumberingStore = class {
|
|
3869
|
+
adapter;
|
|
3870
|
+
vault;
|
|
3871
|
+
encrypted;
|
|
3872
|
+
getDEK;
|
|
3873
|
+
actor;
|
|
3874
|
+
configs;
|
|
3875
|
+
/**
|
|
3876
|
+
* Stamp a serial onto a USER record THROUGH the Collection layer (so the
|
|
3877
|
+
* cache, indexes, and MVs stay coherent — the engine must NOT write user
|
|
3878
|
+
* collections at the raw adapter level). Returns false if the record is
|
|
3879
|
+
* gone (the engine then skips it without burning a serial). Provided by the
|
|
3880
|
+
* vault; unit tests pass a Map-backed double.
|
|
3881
|
+
*/
|
|
3882
|
+
stamp;
|
|
3883
|
+
/** In-process registry: `${series}::${recordId}` → resolver for the live next() Promise. */
|
|
3884
|
+
waiters = /* @__PURE__ */ new Map();
|
|
3885
|
+
dekCache = /* @__PURE__ */ new Map();
|
|
3886
|
+
constructor(opts) {
|
|
3887
|
+
this.adapter = opts.adapter;
|
|
3888
|
+
this.vault = opts.vault;
|
|
3889
|
+
this.encrypted = opts.encrypted;
|
|
3890
|
+
this.getDEK = opts.getDEK;
|
|
3891
|
+
this.actor = opts.actor;
|
|
3892
|
+
this.configs = opts.configs;
|
|
3893
|
+
this.stamp = opts.stamp;
|
|
3894
|
+
}
|
|
3895
|
+
has(series) {
|
|
3896
|
+
return this.configs.has(series);
|
|
3897
|
+
}
|
|
3898
|
+
dek(collection) {
|
|
3899
|
+
let p = this.dekCache.get(collection);
|
|
3900
|
+
if (!p) {
|
|
3901
|
+
p = this.getDEK(collection);
|
|
3902
|
+
this.dekCache.set(collection, p);
|
|
3903
|
+
}
|
|
3904
|
+
return p;
|
|
3905
|
+
}
|
|
3906
|
+
async readJson(collection, id) {
|
|
3907
|
+
const env = await this.adapter.get(this.vault, collection, id);
|
|
3908
|
+
if (!env) return { env: null, value: null };
|
|
3909
|
+
const json = this.encrypted ? await decrypt(env._iv, env._data, await this.dek(collection)) : env._data;
|
|
3910
|
+
return { env, value: JSON.parse(json) };
|
|
3911
|
+
}
|
|
3912
|
+
async writeJson(collection, id, value, expectedVersion) {
|
|
3913
|
+
const json = JSON.stringify(value);
|
|
3914
|
+
let env;
|
|
3915
|
+
if (!this.encrypted) {
|
|
3916
|
+
env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: "", _data: json, _by: this.actor };
|
|
3917
|
+
} else {
|
|
3918
|
+
const { iv, data } = await encrypt(json, await this.dek(collection));
|
|
3919
|
+
env = { _noydb: NOYDB_FORMAT_VERSION, _v: expectedVersion + 1, _ts: (/* @__PURE__ */ new Date()).toISOString(), _iv: iv, _data: data, _by: this.actor };
|
|
3920
|
+
}
|
|
3921
|
+
await this.adapter.put(this.vault, collection, id, env, expectedVersion);
|
|
3922
|
+
}
|
|
3923
|
+
pendingId(series, recordId) {
|
|
3924
|
+
return `${series}::${recordId}`;
|
|
3925
|
+
}
|
|
3926
|
+
/** Current last-assigned serial for a series (0 if none). */
|
|
3927
|
+
async peek(series) {
|
|
3928
|
+
const { value } = await this.readJson(NUMBERING_HEAD_COLLECTION, series);
|
|
3929
|
+
return value?.lastSerial ?? 0;
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* Enqueue a record for numbering: stamp it with the current store clock and
|
|
3933
|
+
* durably write a pending entry. The returned Promise resolves once the
|
|
3934
|
+
* record is durably enqueued; its `assigned` field resolves with the serial
|
|
3935
|
+
* at the next pass (the record's `field` is the durable source of truth —
|
|
3936
|
+
* `assigned` is an in-process convenience that a crash may drop).
|
|
3937
|
+
*/
|
|
3938
|
+
async enqueue(series, recordId) {
|
|
3939
|
+
const cfg = this.configs.get(series);
|
|
3940
|
+
if (!cfg) throw new NumberingUncertaintyError(series);
|
|
3941
|
+
if (typeof this.adapter.getStoreTime !== "function") throw new NumberingUncertaintyError(series);
|
|
3942
|
+
const st = await this.adapter.getStoreTime();
|
|
3943
|
+
const id = this.pendingId(series, recordId);
|
|
3944
|
+
const { env } = await this.readJson(NUMBERING_PENDING_COLLECTION, id);
|
|
3945
|
+
const entry = {
|
|
3946
|
+
series,
|
|
3947
|
+
recordId,
|
|
3948
|
+
collection: cfg.collection,
|
|
3949
|
+
field: cfg.field,
|
|
3950
|
+
storeEarliest: st.earliest,
|
|
3951
|
+
storeLatest: st.latest,
|
|
3952
|
+
enqueuedAt: Date.now()
|
|
3953
|
+
};
|
|
3954
|
+
await this.writeJson(NUMBERING_PENDING_COLLECTION, id, entry, env?._v ?? 0);
|
|
3955
|
+
const assigned = new Promise((resolve, reject) => {
|
|
3956
|
+
this.waiters.set(id, { resolve, reject });
|
|
3957
|
+
});
|
|
3958
|
+
return { assigned };
|
|
3959
|
+
}
|
|
3960
|
+
async listPending(series) {
|
|
3961
|
+
const ids = await this.adapter.list(this.vault, NUMBERING_PENDING_COLLECTION);
|
|
3962
|
+
const prefix = `${series}::`;
|
|
3963
|
+
const out = [];
|
|
3964
|
+
for (const id of ids) {
|
|
3965
|
+
if (!id.startsWith(prefix)) continue;
|
|
3966
|
+
const { value } = await this.readJson(NUMBERING_PENDING_COLLECTION, id);
|
|
3967
|
+
if (value) out.push({ id, entry: value });
|
|
3968
|
+
}
|
|
3969
|
+
return out;
|
|
3970
|
+
}
|
|
3971
|
+
/**
|
|
3972
|
+
* Run a numbering pass for `series`: select entries provably settled
|
|
3973
|
+
* (`storeLatest ≤ now.earliest` — commit-wait), order by
|
|
3974
|
+
* `(storeEarliest, recordId)`, assign serials after the head, stamp each
|
|
3975
|
+
* record's field, advance the head with one CAS, and consume the entries.
|
|
3976
|
+
* Idempotent/convergent: a losing concurrent pass returns `[]` and the next
|
|
3977
|
+
* pass reconciles. Resolves any in-process enqueue() `assigned` Promises.
|
|
3978
|
+
*/
|
|
3979
|
+
async runPass(series) {
|
|
3980
|
+
const cfg = this.configs.get(series);
|
|
3981
|
+
if (!cfg) throw new NumberingUncertaintyError(series);
|
|
3982
|
+
if (typeof this.adapter.getStoreTime !== "function") throw new NumberingUncertaintyError(series);
|
|
3983
|
+
const now = await this.adapter.getStoreTime();
|
|
3984
|
+
const settled = (await this.listPending(series)).filter((p) => p.entry.storeLatest <= now.earliest).sort(
|
|
3985
|
+
(a, b) => a.entry.storeEarliest - b.entry.storeEarliest || (a.entry.recordId < b.entry.recordId ? -1 : a.entry.recordId > b.entry.recordId ? 1 : 0)
|
|
3986
|
+
);
|
|
3987
|
+
if (settled.length === 0) return [];
|
|
3988
|
+
const { env: headEnv, value: head } = await this.readJson(NUMBERING_HEAD_COLLECTION, series);
|
|
3989
|
+
let serial = head?.lastSerial ?? 0;
|
|
3990
|
+
const assignments = [];
|
|
3991
|
+
for (const { entry } of settled) {
|
|
3992
|
+
serial += 1;
|
|
3993
|
+
const ok = await this.stamp(entry.collection, entry.recordId, entry.field, serial);
|
|
3994
|
+
if (!ok) {
|
|
3995
|
+
serial -= 1;
|
|
3996
|
+
continue;
|
|
3997
|
+
}
|
|
3998
|
+
assignments.push({ recordId: entry.recordId, serial });
|
|
3999
|
+
}
|
|
4000
|
+
try {
|
|
4001
|
+
await this.writeJson(NUMBERING_HEAD_COLLECTION, series, { series, lastSerial: serial, watermark: now.earliest }, headEnv?._v ?? 0);
|
|
4002
|
+
} catch (err) {
|
|
4003
|
+
if (err instanceof ConflictError) return [];
|
|
4004
|
+
throw err;
|
|
4005
|
+
}
|
|
4006
|
+
for (const { id, entry } of settled) {
|
|
4007
|
+
await this.adapter.delete(this.vault, NUMBERING_PENDING_COLLECTION, id);
|
|
4008
|
+
const a = assignments.find((x) => x.recordId === entry.recordId);
|
|
4009
|
+
if (a) {
|
|
4010
|
+
this.waiters.get(id)?.resolve(a.serial);
|
|
4011
|
+
this.waiters.delete(id);
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
return assignments;
|
|
4015
|
+
}
|
|
4016
|
+
};
|
|
4017
|
+
|
|
3619
4018
|
// src/shadow/strategy.ts
|
|
3620
4019
|
var NOT_ENABLED2 = new Error(
|
|
3621
4020
|
'VaultFrame requires the shadow strategy. Import `{ withShadow }` from "@noy-db/hub/shadow" and pass it to `createNoydb({ shadowStrategy: withShadow() })`.'
|
|
@@ -4726,6 +5125,10 @@ var Vault = class {
|
|
|
4726
5125
|
* call throws with a pointer at `@noy-db/hub/blobs`.
|
|
4727
5126
|
*/
|
|
4728
5127
|
blobStrategy;
|
|
5128
|
+
/** Cold-storage archival strategy (the archive target store). */
|
|
5129
|
+
archiveStrategy;
|
|
5130
|
+
/** Per-collection record archival policies. Indexed by collection name. */
|
|
5131
|
+
archiveRegistry = /* @__PURE__ */ new Map();
|
|
4729
5132
|
indexStrategy;
|
|
4730
5133
|
aggregateStrategy;
|
|
4731
5134
|
crdtStrategy;
|
|
@@ -4829,6 +5232,12 @@ var Vault = class {
|
|
|
4829
5232
|
* docstring.
|
|
4830
5233
|
*/
|
|
4831
5234
|
ledgerStore = null;
|
|
5235
|
+
/** Lazily-built atomic-sequence store. See {@link sequence}. */
|
|
5236
|
+
sequenceStore = null;
|
|
5237
|
+
/** Lazily-built deferred-numbering engine. See {@link runNumberingPass}. */
|
|
5238
|
+
deferredNumbering = null;
|
|
5239
|
+
/** Registered deferred-numbering series, keyed by series name. */
|
|
5240
|
+
numberingConfigs;
|
|
4832
5241
|
/**
|
|
4833
5242
|
* Background writes for persisted-schema envelopes (#schema-dump v0
|
|
4834
5243
|
* slice 1). One promise per `collection({ persistJsonSchema: true })`
|
|
@@ -4915,6 +5324,7 @@ var Vault = class {
|
|
|
4915
5324
|
constructor(opts) {
|
|
4916
5325
|
this.adapter = opts.adapter;
|
|
4917
5326
|
this.name = opts.name;
|
|
5327
|
+
this.numberingConfigs = new Map((opts.numberingConfigs ?? []).map((c) => [c.series, c]));
|
|
4918
5328
|
this.noydb = opts.noydb;
|
|
4919
5329
|
this.keyring = opts.keyring;
|
|
4920
5330
|
this.encrypted = opts.encrypted;
|
|
@@ -4930,6 +5340,7 @@ var Vault = class {
|
|
|
4930
5340
|
this.onRegisterConflictResolver = opts.onRegisterConflictResolver;
|
|
4931
5341
|
this.syncAdapter = opts.syncAdapter;
|
|
4932
5342
|
this.blobStrategy = opts.blobStrategy;
|
|
5343
|
+
this.archiveStrategy = opts.archiveStrategy;
|
|
4933
5344
|
this.indexStrategy = opts.indexStrategy;
|
|
4934
5345
|
this.aggregateStrategy = opts.aggregateStrategy;
|
|
4935
5346
|
this.crdtStrategy = opts.crdtStrategy;
|
|
@@ -4992,8 +5403,9 @@ var Vault = class {
|
|
|
4992
5403
|
*. `put()` validates keys against the declared set; reads
|
|
4993
5404
|
* with `{ locale }` add `<field>Label` virtual fields.
|
|
4994
5405
|
*
|
|
4995
|
-
* Throws `ReservedCollectionNameError` for names starting with `_dict_
|
|
4996
|
-
* Use `vault.dictionary(name)`
|
|
5406
|
+
* Throws `ReservedCollectionNameError` for names starting with `_dict_` or
|
|
5407
|
+
* equal to `_sequences`. Use `vault.dictionary(name)` for dict collections
|
|
5408
|
+
* and `vault.sequence(name)` for sequence counters.
|
|
4997
5409
|
*
|
|
4998
5410
|
* Lazy mode + indexes is rejected at construction time — see the
|
|
4999
5411
|
* Collection constructor for the rationale.
|
|
@@ -5012,7 +5424,16 @@ var Vault = class {
|
|
|
5012
5424
|
if (isDictCollectionName(collectionName)) {
|
|
5013
5425
|
throw new ReservedCollectionNameError(collectionName);
|
|
5014
5426
|
}
|
|
5427
|
+
if (collectionName === SEQUENCE_COLLECTION) {
|
|
5428
|
+
throw new ReservedCollectionNameError(collectionName);
|
|
5429
|
+
}
|
|
5015
5430
|
let coll = this.collectionCache.get(collectionName);
|
|
5431
|
+
if (coll && options?.moneyFields) {
|
|
5432
|
+
coll._applyMoneyFields(options.moneyFields);
|
|
5433
|
+
}
|
|
5434
|
+
if (coll && options?.computed) {
|
|
5435
|
+
coll._applyComputed(options.computed);
|
|
5436
|
+
}
|
|
5016
5437
|
if (!coll) {
|
|
5017
5438
|
if (options?.refs) {
|
|
5018
5439
|
this.refRegistry.register(collectionName, options.refs);
|
|
@@ -5023,6 +5444,9 @@ var Vault = class {
|
|
|
5023
5444
|
if (options?.blobFields) {
|
|
5024
5445
|
this.blobFieldsRegistry.set(collectionName, options.blobFields);
|
|
5025
5446
|
}
|
|
5447
|
+
if (options?.archive) {
|
|
5448
|
+
this.archiveRegistry.set(collectionName, options.archive);
|
|
5449
|
+
}
|
|
5026
5450
|
if (options?.attestation !== void 0) {
|
|
5027
5451
|
this.attestationRegistry.set(collectionName, options.attestation);
|
|
5028
5452
|
}
|
|
@@ -5138,6 +5562,8 @@ var Vault = class {
|
|
|
5138
5562
|
collOpts.onCrossTierAccess = (event) => this.emitCrossTier(event);
|
|
5139
5563
|
if (this.syncAdapter !== void 0) collOpts.syncAdapter = this.syncAdapter;
|
|
5140
5564
|
if (options?.i18nFields !== void 0) collOpts.i18nFields = options.i18nFields;
|
|
5565
|
+
if (options?.moneyFields !== void 0) collOpts.moneyFields = options.moneyFields;
|
|
5566
|
+
if (options?.computed !== void 0) collOpts.computed = options.computed;
|
|
5141
5567
|
if (options?.dictKeyFields !== void 0) {
|
|
5142
5568
|
collOpts.dictLabelResolver = async (dictName, key, locale, fallback) => {
|
|
5143
5569
|
const handle = this.dictionary(dictName);
|
|
@@ -5557,6 +5983,77 @@ var Vault = class {
|
|
|
5557
5983
|
* await vault.compact({ maxEvictions: 1000 }) // cap batch
|
|
5558
5984
|
* ```
|
|
5559
5985
|
*/
|
|
5986
|
+
/**
|
|
5987
|
+
* Atomic, gap-free numbering. `vault.sequence('invoice-2026').next()`
|
|
5988
|
+
* returns 1, 2, 3, … with no gaps or duplicates under concurrency, via
|
|
5989
|
+
* an optimistic-CAS counter at `_sequences/<name>`. Each name is an
|
|
5990
|
+
* independent sequence.
|
|
5991
|
+
*
|
|
5992
|
+
* **Online-only:** `next()` throws `SequenceOfflineError` unless the
|
|
5993
|
+
* store advertises `capabilities.casAtomic` — gap-free numbering cannot
|
|
5994
|
+
* be serialized by an offline / non-CAS writer.
|
|
5995
|
+
*
|
|
5996
|
+
* ```ts
|
|
5997
|
+
* const n = await vault.sequence('invoice-2026').next() // 1, then 2, …
|
|
5998
|
+
* const cur = await vault.sequence('invoice-2026').peek() // current value, no allocation
|
|
5999
|
+
* ```
|
|
6000
|
+
*/
|
|
6001
|
+
sequence(name) {
|
|
6002
|
+
if (this.numberingConfigs.has(name)) {
|
|
6003
|
+
const eng = this.deferred();
|
|
6004
|
+
return {
|
|
6005
|
+
next: async (opts) => {
|
|
6006
|
+
if (!opts?.for) {
|
|
6007
|
+
throw new ValidationError(`sequence("${name}") is a deferred-numbering series; call next({ for: recordId }).`);
|
|
6008
|
+
}
|
|
6009
|
+
return (await eng.enqueue(name, opts.for)).assigned;
|
|
6010
|
+
},
|
|
6011
|
+
peek: () => eng.peek(name)
|
|
6012
|
+
};
|
|
6013
|
+
}
|
|
6014
|
+
if (!this.sequenceStore) {
|
|
6015
|
+
this.sequenceStore = new SequenceStore({
|
|
6016
|
+
adapter: this.adapter,
|
|
6017
|
+
vault: this.name,
|
|
6018
|
+
encrypted: this.encrypted,
|
|
6019
|
+
getDEK: this.getDEK,
|
|
6020
|
+
actor: this.keyring.userId
|
|
6021
|
+
});
|
|
6022
|
+
}
|
|
6023
|
+
return this.sequenceStore.handle(name);
|
|
6024
|
+
}
|
|
6025
|
+
/** @internal — lazily build the deferred-numbering engine with a cache-coherent stamp. */
|
|
6026
|
+
deferred() {
|
|
6027
|
+
if (!this.deferredNumbering) {
|
|
6028
|
+
this.deferredNumbering = new DeferredNumberingStore({
|
|
6029
|
+
adapter: this.adapter,
|
|
6030
|
+
vault: this.name,
|
|
6031
|
+
encrypted: this.encrypted,
|
|
6032
|
+
getDEK: this.getDEK,
|
|
6033
|
+
actor: this.keyring.userId,
|
|
6034
|
+
configs: this.numberingConfigs,
|
|
6035
|
+
// Stamp THROUGH the Collection layer so cache/indexes/MVs stay coherent —
|
|
6036
|
+
// `this.collection(name)` returns the shared cached instance, so a
|
|
6037
|
+
// subsequent user `collection.get(id)` sees the assigned serial.
|
|
6038
|
+
stamp: async (collection, recordId, field, serial) => {
|
|
6039
|
+
const coll = this.collection(collection);
|
|
6040
|
+
const rec = await coll.get(recordId);
|
|
6041
|
+
if (!rec) return false;
|
|
6042
|
+
await coll.put(recordId, { ...rec, [field]: serial });
|
|
6043
|
+
return true;
|
|
6044
|
+
}
|
|
6045
|
+
});
|
|
6046
|
+
}
|
|
6047
|
+
return this.deferredNumbering;
|
|
6048
|
+
}
|
|
6049
|
+
/**
|
|
6050
|
+
* Run a deferred-numbering pass for `series`: assign gap-free serials to all
|
|
6051
|
+
* records whose store-commit-time interval has settled, in store-time order.
|
|
6052
|
+
* Returns the assignments made. See {@link sequence} / `withDeferredNumbering`.
|
|
6053
|
+
*/
|
|
6054
|
+
async runNumberingPass(series) {
|
|
6055
|
+
return this.deferred().runPass(series);
|
|
6056
|
+
}
|
|
5560
6057
|
async compact(options = {}) {
|
|
5561
6058
|
return runCompaction({
|
|
5562
6059
|
adapter: this.adapter,
|
|
@@ -5581,6 +6078,48 @@ var Vault = class {
|
|
|
5581
6078
|
}
|
|
5582
6079
|
}, options);
|
|
5583
6080
|
}
|
|
6081
|
+
/**
|
|
6082
|
+
* Sweep records eligible by their collection's `archive` policy into the
|
|
6083
|
+
* cold archive store. Relocation is envelope-level (no re-encryption) and
|
|
6084
|
+
* bypasses guards + materialized-view dispatch, so issued/immutable
|
|
6085
|
+
* records over a sealed period can be archived without recomputing
|
|
6086
|
+
* finalized aggregates. A `legalHold` predicate blocks archival.
|
|
6087
|
+
* Requires `archiveStrategy: withArchive({ store })` in `createNoydb`.
|
|
6088
|
+
*/
|
|
6089
|
+
async archive(options = {}) {
|
|
6090
|
+
return runArchive(this._archiveContext(), options);
|
|
6091
|
+
}
|
|
6092
|
+
/** Relocate one archived record back to the primary store. Returns false if it was not archived. */
|
|
6093
|
+
async restore(collection, id) {
|
|
6094
|
+
return runRestore(this._archiveContext(), collection, id);
|
|
6095
|
+
}
|
|
6096
|
+
/** List archived record ids for a collection (or all collections with an archive policy). */
|
|
6097
|
+
async listArchived(collection) {
|
|
6098
|
+
return runListArchived(this._archiveContext(), collection);
|
|
6099
|
+
}
|
|
6100
|
+
_archiveContext() {
|
|
6101
|
+
const strategy = this.archiveStrategy;
|
|
6102
|
+
if (!strategy) {
|
|
6103
|
+
throw new Error(
|
|
6104
|
+
"vault.archive/restore/listArchived require `archiveStrategy: withArchive({ store })` in createNoydb"
|
|
6105
|
+
);
|
|
6106
|
+
}
|
|
6107
|
+
const archiveStore = strategy.store;
|
|
6108
|
+
return {
|
|
6109
|
+
vaultId: this.name,
|
|
6110
|
+
archiveStore,
|
|
6111
|
+
collectionsWithPolicy: () => [...this.archiveRegistry.keys()],
|
|
6112
|
+
getPolicy: (c) => this.archiveRegistry.get(c) ?? null,
|
|
6113
|
+
listRecordIds: (c) => this.adapter.list(this.name, c),
|
|
6114
|
+
getRecord: async (c, id) => await this.collection(c).get(id, { locale: "raw" }),
|
|
6115
|
+
getEnvelope: (c, id) => this.adapter.get(this.name, c, id),
|
|
6116
|
+
removeFromPrimary: (c, id) => this.collection(c)._internalDelete(id),
|
|
6117
|
+
restoreToPrimary: async (c, id, env) => {
|
|
6118
|
+
await this.adapter.put(this.name, c, id, env);
|
|
6119
|
+
await this.collection(c)._invalidateCacheEntry(id);
|
|
6120
|
+
}
|
|
6121
|
+
};
|
|
6122
|
+
}
|
|
5584
6123
|
exportBlobs(options = {}) {
|
|
5585
6124
|
this.assertCanExport("plaintext", "blob");
|
|
5586
6125
|
return createExportBlobsHandle(
|
|
@@ -5596,12 +6135,12 @@ var Vault = class {
|
|
|
5596
6135
|
if (!fieldSchema) {
|
|
5597
6136
|
throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
|
|
5598
6137
|
}
|
|
5599
|
-
const { issueAttestationCore } = await import("./issue-
|
|
6138
|
+
const { issueAttestationCore } = await import("./issue-ZH27C23Y.js");
|
|
5600
6139
|
const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
|
|
5601
6140
|
return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
|
|
5602
6141
|
}
|
|
5603
6142
|
async getDocumentSigningPublicKey() {
|
|
5604
|
-
const { loadSigner, loadOrCreateSigner } = await import("./signer-
|
|
6143
|
+
const { loadSigner, loadOrCreateSigner } = await import("./signer-GRIYBA22.js");
|
|
5605
6144
|
const existing = await loadSigner(this.adapter, this.name, this.getDEK);
|
|
5606
6145
|
if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
|
|
5607
6146
|
if (this.keyring.role !== "owner") {
|
|
@@ -5627,19 +6166,19 @@ var Vault = class {
|
|
|
5627
6166
|
};
|
|
5628
6167
|
}
|
|
5629
6168
|
async revokeAttestation(docId) {
|
|
5630
|
-
const { revokeDocCore } = await import("./revoke-
|
|
6169
|
+
const { revokeDocCore } = await import("./revoke-5BOLVJ3N.js");
|
|
5631
6170
|
await revokeDocCore(this.makeRevokeContext(), docId);
|
|
5632
6171
|
}
|
|
5633
6172
|
async unrevokeAttestation(docId) {
|
|
5634
|
-
const { unrevokeDocCore } = await import("./revoke-
|
|
6173
|
+
const { unrevokeDocCore } = await import("./revoke-5BOLVJ3N.js");
|
|
5635
6174
|
await unrevokeDocCore(this.makeRevokeContext(), docId);
|
|
5636
6175
|
}
|
|
5637
6176
|
async getRevokedDocIds() {
|
|
5638
|
-
const { getRevokedDocIdsCore } = await import("./revoke-
|
|
6177
|
+
const { getRevokedDocIdsCore } = await import("./revoke-5BOLVJ3N.js");
|
|
5639
6178
|
return getRevokedDocIdsCore(this.makeRevokeContext());
|
|
5640
6179
|
}
|
|
5641
6180
|
async publishRevocationList() {
|
|
5642
|
-
const { publishRevocationListCore } = await import("./revoke-
|
|
6181
|
+
const { publishRevocationListCore } = await import("./revoke-5BOLVJ3N.js");
|
|
5643
6182
|
return publishRevocationListCore(this.makeRevokeContext());
|
|
5644
6183
|
}
|
|
5645
6184
|
makeRevokeContext() {
|
|
@@ -5956,7 +6495,7 @@ var Vault = class {
|
|
|
5956
6495
|
async _initDerivations(handles) {
|
|
5957
6496
|
if (handles.length === 0) return;
|
|
5958
6497
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
5959
|
-
import("./registry-
|
|
6498
|
+
import("./registry-2PKBQDCH.js"),
|
|
5960
6499
|
import("./read-only-facade-ITU6L7BL.js")
|
|
5961
6500
|
]);
|
|
5962
6501
|
const registry = new DerivationRegistry();
|
|
@@ -5987,7 +6526,7 @@ var Vault = class {
|
|
|
5987
6526
|
*/
|
|
5988
6527
|
async _initMaterializedViews(handles) {
|
|
5989
6528
|
if (handles.length === 0) return;
|
|
5990
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
6529
|
+
const { MaterializedViewRegistry } = await import("./registry-PV4G3OPA.js");
|
|
5991
6530
|
const registry = new MaterializedViewRegistry();
|
|
5992
6531
|
this.materializedViewRegistry = registry;
|
|
5993
6532
|
const db = this;
|
|
@@ -6011,7 +6550,7 @@ var Vault = class {
|
|
|
6011
6550
|
*/
|
|
6012
6551
|
async _initOverlayedViews(handles) {
|
|
6013
6552
|
if (handles.length === 0) return;
|
|
6014
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
6553
|
+
const { OverlayedViewRegistry } = await import("./registry-4VXFKCBJ.js");
|
|
6015
6554
|
const registry = new OverlayedViewRegistry();
|
|
6016
6555
|
const mvRegistry = this.materializedViewRegistry;
|
|
6017
6556
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -6058,13 +6597,13 @@ var Vault = class {
|
|
|
6058
6597
|
if (!reg) {
|
|
6059
6598
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
6060
6599
|
}
|
|
6061
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
6600
|
+
const { MaterializedViewExecutor } = await import("./executor-IQO3KGXQ.js");
|
|
6062
6601
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
6063
6602
|
getCollection: (n) => this.collection(n),
|
|
6064
6603
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
6065
6604
|
getQueryContext: () => this
|
|
6066
6605
|
});
|
|
6067
|
-
const { clearMVStale } = await import("./stale-
|
|
6606
|
+
const { clearMVStale } = await import("./stale-LZYMMDDS.js");
|
|
6068
6607
|
clearMVStale(registry, name);
|
|
6069
6608
|
return result;
|
|
6070
6609
|
}
|
|
@@ -6080,7 +6619,7 @@ var Vault = class {
|
|
|
6080
6619
|
if (registry === null) return { derived: 0, failed: 0 };
|
|
6081
6620
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
6082
6621
|
if (strategies.length === 0) return { derived: 0, failed: 0 };
|
|
6083
|
-
const { DerivationExecutor } = await import("./executor-
|
|
6622
|
+
const { DerivationExecutor } = await import("./executor-AVJ7UEWA.js");
|
|
6084
6623
|
const sourceColl = this.collection(sourceCollection);
|
|
6085
6624
|
const records = await sourceColl.list();
|
|
6086
6625
|
const ctx = { vault: this.readOnlyFacade ?? new (await import("./read-only-facade-ITU6L7BL.js")).ReadOnlyVaultFacade(this) };
|
|
@@ -6105,7 +6644,7 @@ var Vault = class {
|
|
|
6105
6644
|
if (!outSpec) continue;
|
|
6106
6645
|
const outputColl = this.collection(outSpec.collection);
|
|
6107
6646
|
if (out.kind === "array") {
|
|
6108
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
6647
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
6109
6648
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
|
|
6110
6649
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
6111
6650
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -6326,7 +6865,7 @@ var Vault = class {
|
|
|
6326
6865
|
* collection.
|
|
6327
6866
|
*/
|
|
6328
6867
|
async delegate(opts) {
|
|
6329
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
6868
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-K5ERUH6A.js");
|
|
6330
6869
|
if (!this.keyring.kek) {
|
|
6331
6870
|
throw new ValidationError(
|
|
6332
6871
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
|
|
@@ -6348,7 +6887,7 @@ var Vault = class {
|
|
|
6348
6887
|
* if the id does not exist.
|
|
6349
6888
|
*/
|
|
6350
6889
|
async revokeDelegation(id) {
|
|
6351
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
6890
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-K5ERUH6A.js");
|
|
6352
6891
|
await revokeDelegation(this.adapter, this.name, id);
|
|
6353
6892
|
void DELEGATIONS_COLLECTION;
|
|
6354
6893
|
}
|
|
@@ -6817,7 +7356,7 @@ var Vault = class {
|
|
|
6817
7356
|
* @see docs/subsystems/public-envelope.md
|
|
6818
7357
|
*/
|
|
6819
7358
|
async getPublicEnvelope(opts = {}) {
|
|
6820
|
-
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-
|
|
7359
|
+
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-MHG6YVXW.js");
|
|
6821
7360
|
return readPublicEnvelope2(this.adapter, this.name, opts);
|
|
6822
7361
|
}
|
|
6823
7362
|
/**
|
|
@@ -6842,7 +7381,7 @@ var Vault = class {
|
|
|
6842
7381
|
}
|
|
6843
7382
|
}
|
|
6844
7383
|
const internalSnapshot = {};
|
|
6845
|
-
for (const internalName of [LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, SCHEMAS_COLLECTION]) {
|
|
7384
|
+
for (const internalName of [LEDGER_COLLECTION, LEDGER_DELTAS_COLLECTION, SCHEMAS_COLLECTION, SEQUENCE_COLLECTION]) {
|
|
6846
7385
|
const ids = await this.adapter.list(this.name, internalName);
|
|
6847
7386
|
if (ids.length === 0) continue;
|
|
6848
7387
|
const records = {};
|
|
@@ -8359,6 +8898,7 @@ var Noydb = class {
|
|
|
8359
8898
|
writeRelay;
|
|
8360
8899
|
/** Per-vault policy enforcers. */
|
|
8361
8900
|
policyEnforcers = /* @__PURE__ */ new Map();
|
|
8901
|
+
vaultTemplates = /* @__PURE__ */ new Map();
|
|
8362
8902
|
txStrategy;
|
|
8363
8903
|
sessionStrategy;
|
|
8364
8904
|
syncStrategy;
|
|
@@ -8426,9 +8966,9 @@ var Noydb = class {
|
|
|
8426
8966
|
if (!facade) return;
|
|
8427
8967
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
8428
8968
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
8429
|
-
const { GuardExecutor } = await import("./executor-
|
|
8969
|
+
const { GuardExecutor } = await import("./executor-VT7TKGE4.js");
|
|
8430
8970
|
for (const g of guards) {
|
|
8431
|
-
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming);
|
|
8971
|
+
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
8432
8972
|
}
|
|
8433
8973
|
});
|
|
8434
8974
|
this.subsystemBus.registerGate("beforeDelete", async (e) => {
|
|
@@ -8607,6 +9147,7 @@ var Noydb = class {
|
|
|
8607
9147
|
syncAdapter: targets.length > 0 ? targets[0].store : void 0,
|
|
8608
9148
|
historyConfig: this.options.history,
|
|
8609
9149
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
9150
|
+
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
8610
9151
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
8611
9152
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
8612
9153
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
@@ -8617,6 +9158,7 @@ var Noydb = class {
|
|
|
8617
9158
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
8618
9159
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
8619
9160
|
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
|
|
9161
|
+
...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
|
|
8620
9162
|
locale: opts?.locale,
|
|
8621
9163
|
// Thread the translator hook so Collection.put() can invoke it
|
|
8622
9164
|
plaintextTranslator: this.options.plaintextTranslator ? (text, from, to, field, collection) => this.invokeTranslator(text, from, to, field, collection) : void 0,
|
|
@@ -8660,6 +9202,7 @@ var Noydb = class {
|
|
|
8660
9202
|
emitter: this.emitter,
|
|
8661
9203
|
historyConfig: this.options.history,
|
|
8662
9204
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
9205
|
+
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
8663
9206
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
8664
9207
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
8665
9208
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
@@ -8669,7 +9212,8 @@ var Noydb = class {
|
|
|
8669
9212
|
...this.options.historyStrategy !== void 0 ? { historyStrategy: this.options.historyStrategy } : {},
|
|
8670
9213
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
8671
9214
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
8672
|
-
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {}
|
|
9215
|
+
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
|
|
9216
|
+
...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {}
|
|
8673
9217
|
});
|
|
8674
9218
|
this.vaultCache.set(name, comp2);
|
|
8675
9219
|
return comp2;
|
|
@@ -8688,6 +9232,7 @@ var Noydb = class {
|
|
|
8688
9232
|
encrypted: true,
|
|
8689
9233
|
historyConfig: this.options.history,
|
|
8690
9234
|
...this.options.blobStrategy !== void 0 ? { blobStrategy: this.options.blobStrategy } : {},
|
|
9235
|
+
...this.options.archiveStrategy !== void 0 ? { archiveStrategy: this.options.archiveStrategy } : {},
|
|
8691
9236
|
...this.options.indexStrategy !== void 0 ? { indexStrategy: this.options.indexStrategy } : {},
|
|
8692
9237
|
...this.options.aggregateStrategy !== void 0 ? { aggregateStrategy: this.options.aggregateStrategy } : {},
|
|
8693
9238
|
...this.options.crdtStrategy !== void 0 ? { crdtStrategy: this.options.crdtStrategy } : {},
|
|
@@ -8698,6 +9243,7 @@ var Noydb = class {
|
|
|
8698
9243
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
8699
9244
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
8700
9245
|
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
|
|
9246
|
+
...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
|
|
8701
9247
|
emitter: this.emitter
|
|
8702
9248
|
});
|
|
8703
9249
|
this.vaultCache.set(name, comp);
|
|
@@ -9002,6 +9548,61 @@ var Noydb = class {
|
|
|
9002
9548
|
}
|
|
9003
9549
|
return results;
|
|
9004
9550
|
}
|
|
9551
|
+
/**
|
|
9552
|
+
* Register a shard schema blueprint. `createShard` / `openVaultGroup`
|
|
9553
|
+
* stamp shards from the named template. See the MVF design spec.
|
|
9554
|
+
*/
|
|
9555
|
+
withVaultTemplate(name, template) {
|
|
9556
|
+
this.vaultTemplates.set(name, template);
|
|
9557
|
+
}
|
|
9558
|
+
/**
|
|
9559
|
+
* Open a VaultGroup — transparent routing over per-partition shard
|
|
9560
|
+
* vaults, with shard discovery backed by the supplied `vault-registry`
|
|
9561
|
+
* collection.
|
|
9562
|
+
*/
|
|
9563
|
+
async openVaultGroup(name, opts) {
|
|
9564
|
+
if (this.closed) throw new ValidationError("Instance is closed");
|
|
9565
|
+
if (name === STATE_VAULT_NAME) throw new ReservedVaultNameError(name);
|
|
9566
|
+
const template = this.vaultTemplates.get(opts.sharding.vaultTemplate);
|
|
9567
|
+
if (!template) throw new VaultTemplateNotFoundError(opts.sharding.vaultTemplate);
|
|
9568
|
+
const { VaultGroup } = await import("./vault-group-UO4YUZOG.js");
|
|
9569
|
+
const { StateManagementVault } = await import("./state-vault-QFJWU23A.js");
|
|
9570
|
+
const stateVault = opts.registry ? void 0 : await StateManagementVault.open(this);
|
|
9571
|
+
const registry = opts.registry ?? stateVault.registry;
|
|
9572
|
+
const group = new VaultGroup(this, name, registry, opts.sharding, template);
|
|
9573
|
+
if (stateVault) {
|
|
9574
|
+
group._attachStateVault(stateVault);
|
|
9575
|
+
await stateVault.recordManifest(opts.sharding.vaultTemplate, template);
|
|
9576
|
+
try {
|
|
9577
|
+
await stateVault.appendEvent({
|
|
9578
|
+
type: "manifest-recorded",
|
|
9579
|
+
group: name,
|
|
9580
|
+
templateName: opts.sharding.vaultTemplate,
|
|
9581
|
+
version: template.version
|
|
9582
|
+
});
|
|
9583
|
+
await stateVault.appendEvent({ type: "group-opened", group: name });
|
|
9584
|
+
} catch {
|
|
9585
|
+
}
|
|
9586
|
+
}
|
|
9587
|
+
return group;
|
|
9588
|
+
}
|
|
9589
|
+
/**
|
|
9590
|
+
* Open the reserved StateManagement control-plane vault (registry +
|
|
9591
|
+
* schema-manifest + deployment-events). Lazy-loaded so the federation
|
|
9592
|
+
* chunk stays out of the core graph until used.
|
|
9593
|
+
*/
|
|
9594
|
+
async openStateManagementVault() {
|
|
9595
|
+
if (this.closed) throw new ValidationError("Instance is closed");
|
|
9596
|
+
const { StateManagementVault } = await import("./state-vault-QFJWU23A.js");
|
|
9597
|
+
return StateManagementVault.open(this);
|
|
9598
|
+
}
|
|
9599
|
+
/**
|
|
9600
|
+
* @internal — true when an encrypted shard vault is provisioned
|
|
9601
|
+
* (its keyring exists in the store).
|
|
9602
|
+
*/
|
|
9603
|
+
async _shardVaultProvisioned(vaultId) {
|
|
9604
|
+
return (await this.options.store.list(vaultId, "_keyring")).length > 0;
|
|
9605
|
+
}
|
|
9005
9606
|
/**
|
|
9006
9607
|
* Change the current user's passphrase for a vault.
|
|
9007
9608
|
*
|
|
@@ -10493,6 +11094,8 @@ function normalizeSyncTargets(sync) {
|
|
|
10493
11094
|
}
|
|
10494
11095
|
|
|
10495
11096
|
export {
|
|
11097
|
+
withArchive,
|
|
11098
|
+
SequenceStore,
|
|
10496
11099
|
validateSchemaInput,
|
|
10497
11100
|
validateSchemaOutput,
|
|
10498
11101
|
isZodSchema,
|
|
@@ -10512,6 +11115,8 @@ export {
|
|
|
10512
11115
|
diagramAuthConfig,
|
|
10513
11116
|
describeUserAuth,
|
|
10514
11117
|
describeAllUsersAuth,
|
|
11118
|
+
ComputedFieldError,
|
|
11119
|
+
evalComputedFields,
|
|
10515
11120
|
Lru,
|
|
10516
11121
|
parseBytes,
|
|
10517
11122
|
estimateRecordBytes,
|
|
@@ -10528,4 +11133,4 @@ export {
|
|
|
10528
11133
|
Noydb,
|
|
10529
11134
|
createNoydb
|
|
10530
11135
|
};
|
|
10531
|
-
//# sourceMappingURL=chunk-
|
|
11136
|
+
//# sourceMappingURL=chunk-P5MW7BG2.js.map
|