@noy-db/hub 0.2.0-pre.12 → 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/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 +2 -2
- 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.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 +551 -32
- 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-P3Z5Y2TS.js → chunk-3OUCWHV6.js} +2 -2
- package/dist/{chunk-4BHFNKTP.js → chunk-3XZRRBFW.js} +2 -2
- package/dist/{chunk-XSIFXX54.js → chunk-4VCQH32J.js} +2 -2
- package/dist/{chunk-CHBXWJZQ.js → chunk-4YDZ7JPZ.js} +2 -2
- package/dist/{chunk-B7GGYNKQ.js → chunk-5NISHSBO.js} +2 -2
- package/dist/{chunk-O53RIZCC.js → chunk-7TEI2K2A.js} +5 -5
- package/dist/{chunk-ZCFS7U4J.js → chunk-AYNF7PVX.js} +2 -2
- package/dist/{chunk-GFPR7VJS.js → chunk-C3WRKABE.js} +4 -4
- package/dist/{chunk-EKNUBIIQ.js → chunk-CWFQTAD4.js} +4 -4
- package/dist/{chunk-P4EDT5ZP.js → chunk-D5Y3HIC6.js} +2 -2
- package/dist/{chunk-IUBHXEPJ.js → chunk-E3DIBDKA.js} +2 -2
- package/dist/{chunk-WNRGOVLG.js → chunk-FNVFT4HZ.js} +2 -2
- package/dist/{chunk-LYNNZEQD.js → chunk-GC4V7RU7.js} +1 -1
- package/dist/chunk-GC4V7RU7.js.map +1 -0
- package/dist/{chunk-5ARRXIVR.js → chunk-GL3Z7LH7.js} +2 -2
- package/dist/{chunk-WUG3E423.js → chunk-GZJ5JBED.js} +4 -4
- package/dist/{chunk-XHM2SARW.js → chunk-HHZ77DHM.js} +3 -3
- package/dist/{chunk-SJJQKNMP.js → chunk-HQXOEWLZ.js} +4 -4
- package/dist/{chunk-CILT6V3V.js → chunk-ILWQGTNH.js} +2 -2
- package/dist/{chunk-RRDWXNBQ.js → chunk-J67BP5EP.js} +3 -3
- package/dist/{chunk-HLGDYFWR.js → chunk-JPOQMXGT.js} +2 -2
- package/dist/{chunk-IEPT7HVP.js → chunk-JWFNOD2T.js} +2 -2
- package/dist/{chunk-BXOUVUES.js → chunk-KHQ3N5AB.js} +4 -4
- package/dist/{chunk-UA6G45ME.js → chunk-KJF7EPUE.js} +3 -3
- package/dist/{chunk-C2CIIQRG.js → chunk-KKB42D3Q.js} +2 -2
- package/dist/{chunk-M45IRXDM.js → chunk-M6KXHRIA.js} +3 -3
- package/dist/{chunk-VOXMU6LB.js → chunk-NIUXQDWD.js} +2 -2
- package/dist/{chunk-UOC7JMZO.js → chunk-NJMKHRQI.js} +135 -10
- package/dist/chunk-NJMKHRQI.js.map +1 -0
- package/dist/{chunk-AGRC7NQQ.js → chunk-NKGY3C53.js} +26 -1
- package/dist/chunk-NKGY3C53.js.map +1 -0
- package/dist/{chunk-LWSD4QPT.js → chunk-O2JW656W.js} +3 -3
- package/dist/{chunk-TMHJEYW7.js → chunk-P5MW7BG2.js} +302 -137
- package/dist/chunk-P5MW7BG2.js.map +1 -0
- package/dist/{chunk-LSEW3ZZ2.js → chunk-PW26DAXS.js} +3 -3
- package/dist/{chunk-HBAJDI2N.js → chunk-QAWCVWCX.js} +5 -5
- package/dist/{chunk-L6BYRCYB.js → chunk-QFYVGJLI.js} +2 -2
- package/dist/{chunk-6BYBVRZU.js → chunk-QIVFGU2M.js} +3 -3
- package/dist/{chunk-ZC7MNVYN.js → chunk-SJ24GHID.js} +2 -2
- package/dist/{chunk-SZ4N3IL5.js → chunk-SOU42FGB.js} +5 -5
- package/dist/{chunk-DLTU4M2I.js → chunk-SYSKC237.js} +6 -6
- package/dist/{chunk-6AD5TBF2.js → chunk-TDECYU4Y.js} +3 -3
- package/dist/{chunk-7JJE3OMJ.js → chunk-TEQGXA7L.js} +5 -5
- package/dist/{chunk-RHQYVHFH.js → chunk-UNQEWORI.js} +2 -2
- package/dist/{chunk-LOA2VCMS.js → chunk-VAK6NQAK.js} +5 -5
- package/dist/{chunk-7LVRIW4G.js → chunk-WQKZIQIL.js} +4 -4
- package/dist/{chunk-OPDTLHFA.js → chunk-YWBHS25M.js} +2 -2
- 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-AJB72OKN.js → crypto-YXH6SAOW.js} +3 -3
- package/dist/{delegation-6FCWDRUS.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-D3mpVFRc.d.ts → dev-unlock-BW0GNBEV.d.ts} +1 -1
- package/dist/{dev-unlock-ckqa_Nso.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-ZSKEQ6NI.js → fanout-sidecar-N6OJX6QR.js} +2 -2
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +5 -5
- package/dist/guards/index.d.ts +5 -5
- package/dist/guards/index.js +3 -3
- package/dist/{hash-rDSSd_oW.d.cts → hash-B0cLQcq_.d.cts} +1 -1
- package/dist/{hash-CTZVkXLx.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-DyD0qg2k.d.ts → immutable-guard-B0h-ipLz.d.ts} +1 -1
- package/dist/{immutable-guard-C51vAHuh.d.cts → immutable-guard-BZIcYhYX.d.cts} +1 -1
- package/dist/{index-Cmop06zJ.d.cts → index-CUVOMtgg.d.cts} +28 -2
- package/dist/{index-CkFHr4OP.d.ts → index-Cqzp4tt9.d.ts} +28 -2
- package/dist/index.cjs +567 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -13
- package/dist/index.d.ts +22 -13
- package/dist/index.js +59 -40
- 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-5JMVF7PY.js → ledger-64TTQMRS.js} +5 -5
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +5 -5
- package/dist/materialized-views/index.d.ts +5 -5
- 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-PFLZI5MO.js → public-envelope-MHG6YVXW.js} +4 -4
- package/dist/query/index.cjs +89 -7
- 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 +3 -3
- package/dist/registry-2PKBQDCH.js +8 -0
- package/dist/registry-4VXFKCBJ.js +8 -0
- package/dist/{registry-NCY445U5.js → registry-PV4G3OPA.js} +3 -3
- package/dist/{revoke-7RLGQWZ7.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-6JF44I4A.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-UBLP3RJ3.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-rtpKDfTC.d.ts → strategy-CrS7PnbE.d.cts} +20 -1
- package/dist/{strategy-rtpKDfTC.d.cts → strategy-CrS7PnbE.d.ts} +20 -1
- 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.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-BGwjsDef.d.cts → types-CDwSSXiI.d.cts} +290 -92
- package/dist/{types-DRdfwgTG.d.ts → types-pax34sec.d.ts} +290 -92
- package/dist/{ulid-D4d0Xto3.d.cts → ulid-7bCSgIgb.d.cts} +1 -1
- package/dist/{ulid-DOTPZ5_h.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-Z4KB75ZH.js → vault-group-UO4YUZOG.js} +53 -10
- package/dist/vault-group-UO4YUZOG.js.map +1 -0
- package/dist/{with-derivation-B082Y_WQ.d.ts → with-derivation-BjdOxUBn.d.ts} +1 -1
- package/dist/{with-derivation-CB1EdcFF.d.cts → with-derivation-D8wFlb6V.d.cts} +1 -1
- package/dist/{with-materialized-view-CzRg1Dpr.d.cts → with-materialized-view-5QMF1rS_.d.cts} +1 -1
- package/dist/{with-materialized-view-Dw4SwjKl.d.ts → with-materialized-view-DJb-HO65.d.ts} +1 -1
- package/dist/{with-overlayed-view-CaCXeW26.d.ts → with-overlayed-view-CkqTefbz.d.ts} +1 -1
- package/dist/{with-overlayed-view-C9YFKXzn.d.cts → with-overlayed-view-DDNflPvC.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-AGRC7NQQ.js.map +0 -1
- package/dist/chunk-LYNNZEQD.js.map +0 -1
- package/dist/chunk-TMHJEYW7.js.map +0 -1
- package/dist/chunk-UOC7JMZO.js.map +0 -1
- package/dist/executor-7KSCEIFA.js +0 -8
- package/dist/executor-D2QMNGRJ.js +0 -8
- package/dist/executor-O5AZK7UW.js +0 -11
- package/dist/issue-YIYG4OW5.js +0 -12
- package/dist/noydb-D5SLAJ6V.js +0 -34
- package/dist/registry-BVQ5ITMF.js +0 -8
- package/dist/registry-JLP3QOLD.js +0 -8
- package/dist/vault-group-Z4KB75ZH.js.map +0 -1
- /package/dist/{chunk-P3Z5Y2TS.js.map → chunk-3OUCWHV6.js.map} +0 -0
- /package/dist/{chunk-4BHFNKTP.js.map → chunk-3XZRRBFW.js.map} +0 -0
- /package/dist/{chunk-XSIFXX54.js.map → chunk-4VCQH32J.js.map} +0 -0
- /package/dist/{chunk-CHBXWJZQ.js.map → chunk-4YDZ7JPZ.js.map} +0 -0
- /package/dist/{chunk-B7GGYNKQ.js.map → chunk-5NISHSBO.js.map} +0 -0
- /package/dist/{chunk-O53RIZCC.js.map → chunk-7TEI2K2A.js.map} +0 -0
- /package/dist/{chunk-ZCFS7U4J.js.map → chunk-AYNF7PVX.js.map} +0 -0
- /package/dist/{chunk-GFPR7VJS.js.map → chunk-C3WRKABE.js.map} +0 -0
- /package/dist/{chunk-EKNUBIIQ.js.map → chunk-CWFQTAD4.js.map} +0 -0
- /package/dist/{chunk-P4EDT5ZP.js.map → chunk-D5Y3HIC6.js.map} +0 -0
- /package/dist/{chunk-IUBHXEPJ.js.map → chunk-E3DIBDKA.js.map} +0 -0
- /package/dist/{chunk-WNRGOVLG.js.map → chunk-FNVFT4HZ.js.map} +0 -0
- /package/dist/{chunk-5ARRXIVR.js.map → chunk-GL3Z7LH7.js.map} +0 -0
- /package/dist/{chunk-WUG3E423.js.map → chunk-GZJ5JBED.js.map} +0 -0
- /package/dist/{chunk-XHM2SARW.js.map → chunk-HHZ77DHM.js.map} +0 -0
- /package/dist/{chunk-SJJQKNMP.js.map → chunk-HQXOEWLZ.js.map} +0 -0
- /package/dist/{chunk-CILT6V3V.js.map → chunk-ILWQGTNH.js.map} +0 -0
- /package/dist/{chunk-RRDWXNBQ.js.map → chunk-J67BP5EP.js.map} +0 -0
- /package/dist/{chunk-HLGDYFWR.js.map → chunk-JPOQMXGT.js.map} +0 -0
- /package/dist/{chunk-IEPT7HVP.js.map → chunk-JWFNOD2T.js.map} +0 -0
- /package/dist/{chunk-BXOUVUES.js.map → chunk-KHQ3N5AB.js.map} +0 -0
- /package/dist/{chunk-UA6G45ME.js.map → chunk-KJF7EPUE.js.map} +0 -0
- /package/dist/{chunk-C2CIIQRG.js.map → chunk-KKB42D3Q.js.map} +0 -0
- /package/dist/{chunk-M45IRXDM.js.map → chunk-M6KXHRIA.js.map} +0 -0
- /package/dist/{chunk-VOXMU6LB.js.map → chunk-NIUXQDWD.js.map} +0 -0
- /package/dist/{chunk-LWSD4QPT.js.map → chunk-O2JW656W.js.map} +0 -0
- /package/dist/{chunk-LSEW3ZZ2.js.map → chunk-PW26DAXS.js.map} +0 -0
- /package/dist/{chunk-HBAJDI2N.js.map → chunk-QAWCVWCX.js.map} +0 -0
- /package/dist/{chunk-L6BYRCYB.js.map → chunk-QFYVGJLI.js.map} +0 -0
- /package/dist/{chunk-6BYBVRZU.js.map → chunk-QIVFGU2M.js.map} +0 -0
- /package/dist/{chunk-ZC7MNVYN.js.map → chunk-SJ24GHID.js.map} +0 -0
- /package/dist/{chunk-SZ4N3IL5.js.map → chunk-SOU42FGB.js.map} +0 -0
- /package/dist/{chunk-DLTU4M2I.js.map → chunk-SYSKC237.js.map} +0 -0
- /package/dist/{chunk-6AD5TBF2.js.map → chunk-TDECYU4Y.js.map} +0 -0
- /package/dist/{chunk-7JJE3OMJ.js.map → chunk-TEQGXA7L.js.map} +0 -0
- /package/dist/{chunk-RHQYVHFH.js.map → chunk-UNQEWORI.js.map} +0 -0
- /package/dist/{chunk-LOA2VCMS.js.map → chunk-VAK6NQAK.js.map} +0 -0
- /package/dist/{chunk-7LVRIW4G.js.map → chunk-WQKZIQIL.js.map} +0 -0
- /package/dist/{chunk-OPDTLHFA.js.map → chunk-YWBHS25M.js.map} +0 -0
- /package/dist/{crypto-AJB72OKN.js.map → crypto-YXH6SAOW.js.map} +0 -0
- /package/dist/{delegation-6FCWDRUS.js.map → delegation-K5ERUH6A.js.map} +0 -0
- /package/dist/{executor-7KSCEIFA.js.map → executor-AVJ7UEWA.js.map} +0 -0
- /package/dist/{executor-D2QMNGRJ.js.map → executor-IQO3KGXQ.js.map} +0 -0
- /package/dist/{executor-O5AZK7UW.js.map → executor-VT7TKGE4.js.map} +0 -0
- /package/dist/{fanout-sidecar-ZSKEQ6NI.js.map → fanout-sidecar-N6OJX6QR.js.map} +0 -0
- /package/dist/{issue-YIYG4OW5.js.map → issue-ZH27C23Y.js.map} +0 -0
- /package/dist/{ledger-5JMVF7PY.js.map → ledger-64TTQMRS.js.map} +0 -0
- /package/dist/{noydb-D5SLAJ6V.js.map → noydb-O76SKBST.js.map} +0 -0
- /package/dist/{public-envelope-PFLZI5MO.js.map → public-envelope-MHG6YVXW.js.map} +0 -0
- /package/dist/{registry-BVQ5ITMF.js.map → registry-2PKBQDCH.js.map} +0 -0
- /package/dist/{registry-JLP3QOLD.js.map → registry-4VXFKCBJ.js.map} +0 -0
- /package/dist/{registry-NCY445U5.js.map → registry-PV4G3OPA.js.map} +0 -0
- /package/dist/{revoke-7RLGQWZ7.js.map → revoke-5BOLVJ3N.js.map} +0 -0
- /package/dist/{signer-6JF44I4A.js.map → signer-GRIYBA22.js.map} +0 -0
- /package/dist/{stale-UBLP3RJ3.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,21 +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
|
-
|
|
109
|
-
|
|
110
|
-
formatScaledInt,
|
|
111
|
-
parseToScaledInt
|
|
112
|
-
} from "./chunk-OPDTLHFA.js";
|
|
113
|
+
canonicalGroupKey
|
|
114
|
+
} from "./chunk-YWBHS25M.js";
|
|
113
115
|
import {
|
|
114
116
|
readPath
|
|
115
117
|
} from "./chunk-TV3YZ35S.js";
|
|
@@ -117,17 +119,17 @@ import {
|
|
|
117
119
|
EXPORT_AUDIT_COLLECTION,
|
|
118
120
|
createExportBlobsHandle,
|
|
119
121
|
runCompaction
|
|
120
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-TDECYU4Y.js";
|
|
121
123
|
import {
|
|
122
124
|
NOYDB_BACKUP_VERSION,
|
|
123
125
|
NOYDB_FORMAT_VERSION
|
|
124
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-GC4V7RU7.js";
|
|
125
127
|
import {
|
|
126
128
|
decrypt,
|
|
127
129
|
encrypt,
|
|
128
130
|
encryptDeterministic,
|
|
129
131
|
sha256Hex
|
|
130
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-E3DIBDKA.js";
|
|
131
133
|
import {
|
|
132
134
|
AlreadyElevatedError,
|
|
133
135
|
AttestationError,
|
|
@@ -144,10 +146,12 @@ import {
|
|
|
144
146
|
MigrationRequiredError,
|
|
145
147
|
NoAccessError,
|
|
146
148
|
NoydbError,
|
|
149
|
+
NumberingUncertaintyError,
|
|
147
150
|
PermissionDeniedError,
|
|
148
151
|
QuiesceTimeoutError,
|
|
149
152
|
ReadOnlyError,
|
|
150
153
|
ReservedCollectionNameError,
|
|
154
|
+
ReservedVaultNameError,
|
|
151
155
|
SchemaFenceError,
|
|
152
156
|
SchemaValidationError,
|
|
153
157
|
SequenceContentionError,
|
|
@@ -160,7 +164,7 @@ import {
|
|
|
160
164
|
UnsupportedIndexOptionError,
|
|
161
165
|
ValidationError,
|
|
162
166
|
VaultTemplateNotFoundError
|
|
163
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-NKGY3C53.js";
|
|
164
168
|
|
|
165
169
|
// src/policy/storage.ts
|
|
166
170
|
var META_COLLECTION = "_meta";
|
|
@@ -335,88 +339,6 @@ var NO_CRDT = {
|
|
|
335
339
|
}
|
|
336
340
|
};
|
|
337
341
|
|
|
338
|
-
// src/money/normalize.ts
|
|
339
|
-
function isMoneyValueObject(v) {
|
|
340
|
-
return typeof v === "object" && v !== null && "currency" in v;
|
|
341
|
-
}
|
|
342
|
-
function quantizeAmount(field, input, scale, rounding) {
|
|
343
|
-
const r = parseToScaledInt(input, scale, rounding);
|
|
344
|
-
if (!r.ok) {
|
|
345
|
-
if (r.reason === "precision") throw new MoneyPrecisionError(field, input, scale);
|
|
346
|
-
throw new TypeError(`money: field "${field}" value ${JSON.stringify(input)} is not a finite decimal`);
|
|
347
|
-
}
|
|
348
|
-
return r.value.toString();
|
|
349
|
-
}
|
|
350
|
-
function quantizeMoneyFields(record, moneyFields) {
|
|
351
|
-
const out = { ...record };
|
|
352
|
-
for (const [field, desc] of Object.entries(moneyFields)) {
|
|
353
|
-
const raw = out[field];
|
|
354
|
-
if (raw === null || raw === void 0) continue;
|
|
355
|
-
if (desc.mode === "fixed") {
|
|
356
|
-
const currency2 = desc.fixedCurrency;
|
|
357
|
-
out[field] = quantizeAmount(field, raw, desc.scaleFor(currency2), desc.rounding);
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
let amount;
|
|
361
|
-
let currency;
|
|
362
|
-
if (isMoneyValueObject(raw)) {
|
|
363
|
-
currency = String(raw.currency);
|
|
364
|
-
amount = raw.amount;
|
|
365
|
-
} else {
|
|
366
|
-
const sole = desc.soleCurrency();
|
|
367
|
-
if (sole === void 0) {
|
|
368
|
-
throw new TypeError(
|
|
369
|
-
`money: field "${field}" is multi-currency \u2014 write { amount, currency }, not a bare amount`
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
currency = sole;
|
|
373
|
-
amount = raw;
|
|
374
|
-
}
|
|
375
|
-
const scale = desc.scaleFor(currency);
|
|
376
|
-
out[field] = { amount: quantizeAmount(field, amount, scale, desc.rounding), currency };
|
|
377
|
-
}
|
|
378
|
-
return out;
|
|
379
|
-
}
|
|
380
|
-
function formatCurrency(decimal, currency, scale, locale) {
|
|
381
|
-
const fmt = new Intl.NumberFormat(locale, {
|
|
382
|
-
style: "currency",
|
|
383
|
-
currency,
|
|
384
|
-
minimumFractionDigits: scale,
|
|
385
|
-
maximumFractionDigits: scale
|
|
386
|
-
});
|
|
387
|
-
return fmt.format(decimal);
|
|
388
|
-
}
|
|
389
|
-
function decodeMoneyFields(record, moneyFields, locale) {
|
|
390
|
-
const out = { ...record };
|
|
391
|
-
const format = locale !== "raw";
|
|
392
|
-
const fmtLocale = typeof locale === "string" && locale !== "raw" ? locale : "en-US";
|
|
393
|
-
for (const [field, desc] of Object.entries(moneyFields)) {
|
|
394
|
-
const stored = out[field];
|
|
395
|
-
if (stored === null || stored === void 0) continue;
|
|
396
|
-
let currency;
|
|
397
|
-
let scaledIntString;
|
|
398
|
-
if (desc.mode === "fixed") {
|
|
399
|
-
if (typeof stored !== "string" && typeof stored !== "number") continue;
|
|
400
|
-
currency = desc.fixedCurrency;
|
|
401
|
-
scaledIntString = String(stored);
|
|
402
|
-
} else {
|
|
403
|
-
if (!isMoneyValueObject(stored)) continue;
|
|
404
|
-
const amount = stored.amount;
|
|
405
|
-
if (typeof stored.currency !== "string" || typeof amount !== "string" && typeof amount !== "number") continue;
|
|
406
|
-
currency = stored.currency;
|
|
407
|
-
scaledIntString = String(amount);
|
|
408
|
-
}
|
|
409
|
-
const scale = desc.scaleFor(currency);
|
|
410
|
-
const decimal = formatScaledInt(BigInt(scaledIntString), scale);
|
|
411
|
-
out[field] = desc.mode === "fixed" ? decimal : { amount: decimal, currency };
|
|
412
|
-
if (format) {
|
|
413
|
-
out[`${field}Formatted`] = formatCurrency(decimal, currency, scale, fmtLocale);
|
|
414
|
-
out[`${field}Number`] = Number(decimal);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
return out;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
342
|
// src/computed/index.ts
|
|
421
343
|
var ComputedFieldError = class extends NoydbError {
|
|
422
344
|
constructor(field, id, cause) {
|
|
@@ -885,7 +807,7 @@ async function resolveStaleOnRead(accessor, outputCollection, id) {
|
|
|
885
807
|
}
|
|
886
808
|
const sourceWithId = { ...source, id };
|
|
887
809
|
if (DerivationExecutor === null) {
|
|
888
|
-
({ DerivationExecutor } = await import("./executor-
|
|
810
|
+
({ DerivationExecutor } = await import("./executor-AVJ7UEWA.js"));
|
|
889
811
|
}
|
|
890
812
|
const ctx = { vault: accessor.getReadOnlyFacade() };
|
|
891
813
|
const result = await DerivationExecutor.run(spec, sourceWithId, 0, strategyHash, ctx);
|
|
@@ -1391,7 +1313,7 @@ var Collection = class {
|
|
|
1391
1313
|
}
|
|
1392
1314
|
}
|
|
1393
1315
|
if (this.materializedViewSource !== void 0) {
|
|
1394
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
1316
|
+
const { resolveStaleMVOnRead } = await import("./stale-LZYMMDDS.js");
|
|
1395
1317
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
1396
1318
|
}
|
|
1397
1319
|
let record;
|
|
@@ -1788,7 +1710,7 @@ var Collection = class {
|
|
|
1788
1710
|
if (mode === "eager") {
|
|
1789
1711
|
if (executor === null) {
|
|
1790
1712
|
;
|
|
1791
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
1713
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-IQO3KGXQ.js"));
|
|
1792
1714
|
}
|
|
1793
1715
|
await executor.refresh(reg, {
|
|
1794
1716
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -1797,7 +1719,7 @@ var Collection = class {
|
|
|
1797
1719
|
});
|
|
1798
1720
|
} else if (mode === "lazy") {
|
|
1799
1721
|
if (staleHelpers === null) {
|
|
1800
|
-
staleHelpers = await import("./stale-
|
|
1722
|
+
staleHelpers = await import("./stale-LZYMMDDS.js");
|
|
1801
1723
|
}
|
|
1802
1724
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
1803
1725
|
}
|
|
@@ -1826,7 +1748,7 @@ var Collection = class {
|
|
|
1826
1748
|
const mode = typeof spec.lifecycle === "string" ? spec.lifecycle : spec.lifecycle.mode;
|
|
1827
1749
|
if (mode === "eager") {
|
|
1828
1750
|
if (DerivationExecutor === null) {
|
|
1829
|
-
({ DerivationExecutor } = await import("./executor-
|
|
1751
|
+
({ DerivationExecutor } = await import("./executor-AVJ7UEWA.js"));
|
|
1830
1752
|
}
|
|
1831
1753
|
const sourceWithId = { ...incoming, id };
|
|
1832
1754
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
@@ -1845,7 +1767,7 @@ var Collection = class {
|
|
|
1845
1767
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
1846
1768
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
1847
1769
|
if (out.kind === "array") {
|
|
1848
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
1770
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
1849
1771
|
const prior = await loadFanoutSidecar(
|
|
1850
1772
|
this.adapter,
|
|
1851
1773
|
this.vault,
|
|
@@ -2138,7 +2060,7 @@ var Collection = class {
|
|
|
2138
2060
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
2139
2061
|
if (outSpec.shape !== "array") continue;
|
|
2140
2062
|
if (helpers === null) {
|
|
2141
|
-
helpers = await import("./fanout-sidecar-
|
|
2063
|
+
helpers = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
2142
2064
|
}
|
|
2143
2065
|
const sidecar = await helpers.loadFanoutSidecar(
|
|
2144
2066
|
this.adapter,
|
|
@@ -2178,7 +2100,7 @@ var Collection = class {
|
|
|
2178
2100
|
if (mode === "eager") {
|
|
2179
2101
|
if (executor === null) {
|
|
2180
2102
|
;
|
|
2181
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2103
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-IQO3KGXQ.js"));
|
|
2182
2104
|
}
|
|
2183
2105
|
await executor.refresh(reg, {
|
|
2184
2106
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -2187,7 +2109,7 @@ var Collection = class {
|
|
|
2187
2109
|
});
|
|
2188
2110
|
} else if (mode === "lazy") {
|
|
2189
2111
|
if (staleHelpers === null) {
|
|
2190
|
-
staleHelpers = await import("./stale-
|
|
2112
|
+
staleHelpers = await import("./stale-LZYMMDDS.js");
|
|
2191
2113
|
}
|
|
2192
2114
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
2193
2115
|
}
|
|
@@ -2210,14 +2132,22 @@ var Collection = class {
|
|
|
2210
2132
|
);
|
|
2211
2133
|
}
|
|
2212
2134
|
if (this.materializedViewSource !== void 0) {
|
|
2213
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2135
|
+
const { resolveStaleMVOnRead } = await import("./stale-LZYMMDDS.js");
|
|
2214
2136
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2215
2137
|
}
|
|
2216
2138
|
await this.ensureHydrated();
|
|
2217
2139
|
const records = [...this.cache.values()].map((e) => e.record);
|
|
2218
|
-
if (!
|
|
2140
|
+
if (!this.hasReadTransforms()) return records;
|
|
2219
2141
|
return Promise.all(records.map((r) => this.applyLocaleToRecord(r, locale)));
|
|
2220
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
|
+
}
|
|
2221
2151
|
// ─── Bulk operations ─────────────────────────────────────
|
|
2222
2152
|
/**
|
|
2223
2153
|
* Put many records in one call. Each item is processed sequentially
|
|
@@ -2723,7 +2653,8 @@ var Collection = class {
|
|
|
2723
2653
|
pageSize,
|
|
2724
2654
|
[],
|
|
2725
2655
|
[],
|
|
2726
|
-
joinContext
|
|
2656
|
+
joinContext,
|
|
2657
|
+
this.moneyFields
|
|
2727
2658
|
);
|
|
2728
2659
|
}
|
|
2729
2660
|
/** Decrypt a page of envelopes returned by `adapter.listPage`. */
|
|
@@ -3931,6 +3862,159 @@ var SequenceStore = class {
|
|
|
3931
3862
|
}
|
|
3932
3863
|
};
|
|
3933
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
|
+
|
|
3934
4018
|
// src/shadow/strategy.ts
|
|
3935
4019
|
var NOT_ENABLED2 = new Error(
|
|
3936
4020
|
'VaultFrame requires the shadow strategy. Import `{ withShadow }` from "@noy-db/hub/shadow" and pass it to `createNoydb({ shadowStrategy: withShadow() })`.'
|
|
@@ -5150,6 +5234,10 @@ var Vault = class {
|
|
|
5150
5234
|
ledgerStore = null;
|
|
5151
5235
|
/** Lazily-built atomic-sequence store. See {@link sequence}. */
|
|
5152
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;
|
|
5153
5241
|
/**
|
|
5154
5242
|
* Background writes for persisted-schema envelopes (#schema-dump v0
|
|
5155
5243
|
* slice 1). One promise per `collection({ persistJsonSchema: true })`
|
|
@@ -5236,6 +5324,7 @@ var Vault = class {
|
|
|
5236
5324
|
constructor(opts) {
|
|
5237
5325
|
this.adapter = opts.adapter;
|
|
5238
5326
|
this.name = opts.name;
|
|
5327
|
+
this.numberingConfigs = new Map((opts.numberingConfigs ?? []).map((c) => [c.series, c]));
|
|
5239
5328
|
this.noydb = opts.noydb;
|
|
5240
5329
|
this.keyring = opts.keyring;
|
|
5241
5330
|
this.encrypted = opts.encrypted;
|
|
@@ -5910,6 +5999,18 @@ var Vault = class {
|
|
|
5910
5999
|
* ```
|
|
5911
6000
|
*/
|
|
5912
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
|
+
}
|
|
5913
6014
|
if (!this.sequenceStore) {
|
|
5914
6015
|
this.sequenceStore = new SequenceStore({
|
|
5915
6016
|
adapter: this.adapter,
|
|
@@ -5921,6 +6022,38 @@ var Vault = class {
|
|
|
5921
6022
|
}
|
|
5922
6023
|
return this.sequenceStore.handle(name);
|
|
5923
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
|
+
}
|
|
5924
6057
|
async compact(options = {}) {
|
|
5925
6058
|
return runCompaction({
|
|
5926
6059
|
adapter: this.adapter,
|
|
@@ -6002,12 +6135,12 @@ var Vault = class {
|
|
|
6002
6135
|
if (!fieldSchema) {
|
|
6003
6136
|
throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
|
|
6004
6137
|
}
|
|
6005
|
-
const { issueAttestationCore } = await import("./issue-
|
|
6138
|
+
const { issueAttestationCore } = await import("./issue-ZH27C23Y.js");
|
|
6006
6139
|
const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
|
|
6007
6140
|
return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
|
|
6008
6141
|
}
|
|
6009
6142
|
async getDocumentSigningPublicKey() {
|
|
6010
|
-
const { loadSigner, loadOrCreateSigner } = await import("./signer-
|
|
6143
|
+
const { loadSigner, loadOrCreateSigner } = await import("./signer-GRIYBA22.js");
|
|
6011
6144
|
const existing = await loadSigner(this.adapter, this.name, this.getDEK);
|
|
6012
6145
|
if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
|
|
6013
6146
|
if (this.keyring.role !== "owner") {
|
|
@@ -6033,19 +6166,19 @@ var Vault = class {
|
|
|
6033
6166
|
};
|
|
6034
6167
|
}
|
|
6035
6168
|
async revokeAttestation(docId) {
|
|
6036
|
-
const { revokeDocCore } = await import("./revoke-
|
|
6169
|
+
const { revokeDocCore } = await import("./revoke-5BOLVJ3N.js");
|
|
6037
6170
|
await revokeDocCore(this.makeRevokeContext(), docId);
|
|
6038
6171
|
}
|
|
6039
6172
|
async unrevokeAttestation(docId) {
|
|
6040
|
-
const { unrevokeDocCore } = await import("./revoke-
|
|
6173
|
+
const { unrevokeDocCore } = await import("./revoke-5BOLVJ3N.js");
|
|
6041
6174
|
await unrevokeDocCore(this.makeRevokeContext(), docId);
|
|
6042
6175
|
}
|
|
6043
6176
|
async getRevokedDocIds() {
|
|
6044
|
-
const { getRevokedDocIdsCore } = await import("./revoke-
|
|
6177
|
+
const { getRevokedDocIdsCore } = await import("./revoke-5BOLVJ3N.js");
|
|
6045
6178
|
return getRevokedDocIdsCore(this.makeRevokeContext());
|
|
6046
6179
|
}
|
|
6047
6180
|
async publishRevocationList() {
|
|
6048
|
-
const { publishRevocationListCore } = await import("./revoke-
|
|
6181
|
+
const { publishRevocationListCore } = await import("./revoke-5BOLVJ3N.js");
|
|
6049
6182
|
return publishRevocationListCore(this.makeRevokeContext());
|
|
6050
6183
|
}
|
|
6051
6184
|
makeRevokeContext() {
|
|
@@ -6362,7 +6495,7 @@ var Vault = class {
|
|
|
6362
6495
|
async _initDerivations(handles) {
|
|
6363
6496
|
if (handles.length === 0) return;
|
|
6364
6497
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
6365
|
-
import("./registry-
|
|
6498
|
+
import("./registry-2PKBQDCH.js"),
|
|
6366
6499
|
import("./read-only-facade-ITU6L7BL.js")
|
|
6367
6500
|
]);
|
|
6368
6501
|
const registry = new DerivationRegistry();
|
|
@@ -6393,7 +6526,7 @@ var Vault = class {
|
|
|
6393
6526
|
*/
|
|
6394
6527
|
async _initMaterializedViews(handles) {
|
|
6395
6528
|
if (handles.length === 0) return;
|
|
6396
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
6529
|
+
const { MaterializedViewRegistry } = await import("./registry-PV4G3OPA.js");
|
|
6397
6530
|
const registry = new MaterializedViewRegistry();
|
|
6398
6531
|
this.materializedViewRegistry = registry;
|
|
6399
6532
|
const db = this;
|
|
@@ -6417,7 +6550,7 @@ var Vault = class {
|
|
|
6417
6550
|
*/
|
|
6418
6551
|
async _initOverlayedViews(handles) {
|
|
6419
6552
|
if (handles.length === 0) return;
|
|
6420
|
-
const { OverlayedViewRegistry } = await import("./registry-
|
|
6553
|
+
const { OverlayedViewRegistry } = await import("./registry-4VXFKCBJ.js");
|
|
6421
6554
|
const registry = new OverlayedViewRegistry();
|
|
6422
6555
|
const mvRegistry = this.materializedViewRegistry;
|
|
6423
6556
|
const overlayNames = /* @__PURE__ */ new Set();
|
|
@@ -6464,13 +6597,13 @@ var Vault = class {
|
|
|
6464
6597
|
if (!reg) {
|
|
6465
6598
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
6466
6599
|
}
|
|
6467
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
6600
|
+
const { MaterializedViewExecutor } = await import("./executor-IQO3KGXQ.js");
|
|
6468
6601
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
6469
6602
|
getCollection: (n) => this.collection(n),
|
|
6470
6603
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
6471
6604
|
getQueryContext: () => this
|
|
6472
6605
|
});
|
|
6473
|
-
const { clearMVStale } = await import("./stale-
|
|
6606
|
+
const { clearMVStale } = await import("./stale-LZYMMDDS.js");
|
|
6474
6607
|
clearMVStale(registry, name);
|
|
6475
6608
|
return result;
|
|
6476
6609
|
}
|
|
@@ -6486,7 +6619,7 @@ var Vault = class {
|
|
|
6486
6619
|
if (registry === null) return { derived: 0, failed: 0 };
|
|
6487
6620
|
const strategies = registry.strategiesForSource(sourceCollection);
|
|
6488
6621
|
if (strategies.length === 0) return { derived: 0, failed: 0 };
|
|
6489
|
-
const { DerivationExecutor } = await import("./executor-
|
|
6622
|
+
const { DerivationExecutor } = await import("./executor-AVJ7UEWA.js");
|
|
6490
6623
|
const sourceColl = this.collection(sourceCollection);
|
|
6491
6624
|
const records = await sourceColl.list();
|
|
6492
6625
|
const ctx = { vault: this.readOnlyFacade ?? new (await import("./read-only-facade-ITU6L7BL.js")).ReadOnlyVaultFacade(this) };
|
|
@@ -6511,7 +6644,7 @@ var Vault = class {
|
|
|
6511
6644
|
if (!outSpec) continue;
|
|
6512
6645
|
const outputColl = this.collection(outSpec.collection);
|
|
6513
6646
|
if (out.kind === "array") {
|
|
6514
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
6647
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-N6OJX6QR.js");
|
|
6515
6648
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
|
|
6516
6649
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
6517
6650
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -6732,7 +6865,7 @@ var Vault = class {
|
|
|
6732
6865
|
* collection.
|
|
6733
6866
|
*/
|
|
6734
6867
|
async delegate(opts) {
|
|
6735
|
-
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
6868
|
+
const { issueDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-K5ERUH6A.js");
|
|
6736
6869
|
if (!this.keyring.kek) {
|
|
6737
6870
|
throw new ValidationError(
|
|
6738
6871
|
"issueDelegation: keyring.kek is null \u2014 issuing a delegation requires a tier-1 unlock. Re-authenticate at tier 1 (passphrase) first."
|
|
@@ -6754,7 +6887,7 @@ var Vault = class {
|
|
|
6754
6887
|
* if the id does not exist.
|
|
6755
6888
|
*/
|
|
6756
6889
|
async revokeDelegation(id) {
|
|
6757
|
-
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-
|
|
6890
|
+
const { revokeDelegation, DELEGATIONS_COLLECTION } = await import("./delegation-K5ERUH6A.js");
|
|
6758
6891
|
await revokeDelegation(this.adapter, this.name, id);
|
|
6759
6892
|
void DELEGATIONS_COLLECTION;
|
|
6760
6893
|
}
|
|
@@ -7223,7 +7356,7 @@ var Vault = class {
|
|
|
7223
7356
|
* @see docs/subsystems/public-envelope.md
|
|
7224
7357
|
*/
|
|
7225
7358
|
async getPublicEnvelope(opts = {}) {
|
|
7226
|
-
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-
|
|
7359
|
+
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-MHG6YVXW.js");
|
|
7227
7360
|
return readPublicEnvelope2(this.adapter, this.name, opts);
|
|
7228
7361
|
}
|
|
7229
7362
|
/**
|
|
@@ -8833,7 +8966,7 @@ var Noydb = class {
|
|
|
8833
8966
|
if (!facade) return;
|
|
8834
8967
|
const ctx = { existing, vault: facade, userId: e.userId, role: e.role };
|
|
8835
8968
|
await registry.runChecks(e.collection, incoming, ctx);
|
|
8836
|
-
const { GuardExecutor } = await import("./executor-
|
|
8969
|
+
const { GuardExecutor } = await import("./executor-VT7TKGE4.js");
|
|
8837
8970
|
for (const g of guards) {
|
|
8838
8971
|
await GuardExecutor.checkFrozenFields(g, e.docId, existing, incoming, e.computedFieldNames);
|
|
8839
8972
|
}
|
|
@@ -9025,6 +9158,7 @@ var Noydb = class {
|
|
|
9025
9158
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
9026
9159
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
9027
9160
|
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
|
|
9161
|
+
...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
|
|
9028
9162
|
locale: opts?.locale,
|
|
9029
9163
|
// Thread the translator hook so Collection.put() can invoke it
|
|
9030
9164
|
plaintextTranslator: this.options.plaintextTranslator ? (text, from, to, field, collection) => this.invokeTranslator(text, from, to, field, collection) : void 0,
|
|
@@ -9078,7 +9212,8 @@ var Noydb = class {
|
|
|
9078
9212
|
...this.options.historyStrategy !== void 0 ? { historyStrategy: this.options.historyStrategy } : {},
|
|
9079
9213
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
9080
9214
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
9081
|
-
...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 } : {}
|
|
9082
9217
|
});
|
|
9083
9218
|
this.vaultCache.set(name, comp2);
|
|
9084
9219
|
return comp2;
|
|
@@ -9108,6 +9243,7 @@ var Noydb = class {
|
|
|
9108
9243
|
...this.options.i18nStrategy !== void 0 ? { i18nStrategy: this.options.i18nStrategy } : {},
|
|
9109
9244
|
...this.options.syncStrategy !== void 0 ? { syncStrategy: this.options.syncStrategy } : {},
|
|
9110
9245
|
...this.options.guardStrategies !== void 0 ? { guardStrategies: this.options.guardStrategies } : {},
|
|
9246
|
+
...this.options.numbering !== void 0 ? { numberingConfigs: this.options.numbering } : {},
|
|
9111
9247
|
emitter: this.emitter
|
|
9112
9248
|
});
|
|
9113
9249
|
this.vaultCache.set(name, comp);
|
|
@@ -9426,10 +9562,39 @@ var Noydb = class {
|
|
|
9426
9562
|
*/
|
|
9427
9563
|
async openVaultGroup(name, opts) {
|
|
9428
9564
|
if (this.closed) throw new ValidationError("Instance is closed");
|
|
9565
|
+
if (name === STATE_VAULT_NAME) throw new ReservedVaultNameError(name);
|
|
9429
9566
|
const template = this.vaultTemplates.get(opts.sharding.vaultTemplate);
|
|
9430
9567
|
if (!template) throw new VaultTemplateNotFoundError(opts.sharding.vaultTemplate);
|
|
9431
|
-
const { VaultGroup } = await import("./vault-group-
|
|
9432
|
-
|
|
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);
|
|
9433
9598
|
}
|
|
9434
9599
|
/**
|
|
9435
9600
|
* @internal — true when an encrypted shard vault is provisioned
|
|
@@ -10968,4 +11133,4 @@ export {
|
|
|
10968
11133
|
Noydb,
|
|
10969
11134
|
createNoydb
|
|
10970
11135
|
};
|
|
10971
|
-
//# sourceMappingURL=chunk-
|
|
11136
|
+
//# sourceMappingURL=chunk-P5MW7BG2.js.map
|