@noy-db/hub 0.2.0-pre.14 → 0.2.0-pre.16
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 +160 -64
- 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 +3 -3
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +5 -5
- package/dist/attestation/index.d.ts +5 -5
- package/dist/attestation/index.js +4 -4
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +3 -3
- package/dist/bundle/index.cjs +607 -114
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +7 -7
- package/dist/bundle/index.d.ts +7 -7
- package/dist/bundle/index.js +7 -7
- package/dist/{chunk-BIYRQQV6.js → chunk-3YWP3WBP.js} +3 -3
- package/dist/{chunk-VU7SWWT5.js → chunk-42FEUPZQ.js} +10 -6
- package/dist/chunk-42FEUPZQ.js.map +1 -0
- package/dist/{chunk-ACKFRSAH.js → chunk-667MB6AH.js} +132 -54
- package/dist/chunk-667MB6AH.js.map +1 -0
- package/dist/{chunk-A5ZOOZFB.js → chunk-6H2ZUNR7.js} +2 -2
- package/dist/{chunk-7HT2MEZ5.js → chunk-7BQ4QWYX.js} +3 -3
- package/dist/{chunk-DQU36Q7I.js → chunk-7Z7KSVA5.js} +13 -4
- package/dist/chunk-7Z7KSVA5.js.map +1 -0
- package/dist/{chunk-WBAYSNUQ.js → chunk-BI6ETQPF.js} +2 -2
- package/dist/{chunk-56DJ7JVK.js → chunk-BR3AMFGS.js} +2 -2
- package/dist/chunk-CJORTUJ2.js +524 -0
- package/dist/chunk-CJORTUJ2.js.map +1 -0
- package/dist/{chunk-YNTBADIY.js → chunk-CZI2A4MQ.js} +2 -2
- package/dist/{chunk-COFPAMX6.js → chunk-DLZ2ONOD.js} +3 -3
- package/dist/{chunk-KGCORI4L.js → chunk-DUREQF5W.js} +266 -66
- package/dist/chunk-DUREQF5W.js.map +1 -0
- package/dist/{chunk-PE4AQGFH.js → chunk-E2CDVKMH.js} +3 -3
- package/dist/{chunk-GC4V7RU7.js → chunk-F3BPIPLS.js} +1 -1
- package/dist/{chunk-GC4V7RU7.js.map → chunk-F3BPIPLS.js.map} +1 -1
- package/dist/{chunk-L2FE64BU.js → chunk-FFXM3ZIF.js} +2 -2
- package/dist/{chunk-5LQG6ZO2.js → chunk-G4SCICH5.js} +8 -3
- package/dist/chunk-G4SCICH5.js.map +1 -0
- package/dist/{chunk-WGHU7BLI.js → chunk-GNI5STXQ.js} +2 -2
- package/dist/{chunk-UWNYBOOO.js → chunk-HBXJ37ZY.js} +11 -5
- package/dist/chunk-HBXJ37ZY.js.map +1 -0
- package/dist/{chunk-NP6EZT44.js → chunk-IQLVUT37.js} +2 -2
- package/dist/{chunk-7PS7EOCF.js → chunk-IXBIFDEW.js} +2 -2
- package/dist/{chunk-LX3CB26H.js → chunk-KABJXG2F.js} +2 -2
- package/dist/{chunk-3EWA37FV.js → chunk-L2BNJ6HM.js} +32 -276
- package/dist/chunk-L2BNJ6HM.js.map +1 -0
- package/dist/{chunk-DKO2QFSA.js → chunk-OB2ZJQ2D.js} +2 -2
- package/dist/{chunk-4PEFEETV.js → chunk-OMAMZKKD.js} +2 -2
- package/dist/{chunk-EGD5DXFT.js → chunk-OQSRJG6A.js} +13 -1
- package/dist/chunk-OQSRJG6A.js.map +1 -0
- package/dist/{chunk-KI6HAJWL.js → chunk-QSUK7YWK.js} +2 -2
- package/dist/{chunk-YHPM5D7Y.js → chunk-QVIEAYTP.js} +61 -2
- package/dist/chunk-QVIEAYTP.js.map +1 -0
- package/dist/{chunk-NSCVNK5K.js → chunk-SCJPI4Z5.js} +3 -3
- package/dist/{chunk-ZWTNWAO4.js → chunk-TKIY625R.js} +13 -3
- package/dist/chunk-TKIY625R.js.map +1 -0
- package/dist/{chunk-OHVFWCJP.js → chunk-VLMPU56Q.js} +48 -18
- package/dist/chunk-VLMPU56Q.js.map +1 -0
- package/dist/{chunk-6AJBSQU4.js → chunk-XL35NSEN.js} +2 -2
- package/dist/{chunk-WIBHRONM.js → chunk-XWH4MXIU.js} +2 -2
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/derivations/index.cjs +24 -3
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +7 -7
- package/dist/derivations/index.d.ts +7 -7
- package/dist/derivations/index.js +2 -2
- package/dist/{dev-unlock-BF4OSxRv.d.cts → dev-unlock-8XzcD2Z4.d.cts} +1 -1
- package/dist/{dev-unlock-DV7ujTCI.d.ts → dev-unlock-DR3upLd1.d.ts} +1 -1
- package/dist/executor-AZLS3KBK.js +11 -0
- package/dist/{fanout-sidecar-N6OJX6QR.js → fanout-sidecar-67CMI3UT.js} +2 -2
- package/dist/guards/index.cjs +9 -5
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +7 -7
- package/dist/guards/index.d.ts +7 -7
- package/dist/guards/index.js +1 -1
- package/dist/{hash-DswxkLtW.d.ts → hash-CDjye9KV.d.ts} +1 -1
- package/dist/{hash-BcF5WQXl.d.cts → hash-DuQ88_5W.d.cts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +7 -7
- package/dist/history/index.d.ts +7 -7
- package/dist/history/index.js +2 -2
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +6 -6
- package/dist/i18n/index.d.ts +6 -6
- package/dist/i18n/index.js +3 -3
- package/dist/{immutable-guard-7KqslW2K.d.cts → immutable-guard-CRPvu24K.d.cts} +16 -1
- package/dist/{immutable-guard-C8IYdzfu.d.ts → immutable-guard-Dov3WvwF.d.ts} +16 -1
- package/dist/{index-Cqzp4tt9.d.ts → index-C8Bk3-VF.d.cts} +11 -3
- package/dist/{index-CUVOMtgg.d.cts → index-nP99bXLg.d.ts} +11 -3
- package/dist/index.cjs +840 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +146 -15
- package/dist/index.d.ts +146 -15
- package/dist/index.js +153 -35
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +92 -31
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.d.cts +3 -3
- package/dist/indexing/index.d.ts +3 -3
- package/dist/indexing/index.js +3 -3
- package/dist/{issue-ADVS4OVP.js → issue-RZP3VI6O.js} +4 -4
- package/dist/{lazy-builder-D5GU14TS.d.ts → lazy-builder-ChSqcF5t.d.ts} +1 -1
- package/dist/{lazy-builder-Ci5_YG73.d.cts → lazy-builder-eYZzLEL1.d.cts} +1 -1
- package/dist/{ledger-CWSE3BLF.js → ledger-A3LL253R.js} +3 -3
- package/dist/materialized-views/index.cjs +409 -7
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -7
- package/dist/materialized-views/index.d.ts +7 -7
- package/dist/materialized-views/index.js +6 -6
- package/dist/noydb-WCMY2ZOW.js +35 -0
- package/dist/overlay-views/index.cjs +47 -17
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +28 -10
- package/dist/overlay-views/index.d.ts +28 -10
- package/dist/overlay-views/index.js +1 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +6 -6
- package/dist/periods/index.d.ts +6 -6
- package/dist/periods/index.js +3 -3
- package/dist/{predicate-Bt5ft-9c.d.cts → predicate-BmhBSPCH.d.cts} +59 -2
- package/dist/{predicate-Bt5ft-9c.d.ts → predicate-BmhBSPCH.d.ts} +59 -2
- package/dist/{public-envelope-SYHEYQ3X.js → public-envelope-YP2UWMLG.js} +3 -3
- package/dist/query/index.cjs +604 -205
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +5 -5
- package/dist/{registry-XGLNADIE.js → registry-EB6SISTA.js} +2 -2
- package/dist/{registry-DK5YWAAA.js → registry-UTA4CLQS.js} +2 -2
- package/dist/{revoke-ZDFKMR5E.js → revoke-HNMQZSCL.js} +4 -4
- package/dist/session/index.d.cts +7 -7
- package/dist/session/index.d.ts +7 -7
- package/dist/shadow/index.d.cts +6 -6
- package/dist/shadow/index.d.ts +6 -6
- package/dist/{signer-P5D7Y72U.js → signer-DCMNKXSF.js} +3 -3
- package/dist/snapshots/index.d.cts +6 -6
- package/dist/snapshots/index.d.ts +6 -6
- package/dist/snapshots/index.js +3 -3
- package/dist/{stale-7FRJVHN6.js → stale-W5PQTRYH.js} +2 -2
- package/dist/store/index.d.cts +6 -6
- package/dist/store/index.d.ts +6 -6
- package/dist/{strategy-CrS7PnbE.d.cts → strategy-BtW8fAjz.d.cts} +2 -2
- package/dist/{strategy-CrS7PnbE.d.ts → strategy-BtW8fAjz.d.ts} +2 -2
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +5 -5
- package/dist/sync/index.d.ts +5 -5
- package/dist/sync/index.js +2 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +6 -6
- package/dist/team/index.d.ts +6 -6
- package/dist/team/index.js +5 -5
- package/dist/tx/index.cjs +66 -3
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +24 -8
- package/dist/tx/index.d.ts +24 -8
- package/dist/tx/index.js +7 -3
- package/dist/tx/index.js.map +1 -1
- package/dist/{types-V5R2-pd4.d.cts → types-Bze6vkwm.d.cts} +391 -144
- package/dist/{types-BFHQUjdy.d.ts → types-DrmBTscX.d.ts} +391 -144
- package/dist/{ulid-p2nKiiKg.d.ts → ulid-DbBVrNSt.d.ts} +1 -1
- package/dist/{ulid-CwNf9e6-.d.cts → ulid-DfZlAh0u.d.cts} +1 -1
- package/dist/{vault-group-W7QC4UYW.js → vault-group-DX2HFQMX.js} +3 -3
- package/dist/{with-derivation-C9K43BOB.d.cts → with-derivation-CCqAchD5.d.cts} +1 -1
- package/dist/{with-derivation-Ds9yZgCj.d.ts → with-derivation-_lySGdlm.d.ts} +1 -1
- package/dist/{with-materialized-view-DgQcAjYv.d.cts → with-materialized-view--4PsvMDu.d.cts} +1 -1
- package/dist/{with-materialized-view-DwR4jkV5.d.ts → with-materialized-view-QT1Tp7NO.d.ts} +1 -1
- package/dist/{with-overlayed-view-ByyhHdVr.d.ts → with-overlayed-view-BEXfpzSb.d.ts} +1 -1
- package/dist/{with-overlayed-view-7-rUB3vD.d.cts → with-overlayed-view-DlH5qmeB.d.cts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-3EWA37FV.js.map +0 -1
- package/dist/chunk-5LQG6ZO2.js.map +0 -1
- package/dist/chunk-ACKFRSAH.js.map +0 -1
- package/dist/chunk-DQU36Q7I.js.map +0 -1
- package/dist/chunk-EGD5DXFT.js.map +0 -1
- package/dist/chunk-KGCORI4L.js.map +0 -1
- package/dist/chunk-OHVFWCJP.js.map +0 -1
- package/dist/chunk-TV3YZ35S.js +0 -90
- package/dist/chunk-TV3YZ35S.js.map +0 -1
- package/dist/chunk-UWNYBOOO.js.map +0 -1
- package/dist/chunk-VU7SWWT5.js.map +0 -1
- package/dist/chunk-YHPM5D7Y.js.map +0 -1
- package/dist/chunk-ZWTNWAO4.js.map +0 -1
- package/dist/executor-723ZP6TH.js +0 -11
- package/dist/noydb-VZ4JVW55.js +0 -35
- /package/dist/{chunk-BIYRQQV6.js.map → chunk-3YWP3WBP.js.map} +0 -0
- /package/dist/{chunk-A5ZOOZFB.js.map → chunk-6H2ZUNR7.js.map} +0 -0
- /package/dist/{chunk-7HT2MEZ5.js.map → chunk-7BQ4QWYX.js.map} +0 -0
- /package/dist/{chunk-WBAYSNUQ.js.map → chunk-BI6ETQPF.js.map} +0 -0
- /package/dist/{chunk-56DJ7JVK.js.map → chunk-BR3AMFGS.js.map} +0 -0
- /package/dist/{chunk-YNTBADIY.js.map → chunk-CZI2A4MQ.js.map} +0 -0
- /package/dist/{chunk-COFPAMX6.js.map → chunk-DLZ2ONOD.js.map} +0 -0
- /package/dist/{chunk-PE4AQGFH.js.map → chunk-E2CDVKMH.js.map} +0 -0
- /package/dist/{chunk-L2FE64BU.js.map → chunk-FFXM3ZIF.js.map} +0 -0
- /package/dist/{chunk-WGHU7BLI.js.map → chunk-GNI5STXQ.js.map} +0 -0
- /package/dist/{chunk-NP6EZT44.js.map → chunk-IQLVUT37.js.map} +0 -0
- /package/dist/{chunk-7PS7EOCF.js.map → chunk-IXBIFDEW.js.map} +0 -0
- /package/dist/{chunk-LX3CB26H.js.map → chunk-KABJXG2F.js.map} +0 -0
- /package/dist/{chunk-DKO2QFSA.js.map → chunk-OB2ZJQ2D.js.map} +0 -0
- /package/dist/{chunk-4PEFEETV.js.map → chunk-OMAMZKKD.js.map} +0 -0
- /package/dist/{chunk-KI6HAJWL.js.map → chunk-QSUK7YWK.js.map} +0 -0
- /package/dist/{chunk-NSCVNK5K.js.map → chunk-SCJPI4Z5.js.map} +0 -0
- /package/dist/{chunk-6AJBSQU4.js.map → chunk-XL35NSEN.js.map} +0 -0
- /package/dist/{chunk-WIBHRONM.js.map → chunk-XWH4MXIU.js.map} +0 -0
- /package/dist/{executor-723ZP6TH.js.map → executor-AZLS3KBK.js.map} +0 -0
- /package/dist/{fanout-sidecar-N6OJX6QR.js.map → fanout-sidecar-67CMI3UT.js.map} +0 -0
- /package/dist/{issue-ADVS4OVP.js.map → issue-RZP3VI6O.js.map} +0 -0
- /package/dist/{ledger-CWSE3BLF.js.map → ledger-A3LL253R.js.map} +0 -0
- /package/dist/{noydb-VZ4JVW55.js.map → noydb-WCMY2ZOW.js.map} +0 -0
- /package/dist/{public-envelope-SYHEYQ3X.js.map → public-envelope-YP2UWMLG.js.map} +0 -0
- /package/dist/{registry-DK5YWAAA.js.map → registry-EB6SISTA.js.map} +0 -0
- /package/dist/{registry-XGLNADIE.js.map → registry-UTA4CLQS.js.map} +0 -0
- /package/dist/{revoke-ZDFKMR5E.js.map → revoke-HNMQZSCL.js.map} +0 -0
- /package/dist/{signer-P5D7Y72U.js.map → signer-DCMNKXSF.js.map} +0 -0
- /package/dist/{stale-7FRJVHN6.js.map → stale-W5PQTRYH.js.map} +0 -0
- /package/dist/{vault-group-W7QC4UYW.js.map → vault-group-DX2HFQMX.js.map} +0 -0
package/dist/bundle/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { T as TransferSealPayload } from '../ulid-
|
|
2
|
-
export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-
|
|
3
|
-
import {
|
|
4
|
-
export { X as AdoptionStateError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, a1 as PartitionExtractionError, a2 as TransferSealError } from '../strategy-
|
|
5
|
-
import '../lazy-builder-
|
|
6
|
-
import '../predicate-
|
|
1
|
+
import { T as TransferSealPayload } from '../ulid-DfZlAh0u.cjs';
|
|
2
|
+
export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-DfZlAh0u.cjs';
|
|
3
|
+
import { bs as Vault, a$ as NoydbStore, bo as SealingKeyProvider, bt as RecoveryEnrollmentInput, bu as ShamirRecoveryProvider } from '../types-Bze6vkwm.cjs';
|
|
4
|
+
export { X as AdoptionStateError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, a1 as PartitionExtractionError, a2 as TransferSealError } from '../strategy-BtW8fAjz.cjs';
|
|
5
|
+
import '../lazy-builder-eYZzLEL1.cjs';
|
|
6
|
+
import '../predicate-BmhBSPCH.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-C8Bk3-VF.cjs';
|
|
9
9
|
import '@noy-db/attestation';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/bundle/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { T as TransferSealPayload } from '../ulid-
|
|
2
|
-
export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-
|
|
3
|
-
import {
|
|
4
|
-
export { X as AdoptionStateError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, a1 as PartitionExtractionError, a2 as TransferSealError } from '../strategy-
|
|
5
|
-
import '../lazy-builder-
|
|
6
|
-
import '../predicate-
|
|
1
|
+
import { T as TransferSealPayload } from '../ulid-DbBVrNSt.js';
|
|
2
|
+
export { C as COMPRESSION_BROTLI, a as COMPRESSION_GZIP, b as COMPRESSION_NONE, c as CompressionAlgo, F as FLAG_COMPRESSED, d as FLAG_HAS_INTEGRITY_HASH, N as NOYDB_BUNDLE_FORMAT_VERSION, e as NOYDB_BUNDLE_MAGIC, f as NOYDB_BUNDLE_PREFIX_BYTES, g as NoydbBundleHeader, h as NoydbBundleReadResult, R as ReadNoydbBundleOptions, W as WriteNoydbBundleOptions, i as encodeBundleHeader, j as generateULID, k as isULID, r as readNoydbBundle, l as readNoydbBundleHeader, m as resetBrotliSupportCache, v as validateBundleHeader, w as writeNoydbBundle } from '../ulid-DbBVrNSt.js';
|
|
3
|
+
import { bs as Vault, a$ as NoydbStore, bo as SealingKeyProvider, bt as RecoveryEnrollmentInput, bu as ShamirRecoveryProvider } from '../types-DrmBTscX.js';
|
|
4
|
+
export { X as AdoptionStateError, Y as BackupCorruptedError, Z as BackupLedgerError, _ as BundleIntegrityError, $ as BundleSealMismatchError, a0 as BundleVersionConflictError, a1 as PartitionExtractionError, a2 as TransferSealError } from '../strategy-BtW8fAjz.js';
|
|
5
|
+
import '../lazy-builder-ChSqcF5t.js';
|
|
6
|
+
import '../predicate-BmhBSPCH.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-nP99bXLg.js';
|
|
9
9
|
import '@noy-db/attestation';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SCHEMAS_COLLECTION,
|
|
3
3
|
resolveManagedSecret
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-GNI5STXQ.js";
|
|
5
5
|
import {
|
|
6
6
|
COMPRESSION_BROTLI,
|
|
7
7
|
COMPRESSION_GZIP,
|
|
@@ -20,11 +20,11 @@ import {
|
|
|
20
20
|
resetBrotliSupportCache,
|
|
21
21
|
validateBundleHeader,
|
|
22
22
|
writeNoydbBundle
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-FFXM3ZIF.js";
|
|
24
|
+
import "../chunk-OB2ZJQ2D.js";
|
|
25
25
|
import {
|
|
26
26
|
createOwnerKeyring
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-6H2ZUNR7.js";
|
|
28
28
|
import {
|
|
29
29
|
generateULID,
|
|
30
30
|
isULID
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
LEDGER_COLLECTION,
|
|
34
34
|
LedgerStore
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-BR3AMFGS.js";
|
|
36
36
|
import {
|
|
37
37
|
canonicalJson,
|
|
38
38
|
envelopePayloadHash,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
NOYDB_BACKUP_VERSION,
|
|
43
43
|
NOYDB_FORMAT_VERSION
|
|
44
|
-
} from "../chunk-
|
|
44
|
+
} from "../chunk-F3BPIPLS.js";
|
|
45
45
|
import {
|
|
46
46
|
base64ToBuffer,
|
|
47
47
|
bufferToBase64,
|
|
@@ -532,7 +532,7 @@ async function createOwnerOnAdoptedPartition(store, vaultName, opts) {
|
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
if (isManaged(opts)) {
|
|
535
|
-
const { createNoydb } = await import("../noydb-
|
|
535
|
+
const { createNoydb } = await import("../noydb-WCMY2ZOW.js");
|
|
536
536
|
const db = await createNoydb({
|
|
537
537
|
store,
|
|
538
538
|
user: userId,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ATTESTATIONS_COLLECTION,
|
|
3
3
|
loadOrCreateSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IXBIFDEW.js";
|
|
5
5
|
import {
|
|
6
6
|
generateULID
|
|
7
7
|
} from "./chunk-FZU343FL.js";
|
|
8
8
|
import {
|
|
9
9
|
NOYDB_FORMAT_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-F3BPIPLS.js";
|
|
11
11
|
import {
|
|
12
12
|
encrypt
|
|
13
13
|
} from "./chunk-YULZKK4F.js";
|
|
@@ -56,4 +56,4 @@ async function issueAttestationCore(ctx, args) {
|
|
|
56
56
|
export {
|
|
57
57
|
issueAttestationCore
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-3YWP3WBP.js.map
|
|
@@ -20,7 +20,7 @@ function recordId(record) {
|
|
|
20
20
|
return typeof id === "string" ? id : "";
|
|
21
21
|
}
|
|
22
22
|
function immutableGuard(config) {
|
|
23
|
-
const { collection, after, appendOnly, amendmentRoles } = config;
|
|
23
|
+
const { collection, after, appendOnly, amendmentRoles, amendmentInvariant } = config;
|
|
24
24
|
if (appendOnly && after !== void 0) {
|
|
25
25
|
throw new ValidationError("immutableGuard: `after` and `appendOnly` are mutually exclusive");
|
|
26
26
|
}
|
|
@@ -46,12 +46,16 @@ function immutableGuard(config) {
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
// The authorized override: inside an amendment transaction the
|
|
49
|
-
// check/onDelete are skipped and the change is ledgered.
|
|
50
|
-
// invariant — the amendment itself is the
|
|
49
|
+
// check/onDelete are skipped and the change is ledgered. By default
|
|
50
|
+
// there is no extra invariant — the amendment itself is the
|
|
51
|
+
// sanctioned exception. Callers may supply `amendmentInvariant` to
|
|
52
|
+
// keep a constraint inviolable even under amendment (e.g. forbid
|
|
53
|
+
// deletes, or preserve a cross-record sum); a throw reverts the
|
|
54
|
+
// amendment and surfaces as `InvariantError`.
|
|
51
55
|
amendment: {
|
|
52
56
|
roles: amendmentRoles ?? ["admin", "owner"],
|
|
53
|
-
invariant: () => {
|
|
54
|
-
}
|
|
57
|
+
invariant: amendmentInvariant ?? (() => {
|
|
58
|
+
})
|
|
55
59
|
}
|
|
56
60
|
};
|
|
57
61
|
return withGuard(spec);
|
|
@@ -61,4 +65,4 @@ export {
|
|
|
61
65
|
withGuard,
|
|
62
66
|
immutableGuard
|
|
63
67
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-42FEUPZQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/guards/with-guard.ts","../src/guards/immutable-guard.ts"],"sourcesContent":["import { ValidationError } from '../errors.js'\nimport type { GuardStrategy, GuardStrategyHandle } from './types.js'\n\n/**\n * Register a guard for a collection. Guards run on every `put()` /\n * `delete()` for the named collection (after permissions, before\n * encryption) and may:\n *\n * - `check` — block writes by throwing (typically `RecordLockedError`)\n * - `frozenFields` — freeze specific fields once a condition is true\n * - `amendment` — declare an authorized-override path with invariant\n *\n * Pass the returned handle to `createNoydb({ strategies: [...] })`.\n *\n * @see docs/superpowers/specs/2026-05-18-guards-design.md\n */\nexport function withGuard<T extends Record<string, unknown>>(\n strategy: GuardStrategy<T>,\n): GuardStrategyHandle<T> {\n if (!strategy.collection || strategy.collection.length === 0) {\n throw new ValidationError('withGuard: collection name is required')\n }\n return {\n __noydb_strategy: 'guard',\n spec: strategy,\n }\n}\n","/**\n * `immutableGuard` — declarative WORM / append-only sugar over the guard\n * subsystem.\n *\n * Issued fiscal documents (invoices, DDTs) must be immutable after issue.\n * That is expressible today with a hand-rolled `withGuard` (block on\n * `check`/`onDelete`, allow an admin `amendment`), but the boilerplate is\n * repetitive and easy to get subtly wrong. `immutableGuard` generates\n * exactly that guard from a declarative config, reusing the guard\n * machinery wholesale — `check`/`onDelete` rejection, the ledgered\n * `amendment` override, and composition with `periods`/`history`.\n *\n * ```ts\n * createNoydb({ guardStrategies: [\n * immutableGuard({\n * collection: 'invoices',\n * after: (r) => r.status === 'issued', // immutable once issued\n * }),\n * ] })\n * ```\n *\n * A record is mutable until `after(record)` holds; from then on, updates\n * and deletes throw `RecordLockedError` unless performed inside an\n * `amendment` transaction by an authorized role (the override is\n * ledgered by the guard amendment mechanism). `appendOnly: true` is\n * shorthand for `after: () => true` — immutable from creation.\n */\n\nimport { withGuard } from './with-guard.js'\nimport type { GuardStrategy, GuardStrategyHandle, GuardContext, GuardChange } from './types.js'\nimport { RecordLockedError, ValidationError } from '../errors.js'\n\nexport interface ImmutableGuardConfig<T extends Record<string, unknown>> {\n /** The collection to make WORM. */\n collection: string\n /**\n * A record becomes immutable once this predicate holds. Evaluated on\n * the *existing* (already-persisted) record, so the write that first\n * makes it true is still allowed; subsequent writes are blocked.\n * Mutually exclusive with `appendOnly`.\n */\n after?: (record: T) => boolean\n /** Shorthand for `after: () => true` — immutable from creation. */\n appendOnly?: boolean\n /** Roles permitted to override via an amendment transaction. Default `['admin', 'owner']`. */\n amendmentRoles?: ReadonlyArray<'admin' | 'owner'>\n /**\n * Optional set-level invariant run over the amendment change-set after\n * the writes execute. Signature matches `GuardStrategy.amendment.invariant`\n * exactly: it receives every {before, after} pair touching this\n * collection in the amendment plus the guard context; throwing reverts\n * the whole amendment and surfaces as `InvariantError`.\n *\n * Use this to keep a constraint inviolable EVEN under amendment — e.g.\n * forbid deleting an issued document by re-throwing on any\n * `before !== null && after === null` change, or assert a cross-record\n * sum is preserved. When omitted the amendment is unconditionally\n * allowed (the amendment itself is the sanctioned, ledgered override) —\n * this is the backward-compatible default.\n */\n amendmentInvariant?: (\n changes: ReadonlyArray<GuardChange<T>>,\n ctx: GuardContext<T>,\n ) => Promise<void> | void\n}\n\nfunction recordId(record: Record<string, unknown> | null): string {\n const id = record?.id\n return typeof id === 'string' ? id : ''\n}\n\n/**\n * Build an immutability guard. Pass the returned handle to\n * `createNoydb({ guardStrategies: [...] })`.\n */\nexport function immutableGuard<T extends Record<string, unknown>>(\n config: ImmutableGuardConfig<T>,\n): GuardStrategyHandle<T> {\n const { collection, after, appendOnly, amendmentRoles, amendmentInvariant } = config\n if (appendOnly && after !== undefined) {\n throw new ValidationError('immutableGuard: `after` and `appendOnly` are mutually exclusive')\n }\n if (!appendOnly && after === undefined) {\n throw new ValidationError('immutableGuard: provide `after` or `appendOnly: true`')\n }\n\n const isImmutable: (record: T) => boolean = appendOnly ? () => true : after!\n const reason = appendOnly ? 'append-only collection' : 'record is immutable after issue'\n\n const spec: GuardStrategy<T> = {\n collection,\n // Block updates to an already-immutable record. Inserts (existing\n // null) and the transition write that first makes the record\n // immutable are allowed — `after` reads the prior state.\n check: (incoming: T, ctx: GuardContext<T>) => {\n if (ctx.existing !== null && isImmutable(ctx.existing)) {\n throw new RecordLockedError(collection, recordId(incoming as Record<string, unknown>), reason)\n }\n },\n // Block deletes of an immutable record.\n onDelete: (existing: T) => {\n if (isImmutable(existing)) {\n throw new RecordLockedError(collection, recordId(existing as Record<string, unknown>), reason)\n }\n },\n // The authorized override: inside an amendment transaction the\n // check/onDelete are skipped and the change is ledgered. By default\n // there is no extra invariant — the amendment itself is the\n // sanctioned exception. Callers may supply `amendmentInvariant` to\n // keep a constraint inviolable even under amendment (e.g. forbid\n // deletes, or preserve a cross-record sum); a throw reverts the\n // amendment and surfaces as `InvariantError`.\n amendment: {\n roles: amendmentRoles ?? ['admin', 'owner'],\n invariant: amendmentInvariant ?? (() => {\n /* allow — the amendment is the override, and is ledgered */\n }),\n },\n }\n\n return withGuard<T>(spec)\n}\n"],"mappings":";;;;;;AAgBO,SAAS,UACd,UACwB;AACxB,MAAI,CAAC,SAAS,cAAc,SAAS,WAAW,WAAW,GAAG;AAC5D,UAAM,IAAI,gBAAgB,wCAAwC;AAAA,EACpE;AACA,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,MAAM;AAAA,EACR;AACF;;;ACwCA,SAAS,SAAS,QAAgD;AAChE,QAAM,KAAK,QAAQ;AACnB,SAAO,OAAO,OAAO,WAAW,KAAK;AACvC;AAMO,SAAS,eACd,QACwB;AACxB,QAAM,EAAE,YAAY,OAAO,YAAY,gBAAgB,mBAAmB,IAAI;AAC9E,MAAI,cAAc,UAAU,QAAW;AACrC,UAAM,IAAI,gBAAgB,iEAAiE;AAAA,EAC7F;AACA,MAAI,CAAC,cAAc,UAAU,QAAW;AACtC,UAAM,IAAI,gBAAgB,uDAAuD;AAAA,EACnF;AAEA,QAAM,cAAsC,aAAa,MAAM,OAAO;AACtE,QAAM,SAAS,aAAa,2BAA2B;AAEvD,QAAM,OAAyB;AAAA,IAC7B;AAAA;AAAA;AAAA;AAAA,IAIA,OAAO,CAAC,UAAa,QAAyB;AAC5C,UAAI,IAAI,aAAa,QAAQ,YAAY,IAAI,QAAQ,GAAG;AACtD,cAAM,IAAI,kBAAkB,YAAY,SAAS,QAAmC,GAAG,MAAM;AAAA,MAC/F;AAAA,IACF;AAAA;AAAA,IAEA,UAAU,CAAC,aAAgB;AACzB,UAAI,YAAY,QAAQ,GAAG;AACzB,cAAM,IAAI,kBAAkB,YAAY,SAAS,QAAmC,GAAG,MAAM;AAAA,MAC/F;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,WAAW;AAAA,MACT,OAAO,kBAAkB,CAAC,SAAS,OAAO;AAAA,MAC1C,WAAW,uBAAuB,MAAM;AAAA,MAExC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,UAAa,IAAI;AAC1B;","names":[]}
|
|
@@ -7,37 +7,37 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
TxContext,
|
|
9
9
|
revertExecuted
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QVIEAYTP.js";
|
|
11
11
|
import {
|
|
12
12
|
OverlayedCollection
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VLMPU56Q.js";
|
|
14
14
|
import {
|
|
15
15
|
LazyQuery,
|
|
16
16
|
decodeIdxId,
|
|
17
17
|
encodeIdxId
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CZI2A4MQ.js";
|
|
19
19
|
import {
|
|
20
20
|
SCHEMAS_COLLECTION,
|
|
21
21
|
loadPersistedSchema,
|
|
22
22
|
resolveManagedSecret,
|
|
23
23
|
savePersistedSchema,
|
|
24
24
|
saveSealedPassphrase
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-GNI5STXQ.js";
|
|
26
26
|
import {
|
|
27
27
|
loadPublicEnvelope,
|
|
28
28
|
readPublicEnvelope,
|
|
29
29
|
savePublicEnvelope,
|
|
30
30
|
validatePublicEnvelopeInput
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-OB2ZJQ2D.js";
|
|
32
32
|
import {
|
|
33
33
|
PERIODS_COLLECTION
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QSUK7YWK.js";
|
|
35
35
|
import {
|
|
36
36
|
getAtPath,
|
|
37
37
|
isDictCollectionName,
|
|
38
38
|
resolvePolicy,
|
|
39
39
|
setAtPathInPlace
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-7BQ4QWYX.js";
|
|
41
41
|
import {
|
|
42
42
|
ManagedRecoveryNotEnrolledError,
|
|
43
43
|
PolicyDeniedError,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
saveShamirRecoveryEntries,
|
|
60
60
|
updateAuthenticator,
|
|
61
61
|
writeMagicLinkGrant
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-DLZ2ONOD.js";
|
|
63
63
|
import {
|
|
64
64
|
assertTierAccess,
|
|
65
65
|
dekKey
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
rotateKeys,
|
|
89
89
|
saveUserEnvelope,
|
|
90
90
|
updateKeyringIdentity
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-6H2ZUNR7.js";
|
|
92
92
|
import {
|
|
93
93
|
INDEXED_STORE_POLICY
|
|
94
94
|
} from "./chunk-2QR2PQTT.js";
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
import {
|
|
99
99
|
LEDGER_COLLECTION,
|
|
100
100
|
LEDGER_DELTAS_COLLECTION
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-BR3AMFGS.js";
|
|
102
102
|
import {
|
|
103
103
|
sha256Hex as sha256Hex2
|
|
104
104
|
} from "./chunk-Z6FNBOTC.js";
|
|
@@ -106,24 +106,27 @@ import {
|
|
|
106
106
|
NO_AGGREGATE,
|
|
107
107
|
Query,
|
|
108
108
|
ScanBuilder,
|
|
109
|
+
canonicalizeIncomingMoney,
|
|
110
|
+
canonicalizeStoredMoney,
|
|
109
111
|
decodeMoneyFields,
|
|
110
|
-
quantizeMoneyFields
|
|
111
|
-
|
|
112
|
+
quantizeMoneyFields,
|
|
113
|
+
validateMoneyFieldPaths
|
|
114
|
+
} from "./chunk-DUREQF5W.js";
|
|
112
115
|
import {
|
|
113
116
|
canonicalGroupKey
|
|
114
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-L2BNJ6HM.js";
|
|
115
118
|
import {
|
|
116
119
|
readPath
|
|
117
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-CJORTUJ2.js";
|
|
118
121
|
import {
|
|
119
122
|
EXPORT_AUDIT_COLLECTION,
|
|
120
123
|
createExportBlobsHandle,
|
|
121
124
|
runCompaction
|
|
122
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-XL35NSEN.js";
|
|
123
126
|
import {
|
|
124
127
|
NOYDB_BACKUP_VERSION,
|
|
125
128
|
NOYDB_FORMAT_VERSION
|
|
126
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-F3BPIPLS.js";
|
|
127
130
|
import {
|
|
128
131
|
decrypt,
|
|
129
132
|
encrypt,
|
|
@@ -1153,6 +1156,7 @@ var Collection = class {
|
|
|
1153
1156
|
this.joinResolver = opts.joinResolver;
|
|
1154
1157
|
this.i18nFields = opts.i18nFields;
|
|
1155
1158
|
this.dictKeyFields = opts.dictKeyFields;
|
|
1159
|
+
if (opts.moneyFields) validateMoneyFieldPaths(opts.moneyFields);
|
|
1156
1160
|
this.moneyFields = opts.moneyFields;
|
|
1157
1161
|
this.computed = opts.computed;
|
|
1158
1162
|
this.dictLabelResolver = opts.dictLabelResolver;
|
|
@@ -1286,7 +1290,9 @@ var Collection = class {
|
|
|
1286
1290
|
* declaration; this reconciles that ordering. First-wins. Not public.
|
|
1287
1291
|
*/
|
|
1288
1292
|
_applyMoneyFields(moneyFields) {
|
|
1289
|
-
if (this.moneyFields
|
|
1293
|
+
if (this.moneyFields !== void 0) return;
|
|
1294
|
+
validateMoneyFieldPaths(moneyFields);
|
|
1295
|
+
this.moneyFields = moneyFields;
|
|
1290
1296
|
}
|
|
1291
1297
|
/** @internal — attach computed fields post-construction. See {@link _applyMoneyFields}. */
|
|
1292
1298
|
_applyComputed(computed) {
|
|
@@ -1313,7 +1319,7 @@ var Collection = class {
|
|
|
1313
1319
|
}
|
|
1314
1320
|
}
|
|
1315
1321
|
if (this.materializedViewSource !== void 0) {
|
|
1316
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
1322
|
+
const { resolveStaleMVOnRead } = await import("./stale-W5PQTRYH.js");
|
|
1317
1323
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
1318
1324
|
}
|
|
1319
1325
|
let record;
|
|
@@ -1453,6 +1459,7 @@ var Collection = class {
|
|
|
1453
1459
|
if (!hasWritePermission(this.keyring, this.name)) {
|
|
1454
1460
|
throw new ReadOnlyError();
|
|
1455
1461
|
}
|
|
1462
|
+
record = canonicalizeIncomingMoney(record, this.moneyFields);
|
|
1456
1463
|
if (this.subsystemBus?.hasGateHandlers("beforePut")) {
|
|
1457
1464
|
const existingEnv = await this.adapter.get(this.vault, this.name, id);
|
|
1458
1465
|
let existingRecord = null;
|
|
@@ -1469,7 +1476,7 @@ var Collection = class {
|
|
|
1469
1476
|
collection: this.name,
|
|
1470
1477
|
docId: id,
|
|
1471
1478
|
incoming: record,
|
|
1472
|
-
existing: existingRecord,
|
|
1479
|
+
existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
|
|
1473
1480
|
existingVersion: existingEnv?._v ?? 0,
|
|
1474
1481
|
existingTs: existingEnv?._ts,
|
|
1475
1482
|
userId: this.keyring.userId,
|
|
@@ -1710,7 +1717,7 @@ var Collection = class {
|
|
|
1710
1717
|
if (mode === "eager") {
|
|
1711
1718
|
if (executor === null) {
|
|
1712
1719
|
;
|
|
1713
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
1720
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-AZLS3KBK.js"));
|
|
1714
1721
|
}
|
|
1715
1722
|
await executor.refresh(reg, {
|
|
1716
1723
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -1719,7 +1726,7 @@ var Collection = class {
|
|
|
1719
1726
|
});
|
|
1720
1727
|
} else if (mode === "lazy") {
|
|
1721
1728
|
if (staleHelpers === null) {
|
|
1722
|
-
staleHelpers = await import("./stale-
|
|
1729
|
+
staleHelpers = await import("./stale-W5PQTRYH.js");
|
|
1723
1730
|
}
|
|
1724
1731
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
1725
1732
|
}
|
|
@@ -1738,7 +1745,7 @@ var Collection = class {
|
|
|
1738
1745
|
*/
|
|
1739
1746
|
async dispatchDerivations(id, record, version) {
|
|
1740
1747
|
if (this.derivationSource === void 0) return;
|
|
1741
|
-
const incoming = record;
|
|
1748
|
+
const incoming = canonicalizeStoredMoney(record, this.moneyFields);
|
|
1742
1749
|
if (incoming && typeof incoming === "object" && "_derivedFrom" in incoming) return;
|
|
1743
1750
|
const registry = this.derivationSource.registry();
|
|
1744
1751
|
const strategies = registry.strategiesForSource(this.name);
|
|
@@ -1750,9 +1757,18 @@ var Collection = class {
|
|
|
1750
1757
|
if (DerivationExecutor === null) {
|
|
1751
1758
|
({ DerivationExecutor } = await import("./executor-6ZDSDZ6V.js"));
|
|
1752
1759
|
}
|
|
1753
|
-
|
|
1760
|
+
let sourceWithId;
|
|
1761
|
+
let sourceVersion = version;
|
|
1762
|
+
if (spec.source === this.name) {
|
|
1763
|
+
sourceWithId = { ...incoming, id };
|
|
1764
|
+
} else {
|
|
1765
|
+
const primary = await this.derivationSource.getCollection(spec.source).get(id);
|
|
1766
|
+
if (primary === null || primary === void 0) continue;
|
|
1767
|
+
sourceWithId = { ...primary, id };
|
|
1768
|
+
sourceVersion = 0;
|
|
1769
|
+
}
|
|
1754
1770
|
const ctx = { vault: this.derivationSource.getReadOnlyFacade() };
|
|
1755
|
-
const result = await DerivationExecutor.run(spec, sourceWithId,
|
|
1771
|
+
const result = await DerivationExecutor.run(spec, sourceWithId, sourceVersion, strategyHash, ctx);
|
|
1756
1772
|
for (const key of Object.keys(spec.outputs)) {
|
|
1757
1773
|
const out = result.outputs[key];
|
|
1758
1774
|
if (!out) continue;
|
|
@@ -1767,7 +1783,7 @@ var Collection = class {
|
|
|
1767
1783
|
const outputCollection = this.derivationSource.getCollection(outSpec.collection);
|
|
1768
1784
|
const txCtx = this.derivationSource.getActiveTxContext();
|
|
1769
1785
|
if (out.kind === "array") {
|
|
1770
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
1786
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-67CMI3UT.js");
|
|
1771
1787
|
const prior = await loadFanoutSidecar(
|
|
1772
1788
|
this.adapter,
|
|
1773
1789
|
this.vault,
|
|
@@ -1971,7 +1987,7 @@ var Collection = class {
|
|
|
1971
1987
|
vault: this.vault,
|
|
1972
1988
|
collection: this.name,
|
|
1973
1989
|
docId: id,
|
|
1974
|
-
existing: existingRecord,
|
|
1990
|
+
existing: canonicalizeStoredMoney(existingRecord, this.moneyFields),
|
|
1975
1991
|
existingVersion: existingEnv._v,
|
|
1976
1992
|
existingTs: existingEnv._ts,
|
|
1977
1993
|
internal,
|
|
@@ -2060,7 +2076,7 @@ var Collection = class {
|
|
|
2060
2076
|
for (const [outputKey, outSpec] of Object.entries(spec.outputs)) {
|
|
2061
2077
|
if (outSpec.shape !== "array") continue;
|
|
2062
2078
|
if (helpers === null) {
|
|
2063
|
-
helpers = await import("./fanout-sidecar-
|
|
2079
|
+
helpers = await import("./fanout-sidecar-67CMI3UT.js");
|
|
2064
2080
|
}
|
|
2065
2081
|
const sidecar = await helpers.loadFanoutSidecar(
|
|
2066
2082
|
this.adapter,
|
|
@@ -2100,7 +2116,7 @@ var Collection = class {
|
|
|
2100
2116
|
if (mode === "eager") {
|
|
2101
2117
|
if (executor === null) {
|
|
2102
2118
|
;
|
|
2103
|
-
({ MaterializedViewExecutor: executor } = await import("./executor-
|
|
2119
|
+
({ MaterializedViewExecutor: executor } = await import("./executor-AZLS3KBK.js"));
|
|
2104
2120
|
}
|
|
2105
2121
|
await executor.refresh(reg, {
|
|
2106
2122
|
getCollection: (name) => this.materializedViewSource.getCollection(name),
|
|
@@ -2109,7 +2125,7 @@ var Collection = class {
|
|
|
2109
2125
|
});
|
|
2110
2126
|
} else if (mode === "lazy") {
|
|
2111
2127
|
if (staleHelpers === null) {
|
|
2112
|
-
staleHelpers = await import("./stale-
|
|
2128
|
+
staleHelpers = await import("./stale-W5PQTRYH.js");
|
|
2113
2129
|
}
|
|
2114
2130
|
staleHelpers.markMVStale(registry, reg.spec.name);
|
|
2115
2131
|
}
|
|
@@ -2132,7 +2148,7 @@ var Collection = class {
|
|
|
2132
2148
|
);
|
|
2133
2149
|
}
|
|
2134
2150
|
if (this.materializedViewSource !== void 0) {
|
|
2135
|
-
const { resolveStaleMVOnRead } = await import("./stale-
|
|
2151
|
+
const { resolveStaleMVOnRead } = await import("./stale-W5PQTRYH.js");
|
|
2136
2152
|
await resolveStaleMVOnRead(this.materializedViewSource, this.name);
|
|
2137
2153
|
}
|
|
2138
2154
|
await this.ensureHydrated();
|
|
@@ -3777,6 +3793,21 @@ function withArchive(opts) {
|
|
|
3777
3793
|
// src/sequence/index.ts
|
|
3778
3794
|
var SEQUENCE_COLLECTION = "_sequences";
|
|
3779
3795
|
var MAX_NEXT_ATTEMPTS = 16;
|
|
3796
|
+
function resolveSequenceKey(series, opts) {
|
|
3797
|
+
const partition = opts?.partition;
|
|
3798
|
+
if (!partition || partition.length === 0) return series;
|
|
3799
|
+
const parts = partition.map((p) => {
|
|
3800
|
+
if (typeof p === "number" && !Number.isFinite(p)) {
|
|
3801
|
+
throw new ValidationError(`sequence partition component must be a finite number, got ${p}`);
|
|
3802
|
+
}
|
|
3803
|
+
const s = String(p);
|
|
3804
|
+
if (s === "") {
|
|
3805
|
+
throw new ValidationError("sequence partition component must not be empty");
|
|
3806
|
+
}
|
|
3807
|
+
return encodeURIComponent(s);
|
|
3808
|
+
});
|
|
3809
|
+
return `${series}\0${parts.join("/")}`;
|
|
3810
|
+
}
|
|
3780
3811
|
async function sleepBackoff(attempt) {
|
|
3781
3812
|
const ceil = Math.min(2 ** attempt, 32);
|
|
3782
3813
|
const ms = Math.floor(Math.random() * ceil);
|
|
@@ -3807,7 +3838,8 @@ var SequenceStore = class {
|
|
|
3807
3838
|
handle(name) {
|
|
3808
3839
|
return {
|
|
3809
3840
|
next: () => this.next(name),
|
|
3810
|
-
peek: () => this.peek(name)
|
|
3841
|
+
peek: () => this.peek(name),
|
|
3842
|
+
seedTo: (n) => this.seedTo(name, n)
|
|
3811
3843
|
};
|
|
3812
3844
|
}
|
|
3813
3845
|
assertOnline() {
|
|
@@ -3860,6 +3892,30 @@ var SequenceStore = class {
|
|
|
3860
3892
|
void lastConflict;
|
|
3861
3893
|
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
3862
3894
|
}
|
|
3895
|
+
async seedTo(name, n) {
|
|
3896
|
+
this.assertOnline();
|
|
3897
|
+
if (n <= 0) return;
|
|
3898
|
+
let lastConflict;
|
|
3899
|
+
for (let attempt = 0; attempt < MAX_NEXT_ATTEMPTS; attempt++) {
|
|
3900
|
+
const { env, value } = await this.read(name);
|
|
3901
|
+
if (value >= n) return;
|
|
3902
|
+
const expectedVersion = env?._v ?? 0;
|
|
3903
|
+
const envelope = await this.encryptState({ value: n }, expectedVersion + 1);
|
|
3904
|
+
try {
|
|
3905
|
+
await this.adapter.put(this.vault, SEQUENCE_COLLECTION, name, envelope, expectedVersion);
|
|
3906
|
+
return;
|
|
3907
|
+
} catch (err) {
|
|
3908
|
+
if (err instanceof ConflictError) {
|
|
3909
|
+
lastConflict = err;
|
|
3910
|
+
if (attempt < MAX_NEXT_ATTEMPTS - 1) await sleepBackoff(attempt);
|
|
3911
|
+
continue;
|
|
3912
|
+
}
|
|
3913
|
+
throw err;
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
void lastConflict;
|
|
3917
|
+
throw new SequenceContentionError(name, MAX_NEXT_ATTEMPTS);
|
|
3918
|
+
}
|
|
3863
3919
|
};
|
|
3864
3920
|
|
|
3865
3921
|
// src/numbering/index.ts
|
|
@@ -5998,17 +6054,23 @@ var Vault = class {
|
|
|
5998
6054
|
* const cur = await vault.sequence('invoice-2026').peek() // current value, no allocation
|
|
5999
6055
|
* ```
|
|
6000
6056
|
*/
|
|
6001
|
-
sequence(
|
|
6002
|
-
if (
|
|
6057
|
+
sequence(series, opts) {
|
|
6058
|
+
if (series.includes("\0")) {
|
|
6059
|
+
throw new ValidationError(`sequence("${series}"): series name must not contain a null byte (\\x00).`);
|
|
6060
|
+
}
|
|
6061
|
+
if (this.numberingConfigs.has(series)) {
|
|
6003
6062
|
const eng = this.deferred();
|
|
6004
6063
|
return {
|
|
6005
|
-
next: async (
|
|
6006
|
-
if (!
|
|
6007
|
-
throw new ValidationError(`sequence("${
|
|
6064
|
+
next: async (nextOpts) => {
|
|
6065
|
+
if (!nextOpts?.for) {
|
|
6066
|
+
throw new ValidationError(`sequence("${series}") is a deferred-numbering series; call next({ for: recordId }).`);
|
|
6008
6067
|
}
|
|
6009
|
-
return (await eng.enqueue(
|
|
6068
|
+
return (await eng.enqueue(series, nextOpts.for)).assigned;
|
|
6010
6069
|
},
|
|
6011
|
-
peek: () => eng.peek(
|
|
6070
|
+
peek: () => eng.peek(series),
|
|
6071
|
+
seedTo: () => {
|
|
6072
|
+
throw new ValidationError(`sequence("${series}") is a deferred-numbering series; seedTo is CAS-only.`);
|
|
6073
|
+
}
|
|
6012
6074
|
};
|
|
6013
6075
|
}
|
|
6014
6076
|
if (!this.sequenceStore) {
|
|
@@ -6020,7 +6082,7 @@ var Vault = class {
|
|
|
6020
6082
|
actor: this.keyring.userId
|
|
6021
6083
|
});
|
|
6022
6084
|
}
|
|
6023
|
-
return this.sequenceStore.handle(
|
|
6085
|
+
return this.sequenceStore.handle(resolveSequenceKey(series, opts));
|
|
6024
6086
|
}
|
|
6025
6087
|
/** @internal — lazily build the deferred-numbering engine with a cache-coherent stamp. */
|
|
6026
6088
|
deferred() {
|
|
@@ -6135,12 +6197,12 @@ var Vault = class {
|
|
|
6135
6197
|
if (!fieldSchema) {
|
|
6136
6198
|
throw new AttestationError(`issueAttestation: collection '${collectionName}' has no attestation field-schema. Declare it via vault.collection('${collectionName}', { attestation: { fields: [...] } }).`);
|
|
6137
6199
|
}
|
|
6138
|
-
const { issueAttestationCore } = await import("./issue-
|
|
6200
|
+
const { issueAttestationCore } = await import("./issue-RZP3VI6O.js");
|
|
6139
6201
|
const out = await issueAttestationCore(this.makeIssueContext(), { collection: collectionName, id, fieldSchema });
|
|
6140
6202
|
return { docId: out.docId, qr: out.qr, keyId: out.keyId, publicKeyB64: out.publicKeyB64 };
|
|
6141
6203
|
}
|
|
6142
6204
|
async getDocumentSigningPublicKey() {
|
|
6143
|
-
const { loadSigner, loadOrCreateSigner } = await import("./signer-
|
|
6205
|
+
const { loadSigner, loadOrCreateSigner } = await import("./signer-DCMNKXSF.js");
|
|
6144
6206
|
const existing = await loadSigner(this.adapter, this.name, this.getDEK);
|
|
6145
6207
|
if (existing) return { keyId: existing.keyId, publicKeyB64: existing.publicKeyB64 };
|
|
6146
6208
|
if (this.keyring.role !== "owner") {
|
|
@@ -6166,19 +6228,19 @@ var Vault = class {
|
|
|
6166
6228
|
};
|
|
6167
6229
|
}
|
|
6168
6230
|
async revokeAttestation(docId) {
|
|
6169
|
-
const { revokeDocCore } = await import("./revoke-
|
|
6231
|
+
const { revokeDocCore } = await import("./revoke-HNMQZSCL.js");
|
|
6170
6232
|
await revokeDocCore(this.makeRevokeContext(), docId);
|
|
6171
6233
|
}
|
|
6172
6234
|
async unrevokeAttestation(docId) {
|
|
6173
|
-
const { unrevokeDocCore } = await import("./revoke-
|
|
6235
|
+
const { unrevokeDocCore } = await import("./revoke-HNMQZSCL.js");
|
|
6174
6236
|
await unrevokeDocCore(this.makeRevokeContext(), docId);
|
|
6175
6237
|
}
|
|
6176
6238
|
async getRevokedDocIds() {
|
|
6177
|
-
const { getRevokedDocIdsCore } = await import("./revoke-
|
|
6239
|
+
const { getRevokedDocIdsCore } = await import("./revoke-HNMQZSCL.js");
|
|
6178
6240
|
return getRevokedDocIdsCore(this.makeRevokeContext());
|
|
6179
6241
|
}
|
|
6180
6242
|
async publishRevocationList() {
|
|
6181
|
-
const { publishRevocationListCore } = await import("./revoke-
|
|
6243
|
+
const { publishRevocationListCore } = await import("./revoke-HNMQZSCL.js");
|
|
6182
6244
|
return publishRevocationListCore(this.makeRevokeContext());
|
|
6183
6245
|
}
|
|
6184
6246
|
makeRevokeContext() {
|
|
@@ -6312,9 +6374,24 @@ var Vault = class {
|
|
|
6312
6374
|
});
|
|
6313
6375
|
}
|
|
6314
6376
|
if (rule.mode === "cascade") {
|
|
6377
|
+
const txCtx = this.noydb._activeTxContextOrNull;
|
|
6315
6378
|
for (const match of matches) {
|
|
6316
6379
|
const matchId = match["id"] ?? null;
|
|
6317
6380
|
if (matchId === null) continue;
|
|
6381
|
+
if (txCtx !== null) {
|
|
6382
|
+
const prior = await this.adapter.get(this.name, rule.collection, matchId);
|
|
6383
|
+
if (prior !== null) {
|
|
6384
|
+
txCtx._executed.push({
|
|
6385
|
+
op: {
|
|
6386
|
+
type: "delete",
|
|
6387
|
+
vaultName: this.name,
|
|
6388
|
+
collectionName: rule.collection,
|
|
6389
|
+
id: matchId
|
|
6390
|
+
},
|
|
6391
|
+
priorEnvelope: prior
|
|
6392
|
+
});
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6318
6395
|
await fromCollection.delete(matchId);
|
|
6319
6396
|
}
|
|
6320
6397
|
}
|
|
@@ -6495,7 +6572,7 @@ var Vault = class {
|
|
|
6495
6572
|
async _initDerivations(handles) {
|
|
6496
6573
|
if (handles.length === 0) return;
|
|
6497
6574
|
const [{ DerivationRegistry }, { ReadOnlyVaultFacade }] = await Promise.all([
|
|
6498
|
-
import("./registry-
|
|
6575
|
+
import("./registry-EB6SISTA.js"),
|
|
6499
6576
|
import("./read-only-facade-ITU6L7BL.js")
|
|
6500
6577
|
]);
|
|
6501
6578
|
const registry = new DerivationRegistry();
|
|
@@ -6526,7 +6603,7 @@ var Vault = class {
|
|
|
6526
6603
|
*/
|
|
6527
6604
|
async _initMaterializedViews(handles) {
|
|
6528
6605
|
if (handles.length === 0) return;
|
|
6529
|
-
const { MaterializedViewRegistry } = await import("./registry-
|
|
6606
|
+
const { MaterializedViewRegistry } = await import("./registry-UTA4CLQS.js");
|
|
6530
6607
|
const registry = new MaterializedViewRegistry();
|
|
6531
6608
|
this.materializedViewRegistry = registry;
|
|
6532
6609
|
const db = this;
|
|
@@ -6597,13 +6674,13 @@ var Vault = class {
|
|
|
6597
6674
|
if (!reg) {
|
|
6598
6675
|
throw new Error(`refreshView: no MV registered with name "${name}"`);
|
|
6599
6676
|
}
|
|
6600
|
-
const { MaterializedViewExecutor } = await import("./executor-
|
|
6677
|
+
const { MaterializedViewExecutor } = await import("./executor-AZLS3KBK.js");
|
|
6601
6678
|
const result = await MaterializedViewExecutor.refresh(reg, {
|
|
6602
6679
|
getCollection: (n) => this.collection(n),
|
|
6603
6680
|
getActiveTxContext: () => this.noydb._activeTxContextOrNull,
|
|
6604
6681
|
getQueryContext: () => this
|
|
6605
6682
|
});
|
|
6606
|
-
const { clearMVStale } = await import("./stale-
|
|
6683
|
+
const { clearMVStale } = await import("./stale-W5PQTRYH.js");
|
|
6607
6684
|
clearMVStale(registry, name);
|
|
6608
6685
|
return result;
|
|
6609
6686
|
}
|
|
@@ -6644,7 +6721,7 @@ var Vault = class {
|
|
|
6644
6721
|
if (!outSpec) continue;
|
|
6645
6722
|
const outputColl = this.collection(outSpec.collection);
|
|
6646
6723
|
if (out.kind === "array") {
|
|
6647
|
-
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-
|
|
6724
|
+
const { loadFanoutSidecar, saveFanoutSidecar } = await import("./fanout-sidecar-67CMI3UT.js");
|
|
6648
6725
|
const prior = await loadFanoutSidecar(this.adapter, this.name, spec.source, id, key);
|
|
6649
6726
|
const prevKeys = new Set(prior?.keys ?? []);
|
|
6650
6727
|
const newKeysList = out.entries.map((e) => e.key);
|
|
@@ -7356,7 +7433,7 @@ var Vault = class {
|
|
|
7356
7433
|
* @see docs/subsystems/public-envelope.md
|
|
7357
7434
|
*/
|
|
7358
7435
|
async getPublicEnvelope(opts = {}) {
|
|
7359
|
-
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-
|
|
7436
|
+
const { readPublicEnvelope: readPublicEnvelope2 } = await import("./public-envelope-YP2UWMLG.js");
|
|
7360
7437
|
return readPublicEnvelope2(this.adapter, this.name, opts);
|
|
7361
7438
|
}
|
|
7362
7439
|
/**
|
|
@@ -8554,7 +8631,7 @@ var NOT_ENABLED5 = new Error(
|
|
|
8554
8631
|
'Multi-record transactions require the tx strategy. Import `{ withTransactions }` from "@noy-db/hub/tx" and pass it to `createNoydb({ txStrategy: withTransactions() })`.'
|
|
8555
8632
|
);
|
|
8556
8633
|
var NO_TX = {
|
|
8557
|
-
async runTransaction() {
|
|
8634
|
+
async runTransaction(_db, _fn, _options, _txInvariants) {
|
|
8558
8635
|
throw NOT_ENABLED5;
|
|
8559
8636
|
},
|
|
8560
8637
|
async runDryRun() {
|
|
@@ -9565,7 +9642,7 @@ var Noydb = class {
|
|
|
9565
9642
|
if (name === STATE_VAULT_NAME) throw new ReservedVaultNameError(name);
|
|
9566
9643
|
const template = this.vaultTemplates.get(opts.sharding.vaultTemplate);
|
|
9567
9644
|
if (!template) throw new VaultTemplateNotFoundError(opts.sharding.vaultTemplate);
|
|
9568
|
-
const { VaultGroup } = await import("./vault-group-
|
|
9645
|
+
const { VaultGroup } = await import("./vault-group-DX2HFQMX.js");
|
|
9569
9646
|
const { StateManagementVault } = await import("./state-vault-TMXZRTY5.js");
|
|
9570
9647
|
const stateVault = opts.registry ? void 0 : await StateManagementVault.open(this);
|
|
9571
9648
|
const registry = opts.registry ?? stateVault.registry;
|
|
@@ -11095,6 +11172,7 @@ function normalizeSyncTargets(sync) {
|
|
|
11095
11172
|
|
|
11096
11173
|
export {
|
|
11097
11174
|
withArchive,
|
|
11175
|
+
resolveSequenceKey,
|
|
11098
11176
|
SequenceStore,
|
|
11099
11177
|
validateSchemaInput,
|
|
11100
11178
|
validateSchemaOutput,
|
|
@@ -11133,4 +11211,4 @@ export {
|
|
|
11133
11211
|
Noydb,
|
|
11134
11212
|
createNoydb
|
|
11135
11213
|
};
|
|
11136
|
-
//# sourceMappingURL=chunk-
|
|
11214
|
+
//# sourceMappingURL=chunk-667MB6AH.js.map
|