@noy-db/hub 0.2.0-pre.2 → 0.2.0-pre.20

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 (368) hide show
  1. package/README.md +126 -0
  2. package/dist/aggregate/index.cjs +643 -37
  3. package/dist/aggregate/index.cjs.map +1 -1
  4. package/dist/aggregate/index.d.cts +3 -2
  5. package/dist/aggregate/index.d.ts +3 -2
  6. package/dist/aggregate/index.js +9 -8
  7. package/dist/aggregate/index.js.map +1 -1
  8. package/dist/attestation/index.cjs.map +1 -1
  9. package/dist/attestation/index.d.cts +7 -5
  10. package/dist/attestation/index.d.ts +7 -5
  11. package/dist/attestation/index.js +6 -6
  12. package/dist/blobs/index.cjs +509 -22
  13. package/dist/blobs/index.cjs.map +1 -1
  14. package/dist/blobs/index.d.cts +9 -7
  15. package/dist/blobs/index.d.ts +9 -7
  16. package/dist/blobs/index.js +11 -6
  17. package/dist/blobs/index.js.map +1 -1
  18. package/dist/bundle/index.cjs +7886 -841
  19. package/dist/bundle/index.cjs.map +1 -1
  20. package/dist/bundle/index.d.cts +20 -18
  21. package/dist/bundle/index.d.ts +20 -18
  22. package/dist/bundle/index.js +24 -13
  23. package/dist/bundle/index.js.map +1 -1
  24. package/dist/{chunk-PFSNOPBQ.js → chunk-2XA2ZML4.js} +31 -3
  25. package/dist/chunk-2XA2ZML4.js.map +1 -0
  26. package/dist/{chunk-2PAQNPE3.js → chunk-37VGJM3T.js} +37 -2
  27. package/dist/chunk-37VGJM3T.js.map +1 -0
  28. package/dist/{chunk-7BRE6EUA.js → chunk-3HNKR65T.js} +4 -4
  29. package/dist/chunk-3HNKR65T.js.map +1 -0
  30. package/dist/{chunk-Y2RKOPNC.js → chunk-5YTXYPES.js} +46 -10
  31. package/dist/chunk-5YTXYPES.js.map +1 -0
  32. package/dist/{chunk-OVZDFEOR.js → chunk-6QAZ5O6X.js} +2 -2
  33. package/dist/chunk-6QAZ5O6X.js.map +1 -0
  34. package/dist/{chunk-RTZVQAJ7.js → chunk-6QE4DUYC.js} +19 -4
  35. package/dist/chunk-6QE4DUYC.js.map +1 -0
  36. package/dist/{chunk-7Q5PLD5C.js → chunk-7MRT7EPB.js} +3 -3
  37. package/dist/{chunk-E535SAN4.js → chunk-7PH4OPBZ.js} +4258 -520
  38. package/dist/chunk-7PH4OPBZ.js.map +1 -0
  39. package/dist/{chunk-PEULZC6M.js → chunk-A3JMGXPG.js} +8 -1
  40. package/dist/chunk-A3JMGXPG.js.map +1 -0
  41. package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
  42. package/dist/chunk-ADB7GPM3.js.map +1 -0
  43. package/dist/{chunk-G6FRSBKK.js → chunk-AI4USDRI.js} +4 -4
  44. package/dist/chunk-BZW5IL43.js +151 -0
  45. package/dist/chunk-BZW5IL43.js.map +1 -0
  46. package/dist/chunk-C2RJVZZL.js +123 -0
  47. package/dist/chunk-C2RJVZZL.js.map +1 -0
  48. package/dist/{chunk-UND4XIB6.js → chunk-C6W5KVDV.js} +52 -38
  49. package/dist/chunk-C6W5KVDV.js.map +1 -0
  50. package/dist/chunk-CQYEDODS.js +125 -0
  51. package/dist/chunk-CQYEDODS.js.map +1 -0
  52. package/dist/{chunk-NWZ3I6R6.js → chunk-EYK72OTL.js} +5 -5
  53. package/dist/{chunk-7BUTTVMR.js → chunk-F5GWNSE2.js} +2 -2
  54. package/dist/{chunk-AHPFONIL.js → chunk-F5ILTHMU.js} +5 -5
  55. package/dist/{chunk-Q6W2CMEJ.js → chunk-FRRJIUSI.js} +18 -5
  56. package/dist/chunk-FRRJIUSI.js.map +1 -0
  57. package/dist/{chunk-YMYK7US4.js → chunk-GJTKMME7.js} +2 -2
  58. package/dist/chunk-GJTKMME7.js.map +1 -0
  59. package/dist/{chunk-EUYOGYGV.js → chunk-HYJMAV53.js} +6 -6
  60. package/dist/chunk-HYJMAV53.js.map +1 -0
  61. package/dist/{chunk-QPEXPHJR.js → chunk-I3IYTUUI.js} +4 -4
  62. package/dist/{chunk-3QAKZ37R.js → chunk-IVZWHIEK.js} +5 -5
  63. package/dist/{chunk-PLI5TV7N.js → chunk-IW4L4X65.js} +2 -2
  64. package/dist/chunk-IW4L4X65.js.map +1 -0
  65. package/dist/{chunk-3Z2TPHC4.js → chunk-IY24WS2P.js} +69 -5
  66. package/dist/chunk-IY24WS2P.js.map +1 -0
  67. package/dist/{chunk-HXJXPZRE.js → chunk-J6RGRZOY.js} +10 -3
  68. package/dist/chunk-J6RGRZOY.js.map +1 -0
  69. package/dist/{chunk-3S4BJX25.js → chunk-JBBWALNI.js} +2 -2
  70. package/dist/chunk-JBBWALNI.js.map +1 -0
  71. package/dist/{chunk-7Z23ZFLV.js → chunk-JDCPRJVS.js} +5 -5
  72. package/dist/chunk-JDCPRJVS.js.map +1 -0
  73. package/dist/{chunk-243PNUA6.js → chunk-JOK73NDT.js} +3 -3
  74. package/dist/chunk-JTI57WRT.js +164 -0
  75. package/dist/chunk-JTI57WRT.js.map +1 -0
  76. package/dist/{chunk-VRBCTEKQ.js → chunk-JYNH4FIM.js} +233 -11
  77. package/dist/chunk-JYNH4FIM.js.map +1 -0
  78. package/dist/{chunk-TBKOGSYR.js → chunk-KOAJ3TZM.js} +27 -5
  79. package/dist/chunk-KOAJ3TZM.js.map +1 -0
  80. package/dist/{chunk-YTXSFG3C.js → chunk-MBXKRHSS.js} +50 -20
  81. package/dist/chunk-MBXKRHSS.js.map +1 -0
  82. package/dist/{chunk-MUWOSVEP.js → chunk-NSXNXLYM.js} +10 -2
  83. package/dist/chunk-NSXNXLYM.js.map +1 -0
  84. package/dist/{chunk-J4KLMEUL.js → chunk-NV4IHBZS.js} +664 -51
  85. package/dist/chunk-NV4IHBZS.js.map +1 -0
  86. package/dist/{chunk-LRAZDV5X.js → chunk-O5XKZCUD.js} +31 -8
  87. package/dist/chunk-O5XKZCUD.js.map +1 -0
  88. package/dist/{chunk-W3XXT26A.js → chunk-OTWT6BAJ.js} +358 -3
  89. package/dist/chunk-OTWT6BAJ.js.map +1 -0
  90. package/dist/{chunk-XG3PTSCD.js → chunk-PDVP3C2I.js} +1 -1
  91. package/dist/chunk-PDVP3C2I.js.map +1 -0
  92. package/dist/{chunk-GIV6DWBG.js → chunk-S45MDEEF.js} +44 -5
  93. package/dist/chunk-S45MDEEF.js.map +1 -0
  94. package/dist/{chunk-VK5EER6C.js → chunk-SQKAECUL.js} +2 -2
  95. package/dist/{chunk-FAQVNJD4.js → chunk-SQOK5UM6.js} +12 -2
  96. package/dist/{chunk-FAQVNJD4.js.map → chunk-SQOK5UM6.js.map} +1 -1
  97. package/dist/chunk-STNPB3UM.js +9 -0
  98. package/dist/chunk-STNPB3UM.js.map +1 -0
  99. package/dist/{chunk-YS3POABP.js → chunk-TA6HPKWQ.js} +1 -1
  100. package/dist/chunk-TA6HPKWQ.js.map +1 -0
  101. package/dist/{chunk-4HIL6AHQ.js → chunk-TAMRU7A2.js} +4 -4
  102. package/dist/{chunk-QXQRKXCU.js → chunk-TGIJTNM3.js} +2 -2
  103. package/dist/chunk-TNH5SLCD.js +361 -0
  104. package/dist/chunk-TNH5SLCD.js.map +1 -0
  105. package/dist/{chunk-VPSUZLOJ.js → chunk-TYMDCIQM.js} +31 -5
  106. package/dist/chunk-TYMDCIQM.js.map +1 -0
  107. package/dist/chunk-U2XSUCDF.js +524 -0
  108. package/dist/chunk-U2XSUCDF.js.map +1 -0
  109. package/dist/{chunk-3Y53S2SA.js → chunk-UU6M64HI.js} +4 -4
  110. package/dist/{chunk-VCGTOS2A.js → chunk-WE2BUQD2.js} +3 -3
  111. package/dist/chunk-WE2BUQD2.js.map +1 -0
  112. package/dist/{chunk-JYQTXEIO.js → chunk-WWVJXBOT.js} +449 -29
  113. package/dist/chunk-WWVJXBOT.js.map +1 -0
  114. package/dist/chunk-YPIOFSN3.js +129 -0
  115. package/dist/chunk-YPIOFSN3.js.map +1 -0
  116. package/dist/chunk-ZC7J6ZYV.js +7 -0
  117. package/dist/chunk-ZC7J6ZYV.js.map +1 -0
  118. package/dist/{chunk-5ZGZ6HIZ.js → chunk-ZONKSLF2.js} +30 -7
  119. package/dist/chunk-ZONKSLF2.js.map +1 -0
  120. package/dist/consent/index.cjs.map +1 -1
  121. package/dist/consent/index.d.cts +8 -6
  122. package/dist/consent/index.d.ts +8 -6
  123. package/dist/consent/index.js +3 -3
  124. package/dist/{crypto-5ZDIY3NG.js → crypto-456N7UVX.js} +7 -3
  125. package/dist/{delegation-QYXZW25W.js → delegation-DP4COTXB.js} +5 -5
  126. package/dist/derivations/index.cjs +124 -6
  127. package/dist/derivations/index.cjs.map +1 -1
  128. package/dist/derivations/index.d.cts +11 -9
  129. package/dist/derivations/index.d.ts +11 -9
  130. package/dist/derivations/index.js +8 -6
  131. package/dist/{dev-unlock-DQCNDfFp.d.cts → dev-unlock-CY0HIZA0.d.cts} +1 -1
  132. package/dist/{dev-unlock-utkybTKb.d.ts → dev-unlock-CpKSkl2c.d.ts} +1 -1
  133. package/dist/discriminant-BN9REW3o.d.cts +60 -0
  134. package/dist/discriminant-BN9REW3o.d.ts +60 -0
  135. package/dist/errors-Dkc_fi-S.d.cts +1467 -0
  136. package/dist/errors-Dkc_fi-S.d.ts +1467 -0
  137. package/dist/executor-4IEW4KG5.js +8 -0
  138. package/dist/executor-KYJCJCIN.js +12 -0
  139. package/dist/executor-W7VIBOBZ.js +8 -0
  140. package/dist/{fanout-sidecar-VJ52RIEY.js → fanout-sidecar-YXNAEZ33.js} +2 -2
  141. package/dist/fanout-sidecar-YXNAEZ33.js.map +1 -0
  142. package/dist/forget/index.cjs +43 -0
  143. package/dist/forget/index.cjs.map +1 -0
  144. package/dist/forget/index.d.cts +1 -0
  145. package/dist/forget/index.d.ts +1 -0
  146. package/dist/forget/index.js +14 -0
  147. package/dist/guards/index.cjs +144 -4
  148. package/dist/guards/index.cjs.map +1 -1
  149. package/dist/guards/index.d.cts +16 -8
  150. package/dist/guards/index.d.ts +16 -8
  151. package/dist/guards/index.js +13 -7
  152. package/dist/{hash-jDowCrK2.d.cts → hash-BSd0-_L8.d.cts} +1 -1
  153. package/dist/{hash-DcoYWfJ_.d.ts → hash-BnBQx39y.d.ts} +1 -1
  154. package/dist/history/index.cjs +28 -5
  155. package/dist/history/index.cjs.map +1 -1
  156. package/dist/history/index.d.cts +9 -7
  157. package/dist/history/index.d.ts +9 -7
  158. package/dist/history/index.js +9 -7
  159. package/dist/history/index.js.map +1 -1
  160. package/dist/i18n/index.cjs +356 -26
  161. package/dist/i18n/index.cjs.map +1 -1
  162. package/dist/i18n/index.d.cts +8 -6
  163. package/dist/i18n/index.d.ts +8 -6
  164. package/dist/i18n/index.js +36 -15
  165. package/dist/i18n/index.js.map +1 -1
  166. package/dist/index-BMmajblo.d.cts +362 -0
  167. package/dist/index-BMmajblo.d.ts +362 -0
  168. package/dist/{index-BCKdioeh.d.ts → index-Bm9hIY7t.d.ts} +169 -1127
  169. package/dist/{index-BMjrzNZr.d.cts → index-tZqVB9g5.d.cts} +169 -1127
  170. package/dist/index.cjs +10286 -2168
  171. package/dist/index.cjs.map +1 -1
  172. package/dist/index.d.cts +258 -23
  173. package/dist/index.d.ts +258 -23
  174. package/dist/index.js +443 -110
  175. package/dist/index.js.map +1 -1
  176. package/dist/indexing/index.cjs +97 -32
  177. package/dist/indexing/index.cjs.map +1 -1
  178. package/dist/indexing/index.d.cts +3 -3
  179. package/dist/indexing/index.d.ts +3 -3
  180. package/dist/indexing/index.js +4 -4
  181. package/dist/issue-JXC6T2QR.js +12 -0
  182. package/dist/{lazy-builder-Rpd-V3jP.d.ts → lazy-builder-ChSqcF5t.d.ts} +2 -2
  183. package/dist/{lazy-builder-C-rPfWG0.d.cts → lazy-builder-eYZzLEL1.d.cts} +2 -2
  184. package/dist/{ledger-3IU5GMXA.js → ledger-I7JUYP4L.js} +6 -6
  185. package/dist/materialized-views/index.cjs +687 -13
  186. package/dist/materialized-views/index.cjs.map +1 -1
  187. package/dist/materialized-views/index.d.cts +23 -20
  188. package/dist/materialized-views/index.d.ts +23 -20
  189. package/dist/materialized-views/index.js +8 -7
  190. package/dist/mime-magic-BnJCGJzB.d.cts +103 -0
  191. package/dist/mime-magic-CjSyakO4.d.ts +103 -0
  192. package/dist/noydb-ZZCRF6TE.js +38 -0
  193. package/dist/overlay-views/index.cjs +58 -18
  194. package/dist/overlay-views/index.cjs.map +1 -1
  195. package/dist/overlay-views/index.d.cts +32 -12
  196. package/dist/overlay-views/index.d.ts +32 -12
  197. package/dist/overlay-views/index.js +6 -6
  198. package/dist/periods/index.cjs.map +1 -1
  199. package/dist/periods/index.d.cts +8 -6
  200. package/dist/periods/index.d.ts +8 -6
  201. package/dist/periods/index.js +6 -6
  202. package/dist/{predicate-Dnu81tsS.d.cts → predicate-BmhBSPCH.d.cts} +87 -5
  203. package/dist/{predicate-Dnu81tsS.d.ts → predicate-BmhBSPCH.d.ts} +87 -5
  204. package/dist/{public-envelope-U3CMEOMV.js → public-envelope-5XRTUNKF.js} +4 -4
  205. package/dist/query/index.cjs +1438 -130
  206. package/dist/query/index.cjs.map +1 -1
  207. package/dist/query/index.d.cts +4 -3
  208. package/dist/query/index.d.ts +4 -3
  209. package/dist/query/index.js +13 -6
  210. package/dist/read-only-facade-EX6WZZBP.js +7 -0
  211. package/dist/registry-ATRHOG5B.js +8 -0
  212. package/dist/registry-DKEXOJVO.js +7 -0
  213. package/dist/registry-LEHB26TY.js +8 -0
  214. package/dist/{registry-3ALP62P6.js → registry-NWHOLD5M.js} +3 -3
  215. package/dist/{revoke-KY2GB4KP.js → revoke-5IEK22KT.js} +6 -6
  216. package/dist/sealed-record/index.cjs +139 -0
  217. package/dist/sealed-record/index.cjs.map +1 -0
  218. package/dist/sealed-record/index.d.cts +123 -0
  219. package/dist/sealed-record/index.d.ts +123 -0
  220. package/dist/sealed-record/index.js +42 -0
  221. package/dist/sealed-record/index.js.map +1 -0
  222. package/dist/session/index.cjs.map +1 -1
  223. package/dist/session/index.d.cts +9 -7
  224. package/dist/session/index.d.ts +9 -7
  225. package/dist/session/index.js +3 -3
  226. package/dist/shadow/index.cjs.map +1 -1
  227. package/dist/shadow/index.d.cts +8 -6
  228. package/dist/shadow/index.d.ts +8 -6
  229. package/dist/shadow/index.js +2 -2
  230. package/dist/{signer-GRI5TZKH.js → signer-I6YARZQA.js} +5 -5
  231. package/dist/snapshots/index.cjs +937 -0
  232. package/dist/snapshots/index.cjs.map +1 -0
  233. package/dist/snapshots/index.d.cts +30 -0
  234. package/dist/snapshots/index.d.ts +30 -0
  235. package/dist/snapshots/index.js +152 -0
  236. package/dist/snapshots/index.js.map +1 -0
  237. package/dist/{stale-OTOF3FH7.js → stale-CPESGAPL.js} +2 -2
  238. package/dist/stale-CPESGAPL.js.map +1 -0
  239. package/dist/state-vault-JR3CFGNP.js +14 -0
  240. package/dist/state-vault-JR3CFGNP.js.map +1 -0
  241. package/dist/store/index.cjs +8 -0
  242. package/dist/store/index.cjs.map +1 -1
  243. package/dist/store/index.d.cts +15 -6
  244. package/dist/store/index.d.ts +15 -6
  245. package/dist/store/index.js +2 -2
  246. package/dist/{strategy-DSTrsZ8t.d.ts → strategy-54eIwox5.d.ts} +456 -7
  247. package/dist/{strategy-DSTrsZ8t.d.cts → strategy-WtB-jXYv.d.cts} +456 -7
  248. package/dist/sync/index.cjs.map +1 -1
  249. package/dist/sync/index.d.cts +7 -5
  250. package/dist/sync/index.d.ts +7 -5
  251. package/dist/sync/index.js +4 -4
  252. package/dist/team/index.cjs +1 -1
  253. package/dist/team/index.cjs.map +1 -1
  254. package/dist/team/index.d.cts +8 -6
  255. package/dist/team/index.d.ts +8 -6
  256. package/dist/team/index.js +8 -8
  257. package/dist/transition-guard-D4bfIAiW.d.ts +165 -0
  258. package/dist/transition-guard-Dmpqzg-_.d.cts +165 -0
  259. package/dist/tx/index.cjs +155 -5
  260. package/dist/tx/index.cjs.map +1 -1
  261. package/dist/tx/index.d.cts +27 -9
  262. package/dist/tx/index.d.ts +27 -9
  263. package/dist/tx/index.js +61 -4
  264. package/dist/tx/index.js.map +1 -1
  265. package/dist/{types-BoFFiskX.d.ts → types-DLfWFr6U.d.ts} +3997 -1262
  266. package/dist/{types-DJG8HG6F.d.cts → types-DyOI6XZ_.d.cts} +3997 -1262
  267. package/dist/{ulid-BmBgooGm.d.ts → ulid-B2L_aqVA.d.ts} +19 -19
  268. package/dist/{ulid-C7ms9oli.d.cts → ulid-LaxfH2tK.d.cts} +19 -19
  269. package/dist/util/index.cjs +7 -0
  270. package/dist/util/index.cjs.map +1 -1
  271. package/dist/util/index.d.cts +2 -0
  272. package/dist/util/index.d.ts +2 -0
  273. package/dist/util/index.js +5 -1
  274. package/dist/util/index.js.map +1 -1
  275. package/dist/vault-group-BB246VIM.js +804 -0
  276. package/dist/vault-group-BB246VIM.js.map +1 -0
  277. package/dist/{with-materialized-view-CqnRwI2S.d.ts → with-materialized-view-CeZYGJVf.d.cts} +2 -2
  278. package/dist/{with-materialized-view-BbEPFIIJ.d.cts → with-materialized-view-DNULSxoP.d.ts} +2 -2
  279. package/dist/{with-overlayed-view-Ct1fSJt-.d.ts → with-overlayed-view-C9joG7UZ.d.ts} +2 -2
  280. package/dist/{with-overlayed-view-bwlmmFjx.d.cts → with-overlayed-view-kdcPGHih.d.cts} +2 -2
  281. package/dist/with-rollup-DJDbrxjf.d.ts +47 -0
  282. package/dist/with-rollup-s58XAeWO.d.cts +47 -0
  283. package/package.json +35 -4
  284. package/dist/chunk-2PAQNPE3.js.map +0 -1
  285. package/dist/chunk-3S4BJX25.js.map +0 -1
  286. package/dist/chunk-3XHOCQK4.js +0 -118
  287. package/dist/chunk-3XHOCQK4.js.map +0 -1
  288. package/dist/chunk-3Z2TPHC4.js.map +0 -1
  289. package/dist/chunk-5ZGZ6HIZ.js.map +0 -1
  290. package/dist/chunk-7BRE6EUA.js.map +0 -1
  291. package/dist/chunk-7Z23ZFLV.js.map +0 -1
  292. package/dist/chunk-CXSCDO5T.js +0 -51
  293. package/dist/chunk-CXSCDO5T.js.map +0 -1
  294. package/dist/chunk-E535SAN4.js.map +0 -1
  295. package/dist/chunk-EUYOGYGV.js.map +0 -1
  296. package/dist/chunk-GIV6DWBG.js.map +0 -1
  297. package/dist/chunk-HXJXPZRE.js.map +0 -1
  298. package/dist/chunk-J4KLMEUL.js.map +0 -1
  299. package/dist/chunk-JYQTXEIO.js.map +0 -1
  300. package/dist/chunk-LRAZDV5X.js.map +0 -1
  301. package/dist/chunk-MRIBLZL3.js +0 -86
  302. package/dist/chunk-MRIBLZL3.js.map +0 -1
  303. package/dist/chunk-MUWOSVEP.js.map +0 -1
  304. package/dist/chunk-OVZDFEOR.js.map +0 -1
  305. package/dist/chunk-PEULZC6M.js.map +0 -1
  306. package/dist/chunk-PFSNOPBQ.js.map +0 -1
  307. package/dist/chunk-PLI5TV7N.js.map +0 -1
  308. package/dist/chunk-Q6W2CMEJ.js.map +0 -1
  309. package/dist/chunk-RTZVQAJ7.js.map +0 -1
  310. package/dist/chunk-TBKOGSYR.js.map +0 -1
  311. package/dist/chunk-UMLVJTYV.js.map +0 -1
  312. package/dist/chunk-UND4XIB6.js.map +0 -1
  313. package/dist/chunk-VCGTOS2A.js.map +0 -1
  314. package/dist/chunk-VE6YVP32.js +0 -19
  315. package/dist/chunk-VE6YVP32.js.map +0 -1
  316. package/dist/chunk-VPSUZLOJ.js.map +0 -1
  317. package/dist/chunk-VRBCTEKQ.js.map +0 -1
  318. package/dist/chunk-W3XXT26A.js.map +0 -1
  319. package/dist/chunk-XG3PTSCD.js.map +0 -1
  320. package/dist/chunk-Y2RKOPNC.js.map +0 -1
  321. package/dist/chunk-YMYK7US4.js.map +0 -1
  322. package/dist/chunk-YS3POABP.js.map +0 -1
  323. package/dist/chunk-YTXSFG3C.js.map +0 -1
  324. package/dist/executor-AS2IDHKZ.js +0 -11
  325. package/dist/executor-HLXFXNFM.js +0 -8
  326. package/dist/executor-HN6YBHZ5.js +0 -8
  327. package/dist/fanout-sidecar-VJ52RIEY.js.map +0 -1
  328. package/dist/issue-ORP37MVW.js +0 -12
  329. package/dist/mime-magic-CBBSOkjm.d.cts +0 -50
  330. package/dist/mime-magic-CBBSOkjm.d.ts +0 -50
  331. package/dist/noydb-5H3C24GG.js +0 -34
  332. package/dist/read-only-facade-ITU6L7BL.js +0 -7
  333. package/dist/registry-7HE6VJGC.js +0 -8
  334. package/dist/registry-PSIPG2QR.js +0 -8
  335. package/dist/registry-RFGGMVNJ.js +0 -7
  336. package/dist/with-derivation-BKXXa8Vt.d.ts +0 -13
  337. package/dist/with-derivation-BjQ7q4NE.d.cts +0 -13
  338. package/dist/with-guard-C25yNjzd.d.ts +0 -18
  339. package/dist/with-guard-DQme5DKE.d.cts +0 -18
  340. /package/dist/{chunk-7Q5PLD5C.js.map → chunk-7MRT7EPB.js.map} +0 -0
  341. /package/dist/{chunk-G6FRSBKK.js.map → chunk-AI4USDRI.js.map} +0 -0
  342. /package/dist/{chunk-NWZ3I6R6.js.map → chunk-EYK72OTL.js.map} +0 -0
  343. /package/dist/{chunk-7BUTTVMR.js.map → chunk-F5GWNSE2.js.map} +0 -0
  344. /package/dist/{chunk-AHPFONIL.js.map → chunk-F5ILTHMU.js.map} +0 -0
  345. /package/dist/{chunk-QPEXPHJR.js.map → chunk-I3IYTUUI.js.map} +0 -0
  346. /package/dist/{chunk-3QAKZ37R.js.map → chunk-IVZWHIEK.js.map} +0 -0
  347. /package/dist/{chunk-243PNUA6.js.map → chunk-JOK73NDT.js.map} +0 -0
  348. /package/dist/{chunk-VK5EER6C.js.map → chunk-SQKAECUL.js.map} +0 -0
  349. /package/dist/{chunk-4HIL6AHQ.js.map → chunk-TAMRU7A2.js.map} +0 -0
  350. /package/dist/{chunk-QXQRKXCU.js.map → chunk-TGIJTNM3.js.map} +0 -0
  351. /package/dist/{chunk-3Y53S2SA.js.map → chunk-UU6M64HI.js.map} +0 -0
  352. /package/dist/{crypto-5ZDIY3NG.js.map → crypto-456N7UVX.js.map} +0 -0
  353. /package/dist/{delegation-QYXZW25W.js.map → delegation-DP4COTXB.js.map} +0 -0
  354. /package/dist/{executor-AS2IDHKZ.js.map → executor-4IEW4KG5.js.map} +0 -0
  355. /package/dist/{executor-HLXFXNFM.js.map → executor-KYJCJCIN.js.map} +0 -0
  356. /package/dist/{executor-HN6YBHZ5.js.map → executor-W7VIBOBZ.js.map} +0 -0
  357. /package/dist/{issue-ORP37MVW.js.map → forget/index.js.map} +0 -0
  358. /package/dist/{ledger-3IU5GMXA.js.map → issue-JXC6T2QR.js.map} +0 -0
  359. /package/dist/{noydb-5H3C24GG.js.map → ledger-I7JUYP4L.js.map} +0 -0
  360. /package/dist/{public-envelope-U3CMEOMV.js.map → noydb-ZZCRF6TE.js.map} +0 -0
  361. /package/dist/{read-only-facade-ITU6L7BL.js.map → public-envelope-5XRTUNKF.js.map} +0 -0
  362. /package/dist/{registry-3ALP62P6.js.map → read-only-facade-EX6WZZBP.js.map} +0 -0
  363. /package/dist/{registry-7HE6VJGC.js.map → registry-ATRHOG5B.js.map} +0 -0
  364. /package/dist/{registry-PSIPG2QR.js.map → registry-DKEXOJVO.js.map} +0 -0
  365. /package/dist/{registry-RFGGMVNJ.js.map → registry-LEHB26TY.js.map} +0 -0
  366. /package/dist/{revoke-KY2GB4KP.js.map → registry-NWHOLD5M.js.map} +0 -0
  367. /package/dist/{signer-GRI5TZKH.js.map → revoke-5IEK22KT.js.map} +0 -0
  368. /package/dist/{stale-OTOF3FH7.js.map → signer-I6YARZQA.js.map} +0 -0
@@ -1,11 +1,13 @@
1
- import { aN as HistoryStrategy, aO as NoydbStore, aP as HistoryOptions, aQ as EncryptedEnvelope, aR as PruneOptions } from '../types-DJG8HG6F.cjs';
2
- export { aS as AppendInput, aT as ChangeType, aU as CollectionInstant, aV as DiffEntry, aW as JsonPatch, aX as JsonPatchOp, aY as LedgerEntry, aZ as LedgerStore, a_ as VaultEngine, a$ as VaultInstant, b0 as VerifyResult, b1 as applyPatch, b2 as canonicalJson, b3 as computePatch, b4 as diff, b5 as formatDiff, b6 as hashEntry, b7 as paddedIndex, b8 as parseIndex, b9 as sha256Hex } from '../types-DJG8HG6F.cjs';
3
- export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-jDowCrK2.cjs';
4
- import '../lazy-builder-C-rPfWG0.cjs';
5
- import '../predicate-Dnu81tsS.cjs';
6
- import '../strategy-DSTrsZ8t.cjs';
1
+ import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-DyOI6XZ_.cjs';
2
+ export { a_ as AppendInput, a$ as ChangeType, b0 as CollectionInstant, b1 as DiffEntry, b2 as JsonPatch, b3 as JsonPatchOp, b4 as LedgerStore, b5 as VaultEngine, b6 as VaultInstant, b7 as VerifyResult, b8 as applyPatch, b9 as computePatch, ba as diff, bb as formatDiff } from '../types-DyOI6XZ_.cjs';
3
+ export { L as LedgerEntry, c as canonicalJson, h as hashEntry, p as paddedIndex, a as parseIndex, s as sha256Hex } from '../index-BMmajblo.cjs';
4
+ export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-BSd0-_L8.cjs';
5
+ import '../lazy-builder-eYZzLEL1.cjs';
6
+ import '../predicate-BmhBSPCH.cjs';
7
+ import '../strategy-WtB-jXYv.cjs';
8
+ import '../errors-Dkc_fi-S.cjs';
7
9
  import '../strategy-BSxFXGzb.cjs';
8
- import '../index-BMjrzNZr.cjs';
10
+ import '../index-tZqVB9g5.cjs';
9
11
  import '@noy-db/attestation';
10
12
 
11
13
  /**
@@ -1,11 +1,13 @@
1
- import { aN as HistoryStrategy, aO as NoydbStore, aP as HistoryOptions, aQ as EncryptedEnvelope, aR as PruneOptions } from '../types-BoFFiskX.js';
2
- export { aS as AppendInput, aT as ChangeType, aU as CollectionInstant, aV as DiffEntry, aW as JsonPatch, aX as JsonPatchOp, aY as LedgerEntry, aZ as LedgerStore, a_ as VaultEngine, a$ as VaultInstant, b0 as VerifyResult, b1 as applyPatch, b2 as canonicalJson, b3 as computePatch, b4 as diff, b5 as formatDiff, b6 as hashEntry, b7 as paddedIndex, b8 as parseIndex, b9 as sha256Hex } from '../types-BoFFiskX.js';
3
- export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-DcoYWfJ_.js';
4
- import '../lazy-builder-Rpd-V3jP.js';
5
- import '../predicate-Dnu81tsS.js';
6
- import '../strategy-DSTrsZ8t.js';
1
+ import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-DLfWFr6U.js';
2
+ export { a_ as AppendInput, a$ as ChangeType, b0 as CollectionInstant, b1 as DiffEntry, b2 as JsonPatch, b3 as JsonPatchOp, b4 as LedgerStore, b5 as VaultEngine, b6 as VaultInstant, b7 as VerifyResult, b8 as applyPatch, b9 as computePatch, ba as diff, bb as formatDiff } from '../types-DLfWFr6U.js';
3
+ export { L as LedgerEntry, c as canonicalJson, h as hashEntry, p as paddedIndex, a as parseIndex, s as sha256Hex } from '../index-BMmajblo.js';
4
+ export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-BnBQx39y.js';
5
+ import '../lazy-builder-ChSqcF5t.js';
6
+ import '../predicate-BmhBSPCH.js';
7
+ import '../strategy-54eIwox5.js';
8
+ import '../errors-Dkc_fi-S.js';
7
9
  import '../strategy-BSxFXGzb.js';
8
- import '../index-BCKdioeh.js';
10
+ import '../index-Bm9hIY7t.js';
9
11
  import '@noy-db/attestation';
10
12
 
11
13
  /**
@@ -7,15 +7,16 @@ import {
7
7
  getHistory,
8
8
  getVersionEnvelope,
9
9
  pruneHistory,
10
- saveHistory
11
- } from "../chunk-VPSUZLOJ.js";
10
+ saveHistory,
11
+ tombstoneHistory
12
+ } from "../chunk-TYMDCIQM.js";
12
13
  import {
13
14
  LEDGER_COLLECTION,
14
15
  LEDGER_DELTAS_COLLECTION,
15
16
  LedgerStore,
16
17
  applyPatch,
17
18
  computePatch
18
- } from "../chunk-7Z23ZFLV.js";
19
+ } from "../chunk-JDCPRJVS.js";
19
20
  import {
20
21
  canonicalJson,
21
22
  envelopePayloadHash,
@@ -23,10 +24,10 @@ import {
23
24
  paddedIndex,
24
25
  parseIndex,
25
26
  sha256Hex
26
- } from "../chunk-XG3PTSCD.js";
27
- import "../chunk-YS3POABP.js";
28
- import "../chunk-2PAQNPE3.js";
29
- import "../chunk-W3XXT26A.js";
27
+ } from "../chunk-PDVP3C2I.js";
28
+ import "../chunk-TA6HPKWQ.js";
29
+ import "../chunk-37VGJM3T.js";
30
+ import "../chunk-OTWT6BAJ.js";
30
31
 
31
32
  // src/history/active.ts
32
33
  function withHistory() {
@@ -36,6 +37,7 @@ function withHistory() {
36
37
  getVersionEnvelope,
37
38
  pruneHistory,
38
39
  clearHistory,
40
+ tombstoneHistory,
39
41
  envelopePayloadHash,
40
42
  computePatch,
41
43
  diff,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/history/active.ts"],"sourcesContent":["/**\n * Active history strategy — `withHistory()` returns the real\n * implementation that wires per-record snapshots, the hash-chained\n * audit ledger, JSON-patch deltas, and time-machine reads into the\n * core write/read paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withHistory } from '@noy-db/hub/history'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * historyStrategy: withHistory(),\n * })\n * ```\n *\n * The factory is a thin wrapper that delegates to the existing\n * `history.ts`, `diff.ts`, `ledger/store.ts`, `ledger/patch.ts`, and\n * `time-machine.ts` modules. Splitting the import chain through this\n * file is what lets `tsup` tree-shake the heavy modules out of the\n * default `@noy-db/hub` bundle when no `withHistory()` import is\n * present in the consumer.\n *\n * @public\n */\n\nimport type { HistoryStrategy, BuildLedgerOptions } from './strategy.js'\nimport {\n saveHistory,\n getHistory,\n getVersionEnvelope,\n pruneHistory,\n clearHistory,\n} from './history.js'\nimport { diff as computeDiff } from './diff.js'\nimport { LedgerStore, envelopePayloadHash } from './ledger/store.js'\nimport { computePatch } from './ledger/patch.js'\nimport { VaultInstant } from './time-machine.js'\n\n/**\n * Build the active history strategy. Today the factory takes no\n * options; per-collection retention tuning still flows through\n * `HistoryConfig` on `Vault.collection()` / `vault.openVault()`.\n *\n * Future option slots (kept off the LTS surface for now):\n * - global maxVersions cap\n * - global beforeDate prune cadence\n * - ledger encryption toggle (today inferred from vault.encrypted)\n */\nexport function withHistory(): HistoryStrategy {\n return {\n saveHistory,\n getHistoryEntries: getHistory,\n getVersionEnvelope,\n pruneHistory,\n clearHistory,\n envelopePayloadHash,\n computePatch,\n diff: computeDiff,\n buildLedger(opts: BuildLedgerOptions): LedgerStore {\n return new LedgerStore({\n adapter: opts.adapter,\n vault: opts.vault,\n encrypted: opts.encrypted,\n getDEK: opts.getDEK,\n actor: opts.actor,\n })\n },\n buildVaultInstant(engine, timestamp): VaultInstant {\n return new VaultInstant(engine, timestamp)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDO,SAAS,cAA+B;AAC7C,SAAO;AAAA,IACL;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,MAAuC;AACjD,aAAO,IAAI,YAAY;AAAA,QACrB,SAAS,KAAK;AAAA,QACd,OAAO,KAAK;AAAA,QACZ,WAAW,KAAK;AAAA,QAChB,QAAQ,KAAK;AAAA,QACb,OAAO,KAAK;AAAA,MACd,CAAC;AAAA,IACH;AAAA,IACA,kBAAkB,QAAQ,WAAyB;AACjD,aAAO,IAAI,aAAa,QAAQ,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/history/active.ts"],"sourcesContent":["/**\n * Active history strategy — `withHistory()` returns the real\n * implementation that wires per-record snapshots, the hash-chained\n * audit ledger, JSON-patch deltas, and time-machine reads into the\n * core write/read paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withHistory } from '@noy-db/hub/history'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * historyStrategy: withHistory(),\n * })\n * ```\n *\n * The factory is a thin wrapper that delegates to the existing\n * `history.ts`, `diff.ts`, `ledger/store.ts`, `ledger/patch.ts`, and\n * `time-machine.ts` modules. Splitting the import chain through this\n * file is what lets `tsup` tree-shake the heavy modules out of the\n * default `@noy-db/hub` bundle when no `withHistory()` import is\n * present in the consumer.\n *\n * @public\n */\n\nimport type { HistoryStrategy, BuildLedgerOptions } from './strategy.js'\nimport {\n saveHistory,\n getHistory,\n getVersionEnvelope,\n pruneHistory,\n clearHistory,\n tombstoneHistory,\n} from './history.js'\nimport { diff as computeDiff } from './diff.js'\nimport { LedgerStore, envelopePayloadHash } from './ledger/store.js'\nimport { computePatch } from './ledger/patch.js'\nimport { VaultInstant } from './time-machine.js'\n\n/**\n * Build the active history strategy. Today the factory takes no\n * options; per-collection retention tuning still flows through\n * `HistoryConfig` on `Vault.collection()` / `vault.openVault()`.\n *\n * Future option slots (kept off the LTS surface for now):\n * - global maxVersions cap\n * - global beforeDate prune cadence\n * - ledger encryption toggle (today inferred from vault.encrypted)\n */\nexport function withHistory(): HistoryStrategy {\n return {\n saveHistory,\n getHistoryEntries: getHistory,\n getVersionEnvelope,\n pruneHistory,\n clearHistory,\n tombstoneHistory,\n envelopePayloadHash,\n computePatch,\n diff: computeDiff,\n buildLedger(opts: BuildLedgerOptions): LedgerStore {\n return new LedgerStore({\n adapter: opts.adapter,\n vault: opts.vault,\n encrypted: opts.encrypted,\n getDEK: opts.getDEK,\n actor: opts.actor,\n })\n },\n buildVaultInstant(engine, timestamp): VaultInstant {\n return new VaultInstant(engine, timestamp)\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDO,SAAS,cAA+B;AAC7C,SAAO;AAAA,IACL;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,MAAuC;AACjD,aAAO,IAAI,YAAY;AAAA,QACrB,SAAS,KAAK;AAAA,QACd,OAAO,KAAK;AAAA,QACZ,WAAW,KAAK;AAAA,QAChB,QAAQ,KAAK;AAAA,QACb,OAAO,KAAK;AAAA,MACd,CAAC;AAAA,IACH;AAAA,IACA,kBAAkB,QAAQ,WAAyB;AACjD,aAAO,IAAI,aAAa,QAAQ,SAAS;AAAA,IAC3C;AAAA,EACF;AACF;","names":[]}
@@ -27,15 +27,25 @@ __export(i18n_exports, {
27
27
  LocaleNotSpecifiedError: () => LocaleNotSpecifiedError,
28
28
  MissingTranslationError: () => MissingTranslationError,
29
29
  ReservedCollectionNameError: () => ReservedCollectionNameError,
30
+ ScriptViolationError: () => ScriptViolationError,
31
+ StaticDictReadonlyError: () => StaticDictReadonlyError,
30
32
  TranslatorNotConfiguredError: () => TranslatorNotConfiguredError,
33
+ UnknownDictCodeError: () => UnknownDictCodeError,
31
34
  applyI18nLocale: () => applyI18nLocale,
32
35
  dictCollectionName: () => dictCollectionName,
33
36
  dictKey: () => dictKey,
37
+ enforceScript: () => enforceScript,
38
+ getAtPath: () => getAtPath,
34
39
  i18nText: () => i18nText,
40
+ inferScripts: () => inferScripts,
35
41
  isDictCollectionName: () => isDictCollectionName,
36
42
  isDictKeyDescriptor: () => isDictKeyDescriptor,
37
43
  isI18nTextDescriptor: () => isI18nTextDescriptor,
44
+ isStaticDictDescriptor: () => isStaticDictDescriptor,
38
45
  resolveI18nText: () => resolveI18nText,
46
+ resolvePolicy: () => resolvePolicy,
47
+ setAtPathInPlace: () => setAtPathInPlace,
48
+ staticDict: () => staticDict,
39
49
  validateI18nTextValue: () => validateI18nTextValue,
40
50
  withI18n: () => withI18n
41
51
  });
@@ -150,6 +160,57 @@ var LocaleNotSpecifiedError = class extends NoydbError {
150
160
  this.field = field;
151
161
  }
152
162
  };
163
+ var ScriptViolationError = class extends NoydbError {
164
+ /** The field whose value violated its script constraint. */
165
+ field;
166
+ /** The locale slot (e.g. `'en'`) that was checked. */
167
+ locale;
168
+ /** The Unicode scripts allowed for this slot. */
169
+ expected;
170
+ /** A short sample of the offending characters, for diagnostics. */
171
+ sample;
172
+ constructor(field, locale, expected, sample, message) {
173
+ super(
174
+ "SCRIPT_VIOLATION",
175
+ message ?? `Field "${field}" slot "${locale}" expects script(s) [${expected.join(", ")}] but contains disallowed character(s): "${sample}".`
176
+ );
177
+ this.name = "ScriptViolationError";
178
+ this.field = field;
179
+ this.locale = locale;
180
+ this.expected = expected;
181
+ this.sample = sample;
182
+ }
183
+ };
184
+ var StaticDictReadonlyError = class extends NoydbError {
185
+ /** The static dictionary name that was the target of the mutation. */
186
+ dictionaryName;
187
+ constructor(dictionaryName) {
188
+ super(
189
+ "STATIC_DICT_READONLY",
190
+ `Dictionary "${dictionaryName}" is a staticDict \u2014 its labels are code constants with no mutation surface. put/putAll/rename/delete are not supported; change the label in the staticDict() table and redeploy.`
191
+ );
192
+ this.name = "StaticDictReadonlyError";
193
+ this.dictionaryName = dictionaryName;
194
+ }
195
+ };
196
+ var UnknownDictCodeError = class extends NoydbError {
197
+ /** The static dictionary name. */
198
+ dictionaryName;
199
+ /** The field that carried the unknown code. */
200
+ field;
201
+ /** The offending code value. */
202
+ code;
203
+ constructor(dictionaryName, field, code) {
204
+ super(
205
+ "UNKNOWN_DICT_CODE",
206
+ `Field "${field}": code "${code}" is not a known key of staticDict "${dictionaryName}". Use a declared code, or pass { validateCodes: false } on the descriptor to allow open codes.`
207
+ );
208
+ this.name = "UnknownDictCodeError";
209
+ this.dictionaryName = dictionaryName;
210
+ this.field = field;
211
+ this.code = code;
212
+ }
213
+ };
153
214
  var TranslatorNotConfiguredError = class extends NoydbError {
154
215
  /** The field that requested auto-translation. */
155
216
  field;
@@ -166,6 +227,144 @@ var TranslatorNotConfiguredError = class extends NoydbError {
166
227
  }
167
228
  };
168
229
 
230
+ // src/i18n/policy.ts
231
+ function resolvePolicy(onMissing, layer) {
232
+ const explicit = onMissing && typeof onMissing === "object" ? onMissing[layer] : void 0;
233
+ const scalar = typeof onMissing === "string" ? onMissing : void 0;
234
+ const layerDefault = layer === "guard" ? "substitute" : void 0;
235
+ return explicit ?? layerDefault ?? scalar ?? "throw";
236
+ }
237
+
238
+ // src/i18n/script.ts
239
+ var LATIN_BASE = /* @__PURE__ */ new Set([
240
+ "en",
241
+ "fr",
242
+ "de",
243
+ "es",
244
+ "it",
245
+ "pt",
246
+ "nl",
247
+ "sv",
248
+ "no",
249
+ "da",
250
+ "fi",
251
+ "is",
252
+ "pl",
253
+ "cs",
254
+ "sk",
255
+ "hu",
256
+ "ro",
257
+ "hr",
258
+ "sl",
259
+ "et",
260
+ "lv",
261
+ "lt",
262
+ "tr",
263
+ "vi",
264
+ "id",
265
+ "ms",
266
+ "tl",
267
+ "sw",
268
+ "af",
269
+ "ca",
270
+ "gl",
271
+ "eu",
272
+ "cy",
273
+ "ga"
274
+ ]);
275
+ var SCRIPT_TABLE = {
276
+ th: ["Thai"],
277
+ ko: ["Hangul", "Han"],
278
+ ja: ["Han", "Hiragana", "Katakana"],
279
+ zh: ["Han"],
280
+ ar: ["Arabic"],
281
+ fa: ["Arabic"],
282
+ ur: ["Arabic"],
283
+ ru: ["Cyrillic"],
284
+ uk: ["Cyrillic"],
285
+ bg: ["Cyrillic"],
286
+ sr: ["Cyrillic"],
287
+ he: ["Hebrew"],
288
+ el: ["Greek"],
289
+ hi: ["Devanagari"],
290
+ ta: ["Tamil"],
291
+ km: ["Khmer"],
292
+ lo: ["Lao"],
293
+ my: ["Myanmar"]
294
+ };
295
+ var SUBTAG_SCRIPTS = {
296
+ Latn: ["Latin"],
297
+ Cyrl: ["Cyrillic", "Latin"],
298
+ Hans: ["Han", "Latin"],
299
+ Hant: ["Han", "Latin"],
300
+ Thai: ["Thai", "Latin"],
301
+ Arab: ["Arabic", "Latin"]
302
+ };
303
+ function inferScripts(locale) {
304
+ const parts = locale.split("-");
305
+ const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
306
+ if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
307
+ const base = (parts[0] ?? "").toLowerCase();
308
+ if (LATIN_BASE.has(base)) return ["Latin"];
309
+ const primary = SCRIPT_TABLE[base];
310
+ if (primary) return [...primary, "Latin"];
311
+ return ["Latin"];
312
+ }
313
+ function allowedFor(descriptor, locale) {
314
+ const script = descriptor.options.script;
315
+ if (script && script !== "auto") {
316
+ const explicit = script[locale];
317
+ if (explicit) return explicit;
318
+ }
319
+ return inferScripts(locale);
320
+ }
321
+ var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
322
+ function fullMatcher(scripts) {
323
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
324
+ return new RegExp(`^[${BASELINE}${cls}]*$`, "u");
325
+ }
326
+ function charMatcher(scripts) {
327
+ const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
328
+ return new RegExp(`[${BASELINE}${cls}]`, "u");
329
+ }
330
+ function offendingSample(str, scripts) {
331
+ const ok = charMatcher(scripts);
332
+ const bad = [];
333
+ for (const ch of str) {
334
+ if (!ok.test(ch)) bad.push(ch);
335
+ if (bad.length >= 8) break;
336
+ }
337
+ return bad.join("");
338
+ }
339
+ function stripDisallowed(str, scripts) {
340
+ const ok = charMatcher(scripts);
341
+ let out = "";
342
+ for (const ch of str) if (ok.test(ch)) out += ch;
343
+ return out;
344
+ }
345
+ function enforceScript(value, field, descriptor) {
346
+ const opt = descriptor.options;
347
+ if (!opt.script) return { value, warnings: [] };
348
+ const mode = opt.onScriptViolation ?? "reject";
349
+ const warnings = [];
350
+ let out = value;
351
+ for (const [locale, raw] of Object.entries(value)) {
352
+ if (typeof raw !== "string") continue;
353
+ const allowed = allowedFor(descriptor, locale);
354
+ if (fullMatcher(allowed).test(raw)) continue;
355
+ const sample = offendingSample(raw, allowed);
356
+ if (mode === "reject") {
357
+ throw new ScriptViolationError(field, locale, allowed, sample);
358
+ }
359
+ warnings.push({ field, locale, expected: allowed, sample });
360
+ if (mode === "filter") {
361
+ if (out === value) out = { ...value };
362
+ out[locale] = stripDisallowed(raw, allowed);
363
+ }
364
+ }
365
+ return { value: out, warnings };
366
+ }
367
+
169
368
  // src/i18n/core.ts
170
369
  function i18nText(options) {
171
370
  return { _noydbI18nText: true, options };
@@ -229,7 +428,21 @@ function validateI18nTextValue(value, field, descriptor) {
229
428
  }
230
429
  }
231
430
  }
232
- function resolveI18nText(value, locale, fallback, field) {
431
+ function toChain(fallback) {
432
+ return Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
433
+ }
434
+ function pickFromChain(value, chain) {
435
+ for (const fb of chain) {
436
+ if (fb === "any") {
437
+ const any = Object.values(value).find((v) => v !== "");
438
+ if (any !== void 0) return any;
439
+ } else if (value[fb] !== void 0 && value[fb] !== "") {
440
+ return value[fb];
441
+ }
442
+ }
443
+ return void 0;
444
+ }
445
+ function resolveI18nText(value, locale, fallback, field, opts) {
233
446
  if (locale === "raw") {
234
447
  return value;
235
448
  }
@@ -239,34 +452,119 @@ function resolveI18nText(value, locale, fallback, field) {
239
452
  if (value[locale] !== void 0 && value[locale] !== "") {
240
453
  return value[locale];
241
454
  }
242
- const chain = Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
243
- for (const fb of chain) {
244
- if (fb === "any") {
245
- const any = Object.values(value).find((v) => v !== "");
246
- if (any !== void 0) return any;
247
- } else if (value[fb] !== void 0 && value[fb] !== "") {
248
- return value[fb];
455
+ const policy = opts?.policy ?? "throw";
456
+ const callerChain = toChain(fallback);
457
+ const callerHit = pickFromChain(value, callerChain);
458
+ if (callerHit !== void 0) return callerHit;
459
+ if (policy === "substitute") {
460
+ const subHit = pickFromChain(value, toChain(opts?.substitute));
461
+ if (subHit !== void 0) return subHit;
462
+ if (opts?.smartSubstitute) {
463
+ const smartHit = pickNearestScript(value, locale);
464
+ if (smartHit !== void 0) return smartHit;
249
465
  }
250
466
  }
251
- throw new LocaleNotSpecifiedError(
252
- field ?? "<unknown>",
253
- `No translation available for locale "${locale}"` + (chain.length > 0 ? ` or fallback chain [${chain.join(", ")}]` : "") + "."
254
- );
467
+ if (policy === "throw") {
468
+ throw new LocaleNotSpecifiedError(
469
+ field ?? "<unknown>",
470
+ `No translation available for locale "${locale}"` + (callerChain.length > 0 ? ` or fallback chain [${callerChain.join(", ")}]` : "") + "."
471
+ );
472
+ }
473
+ return null;
255
474
  }
256
- function applyI18nLocale(record, i18nFields, locale, fallback) {
475
+ function pickNearestScript(value, target) {
476
+ const targetScript = inferScripts(target)[0] ?? "Latin";
477
+ let best;
478
+ for (const [loc, v] of Object.entries(value)) {
479
+ if (typeof v !== "string" || v === "") continue;
480
+ const s = inferScripts(loc)[0] ?? "Latin";
481
+ const score = s === targetScript ? 0 : s === "Latin" ? 1 : 2;
482
+ if (best === void 0 || score < best.score) best = { score, v };
483
+ if (score === 0) break;
484
+ }
485
+ return best?.v;
486
+ }
487
+ function getAtPath(obj, path) {
488
+ const arrayIdx = path.indexOf("[].");
489
+ if (arrayIdx !== -1) {
490
+ const arrayKey = path.slice(0, arrayIdx);
491
+ const restPath = path.slice(arrayIdx + 3);
492
+ const arr = obj[arrayKey];
493
+ if (!Array.isArray(arr)) return [];
494
+ return arr.flatMap((item) => {
495
+ if (!item || typeof item !== "object" || Array.isArray(item)) return [];
496
+ return getAtPath(item, restPath);
497
+ });
498
+ }
499
+ const dotIdx = path.indexOf(".");
500
+ if (dotIdx !== -1) {
501
+ const head = path.slice(0, dotIdx);
502
+ const rest = path.slice(dotIdx + 1);
503
+ const nested = obj[head];
504
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return [];
505
+ return getAtPath(nested, rest);
506
+ }
507
+ const val = obj[path];
508
+ return val !== void 0 ? [val] : [];
509
+ }
510
+ function setAtPathInPlace(obj, path, value) {
511
+ const dotIdx = path.indexOf(".");
512
+ if (dotIdx !== -1) {
513
+ const head = path.slice(0, dotIdx);
514
+ const rest = path.slice(dotIdx + 1);
515
+ const nested = obj[head];
516
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return;
517
+ setAtPathInPlace(nested, rest, value);
518
+ return;
519
+ }
520
+ obj[path] = value;
521
+ }
522
+ function applyAtPath(obj, path, locale, fallback, opts) {
523
+ const arrayIdx = path.indexOf("[].");
524
+ if (arrayIdx !== -1) {
525
+ const arrayKey = path.slice(0, arrayIdx);
526
+ const restPath = path.slice(arrayIdx + 3);
527
+ const arr = obj[arrayKey];
528
+ if (!Array.isArray(arr)) return obj;
529
+ return {
530
+ ...obj,
531
+ [arrayKey]: arr.map((item) => {
532
+ if (!item || typeof item !== "object" || Array.isArray(item)) return item;
533
+ return applyAtPath(item, restPath, locale, fallback, opts);
534
+ })
535
+ };
536
+ }
537
+ const dotIdx = path.indexOf(".");
538
+ if (dotIdx !== -1) {
539
+ const head = path.slice(0, dotIdx);
540
+ const rest = path.slice(dotIdx + 1);
541
+ const nested = obj[head];
542
+ if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
543
+ return {
544
+ ...obj,
545
+ [head]: applyAtPath(nested, rest, locale, fallback, opts)
546
+ };
547
+ }
548
+ const raw = obj[path];
549
+ if (raw === void 0 || raw === null) return obj;
550
+ if (typeof raw !== "object" || Array.isArray(raw)) return obj;
551
+ return {
552
+ ...obj,
553
+ [path]: resolveI18nText(raw, locale, fallback, path, opts)
554
+ };
555
+ }
556
+ function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
257
557
  const fieldNames = Object.keys(i18nFields);
258
558
  if (fieldNames.length === 0) return record;
259
- const result = { ...record };
260
- for (const field of fieldNames) {
261
- const raw = result[field];
262
- if (raw === void 0 || raw === null) continue;
263
- if (typeof raw !== "object" || Array.isArray(raw)) continue;
264
- result[field] = resolveI18nText(
265
- raw,
266
- locale,
267
- fallback,
268
- field
269
- );
559
+ let result = record;
560
+ for (const [field, descriptor] of Object.entries(i18nFields)) {
561
+ const { onMissing, substitute, smartSubstitute } = descriptor.options;
562
+ const opts = {
563
+ policy: resolvePolicy(onMissing, layer),
564
+ ...substitute !== void 0 ? { substitute } : {},
565
+ ...smartSubstitute ? { smartSubstitute } : {}
566
+ };
567
+ result = applyAtPath(result, field, locale, fallback, opts);
270
568
  }
271
569
  return result;
272
570
  }
@@ -452,12 +750,33 @@ function dictCollectionName(dictionaryName) {
452
750
  function isDictCollectionName(name) {
453
751
  return name.startsWith(DICT_COLLECTION_PREFIX);
454
752
  }
455
- function dictKey(name, keys) {
456
- return { _noydbDictKey: true, name, keys };
753
+ function dictKey(name, keys, opts) {
754
+ return {
755
+ _noydbDictKey: true,
756
+ name,
757
+ keys,
758
+ ...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
759
+ ...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {}
760
+ };
457
761
  }
458
762
  function isDictKeyDescriptor(x) {
459
763
  return typeof x === "object" && x !== null && x._noydbDictKey === true;
460
764
  }
765
+ function staticDict(name, table, opts) {
766
+ return {
767
+ _noydbStaticDict: true,
768
+ name,
769
+ table,
770
+ keys: Object.keys(table),
771
+ ...opts?.displayLocale !== void 0 ? { displayLocale: opts.displayLocale } : {},
772
+ ...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
773
+ ...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {},
774
+ ...opts?.validateCodes !== void 0 ? { validateCodes: opts.validateCodes } : {}
775
+ };
776
+ }
777
+ function isStaticDictDescriptor(x) {
778
+ return typeof x === "object" && x !== null && x._noydbStaticDict === true;
779
+ }
461
780
  var DictionaryHandle = class {
462
781
  constructor(adapter, compartmentName, dictionaryName, keyring, getDEK, encrypted, ledger, options, findAndUpdateReferences, emitter) {
463
782
  this.adapter = adapter;
@@ -800,6 +1119,7 @@ function withI18n() {
800
1119
  return {
801
1120
  applyI18nLocale,
802
1121
  validateI18nTextValue,
1122
+ enforceScript,
803
1123
  buildDictionaryHandle(opts) {
804
1124
  return new DictionaryHandle(
805
1125
  opts.adapter,
@@ -825,15 +1145,25 @@ function withI18n() {
825
1145
  LocaleNotSpecifiedError,
826
1146
  MissingTranslationError,
827
1147
  ReservedCollectionNameError,
1148
+ ScriptViolationError,
1149
+ StaticDictReadonlyError,
828
1150
  TranslatorNotConfiguredError,
1151
+ UnknownDictCodeError,
829
1152
  applyI18nLocale,
830
1153
  dictCollectionName,
831
1154
  dictKey,
1155
+ enforceScript,
1156
+ getAtPath,
832
1157
  i18nText,
1158
+ inferScripts,
833
1159
  isDictCollectionName,
834
1160
  isDictKeyDescriptor,
835
1161
  isI18nTextDescriptor,
1162
+ isStaticDictDescriptor,
836
1163
  resolveI18nText,
1164
+ resolvePolicy,
1165
+ setAtPathInPlace,
1166
+ staticDict,
837
1167
  validateI18nTextValue,
838
1168
  withI18n
839
1169
  });