@noy-db/hub 0.2.0-pre.26 → 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 +403 -149
- 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-56ENKU46.js → chunk-3LHTFCU2.js} +186 -161
- package/dist/chunk-3LHTFCU2.js.map +1 -0
- package/dist/{chunk-ANLOD6IS.js → chunk-42EGY2FQ.js} +3 -3
- package/dist/{chunk-KJ37E3R5.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-EYZJULEN.js → chunk-7GKDVWMD.js} +2 -2
- package/dist/{chunk-N4EXCKWP.js → chunk-7TBCLM52.js} +2 -2
- package/dist/{chunk-VJNV2GRF.js → chunk-AHDQYG7P.js} +3 -3
- package/dist/{chunk-ZCBJIDT4.js → chunk-DCYWBKQ2.js} +2 -2
- package/dist/{chunk-Y5CTT6K5.js → chunk-DMWUOV7X.js} +2 -2
- package/dist/{chunk-RZOGD7IF.js → chunk-DQ6XF2K2.js} +6 -6
- package/dist/{chunk-OCRDV3NU.js → chunk-ENC4C6XW.js} +3 -3
- package/dist/{chunk-FCIZXX56.js → chunk-GVEUI7VR.js} +2 -2
- package/dist/{chunk-WVYL6HM7.js → chunk-HI7FY7QZ.js} +2 -2
- package/dist/{chunk-JJKXJAH2.js → chunk-HQ242WNG.js} +3 -3
- package/dist/{chunk-GHXOVGTX.js → chunk-IMY4FXYE.js} +3 -3
- package/dist/{chunk-YP2AYE5W.js → chunk-JEQB2KVI.js} +2 -2
- package/dist/chunk-M2VZQ24Q.js +220 -0
- package/dist/chunk-M2VZQ24Q.js.map +1 -0
- package/dist/{chunk-HUXDQIVU.js → chunk-PPF7Z2YQ.js} +2 -2
- package/dist/{chunk-2RHBFCWQ.js → chunk-QBC2TZHC.js} +3 -3
- package/dist/{chunk-LR7CODVN.js → chunk-QSLIT4JZ.js} +1 -1
- package/dist/chunk-QSLIT4JZ.js.map +1 -0
- package/dist/{chunk-TSUICI5N.js → chunk-RG5KLMEU.js} +2 -2
- package/dist/{chunk-GPZHHTJU.js → chunk-SWGVCSIY.js} +2 -2
- package/dist/{chunk-UNBX2HMA.js → chunk-VSL3W2MO.js} +2 -2
- package/dist/{chunk-VGAN5RLD.js → chunk-WH7G2YEE.js} +2 -2
- package/dist/{chunk-QYQRAOEF.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-CyyJUWLR.d.ts → decrypt-partition-BtGtE-19.d.ts} +1 -1
- package/dist/{decrypt-partition-C71vhnND.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-BdrE0kbS.d.cts → dev-unlock-Cts_iiVv.d.cts} +1 -1
- package/dist/{dev-unlock-ByBkl99-.d.ts → dev-unlock-D0p9cQzN.d.ts} +1 -1
- package/dist/{executor-BIW4FT5R.js → executor-PJHMRZWJ.js} +4 -4
- package/dist/{fanout-sidecar-ZQT4Y7PF.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-CZxVv8RH.d.ts → hash-BtDtwguU.d.ts} +1 -1
- package/dist/{hash-BUkDp_8Q.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-DFhKV-6A.d.ts → index-BidHvmWf.d.ts} +3 -3
- package/dist/{index-CBUhOmrM.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 +411 -146
- 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 -23
- package/dist/index.js.map +1 -1
- package/dist/{issue-LEBPVF3Y.js → issue-JSGGSVY4.js} +4 -4
- package/dist/kernel/index.cjs +61 -0
- package/dist/kernel/index.cjs.map +1 -1
- package/dist/kernel/index.d.cts +4 -4
- package/dist/kernel/index.d.ts +4 -4
- package/dist/kernel/index.js +9 -2
- package/dist/{ledger-FLRTSOYH.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-C1UbcBxP.d.ts → mime-magic--NcogI82.d.ts} +1 -1
- package/dist/{mime-magic-BAhLjkHw.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-DBKJEBBF.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-P5D3UTRX.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-NEQPCHMW.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-BSLdikC_.d.ts → transition-guard-BZhOlrFT.d.ts} +1 -1
- package/dist/{transition-guard-DPs6al8h.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-CCq0WHh9.d.ts → types-84nsWSDF.d.ts} +182 -11
- package/dist/{types-BCYvhKzr.d.cts → types-B_eCkuEI.d.cts} +182 -11
- package/dist/{with-materialized-view-DiD41wQp.d.ts → with-materialized-view-CAMGQroY.d.ts} +1 -1
- package/dist/{with-materialized-view-CTHe6uh9.d.cts → with-materialized-view-DKMaZmkJ.d.cts} +1 -1
- package/dist/{with-overlayed-view-Dlz5hcM8.d.cts → with-overlayed-view--lWXImbV.d.cts} +1 -1
- package/dist/{with-overlayed-view-DlbsJMhF.d.ts → with-overlayed-view-FnOf1v6H.d.ts} +1 -1
- package/dist/{with-rollup-BBWdrCvu.d.cts → with-rollup-C5875Ad5.d.cts} +1 -1
- package/dist/{with-rollup-mT4_CWaU.d.ts → with-rollup-xi-mkY6Y.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-56ENKU46.js.map +0 -1
- package/dist/chunk-KD253AI5.js.map +0 -1
- package/dist/chunk-LR7CODVN.js.map +0 -1
- package/dist/noydb-6FA46A4M.js +0 -38
- /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-ANLOD6IS.js.map → chunk-42EGY2FQ.js.map} +0 -0
- /package/dist/{chunk-KJ37E3R5.js.map → chunk-4FHKQDHN.js.map} +0 -0
- /package/dist/{chunk-EYZJULEN.js.map → chunk-7GKDVWMD.js.map} +0 -0
- /package/dist/{chunk-N4EXCKWP.js.map → chunk-7TBCLM52.js.map} +0 -0
- /package/dist/{chunk-VJNV2GRF.js.map → chunk-AHDQYG7P.js.map} +0 -0
- /package/dist/{chunk-ZCBJIDT4.js.map → chunk-DCYWBKQ2.js.map} +0 -0
- /package/dist/{chunk-Y5CTT6K5.js.map → chunk-DMWUOV7X.js.map} +0 -0
- /package/dist/{chunk-RZOGD7IF.js.map → chunk-DQ6XF2K2.js.map} +0 -0
- /package/dist/{chunk-OCRDV3NU.js.map → chunk-ENC4C6XW.js.map} +0 -0
- /package/dist/{chunk-FCIZXX56.js.map → chunk-GVEUI7VR.js.map} +0 -0
- /package/dist/{chunk-WVYL6HM7.js.map → chunk-HI7FY7QZ.js.map} +0 -0
- /package/dist/{chunk-JJKXJAH2.js.map → chunk-HQ242WNG.js.map} +0 -0
- /package/dist/{chunk-GHXOVGTX.js.map → chunk-IMY4FXYE.js.map} +0 -0
- /package/dist/{chunk-YP2AYE5W.js.map → chunk-JEQB2KVI.js.map} +0 -0
- /package/dist/{chunk-HUXDQIVU.js.map → chunk-PPF7Z2YQ.js.map} +0 -0
- /package/dist/{chunk-2RHBFCWQ.js.map → chunk-QBC2TZHC.js.map} +0 -0
- /package/dist/{chunk-TSUICI5N.js.map → chunk-RG5KLMEU.js.map} +0 -0
- /package/dist/{chunk-GPZHHTJU.js.map → chunk-SWGVCSIY.js.map} +0 -0
- /package/dist/{chunk-UNBX2HMA.js.map → chunk-VSL3W2MO.js.map} +0 -0
- /package/dist/{chunk-VGAN5RLD.js.map → chunk-WH7G2YEE.js.map} +0 -0
- /package/dist/{chunk-QYQRAOEF.js.map → chunk-YYLFXX2K.js.map} +0 -0
- /package/dist/{executor-BIW4FT5R.js.map → executor-PJHMRZWJ.js.map} +0 -0
- /package/dist/{fanout-sidecar-ZQT4Y7PF.js.map → fanout-sidecar-DSBVAR2P.js.map} +0 -0
- /package/dist/{issue-LEBPVF3Y.js.map → issue-JSGGSVY4.js.map} +0 -0
- /package/dist/{ledger-FLRTSOYH.js.map → ledger-PLMSH7LD.js.map} +0 -0
- /package/dist/{noydb-6FA46A4M.js.map → noydb-PHXA5E6I.js.map} +0 -0
- /package/dist/{public-envelope-DBKJEBBF.js.map → public-envelope-7MTH2PVE.js.map} +0 -0
- /package/dist/{revoke-P5D3UTRX.js.map → revoke-DBAGKIDA.js.map} +0 -0
- /package/dist/{signer-NEQPCHMW.js.map → signer-ADFJNS5W.js.map} +0 -0
- /package/dist/{stale-KKCHF2VB.js.map → stale-BCIE3SMC.js.map} +0 -0
package/dist/i18n/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { I as I18nMap, a as I18nTextDescriptor, b as I18nTextOptions, L as Layer, O as OnMissing, c as OnMissingPolicy, R as ResolveI18nOptions, d as applyI18nLocale, g as getAtPath, i as i18nText, e as isI18nTextDescriptor, r as resolveI18nText, f as resolvePolicy, s as setAtPathInPlace, v as validateI18nTextValue } from '../strategy-
|
|
2
|
-
import { I as I18nStrategy } from '../types-
|
|
3
|
-
export { D as DICT_COLLECTION_PREFIX, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, S as ScriptWarning, e as StaticDictDescriptor, f as dictCollectionName, g as dictKey, h as enforceScript, i as inferScripts, j as isDictCollectionName, k as isDictKeyDescriptor, l as isStaticDictDescriptor, s as staticDict } from '../types-
|
|
1
|
+
export { I as I18nMap, a as I18nTextDescriptor, b as I18nTextOptions, L as Layer, O as OnMissing, c as OnMissingPolicy, R as ResolveI18nOptions, d as applyI18nLocale, g as getAtPath, i as i18nText, e as isI18nTextDescriptor, r as resolveI18nText, f as resolvePolicy, s as setAtPathInPlace, h as stripI18nFilled, v as validateI18nTextValue } from '../strategy-DDNvt_UD.cjs';
|
|
2
|
+
import { I as I18nStrategy } from '../types-B_eCkuEI.cjs';
|
|
3
|
+
export { D as DICT_COLLECTION_PREFIX, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, S as ScriptWarning, e as StaticDictDescriptor, f as dictCollectionName, g as dictKey, h as enforceScript, i as inferScripts, j as isDictCollectionName, k as isDictKeyDescriptor, l as isStaticDictDescriptor, s as staticDict } from '../types-B_eCkuEI.cjs';
|
|
4
4
|
export { D as DictKeyInUseError, a as DictKeyMissingError, L as LocaleNotSpecifiedError, M as MissingTranslationError, R as ReservedCollectionNameError, S as ScriptViolationError, b as StaticDictReadonlyError, T as TranslatorNotConfiguredError, U as UnknownDictCodeError } from '../errors-Dwk2k1xY.cjs';
|
|
5
5
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
6
6
|
import '../predicate-BmhBSPCH.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
8
|
import '../index-BMmajblo.cjs';
|
|
9
|
-
import '../index-
|
|
9
|
+
import '../index-CVnt2Qmq.cjs';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { I as I18nMap, a as I18nTextDescriptor, b as I18nTextOptions, L as Layer, O as OnMissing, c as OnMissingPolicy, R as ResolveI18nOptions, d as applyI18nLocale, g as getAtPath, i as i18nText, e as isI18nTextDescriptor, r as resolveI18nText, f as resolvePolicy, s as setAtPathInPlace, v as validateI18nTextValue } from '../strategy-
|
|
2
|
-
import { I as I18nStrategy } from '../types-
|
|
3
|
-
export { D as DICT_COLLECTION_PREFIX, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, S as ScriptWarning, e as StaticDictDescriptor, f as dictCollectionName, g as dictKey, h as enforceScript, i as inferScripts, j as isDictCollectionName, k as isDictKeyDescriptor, l as isStaticDictDescriptor, s as staticDict } from '../types-
|
|
1
|
+
export { I as I18nMap, a as I18nTextDescriptor, b as I18nTextOptions, L as Layer, O as OnMissing, c as OnMissingPolicy, R as ResolveI18nOptions, d as applyI18nLocale, g as getAtPath, i as i18nText, e as isI18nTextDescriptor, r as resolveI18nText, f as resolvePolicy, s as setAtPathInPlace, h as stripI18nFilled, v as validateI18nTextValue } from '../strategy-BoITAb2H.js';
|
|
2
|
+
import { I as I18nStrategy } from '../types-84nsWSDF.js';
|
|
3
|
+
export { D as DICT_COLLECTION_PREFIX, a as DictEntry, b as DictKeyDescriptor, c as DictionaryHandle, d as DictionaryOptions, S as ScriptWarning, e as StaticDictDescriptor, f as dictCollectionName, g as dictKey, h as enforceScript, i as inferScripts, j as isDictCollectionName, k as isDictKeyDescriptor, l as isStaticDictDescriptor, s as staticDict } from '../types-84nsWSDF.js';
|
|
4
4
|
export { D as DictKeyInUseError, a as DictKeyMissingError, L as LocaleNotSpecifiedError, M as MissingTranslationError, R as ReservedCollectionNameError, S as ScriptViolationError, b as StaticDictReadonlyError, T as TranslatorNotConfiguredError, U as UnknownDictCodeError } from '../errors-Dwk2k1xY.js';
|
|
5
5
|
import '../lazy-builder-ChSqcF5t.js';
|
|
6
6
|
import '../predicate-BmhBSPCH.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
8
|
import '../index-BMmajblo.js';
|
|
9
|
-
import '../index-
|
|
9
|
+
import '../index-DxBNV54L.js';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/i18n/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isDictKeyDescriptor,
|
|
8
8
|
isStaticDictDescriptor,
|
|
9
9
|
staticDict
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-HQ242WNG.js";
|
|
11
11
|
import {
|
|
12
12
|
applyI18nLocale,
|
|
13
13
|
enforceScript,
|
|
@@ -18,11 +18,12 @@ import {
|
|
|
18
18
|
resolveI18nText,
|
|
19
19
|
resolvePolicy,
|
|
20
20
|
setAtPathInPlace,
|
|
21
|
+
stripI18nFilled,
|
|
21
22
|
validateI18nTextValue
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-6LD37AMK.js";
|
|
24
|
+
import "../chunk-VSL3W2MO.js";
|
|
24
25
|
import "../chunk-PDVP3C2I.js";
|
|
25
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-QSLIT4JZ.js";
|
|
26
27
|
import "../chunk-7JSP3E67.js";
|
|
27
28
|
import {
|
|
28
29
|
DictKeyInUseError,
|
|
@@ -36,12 +37,89 @@ import {
|
|
|
36
37
|
UnknownDictCodeError
|
|
37
38
|
} from "../chunk-DDOYOMAD.js";
|
|
38
39
|
|
|
40
|
+
// src/i18n/densify.ts
|
|
41
|
+
var MARKER = "_i18nFilled";
|
|
42
|
+
function priorFilled(prior, field) {
|
|
43
|
+
if (!prior) return /* @__PURE__ */ new Set();
|
|
44
|
+
const marker = prior[MARKER];
|
|
45
|
+
return new Set(marker?.[field] ?? []);
|
|
46
|
+
}
|
|
47
|
+
function singleLeaf(record, field) {
|
|
48
|
+
const leaves = getAtPath(record, field);
|
|
49
|
+
if (leaves.length !== 1) return void 0;
|
|
50
|
+
const leaf = leaves[0];
|
|
51
|
+
if (!leaf || typeof leaf !== "object" || Array.isArray(leaf)) return void 0;
|
|
52
|
+
return leaf;
|
|
53
|
+
}
|
|
54
|
+
function computeExemptFills(prior, incoming, fields) {
|
|
55
|
+
const out = /* @__PURE__ */ new Map();
|
|
56
|
+
if (!prior) return out;
|
|
57
|
+
for (const field of Object.keys(fields)) {
|
|
58
|
+
const filled = priorFilled(prior, field);
|
|
59
|
+
if (filled.size === 0) continue;
|
|
60
|
+
const priorLeaf = singleLeaf(prior, field);
|
|
61
|
+
const incLeaf = singleLeaf(incoming, field);
|
|
62
|
+
if (!priorLeaf || !incLeaf) continue;
|
|
63
|
+
const exempt = /* @__PURE__ */ new Set();
|
|
64
|
+
for (const loc of filled) {
|
|
65
|
+
if (incLeaf[loc] !== void 0 && incLeaf[loc] !== "" && incLeaf[loc] === priorLeaf[loc]) {
|
|
66
|
+
exempt.add(loc);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (exempt.size > 0) out.set(field, exempt);
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
function densify(record, prior, fields) {
|
|
74
|
+
let marker = record[MARKER];
|
|
75
|
+
for (const [field, descriptor] of Object.entries(fields)) {
|
|
76
|
+
const leaf = singleLeaf(record, field);
|
|
77
|
+
if (!leaf) continue;
|
|
78
|
+
const { languages, substitute, smartSubstitute } = descriptor.options;
|
|
79
|
+
const filledSet = priorFilled(prior, field);
|
|
80
|
+
const priorLeaf = singleLeaf(prior ?? {}, field);
|
|
81
|
+
const isUnchangedFill = (loc) => filledSet.has(loc) && priorLeaf?.[loc] !== void 0 && leaf[loc] === priorLeaf[loc];
|
|
82
|
+
const authored = {};
|
|
83
|
+
for (const [loc, val] of Object.entries(leaf)) {
|
|
84
|
+
if (typeof val === "string" && val !== "" && !isUnchangedFill(loc)) authored[loc] = val;
|
|
85
|
+
}
|
|
86
|
+
const filled = [];
|
|
87
|
+
for (const loc of languages) {
|
|
88
|
+
if (authored[loc] !== void 0) continue;
|
|
89
|
+
const sub = resolveI18nText(authored, loc, void 0, field, {
|
|
90
|
+
policy: "substitute",
|
|
91
|
+
substitute: substitute ?? ["any"],
|
|
92
|
+
...smartSubstitute ? { smartSubstitute } : {}
|
|
93
|
+
});
|
|
94
|
+
if (typeof sub === "string" && sub !== "") {
|
|
95
|
+
leaf[loc] = sub;
|
|
96
|
+
filled.push(loc);
|
|
97
|
+
} else if (isUnchangedFill(loc)) {
|
|
98
|
+
delete leaf[loc];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (filled.length > 0) {
|
|
102
|
+
marker ??= {};
|
|
103
|
+
marker[field] = filled;
|
|
104
|
+
} else if (marker) {
|
|
105
|
+
delete marker[field];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (marker && Object.keys(marker).length > 0) {
|
|
109
|
+
record[MARKER] = marker;
|
|
110
|
+
} else {
|
|
111
|
+
delete record[MARKER];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
39
115
|
// src/i18n/active.ts
|
|
40
116
|
function withI18n() {
|
|
41
117
|
return {
|
|
42
118
|
applyI18nLocale,
|
|
43
119
|
validateI18nTextValue,
|
|
44
120
|
enforceScript,
|
|
121
|
+
computeExemptFills,
|
|
122
|
+
densify,
|
|
45
123
|
buildDictionaryHandle(opts) {
|
|
46
124
|
return new DictionaryHandle(
|
|
47
125
|
opts.adapter,
|
|
@@ -85,6 +163,7 @@ export {
|
|
|
85
163
|
resolvePolicy,
|
|
86
164
|
setAtPathInPlace,
|
|
87
165
|
staticDict,
|
|
166
|
+
stripI18nFilled,
|
|
88
167
|
validateI18nTextValue,
|
|
89
168
|
withI18n
|
|
90
169
|
};
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i18n/active.ts"],"sourcesContent":["/**\n * Active i18n strategy — `withI18n()` returns the real implementation\n * that wires multi-locale resolution, i18nText validation, and the\n * `DictionaryHandle` for `dictKey` fields into the core read/write\n * paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withI18n } from '@noy-db/hub/i18n'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * i18nStrategy: withI18n(),\n * })\n * ```\n *\n * The factory delegates to the existing `core.ts` and `dictionary.ts`\n * modules. Splitting the import chain through this file is what lets\n * tsup tree-shake the `~854 LOC` of dictionary + locale resolution\n * out of the default bundle when no `withI18n()` import is present.\n *\n * @public\n */\n\nimport type { I18nStrategy, BuildDictionaryHandleOptions } from './strategy.js'\nimport { applyI18nLocale, validateI18nTextValue } from './core.js'\nimport { enforceScript } from './script.js'\nimport { DictionaryHandle } from './dictionary.js'\n\nexport function withI18n(): I18nStrategy {\n return {\n applyI18nLocale,\n validateI18nTextValue,\n enforceScript,\n buildDictionaryHandle<Keys extends string = string>(\n opts: BuildDictionaryHandleOptions<Keys>,\n ): DictionaryHandle<Keys> {\n return new DictionaryHandle<Keys>(\n opts.adapter,\n opts.compartmentName,\n opts.dictionaryName,\n opts.keyring,\n opts.getDEK,\n opts.encrypted,\n opts.ledger,\n opts.options,\n opts.findAndUpdateReferences,\n opts.emitter,\n )\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/densify.ts","../../src/i18n/active.ts"],"sourcesContent":["/**\n * #435 v1.x densifyOnWrite — eager-fill empty i18n slots from each field's\n * substitute chain at write time, recording provenance in the internal\n * `_i18nFilled` marker (decision A: dense map + prior-read).\n *\n * Pure functions over plain records; all DB wiring lives in collection.ts.\n * Only single-leaf i18n fields are supported (array-wildcard paths are\n * skipped, mirroring auto-translate).\n */\nimport { getAtPath, resolveI18nText } from './core.js'\nimport type { I18nTextDescriptor } from './core.js'\n\nconst MARKER = '_i18nFilled'\n\ntype Leaf = Record<string, string>\n\n/** Locales recorded as densify-filled on the prior record for `field`. */\nfunction priorFilled(prior: Record<string, unknown> | undefined, field: string): Set<string> {\n if (!prior) return new Set()\n const marker = prior[MARKER] as Record<string, string[]> | undefined\n return new Set(marker?.[field] ?? [])\n}\n\n/** The single leaf map for `field`, or undefined for absent / array-wildcard / non-object. */\nfunction singleLeaf(record: Record<string, unknown>, field: string): Leaf | undefined {\n const leaves = getAtPath(record, field)\n if (leaves.length !== 1) return undefined\n const leaf = leaves[0]\n if (!leaf || typeof leaf !== 'object' || Array.isArray(leaf)) return undefined\n return leaf as Leaf\n}\n\n/**\n * Per field, the locales that are UNCHANGED round-tripped densify fills — i.e.\n * marked filled on the prior record AND identical in the incoming record.\n * These are exempt from write-time script enforcement (they are derived copies,\n * not authored text). Slots the user changed are NOT exempt (validated as authored).\n */\nexport function computeExemptFills(\n prior: Record<string, unknown> | undefined,\n incoming: Record<string, unknown>,\n fields: Record<string, I18nTextDescriptor>,\n): Map<string, Set<string>> {\n const out = new Map<string, Set<string>>()\n if (!prior) return out\n for (const field of Object.keys(fields)) {\n const filled = priorFilled(prior, field)\n if (filled.size === 0) continue\n const priorLeaf = singleLeaf(prior, field)\n const incLeaf = singleLeaf(incoming, field)\n if (!priorLeaf || !incLeaf) continue\n const exempt = new Set<string>()\n for (const loc of filled) {\n if (incLeaf[loc] !== undefined && incLeaf[loc] !== '' && incLeaf[loc] === priorLeaf[loc]) {\n exempt.add(loc)\n }\n }\n if (exempt.size > 0) out.set(field, exempt)\n }\n return out\n}\n\n/**\n * Mutate `record` in place: fill empty declared-language slots for each\n * densify-enabled field from the field's substitute chain, recompute unchanged\n * prior fills, clear marks for slots that became authored, and write the\n * resulting `_i18nFilled` marker (removed when empty).\n *\n * `prior` is read-only — it is never mutated.\n *\n * Provenance uses value-equality (decision A): a slot counts as an unchanged\n * fill when it was prior-marked AND its value still equals the prior value. A\n * consequence is that re-authoring a value byte-identical to the existing fill\n * keeps it classified as a fill (the visible value is unchanged either way; the\n * slot stays script-exempt and will auto-refresh if its source later changes).\n * This is inherent to value-equality provenance, not a bug.\n */\nexport function densify(\n record: Record<string, unknown>,\n prior: Record<string, unknown> | undefined,\n fields: Record<string, I18nTextDescriptor>,\n): void {\n let marker = record[MARKER] as Record<string, string[]> | undefined\n\n for (const [field, descriptor] of Object.entries(fields)) {\n const leaf = singleLeaf(record, field)\n if (!leaf) continue\n const { languages, substitute, smartSubstitute } = descriptor.options\n const filledSet = priorFilled(prior, field)\n const priorLeaf = singleLeaf(prior ?? {}, field)\n const isUnchangedFill = (loc: string): boolean =>\n filledSet.has(loc) && priorLeaf?.[loc] !== undefined && leaf[loc] === priorLeaf[loc]\n\n // Authored source = present, non-empty, NOT an unchanged prior fill.\n const authored: Leaf = {}\n for (const [loc, val] of Object.entries(leaf)) {\n if (typeof val === 'string' && val !== '' && !isUnchangedFill(loc)) authored[loc] = val\n }\n\n const filled: string[] = []\n for (const loc of languages) {\n if (authored[loc] !== undefined) continue // real value present → not a fill\n const sub = resolveI18nText(authored, loc, undefined, field, {\n policy: 'substitute',\n substitute: substitute ?? ['any'],\n ...(smartSubstitute ? { smartSubstitute } : {}),\n })\n if (typeof sub === 'string' && sub !== '') {\n leaf[loc] = sub\n filled.push(loc)\n } else if (isUnchangedFill(loc)) {\n delete leaf[loc] // stale fill with no source left → drop it\n }\n }\n\n if (filled.length > 0) {\n marker ??= {}\n marker[field] = filled\n } else if (marker) {\n delete marker[field]\n }\n }\n\n if (marker && Object.keys(marker).length > 0) {\n record[MARKER] = marker\n } else {\n delete record[MARKER]\n }\n}\n","/**\n * Active i18n strategy — `withI18n()` returns the real implementation\n * that wires multi-locale resolution, i18nText validation, and the\n * `DictionaryHandle` for `dictKey` fields into the core read/write\n * paths.\n *\n * Consumers opt in by:\n *\n * ```ts\n * import { createNoydb } from '@noy-db/hub'\n * import { withI18n } from '@noy-db/hub/i18n'\n *\n * const db = await createNoydb({\n * store: ...,\n * user: ...,\n * i18nStrategy: withI18n(),\n * })\n * ```\n *\n * The factory delegates to the existing `core.ts` and `dictionary.ts`\n * modules. Splitting the import chain through this file is what lets\n * tsup tree-shake the `~854 LOC` of dictionary + locale resolution\n * out of the default bundle when no `withI18n()` import is present.\n *\n * @public\n */\n\nimport type { I18nStrategy, BuildDictionaryHandleOptions } from './strategy.js'\nimport { applyI18nLocale, validateI18nTextValue } from './core.js'\nimport { enforceScript } from './script.js'\nimport { computeExemptFills, densify } from './densify.js'\nimport { DictionaryHandle } from './dictionary.js'\n\nexport function withI18n(): I18nStrategy {\n return {\n applyI18nLocale,\n validateI18nTextValue,\n enforceScript,\n computeExemptFills,\n densify,\n buildDictionaryHandle<Keys extends string = string>(\n opts: BuildDictionaryHandleOptions<Keys>,\n ): DictionaryHandle<Keys> {\n return new DictionaryHandle<Keys>(\n opts.adapter,\n opts.compartmentName,\n opts.dictionaryName,\n opts.keyring,\n opts.getDEK,\n opts.encrypted,\n opts.ledger,\n opts.options,\n opts.findAndUpdateReferences,\n opts.emitter,\n )\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAM,SAAS;AAKf,SAAS,YAAY,OAA4C,OAA4B;AAC3F,MAAI,CAAC,MAAO,QAAO,oBAAI,IAAI;AAC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AK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './predicate-BmhBSPCH.js';
|
|
2
|
-
import './strategy-
|
|
2
|
+
import './strategy-BoITAb2H.js';
|
|
3
3
|
import './ulid-DRH25k3y.js';
|
|
4
|
+
import './types-84nsWSDF.js';
|
|
4
5
|
import './errors-Dwk2k1xY.js';
|
|
5
|
-
import './
|
|
6
|
-
import './index-LaexBi3v.js';
|
|
6
|
+
import './index-DxBNV54L.js';
|
|
7
7
|
|
|
8
8
|
interface EncryptResult {
|
|
9
9
|
iv: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import './predicate-BmhBSPCH.cjs';
|
|
2
|
-
import './strategy-
|
|
2
|
+
import './strategy-DDNvt_UD.cjs';
|
|
3
3
|
import './ulid-DRH25k3y.cjs';
|
|
4
|
+
import './types-B_eCkuEI.cjs';
|
|
4
5
|
import './errors-Dwk2k1xY.cjs';
|
|
5
|
-
import './
|
|
6
|
-
import './index-DoxKSsMj.cjs';
|
|
6
|
+
import './index-CVnt2Qmq.cjs';
|
|
7
7
|
|
|
8
8
|
interface EncryptResult {
|
|
9
9
|
iv: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as CollectionIndexes, a as Clause, O as Operator } from './predicate-BmhBSPCH.cjs';
|
|
2
2
|
import { N as NoydbError } from './errors-Dwk2k1xY.cjs';
|
|
3
|
-
import { a as I18nTextDescriptor,
|
|
3
|
+
import { a as I18nTextDescriptor, P as MoneyDescriptor, A as AggregateStrategy, k as AggregateSpec, l as Aggregation, j as AggregateResult, p as GroupedQuery, q as GroupedQueryN } from './strategy-DDNvt_UD.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Foreign-key references — the soft-FK mechanism.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as CollectionIndexes, a as Clause, O as Operator } from './predicate-BmhBSPCH.js';
|
|
2
2
|
import { N as NoydbError } from './errors-Dwk2k1xY.js';
|
|
3
|
-
import { a as I18nTextDescriptor,
|
|
3
|
+
import { a as I18nTextDescriptor, P as MoneyDescriptor, A as AggregateStrategy, k as AggregateSpec, l as Aggregation, j as AggregateResult, p as GroupedQuery, q as GroupedQueryN } from './strategy-BoITAb2H.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Foreign-key references — the soft-FK mechanism.
|