@noy-db/hub 0.2.0-pre.27 → 0.2.0-pre.28
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 +7 -0
- 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 +2 -2
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +3 -3
- package/dist/attestation/index.d.ts +3 -3
- package/dist/attestation/index.js +4 -4
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +5 -5
- package/dist/blobs/index.d.ts +5 -5
- package/dist/blobs/index.js +4 -4
- package/dist/bundle/index.cjs +83 -5
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +5 -5
- package/dist/bundle/index.d.ts +5 -5
- package/dist/bundle/index.js +8 -8
- package/dist/{chunk-PS6PSEZL.js → chunk-2M62POB5.js} +3 -3
- package/dist/{chunk-C7UIT5XY.js → chunk-345PYZD6.js} +2 -2
- package/dist/{chunk-KSKKLVPA.js → chunk-3LHTFCU2.js} +113 -41
- package/dist/chunk-3LHTFCU2.js.map +1 -0
- package/dist/{chunk-KA5A5CSD.js → chunk-42EGY2FQ.js} +3 -3
- package/dist/{chunk-7DDTFGXY.js → chunk-4FHKQDHN.js} +2 -2
- package/dist/{chunk-KD253AI5.js → chunk-6LD37AMK.js} +22 -3
- package/dist/chunk-6LD37AMK.js.map +1 -0
- package/dist/{chunk-6H4CAHMQ.js → chunk-7GKDVWMD.js} +2 -2
- package/dist/{chunk-6ZKXFMUG.js → chunk-7TBCLM52.js} +2 -2
- package/dist/{chunk-VJNV2GRF.js → chunk-AHDQYG7P.js} +3 -3
- package/dist/{chunk-RRCRITDM.js → chunk-DCYWBKQ2.js} +2 -2
- package/dist/{chunk-K6PCTYAH.js → chunk-DMWUOV7X.js} +2 -2
- package/dist/{chunk-CVTPNW2Y.js → chunk-DQ6XF2K2.js} +6 -6
- package/dist/{chunk-5EITJMUJ.js → chunk-ENC4C6XW.js} +3 -3
- package/dist/{chunk-BOMH3637.js → chunk-GVEUI7VR.js} +2 -2
- package/dist/{chunk-WVYL6HM7.js → chunk-HI7FY7QZ.js} +2 -2
- package/dist/{chunk-PFKAT4NT.js → chunk-HQ242WNG.js} +3 -3
- package/dist/{chunk-HAKEZTA7.js → chunk-IMY4FXYE.js} +3 -3
- package/dist/{chunk-SID2NJNF.js → chunk-JEQB2KVI.js} +2 -2
- package/dist/{chunk-Z3BJF7SF.js → chunk-M2VZQ24Q.js} +2 -2
- package/dist/{chunk-2NYVA6FW.js → chunk-PPF7Z2YQ.js} +2 -2
- package/dist/{chunk-IWGVH2RR.js → chunk-QBC2TZHC.js} +3 -3
- package/dist/{chunk-AD6RNBAW.js → chunk-QSLIT4JZ.js} +1 -1
- package/dist/chunk-QSLIT4JZ.js.map +1 -0
- package/dist/{chunk-BMDVFBCL.js → chunk-RG5KLMEU.js} +2 -2
- package/dist/{chunk-DONPLWRC.js → chunk-SWGVCSIY.js} +2 -2
- package/dist/{chunk-LXA2E3VI.js → chunk-VSL3W2MO.js} +2 -2
- package/dist/{chunk-6M5JKTUQ.js → chunk-WH7G2YEE.js} +2 -2
- package/dist/{chunk-I2RX62RX.js → chunk-YYLFXX2K.js} +2 -2
- package/dist/consent/index.d.cts +4 -4
- package/dist/consent/index.d.ts +4 -4
- package/dist/{decrypt-partition-CptDdcCx.d.ts → decrypt-partition-BtGtE-19.d.ts} +1 -1
- package/dist/{decrypt-partition-DmkeOB4I.d.cts → decrypt-partition-Cqi5gcOl.d.cts} +1 -1
- package/dist/derivations/index.d.cts +5 -5
- package/dist/derivations/index.d.ts +5 -5
- package/dist/{dev-unlock-DUTLA3Sc.d.cts → dev-unlock-Cts_iiVv.d.cts} +1 -1
- package/dist/{dev-unlock-Y9znMkQ2.d.ts → dev-unlock-D0p9cQzN.d.ts} +1 -1
- package/dist/{executor-BIW4FT5R.js → executor-PJHMRZWJ.js} +4 -4
- package/dist/{fanout-sidecar-OC4QVTS2.js → fanout-sidecar-DSBVAR2P.js} +2 -2
- package/dist/forget/index.js +2 -2
- package/dist/guards/index.d.cts +5 -5
- package/dist/guards/index.d.ts +5 -5
- package/dist/{hash-Btl9IvQS.d.ts → hash-BtDtwguU.d.ts} +1 -1
- package/dist/{hash-DFK7cGdo.d.cts → hash-DA75XwW2.d.cts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +5 -5
- package/dist/history/index.d.ts +5 -5
- package/dist/history/index.js +3 -3
- package/dist/i18n/index.cjs +98 -1
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +4 -4
- package/dist/i18n/index.d.ts +4 -4
- package/dist/i18n/index.js +83 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/{index-wRwJVVJQ.d.ts → index-BidHvmWf.d.ts} +3 -3
- package/dist/{index-CqzZml-D.d.cts → index-CP24aYCp.d.cts} +3 -3
- package/dist/{index-DoxKSsMj.d.cts → index-CVnt2Qmq.d.cts} +1 -1
- package/dist/{index-LaexBi3v.d.ts → index-DxBNV54L.d.ts} +1 -1
- package/dist/index.cjs +95 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +24 -24
- package/dist/{issue-ZZ2XPOGP.js → issue-JSGGSVY4.js} +4 -4
- package/dist/kernel/index.d.cts +4 -4
- package/dist/kernel/index.d.ts +4 -4
- package/dist/kernel/index.js +4 -4
- package/dist/{ledger-XQ4KVFQ6.js → ledger-PLMSH7LD.js} +3 -3
- package/dist/materialized-views/index.cjs +7 -0
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +5 -5
- package/dist/materialized-views/index.d.ts +5 -5
- package/dist/materialized-views/index.js +4 -4
- package/dist/{mime-magic-OiPT1qed.d.ts → mime-magic--NcogI82.d.ts} +1 -1
- package/dist/{mime-magic-Co4Pyj-O.d.cts → mime-magic-i2VSlkPM.d.cts} +1 -1
- package/dist/noydb-PHXA5E6I.js +39 -0
- package/dist/overlay-views/index.d.cts +5 -5
- package/dist/overlay-views/index.d.ts +5 -5
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +4 -4
- package/dist/periods/index.d.ts +4 -4
- package/dist/periods/index.js +3 -3
- package/dist/{public-envelope-O6X6AUUS.js → public-envelope-7MTH2PVE.js} +3 -3
- package/dist/query/index.cjs +7 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js +3 -3
- package/dist/{revoke-QJ2HUM4W.js → revoke-DBAGKIDA.js} +4 -4
- package/dist/session/index.d.cts +5 -5
- package/dist/session/index.d.ts +5 -5
- package/dist/shadow/index.d.cts +4 -4
- package/dist/shadow/index.d.ts +4 -4
- package/dist/{signer-SCJ6C6HQ.js → signer-ADFJNS5W.js} +3 -3
- package/dist/snapshots/index.d.cts +4 -4
- package/dist/snapshots/index.d.ts +4 -4
- package/dist/snapshots/index.js +3 -3
- package/dist/{stale-KKCHF2VB.js → stale-BCIE3SMC.js} +2 -2
- package/dist/store/index.d.cts +4 -4
- package/dist/store/index.d.ts +4 -4
- package/dist/{strategy-YQ1qJWyq.d.ts → strategy-BoITAb2H.d.ts} +20 -1
- package/dist/{strategy-D1zjEV3n.d.cts → strategy-DDNvt_UD.d.cts} +20 -1
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +3 -3
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.js +2 -2
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +4 -4
- package/dist/team/index.d.ts +4 -4
- package/dist/team/index.js +5 -5
- package/dist/{transition-guard-CJmb8O8q.d.ts → transition-guard-BZhOlrFT.d.ts} +1 -1
- package/dist/{transition-guard-Dzj68JWC.d.cts → transition-guard-Bekgaxux.d.cts} +1 -1
- package/dist/tx/index.d.cts +4 -4
- package/dist/tx/index.d.ts +4 -4
- package/dist/{types-CkSWJt0H.d.ts → types-84nsWSDF.d.ts} +45 -4
- package/dist/{types-CwrTuYFI.d.cts → types-B_eCkuEI.d.cts} +45 -4
- package/dist/{with-materialized-view-BVfcPlaE.d.ts → with-materialized-view-CAMGQroY.d.ts} +1 -1
- package/dist/{with-materialized-view-dPG213gd.d.cts → with-materialized-view-DKMaZmkJ.d.cts} +1 -1
- package/dist/{with-overlayed-view-CJ2UDBol.d.cts → with-overlayed-view--lWXImbV.d.cts} +1 -1
- package/dist/{with-overlayed-view-zYPQzGGh.d.ts → with-overlayed-view-FnOf1v6H.d.ts} +1 -1
- package/dist/{with-rollup-B_zbRi3f.d.cts → with-rollup-C5875Ad5.d.cts} +1 -1
- package/dist/{with-rollup-BvaJefEs.d.ts → with-rollup-xi-mkY6Y.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-AD6RNBAW.js.map +0 -1
- package/dist/chunk-KD253AI5.js.map +0 -1
- package/dist/chunk-KSKKLVPA.js.map +0 -1
- package/dist/noydb-EY52NVH4.js +0 -39
- /package/dist/{chunk-PS6PSEZL.js.map → chunk-2M62POB5.js.map} +0 -0
- /package/dist/{chunk-C7UIT5XY.js.map → chunk-345PYZD6.js.map} +0 -0
- /package/dist/{chunk-KA5A5CSD.js.map → chunk-42EGY2FQ.js.map} +0 -0
- /package/dist/{chunk-7DDTFGXY.js.map → chunk-4FHKQDHN.js.map} +0 -0
- /package/dist/{chunk-6H4CAHMQ.js.map → chunk-7GKDVWMD.js.map} +0 -0
- /package/dist/{chunk-6ZKXFMUG.js.map → chunk-7TBCLM52.js.map} +0 -0
- /package/dist/{chunk-VJNV2GRF.js.map → chunk-AHDQYG7P.js.map} +0 -0
- /package/dist/{chunk-RRCRITDM.js.map → chunk-DCYWBKQ2.js.map} +0 -0
- /package/dist/{chunk-K6PCTYAH.js.map → chunk-DMWUOV7X.js.map} +0 -0
- /package/dist/{chunk-CVTPNW2Y.js.map → chunk-DQ6XF2K2.js.map} +0 -0
- /package/dist/{chunk-5EITJMUJ.js.map → chunk-ENC4C6XW.js.map} +0 -0
- /package/dist/{chunk-BOMH3637.js.map → chunk-GVEUI7VR.js.map} +0 -0
- /package/dist/{chunk-WVYL6HM7.js.map → chunk-HI7FY7QZ.js.map} +0 -0
- /package/dist/{chunk-PFKAT4NT.js.map → chunk-HQ242WNG.js.map} +0 -0
- /package/dist/{chunk-HAKEZTA7.js.map → chunk-IMY4FXYE.js.map} +0 -0
- /package/dist/{chunk-SID2NJNF.js.map → chunk-JEQB2KVI.js.map} +0 -0
- /package/dist/{chunk-Z3BJF7SF.js.map → chunk-M2VZQ24Q.js.map} +0 -0
- /package/dist/{chunk-2NYVA6FW.js.map → chunk-PPF7Z2YQ.js.map} +0 -0
- /package/dist/{chunk-IWGVH2RR.js.map → chunk-QBC2TZHC.js.map} +0 -0
- /package/dist/{chunk-BMDVFBCL.js.map → chunk-RG5KLMEU.js.map} +0 -0
- /package/dist/{chunk-DONPLWRC.js.map → chunk-SWGVCSIY.js.map} +0 -0
- /package/dist/{chunk-LXA2E3VI.js.map → chunk-VSL3W2MO.js.map} +0 -0
- /package/dist/{chunk-6M5JKTUQ.js.map → chunk-WH7G2YEE.js.map} +0 -0
- /package/dist/{chunk-I2RX62RX.js.map → chunk-YYLFXX2K.js.map} +0 -0
- /package/dist/{executor-BIW4FT5R.js.map → executor-PJHMRZWJ.js.map} +0 -0
- /package/dist/{fanout-sidecar-OC4QVTS2.js.map → fanout-sidecar-DSBVAR2P.js.map} +0 -0
- /package/dist/{issue-ZZ2XPOGP.js.map → issue-JSGGSVY4.js.map} +0 -0
- /package/dist/{ledger-XQ4KVFQ6.js.map → ledger-PLMSH7LD.js.map} +0 -0
- /package/dist/{noydb-EY52NVH4.js.map → noydb-PHXA5E6I.js.map} +0 -0
- /package/dist/{public-envelope-O6X6AUUS.js.map → public-envelope-7MTH2PVE.js.map} +0 -0
- /package/dist/{revoke-QJ2HUM4W.js.map → revoke-DBAGKIDA.js.map} +0 -0
- /package/dist/{signer-SCJ6C6HQ.js.map → signer-ADFJNS5W.js.map} +0 -0
- /package/dist/{stale-KKCHF2VB.js.map → stale-BCIE3SMC.js.map} +0 -0
package/dist/history/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-
|
|
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-
|
|
1
|
+
import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-B_eCkuEI.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-B_eCkuEI.cjs';
|
|
3
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-
|
|
4
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-DA75XwW2.cjs';
|
|
5
5
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
6
6
|
import '../predicate-BmhBSPCH.cjs';
|
|
7
|
-
import '../strategy-
|
|
7
|
+
import '../strategy-DDNvt_UD.cjs';
|
|
8
8
|
import '../errors-Dwk2k1xY.cjs';
|
|
9
9
|
import '../strategy-BSxFXGzb.cjs';
|
|
10
|
-
import '../index-
|
|
10
|
+
import '../index-CVnt2Qmq.cjs';
|
|
11
11
|
import '@noy-db/attestation';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/history/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-
|
|
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-
|
|
1
|
+
import { aV as HistoryStrategy, aW as NoydbStore, aX as HistoryOptions, aY as EncryptedEnvelope, aZ as PruneOptions } from '../types-84nsWSDF.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-84nsWSDF.js';
|
|
3
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-
|
|
4
|
+
export { L as LEDGER_COLLECTION, a as LEDGER_DELTAS_COLLECTION, e as envelopePayloadHash } from '../hash-BtDtwguU.js';
|
|
5
5
|
import '../lazy-builder-ChSqcF5t.js';
|
|
6
6
|
import '../predicate-BmhBSPCH.js';
|
|
7
|
-
import '../strategy-
|
|
7
|
+
import '../strategy-BoITAb2H.js';
|
|
8
8
|
import '../errors-Dwk2k1xY.js';
|
|
9
9
|
import '../strategy-BSxFXGzb.js';
|
|
10
|
-
import '../index-
|
|
10
|
+
import '../index-DxBNV54L.js';
|
|
11
11
|
import '@noy-db/attestation';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/history/index.js
CHANGED
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
pruneHistory,
|
|
10
10
|
saveHistory,
|
|
11
11
|
tombstoneHistory
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-WH7G2YEE.js";
|
|
13
13
|
import {
|
|
14
14
|
LEDGER_COLLECTION,
|
|
15
15
|
LEDGER_DELTAS_COLLECTION,
|
|
16
16
|
LedgerStore,
|
|
17
17
|
applyPatch,
|
|
18
18
|
computePatch
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7GKDVWMD.js";
|
|
20
20
|
import {
|
|
21
21
|
canonicalJson,
|
|
22
22
|
envelopePayloadHash,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
parseIndex,
|
|
26
26
|
sha256Hex
|
|
27
27
|
} from "../chunk-PDVP3C2I.js";
|
|
28
|
-
import "../chunk-
|
|
28
|
+
import "../chunk-QSLIT4JZ.js";
|
|
29
29
|
import "../chunk-7JSP3E67.js";
|
|
30
30
|
import "../chunk-DDOYOMAD.js";
|
|
31
31
|
|
package/dist/i18n/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(i18n_exports, {
|
|
|
46
46
|
resolvePolicy: () => resolvePolicy,
|
|
47
47
|
setAtPathInPlace: () => setAtPathInPlace,
|
|
48
48
|
staticDict: () => staticDict,
|
|
49
|
+
stripI18nFilled: () => stripI18nFilled,
|
|
49
50
|
validateI18nTextValue: () => validateI18nTextValue,
|
|
50
51
|
withI18n: () => withI18n
|
|
51
52
|
});
|
|
@@ -342,13 +343,14 @@ function stripDisallowed(str, scripts) {
|
|
|
342
343
|
for (const ch of str) if (ok.test(ch)) out += ch;
|
|
343
344
|
return out;
|
|
344
345
|
}
|
|
345
|
-
function enforceScript(value, field, descriptor) {
|
|
346
|
+
function enforceScript(value, field, descriptor, exempt) {
|
|
346
347
|
const opt = descriptor.options;
|
|
347
348
|
if (!opt.script) return { value, warnings: [] };
|
|
348
349
|
const mode = opt.onScriptViolation ?? "reject";
|
|
349
350
|
const warnings = [];
|
|
350
351
|
let out = value;
|
|
351
352
|
for (const [locale, raw] of Object.entries(value)) {
|
|
353
|
+
if (exempt?.has(locale)) continue;
|
|
352
354
|
if (typeof raw !== "string") continue;
|
|
353
355
|
const allowed = allowedFor(descriptor, locale);
|
|
354
356
|
if (fullMatcher(allowed).test(raw)) continue;
|
|
@@ -367,8 +369,18 @@ function enforceScript(value, field, descriptor) {
|
|
|
367
369
|
|
|
368
370
|
// src/i18n/core.ts
|
|
369
371
|
function i18nText(options) {
|
|
372
|
+
if (options.densifyOnWrite === true && hasThrowPolicy(options.onMissing)) {
|
|
373
|
+
throw new Error(
|
|
374
|
+
`i18nText: densifyOnWrite cannot be combined with an explicit onMissing 'throw' policy \u2014 densify fills every empty slot, so a 'throw' would be unreachable. Remove the 'throw' policy or disable densifyOnWrite.`
|
|
375
|
+
);
|
|
376
|
+
}
|
|
370
377
|
return { _noydbI18nText: true, options };
|
|
371
378
|
}
|
|
379
|
+
function hasThrowPolicy(onMissing) {
|
|
380
|
+
if (onMissing === void 0) return false;
|
|
381
|
+
if (typeof onMissing === "string") return onMissing === "throw";
|
|
382
|
+
return Object.values(onMissing).includes("throw");
|
|
383
|
+
}
|
|
372
384
|
function isI18nTextDescriptor(x) {
|
|
373
385
|
return typeof x === "object" && x !== null && x._noydbI18nText === true;
|
|
374
386
|
}
|
|
@@ -566,8 +578,15 @@ function applyI18nLocale(record, i18nFields, locale, fallback, layer = "read") {
|
|
|
566
578
|
};
|
|
567
579
|
result = applyAtPath(result, field, locale, fallback, opts);
|
|
568
580
|
}
|
|
581
|
+
result = stripI18nFilled(result);
|
|
569
582
|
return result;
|
|
570
583
|
}
|
|
584
|
+
function stripI18nFilled(record) {
|
|
585
|
+
if (!Object.prototype.hasOwnProperty.call(record, "_i18nFilled")) return record;
|
|
586
|
+
const rest = { ...record };
|
|
587
|
+
delete rest._i18nFilled;
|
|
588
|
+
return rest;
|
|
589
|
+
}
|
|
571
590
|
|
|
572
591
|
// src/types.ts
|
|
573
592
|
var NOYDB_FORMAT_VERSION = 1;
|
|
@@ -1114,12 +1133,89 @@ var DictionaryHandle = class {
|
|
|
1114
1133
|
}
|
|
1115
1134
|
};
|
|
1116
1135
|
|
|
1136
|
+
// src/i18n/densify.ts
|
|
1137
|
+
var MARKER = "_i18nFilled";
|
|
1138
|
+
function priorFilled(prior, field) {
|
|
1139
|
+
if (!prior) return /* @__PURE__ */ new Set();
|
|
1140
|
+
const marker = prior[MARKER];
|
|
1141
|
+
return new Set(marker?.[field] ?? []);
|
|
1142
|
+
}
|
|
1143
|
+
function singleLeaf(record, field) {
|
|
1144
|
+
const leaves = getAtPath(record, field);
|
|
1145
|
+
if (leaves.length !== 1) return void 0;
|
|
1146
|
+
const leaf = leaves[0];
|
|
1147
|
+
if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) return void 0;
|
|
1148
|
+
return leaf;
|
|
1149
|
+
}
|
|
1150
|
+
function computeExemptFills(prior, incoming, fields) {
|
|
1151
|
+
const out = /* @__PURE__ */ new Map();
|
|
1152
|
+
if (!prior) return out;
|
|
1153
|
+
for (const field of Object.keys(fields)) {
|
|
1154
|
+
const filled = priorFilled(prior, field);
|
|
1155
|
+
if (filled.size === 0) continue;
|
|
1156
|
+
const priorLeaf = singleLeaf(prior, field);
|
|
1157
|
+
const incLeaf = singleLeaf(incoming, field);
|
|
1158
|
+
if (!priorLeaf || !incLeaf) continue;
|
|
1159
|
+
const exempt = /* @__PURE__ */ new Set();
|
|
1160
|
+
for (const loc of filled) {
|
|
1161
|
+
if (incLeaf[loc] !== void 0 && incLeaf[loc] !== "" && incLeaf[loc] === priorLeaf[loc]) {
|
|
1162
|
+
exempt.add(loc);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
if (exempt.size > 0) out.set(field, exempt);
|
|
1166
|
+
}
|
|
1167
|
+
return out;
|
|
1168
|
+
}
|
|
1169
|
+
function densify(record, prior, fields) {
|
|
1170
|
+
let marker = record[MARKER];
|
|
1171
|
+
for (const [field, descriptor] of Object.entries(fields)) {
|
|
1172
|
+
const leaf = singleLeaf(record, field);
|
|
1173
|
+
if (!leaf) continue;
|
|
1174
|
+
const { languages, substitute, smartSubstitute } = descriptor.options;
|
|
1175
|
+
const filledSet = priorFilled(prior, field);
|
|
1176
|
+
const priorLeaf = singleLeaf(prior ?? {}, field);
|
|
1177
|
+
const isUnchangedFill = (loc) => filledSet.has(loc) && priorLeaf?.[loc] !== void 0 && leaf[loc] === priorLeaf[loc];
|
|
1178
|
+
const authored = {};
|
|
1179
|
+
for (const [loc, val] of Object.entries(leaf)) {
|
|
1180
|
+
if (typeof val === "string" && val !== "" && !isUnchangedFill(loc)) authored[loc] = val;
|
|
1181
|
+
}
|
|
1182
|
+
const filled = [];
|
|
1183
|
+
for (const loc of languages) {
|
|
1184
|
+
if (authored[loc] !== void 0) continue;
|
|
1185
|
+
const sub = resolveI18nText(authored, loc, void 0, field, {
|
|
1186
|
+
policy: "substitute",
|
|
1187
|
+
substitute: substitute ?? ["any"],
|
|
1188
|
+
...smartSubstitute ? { smartSubstitute } : {}
|
|
1189
|
+
});
|
|
1190
|
+
if (typeof sub === "string" && sub !== "") {
|
|
1191
|
+
leaf[loc] = sub;
|
|
1192
|
+
filled.push(loc);
|
|
1193
|
+
} else if (isUnchangedFill(loc)) {
|
|
1194
|
+
delete leaf[loc];
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (filled.length > 0) {
|
|
1198
|
+
marker ??= {};
|
|
1199
|
+
marker[field] = filled;
|
|
1200
|
+
} else if (marker) {
|
|
1201
|
+
delete marker[field];
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
if (marker && Object.keys(marker).length > 0) {
|
|
1205
|
+
record[MARKER] = marker;
|
|
1206
|
+
} else {
|
|
1207
|
+
delete record[MARKER];
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1117
1211
|
// src/i18n/active.ts
|
|
1118
1212
|
function withI18n() {
|
|
1119
1213
|
return {
|
|
1120
1214
|
applyI18nLocale,
|
|
1121
1215
|
validateI18nTextValue,
|
|
1122
1216
|
enforceScript,
|
|
1217
|
+
computeExemptFills,
|
|
1218
|
+
densify,
|
|
1123
1219
|
buildDictionaryHandle(opts) {
|
|
1124
1220
|
return new DictionaryHandle(
|
|
1125
1221
|
opts.adapter,
|
|
@@ -1164,6 +1260,7 @@ function withI18n() {
|
|
|
1164
1260
|
resolvePolicy,
|
|
1165
1261
|
setAtPathInPlace,
|
|
1166
1262
|
staticDict,
|
|
1263
|
+
stripI18nFilled,
|
|
1167
1264
|
validateI18nTextValue,
|
|
1168
1265
|
withI18n
|
|
1169
1266
|
});
|