@noy-db/hub 0.2.0-pre.6 → 0.2.0-pre.8
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.js +4 -4
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +4 -4
- package/dist/attestation/index.d.ts +4 -4
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +5 -5
- package/dist/blobs/index.d.ts +5 -5
- package/dist/blobs/index.js +5 -5
- package/dist/bundle/index.cjs +420 -29
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +6 -6
- package/dist/bundle/index.d.ts +6 -6
- package/dist/bundle/index.js +12 -12
- package/dist/{chunk-JICBEFBT.js → chunk-22DWZL57.js} +63 -27
- package/dist/chunk-22DWZL57.js.map +1 -0
- package/dist/{chunk-XDW37COG.js → chunk-2GLDA55J.js} +212 -7
- package/dist/chunk-2GLDA55J.js.map +1 -0
- package/dist/{chunk-RIHZBSWJ.js → chunk-2WUSG3IT.js} +3 -3
- package/dist/{chunk-JSYTGEX4.js → chunk-3BFJOWSU.js} +3 -3
- package/dist/{chunk-Y3P5DEMZ.js → chunk-3YPCK6JX.js} +6 -6
- package/dist/{chunk-A4JNVBPF.js → chunk-53XBRIRT.js} +5 -5
- package/dist/{chunk-CKH247ZR.js → chunk-5T22KDPN.js} +4 -4
- package/dist/{chunk-PX3MJ6RB.js → chunk-5XHKQ56N.js} +3 -3
- package/dist/{chunk-W277AG6N.js → chunk-6774ZOQ7.js} +170 -57
- package/dist/chunk-6774ZOQ7.js.map +1 -0
- package/dist/chunk-6STK5TQP.js +139 -0
- package/dist/chunk-6STK5TQP.js.map +1 -0
- package/dist/{chunk-6HJ2ZALB.js → chunk-B6PB7JLN.js} +66 -2
- package/dist/chunk-B6PB7JLN.js.map +1 -0
- package/dist/{chunk-5QPF2MJ5.js → chunk-BVRYKATC.js} +3 -3
- package/dist/{chunk-UGVDIOY7.js → chunk-DE6GKS6G.js} +2 -2
- package/dist/{chunk-R4LTCI6O.js → chunk-DFMLEQZB.js} +2 -2
- package/dist/{chunk-34XGYMQT.js → chunk-DJHHA6XH.js} +2 -2
- package/dist/{chunk-OPD3PZOG.js → chunk-DL3HWOQ5.js} +4 -4
- package/dist/{chunk-DFCINPB5.js → chunk-DO7C2TOG.js} +2 -2
- package/dist/{chunk-T6MTNGBM.js → chunk-DONMZAD2.js} +4 -4
- package/dist/{chunk-ARZAHCCF.js → chunk-F3GDRNUT.js} +3 -3
- package/dist/{chunk-XVJFFGTG.js → chunk-H2X3ISXG.js} +3 -3
- package/dist/{chunk-R7JTYCRX.js → chunk-HNRHLRDC.js} +2 -2
- package/dist/{chunk-E225X5CQ.js → chunk-I5FOWO4J.js} +3 -3
- package/dist/{chunk-ZQMYB56Z.js → chunk-JWRVQKRZ.js} +3 -3
- package/dist/{chunk-LWFQYT4N.js → chunk-K3DK3NU5.js} +2 -2
- package/dist/{chunk-WEA4TDTJ.js → chunk-ML236QKC.js} +3 -3
- package/dist/{chunk-G26QAQNI.js → chunk-NONAAENK.js} +2 -2
- package/dist/{chunk-YEHUEUNP.js → chunk-O3VZPBZG.js} +4 -4
- package/dist/{chunk-HIELMTUK.js → chunk-OIF6LZUR.js} +2 -2
- package/dist/{chunk-ED3E3OLO.js → chunk-OQ6PIGHA.js} +2 -2
- package/dist/{chunk-6A4AMQ2H.js → chunk-PE2FR4J3.js} +4 -4
- package/dist/{chunk-EKTOYEZ3.js → chunk-PP6W64Y3.js} +2 -2
- package/dist/{chunk-SGSHQ4PH.js → chunk-PX35GA7L.js} +5 -5
- package/dist/{chunk-YJ46RFCD.js → chunk-QEILDE6R.js} +2 -2
- package/dist/{chunk-KGFV72WK.js → chunk-QODLLGQ7.js} +5 -5
- package/dist/{chunk-2GMRNNI3.js → chunk-RAZ4OVLL.js} +2 -2
- package/dist/{chunk-25WFLKOH.js → chunk-SYMWGEET.js} +2 -2
- package/dist/{chunk-7TX7HN42.js → chunk-T7JEBOGN.js} +20 -3
- package/dist/chunk-T7JEBOGN.js.map +1 -0
- package/dist/{chunk-LJO6Q3X6.js → chunk-TFBP23BX.js} +3 -3
- package/dist/{chunk-ICH4AIGL.js → chunk-TV3YZ35S.js} +5 -1
- package/dist/chunk-TV3YZ35S.js.map +1 -0
- package/dist/{chunk-TNBIWSQ7.js → chunk-U26HQ6KJ.js} +2 -2
- package/dist/{chunk-CGJFCT3X.js → chunk-VTKGMEPP.js} +2 -2
- package/dist/{chunk-5VMTAX4Y.js → chunk-W6EQLGMB.js} +2 -2
- package/dist/{chunk-5OVIFUQE.js → chunk-WIRRPTFH.js} +1 -1
- package/dist/chunk-WIRRPTFH.js.map +1 -0
- package/dist/{chunk-PS5G6A3Y.js → chunk-WPLVTJ5D.js} +4 -4
- package/dist/{chunk-MDIC4FAU.js → chunk-XJFLDA7A.js} +2 -2
- package/dist/{chunk-CCC25PA7.js → chunk-ZYWZWG6G.js} +5 -5
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-5UDZZL26.js → crypto-HTZ4FJOP.js} +3 -3
- package/dist/{delegation-42LO4WFO.js → delegation-RI54P6I5.js} +5 -5
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +6 -6
- package/dist/derivations/index.d.ts +6 -6
- package/dist/derivations/index.js +4 -4
- package/dist/{dev-unlock-Dy1qVpkL.d.cts → dev-unlock-M4VAWNq_.d.cts} +1 -1
- package/dist/{dev-unlock-Cvo-xCQC.d.ts → dev-unlock-p3ysikWP.d.ts} +1 -1
- package/dist/executor-5PNY7LGW.js +8 -0
- package/dist/executor-B4QIYGZX.js +8 -0
- package/dist/executor-BWXXDQ7K.js +11 -0
- package/dist/{fanout-sidecar-EVICRM46.js → fanout-sidecar-OKPMMPLG.js} +2 -2
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +6 -6
- package/dist/guards/index.d.ts +6 -6
- package/dist/guards/index.js +3 -3
- package/dist/{hash-BgEQklQc.d.cts → hash-BPsYPcv_.d.cts} +1 -1
- package/dist/{hash-BAlWR4WD.d.ts → hash-C1GtiOhR.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +6 -6
- package/dist/history/index.d.ts +6 -6
- package/dist/history/index.js +5 -5
- package/dist/i18n/index.cjs +217 -22
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +5 -5
- package/dist/i18n/index.d.ts +5 -5
- package/dist/i18n/index.js +16 -5
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-5I0MZ0jQ.d.cts → index-4fBVt8j9.d.cts} +104 -7
- package/dist/{index-fIPPh5dg.d.ts → index-D8I_pyJD.d.ts} +104 -7
- package/dist/index.cjs +625 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +70 -52
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +4 -0
- 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 +4 -4
- package/dist/issue-VGDPP4B5.js +12 -0
- package/dist/{lazy-builder-D1MyR1qH.d.ts → lazy-builder-7tIpFyWN.d.ts} +1 -1
- package/dist/{lazy-builder-DXlSCNCJ.d.cts → lazy-builder-wY4pMCEe.d.cts} +1 -1
- package/dist/{ledger-UX4QIHWI.js → ledger-TMRZYNVJ.js} +5 -5
- package/dist/materialized-views/index.cjs +18 -1
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +10 -8
- package/dist/materialized-views/index.d.ts +10 -8
- package/dist/materialized-views/index.js +12 -12
- package/dist/noydb-LZBH3XDK.js +34 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +6 -6
- package/dist/overlay-views/index.d.ts +6 -6
- package/dist/overlay-views/index.js +6 -6
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +5 -5
- package/dist/periods/index.d.ts +5 -5
- package/dist/periods/index.js +5 -5
- package/dist/{predicate-B0IKeBXx.d.cts → predicate-BSAGEyu5.d.cts} +26 -2
- package/dist/{predicate-B0IKeBXx.d.ts → predicate-BSAGEyu5.d.ts} +26 -2
- package/dist/{public-envelope-YKHKP74C.js → public-envelope-BW6OXORV.js} +4 -4
- package/dist/query/index.cjs +244 -4
- 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 +12 -6
- package/dist/registry-3QP3YKQS.js +8 -0
- package/dist/{registry-4NEW7LQY.js → registry-OJIOSBV6.js} +3 -3
- package/dist/registry-USRVT6YF.js +8 -0
- package/dist/{revoke-R5NIQ74J.js → revoke-JCC7N56X.js} +6 -6
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +6 -6
- package/dist/session/index.d.ts +6 -6
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +5 -5
- package/dist/shadow/index.d.ts +5 -5
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-WGDJNWSU.js → signer-72QAUSVW.js} +5 -5
- package/dist/snapshots/index.cjs +903 -0
- package/dist/snapshots/index.cjs.map +1 -0
- package/dist/snapshots/index.d.cts +21 -0
- package/dist/snapshots/index.d.ts +21 -0
- package/dist/snapshots/index.js +118 -0
- package/dist/snapshots/index.js.map +1 -0
- package/dist/{stale-74WGLVZ2.js → stale-6ZDBTQT7.js} +2 -2
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +5 -5
- package/dist/store/index.d.ts +5 -5
- package/dist/store/index.js +2 -2
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +4 -4
- package/dist/sync/index.d.ts +4 -4
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +5 -5
- package/dist/team/index.d.ts +5 -5
- package/dist/team/index.js +8 -8
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +5 -5
- package/dist/tx/index.d.ts +5 -5
- package/dist/tx/index.js +3 -3
- package/dist/{types-DlnZh1_i.d.ts → types-DGU60JDt.d.ts} +235 -7
- package/dist/{types-DVlvNn2c.d.cts → types-DjunxzJa.d.cts} +235 -7
- package/dist/{ulid-CzPONlhG.d.ts → ulid-BFJkYRRW.d.ts} +1 -1
- package/dist/{ulid-r98nkjVd.d.cts → ulid-DPeuPgi3.d.cts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{with-derivation-BMQ9pIHe.d.cts → with-derivation-Df0kMlED.d.cts} +1 -1
- package/dist/{with-derivation-B98shCV8.d.ts → with-derivation-DfOpKjFw.d.ts} +1 -1
- package/dist/{with-guard-DmT50nVG.d.ts → with-guard-0KksDtSR.d.ts} +1 -1
- package/dist/{with-guard-DUnC3JDN.d.cts → with-guard-C6W5RVrH.d.cts} +1 -1
- package/dist/{with-materialized-view-Bp_M3sNG.d.ts → with-materialized-view-BiasFcYx.d.ts} +1 -1
- package/dist/{with-materialized-view-eMTZ65_J.d.cts → with-materialized-view-BmDKyHrm.d.cts} +1 -1
- package/dist/{with-overlayed-view-BoY6PB3n.d.cts → with-overlayed-view-CA66vhHz.d.cts} +1 -1
- package/dist/{with-overlayed-view-zzSnRQmS.d.ts → with-overlayed-view-CQViuko_.d.ts} +1 -1
- package/package.json +15 -4
- package/dist/chunk-5OVIFUQE.js.map +0 -1
- package/dist/chunk-6HJ2ZALB.js.map +0 -1
- package/dist/chunk-7TX7HN42.js.map +0 -1
- package/dist/chunk-ICH4AIGL.js.map +0 -1
- package/dist/chunk-JICBEFBT.js.map +0 -1
- package/dist/chunk-W277AG6N.js.map +0 -1
- package/dist/chunk-XDW37COG.js.map +0 -1
- package/dist/executor-AWCHQ2KN.js +0 -8
- package/dist/executor-RWICJI7J.js +0 -11
- package/dist/executor-SOLEQVUB.js +0 -8
- package/dist/issue-IODMTPME.js +0 -12
- package/dist/noydb-FY2666NY.js +0 -34
- package/dist/registry-446I2NMN.js +0 -8
- package/dist/registry-524KJZG4.js +0 -8
- /package/dist/{chunk-RIHZBSWJ.js.map → chunk-2WUSG3IT.js.map} +0 -0
- /package/dist/{chunk-JSYTGEX4.js.map → chunk-3BFJOWSU.js.map} +0 -0
- /package/dist/{chunk-Y3P5DEMZ.js.map → chunk-3YPCK6JX.js.map} +0 -0
- /package/dist/{chunk-A4JNVBPF.js.map → chunk-53XBRIRT.js.map} +0 -0
- /package/dist/{chunk-CKH247ZR.js.map → chunk-5T22KDPN.js.map} +0 -0
- /package/dist/{chunk-PX3MJ6RB.js.map → chunk-5XHKQ56N.js.map} +0 -0
- /package/dist/{chunk-5QPF2MJ5.js.map → chunk-BVRYKATC.js.map} +0 -0
- /package/dist/{chunk-UGVDIOY7.js.map → chunk-DE6GKS6G.js.map} +0 -0
- /package/dist/{chunk-R4LTCI6O.js.map → chunk-DFMLEQZB.js.map} +0 -0
- /package/dist/{chunk-34XGYMQT.js.map → chunk-DJHHA6XH.js.map} +0 -0
- /package/dist/{chunk-OPD3PZOG.js.map → chunk-DL3HWOQ5.js.map} +0 -0
- /package/dist/{chunk-DFCINPB5.js.map → chunk-DO7C2TOG.js.map} +0 -0
- /package/dist/{chunk-T6MTNGBM.js.map → chunk-DONMZAD2.js.map} +0 -0
- /package/dist/{chunk-ARZAHCCF.js.map → chunk-F3GDRNUT.js.map} +0 -0
- /package/dist/{chunk-XVJFFGTG.js.map → chunk-H2X3ISXG.js.map} +0 -0
- /package/dist/{chunk-R7JTYCRX.js.map → chunk-HNRHLRDC.js.map} +0 -0
- /package/dist/{chunk-E225X5CQ.js.map → chunk-I5FOWO4J.js.map} +0 -0
- /package/dist/{chunk-ZQMYB56Z.js.map → chunk-JWRVQKRZ.js.map} +0 -0
- /package/dist/{chunk-LWFQYT4N.js.map → chunk-K3DK3NU5.js.map} +0 -0
- /package/dist/{chunk-WEA4TDTJ.js.map → chunk-ML236QKC.js.map} +0 -0
- /package/dist/{chunk-G26QAQNI.js.map → chunk-NONAAENK.js.map} +0 -0
- /package/dist/{chunk-YEHUEUNP.js.map → chunk-O3VZPBZG.js.map} +0 -0
- /package/dist/{chunk-HIELMTUK.js.map → chunk-OIF6LZUR.js.map} +0 -0
- /package/dist/{chunk-ED3E3OLO.js.map → chunk-OQ6PIGHA.js.map} +0 -0
- /package/dist/{chunk-6A4AMQ2H.js.map → chunk-PE2FR4J3.js.map} +0 -0
- /package/dist/{chunk-EKTOYEZ3.js.map → chunk-PP6W64Y3.js.map} +0 -0
- /package/dist/{chunk-SGSHQ4PH.js.map → chunk-PX35GA7L.js.map} +0 -0
- /package/dist/{chunk-YJ46RFCD.js.map → chunk-QEILDE6R.js.map} +0 -0
- /package/dist/{chunk-KGFV72WK.js.map → chunk-QODLLGQ7.js.map} +0 -0
- /package/dist/{chunk-2GMRNNI3.js.map → chunk-RAZ4OVLL.js.map} +0 -0
- /package/dist/{chunk-25WFLKOH.js.map → chunk-SYMWGEET.js.map} +0 -0
- /package/dist/{chunk-LJO6Q3X6.js.map → chunk-TFBP23BX.js.map} +0 -0
- /package/dist/{chunk-TNBIWSQ7.js.map → chunk-U26HQ6KJ.js.map} +0 -0
- /package/dist/{chunk-CGJFCT3X.js.map → chunk-VTKGMEPP.js.map} +0 -0
- /package/dist/{chunk-5VMTAX4Y.js.map → chunk-W6EQLGMB.js.map} +0 -0
- /package/dist/{chunk-PS5G6A3Y.js.map → chunk-WPLVTJ5D.js.map} +0 -0
- /package/dist/{chunk-MDIC4FAU.js.map → chunk-XJFLDA7A.js.map} +0 -0
- /package/dist/{chunk-CCC25PA7.js.map → chunk-ZYWZWG6G.js.map} +0 -0
- /package/dist/{crypto-5UDZZL26.js.map → crypto-HTZ4FJOP.js.map} +0 -0
- /package/dist/{delegation-42LO4WFO.js.map → delegation-RI54P6I5.js.map} +0 -0
- /package/dist/{executor-AWCHQ2KN.js.map → executor-5PNY7LGW.js.map} +0 -0
- /package/dist/{executor-RWICJI7J.js.map → executor-B4QIYGZX.js.map} +0 -0
- /package/dist/{executor-SOLEQVUB.js.map → executor-BWXXDQ7K.js.map} +0 -0
- /package/dist/{fanout-sidecar-EVICRM46.js.map → fanout-sidecar-OKPMMPLG.js.map} +0 -0
- /package/dist/{issue-IODMTPME.js.map → issue-VGDPP4B5.js.map} +0 -0
- /package/dist/{ledger-UX4QIHWI.js.map → ledger-TMRZYNVJ.js.map} +0 -0
- /package/dist/{noydb-FY2666NY.js.map → noydb-LZBH3XDK.js.map} +0 -0
- /package/dist/{public-envelope-YKHKP74C.js.map → public-envelope-BW6OXORV.js.map} +0 -0
- /package/dist/{registry-446I2NMN.js.map → registry-3QP3YKQS.js.map} +0 -0
- /package/dist/{registry-4NEW7LQY.js.map → registry-OJIOSBV6.js.map} +0 -0
- /package/dist/{registry-524KJZG4.js.map → registry-USRVT6YF.js.map} +0 -0
- /package/dist/{revoke-R5NIQ74J.js.map → revoke-JCC7N56X.js.map} +0 -0
- /package/dist/{signer-WGDJNWSU.js.map → signer-72QAUSVW.js.map} +0 -0
- /package/dist/{stale-74WGLVZ2.js.map → stale-6ZDBTQT7.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var init_types = __esm({
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
// src/errors.ts
|
|
49
|
-
var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError;
|
|
49
|
+
var NoydbError, DecryptionError, TamperedError, InvalidKeyError, KeyringCorruptError, NoAccessError, ReadOnlyError, ReadOnlyAtInstantError, ReadOnlyFrameError, PermissionDeniedError, ExportCapabilityError, KeyringExpiredError, ImportCapabilityError, StoreCapabilityError, PrivilegeEscalationError, PeriodClosedError, RecordLockedError, FieldFrozenError, InvariantError, AmendmentForbiddenError, DirectoryDisabledError, TierNotGrantedError, ElevationExpiredError, AlreadyElevatedError, TierDemoteDeniedError, DelegationTargetMissingError, ConflictError, LedgerContentionError, BundleVersionConflictError, NetworkError, NotFoundError, ValidationError, SchemaValidationError, SchemaUpdateError, NonAdditiveSchemaChangeError, SchemaLockedError, SchemaFenceError, MigrationRequiredError, QuiesceTimeoutError, GroupCardinalityError, IndexRequiredError, IndexWriteFailureError, BundleIntegrityError, BundleSealMismatchError, ReservedCollectionNameError, DictKeyMissingError, DictKeyInUseError, MissingTranslationError, LocaleNotSpecifiedError, ScriptViolationError, TranslatorNotConfiguredError, BackupLedgerError, BackupCorruptedError, AttestationError, SessionExpiredError, SessionNotFoundError, SessionPolicyError, JoinTooLargeError, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError;
|
|
50
50
|
var init_errors = __esm({
|
|
51
51
|
"src/errors.ts"() {
|
|
52
52
|
"use strict";
|
|
@@ -564,6 +564,27 @@ Resolutions:
|
|
|
564
564
|
this.field = field;
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
|
+
ScriptViolationError = class extends NoydbError {
|
|
568
|
+
/** The field whose value violated its script constraint. */
|
|
569
|
+
field;
|
|
570
|
+
/** The locale slot (e.g. `'en'`) that was checked. */
|
|
571
|
+
locale;
|
|
572
|
+
/** The Unicode scripts allowed for this slot. */
|
|
573
|
+
expected;
|
|
574
|
+
/** A short sample of the offending characters, for diagnostics. */
|
|
575
|
+
sample;
|
|
576
|
+
constructor(field, locale, expected, sample, message) {
|
|
577
|
+
super(
|
|
578
|
+
"SCRIPT_VIOLATION",
|
|
579
|
+
message ?? `Field "${field}" slot "${locale}" expects script(s) [${expected.join(", ")}] but contains disallowed character(s): "${sample}".`
|
|
580
|
+
);
|
|
581
|
+
this.name = "ScriptViolationError";
|
|
582
|
+
this.field = field;
|
|
583
|
+
this.locale = locale;
|
|
584
|
+
this.expected = expected;
|
|
585
|
+
this.sample = sample;
|
|
586
|
+
}
|
|
587
|
+
};
|
|
567
588
|
TranslatorNotConfiguredError = class extends NoydbError {
|
|
568
589
|
/** The field that requested auto-translation. */
|
|
569
590
|
field;
|
|
@@ -646,6 +667,34 @@ Resolutions:
|
|
|
646
667
|
this.side = opts.side;
|
|
647
668
|
}
|
|
648
669
|
};
|
|
670
|
+
CrossJoinTooLargeError = class extends NoydbError {
|
|
671
|
+
target;
|
|
672
|
+
expected;
|
|
673
|
+
limit;
|
|
674
|
+
constructor(opts) {
|
|
675
|
+
super(
|
|
676
|
+
"CROSS_JOIN_TOO_LARGE",
|
|
677
|
+
`crossJoin("${opts.target}"): would produce ${opts.expected} rows, exceeding the limit of ${opts.limit}. Narrow the left side with .where() first, or raise the ceiling with crossJoin("${opts.target}", { ..., maxRows: ${opts.expected} }).`
|
|
678
|
+
);
|
|
679
|
+
this.name = "CrossJoinTooLargeError";
|
|
680
|
+
this.target = opts.target;
|
|
681
|
+
this.expected = opts.expected;
|
|
682
|
+
this.limit = opts.limit;
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
CrossJoinSourceUnknownError = class extends NoydbError {
|
|
686
|
+
target;
|
|
687
|
+
leftCollection;
|
|
688
|
+
constructor(target, leftCollection) {
|
|
689
|
+
super(
|
|
690
|
+
"CROSS_JOIN_SOURCE_UNKNOWN",
|
|
691
|
+
`crossJoin("${target}"): collection "${target}" is not known in the vault (cross-joining from "${leftCollection}"). Make sure "${target}" is open in the same vault before executing this query.`
|
|
692
|
+
);
|
|
693
|
+
this.name = "CrossJoinSourceUnknownError";
|
|
694
|
+
this.target = target;
|
|
695
|
+
this.leftCollection = leftCollection;
|
|
696
|
+
}
|
|
697
|
+
};
|
|
649
698
|
DanglingReferenceError = class extends NoydbError {
|
|
650
699
|
field;
|
|
651
700
|
target;
|
|
@@ -836,6 +885,17 @@ Resolutions:
|
|
|
836
885
|
this.expected = expected;
|
|
837
886
|
}
|
|
838
887
|
};
|
|
888
|
+
SnapshotNotFoundError = class extends NoydbError {
|
|
889
|
+
version;
|
|
890
|
+
constructor(version) {
|
|
891
|
+
super(
|
|
892
|
+
"SNAPSHOT_NOT_FOUND",
|
|
893
|
+
`Snapshot not found: "${version}" does not exist in the snapshot store. It may have been pruned by the retention policy or deleted manually.`
|
|
894
|
+
);
|
|
895
|
+
this.name = "SnapshotNotFoundError";
|
|
896
|
+
this.version = version;
|
|
897
|
+
}
|
|
898
|
+
};
|
|
839
899
|
}
|
|
840
900
|
});
|
|
841
901
|
|
|
@@ -2231,6 +2291,10 @@ function evaluateClause(record, clause) {
|
|
|
2231
2291
|
return clause.fn(record);
|
|
2232
2292
|
case "wherePredicate":
|
|
2233
2293
|
return clause.fn(record, clause.ctx);
|
|
2294
|
+
case "crossJoin":
|
|
2295
|
+
throw new Error(
|
|
2296
|
+
`evaluateClause: 'crossJoin' clauses are expansion primitives and are not evaluated per-record. This is a query planner routing error \u2014 crossJoin clauses must be extracted from the clause list before calling evaluateClause or filterRecords.`
|
|
2297
|
+
);
|
|
2234
2298
|
case "group":
|
|
2235
2299
|
if (clause.op === "and") {
|
|
2236
2300
|
for (const child of clause.clauses) {
|
|
@@ -2800,6 +2864,11 @@ function analyzeDependencies(query) {
|
|
|
2800
2864
|
for (const leg of plan.joins) {
|
|
2801
2865
|
deps.add(leg.target);
|
|
2802
2866
|
}
|
|
2867
|
+
for (const clause of plan.clauses) {
|
|
2868
|
+
if (clause.type === "crossJoin") {
|
|
2869
|
+
deps.add(clause.target);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2803
2872
|
walkClausesForJoins(plan, deps, ctx);
|
|
2804
2873
|
return deps;
|
|
2805
2874
|
}
|
|
@@ -2815,7 +2884,19 @@ function summarizeQueryPlan(query) {
|
|
|
2815
2884
|
const ctx = query._joinContext();
|
|
2816
2885
|
return JSON.stringify({
|
|
2817
2886
|
root: ctx?.leftCollection ?? null,
|
|
2818
|
-
clauses: plan.clauses
|
|
2887
|
+
clauses: plan.clauses.map((c) => {
|
|
2888
|
+
if (c.type === "crossJoin") {
|
|
2889
|
+
return {
|
|
2890
|
+
type: "crossJoin",
|
|
2891
|
+
target: c.target,
|
|
2892
|
+
as: c.as,
|
|
2893
|
+
// Inline on: callback: use sentinel — drift detection disabled for this MV
|
|
2894
|
+
onPredicateName: c.onPredicateName ?? (c.on ? "[inline]" : null),
|
|
2895
|
+
maxRows: c.maxRows ?? null
|
|
2896
|
+
};
|
|
2897
|
+
}
|
|
2898
|
+
return c;
|
|
2899
|
+
}),
|
|
2819
2900
|
orderBy: plan.orderBy,
|
|
2820
2901
|
limit: plan.limit ?? null,
|
|
2821
2902
|
offset: plan.offset,
|
|
@@ -3942,7 +4023,10 @@ __export(src_exports, {
|
|
|
3942
4023
|
CollectionIndexes: () => CollectionIndexes,
|
|
3943
4024
|
CollectionInstant: () => CollectionInstant,
|
|
3944
4025
|
ConflictError: () => ConflictError,
|
|
4026
|
+
CrossJoinSourceUnknownError: () => CrossJoinSourceUnknownError,
|
|
4027
|
+
CrossJoinTooLargeError: () => CrossJoinTooLargeError,
|
|
3945
4028
|
DEFAULT_CHUNK_SIZE: () => DEFAULT_CHUNK_SIZE,
|
|
4029
|
+
DEFAULT_CROSS_JOIN_MAX_ROWS: () => DEFAULT_CROSS_JOIN_MAX_ROWS,
|
|
3946
4030
|
DEFAULT_FRESHNESS_MS: () => DEFAULT_FRESHNESS_MS,
|
|
3947
4031
|
DEFAULT_JOIN_MAX_ROWS: () => DEFAULT_JOIN_MAX_ROWS,
|
|
3948
4032
|
DEFAULT_PUBLIC_ENVELOPE_SCHEMA: () => DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
|
|
@@ -4052,9 +4136,11 @@ __export(src_exports, {
|
|
|
4052
4136
|
SchemaLockedError: () => SchemaLockedError,
|
|
4053
4137
|
SchemaUpdateError: () => SchemaUpdateError,
|
|
4054
4138
|
SchemaValidationError: () => SchemaValidationError,
|
|
4139
|
+
ScriptViolationError: () => ScriptViolationError,
|
|
4055
4140
|
SessionExpiredError: () => SessionExpiredError,
|
|
4056
4141
|
SessionNotFoundError: () => SessionNotFoundError,
|
|
4057
4142
|
SessionPolicyError: () => SessionPolicyError,
|
|
4143
|
+
SnapshotNotFoundError: () => SnapshotNotFoundError,
|
|
4058
4144
|
StoreCapabilityError: () => StoreCapabilityError,
|
|
4059
4145
|
SyncEngine: () => SyncEngine,
|
|
4060
4146
|
SyncScheduler: () => SyncScheduler,
|
|
@@ -4126,6 +4212,7 @@ __export(src_exports, {
|
|
|
4126
4212
|
enableDevUnlock: () => enableDevUnlock,
|
|
4127
4213
|
encryptBytes: () => encryptBytes,
|
|
4128
4214
|
encryptDeterministic: () => encryptDeterministic,
|
|
4215
|
+
enforceScript: () => enforceScript,
|
|
4129
4216
|
enrollAuthenticator: () => enrollAuthenticator,
|
|
4130
4217
|
envelopePayloadHash: () => envelopePayloadHash,
|
|
4131
4218
|
estimateEntropy: () => estimateEntropy,
|
|
@@ -4146,6 +4233,7 @@ __export(src_exports, {
|
|
|
4146
4233
|
hasRecoveryEnrolled: () => hasRecoveryEnrolled,
|
|
4147
4234
|
hashEntry: () => hashEntry,
|
|
4148
4235
|
i18nText: () => i18nText,
|
|
4236
|
+
inferScripts: () => inferScripts,
|
|
4149
4237
|
isDevUnlockActive: () => isDevUnlockActive,
|
|
4150
4238
|
isDictCollectionName: () => isDictCollectionName,
|
|
4151
4239
|
isDictKeyDescriptor: () => isDictKeyDescriptor,
|
|
@@ -4206,6 +4294,7 @@ __export(src_exports, {
|
|
|
4206
4294
|
resetJoinWarnings: () => resetJoinWarnings,
|
|
4207
4295
|
resolveCrdtSnapshot: () => resolveCrdtSnapshot,
|
|
4208
4296
|
resolveI18nText: () => resolveI18nText,
|
|
4297
|
+
resolvePolicy: () => resolvePolicy,
|
|
4209
4298
|
resolvePublicEnvelopeSchema: () => resolveSchema,
|
|
4210
4299
|
resolveSession: () => resolveSession,
|
|
4211
4300
|
revokeAllSessions: () => revokeAllSessions,
|
|
@@ -6223,6 +6312,7 @@ function withHealthCheck(opts = {}) {
|
|
|
6223
6312
|
|
|
6224
6313
|
// src/index.ts
|
|
6225
6314
|
init_errors();
|
|
6315
|
+
init_errors();
|
|
6226
6316
|
|
|
6227
6317
|
// src/bundle/format.ts
|
|
6228
6318
|
var NOYDB_BUNDLE_MAGIC = new Uint8Array([78, 68, 66, 49]);
|
|
@@ -9679,6 +9769,16 @@ var NO_CRDT = {
|
|
|
9679
9769
|
|
|
9680
9770
|
// src/i18n/core.ts
|
|
9681
9771
|
init_errors();
|
|
9772
|
+
|
|
9773
|
+
// src/i18n/policy.ts
|
|
9774
|
+
function resolvePolicy(onMissing, layer) {
|
|
9775
|
+
const explicit = onMissing && typeof onMissing === "object" ? onMissing[layer] : void 0;
|
|
9776
|
+
const scalar = typeof onMissing === "string" ? onMissing : void 0;
|
|
9777
|
+
const layerDefault = layer === "guard" ? "substitute" : void 0;
|
|
9778
|
+
return explicit ?? layerDefault ?? scalar ?? "throw";
|
|
9779
|
+
}
|
|
9780
|
+
|
|
9781
|
+
// src/i18n/core.ts
|
|
9682
9782
|
function i18nText(options) {
|
|
9683
9783
|
return { _noydbI18nText: true, options };
|
|
9684
9784
|
}
|
|
@@ -9741,7 +9841,21 @@ function validateI18nTextValue(value, field, descriptor) {
|
|
|
9741
9841
|
}
|
|
9742
9842
|
}
|
|
9743
9843
|
}
|
|
9744
|
-
function
|
|
9844
|
+
function toChain(fallback) {
|
|
9845
|
+
return Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
|
|
9846
|
+
}
|
|
9847
|
+
function pickFromChain(value, chain) {
|
|
9848
|
+
for (const fb of chain) {
|
|
9849
|
+
if (fb === "any") {
|
|
9850
|
+
const any = Object.values(value).find((v) => v !== "");
|
|
9851
|
+
if (any !== void 0) return any;
|
|
9852
|
+
} else if (value[fb] !== void 0 && value[fb] !== "") {
|
|
9853
|
+
return value[fb];
|
|
9854
|
+
}
|
|
9855
|
+
}
|
|
9856
|
+
return void 0;
|
|
9857
|
+
}
|
|
9858
|
+
function resolveI18nText(value, locale, fallback, field, opts) {
|
|
9745
9859
|
if (locale === "raw") {
|
|
9746
9860
|
return value;
|
|
9747
9861
|
}
|
|
@@ -9751,19 +9865,21 @@ function resolveI18nText(value, locale, fallback, field) {
|
|
|
9751
9865
|
if (value[locale] !== void 0 && value[locale] !== "") {
|
|
9752
9866
|
return value[locale];
|
|
9753
9867
|
}
|
|
9754
|
-
const
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9868
|
+
const policy = opts?.policy ?? "throw";
|
|
9869
|
+
const callerChain = toChain(fallback);
|
|
9870
|
+
const callerHit = pickFromChain(value, callerChain);
|
|
9871
|
+
if (callerHit !== void 0) return callerHit;
|
|
9872
|
+
if (policy === "substitute") {
|
|
9873
|
+
const subHit = pickFromChain(value, toChain(opts?.substitute));
|
|
9874
|
+
if (subHit !== void 0) return subHit;
|
|
9875
|
+
}
|
|
9876
|
+
if (policy === "throw") {
|
|
9877
|
+
throw new LocaleNotSpecifiedError(
|
|
9878
|
+
field ?? "<unknown>",
|
|
9879
|
+
`No translation available for locale "${locale}"` + (callerChain.length > 0 ? ` or fallback chain [${callerChain.join(", ")}]` : "") + "."
|
|
9880
|
+
);
|
|
9762
9881
|
}
|
|
9763
|
-
|
|
9764
|
-
field ?? "<unknown>",
|
|
9765
|
-
`No translation available for locale "${locale}"` + (chain.length > 0 ? ` or fallback chain [${chain.join(", ")}]` : "") + "."
|
|
9766
|
-
);
|
|
9882
|
+
return null;
|
|
9767
9883
|
}
|
|
9768
9884
|
function getAtPath(obj, path) {
|
|
9769
9885
|
const arrayIdx = path.indexOf("[].");
|
|
@@ -9800,7 +9916,7 @@ function setAtPathInPlace(obj, path, value) {
|
|
|
9800
9916
|
}
|
|
9801
9917
|
obj[path] = value;
|
|
9802
9918
|
}
|
|
9803
|
-
function applyAtPath(obj, path, locale, fallback) {
|
|
9919
|
+
function applyAtPath(obj, path, locale, fallback, opts) {
|
|
9804
9920
|
const arrayIdx = path.indexOf("[].");
|
|
9805
9921
|
if (arrayIdx !== -1) {
|
|
9806
9922
|
const arrayKey = path.slice(0, arrayIdx);
|
|
@@ -9811,7 +9927,7 @@ function applyAtPath(obj, path, locale, fallback) {
|
|
|
9811
9927
|
...obj,
|
|
9812
9928
|
[arrayKey]: arr.map((item) => {
|
|
9813
9929
|
if (!item || typeof item !== "object" || Array.isArray(item)) return item;
|
|
9814
|
-
return applyAtPath(item, restPath, locale, fallback);
|
|
9930
|
+
return applyAtPath(item, restPath, locale, fallback, opts);
|
|
9815
9931
|
})
|
|
9816
9932
|
};
|
|
9817
9933
|
}
|
|
@@ -9823,7 +9939,7 @@ function applyAtPath(obj, path, locale, fallback) {
|
|
|
9823
9939
|
if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
|
|
9824
9940
|
return {
|
|
9825
9941
|
...obj,
|
|
9826
|
-
[head]: applyAtPath(nested, rest, locale, fallback)
|
|
9942
|
+
[head]: applyAtPath(nested, rest, locale, fallback, opts)
|
|
9827
9943
|
};
|
|
9828
9944
|
}
|
|
9829
9945
|
const raw = obj[path];
|
|
@@ -9831,15 +9947,20 @@ function applyAtPath(obj, path, locale, fallback) {
|
|
|
9831
9947
|
if (typeof raw !== "object" || Array.isArray(raw)) return obj;
|
|
9832
9948
|
return {
|
|
9833
9949
|
...obj,
|
|
9834
|
-
[path]: resolveI18nText(raw, locale, fallback, path)
|
|
9950
|
+
[path]: resolveI18nText(raw, locale, fallback, path, opts)
|
|
9835
9951
|
};
|
|
9836
9952
|
}
|
|
9837
|
-
function applyI18nLocale(record, i18nFields, locale, fallback) {
|
|
9953
|
+
function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
|
|
9838
9954
|
const fieldNames = Object.keys(i18nFields);
|
|
9839
9955
|
if (fieldNames.length === 0) return record;
|
|
9840
9956
|
let result = record;
|
|
9841
|
-
for (const field of
|
|
9842
|
-
|
|
9957
|
+
for (const [field, descriptor] of Object.entries(i18nFields)) {
|
|
9958
|
+
const { onMissing, substitute } = descriptor.options;
|
|
9959
|
+
const opts = {
|
|
9960
|
+
policy: resolvePolicy(onMissing, layer),
|
|
9961
|
+
...substitute !== void 0 ? { substitute } : {}
|
|
9962
|
+
};
|
|
9963
|
+
result = applyAtPath(result, field, locale, fallback, opts);
|
|
9843
9964
|
}
|
|
9844
9965
|
return result;
|
|
9845
9966
|
}
|
|
@@ -9857,6 +9978,9 @@ var NO_I18N = {
|
|
|
9857
9978
|
validateI18nTextValue() {
|
|
9858
9979
|
throw notEnabled("i18nText field validation");
|
|
9859
9980
|
},
|
|
9981
|
+
enforceScript(value) {
|
|
9982
|
+
return { value, warnings: [] };
|
|
9983
|
+
},
|
|
9860
9984
|
buildDictionaryHandle() {
|
|
9861
9985
|
throw notEnabled("vault.dictionary()");
|
|
9862
9986
|
}
|
|
@@ -10065,6 +10189,9 @@ function resetJoinWarnings() {
|
|
|
10065
10189
|
warnedCeilingKeys.clear();
|
|
10066
10190
|
}
|
|
10067
10191
|
|
|
10192
|
+
// src/query/builder.ts
|
|
10193
|
+
init_errors();
|
|
10194
|
+
|
|
10068
10195
|
// src/query/live.ts
|
|
10069
10196
|
function buildLiveQuery(recompute, upstreams) {
|
|
10070
10197
|
return new LiveQueryImpl(recompute, upstreams);
|
|
@@ -10163,6 +10290,7 @@ var EMPTY_PLAN = {
|
|
|
10163
10290
|
offset: 0,
|
|
10164
10291
|
joins: []
|
|
10165
10292
|
};
|
|
10293
|
+
var DEFAULT_CROSS_JOIN_MAX_ROWS = 5e4;
|
|
10166
10294
|
var Query = class _Query {
|
|
10167
10295
|
source;
|
|
10168
10296
|
plan;
|
|
@@ -10444,6 +10572,78 @@ var Query = class _Query {
|
|
|
10444
10572
|
this.predicates
|
|
10445
10573
|
);
|
|
10446
10574
|
}
|
|
10575
|
+
/**
|
|
10576
|
+
* Cartesian-product cross-join against `target` collection. Each result row
|
|
10577
|
+
* carries the original `T` fields plus `result[as]` populated from every
|
|
10578
|
+
* right-side row (or the filtered subset when `on:` is supplied).
|
|
10579
|
+
*
|
|
10580
|
+
* **Order matters:** `.where().crossJoin()` filters BEFORE expanding (cheaper);
|
|
10581
|
+
* `.crossJoin().where('alias.field', ...)` filters AFTER (required when the
|
|
10582
|
+
* where clause references the aliased fields).
|
|
10583
|
+
*
|
|
10584
|
+
* **Cost ceiling:** `CrossJoinTooLargeError` fires before allocation when
|
|
10585
|
+
* `leftRows × rightRows` (or the cumulative lateral count) exceeds the limit.
|
|
10586
|
+
* Default: 50,000 rows. Override per-clause with `{ maxRows: N }`.
|
|
10587
|
+
*
|
|
10588
|
+
* **`on:` shapes:**
|
|
10589
|
+
* - `on: (left) => TTarget[]` — subset form (most efficient)
|
|
10590
|
+
* - `on: (left) => (right) => boolean` — predicate form
|
|
10591
|
+
* - `on: { predicate: 'name' }` — MV-safe, hash-tracked form
|
|
10592
|
+
* (requires the Query to have been augmented via `_withPredicates`)
|
|
10593
|
+
*
|
|
10594
|
+
* Requires a JoinContext (constructed via `collection.query()`).
|
|
10595
|
+
*/
|
|
10596
|
+
crossJoin(target, opts) {
|
|
10597
|
+
if (!this.joinContext) {
|
|
10598
|
+
throw new Error(
|
|
10599
|
+
`Query.crossJoin("${target}"): requires a join context. Use collection.query() to construct a cross-join-capable Query instead of the Query constructor directly.`
|
|
10600
|
+
);
|
|
10601
|
+
}
|
|
10602
|
+
let onFn;
|
|
10603
|
+
let onPredicateName;
|
|
10604
|
+
if (opts.on !== void 0) {
|
|
10605
|
+
if (typeof opts.on === "function") {
|
|
10606
|
+
onFn = opts.on;
|
|
10607
|
+
if (this.predicates) {
|
|
10608
|
+
console.warn(
|
|
10609
|
+
`Query.crossJoin("${target}", { on: callback }): inline on: callback inside a withMaterializedView query() disables queryHash drift detection for this cross-join. Use on: { predicate: '<name>' } to enable it.`
|
|
10610
|
+
);
|
|
10611
|
+
}
|
|
10612
|
+
} else {
|
|
10613
|
+
const predName = opts.on.predicate;
|
|
10614
|
+
if (!this.predicates) {
|
|
10615
|
+
throw new Error(
|
|
10616
|
+
`Query.crossJoin("${target}", { on: { predicate: "${predName}" } }): the { predicate } form requires a predicates map. Use this form inside a withMaterializedView query() callback that declares predicates: { ${predName}: { hash, fn } }.`
|
|
10617
|
+
);
|
|
10618
|
+
}
|
|
10619
|
+
const decl = this.predicates.get(predName);
|
|
10620
|
+
if (!decl) {
|
|
10621
|
+
throw new Error(
|
|
10622
|
+
`Query.crossJoin("${target}"): predicate "${predName}" not registered. Available: ${[...this.predicates.keys()].join(", ") || "(none)"}.`
|
|
10623
|
+
);
|
|
10624
|
+
}
|
|
10625
|
+
const as = opts.as;
|
|
10626
|
+
const predicateFn = decl.fn;
|
|
10627
|
+
onFn = (_left) => (right) => predicateFn({ ..._left, [as]: right });
|
|
10628
|
+
onPredicateName = predName;
|
|
10629
|
+
}
|
|
10630
|
+
}
|
|
10631
|
+
const clause = {
|
|
10632
|
+
type: "crossJoin",
|
|
10633
|
+
target,
|
|
10634
|
+
as: opts.as,
|
|
10635
|
+
...onFn !== void 0 && { on: onFn },
|
|
10636
|
+
...onPredicateName !== void 0 && { onPredicateName },
|
|
10637
|
+
...opts.maxRows !== void 0 && { maxRows: opts.maxRows }
|
|
10638
|
+
};
|
|
10639
|
+
return new _Query(
|
|
10640
|
+
this.source,
|
|
10641
|
+
{ ...this.plan, clauses: [...this.plan.clauses, clause] },
|
|
10642
|
+
this.joinContext,
|
|
10643
|
+
this.aggregateStrategy,
|
|
10644
|
+
this.predicates
|
|
10645
|
+
);
|
|
10646
|
+
}
|
|
10447
10647
|
/**
|
|
10448
10648
|
* Execute the plan and return the matching records. When the plan
|
|
10449
10649
|
* carries any join legs, they are applied after `where` / `orderBy`
|
|
@@ -10451,7 +10651,7 @@ var Query = class _Query {
|
|
|
10451
10651
|
* for the ordering rationale.
|
|
10452
10652
|
*/
|
|
10453
10653
|
toArray() {
|
|
10454
|
-
const base = executePlanWithSource(this.source, this.plan);
|
|
10654
|
+
const base = executePlanWithSource(this.source, this.plan, this.joinContext);
|
|
10455
10655
|
if (this.plan.joins.length === 0) return base;
|
|
10456
10656
|
if (!this.joinContext) {
|
|
10457
10657
|
throw new Error(
|
|
@@ -10475,6 +10675,14 @@ var Query = class _Query {
|
|
|
10475
10675
|
* intent is purely to count.
|
|
10476
10676
|
*/
|
|
10477
10677
|
count() {
|
|
10678
|
+
if (this.plan.clauses.some((c) => c.type === "crossJoin")) {
|
|
10679
|
+
if (!this.joinContext) {
|
|
10680
|
+
throw new Error(
|
|
10681
|
+
`Query.count(): plan contains crossJoin clauses but no JoinContext is attached.`
|
|
10682
|
+
);
|
|
10683
|
+
}
|
|
10684
|
+
return executeClausePipeline(this.source, this.plan.clauses, this.joinContext).length;
|
|
10685
|
+
}
|
|
10478
10686
|
const { candidates, remainingClauses } = candidateRecords(this.source, this.plan.clauses);
|
|
10479
10687
|
if (remainingClauses.length === 0) return candidates.length;
|
|
10480
10688
|
return filterRecords(candidates, remainingClauses).length;
|
|
@@ -10522,7 +10730,13 @@ var Query = class _Query {
|
|
|
10522
10730
|
aggregate(spec) {
|
|
10523
10731
|
const source = this.source;
|
|
10524
10732
|
const clauses = this.plan.clauses;
|
|
10733
|
+
const joinCtx = this.joinContext;
|
|
10734
|
+
const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
|
|
10525
10735
|
const executeRecords = () => {
|
|
10736
|
+
if (hasCrossJoins) {
|
|
10737
|
+
if (!joinCtx) throw new Error("Query.aggregate(): crossJoin requires a join context");
|
|
10738
|
+
return executeClausePipeline(source, clauses, joinCtx);
|
|
10739
|
+
}
|
|
10526
10740
|
const { candidates, remainingClauses } = candidateRecords(source, clauses);
|
|
10527
10741
|
return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
|
|
10528
10742
|
};
|
|
@@ -10539,7 +10753,13 @@ var Query = class _Query {
|
|
|
10539
10753
|
}
|
|
10540
10754
|
const source = this.source;
|
|
10541
10755
|
const clauses = this.plan.clauses;
|
|
10756
|
+
const joinCtx = this.joinContext;
|
|
10757
|
+
const hasCrossJoins = clauses.some((c) => c.type === "crossJoin");
|
|
10542
10758
|
const executeRecords = () => {
|
|
10759
|
+
if (hasCrossJoins) {
|
|
10760
|
+
if (!joinCtx) throw new Error("Query.groupBy(): crossJoin requires a join context");
|
|
10761
|
+
return executeClausePipeline(source, clauses, joinCtx);
|
|
10762
|
+
}
|
|
10543
10763
|
const { candidates, remainingClauses } = candidateRecords(source, clauses);
|
|
10544
10764
|
return remainingClauses.length === 0 ? candidates : filterRecords(candidates, remainingClauses);
|
|
10545
10765
|
};
|
|
@@ -10653,6 +10873,21 @@ var Query = class _Query {
|
|
|
10653
10873
|
}
|
|
10654
10874
|
}
|
|
10655
10875
|
}
|
|
10876
|
+
if (this.joinContext) {
|
|
10877
|
+
const subscribedCross = /* @__PURE__ */ new Set();
|
|
10878
|
+
for (const clause of this.plan.clauses) {
|
|
10879
|
+
if (clause.type !== "crossJoin") continue;
|
|
10880
|
+
if (subscribedCross.has(clause.target)) continue;
|
|
10881
|
+
subscribedCross.add(clause.target);
|
|
10882
|
+
const rightSource = this.joinContext.resolveSource(clause.target);
|
|
10883
|
+
if (rightSource?.subscribe) {
|
|
10884
|
+
const rightSubscribe = rightSource.subscribe.bind(rightSource);
|
|
10885
|
+
upstreams.push({
|
|
10886
|
+
subscribe: (cb) => rightSubscribe(cb)
|
|
10887
|
+
});
|
|
10888
|
+
}
|
|
10889
|
+
}
|
|
10890
|
+
}
|
|
10656
10891
|
return buildLiveQuery(() => this.toArray(), upstreams);
|
|
10657
10892
|
}
|
|
10658
10893
|
/**
|
|
@@ -10664,9 +10899,20 @@ var Query = class _Query {
|
|
|
10664
10899
|
return serializePlan(this.plan);
|
|
10665
10900
|
}
|
|
10666
10901
|
};
|
|
10667
|
-
function executePlanWithSource(source, plan) {
|
|
10668
|
-
const
|
|
10669
|
-
let result
|
|
10902
|
+
function executePlanWithSource(source, plan, joinContext) {
|
|
10903
|
+
const hasCrossJoins = plan.clauses.some((c) => c.type === "crossJoin");
|
|
10904
|
+
let result;
|
|
10905
|
+
if (hasCrossJoins) {
|
|
10906
|
+
if (!joinContext) {
|
|
10907
|
+
throw new Error(
|
|
10908
|
+
`Query.toArray(): plan contains crossJoin clauses but no JoinContext is attached. Use collection.query() instead of new Query() for cross-join support.`
|
|
10909
|
+
);
|
|
10910
|
+
}
|
|
10911
|
+
result = executeClausePipeline(source, plan.clauses, joinContext);
|
|
10912
|
+
} else {
|
|
10913
|
+
const { candidates, remainingClauses } = candidateRecords(source, plan.clauses);
|
|
10914
|
+
result = remainingClauses.length === 0 ? [...candidates] : filterRecords(candidates, remainingClauses);
|
|
10915
|
+
}
|
|
10670
10916
|
if (plan.orderBy.length > 0) {
|
|
10671
10917
|
result = sortRecords(result, plan.orderBy);
|
|
10672
10918
|
}
|
|
@@ -10716,6 +10962,11 @@ function materializeIds(ids, lookupById) {
|
|
|
10716
10962
|
return out;
|
|
10717
10963
|
}
|
|
10718
10964
|
function executePlan(records, plan) {
|
|
10965
|
+
if (plan.clauses.some((c) => c.type === "crossJoin")) {
|
|
10966
|
+
throw new Error(
|
|
10967
|
+
`executePlan(): does not support crossJoin clauses. executePlan is a stateless pure function \u2014 it cannot resolve cross-join right-side collections. Use Query.toArray() (via collection.query()) instead.`
|
|
10968
|
+
);
|
|
10969
|
+
}
|
|
10719
10970
|
let result = filterRecords(records, plan.clauses);
|
|
10720
10971
|
if (plan.orderBy.length > 0) {
|
|
10721
10972
|
result = sortRecords(result, plan.orderBy);
|
|
@@ -10743,6 +10994,74 @@ function filterRecords(records, clauses) {
|
|
|
10743
10994
|
}
|
|
10744
10995
|
return out;
|
|
10745
10996
|
}
|
|
10997
|
+
function executeClausePipeline(source, clauses, joinContext) {
|
|
10998
|
+
let rel = [...source.snapshot()];
|
|
10999
|
+
let filterBatch = [];
|
|
11000
|
+
for (const clause of clauses) {
|
|
11001
|
+
if (clause.type === "crossJoin") {
|
|
11002
|
+
if (filterBatch.length > 0) {
|
|
11003
|
+
rel = filterRecords(rel, filterBatch);
|
|
11004
|
+
filterBatch = [];
|
|
11005
|
+
}
|
|
11006
|
+
const rightSource = joinContext.resolveSource(clause.target);
|
|
11007
|
+
if (!rightSource) {
|
|
11008
|
+
throw new CrossJoinSourceUnknownError(clause.target, joinContext.leftCollection);
|
|
11009
|
+
}
|
|
11010
|
+
rel = applyCrossJoin(rel, clause, rightSource);
|
|
11011
|
+
} else {
|
|
11012
|
+
filterBatch.push(clause);
|
|
11013
|
+
}
|
|
11014
|
+
}
|
|
11015
|
+
if (filterBatch.length > 0) {
|
|
11016
|
+
rel = filterRecords(rel, filterBatch);
|
|
11017
|
+
}
|
|
11018
|
+
return rel;
|
|
11019
|
+
}
|
|
11020
|
+
function applyCrossJoin(leftRel, clause, rightSource) {
|
|
11021
|
+
const rightRows = rightSource.snapshot();
|
|
11022
|
+
const maxRows = clause.maxRows ?? DEFAULT_CROSS_JOIN_MAX_ROWS;
|
|
11023
|
+
const { as } = clause;
|
|
11024
|
+
if (!clause.on) {
|
|
11025
|
+
const product = leftRel.length * rightRows.length;
|
|
11026
|
+
if (product > maxRows) {
|
|
11027
|
+
throw new CrossJoinTooLargeError({ target: clause.target, expected: product, limit: maxRows });
|
|
11028
|
+
}
|
|
11029
|
+
const expanded2 = [];
|
|
11030
|
+
for (const left of leftRel) {
|
|
11031
|
+
const leftObj = left;
|
|
11032
|
+
for (const right of rightRows) {
|
|
11033
|
+
expanded2.push({ ...leftObj, [as]: right });
|
|
11034
|
+
}
|
|
11035
|
+
}
|
|
11036
|
+
return expanded2;
|
|
11037
|
+
}
|
|
11038
|
+
const expanded = [];
|
|
11039
|
+
let cumulative = 0;
|
|
11040
|
+
for (const left of leftRel) {
|
|
11041
|
+
const callbackResult = clause.on(left);
|
|
11042
|
+
let filteredRight;
|
|
11043
|
+
if (Array.isArray(callbackResult)) {
|
|
11044
|
+
filteredRight = callbackResult;
|
|
11045
|
+
} else {
|
|
11046
|
+
filteredRight = rightRows.filter(
|
|
11047
|
+
callbackResult
|
|
11048
|
+
);
|
|
11049
|
+
}
|
|
11050
|
+
cumulative += filteredRight.length;
|
|
11051
|
+
if (cumulative > maxRows) {
|
|
11052
|
+
throw new CrossJoinTooLargeError({
|
|
11053
|
+
target: clause.target,
|
|
11054
|
+
expected: cumulative,
|
|
11055
|
+
limit: maxRows
|
|
11056
|
+
});
|
|
11057
|
+
}
|
|
11058
|
+
const leftObj = left;
|
|
11059
|
+
for (const right of filteredRight) {
|
|
11060
|
+
expanded.push({ ...leftObj, [as]: right });
|
|
11061
|
+
}
|
|
11062
|
+
}
|
|
11063
|
+
return expanded;
|
|
11064
|
+
}
|
|
10746
11065
|
function sortRecords(records, orderBy) {
|
|
10747
11066
|
return [...records].sort((a, b) => {
|
|
10748
11067
|
for (const { field, direction } of orderBy) {
|
|
@@ -10805,6 +11124,16 @@ function serializeClause(clause) {
|
|
|
10805
11124
|
clauses: clause.clauses.map(serializeClause)
|
|
10806
11125
|
};
|
|
10807
11126
|
}
|
|
11127
|
+
if (clause.type === "crossJoin") {
|
|
11128
|
+
return {
|
|
11129
|
+
type: "crossJoin",
|
|
11130
|
+
target: clause.target,
|
|
11131
|
+
as: clause.as,
|
|
11132
|
+
on: clause.on ? "[function]" : void 0,
|
|
11133
|
+
onPredicateName: clause.onPredicateName,
|
|
11134
|
+
maxRows: clause.maxRows
|
|
11135
|
+
};
|
|
11136
|
+
}
|
|
10808
11137
|
return clause;
|
|
10809
11138
|
}
|
|
10810
11139
|
function canonicalCtxHash(ctx) {
|
|
@@ -12841,6 +13170,22 @@ var Collection = class {
|
|
|
12841
13170
|
setAtPathInPlace(obj, field, translated);
|
|
12842
13171
|
}
|
|
12843
13172
|
}
|
|
13173
|
+
if (this.i18nFields) {
|
|
13174
|
+
const obj = record;
|
|
13175
|
+
for (const [field, descriptor] of Object.entries(this.i18nFields)) {
|
|
13176
|
+
if (!descriptor.options.script) continue;
|
|
13177
|
+
for (const leaf of getAtPath(obj, field)) {
|
|
13178
|
+
if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) continue;
|
|
13179
|
+
const leafMap = leaf;
|
|
13180
|
+
const { value: cleaned } = this.i18nStrategy.enforceScript(
|
|
13181
|
+
leafMap,
|
|
13182
|
+
field,
|
|
13183
|
+
descriptor
|
|
13184
|
+
);
|
|
13185
|
+
if (cleaned !== leafMap) Object.assign(leafMap, cleaned);
|
|
13186
|
+
}
|
|
13187
|
+
}
|
|
13188
|
+
}
|
|
12844
13189
|
if (this.i18nPutValidator !== void 0) {
|
|
12845
13190
|
this.i18nPutValidator(record);
|
|
12846
13191
|
}
|
|
@@ -14283,17 +14628,52 @@ var Collection = class {
|
|
|
14283
14628
|
}
|
|
14284
14629
|
if (hasDict && this.dictKeyFields && this.dictLabelResolver && locale !== "raw") {
|
|
14285
14630
|
const withLabels = { ...result };
|
|
14631
|
+
const resolver = this.dictLabelResolver;
|
|
14286
14632
|
for (const [field, desc] of Object.entries(this.dictKeyFields)) {
|
|
14287
|
-
const
|
|
14288
|
-
|
|
14289
|
-
const
|
|
14290
|
-
desc.name,
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14296
|
-
|
|
14633
|
+
const policy = desc.onMissing ? resolvePolicy(desc.onMissing, "read") : "null";
|
|
14634
|
+
const fallback = policy === "substitute" ? localeOpts?.fallback ?? desc.substitute : localeOpts?.fallback;
|
|
14635
|
+
const resolveKey = async (key) => {
|
|
14636
|
+
const label = await resolver(desc.name, key, locale, fallback);
|
|
14637
|
+
if (label === void 0) {
|
|
14638
|
+
if (policy === "throw") {
|
|
14639
|
+
throw new LocaleNotSpecifiedError(
|
|
14640
|
+
field,
|
|
14641
|
+
`dictKey "${field}": no label for key "${key}" in locale "${locale}".`
|
|
14642
|
+
);
|
|
14643
|
+
}
|
|
14644
|
+
return null;
|
|
14645
|
+
}
|
|
14646
|
+
return label;
|
|
14647
|
+
};
|
|
14648
|
+
if (field.includes("[].")) {
|
|
14649
|
+
const parts = field.split("[].");
|
|
14650
|
+
const arrayKey = parts[0];
|
|
14651
|
+
const leaf = parts[1];
|
|
14652
|
+
if (!leaf || leaf.includes(".")) continue;
|
|
14653
|
+
const arr = withLabels[arrayKey];
|
|
14654
|
+
if (!Array.isArray(arr)) continue;
|
|
14655
|
+
const labelKey = `${leaf}Label`;
|
|
14656
|
+
withLabels[arrayKey] = await Promise.all(
|
|
14657
|
+
arr.map(async (el) => {
|
|
14658
|
+
if (!el || typeof el !== "object" || Array.isArray(el)) return el;
|
|
14659
|
+
const k = el[leaf];
|
|
14660
|
+
if (typeof k !== "string") return el;
|
|
14661
|
+
return { ...el, [labelKey]: await resolveKey(k) };
|
|
14662
|
+
})
|
|
14663
|
+
);
|
|
14664
|
+
continue;
|
|
14665
|
+
}
|
|
14666
|
+
const val = result[field];
|
|
14667
|
+
if (Array.isArray(val)) {
|
|
14668
|
+
withLabels[`${field}Label`] = await Promise.all(
|
|
14669
|
+
val.map(async (k) => ({
|
|
14670
|
+
key: k,
|
|
14671
|
+
label: typeof k === "string" ? await resolveKey(k) : null
|
|
14672
|
+
}))
|
|
14673
|
+
);
|
|
14674
|
+
} else if (typeof val === "string") {
|
|
14675
|
+
const label = await resolveKey(val);
|
|
14676
|
+
if (label !== null) withLabels[`${field}Label`] = label;
|
|
14297
14677
|
}
|
|
14298
14678
|
}
|
|
14299
14679
|
result = withLabels;
|
|
@@ -15168,8 +15548,14 @@ function dictCollectionName(dictionaryName) {
|
|
|
15168
15548
|
function isDictCollectionName(name) {
|
|
15169
15549
|
return name.startsWith(DICT_COLLECTION_PREFIX);
|
|
15170
15550
|
}
|
|
15171
|
-
function dictKey(name, keys) {
|
|
15172
|
-
return {
|
|
15551
|
+
function dictKey(name, keys, opts) {
|
|
15552
|
+
return {
|
|
15553
|
+
_noydbDictKey: true,
|
|
15554
|
+
name,
|
|
15555
|
+
keys,
|
|
15556
|
+
...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
|
|
15557
|
+
...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {}
|
|
15558
|
+
};
|
|
15173
15559
|
}
|
|
15174
15560
|
function isDictKeyDescriptor(x) {
|
|
15175
15561
|
return typeof x === "object" && x !== null && x._noydbDictKey === true;
|
|
@@ -19464,16 +19850,32 @@ function isTabWriteMsg(x) {
|
|
|
19464
19850
|
return o["kind"] === "tab-write" && typeof o["writerId"] === "string" && typeof o["vault"] === "string" && typeof o["collection"] === "string" && typeof o["docId"] === "string" && (o["action"] === "put" || o["action"] === "delete") && typeof o["baseV"] === "number" && typeof o["v"] === "number";
|
|
19465
19851
|
}
|
|
19466
19852
|
|
|
19467
|
-
// src/
|
|
19853
|
+
// src/snapshots/strategy.ts
|
|
19468
19854
|
var NOT_ENABLED5 = new Error(
|
|
19855
|
+
'Snapshots require the snapshot strategy. Import `{ withSnapshots }` from "@noy-db/hub/snapshots" and pass it to `createNoydb({ snapshotStrategy: withSnapshots({ store }) })`.'
|
|
19856
|
+
);
|
|
19857
|
+
var NO_SNAPSHOTS = {
|
|
19858
|
+
async snapshot() {
|
|
19859
|
+
throw NOT_ENABLED5;
|
|
19860
|
+
},
|
|
19861
|
+
async listSnapshots() {
|
|
19862
|
+
throw NOT_ENABLED5;
|
|
19863
|
+
},
|
|
19864
|
+
async restoreSnapshot() {
|
|
19865
|
+
throw NOT_ENABLED5;
|
|
19866
|
+
}
|
|
19867
|
+
};
|
|
19868
|
+
|
|
19869
|
+
// src/tx/strategy.ts
|
|
19870
|
+
var NOT_ENABLED6 = new Error(
|
|
19469
19871
|
'Multi-record transactions require the tx strategy. Import `{ withTransactions }` from "@noy-db/hub/tx" and pass it to `createNoydb({ txStrategy: withTransactions() })`.'
|
|
19470
19872
|
);
|
|
19471
19873
|
var NO_TX = {
|
|
19472
19874
|
async runTransaction() {
|
|
19473
|
-
throw
|
|
19875
|
+
throw NOT_ENABLED6;
|
|
19474
19876
|
},
|
|
19475
19877
|
async runDryRun() {
|
|
19476
|
-
throw
|
|
19878
|
+
throw NOT_ENABLED6;
|
|
19477
19879
|
}
|
|
19478
19880
|
};
|
|
19479
19881
|
|
|
@@ -19816,6 +20218,7 @@ var Noydb = class {
|
|
|
19816
20218
|
txStrategy;
|
|
19817
20219
|
sessionStrategy;
|
|
19818
20220
|
syncStrategy;
|
|
20221
|
+
snapshotStrategy;
|
|
19819
20222
|
/**
|
|
19820
20223
|
* Currently-running multi-record transaction, set by
|
|
19821
20224
|
* `runTransaction` at the start of Phase 2 (commit) and cleared in
|
|
@@ -19840,6 +20243,7 @@ var Noydb = class {
|
|
|
19840
20243
|
this.txStrategy = options.txStrategy ?? NO_TX;
|
|
19841
20244
|
this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
|
|
19842
20245
|
this.syncStrategy = options.syncStrategy ?? NO_SYNC;
|
|
20246
|
+
this.snapshotStrategy = options.snapshotStrategy ?? NO_SNAPSHOTS;
|
|
19843
20247
|
this.publicEnvelopeSchema = resolveSchema(options.publicEnvelope);
|
|
19844
20248
|
if (options.sessionPolicy) {
|
|
19845
20249
|
this.sessionStrategy.validateSessionPolicy(options.sessionPolicy);
|
|
@@ -21826,6 +22230,45 @@ var Noydb = class {
|
|
|
21826
22230
|
this.keyringCache.set(vault, keyring);
|
|
21827
22231
|
return keyring;
|
|
21828
22232
|
}
|
|
22233
|
+
/**
|
|
22234
|
+
* Take an on-demand checkpoint of the given vault.
|
|
22235
|
+
* Requires `snapshotStrategy: withSnapshots({ store })` in `createNoydb`.
|
|
22236
|
+
* @throws ValidationError when the vault is not open
|
|
22237
|
+
*/
|
|
22238
|
+
async snapshot(vault, opts) {
|
|
22239
|
+
if (this.closed) throw new ValidationError("Instance is closed");
|
|
22240
|
+
const v = this.vaultCache.get(vault);
|
|
22241
|
+
if (!v) {
|
|
22242
|
+
throw new ValidationError(
|
|
22243
|
+
`Vault "${vault}" is not open. Call openVault() first.`
|
|
22244
|
+
);
|
|
22245
|
+
}
|
|
22246
|
+
return this.snapshotStrategy.snapshot(v, this.options.user, opts);
|
|
22247
|
+
}
|
|
22248
|
+
/**
|
|
22249
|
+
* List all snapshots for the given vault, newest first.
|
|
22250
|
+
* Reads only the sidecar index — does not download snapshot bytes.
|
|
22251
|
+
*/
|
|
22252
|
+
async listSnapshots(vault) {
|
|
22253
|
+
if (this.closed) throw new ValidationError("Instance is closed");
|
|
22254
|
+
return this.snapshotStrategy.listSnapshots(vault);
|
|
22255
|
+
}
|
|
22256
|
+
/**
|
|
22257
|
+
* Restore the vault to a previously snapshotted state.
|
|
22258
|
+
* Runs `verifyBackupIntegrity()` automatically on restore.
|
|
22259
|
+
* @throws SnapshotNotFoundError when `version` doesn't exist in the store
|
|
22260
|
+
* @throws ValidationError when the vault is not open
|
|
22261
|
+
*/
|
|
22262
|
+
async restoreSnapshot(vault, version) {
|
|
22263
|
+
if (this.closed) throw new ValidationError("Instance is closed");
|
|
22264
|
+
const v = this.vaultCache.get(vault);
|
|
22265
|
+
if (!v) {
|
|
22266
|
+
throw new ValidationError(
|
|
22267
|
+
`Vault "${vault}" is not open. Call openVault() first.`
|
|
22268
|
+
);
|
|
22269
|
+
}
|
|
22270
|
+
return this.snapshotStrategy.restoreSnapshot(v, version);
|
|
22271
|
+
}
|
|
21829
22272
|
};
|
|
21830
22273
|
async function createNoydb(options) {
|
|
21831
22274
|
const encrypted = options.encrypt !== false;
|
|
@@ -22792,6 +23235,139 @@ function withOverlayedView(spec) {
|
|
|
22792
23235
|
// src/index.ts
|
|
22793
23236
|
init_errors();
|
|
22794
23237
|
init_errors();
|
|
23238
|
+
|
|
23239
|
+
// src/i18n/script.ts
|
|
23240
|
+
init_errors();
|
|
23241
|
+
var LATIN_BASE = /* @__PURE__ */ new Set([
|
|
23242
|
+
"en",
|
|
23243
|
+
"fr",
|
|
23244
|
+
"de",
|
|
23245
|
+
"es",
|
|
23246
|
+
"it",
|
|
23247
|
+
"pt",
|
|
23248
|
+
"nl",
|
|
23249
|
+
"sv",
|
|
23250
|
+
"no",
|
|
23251
|
+
"da",
|
|
23252
|
+
"fi",
|
|
23253
|
+
"is",
|
|
23254
|
+
"pl",
|
|
23255
|
+
"cs",
|
|
23256
|
+
"sk",
|
|
23257
|
+
"hu",
|
|
23258
|
+
"ro",
|
|
23259
|
+
"hr",
|
|
23260
|
+
"sl",
|
|
23261
|
+
"et",
|
|
23262
|
+
"lv",
|
|
23263
|
+
"lt",
|
|
23264
|
+
"tr",
|
|
23265
|
+
"vi",
|
|
23266
|
+
"id",
|
|
23267
|
+
"ms",
|
|
23268
|
+
"tl",
|
|
23269
|
+
"sw",
|
|
23270
|
+
"af",
|
|
23271
|
+
"ca",
|
|
23272
|
+
"gl",
|
|
23273
|
+
"eu",
|
|
23274
|
+
"cy",
|
|
23275
|
+
"ga"
|
|
23276
|
+
]);
|
|
23277
|
+
var SCRIPT_TABLE = {
|
|
23278
|
+
th: ["Thai"],
|
|
23279
|
+
ko: ["Hangul", "Han"],
|
|
23280
|
+
ja: ["Han", "Hiragana", "Katakana"],
|
|
23281
|
+
zh: ["Han"],
|
|
23282
|
+
ar: ["Arabic"],
|
|
23283
|
+
fa: ["Arabic"],
|
|
23284
|
+
ur: ["Arabic"],
|
|
23285
|
+
ru: ["Cyrillic"],
|
|
23286
|
+
uk: ["Cyrillic"],
|
|
23287
|
+
bg: ["Cyrillic"],
|
|
23288
|
+
sr: ["Cyrillic"],
|
|
23289
|
+
he: ["Hebrew"],
|
|
23290
|
+
el: ["Greek"],
|
|
23291
|
+
hi: ["Devanagari"],
|
|
23292
|
+
ta: ["Tamil"],
|
|
23293
|
+
km: ["Khmer"],
|
|
23294
|
+
lo: ["Lao"],
|
|
23295
|
+
my: ["Myanmar"]
|
|
23296
|
+
};
|
|
23297
|
+
var SUBTAG_SCRIPTS = {
|
|
23298
|
+
Latn: ["Latin"],
|
|
23299
|
+
Cyrl: ["Cyrillic", "Latin"],
|
|
23300
|
+
Hans: ["Han", "Latin"],
|
|
23301
|
+
Hant: ["Han", "Latin"],
|
|
23302
|
+
Thai: ["Thai", "Latin"],
|
|
23303
|
+
Arab: ["Arabic", "Latin"]
|
|
23304
|
+
};
|
|
23305
|
+
function inferScripts(locale) {
|
|
23306
|
+
const parts = locale.split("-");
|
|
23307
|
+
const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
|
|
23308
|
+
if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
|
|
23309
|
+
const base = (parts[0] ?? "").toLowerCase();
|
|
23310
|
+
if (LATIN_BASE.has(base)) return ["Latin"];
|
|
23311
|
+
const primary = SCRIPT_TABLE[base];
|
|
23312
|
+
if (primary) return [...primary, "Latin"];
|
|
23313
|
+
return ["Latin"];
|
|
23314
|
+
}
|
|
23315
|
+
function allowedFor(descriptor, locale) {
|
|
23316
|
+
const script = descriptor.options.script;
|
|
23317
|
+
if (script && script !== "auto") {
|
|
23318
|
+
const explicit = script[locale];
|
|
23319
|
+
if (explicit) return explicit;
|
|
23320
|
+
}
|
|
23321
|
+
return inferScripts(locale);
|
|
23322
|
+
}
|
|
23323
|
+
var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
|
|
23324
|
+
function fullMatcher(scripts) {
|
|
23325
|
+
const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
|
|
23326
|
+
return new RegExp(`^[${BASELINE}${cls}]*$`, "u");
|
|
23327
|
+
}
|
|
23328
|
+
function charMatcher(scripts) {
|
|
23329
|
+
const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
|
|
23330
|
+
return new RegExp(`[${BASELINE}${cls}]`, "u");
|
|
23331
|
+
}
|
|
23332
|
+
function offendingSample(str, scripts) {
|
|
23333
|
+
const ok = charMatcher(scripts);
|
|
23334
|
+
const bad = [];
|
|
23335
|
+
for (const ch of str) {
|
|
23336
|
+
if (!ok.test(ch)) bad.push(ch);
|
|
23337
|
+
if (bad.length >= 8) break;
|
|
23338
|
+
}
|
|
23339
|
+
return bad.join("");
|
|
23340
|
+
}
|
|
23341
|
+
function stripDisallowed(str, scripts) {
|
|
23342
|
+
const ok = charMatcher(scripts);
|
|
23343
|
+
let out = "";
|
|
23344
|
+
for (const ch of str) if (ok.test(ch)) out += ch;
|
|
23345
|
+
return out;
|
|
23346
|
+
}
|
|
23347
|
+
function enforceScript(value, field, descriptor) {
|
|
23348
|
+
const opt = descriptor.options;
|
|
23349
|
+
if (!opt.script) return { value, warnings: [] };
|
|
23350
|
+
const mode = opt.onScriptViolation ?? "reject";
|
|
23351
|
+
const warnings = [];
|
|
23352
|
+
let out = value;
|
|
23353
|
+
for (const [locale, raw] of Object.entries(value)) {
|
|
23354
|
+
if (typeof raw !== "string") continue;
|
|
23355
|
+
const allowed = allowedFor(descriptor, locale);
|
|
23356
|
+
if (fullMatcher(allowed).test(raw)) continue;
|
|
23357
|
+
const sample = offendingSample(raw, allowed);
|
|
23358
|
+
if (mode === "reject") {
|
|
23359
|
+
throw new ScriptViolationError(field, locale, allowed, sample);
|
|
23360
|
+
}
|
|
23361
|
+
warnings.push({ field, locale, expected: allowed, sample });
|
|
23362
|
+
if (mode === "filter") {
|
|
23363
|
+
if (out === value) out = { ...value };
|
|
23364
|
+
out[locale] = stripDisallowed(raw, allowed);
|
|
23365
|
+
}
|
|
23366
|
+
}
|
|
23367
|
+
return { value: out, warnings };
|
|
23368
|
+
}
|
|
23369
|
+
|
|
23370
|
+
// src/index.ts
|
|
22795
23371
|
init_errors();
|
|
22796
23372
|
|
|
22797
23373
|
// src/team/sync-credentials.ts
|
|
@@ -23440,7 +24016,10 @@ function shortJSON(value) {
|
|
|
23440
24016
|
CollectionIndexes,
|
|
23441
24017
|
CollectionInstant,
|
|
23442
24018
|
ConflictError,
|
|
24019
|
+
CrossJoinSourceUnknownError,
|
|
24020
|
+
CrossJoinTooLargeError,
|
|
23443
24021
|
DEFAULT_CHUNK_SIZE,
|
|
24022
|
+
DEFAULT_CROSS_JOIN_MAX_ROWS,
|
|
23444
24023
|
DEFAULT_FRESHNESS_MS,
|
|
23445
24024
|
DEFAULT_JOIN_MAX_ROWS,
|
|
23446
24025
|
DEFAULT_PUBLIC_ENVELOPE_SCHEMA,
|
|
@@ -23550,9 +24129,11 @@ function shortJSON(value) {
|
|
|
23550
24129
|
SchemaLockedError,
|
|
23551
24130
|
SchemaUpdateError,
|
|
23552
24131
|
SchemaValidationError,
|
|
24132
|
+
ScriptViolationError,
|
|
23553
24133
|
SessionExpiredError,
|
|
23554
24134
|
SessionNotFoundError,
|
|
23555
24135
|
SessionPolicyError,
|
|
24136
|
+
SnapshotNotFoundError,
|
|
23556
24137
|
StoreCapabilityError,
|
|
23557
24138
|
SyncEngine,
|
|
23558
24139
|
SyncScheduler,
|
|
@@ -23624,6 +24205,7 @@ function shortJSON(value) {
|
|
|
23624
24205
|
enableDevUnlock,
|
|
23625
24206
|
encryptBytes,
|
|
23626
24207
|
encryptDeterministic,
|
|
24208
|
+
enforceScript,
|
|
23627
24209
|
enrollAuthenticator,
|
|
23628
24210
|
envelopePayloadHash,
|
|
23629
24211
|
estimateEntropy,
|
|
@@ -23644,6 +24226,7 @@ function shortJSON(value) {
|
|
|
23644
24226
|
hasRecoveryEnrolled,
|
|
23645
24227
|
hashEntry,
|
|
23646
24228
|
i18nText,
|
|
24229
|
+
inferScripts,
|
|
23647
24230
|
isDevUnlockActive,
|
|
23648
24231
|
isDictCollectionName,
|
|
23649
24232
|
isDictKeyDescriptor,
|
|
@@ -23704,6 +24287,7 @@ function shortJSON(value) {
|
|
|
23704
24287
|
resetJoinWarnings,
|
|
23705
24288
|
resolveCrdtSnapshot,
|
|
23706
24289
|
resolveI18nText,
|
|
24290
|
+
resolvePolicy,
|
|
23707
24291
|
resolvePublicEnvelopeSchema,
|
|
23708
24292
|
resolveSession,
|
|
23709
24293
|
revokeAllSessions,
|