@noy-db/hub 0.1.0-pre.9 → 0.2.0-pre.10
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 +100 -36
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +2 -2
- package/dist/aggregate/index.d.ts +2 -2
- package/dist/aggregate/index.js +16 -9
- package/dist/aggregate/index.js.map +1 -1
- package/dist/attestation/index.cjs +305 -0
- package/dist/attestation/index.cjs.map +1 -0
- package/dist/attestation/index.d.cts +52 -0
- package/dist/attestation/index.d.ts +52 -0
- package/dist/attestation/index.js +36 -0
- package/dist/attestation/index.js.map +1 -0
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +7 -6
- package/dist/blobs/index.d.ts +7 -6
- package/dist/blobs/index.js +10 -8
- package/dist/blobs/index.js.map +1 -1
- package/dist/bundle/index.cjs +19121 -60
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +175 -6
- package/dist/bundle/index.d.ts +175 -6
- package/dist/bundle/index.js +543 -4
- package/dist/bundle/index.js.map +1 -1
- package/dist/chunk-26NK23DZ.js +296 -0
- package/dist/chunk-26NK23DZ.js.map +1 -0
- package/dist/{chunk-TDR6T5CJ.js → chunk-2LPPNWF6.js} +91 -132
- package/dist/chunk-2LPPNWF6.js.map +1 -0
- package/dist/{chunk-PTVMYYON.js → chunk-2N62W5YP.js} +3 -3
- package/dist/{chunk-QGZRWRSL.js → chunk-3LPV6BXR.js} +4 -4
- package/dist/{chunk-QAVUREFT.js → chunk-4CLICFEY.js} +12 -6
- package/dist/chunk-4CLICFEY.js.map +1 -0
- package/dist/chunk-4USCAEDT.js +10529 -0
- package/dist/chunk-4USCAEDT.js.map +1 -0
- package/dist/chunk-5IXJGFF2.js +83 -0
- package/dist/chunk-5IXJGFF2.js.map +1 -0
- package/dist/chunk-5OEJ6GOT.js +124 -0
- package/dist/chunk-5OEJ6GOT.js.map +1 -0
- package/dist/{chunk-4PWAI7Q4.js → chunk-5OX6XVNS.js} +5 -5
- package/dist/{chunk-2CSJGFCB.js → chunk-6EOXTJS2.js} +6 -229
- package/dist/chunk-6EOXTJS2.js.map +1 -0
- package/dist/chunk-6T2UDBKG.js +53 -0
- package/dist/chunk-6T2UDBKG.js.map +1 -0
- package/dist/{chunk-GOUT6DND.js → chunk-6YLPHBKR.js} +382 -95
- package/dist/chunk-6YLPHBKR.js.map +1 -0
- package/dist/chunk-7CEGU63S.js +179 -0
- package/dist/chunk-7CEGU63S.js.map +1 -0
- package/dist/chunk-A3JMGXPG.js +125 -0
- package/dist/chunk-A3JMGXPG.js.map +1 -0
- package/dist/chunk-BB27JMWB.js +795 -0
- package/dist/chunk-BB27JMWB.js.map +1 -0
- package/dist/{chunk-SCZXXXU4.js → chunk-BDV7INMP.js} +7 -32
- package/dist/chunk-BDV7INMP.js.map +1 -0
- package/dist/chunk-C3WE6UJY.js +19 -0
- package/dist/chunk-C3WE6UJY.js.map +1 -0
- package/dist/chunk-CH22FZHT.js +96 -0
- package/dist/chunk-CH22FZHT.js.map +1 -0
- package/dist/chunk-CXFOITNS.js +34 -0
- package/dist/chunk-CXFOITNS.js.map +1 -0
- package/dist/chunk-CXJG63MA.js +109 -0
- package/dist/chunk-CXJG63MA.js.map +1 -0
- package/dist/chunk-DAP2XL7Q.js +51 -0
- package/dist/chunk-DAP2XL7Q.js.map +1 -0
- package/dist/{chunk-AVVPZ4BC.js → chunk-DJRWA3Q5.js} +4 -4
- package/dist/chunk-DRXIZOFV.js +233 -0
- package/dist/chunk-DRXIZOFV.js.map +1 -0
- package/dist/chunk-FO3UEG4S.js +313 -0
- package/dist/chunk-FO3UEG4S.js.map +1 -0
- package/dist/chunk-GAUEWM7D.js +147 -0
- package/dist/chunk-GAUEWM7D.js.map +1 -0
- package/dist/{chunk-MDDTIZUO.js → chunk-GNHAC43Q.js} +218 -119
- package/dist/chunk-GNHAC43Q.js.map +1 -0
- package/dist/chunk-HHOO7HGH.js +57 -0
- package/dist/chunk-HHOO7HGH.js.map +1 -0
- package/dist/{chunk-WDM5XGGS.js → chunk-HQSQC2XL.js} +182 -12
- package/dist/chunk-HQSQC2XL.js.map +1 -0
- package/dist/chunk-IMYKDWB4.js +139 -0
- package/dist/chunk-IMYKDWB4.js.map +1 -0
- package/dist/{chunk-M62XNWRA.js → chunk-LSTBFLL2.js} +2 -2
- package/dist/{chunk-ACLDOTNQ.js → chunk-O6EJ6WTI.js} +436 -3
- package/dist/chunk-O6EJ6WTI.js.map +1 -0
- package/dist/chunk-PC6ZEDRL.js +71 -0
- package/dist/chunk-PC6ZEDRL.js.map +1 -0
- package/dist/chunk-PM3QYWUU.js +251 -0
- package/dist/chunk-PM3QYWUU.js.map +1 -0
- package/dist/chunk-PVUUIWHY.js +73 -0
- package/dist/chunk-PVUUIWHY.js.map +1 -0
- package/dist/chunk-PXTQPZO4.js +830 -0
- package/dist/chunk-PXTQPZO4.js.map +1 -0
- package/dist/{chunk-ZFKD4QMV.js → chunk-QSOYKKMD.js} +4 -4
- package/dist/chunk-QSOYKKMD.js.map +1 -0
- package/dist/{chunk-MR4424N3.js → chunk-R233SLY3.js} +2 -2
- package/dist/chunk-RC6SU5NO.js +36 -0
- package/dist/chunk-RC6SU5NO.js.map +1 -0
- package/dist/{chunk-USKYUS74.js → chunk-RRNA5GKT.js} +2 -2
- package/dist/{chunk-R36SIKES.js → chunk-RYIL3PI2.js} +2 -2
- package/dist/chunk-STNPB3UM.js +9 -0
- package/dist/chunk-STNPB3UM.js.map +1 -0
- package/dist/{chunk-M5INGEFC.js → chunk-TV3YZ35S.js} +7 -1
- package/dist/chunk-TV3YZ35S.js.map +1 -0
- package/dist/chunk-TY32C732.js +59 -0
- package/dist/chunk-TY32C732.js.map +1 -0
- package/dist/chunk-UMLVJTYV.js +20 -0
- package/dist/chunk-UMLVJTYV.js.map +1 -0
- package/dist/{chunk-NPC4LFV5.js → chunk-WIBHRONM.js} +2 -2
- package/dist/chunk-WIBHRONM.js.map +1 -0
- package/dist/{chunk-RKJ6OL7K.js → chunk-WIRRPTFH.js} +1 -1
- package/dist/chunk-WIRRPTFH.js.map +1 -0
- package/dist/{chunk-VQBTTTUN.js → chunk-Y26YV5R3.js} +4 -4
- package/dist/{chunk-VQBTTTUN.js.map → chunk-Y26YV5R3.js.map} +1 -1
- package/dist/{chunk-NXFEYLVG.js → chunk-YM7LFCG7.js} +5 -4
- package/dist/{chunk-NXFEYLVG.js.map → chunk-YM7LFCG7.js.map} +1 -1
- package/dist/{chunk-CIMZBAZB.js → chunk-Z6FNBOTC.js} +1 -1
- package/dist/chunk-Z6FNBOTC.js.map +1 -0
- package/dist/chunk-ZROPXHJY.js +82 -0
- package/dist/chunk-ZROPXHJY.js.map +1 -0
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +7 -6
- package/dist/consent/index.d.ts +7 -6
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-IVKU7YTT.js → crypto-2CRLG4F4.js} +3 -3
- package/dist/{delegation-2DBS2EOH.js → delegation-ZTRT2PRV.js} +5 -4
- package/dist/derivations/index.cjs +368 -0
- package/dist/derivations/index.cjs.map +1 -0
- package/dist/derivations/index.d.cts +72 -0
- package/dist/derivations/index.d.ts +72 -0
- package/dist/derivations/index.js +27 -0
- package/dist/{dev-unlock-Da1B0TIK.d.cts → dev-unlock-AglVnkPY.d.cts} +1 -1
- package/dist/{dev-unlock-BdPp68qn.d.ts → dev-unlock-BOEYl1xl.d.ts} +1 -1
- package/dist/discriminant-BN9REW3o.d.cts +60 -0
- package/dist/discriminant-BN9REW3o.d.ts +60 -0
- package/dist/executor-S76VN45G.js +8 -0
- package/dist/executor-UCXLIGLW.js +11 -0
- package/dist/executor-UCXLIGLW.js.map +1 -0
- package/dist/executor-ZCNZJMGR.js +8 -0
- package/dist/executor-ZCNZJMGR.js.map +1 -0
- package/dist/fanout-sidecar-OKPMMPLG.js +51 -0
- package/dist/fanout-sidecar-OKPMMPLG.js.map +1 -0
- package/dist/guards/index.cjs +322 -0
- package/dist/guards/index.cjs.map +1 -0
- package/dist/guards/index.d.cts +31 -0
- package/dist/guards/index.d.ts +31 -0
- package/dist/guards/index.js +29 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/{hash-lsoL3eEW.d.ts → hash-B9m3_fhj.d.ts} +1 -1
- package/dist/{hash-BEfzPKwo.d.cts → hash-RVqz2zi8.d.cts} +1 -1
- package/dist/history/index.cjs +9 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +8 -7
- package/dist/history/index.d.ts +8 -7
- package/dist/history/index.js +6 -6
- package/dist/i18n/index.cjs +368 -27
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +7 -6
- package/dist/i18n/index.d.ts +7 -6
- package/dist/i18n/index.js +34 -6
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-DJTf9yxn.d.ts → index-B8bjExET.d.cts} +508 -14
- package/dist/{index-6xNpPsxR.d.cts → index-DfUbNad8.d.ts} +508 -14
- package/dist/index.cjs +8779 -1260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -19
- package/dist/index.d.ts +231 -19
- package/dist/index.js +311 -7370
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs +7 -1
- 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-3W6IVLKH.js +12 -0
- package/dist/issue-3W6IVLKH.js.map +1 -0
- package/dist/{lazy-builder-BwEoBQZ9.d.ts → lazy-builder-Ci5_YG73.d.cts} +2 -2
- package/dist/{lazy-builder-CZVLKh0Z.d.cts → lazy-builder-D5GU14TS.d.ts} +2 -2
- package/dist/{ledger-QZTTHQAQ.js → ledger-O7FXOG3D.js} +6 -6
- package/dist/ledger-O7FXOG3D.js.map +1 -0
- package/dist/materialized-views/index.cjs +856 -0
- package/dist/materialized-views/index.cjs.map +1 -0
- package/dist/materialized-views/index.d.cts +186 -0
- package/dist/materialized-views/index.d.ts +186 -0
- package/dist/materialized-views/index.js +45 -0
- package/dist/materialized-views/index.js.map +1 -0
- package/dist/noydb-YAZNH5TI.js +34 -0
- package/dist/noydb-YAZNH5TI.js.map +1 -0
- package/dist/overlay-views/index.cjs +369 -0
- package/dist/overlay-views/index.cjs.map +1 -0
- package/dist/overlay-views/index.d.cts +82 -0
- package/dist/overlay-views/index.d.ts +82 -0
- package/dist/overlay-views/index.js +25 -0
- package/dist/overlay-views/index.js.map +1 -0
- package/dist/periods/index.cjs +7 -1
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +7 -6
- package/dist/periods/index.d.ts +7 -6
- package/dist/periods/index.js +6 -6
- package/dist/{predicate-SBHmi6D0.d.cts → predicate-Bt5ft-9c.d.cts} +51 -2
- package/dist/{predicate-SBHmi6D0.d.ts → predicate-Bt5ft-9c.d.ts} +51 -2
- package/dist/{public-envelope-6JTACYJV.js → public-envelope-HMYHZIRH.js} +4 -4
- package/dist/public-envelope-HMYHZIRH.js.map +1 -0
- package/dist/query/index.cjs +555 -128
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +32 -11
- package/dist/read-only-facade-ITU6L7BL.js +7 -0
- package/dist/read-only-facade-ITU6L7BL.js.map +1 -0
- package/dist/registry-DKEXOJVO.js +7 -0
- package/dist/registry-DKEXOJVO.js.map +1 -0
- package/dist/registry-ST2VNFZC.js +10 -0
- package/dist/registry-ST2VNFZC.js.map +1 -0
- package/dist/registry-UFIK7CSR.js +8 -0
- package/dist/registry-UFIK7CSR.js.map +1 -0
- package/dist/registry-ZGYYSM5I.js +8 -0
- package/dist/registry-ZGYYSM5I.js.map +1 -0
- package/dist/revoke-S6JMSLUN.js +17 -0
- package/dist/revoke-S6JMSLUN.js.map +1 -0
- package/dist/session/index.cjs +7 -1
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +8 -7
- package/dist/session/index.d.ts +8 -7
- package/dist/session/index.js +10 -3
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +7 -6
- package/dist/shadow/index.d.ts +7 -6
- package/dist/shadow/index.js +2 -2
- package/dist/signer-7NPTB3SQ.js +18 -0
- package/dist/signer-7NPTB3SQ.js.map +1 -0
- package/dist/snapshots/index.cjs +937 -0
- package/dist/snapshots/index.cjs.map +1 -0
- package/dist/snapshots/index.d.cts +28 -0
- package/dist/snapshots/index.d.ts +28 -0
- package/dist/snapshots/index.js +152 -0
- package/dist/snapshots/index.js.map +1 -0
- package/dist/stale-VKXSXJF4.js +13 -0
- package/dist/stale-VKXSXJF4.js.map +1 -0
- package/dist/store/index.cjs +14 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +7 -6
- package/dist/store/index.d.ts +7 -6
- package/dist/store/index.js +5 -2
- package/dist/{strategy-D-SrOLCl.d.ts → strategy-CT2LCKAX.d.cts} +84 -19
- package/dist/{strategy-D-SrOLCl.d.cts → strategy-CT2LCKAX.d.ts} +84 -19
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +6 -5
- package/dist/sync/index.d.ts +6 -5
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs +1554 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +7 -6
- package/dist/team/index.d.ts +7 -6
- package/dist/team/index.js +77 -8
- package/dist/tx/index.cjs +375 -43
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +8 -7
- package/dist/tx/index.d.ts +8 -7
- package/dist/tx/index.js +56 -3
- package/dist/tx/index.js.map +1 -1
- package/dist/{types-Bo7NSXJr.d.ts → types-CaNQm4i8.d.ts} +3902 -614
- package/dist/{types-Bnb82f5R.d.cts → types-n2_IfwlQ.d.cts} +3902 -614
- package/dist/{index-CywCC1qZ.d.cts → ulid-B9SMWj5i.d.ts} +216 -27
- package/dist/{index-8QDuznDr.d.ts → ulid-CLMjmyhG.d.cts} +216 -27
- package/dist/util/index.cjs +7 -0
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.d.cts +2 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +5 -1
- package/dist/util/index.js.map +1 -1
- package/dist/with-derivation-CVIOPTUf.d.ts +13 -0
- package/dist/with-derivation-aKrtS7Jj.d.cts +13 -0
- package/dist/with-guard-DZQbPzoP.d.cts +18 -0
- package/dist/with-guard-DseETUrF.d.ts +18 -0
- package/dist/with-materialized-view-C1eA1_T_.d.cts +27 -0
- package/dist/with-materialized-view-DaYaE8-Q.d.ts +27 -0
- package/dist/with-overlayed-view-DQsh2p8H.d.ts +13 -0
- package/dist/with-overlayed-view-DleJfKcV.d.cts +13 -0
- package/package.json +77 -3
- package/dist/chunk-2CSJGFCB.js.map +0 -1
- package/dist/chunk-ACLDOTNQ.js.map +0 -1
- package/dist/chunk-BTDCBVJW.js +0 -160
- package/dist/chunk-BTDCBVJW.js.map +0 -1
- package/dist/chunk-CIMZBAZB.js.map +0 -1
- package/dist/chunk-EXHNQEV4.js +0 -392
- package/dist/chunk-EXHNQEV4.js.map +0 -1
- package/dist/chunk-GOUT6DND.js.map +0 -1
- package/dist/chunk-M5INGEFC.js.map +0 -1
- package/dist/chunk-MDDTIZUO.js.map +0 -1
- package/dist/chunk-NPC4LFV5.js.map +0 -1
- package/dist/chunk-QAVUREFT.js.map +0 -1
- package/dist/chunk-RKJ6OL7K.js.map +0 -1
- package/dist/chunk-SCZXXXU4.js.map +0 -1
- package/dist/chunk-TDR6T5CJ.js.map +0 -1
- package/dist/chunk-WDM5XGGS.js.map +0 -1
- package/dist/chunk-ZFKD4QMV.js.map +0 -1
- /package/dist/{chunk-PTVMYYON.js.map → chunk-2N62W5YP.js.map} +0 -0
- /package/dist/{chunk-QGZRWRSL.js.map → chunk-3LPV6BXR.js.map} +0 -0
- /package/dist/{chunk-4PWAI7Q4.js.map → chunk-5OX6XVNS.js.map} +0 -0
- /package/dist/{chunk-AVVPZ4BC.js.map → chunk-DJRWA3Q5.js.map} +0 -0
- /package/dist/{chunk-M62XNWRA.js.map → chunk-LSTBFLL2.js.map} +0 -0
- /package/dist/{chunk-MR4424N3.js.map → chunk-R233SLY3.js.map} +0 -0
- /package/dist/{chunk-USKYUS74.js.map → chunk-RRNA5GKT.js.map} +0 -0
- /package/dist/{chunk-R36SIKES.js.map → chunk-RYIL3PI2.js.map} +0 -0
- /package/dist/{crypto-IVKU7YTT.js.map → crypto-2CRLG4F4.js.map} +0 -0
- /package/dist/{delegation-2DBS2EOH.js.map → delegation-ZTRT2PRV.js.map} +0 -0
- /package/dist/{ledger-QZTTHQAQ.js.map → derivations/index.js.map} +0 -0
- /package/dist/{public-envelope-6JTACYJV.js.map → executor-S76VN45G.js.map} +0 -0
package/dist/history/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-
|
|
4
|
-
import '../lazy-builder-
|
|
5
|
-
import '../predicate-
|
|
6
|
-
import '../strategy-
|
|
1
|
+
import { b2 as HistoryStrategy, b3 as NoydbStore, b4 as HistoryOptions, b5 as EncryptedEnvelope, b6 as PruneOptions } from '../types-n2_IfwlQ.cjs';
|
|
2
|
+
export { b7 as AppendInput, b8 as ChangeType, b9 as CollectionInstant, ba as DiffEntry, bb as JsonPatch, bc as JsonPatchOp, bd as LedgerEntry, be as LedgerStore, bf as VaultEngine, bg as VaultInstant, bh as VerifyResult, bi as applyPatch, bj as canonicalJson, bk as computePatch, bl as diff, bm as formatDiff, bn as hashEntry, bo as paddedIndex, bp as parseIndex, bq as sha256Hex } from '../types-n2_IfwlQ.cjs';
|
|
3
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-RVqz2zi8.cjs';
|
|
4
|
+
import '../lazy-builder-Ci5_YG73.cjs';
|
|
5
|
+
import '../predicate-Bt5ft-9c.cjs';
|
|
6
|
+
import '../strategy-CT2LCKAX.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-B8bjExET.cjs';
|
|
9
|
+
import '@noy-db/attestation';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Active history strategy — `withHistory()` returns the real
|
package/dist/history/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-
|
|
4
|
-
import '../lazy-builder-
|
|
5
|
-
import '../predicate-
|
|
6
|
-
import '../strategy-
|
|
1
|
+
import { b2 as HistoryStrategy, b3 as NoydbStore, b4 as HistoryOptions, b5 as EncryptedEnvelope, b6 as PruneOptions } from '../types-CaNQm4i8.js';
|
|
2
|
+
export { b7 as AppendInput, b8 as ChangeType, b9 as CollectionInstant, ba as DiffEntry, bb as JsonPatch, bc as JsonPatchOp, bd as LedgerEntry, be as LedgerStore, bf as VaultEngine, bg as VaultInstant, bh as VerifyResult, bi as applyPatch, bj as canonicalJson, bk as computePatch, bl as diff, bm as formatDiff, bn as hashEntry, bo as paddedIndex, bp as parseIndex, bq as sha256Hex } from '../types-CaNQm4i8.js';
|
|
3
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-B9m3_fhj.js';
|
|
4
|
+
import '../lazy-builder-D5GU14TS.js';
|
|
5
|
+
import '../predicate-Bt5ft-9c.js';
|
|
6
|
+
import '../strategy-CT2LCKAX.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-DfUbNad8.js';
|
|
9
|
+
import '@noy-db/attestation';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Active history strategy — `withHistory()` returns the real
|
package/dist/history/index.js
CHANGED
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
getVersionEnvelope,
|
|
9
9
|
pruneHistory,
|
|
10
10
|
saveHistory
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-YM7LFCG7.js";
|
|
12
12
|
import {
|
|
13
13
|
LEDGER_COLLECTION,
|
|
14
14
|
LEDGER_DELTAS_COLLECTION,
|
|
15
15
|
LedgerStore,
|
|
16
16
|
applyPatch,
|
|
17
17
|
computePatch
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-4CLICFEY.js";
|
|
19
19
|
import {
|
|
20
20
|
canonicalJson,
|
|
21
21
|
envelopePayloadHash,
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
paddedIndex,
|
|
24
24
|
parseIndex,
|
|
25
25
|
sha256Hex
|
|
26
|
-
} from "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
26
|
+
} from "../chunk-Z6FNBOTC.js";
|
|
27
|
+
import "../chunk-WIRRPTFH.js";
|
|
28
|
+
import "../chunk-R233SLY3.js";
|
|
29
|
+
import "../chunk-O6EJ6WTI.js";
|
|
30
30
|
|
|
31
31
|
// src/history/active.ts
|
|
32
32
|
function withHistory() {
|
package/dist/i18n/index.cjs
CHANGED
|
@@ -21,15 +21,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var i18n_exports = {};
|
|
22
22
|
__export(i18n_exports, {
|
|
23
23
|
DICT_COLLECTION_PREFIX: () => DICT_COLLECTION_PREFIX,
|
|
24
|
+
DictKeyInUseError: () => DictKeyInUseError,
|
|
25
|
+
DictKeyMissingError: () => DictKeyMissingError,
|
|
24
26
|
DictionaryHandle: () => DictionaryHandle,
|
|
27
|
+
LocaleNotSpecifiedError: () => LocaleNotSpecifiedError,
|
|
28
|
+
MissingTranslationError: () => MissingTranslationError,
|
|
29
|
+
ReservedCollectionNameError: () => ReservedCollectionNameError,
|
|
30
|
+
ScriptViolationError: () => ScriptViolationError,
|
|
31
|
+
TranslatorNotConfiguredError: () => TranslatorNotConfiguredError,
|
|
25
32
|
applyI18nLocale: () => applyI18nLocale,
|
|
26
33
|
dictCollectionName: () => dictCollectionName,
|
|
27
34
|
dictKey: () => dictKey,
|
|
35
|
+
enforceScript: () => enforceScript,
|
|
36
|
+
getAtPath: () => getAtPath,
|
|
28
37
|
i18nText: () => i18nText,
|
|
38
|
+
inferScripts: () => inferScripts,
|
|
29
39
|
isDictCollectionName: () => isDictCollectionName,
|
|
30
40
|
isDictKeyDescriptor: () => isDictKeyDescriptor,
|
|
31
41
|
isI18nTextDescriptor: () => isI18nTextDescriptor,
|
|
32
42
|
resolveI18nText: () => resolveI18nText,
|
|
43
|
+
resolvePolicy: () => resolvePolicy,
|
|
44
|
+
setAtPathInPlace: () => setAtPathInPlace,
|
|
33
45
|
validateI18nTextValue: () => validateI18nTextValue,
|
|
34
46
|
withI18n: () => withI18n
|
|
35
47
|
});
|
|
@@ -69,6 +81,18 @@ var ValidationError = class extends NoydbError {
|
|
|
69
81
|
this.name = "ValidationError";
|
|
70
82
|
}
|
|
71
83
|
};
|
|
84
|
+
var ReservedCollectionNameError = class extends NoydbError {
|
|
85
|
+
/** The rejected collection name. */
|
|
86
|
+
collectionName;
|
|
87
|
+
constructor(collectionName) {
|
|
88
|
+
super(
|
|
89
|
+
"RESERVED_COLLECTION_NAME",
|
|
90
|
+
`"${collectionName}" is a reserved collection name. Use vault.dictionary("${collectionName.replace(/^_dict_/, "")}") to access dictionary collections.`
|
|
91
|
+
);
|
|
92
|
+
this.name = "ReservedCollectionNameError";
|
|
93
|
+
this.collectionName = collectionName;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
72
96
|
var DictKeyMissingError = class extends NoydbError {
|
|
73
97
|
/** The dictionary name. */
|
|
74
98
|
dictionaryName;
|
|
@@ -84,6 +108,27 @@ var DictKeyMissingError = class extends NoydbError {
|
|
|
84
108
|
this.key = key;
|
|
85
109
|
}
|
|
86
110
|
};
|
|
111
|
+
var DictKeyInUseError = class extends NoydbError {
|
|
112
|
+
/** The dictionary name. */
|
|
113
|
+
dictionaryName;
|
|
114
|
+
/** The key that is still referenced. */
|
|
115
|
+
key;
|
|
116
|
+
/** Name of the first collection found to reference this key. */
|
|
117
|
+
usedBy;
|
|
118
|
+
/** Number of records in `usedBy` that reference this key. */
|
|
119
|
+
count;
|
|
120
|
+
constructor(dictionaryName, key, usedBy, count) {
|
|
121
|
+
super(
|
|
122
|
+
"DICT_KEY_IN_USE",
|
|
123
|
+
`Cannot delete key "${key}" from dictionary "${dictionaryName}": ${count} record(s) in "${usedBy}" still reference it. Use dictionary.rename("${key}", newKey) to rewrite references first.`
|
|
124
|
+
);
|
|
125
|
+
this.name = "DictKeyInUseError";
|
|
126
|
+
this.dictionaryName = dictionaryName;
|
|
127
|
+
this.key = key;
|
|
128
|
+
this.usedBy = usedBy;
|
|
129
|
+
this.count = count;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
87
132
|
var MissingTranslationError = class extends NoydbError {
|
|
88
133
|
/** The field name whose translation(s) are missing. */
|
|
89
134
|
field;
|
|
@@ -111,6 +156,50 @@ var LocaleNotSpecifiedError = class extends NoydbError {
|
|
|
111
156
|
this.field = field;
|
|
112
157
|
}
|
|
113
158
|
};
|
|
159
|
+
var ScriptViolationError = class extends NoydbError {
|
|
160
|
+
/** The field whose value violated its script constraint. */
|
|
161
|
+
field;
|
|
162
|
+
/** The locale slot (e.g. `'en'`) that was checked. */
|
|
163
|
+
locale;
|
|
164
|
+
/** The Unicode scripts allowed for this slot. */
|
|
165
|
+
expected;
|
|
166
|
+
/** A short sample of the offending characters, for diagnostics. */
|
|
167
|
+
sample;
|
|
168
|
+
constructor(field, locale, expected, sample, message) {
|
|
169
|
+
super(
|
|
170
|
+
"SCRIPT_VIOLATION",
|
|
171
|
+
message ?? `Field "${field}" slot "${locale}" expects script(s) [${expected.join(", ")}] but contains disallowed character(s): "${sample}".`
|
|
172
|
+
);
|
|
173
|
+
this.name = "ScriptViolationError";
|
|
174
|
+
this.field = field;
|
|
175
|
+
this.locale = locale;
|
|
176
|
+
this.expected = expected;
|
|
177
|
+
this.sample = sample;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var TranslatorNotConfiguredError = class extends NoydbError {
|
|
181
|
+
/** The field that requested auto-translation. */
|
|
182
|
+
field;
|
|
183
|
+
/** The collection the put was targeting. */
|
|
184
|
+
collection;
|
|
185
|
+
constructor(field, collection) {
|
|
186
|
+
super(
|
|
187
|
+
"TRANSLATOR_NOT_CONFIGURED",
|
|
188
|
+
`Field "${field}" in collection "${collection}" has autoTranslate: true, but no plaintextTranslator was configured on createNoydb(). Either configure a plaintextTranslator or remove autoTranslate from the schema.`
|
|
189
|
+
);
|
|
190
|
+
this.name = "TranslatorNotConfiguredError";
|
|
191
|
+
this.field = field;
|
|
192
|
+
this.collection = collection;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// src/i18n/policy.ts
|
|
197
|
+
function resolvePolicy(onMissing, layer) {
|
|
198
|
+
const explicit = onMissing && typeof onMissing === "object" ? onMissing[layer] : void 0;
|
|
199
|
+
const scalar = typeof onMissing === "string" ? onMissing : void 0;
|
|
200
|
+
const layerDefault = layer === "guard" ? "substitute" : void 0;
|
|
201
|
+
return explicit ?? layerDefault ?? scalar ?? "throw";
|
|
202
|
+
}
|
|
114
203
|
|
|
115
204
|
// src/i18n/core.ts
|
|
116
205
|
function i18nText(options) {
|
|
@@ -175,7 +264,21 @@ function validateI18nTextValue(value, field, descriptor) {
|
|
|
175
264
|
}
|
|
176
265
|
}
|
|
177
266
|
}
|
|
178
|
-
function
|
|
267
|
+
function toChain(fallback) {
|
|
268
|
+
return Array.isArray(fallback) ? fallback : fallback ? [fallback] : [];
|
|
269
|
+
}
|
|
270
|
+
function pickFromChain(value, chain) {
|
|
271
|
+
for (const fb of chain) {
|
|
272
|
+
if (fb === "any") {
|
|
273
|
+
const any = Object.values(value).find((v) => v !== "");
|
|
274
|
+
if (any !== void 0) return any;
|
|
275
|
+
} else if (value[fb] !== void 0 && value[fb] !== "") {
|
|
276
|
+
return value[fb];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return void 0;
|
|
280
|
+
}
|
|
281
|
+
function resolveI18nText(value, locale, fallback, field, opts) {
|
|
179
282
|
if (locale === "raw") {
|
|
180
283
|
return value;
|
|
181
284
|
}
|
|
@@ -185,34 +288,102 @@ function resolveI18nText(value, locale, fallback, field) {
|
|
|
185
288
|
if (value[locale] !== void 0 && value[locale] !== "") {
|
|
186
289
|
return value[locale];
|
|
187
290
|
}
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
291
|
+
const policy = opts?.policy ?? "throw";
|
|
292
|
+
const callerChain = toChain(fallback);
|
|
293
|
+
const callerHit = pickFromChain(value, callerChain);
|
|
294
|
+
if (callerHit !== void 0) return callerHit;
|
|
295
|
+
if (policy === "substitute") {
|
|
296
|
+
const subHit = pickFromChain(value, toChain(opts?.substitute));
|
|
297
|
+
if (subHit !== void 0) return subHit;
|
|
196
298
|
}
|
|
197
|
-
throw
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
299
|
+
if (policy === "throw") {
|
|
300
|
+
throw new LocaleNotSpecifiedError(
|
|
301
|
+
field ?? "<unknown>",
|
|
302
|
+
`No translation available for locale "${locale}"` + (callerChain.length > 0 ? ` or fallback chain [${callerChain.join(", ")}]` : "") + "."
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return null;
|
|
201
306
|
}
|
|
202
|
-
function
|
|
307
|
+
function getAtPath(obj, path) {
|
|
308
|
+
const arrayIdx = path.indexOf("[].");
|
|
309
|
+
if (arrayIdx !== -1) {
|
|
310
|
+
const arrayKey = path.slice(0, arrayIdx);
|
|
311
|
+
const restPath = path.slice(arrayIdx + 3);
|
|
312
|
+
const arr = obj[arrayKey];
|
|
313
|
+
if (!Array.isArray(arr)) return [];
|
|
314
|
+
return arr.flatMap((item) => {
|
|
315
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return [];
|
|
316
|
+
return getAtPath(item, restPath);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
const dotIdx = path.indexOf(".");
|
|
320
|
+
if (dotIdx !== -1) {
|
|
321
|
+
const head = path.slice(0, dotIdx);
|
|
322
|
+
const rest = path.slice(dotIdx + 1);
|
|
323
|
+
const nested = obj[head];
|
|
324
|
+
if (!nested || typeof nested !== "object" || Array.isArray(nested)) return [];
|
|
325
|
+
return getAtPath(nested, rest);
|
|
326
|
+
}
|
|
327
|
+
const val = obj[path];
|
|
328
|
+
return val !== void 0 ? [val] : [];
|
|
329
|
+
}
|
|
330
|
+
function setAtPathInPlace(obj, path, value) {
|
|
331
|
+
const dotIdx = path.indexOf(".");
|
|
332
|
+
if (dotIdx !== -1) {
|
|
333
|
+
const head = path.slice(0, dotIdx);
|
|
334
|
+
const rest = path.slice(dotIdx + 1);
|
|
335
|
+
const nested = obj[head];
|
|
336
|
+
if (!nested || typeof nested !== "object" || Array.isArray(nested)) return;
|
|
337
|
+
setAtPathInPlace(nested, rest, value);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
obj[path] = value;
|
|
341
|
+
}
|
|
342
|
+
function applyAtPath(obj, path, locale, fallback, opts) {
|
|
343
|
+
const arrayIdx = path.indexOf("[].");
|
|
344
|
+
if (arrayIdx !== -1) {
|
|
345
|
+
const arrayKey = path.slice(0, arrayIdx);
|
|
346
|
+
const restPath = path.slice(arrayIdx + 3);
|
|
347
|
+
const arr = obj[arrayKey];
|
|
348
|
+
if (!Array.isArray(arr)) return obj;
|
|
349
|
+
return {
|
|
350
|
+
...obj,
|
|
351
|
+
[arrayKey]: arr.map((item) => {
|
|
352
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return item;
|
|
353
|
+
return applyAtPath(item, restPath, locale, fallback, opts);
|
|
354
|
+
})
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
const dotIdx = path.indexOf(".");
|
|
358
|
+
if (dotIdx !== -1) {
|
|
359
|
+
const head = path.slice(0, dotIdx);
|
|
360
|
+
const rest = path.slice(dotIdx + 1);
|
|
361
|
+
const nested = obj[head];
|
|
362
|
+
if (!nested || typeof nested !== "object" || Array.isArray(nested)) return obj;
|
|
363
|
+
return {
|
|
364
|
+
...obj,
|
|
365
|
+
[head]: applyAtPath(nested, rest, locale, fallback, opts)
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
const raw = obj[path];
|
|
369
|
+
if (raw === void 0 || raw === null) return obj;
|
|
370
|
+
if (typeof raw !== "object" || Array.isArray(raw)) return obj;
|
|
371
|
+
return {
|
|
372
|
+
...obj,
|
|
373
|
+
[path]: resolveI18nText(raw, locale, fallback, path, opts)
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
|
|
203
377
|
const fieldNames = Object.keys(i18nFields);
|
|
204
378
|
if (fieldNames.length === 0) return record;
|
|
205
|
-
|
|
206
|
-
for (const field of
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
fallback,
|
|
214
|
-
field
|
|
215
|
-
);
|
|
379
|
+
let result = record;
|
|
380
|
+
for (const [field, descriptor] of Object.entries(i18nFields)) {
|
|
381
|
+
const { onMissing, substitute } = descriptor.options;
|
|
382
|
+
const opts = {
|
|
383
|
+
policy: resolvePolicy(onMissing, layer),
|
|
384
|
+
...substitute !== void 0 ? { substitute } : {}
|
|
385
|
+
};
|
|
386
|
+
result = applyAtPath(result, field, locale, fallback, opts);
|
|
216
387
|
}
|
|
217
388
|
return result;
|
|
218
389
|
}
|
|
@@ -290,6 +461,25 @@ function base64ToBuffer(base64) {
|
|
|
290
461
|
}
|
|
291
462
|
|
|
292
463
|
// src/team/keyring.ts
|
|
464
|
+
var CANARY_PLAINTEXT_BYTES = new Uint8Array(32);
|
|
465
|
+
var canaryKeyPromise = null;
|
|
466
|
+
function getCanaryKey() {
|
|
467
|
+
if (canaryKeyPromise === null) {
|
|
468
|
+
canaryKeyPromise = globalThis.crypto.subtle.importKey(
|
|
469
|
+
"raw",
|
|
470
|
+
CANARY_PLAINTEXT_BYTES,
|
|
471
|
+
{ name: "AES-GCM", length: 256 },
|
|
472
|
+
true,
|
|
473
|
+
// extractable so AES-KW can wrap it
|
|
474
|
+
["encrypt", "decrypt"]
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
return canaryKeyPromise;
|
|
478
|
+
}
|
|
479
|
+
async function mintKeyringCanary(kek) {
|
|
480
|
+
const canaryKey = await getCanaryKey();
|
|
481
|
+
return wrapKey(canaryKey, kek);
|
|
482
|
+
}
|
|
293
483
|
async function ensureCollectionDEK(adapter, vault, keyring) {
|
|
294
484
|
const inFlight = /* @__PURE__ */ new Map();
|
|
295
485
|
return async (collectionName) => {
|
|
@@ -321,6 +511,7 @@ async function persistKeyring(adapter, vault, keyring) {
|
|
|
321
511
|
for (const [collName, dek] of keyring.deks) {
|
|
322
512
|
wrappedDeks[collName] = await wrapKey(dek, keyring.kek);
|
|
323
513
|
}
|
|
514
|
+
const canary = await mintKeyringCanary(keyring.kek);
|
|
324
515
|
const keyringFile = {
|
|
325
516
|
_noydb_keyring: NOYDB_KEYRING_VERSION,
|
|
326
517
|
user_id: keyring.userId,
|
|
@@ -331,6 +522,7 @@ async function persistKeyring(adapter, vault, keyring) {
|
|
|
331
522
|
salt: bufferToBase64(keyring.salt),
|
|
332
523
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
333
524
|
granted_by: keyring.userId,
|
|
525
|
+
canary,
|
|
334
526
|
...keyring.exportCapability !== void 0 && { export_capability: keyring.exportCapability },
|
|
335
527
|
...keyring.importCapability !== void 0 && { import_capability: keyring.importCapability },
|
|
336
528
|
...keyring.authenticators.length > 0 && { authenticators: keyring.authenticators },
|
|
@@ -377,8 +569,14 @@ function dictCollectionName(dictionaryName) {
|
|
|
377
569
|
function isDictCollectionName(name) {
|
|
378
570
|
return name.startsWith(DICT_COLLECTION_PREFIX);
|
|
379
571
|
}
|
|
380
|
-
function dictKey(name, keys) {
|
|
381
|
-
return {
|
|
572
|
+
function dictKey(name, keys, opts) {
|
|
573
|
+
return {
|
|
574
|
+
_noydbDictKey: true,
|
|
575
|
+
name,
|
|
576
|
+
keys,
|
|
577
|
+
...opts?.onMissing !== void 0 ? { onMissing: opts.onMissing } : {},
|
|
578
|
+
...opts?.substitute !== void 0 ? { substitute: opts.substitute } : {}
|
|
579
|
+
};
|
|
382
580
|
}
|
|
383
581
|
function isDictKeyDescriptor(x) {
|
|
384
582
|
return typeof x === "object" && x !== null && x._noydbDictKey === true;
|
|
@@ -720,11 +918,142 @@ var DictionaryHandle = class {
|
|
|
720
918
|
}
|
|
721
919
|
};
|
|
722
920
|
|
|
921
|
+
// src/i18n/script.ts
|
|
922
|
+
var LATIN_BASE = /* @__PURE__ */ new Set([
|
|
923
|
+
"en",
|
|
924
|
+
"fr",
|
|
925
|
+
"de",
|
|
926
|
+
"es",
|
|
927
|
+
"it",
|
|
928
|
+
"pt",
|
|
929
|
+
"nl",
|
|
930
|
+
"sv",
|
|
931
|
+
"no",
|
|
932
|
+
"da",
|
|
933
|
+
"fi",
|
|
934
|
+
"is",
|
|
935
|
+
"pl",
|
|
936
|
+
"cs",
|
|
937
|
+
"sk",
|
|
938
|
+
"hu",
|
|
939
|
+
"ro",
|
|
940
|
+
"hr",
|
|
941
|
+
"sl",
|
|
942
|
+
"et",
|
|
943
|
+
"lv",
|
|
944
|
+
"lt",
|
|
945
|
+
"tr",
|
|
946
|
+
"vi",
|
|
947
|
+
"id",
|
|
948
|
+
"ms",
|
|
949
|
+
"tl",
|
|
950
|
+
"sw",
|
|
951
|
+
"af",
|
|
952
|
+
"ca",
|
|
953
|
+
"gl",
|
|
954
|
+
"eu",
|
|
955
|
+
"cy",
|
|
956
|
+
"ga"
|
|
957
|
+
]);
|
|
958
|
+
var SCRIPT_TABLE = {
|
|
959
|
+
th: ["Thai"],
|
|
960
|
+
ko: ["Hangul", "Han"],
|
|
961
|
+
ja: ["Han", "Hiragana", "Katakana"],
|
|
962
|
+
zh: ["Han"],
|
|
963
|
+
ar: ["Arabic"],
|
|
964
|
+
fa: ["Arabic"],
|
|
965
|
+
ur: ["Arabic"],
|
|
966
|
+
ru: ["Cyrillic"],
|
|
967
|
+
uk: ["Cyrillic"],
|
|
968
|
+
bg: ["Cyrillic"],
|
|
969
|
+
sr: ["Cyrillic"],
|
|
970
|
+
he: ["Hebrew"],
|
|
971
|
+
el: ["Greek"],
|
|
972
|
+
hi: ["Devanagari"],
|
|
973
|
+
ta: ["Tamil"],
|
|
974
|
+
km: ["Khmer"],
|
|
975
|
+
lo: ["Lao"],
|
|
976
|
+
my: ["Myanmar"]
|
|
977
|
+
};
|
|
978
|
+
var SUBTAG_SCRIPTS = {
|
|
979
|
+
Latn: ["Latin"],
|
|
980
|
+
Cyrl: ["Cyrillic", "Latin"],
|
|
981
|
+
Hans: ["Han", "Latin"],
|
|
982
|
+
Hant: ["Han", "Latin"],
|
|
983
|
+
Thai: ["Thai", "Latin"],
|
|
984
|
+
Arab: ["Arabic", "Latin"]
|
|
985
|
+
};
|
|
986
|
+
function inferScripts(locale) {
|
|
987
|
+
const parts = locale.split("-");
|
|
988
|
+
const subtag = parts.find((t) => /^[A-Z][a-z]{3}$/.test(t));
|
|
989
|
+
if (subtag && SUBTAG_SCRIPTS[subtag]) return SUBTAG_SCRIPTS[subtag];
|
|
990
|
+
const base = (parts[0] ?? "").toLowerCase();
|
|
991
|
+
if (LATIN_BASE.has(base)) return ["Latin"];
|
|
992
|
+
const primary = SCRIPT_TABLE[base];
|
|
993
|
+
if (primary) return [...primary, "Latin"];
|
|
994
|
+
return ["Latin"];
|
|
995
|
+
}
|
|
996
|
+
function allowedFor(descriptor, locale) {
|
|
997
|
+
const script = descriptor.options.script;
|
|
998
|
+
if (script && script !== "auto") {
|
|
999
|
+
const explicit = script[locale];
|
|
1000
|
+
if (explicit) return explicit;
|
|
1001
|
+
}
|
|
1002
|
+
return inferScripts(locale);
|
|
1003
|
+
}
|
|
1004
|
+
var BASELINE = String.raw`\p{White_Space}\p{Script=Common}\p{Script=Inherited}\p{Mark}`;
|
|
1005
|
+
function fullMatcher(scripts) {
|
|
1006
|
+
const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
|
|
1007
|
+
return new RegExp(`^[${BASELINE}${cls}]*$`, "u");
|
|
1008
|
+
}
|
|
1009
|
+
function charMatcher(scripts) {
|
|
1010
|
+
const cls = scripts.map((s) => `\\p{Script=${s}}`).join("");
|
|
1011
|
+
return new RegExp(`[${BASELINE}${cls}]`, "u");
|
|
1012
|
+
}
|
|
1013
|
+
function offendingSample(str, scripts) {
|
|
1014
|
+
const ok = charMatcher(scripts);
|
|
1015
|
+
const bad = [];
|
|
1016
|
+
for (const ch of str) {
|
|
1017
|
+
if (!ok.test(ch)) bad.push(ch);
|
|
1018
|
+
if (bad.length >= 8) break;
|
|
1019
|
+
}
|
|
1020
|
+
return bad.join("");
|
|
1021
|
+
}
|
|
1022
|
+
function stripDisallowed(str, scripts) {
|
|
1023
|
+
const ok = charMatcher(scripts);
|
|
1024
|
+
let out = "";
|
|
1025
|
+
for (const ch of str) if (ok.test(ch)) out += ch;
|
|
1026
|
+
return out;
|
|
1027
|
+
}
|
|
1028
|
+
function enforceScript(value, field, descriptor) {
|
|
1029
|
+
const opt = descriptor.options;
|
|
1030
|
+
if (!opt.script) return { value, warnings: [] };
|
|
1031
|
+
const mode = opt.onScriptViolation ?? "reject";
|
|
1032
|
+
const warnings = [];
|
|
1033
|
+
let out = value;
|
|
1034
|
+
for (const [locale, raw] of Object.entries(value)) {
|
|
1035
|
+
if (typeof raw !== "string") continue;
|
|
1036
|
+
const allowed = allowedFor(descriptor, locale);
|
|
1037
|
+
if (fullMatcher(allowed).test(raw)) continue;
|
|
1038
|
+
const sample = offendingSample(raw, allowed);
|
|
1039
|
+
if (mode === "reject") {
|
|
1040
|
+
throw new ScriptViolationError(field, locale, allowed, sample);
|
|
1041
|
+
}
|
|
1042
|
+
warnings.push({ field, locale, expected: allowed, sample });
|
|
1043
|
+
if (mode === "filter") {
|
|
1044
|
+
if (out === value) out = { ...value };
|
|
1045
|
+
out[locale] = stripDisallowed(raw, allowed);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
return { value: out, warnings };
|
|
1049
|
+
}
|
|
1050
|
+
|
|
723
1051
|
// src/i18n/active.ts
|
|
724
1052
|
function withI18n() {
|
|
725
1053
|
return {
|
|
726
1054
|
applyI18nLocale,
|
|
727
1055
|
validateI18nTextValue,
|
|
1056
|
+
enforceScript,
|
|
728
1057
|
buildDictionaryHandle(opts) {
|
|
729
1058
|
return new DictionaryHandle(
|
|
730
1059
|
opts.adapter,
|
|
@@ -744,15 +1073,27 @@ function withI18n() {
|
|
|
744
1073
|
// Annotate the CommonJS export names for ESM import in node:
|
|
745
1074
|
0 && (module.exports = {
|
|
746
1075
|
DICT_COLLECTION_PREFIX,
|
|
1076
|
+
DictKeyInUseError,
|
|
1077
|
+
DictKeyMissingError,
|
|
747
1078
|
DictionaryHandle,
|
|
1079
|
+
LocaleNotSpecifiedError,
|
|
1080
|
+
MissingTranslationError,
|
|
1081
|
+
ReservedCollectionNameError,
|
|
1082
|
+
ScriptViolationError,
|
|
1083
|
+
TranslatorNotConfiguredError,
|
|
748
1084
|
applyI18nLocale,
|
|
749
1085
|
dictCollectionName,
|
|
750
1086
|
dictKey,
|
|
1087
|
+
enforceScript,
|
|
1088
|
+
getAtPath,
|
|
751
1089
|
i18nText,
|
|
1090
|
+
inferScripts,
|
|
752
1091
|
isDictCollectionName,
|
|
753
1092
|
isDictKeyDescriptor,
|
|
754
1093
|
isI18nTextDescriptor,
|
|
755
1094
|
resolveI18nText,
|
|
1095
|
+
resolvePolicy,
|
|
1096
|
+
setAtPathInPlace,
|
|
756
1097
|
validateI18nTextValue,
|
|
757
1098
|
withI18n
|
|
758
1099
|
});
|