@noy-db/hub 0.2.0-pre.7 → 0.2.0-pre.9

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.
Files changed (235) hide show
  1. package/dist/aggregate/index.cjs.map +1 -1
  2. package/dist/aggregate/index.js +2 -2
  3. package/dist/attestation/index.cjs.map +1 -1
  4. package/dist/attestation/index.d.cts +2 -2
  5. package/dist/attestation/index.d.ts +2 -2
  6. package/dist/attestation/index.js +5 -5
  7. package/dist/blobs/index.cjs.map +1 -1
  8. package/dist/blobs/index.d.cts +3 -3
  9. package/dist/blobs/index.d.ts +3 -3
  10. package/dist/blobs/index.js +4 -4
  11. package/dist/bundle/index.cjs +255 -15
  12. package/dist/bundle/index.cjs.map +1 -1
  13. package/dist/bundle/index.d.cts +4 -4
  14. package/dist/bundle/index.d.ts +4 -4
  15. package/dist/bundle/index.js +8 -8
  16. package/dist/{chunk-AYRTGXF3.js → chunk-22DWZL57.js} +62 -26
  17. package/dist/chunk-22DWZL57.js.map +1 -0
  18. package/dist/{chunk-4EOVWJL6.js → chunk-2GLDA55J.js} +2 -2
  19. package/dist/{chunk-CBHPW77B.js → chunk-2WUSG3IT.js} +2 -2
  20. package/dist/{chunk-WBUG3324.js → chunk-3BFJOWSU.js} +2 -2
  21. package/dist/{chunk-7IH5FDXD.js → chunk-3YPCK6JX.js} +5 -5
  22. package/dist/{chunk-SYOSRZN4.js → chunk-53XBRIRT.js} +4 -4
  23. package/dist/{chunk-UPBZ7NVY.js → chunk-5T22KDPN.js} +4 -4
  24. package/dist/{chunk-KK44CQ5B.js → chunk-5XHKQ56N.js} +2 -2
  25. package/dist/{chunk-3O5FNO5O.js → chunk-6CME4UEK.js} +259 -50
  26. package/dist/chunk-6CME4UEK.js.map +1 -0
  27. package/dist/chunk-6STK5TQP.js +139 -0
  28. package/dist/chunk-6STK5TQP.js.map +1 -0
  29. package/dist/{chunk-REQJJIPP.js → chunk-B6PB7JLN.js} +23 -1
  30. package/dist/{chunk-REQJJIPP.js.map → chunk-B6PB7JLN.js.map} +1 -1
  31. package/dist/{chunk-2TXMTYWZ.js → chunk-BVRYKATC.js} +3 -3
  32. package/dist/{chunk-6ILPGZXZ.js → chunk-DE6GKS6G.js} +2 -2
  33. package/dist/{chunk-TS4FQPDD.js → chunk-DFMLEQZB.js} +2 -2
  34. package/dist/{chunk-3XCXUJTM.js → chunk-DJHHA6XH.js} +2 -2
  35. package/dist/{chunk-LSY46G55.js → chunk-DL3HWOQ5.js} +3 -3
  36. package/dist/{chunk-6MXGU2PW.js → chunk-DO7C2TOG.js} +2 -2
  37. package/dist/{chunk-N4CDTRDH.js → chunk-DONMZAD2.js} +3 -3
  38. package/dist/{chunk-HNC55FLJ.js → chunk-F3GDRNUT.js} +3 -3
  39. package/dist/{chunk-VZOZ3DBN.js → chunk-H2X3ISXG.js} +3 -3
  40. package/dist/{chunk-XZCBBZLS.js → chunk-HNRHLRDC.js} +2 -2
  41. package/dist/{chunk-22ESLVUM.js → chunk-I5FOWO4J.js} +2 -2
  42. package/dist/{chunk-O3JCRQT3.js → chunk-JWRVQKRZ.js} +3 -3
  43. package/dist/{chunk-CSHY53CZ.js → chunk-K3DK3NU5.js} +2 -2
  44. package/dist/{chunk-BNUCCUES.js → chunk-ML236QKC.js} +2 -2
  45. package/dist/{chunk-GZIDTXC4.js → chunk-NONAAENK.js} +2 -2
  46. package/dist/{chunk-JZDA2SRB.js → chunk-O3VZPBZG.js} +4 -4
  47. package/dist/{chunk-PJKGXUMG.js → chunk-OQ6PIGHA.js} +2 -2
  48. package/dist/{chunk-QYO6I7KK.js → chunk-PE2FR4J3.js} +3 -3
  49. package/dist/{chunk-YAMTXW77.js → chunk-PP6W64Y3.js} +2 -2
  50. package/dist/{chunk-HNFXKQD7.js → chunk-PX35GA7L.js} +4 -4
  51. package/dist/{chunk-OXCFFRF3.js → chunk-QEILDE6R.js} +2 -2
  52. package/dist/{chunk-4YVVF6JN.js → chunk-QODLLGQ7.js} +4 -4
  53. package/dist/{chunk-ASFE2X62.js → chunk-RAZ4OVLL.js} +2 -2
  54. package/dist/{chunk-WM5GFORS.js → chunk-SYMWGEET.js} +2 -2
  55. package/dist/{chunk-SLJQIBT7.js → chunk-T7JEBOGN.js} +2 -2
  56. package/dist/{chunk-OA6HE2RW.js → chunk-TFBP23BX.js} +3 -3
  57. package/dist/{chunk-GI6S5ZF2.js → chunk-U26HQ6KJ.js} +2 -2
  58. package/dist/{chunk-WMKCAN4H.js → chunk-VTKGMEPP.js} +2 -2
  59. package/dist/{chunk-BRZFN354.js → chunk-WPLVTJ5D.js} +3 -3
  60. package/dist/{chunk-DCP4L4SH.js → chunk-XJFLDA7A.js} +2 -2
  61. package/dist/{chunk-BE5ZALMB.js → chunk-ZYWZWG6G.js} +4 -4
  62. package/dist/consent/index.cjs.map +1 -1
  63. package/dist/consent/index.d.cts +3 -3
  64. package/dist/consent/index.d.ts +3 -3
  65. package/dist/consent/index.js +3 -3
  66. package/dist/{crypto-TRZ5BJMY.js → crypto-HTZ4FJOP.js} +3 -3
  67. package/dist/{delegation-TLZTK2XW.js → delegation-RI54P6I5.js} +5 -5
  68. package/dist/derivations/index.cjs.map +1 -1
  69. package/dist/derivations/index.d.cts +4 -4
  70. package/dist/derivations/index.d.ts +4 -4
  71. package/dist/derivations/index.js +4 -4
  72. package/dist/{dev-unlock-ClAEZQC4.d.ts → dev-unlock-B4kDxep_.d.ts} +1 -1
  73. package/dist/{dev-unlock-L3z34v0J.d.cts → dev-unlock-BIoEFbwm.d.cts} +1 -1
  74. package/dist/executor-5PNY7LGW.js +8 -0
  75. package/dist/executor-B4QIYGZX.js +8 -0
  76. package/dist/executor-BWXXDQ7K.js +11 -0
  77. package/dist/guards/index.cjs.map +1 -1
  78. package/dist/guards/index.d.cts +4 -4
  79. package/dist/guards/index.d.ts +4 -4
  80. package/dist/guards/index.js +3 -3
  81. package/dist/{hash-M6-JI3Yu.d.cts → hash-DdpVypUp.d.cts} +1 -1
  82. package/dist/{hash-B3lV6lw3.d.ts → hash-HJqD14vS.d.ts} +1 -1
  83. package/dist/history/index.cjs.map +1 -1
  84. package/dist/history/index.d.cts +4 -4
  85. package/dist/history/index.d.ts +4 -4
  86. package/dist/history/index.js +4 -4
  87. package/dist/i18n/index.cjs +217 -22
  88. package/dist/i18n/index.cjs.map +1 -1
  89. package/dist/i18n/index.d.cts +3 -3
  90. package/dist/i18n/index.d.ts +3 -3
  91. package/dist/i18n/index.js +15 -4
  92. package/dist/i18n/index.js.map +1 -1
  93. package/dist/{index-vB43MAt4.d.cts → index-4fBVt8j9.d.cts} +21 -1
  94. package/dist/{index-CmWQyC4e.d.ts → index-D8I_pyJD.d.ts} +21 -1
  95. package/dist/index.cjs +439 -33
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.d.cts +11 -11
  98. package/dist/index.d.ts +11 -11
  99. package/dist/index.js +48 -38
  100. package/dist/index.js.map +1 -1
  101. package/dist/indexing/index.cjs.map +1 -1
  102. package/dist/indexing/index.js +2 -2
  103. package/dist/issue-VGDPP4B5.js +12 -0
  104. package/dist/{ledger-SQVVE2DR.js → ledger-TMRZYNVJ.js} +4 -4
  105. package/dist/materialized-views/index.cjs.map +1 -1
  106. package/dist/materialized-views/index.d.cts +5 -5
  107. package/dist/materialized-views/index.d.ts +5 -5
  108. package/dist/materialized-views/index.js +6 -6
  109. package/dist/noydb-G725ZSZG.js +34 -0
  110. package/dist/overlay-views/index.cjs.map +1 -1
  111. package/dist/overlay-views/index.d.cts +4 -4
  112. package/dist/overlay-views/index.d.ts +4 -4
  113. package/dist/overlay-views/index.js +4 -4
  114. package/dist/periods/index.cjs.map +1 -1
  115. package/dist/periods/index.d.cts +3 -3
  116. package/dist/periods/index.d.ts +3 -3
  117. package/dist/periods/index.js +4 -4
  118. package/dist/{public-envelope-BXPXMN3U.js → public-envelope-BW6OXORV.js} +3 -3
  119. package/dist/query/index.cjs.map +1 -1
  120. package/dist/query/index.d.cts +1 -1
  121. package/dist/query/index.d.ts +1 -1
  122. package/dist/query/index.js +3 -3
  123. package/dist/registry-3QP3YKQS.js +8 -0
  124. package/dist/{registry-4R4IURUM.js → registry-OJIOSBV6.js} +3 -3
  125. package/dist/registry-USRVT6YF.js +8 -0
  126. package/dist/{revoke-Y7UDOXGH.js → revoke-JCC7N56X.js} +5 -5
  127. package/dist/session/index.cjs.map +1 -1
  128. package/dist/session/index.d.cts +4 -4
  129. package/dist/session/index.d.ts +4 -4
  130. package/dist/session/index.js +3 -3
  131. package/dist/shadow/index.cjs.map +1 -1
  132. package/dist/shadow/index.d.cts +3 -3
  133. package/dist/shadow/index.d.ts +3 -3
  134. package/dist/shadow/index.js +2 -2
  135. package/dist/{signer-UD2ZSVDJ.js → signer-72QAUSVW.js} +4 -4
  136. package/dist/snapshots/index.cjs +37 -3
  137. package/dist/snapshots/index.cjs.map +1 -1
  138. package/dist/snapshots/index.d.cts +13 -6
  139. package/dist/snapshots/index.d.ts +13 -6
  140. package/dist/snapshots/index.js +40 -6
  141. package/dist/snapshots/index.js.map +1 -1
  142. package/dist/{stale-F4V5E7ZK.js → stale-6ZDBTQT7.js} +2 -2
  143. package/dist/store/index.cjs.map +1 -1
  144. package/dist/store/index.d.cts +3 -3
  145. package/dist/store/index.d.ts +3 -3
  146. package/dist/store/index.js +2 -2
  147. package/dist/sync/index.cjs.map +1 -1
  148. package/dist/sync/index.d.cts +2 -2
  149. package/dist/sync/index.d.ts +2 -2
  150. package/dist/sync/index.js +3 -3
  151. package/dist/team/index.cjs.map +1 -1
  152. package/dist/team/index.d.cts +3 -3
  153. package/dist/team/index.d.ts +3 -3
  154. package/dist/team/index.js +7 -7
  155. package/dist/tx/index.cjs.map +1 -1
  156. package/dist/tx/index.d.cts +3 -3
  157. package/dist/tx/index.d.ts +3 -3
  158. package/dist/tx/index.js +3 -3
  159. package/dist/{types-DT7cXRHq.d.ts → types-Df28QFKb.d.ts} +216 -5
  160. package/dist/{types-r-y7TIqj.d.cts → types-DyXYr8rE.d.cts} +216 -5
  161. package/dist/{ulid-Dt55yn4s.d.ts → ulid-CJ8RzRrm.d.ts} +1 -1
  162. package/dist/{ulid-BkW3mLlz.d.cts → ulid-Drr7ykr6.d.cts} +1 -1
  163. package/dist/util/index.cjs.map +1 -1
  164. package/dist/util/index.js +1 -1
  165. package/dist/{with-derivation-D_Ids_H6.d.ts → with-derivation-DFnFByiQ.d.ts} +1 -1
  166. package/dist/{with-derivation-DB63Po2m.d.cts → with-derivation-DU3Sjazm.d.cts} +1 -1
  167. package/dist/{with-guard-BHThLppa.d.cts → with-guard-ByyxmEe7.d.cts} +1 -1
  168. package/dist/{with-guard-BJwdc0s6.d.ts → with-guard-qube6BMI.d.ts} +1 -1
  169. package/dist/{with-materialized-view-D-CRVSDX.d.ts → with-materialized-view-BLkQxoQN.d.ts} +1 -1
  170. package/dist/{with-materialized-view-BJmJ-FrO.d.cts → with-materialized-view-BmEToIR1.d.cts} +1 -1
  171. package/dist/{with-overlayed-view-zePNtUSq.d.cts → with-overlayed-view-BMsQQbWm.d.cts} +1 -1
  172. package/dist/{with-overlayed-view-CNf6GbDG.d.ts → with-overlayed-view-CRsSEwHR.d.ts} +1 -1
  173. package/package.json +5 -4
  174. package/dist/chunk-3O5FNO5O.js.map +0 -1
  175. package/dist/chunk-AYRTGXF3.js.map +0 -1
  176. package/dist/executor-HAVRTQN4.js +0 -11
  177. package/dist/executor-V3DKOADS.js +0 -8
  178. package/dist/executor-XO4M4243.js +0 -8
  179. package/dist/issue-EJKUQ6FA.js +0 -12
  180. package/dist/noydb-MK4UQ626.js +0 -34
  181. package/dist/registry-GPBLCHG7.js +0 -8
  182. package/dist/registry-ZON5HNIV.js +0 -8
  183. /package/dist/{chunk-4EOVWJL6.js.map → chunk-2GLDA55J.js.map} +0 -0
  184. /package/dist/{chunk-CBHPW77B.js.map → chunk-2WUSG3IT.js.map} +0 -0
  185. /package/dist/{chunk-WBUG3324.js.map → chunk-3BFJOWSU.js.map} +0 -0
  186. /package/dist/{chunk-7IH5FDXD.js.map → chunk-3YPCK6JX.js.map} +0 -0
  187. /package/dist/{chunk-SYOSRZN4.js.map → chunk-53XBRIRT.js.map} +0 -0
  188. /package/dist/{chunk-UPBZ7NVY.js.map → chunk-5T22KDPN.js.map} +0 -0
  189. /package/dist/{chunk-KK44CQ5B.js.map → chunk-5XHKQ56N.js.map} +0 -0
  190. /package/dist/{chunk-2TXMTYWZ.js.map → chunk-BVRYKATC.js.map} +0 -0
  191. /package/dist/{chunk-6ILPGZXZ.js.map → chunk-DE6GKS6G.js.map} +0 -0
  192. /package/dist/{chunk-TS4FQPDD.js.map → chunk-DFMLEQZB.js.map} +0 -0
  193. /package/dist/{chunk-3XCXUJTM.js.map → chunk-DJHHA6XH.js.map} +0 -0
  194. /package/dist/{chunk-LSY46G55.js.map → chunk-DL3HWOQ5.js.map} +0 -0
  195. /package/dist/{chunk-6MXGU2PW.js.map → chunk-DO7C2TOG.js.map} +0 -0
  196. /package/dist/{chunk-N4CDTRDH.js.map → chunk-DONMZAD2.js.map} +0 -0
  197. /package/dist/{chunk-HNC55FLJ.js.map → chunk-F3GDRNUT.js.map} +0 -0
  198. /package/dist/{chunk-VZOZ3DBN.js.map → chunk-H2X3ISXG.js.map} +0 -0
  199. /package/dist/{chunk-XZCBBZLS.js.map → chunk-HNRHLRDC.js.map} +0 -0
  200. /package/dist/{chunk-22ESLVUM.js.map → chunk-I5FOWO4J.js.map} +0 -0
  201. /package/dist/{chunk-O3JCRQT3.js.map → chunk-JWRVQKRZ.js.map} +0 -0
  202. /package/dist/{chunk-CSHY53CZ.js.map → chunk-K3DK3NU5.js.map} +0 -0
  203. /package/dist/{chunk-BNUCCUES.js.map → chunk-ML236QKC.js.map} +0 -0
  204. /package/dist/{chunk-GZIDTXC4.js.map → chunk-NONAAENK.js.map} +0 -0
  205. /package/dist/{chunk-JZDA2SRB.js.map → chunk-O3VZPBZG.js.map} +0 -0
  206. /package/dist/{chunk-PJKGXUMG.js.map → chunk-OQ6PIGHA.js.map} +0 -0
  207. /package/dist/{chunk-QYO6I7KK.js.map → chunk-PE2FR4J3.js.map} +0 -0
  208. /package/dist/{chunk-YAMTXW77.js.map → chunk-PP6W64Y3.js.map} +0 -0
  209. /package/dist/{chunk-HNFXKQD7.js.map → chunk-PX35GA7L.js.map} +0 -0
  210. /package/dist/{chunk-OXCFFRF3.js.map → chunk-QEILDE6R.js.map} +0 -0
  211. /package/dist/{chunk-4YVVF6JN.js.map → chunk-QODLLGQ7.js.map} +0 -0
  212. /package/dist/{chunk-ASFE2X62.js.map → chunk-RAZ4OVLL.js.map} +0 -0
  213. /package/dist/{chunk-WM5GFORS.js.map → chunk-SYMWGEET.js.map} +0 -0
  214. /package/dist/{chunk-SLJQIBT7.js.map → chunk-T7JEBOGN.js.map} +0 -0
  215. /package/dist/{chunk-OA6HE2RW.js.map → chunk-TFBP23BX.js.map} +0 -0
  216. /package/dist/{chunk-GI6S5ZF2.js.map → chunk-U26HQ6KJ.js.map} +0 -0
  217. /package/dist/{chunk-WMKCAN4H.js.map → chunk-VTKGMEPP.js.map} +0 -0
  218. /package/dist/{chunk-BRZFN354.js.map → chunk-WPLVTJ5D.js.map} +0 -0
  219. /package/dist/{chunk-DCP4L4SH.js.map → chunk-XJFLDA7A.js.map} +0 -0
  220. /package/dist/{chunk-BE5ZALMB.js.map → chunk-ZYWZWG6G.js.map} +0 -0
  221. /package/dist/{crypto-TRZ5BJMY.js.map → crypto-HTZ4FJOP.js.map} +0 -0
  222. /package/dist/{delegation-TLZTK2XW.js.map → delegation-RI54P6I5.js.map} +0 -0
  223. /package/dist/{executor-HAVRTQN4.js.map → executor-5PNY7LGW.js.map} +0 -0
  224. /package/dist/{executor-V3DKOADS.js.map → executor-B4QIYGZX.js.map} +0 -0
  225. /package/dist/{executor-XO4M4243.js.map → executor-BWXXDQ7K.js.map} +0 -0
  226. /package/dist/{issue-EJKUQ6FA.js.map → issue-VGDPP4B5.js.map} +0 -0
  227. /package/dist/{ledger-SQVVE2DR.js.map → ledger-TMRZYNVJ.js.map} +0 -0
  228. /package/dist/{noydb-MK4UQ626.js.map → noydb-G725ZSZG.js.map} +0 -0
  229. /package/dist/{public-envelope-BXPXMN3U.js.map → public-envelope-BW6OXORV.js.map} +0 -0
  230. /package/dist/{registry-4R4IURUM.js.map → registry-3QP3YKQS.js.map} +0 -0
  231. /package/dist/{registry-GPBLCHG7.js.map → registry-OJIOSBV6.js.map} +0 -0
  232. /package/dist/{registry-ZON5HNIV.js.map → registry-USRVT6YF.js.map} +0 -0
  233. /package/dist/{revoke-Y7UDOXGH.js.map → revoke-JCC7N56X.js.map} +0 -0
  234. /package/dist/{signer-UD2ZSVDJ.js.map → signer-72QAUSVW.js.map} +0 -0
  235. /package/dist/{stale-F4V5E7ZK.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, CrossJoinTooLargeError, CrossJoinSourceUnknownError, DanglingReferenceError, FilenameSanitizationError, PathEscapeError, DerivationCycleError, DerivationDepthError, DerivationOutputUnknownError, DerivationOutputShapeError, DerivationCapExceededError, MaterializedViewCycleError, MaterializedViewSourceUnknownError, MaterializedViewTooLargeError, MaterializedViewConfigError, OverlayBaseIsVirtualError, OverlayCollectionUnavailableError, OverlayNameCollisionError, OverlayIdMismatchError, SnapshotNotFoundError;
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;
@@ -4115,6 +4136,7 @@ __export(src_exports, {
4115
4136
  SchemaLockedError: () => SchemaLockedError,
4116
4137
  SchemaUpdateError: () => SchemaUpdateError,
4117
4138
  SchemaValidationError: () => SchemaValidationError,
4139
+ ScriptViolationError: () => ScriptViolationError,
4118
4140
  SessionExpiredError: () => SessionExpiredError,
4119
4141
  SessionNotFoundError: () => SessionNotFoundError,
4120
4142
  SessionPolicyError: () => SessionPolicyError,
@@ -4190,6 +4212,7 @@ __export(src_exports, {
4190
4212
  enableDevUnlock: () => enableDevUnlock,
4191
4213
  encryptBytes: () => encryptBytes,
4192
4214
  encryptDeterministic: () => encryptDeterministic,
4215
+ enforceScript: () => enforceScript,
4193
4216
  enrollAuthenticator: () => enrollAuthenticator,
4194
4217
  envelopePayloadHash: () => envelopePayloadHash,
4195
4218
  estimateEntropy: () => estimateEntropy,
@@ -4210,6 +4233,7 @@ __export(src_exports, {
4210
4233
  hasRecoveryEnrolled: () => hasRecoveryEnrolled,
4211
4234
  hashEntry: () => hashEntry,
4212
4235
  i18nText: () => i18nText,
4236
+ inferScripts: () => inferScripts,
4213
4237
  isDevUnlockActive: () => isDevUnlockActive,
4214
4238
  isDictCollectionName: () => isDictCollectionName,
4215
4239
  isDictKeyDescriptor: () => isDictKeyDescriptor,
@@ -4270,6 +4294,7 @@ __export(src_exports, {
4270
4294
  resetJoinWarnings: () => resetJoinWarnings,
4271
4295
  resolveCrdtSnapshot: () => resolveCrdtSnapshot,
4272
4296
  resolveI18nText: () => resolveI18nText,
4297
+ resolvePolicy: () => resolvePolicy,
4273
4298
  resolvePublicEnvelopeSchema: () => resolveSchema,
4274
4299
  resolveSession: () => resolveSession,
4275
4300
  revokeAllSessions: () => revokeAllSessions,
@@ -9744,6 +9769,16 @@ var NO_CRDT = {
9744
9769
 
9745
9770
  // src/i18n/core.ts
9746
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
9747
9782
  function i18nText(options) {
9748
9783
  return { _noydbI18nText: true, options };
9749
9784
  }
@@ -9806,7 +9841,21 @@ function validateI18nTextValue(value, field, descriptor) {
9806
9841
  }
9807
9842
  }
9808
9843
  }
9809
- function resolveI18nText(value, locale, fallback, field) {
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) {
9810
9859
  if (locale === "raw") {
9811
9860
  return value;
9812
9861
  }
@@ -9816,19 +9865,21 @@ function resolveI18nText(value, locale, fallback, field) {
9816
9865
  if (value[locale] !== void 0 && value[locale] !== "") {
9817
9866
  return value[locale];
9818
9867
  }
9819
- const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
9820
- for (const fb of chain) {
9821
- if (fb === "any") {
9822
- const any = Object.values(value).find((v) => v !== "");
9823
- if (any !== void 0) return any;
9824
- } else if (value[fb] !== void 0 && value[fb] !== "") {
9825
- return value[fb];
9826
- }
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
+ );
9827
9881
  }
9828
- throw new LocaleNotSpecifiedError(
9829
- field ?? "<unknown>",
9830
- `No translation available for locale "${locale}"` + (chain.length > 0 ? ` or fallback chain [${chain.join(", ")}]` : "") + "."
9831
- );
9882
+ return null;
9832
9883
  }
9833
9884
  function getAtPath(obj, path) {
9834
9885
  const arrayIdx = path.indexOf("[].");
@@ -9865,7 +9916,7 @@ function setAtPathInPlace(obj, path, value) {
9865
9916
  }
9866
9917
  obj[path] = value;
9867
9918
  }
9868
- function applyAtPath(obj, path, locale, fallback) {
9919
+ function applyAtPath(obj, path, locale, fallback, opts) {
9869
9920
  const arrayIdx = path.indexOf("[].");
9870
9921
  if (arrayIdx !== -1) {
9871
9922
  const arrayKey = path.slice(0, arrayIdx);
@@ -9876,7 +9927,7 @@ function applyAtPath(obj, path, locale, fallback) {
9876
9927
  ...obj,
9877
9928
  [arrayKey]: arr.map((item) => {
9878
9929
  if (!item || typeof item !== "object" || Array.isArray(item)) return item;
9879
- return applyAtPath(item, restPath, locale, fallback);
9930
+ return applyAtPath(item, restPath, locale, fallback, opts);
9880
9931
  })
9881
9932
  };
9882
9933
  }
@@ -9888,7 +9939,7 @@ function applyAtPath(obj, path, locale, fallback) {
9888
9939
  if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
9889
9940
  return {
9890
9941
  ...obj,
9891
- [head]: applyAtPath(nested, rest, locale, fallback)
9942
+ [head]: applyAtPath(nested, rest, locale, fallback, opts)
9892
9943
  };
9893
9944
  }
9894
9945
  const raw = obj[path];
@@ -9896,15 +9947,20 @@ function applyAtPath(obj, path, locale, fallback) {
9896
9947
  if (typeof raw !== "object" || Array.isArray(raw)) return obj;
9897
9948
  return {
9898
9949
  ...obj,
9899
- [path]: resolveI18nText(raw, locale, fallback, path)
9950
+ [path]: resolveI18nText(raw, locale, fallback, path, opts)
9900
9951
  };
9901
9952
  }
9902
- function applyI18nLocale(record, i18nFields, locale, fallback) {
9953
+ function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
9903
9954
  const fieldNames = Object.keys(i18nFields);
9904
9955
  if (fieldNames.length === 0) return record;
9905
9956
  let result = record;
9906
- for (const field of fieldNames) {
9907
- result = applyAtPath(result, field, locale, fallback);
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);
9908
9964
  }
9909
9965
  return result;
9910
9966
  }
@@ -9922,6 +9978,9 @@ var NO_I18N = {
9922
9978
  validateI18nTextValue() {
9923
9979
  throw notEnabled("i18nText field validation");
9924
9980
  },
9981
+ enforceScript(value) {
9982
+ return { value, warnings: [] };
9983
+ },
9925
9984
  buildDictionaryHandle() {
9926
9985
  throw notEnabled("vault.dictionary()");
9927
9986
  }
@@ -13111,6 +13170,22 @@ var Collection = class {
13111
13170
  setAtPathInPlace(obj, field, translated);
13112
13171
  }
13113
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
+ }
13114
13189
  if (this.i18nPutValidator !== void 0) {
13115
13190
  this.i18nPutValidator(record);
13116
13191
  }
@@ -14553,17 +14628,52 @@ var Collection = class {
14553
14628
  }
14554
14629
  if (hasDict && this.dictKeyFields && this.dictLabelResolver && locale !== "raw") {
14555
14630
  const withLabels = { ...result };
14631
+ const resolver = this.dictLabelResolver;
14556
14632
  for (const [field, desc] of Object.entries(this.dictKeyFields)) {
14557
- const key = result[field];
14558
- if (typeof key !== "string") continue;
14559
- const label = await this.dictLabelResolver(
14560
- desc.name,
14561
- key,
14562
- locale,
14563
- localeOpts?.fallback
14564
- );
14565
- if (label !== void 0) {
14566
- withLabels[`${field}Label`] = label;
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;
14567
14677
  }
14568
14678
  }
14569
14679
  result = withLabels;
@@ -15438,8 +15548,14 @@ function dictCollectionName(dictionaryName) {
15438
15548
  function isDictCollectionName(name) {
15439
15549
  return name.startsWith(DICT_COLLECTION_PREFIX);
15440
15550
  }
15441
- function dictKey(name, keys) {
15442
- return { _noydbDictKey: true, name, keys };
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
+ };
15443
15559
  }
15444
15560
  function isDictKeyDescriptor(x) {
15445
15561
  return typeof x === "object" && x !== null && x._noydbDictKey === true;
@@ -19747,6 +19863,119 @@ var NO_SNAPSHOTS = {
19747
19863
  },
19748
19864
  async restoreSnapshot() {
19749
19865
  throw NOT_ENABLED5;
19866
+ },
19867
+ async autoSnapshot() {
19868
+ throw NOT_ENABLED5;
19869
+ }
19870
+ };
19871
+
19872
+ // src/snapshots/scheduler.ts
19873
+ var SnapshotScheduler = class {
19874
+ policy;
19875
+ callbacks;
19876
+ debounceTimer = null;
19877
+ intervalTimer = null;
19878
+ lastFireTime = 0;
19879
+ firing = false;
19880
+ started = false;
19881
+ boundVisibility = null;
19882
+ boundUnload = null;
19883
+ constructor(policy, callbacks) {
19884
+ this.policy = policy;
19885
+ this.callbacks = callbacks;
19886
+ if (this.shouldRegisterUnload()) {
19887
+ this.boundVisibility = this.handleVisibility.bind(this);
19888
+ this.boundUnload = this.handleUnload.bind(this);
19889
+ }
19890
+ }
19891
+ start() {
19892
+ if (this.started) return;
19893
+ this.started = true;
19894
+ if (this.policy.mode === "interval") {
19895
+ const ms = this.policy.intervalMs ?? 3e5;
19896
+ this.intervalTimer = setInterval(() => {
19897
+ void this.execFire();
19898
+ }, ms);
19899
+ }
19900
+ if (this.boundVisibility && this.boundUnload) {
19901
+ if (typeof document !== "undefined") {
19902
+ document.addEventListener("visibilitychange", this.boundVisibility);
19903
+ }
19904
+ if (typeof globalThis.addEventListener === "function") {
19905
+ globalThis.addEventListener("pagehide", this.boundUnload);
19906
+ }
19907
+ if (typeof process !== "undefined" && typeof process.on === "function") {
19908
+ process.on("beforeExit", this.boundUnload);
19909
+ }
19910
+ }
19911
+ }
19912
+ stop() {
19913
+ if (!this.started) return;
19914
+ this.started = false;
19915
+ if (this.debounceTimer) {
19916
+ clearTimeout(this.debounceTimer);
19917
+ this.debounceTimer = null;
19918
+ }
19919
+ if (this.intervalTimer) {
19920
+ clearInterval(this.intervalTimer);
19921
+ this.intervalTimer = null;
19922
+ }
19923
+ if (this.boundVisibility && this.boundUnload) {
19924
+ if (typeof document !== "undefined") {
19925
+ document.removeEventListener("visibilitychange", this.boundVisibility);
19926
+ }
19927
+ if (typeof globalThis.removeEventListener === "function") {
19928
+ globalThis.removeEventListener("pagehide", this.boundUnload);
19929
+ }
19930
+ if (typeof process !== "undefined" && typeof process.removeListener === "function") {
19931
+ process.removeListener("beforeExit", this.boundUnload);
19932
+ }
19933
+ }
19934
+ }
19935
+ notifyChange() {
19936
+ if (!this.started) return;
19937
+ if (this.policy.mode === "debounce") this.resetDebounce();
19938
+ }
19939
+ resetDebounce() {
19940
+ if (this.debounceTimer) clearTimeout(this.debounceTimer);
19941
+ const ms = this.policy.debounceMs ?? 3e4;
19942
+ this.debounceTimer = setTimeout(() => {
19943
+ this.debounceTimer = null;
19944
+ void this.execFire();
19945
+ }, ms);
19946
+ }
19947
+ async execFire() {
19948
+ if (this.firing) return;
19949
+ const minInterval = this.policy.minIntervalMs ?? 0;
19950
+ if (minInterval > 0 && Date.now() - this.lastFireTime < minInterval) {
19951
+ if (this.policy.mode === "debounce") this.resetDebounce();
19952
+ return;
19953
+ }
19954
+ if (this.callbacks.pendingCount() === 0) return;
19955
+ this.firing = true;
19956
+ try {
19957
+ await this.callbacks.fire();
19958
+ this.lastFireTime = Date.now();
19959
+ } catch {
19960
+ } finally {
19961
+ this.firing = false;
19962
+ }
19963
+ }
19964
+ handleVisibility() {
19965
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") {
19966
+ this.flush();
19967
+ }
19968
+ }
19969
+ handleUnload() {
19970
+ this.flush();
19971
+ }
19972
+ flush() {
19973
+ if (this.callbacks.pendingCount() === 0) return;
19974
+ void this.callbacks.fire().catch(() => {
19975
+ });
19976
+ }
19977
+ shouldRegisterUnload() {
19978
+ return this.policy.onUnload ?? this.policy.mode !== "manual";
19750
19979
  }
19751
19980
  };
19752
19981
 
@@ -20103,6 +20332,8 @@ var Noydb = class {
20103
20332
  sessionStrategy;
20104
20333
  syncStrategy;
20105
20334
  snapshotStrategy;
20335
+ snapshotScheduler = null;
20336
+ dirtySnapshotVaults = /* @__PURE__ */ new Set();
20106
20337
  /**
20107
20338
  * Currently-running multi-record transaction, set by
20108
20339
  * `runTransaction` at the start of Phase 2 (commit) and cleared in
@@ -20128,6 +20359,7 @@ var Noydb = class {
20128
20359
  this.sessionStrategy = options.sessionStrategy ?? NO_SESSION;
20129
20360
  this.syncStrategy = options.syncStrategy ?? NO_SYNC;
20130
20361
  this.snapshotStrategy = options.snapshotStrategy ?? NO_SNAPSHOTS;
20362
+ this.initSnapshotCadence();
20131
20363
  this.publicEnvelopeSchema = resolveSchema(options.publicEnvelope);
20132
20364
  if (options.sessionPolicy) {
20133
20365
  this.sessionStrategy.validateSessionPolicy(options.sessionPolicy);
@@ -21084,6 +21316,8 @@ var Noydb = class {
21084
21316
  }
21085
21317
  close() {
21086
21318
  this.closed = true;
21319
+ this.snapshotScheduler?.stop();
21320
+ this.snapshotScheduler = null;
21087
21321
  if (this.sessionTimer) {
21088
21322
  clearTimeout(this.sessionTimer);
21089
21323
  this.sessionTimer = null;
@@ -22129,6 +22363,41 @@ var Noydb = class {
22129
22363
  }
22130
22364
  return this.snapshotStrategy.snapshot(v, this.options.user, opts);
22131
22365
  }
22366
+ /**
22367
+ * Wire the automatic-snapshot cadence when a non-manual `snapshotPolicy` is
22368
+ * configured. Subscribes to `onAfterWrite` to mark the written vault dirty and
22369
+ * nudge the scheduler; the scheduler fires `autoSnapshot()` per dirty vault.
22370
+ * No-op for `mode:'manual'` or no policy.
22371
+ */
22372
+ initSnapshotCadence() {
22373
+ const policy = this.snapshotStrategy.policy;
22374
+ if (!policy || !policy.mode || policy.mode === "manual") return;
22375
+ const scheduler = new SnapshotScheduler(policy, {
22376
+ fire: async () => {
22377
+ const names = [...this.dirtySnapshotVaults];
22378
+ this.dirtySnapshotVaults.clear();
22379
+ for (const name of names) {
22380
+ const v = this.vaultCache.get(name);
22381
+ if (!v) continue;
22382
+ try {
22383
+ await this.snapshotStrategy.autoSnapshot(v, this.options.user);
22384
+ } catch (err) {
22385
+ this.dirtySnapshotVaults.add(name);
22386
+ console.warn(
22387
+ `[noy-db] auto-snapshot failed for vault "${name}": ` + (err instanceof Error ? err.message : String(err))
22388
+ );
22389
+ }
22390
+ }
22391
+ },
22392
+ pendingCount: () => this.dirtySnapshotVaults.size
22393
+ });
22394
+ this.onAfterWrite((event) => {
22395
+ this.dirtySnapshotVaults.add(event.vault);
22396
+ scheduler.notifyChange();
22397
+ });
22398
+ scheduler.start();
22399
+ this.snapshotScheduler = scheduler;
22400
+ }
22132
22401
  /**
22133
22402
  * List all snapshots for the given vault, newest first.
22134
22403
  * Reads only the sidecar index — does not download snapshot bytes.
@@ -23119,6 +23388,139 @@ function withOverlayedView(spec) {
23119
23388
  // src/index.ts
23120
23389
  init_errors();
23121
23390
  init_errors();
23391
+
23392
+ // src/i18n/script.ts
23393
+ init_errors();
23394
+ var LATIN_BASE = /* @__PURE__ */ new Set([
23395
+ "en",
23396
+ "fr",
23397
+ "de",
23398
+ "es",
23399
+ "it",
23400
+ "pt",
23401
+ "nl",
23402
+ "sv",
23403
+ "no",
23404
+ "da",
23405
+ "fi",
23406
+ "is",
23407
+ "pl",
23408
+ "cs",
23409
+ "sk",
23410
+ "hu",
23411
+ "ro",
23412
+ "hr",
23413
+ "sl",
23414
+ "et",
23415
+ "lv",
23416
+ "lt",
23417
+ "tr",
23418
+ "vi",
23419
+ "id",
23420
+ "ms",
23421
+ "tl",
23422
+ "sw",
23423
+ "af",
23424
+ "ca",
23425
+ "gl",
23426
+ "eu",
23427
+ "cy",
23428
+ "ga"
23429
+ ]);
23430
+ var SCRIPT_TABLE = {
23431
+ th: ["Thai"],
23432
+ ko: ["Hangul", "Han"],
23433
+ ja: ["Han", "Hiragana", "Katakana"],
23434
+ zh: ["Han"],
23435
+ ar: ["Arabic"],
23436
+ fa: ["Arabic"],
23437
+ ur: ["Arabic"],
23438
+ ru: ["Cyrillic"],
23439
+ uk: ["Cyrillic"],
23440
+ bg: ["Cyrillic"],
23441
+ sr: ["Cyrillic"],
23442
+ he: ["Hebrew"],
23443
+ el: ["Greek"],
23444
+ hi: ["Devanagari"],
23445
+ ta: ["Tamil"],
23446
+ km: ["Khmer"],
23447
+ lo: ["Lao"],
23448
+ my: ["Myanmar"]
23449
+ };
23450
+ var SUBTAG_SCRIPTS = {
23451
+ Latn: ["Latin"],
23452
+ Cyrl: ["Cyrillic", "Latin"],
23453
+ Hans: ["Han", "Latin"],
23454
+ Hant: ["Han", "Latin"],
23455
+ Thai: ["Thai", "Latin"],
23456
+ Arab: ["Arabic", "Latin"]
23457
+ };
23458
+ function inferScripts(locale) {
23459
+ const parts = locale.split("-");
23460
+ const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
23461
+ if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
23462
+ const base = (parts[0] ?? "").toLowerCase();
23463
+ if (LATIN_BASE.has(base)) return ["Latin"];
23464
+ const primary = SCRIPT_TABLE[base];
23465
+ if (primary) return [...primary, "Latin"];
23466
+ return ["Latin"];
23467
+ }
23468
+ function allowedFor(descriptor, locale) {
23469
+ const script = descriptor.options.script;
23470
+ if (script && script !== "auto") {
23471
+ const explicit = script[locale];
23472
+ if (explicit) return explicit;
23473
+ }
23474
+ return inferScripts(locale);
23475
+ }
23476
+ var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
23477
+ function fullMatcher(scripts) {
23478
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
23479
+ return new RegExp(`^[${BASELINE}${cls}]*$`, "u");
23480
+ }
23481
+ function charMatcher(scripts) {
23482
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
23483
+ return new RegExp(`[${BASELINE}${cls}]`, "u");
23484
+ }
23485
+ function offendingSample(str, scripts) {
23486
+ const ok = charMatcher(scripts);
23487
+ const bad = [];
23488
+ for (const ch of str) {
23489
+ if (!ok.test(ch)) bad.push(ch);
23490
+ if (bad.length >= 8) break;
23491
+ }
23492
+ return bad.join("");
23493
+ }
23494
+ function stripDisallowed(str, scripts) {
23495
+ const ok = charMatcher(scripts);
23496
+ let out = "";
23497
+ for (const ch of str) if (ok.test(ch)) out += ch;
23498
+ return out;
23499
+ }
23500
+ function enforceScript(value, field, descriptor) {
23501
+ const opt = descriptor.options;
23502
+ if (!opt.script) return { value, warnings: [] };
23503
+ const mode = opt.onScriptViolation ?? "reject";
23504
+ const warnings = [];
23505
+ let out = value;
23506
+ for (const [locale, raw] of Object.entries(value)) {
23507
+ if (typeof raw !== "string") continue;
23508
+ const allowed = allowedFor(descriptor, locale);
23509
+ if (fullMatcher(allowed).test(raw)) continue;
23510
+ const sample = offendingSample(raw, allowed);
23511
+ if (mode === "reject") {
23512
+ throw new ScriptViolationError(field, locale, allowed, sample);
23513
+ }
23514
+ warnings.push({ field, locale, expected: allowed, sample });
23515
+ if (mode === "filter") {
23516
+ if (out === value) out = { ...value };
23517
+ out[locale] = stripDisallowed(raw, allowed);
23518
+ }
23519
+ }
23520
+ return { value: out, warnings };
23521
+ }
23522
+
23523
+ // src/index.ts
23122
23524
  init_errors();
23123
23525
 
23124
23526
  // src/team/sync-credentials.ts
@@ -23880,6 +24282,7 @@ function shortJSON(value) {
23880
24282
  SchemaLockedError,
23881
24283
  SchemaUpdateError,
23882
24284
  SchemaValidationError,
24285
+ ScriptViolationError,
23883
24286
  SessionExpiredError,
23884
24287
  SessionNotFoundError,
23885
24288
  SessionPolicyError,
@@ -23955,6 +24358,7 @@ function shortJSON(value) {
23955
24358
  enableDevUnlock,
23956
24359
  encryptBytes,
23957
24360
  encryptDeterministic,
24361
+ enforceScript,
23958
24362
  enrollAuthenticator,
23959
24363
  envelopePayloadHash,
23960
24364
  estimateEntropy,
@@ -23975,6 +24379,7 @@ function shortJSON(value) {
23975
24379
  hasRecoveryEnrolled,
23976
24380
  hashEntry,
23977
24381
  i18nText,
24382
+ inferScripts,
23978
24383
  isDevUnlockActive,
23979
24384
  isDictCollectionName,
23980
24385
  isDictKeyDescriptor,
@@ -24035,6 +24440,7 @@ function shortJSON(value) {
24035
24440
  resetJoinWarnings,
24036
24441
  resolveCrdtSnapshot,
24037
24442
  resolveI18nText,
24443
+ resolvePolicy,
24038
24444
  resolvePublicEnvelopeSchema,
24039
24445
  resolveSession,
24040
24446
  revokeAllSessions,