lingo.dev 0.78.11 → 0.78.12
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/build/cli.cjs +63 -46
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +18 -1
- package/build/cli.mjs.map +1 -1
- package/package.json +1 -1
package/build/cli.cjs
CHANGED
|
@@ -23,6 +23,7 @@ function getSettings(explicitApiKey) {
|
|
|
23
23
|
const systemFile = _loadSystemFile();
|
|
24
24
|
const defaults = _loadDefaults();
|
|
25
25
|
_legacyEnvVarWarning();
|
|
26
|
+
_envVarsInfo();
|
|
26
27
|
return {
|
|
27
28
|
auth: {
|
|
28
29
|
apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _22 => _22.auth, 'optionalAccess', _23 => _23.apiKey]) || defaults.auth.apiKey,
|
|
@@ -95,6 +96,22 @@ Please use LINGODOTDEV_API_KEY instead.
|
|
|
95
96
|
);
|
|
96
97
|
}
|
|
97
98
|
}
|
|
99
|
+
function _envVarsInfo() {
|
|
100
|
+
const env = _loadEnv();
|
|
101
|
+
const systemFile = _loadSystemFile();
|
|
102
|
+
if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _28 => _28.auth, 'optionalAccess', _29 => _29.apiKey])) {
|
|
103
|
+
console.info(
|
|
104
|
+
"\x1B[36m%s\x1B[0m",
|
|
105
|
+
`\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from login flow (saved in .lingodotdevrc)`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
if (env.LINGODOTDEV_API_URL) {
|
|
109
|
+
console.info("\x1B[36m%s\x1B[0m", `\u2139\uFE0F Using LINGODOTDEV_API_URL: ${env.LINGODOTDEV_API_URL}`);
|
|
110
|
+
}
|
|
111
|
+
if (env.LINGODOTDEV_WEB_URL) {
|
|
112
|
+
console.info("\x1B[36m%s\x1B[0m", `\u2139\uFE0F Using LINGODOTDEV_WEB_URL: ${env.LINGODOTDEV_WEB_URL}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
98
115
|
|
|
99
116
|
// src/cli/utils/errors.ts
|
|
100
117
|
var docLinks = {
|
|
@@ -137,7 +154,7 @@ function createAuthenticator(params) {
|
|
|
137
154
|
});
|
|
138
155
|
if (res.ok) {
|
|
139
156
|
const payload = await res.json();
|
|
140
|
-
if (!_optionalChain([payload, 'optionalAccess',
|
|
157
|
+
if (!_optionalChain([payload, 'optionalAccess', _30 => _30.email])) {
|
|
141
158
|
return null;
|
|
142
159
|
}
|
|
143
160
|
return {
|
|
@@ -755,7 +772,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
755
772
|
});
|
|
756
773
|
const auth2 = await newAuthenticator.whoami();
|
|
757
774
|
if (auth2) {
|
|
758
|
-
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess',
|
|
775
|
+
_ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _31 => _31.email])}`);
|
|
759
776
|
} else {
|
|
760
777
|
_ora2.default.call(void 0, ).fail("Authentication failed.");
|
|
761
778
|
}
|
|
@@ -835,7 +852,7 @@ var locale_default = new (0, _interactivecommander.Command)().command("locale").
|
|
|
835
852
|
function getBuckets(i18nConfig) {
|
|
836
853
|
const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
|
|
837
854
|
const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
|
|
838
|
-
const excludeItems = _optionalChain([bucketEntry, 'access',
|
|
855
|
+
const excludeItems = _optionalChain([bucketEntry, 'access', _32 => _32.exclude, 'optionalAccess', _33 => _33.map, 'call', _34 => _34((item) => resolveBucketItem(item))]);
|
|
839
856
|
return {
|
|
840
857
|
type: bucketType,
|
|
841
858
|
config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
|
|
@@ -852,7 +869,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
|
|
|
852
869
|
})
|
|
853
870
|
)
|
|
854
871
|
);
|
|
855
|
-
const excludedPatterns = _optionalChain([exclude, 'optionalAccess',
|
|
872
|
+
const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _35 => _35.flatMap, 'call', _36 => _36(
|
|
856
873
|
(pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
|
|
857
874
|
(pathPattern) => ({
|
|
858
875
|
pathPattern,
|
|
@@ -977,12 +994,12 @@ function composeLoaders(...loaders) {
|
|
|
977
994
|
return {
|
|
978
995
|
init: async () => {
|
|
979
996
|
for (const loader of loaders) {
|
|
980
|
-
await _optionalChain([loader, 'access',
|
|
997
|
+
await _optionalChain([loader, 'access', _37 => _37.init, 'optionalCall', _38 => _38()]);
|
|
981
998
|
}
|
|
982
999
|
},
|
|
983
1000
|
setDefaultLocale(locale) {
|
|
984
1001
|
for (const loader of loaders) {
|
|
985
|
-
_optionalChain([loader, 'access',
|
|
1002
|
+
_optionalChain([loader, 'access', _39 => _39.setDefaultLocale, 'optionalCall', _40 => _40(locale)]);
|
|
986
1003
|
}
|
|
987
1004
|
return this;
|
|
988
1005
|
},
|
|
@@ -1013,7 +1030,7 @@ function createLoader(lDefinition) {
|
|
|
1013
1030
|
if (state.initCtx) {
|
|
1014
1031
|
return state.initCtx;
|
|
1015
1032
|
}
|
|
1016
|
-
state.initCtx = await _optionalChain([lDefinition, 'access',
|
|
1033
|
+
state.initCtx = await _optionalChain([lDefinition, 'access', _41 => _41.init, 'optionalCall', _42 => _42()]);
|
|
1017
1034
|
return state.initCtx;
|
|
1018
1035
|
},
|
|
1019
1036
|
setDefaultLocale(locale) {
|
|
@@ -1102,7 +1119,7 @@ function createNormalizeLoader() {
|
|
|
1102
1119
|
return normalized;
|
|
1103
1120
|
},
|
|
1104
1121
|
push: async (locale, data, originalInput) => {
|
|
1105
|
-
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess',
|
|
1122
|
+
const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _43 => _43.keysMap]), () => ( {}));
|
|
1106
1123
|
const input2 = mapDenormalizedKeys(data, keysMap);
|
|
1107
1124
|
const denormalized = _flat.unflatten.call(void 0, input2, {
|
|
1108
1125
|
delimiter: "/",
|
|
@@ -1205,8 +1222,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
|
|
|
1205
1222
|
if (!templateData) {
|
|
1206
1223
|
templateData = await readFileForLocale(pathPattern, originalLocale);
|
|
1207
1224
|
}
|
|
1208
|
-
if (_optionalChain([templateData, 'optionalAccess',
|
|
1209
|
-
const ending = _optionalChain([templateData, 'optionalAccess',
|
|
1225
|
+
if (_optionalChain([templateData, 'optionalAccess', _44 => _44.match, 'call', _45 => _45(/[\r\n]$/)])) {
|
|
1226
|
+
const ending = _optionalChain([templateData, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _48 => _48.includes, 'call', _49 => _49("\r")]) ? "\r" : "\n";
|
|
1210
1227
|
return ending;
|
|
1211
1228
|
}
|
|
1212
1229
|
return "";
|
|
@@ -1461,7 +1478,7 @@ function createHtmlLoader() {
|
|
|
1461
1478
|
break;
|
|
1462
1479
|
}
|
|
1463
1480
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1464
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1481
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _50 => _50.textContent, 'optionalAccess', _51 => _51.trim, 'call', _52 => _52()])
|
|
1465
1482
|
);
|
|
1466
1483
|
const index = siblings.indexOf(current);
|
|
1467
1484
|
if (index !== -1) {
|
|
@@ -1496,11 +1513,11 @@ function createHtmlLoader() {
|
|
|
1496
1513
|
result[getPath(element, attr)] = value;
|
|
1497
1514
|
}
|
|
1498
1515
|
});
|
|
1499
|
-
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1516
|
+
Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _53 => _53.textContent, 'optionalAccess', _54 => _54.trim, 'call', _55 => _55()])).forEach(processNode);
|
|
1500
1517
|
}
|
|
1501
1518
|
};
|
|
1502
|
-
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1503
|
-
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1519
|
+
Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _56 => _56.textContent, 'optionalAccess', _57 => _57.trim, 'call', _58 => _58()])).forEach(processNode);
|
|
1520
|
+
Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])).forEach(processNode);
|
|
1504
1521
|
return result;
|
|
1505
1522
|
},
|
|
1506
1523
|
async push(locale, data, originalInput) {
|
|
@@ -1522,7 +1539,7 @@ function createHtmlLoader() {
|
|
|
1522
1539
|
for (let i = 0; i < indices.length; i++) {
|
|
1523
1540
|
const index = parseInt(indices[i]);
|
|
1524
1541
|
const siblings = Array.from(parent.childNodes).filter(
|
|
1525
|
-
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access',
|
|
1542
|
+
(n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])
|
|
1526
1543
|
);
|
|
1527
1544
|
if (index >= siblings.length) {
|
|
1528
1545
|
if (i === indices.length - 1) {
|
|
@@ -1573,7 +1590,7 @@ function createMarkdownLoader() {
|
|
|
1573
1590
|
yaml: yamlEngine
|
|
1574
1591
|
}
|
|
1575
1592
|
});
|
|
1576
|
-
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess',
|
|
1593
|
+
const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _65 => _65.trim, 'call', _66 => _66()]), () => ( ""))).filter(Boolean);
|
|
1577
1594
|
return {
|
|
1578
1595
|
...Object.fromEntries(
|
|
1579
1596
|
sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
|
|
@@ -1585,7 +1602,7 @@ function createMarkdownLoader() {
|
|
|
1585
1602
|
const frontmatter = Object.fromEntries(
|
|
1586
1603
|
Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
|
|
1587
1604
|
);
|
|
1588
|
-
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
1605
|
+
let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]), () => ( ""))).filter(Boolean).join("\n\n");
|
|
1589
1606
|
if (Object.keys(frontmatter).length > 0) {
|
|
1590
1607
|
content = `
|
|
1591
1608
|
${content}`;
|
|
@@ -1629,7 +1646,7 @@ function isSkippableLine(line) {
|
|
|
1629
1646
|
function parsePropertyLine(line) {
|
|
1630
1647
|
const [key, ...valueParts] = line.split("=");
|
|
1631
1648
|
return {
|
|
1632
|
-
key: _optionalChain([key, 'optionalAccess',
|
|
1649
|
+
key: _optionalChain([key, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()]) || "",
|
|
1633
1650
|
value: valueParts.join("=").trim()
|
|
1634
1651
|
};
|
|
1635
1652
|
}
|
|
@@ -1715,7 +1732,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1715
1732
|
if (rootTranslationEntity.shouldTranslate === false) {
|
|
1716
1733
|
continue;
|
|
1717
1734
|
}
|
|
1718
|
-
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess',
|
|
1735
|
+
const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _71 => _71.localizations, 'optionalAccess', _72 => _72[locale]]);
|
|
1719
1736
|
if (langTranslationEntity) {
|
|
1720
1737
|
if ("stringUnit" in langTranslationEntity) {
|
|
1721
1738
|
resultData[translationKey] = langTranslationEntity.stringUnit.value;
|
|
@@ -1724,7 +1741,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1724
1741
|
resultData[translationKey] = {};
|
|
1725
1742
|
const pluralForms = langTranslationEntity.variations.plural;
|
|
1726
1743
|
for (const form in pluralForms) {
|
|
1727
|
-
if (_optionalChain([pluralForms, 'access',
|
|
1744
|
+
if (_optionalChain([pluralForms, 'access', _73 => _73[form], 'optionalAccess', _74 => _74.stringUnit, 'optionalAccess', _75 => _75.value])) {
|
|
1728
1745
|
resultData[translationKey][form] = pluralForms[form].stringUnit.value;
|
|
1729
1746
|
}
|
|
1730
1747
|
}
|
|
@@ -1748,7 +1765,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
|
|
|
1748
1765
|
const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
|
|
1749
1766
|
if (typeof value === "string") {
|
|
1750
1767
|
langDataToMerge.strings[key] = {
|
|
1751
|
-
extractionState: _optionalChain([originalInput, 'optionalAccess',
|
|
1768
|
+
extractionState: _optionalChain([originalInput, 'optionalAccess', _76 => _76.strings, 'optionalAccess', _77 => _77[key], 'optionalAccess', _78 => _78.extractionState]),
|
|
1752
1769
|
localizations: {
|
|
1753
1770
|
[locale]: {
|
|
1754
1771
|
stringUnit: {
|
|
@@ -1894,7 +1911,7 @@ function createPoDataLoader(params) {
|
|
|
1894
1911
|
Object.entries(entries).forEach(([msgid, entry]) => {
|
|
1895
1912
|
if (msgid && entry.msgid) {
|
|
1896
1913
|
const context = entry.msgctxt || "";
|
|
1897
|
-
const fullEntry = _optionalChain([parsedPo, 'access',
|
|
1914
|
+
const fullEntry = _optionalChain([parsedPo, 'access', _79 => _79.translations, 'access', _80 => _80[context], 'optionalAccess', _81 => _81[msgid]]);
|
|
1898
1915
|
if (fullEntry) {
|
|
1899
1916
|
result[msgid] = fullEntry;
|
|
1900
1917
|
}
|
|
@@ -1904,7 +1921,7 @@ function createPoDataLoader(params) {
|
|
|
1904
1921
|
return result;
|
|
1905
1922
|
},
|
|
1906
1923
|
async push(locale, data, originalInput) {
|
|
1907
|
-
const sections = _optionalChain([originalInput, 'optionalAccess',
|
|
1924
|
+
const sections = _optionalChain([originalInput, 'optionalAccess', _82 => _82.split, 'call', _83 => _83("\n\n"), 'access', _84 => _84.filter, 'call', _85 => _85(Boolean)]) || [];
|
|
1908
1925
|
const result = sections.map((section) => {
|
|
1909
1926
|
const sectionPo = _gettextparser2.default.po.parse(section);
|
|
1910
1927
|
const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
|
|
@@ -1946,7 +1963,7 @@ function createPoContentLoader() {
|
|
|
1946
1963
|
entry.msgid,
|
|
1947
1964
|
{
|
|
1948
1965
|
...entry,
|
|
1949
|
-
msgstr: [_optionalChain([data, 'access',
|
|
1966
|
+
msgstr: [_optionalChain([data, 'access', _86 => _86[entry.msgid], 'optionalAccess', _87 => _87.singular]), _optionalChain([data, 'access', _88 => _88[entry.msgid], 'optionalAccess', _89 => _89.plural]) || null].filter(Boolean)
|
|
1950
1967
|
}
|
|
1951
1968
|
]).fromPairs().value();
|
|
1952
1969
|
return result;
|
|
@@ -2192,7 +2209,7 @@ function createDatoClient(params) {
|
|
|
2192
2209
|
only_valid: "true",
|
|
2193
2210
|
ids: !records.length ? void 0 : records.join(",")
|
|
2194
2211
|
}
|
|
2195
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2212
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _90 => _90.response, 'optionalAccess', _91 => _91.body, 'optionalAccess', _92 => _92.data, 'optionalAccess', _93 => _93[0]]) || error));
|
|
2196
2213
|
},
|
|
2197
2214
|
findRecordsForModel: async (modelId, records) => {
|
|
2198
2215
|
try {
|
|
@@ -2202,9 +2219,9 @@ function createDatoClient(params) {
|
|
|
2202
2219
|
filter: {
|
|
2203
2220
|
type: modelId,
|
|
2204
2221
|
only_valid: "true",
|
|
2205
|
-
ids: !_optionalChain([records, 'optionalAccess',
|
|
2222
|
+
ids: !_optionalChain([records, 'optionalAccess', _94 => _94.length]) ? void 0 : records.join(",")
|
|
2206
2223
|
}
|
|
2207
|
-
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2224
|
+
}).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _95 => _95.response, 'optionalAccess', _96 => _96.body, 'optionalAccess', _97 => _97.data, 'optionalAccess', _98 => _98[0]]) || error));
|
|
2208
2225
|
return result;
|
|
2209
2226
|
} catch (_error) {
|
|
2210
2227
|
throw new Error(
|
|
@@ -2218,9 +2235,9 @@ function createDatoClient(params) {
|
|
|
2218
2235
|
},
|
|
2219
2236
|
updateRecord: async (id, payload) => {
|
|
2220
2237
|
try {
|
|
2221
|
-
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2238
|
+
await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _99 => _99.response, 'optionalAccess', _100 => _100.body, 'optionalAccess', _101 => _101.data, 'optionalAccess', _102 => _102[0]]) || error));
|
|
2222
2239
|
} catch (_error) {
|
|
2223
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2240
|
+
if (_optionalChain([_error, 'optionalAccess', _103 => _103.attributes, 'optionalAccess', _104 => _104.details, 'optionalAccess', _105 => _105.message])) {
|
|
2224
2241
|
throw new Error(
|
|
2225
2242
|
[
|
|
2226
2243
|
`${_error.attributes.details.message}`,
|
|
@@ -2241,9 +2258,9 @@ function createDatoClient(params) {
|
|
|
2241
2258
|
},
|
|
2242
2259
|
enableFieldLocalization: async (args) => {
|
|
2243
2260
|
try {
|
|
2244
|
-
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess',
|
|
2261
|
+
await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _106 => _106.response, 'optionalAccess', _107 => _107.body, 'optionalAccess', _108 => _108.data, 'optionalAccess', _109 => _109[0]]) || error));
|
|
2245
2262
|
} catch (_error) {
|
|
2246
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2263
|
+
if (_optionalChain([_error, 'optionalAccess', _110 => _110.attributes, 'optionalAccess', _111 => _111.code]) === "NOT_FOUND") {
|
|
2247
2264
|
throw new Error(
|
|
2248
2265
|
[
|
|
2249
2266
|
`Field "${args.fieldId}" not found in model "${args.modelId}".`,
|
|
@@ -2251,7 +2268,7 @@ function createDatoClient(params) {
|
|
|
2251
2268
|
].join("\n\n")
|
|
2252
2269
|
);
|
|
2253
2270
|
}
|
|
2254
|
-
if (_optionalChain([_error, 'optionalAccess',
|
|
2271
|
+
if (_optionalChain([_error, 'optionalAccess', _112 => _112.attributes, 'optionalAccess', _113 => _113.details, 'optionalAccess', _114 => _114.message])) {
|
|
2255
2272
|
throw new Error(
|
|
2256
2273
|
[`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
|
|
2257
2274
|
);
|
|
@@ -2317,7 +2334,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2317
2334
|
}
|
|
2318
2335
|
}
|
|
2319
2336
|
const records = await dato.findRecordsForModel(modelId);
|
|
2320
|
-
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access',
|
|
2337
|
+
const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _115 => _115.models, 'access', _116 => _116[modelId], 'optionalAccess', _117 => _117.records]) || [], project);
|
|
2321
2338
|
const selectedRecords = await promptRecordSelection(modelName, recordChoices);
|
|
2322
2339
|
result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
|
|
2323
2340
|
updatedConfig.models[modelId].records = selectedRecords;
|
|
@@ -2329,14 +2346,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
|
|
|
2329
2346
|
},
|
|
2330
2347
|
async pull(locale, input2, initCtx) {
|
|
2331
2348
|
const result = {};
|
|
2332
|
-
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess',
|
|
2333
|
-
let records = _optionalChain([initCtx, 'optionalAccess',
|
|
2349
|
+
for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _118 => _118.models]) || {})) {
|
|
2350
|
+
let records = _optionalChain([initCtx, 'optionalAccess', _119 => _119.models, 'access', _120 => _120[modelId], 'access', _121 => _121.records]) || [];
|
|
2334
2351
|
const recordIds = records.map((record) => record.id);
|
|
2335
2352
|
records = await dato.findRecords(recordIds);
|
|
2336
2353
|
console.log(`Fetched ${records.length} records for model ${modelId}`);
|
|
2337
2354
|
if (records.length > 0) {
|
|
2338
2355
|
result[modelId] = {
|
|
2339
|
-
fields: _optionalChain([initCtx, 'optionalAccess',
|
|
2356
|
+
fields: _optionalChain([initCtx, 'optionalAccess', _122 => _122.models, 'optionalAccess', _123 => _123[modelId], 'optionalAccess', _124 => _124.fields]) || [],
|
|
2340
2357
|
records
|
|
2341
2358
|
};
|
|
2342
2359
|
}
|
|
@@ -2395,7 +2412,7 @@ function createRecordChoices(records, selectedIds = [], project) {
|
|
|
2395
2412
|
return records.map((record) => ({
|
|
2396
2413
|
name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
|
|
2397
2414
|
value: record.id,
|
|
2398
|
-
checked: _optionalChain([selectedIds, 'optionalAccess',
|
|
2415
|
+
checked: _optionalChain([selectedIds, 'optionalAccess', _125 => _125.includes, 'call', _126 => _126(record.id)])
|
|
2399
2416
|
}));
|
|
2400
2417
|
}
|
|
2401
2418
|
async function promptRecordSelection(modelName, choices) {
|
|
@@ -2662,7 +2679,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
|
|
|
2662
2679
|
function createVttLoader() {
|
|
2663
2680
|
return createLoader({
|
|
2664
2681
|
async pull(locale, input2) {
|
|
2665
|
-
const vtt = _optionalChain([_nodewebvtt2.default, 'access',
|
|
2682
|
+
const vtt = _optionalChain([_nodewebvtt2.default, 'access', _127 => _127.parse, 'call', _128 => _128(input2), 'optionalAccess', _129 => _129.cues]);
|
|
2666
2683
|
if (Object.keys(vtt).length === 0) {
|
|
2667
2684
|
return {};
|
|
2668
2685
|
} else {
|
|
@@ -2714,7 +2731,7 @@ function variableExtractLoader(params) {
|
|
|
2714
2731
|
for (let i = 0; i < matches.length; i++) {
|
|
2715
2732
|
const match = matches[i];
|
|
2716
2733
|
const currentValue = result[key].value;
|
|
2717
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2734
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _130 => _130.replace, 'call', _131 => _131(match, `{variable:${i}}`)]);
|
|
2718
2735
|
result[key].value = newValue;
|
|
2719
2736
|
result[key].variables[i] = match;
|
|
2720
2737
|
}
|
|
@@ -2728,7 +2745,7 @@ function variableExtractLoader(params) {
|
|
|
2728
2745
|
for (let i = 0; i < valueObj.variables.length; i++) {
|
|
2729
2746
|
const variable = valueObj.variables[i];
|
|
2730
2747
|
const currentValue = result[key];
|
|
2731
|
-
const newValue = _optionalChain([currentValue, 'optionalAccess',
|
|
2748
|
+
const newValue = _optionalChain([currentValue, 'optionalAccess', _132 => _132.replace, 'call', _133 => _133(`{variable:${i}}`, variable)]);
|
|
2732
2749
|
result[key] = newValue;
|
|
2733
2750
|
}
|
|
2734
2751
|
}
|
|
@@ -2909,7 +2926,7 @@ function createVueJsonLoader() {
|
|
|
2909
2926
|
return createLoader({
|
|
2910
2927
|
pull: async (locale, input2, ctx) => {
|
|
2911
2928
|
const parsed = parseVueFile(input2);
|
|
2912
|
-
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess',
|
|
2929
|
+
return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _134 => _134.i18n, 'optionalAccess', _135 => _135[locale]]), () => ( {}));
|
|
2913
2930
|
},
|
|
2914
2931
|
push: async (locale, data, originalInput) => {
|
|
2915
2932
|
const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
|
|
@@ -3280,11 +3297,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
3280
3297
|
const auth = await validateAuth(settings);
|
|
3281
3298
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
3282
3299
|
let buckets = getBuckets(i18nConfig);
|
|
3283
|
-
if (_optionalChain([flags, 'access',
|
|
3300
|
+
if (_optionalChain([flags, 'access', _136 => _136.bucket, 'optionalAccess', _137 => _137.length])) {
|
|
3284
3301
|
buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
|
|
3285
3302
|
}
|
|
3286
3303
|
ora.succeed("Buckets retrieved");
|
|
3287
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
3304
|
+
const targetLocales = _optionalChain([flags, 'access', _138 => _138.locale, 'optionalAccess', _139 => _139.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
3288
3305
|
const lockfileHelper = createLockfileHelper();
|
|
3289
3306
|
ora.start("Ensuring i18n.lock exists...");
|
|
3290
3307
|
if (!lockfileHelper.isLockfileExists()) {
|
|
@@ -3614,12 +3631,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
3614
3631
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
3615
3632
|
docUrl: "bucketNotFound"
|
|
3616
3633
|
});
|
|
3617
|
-
} else if (_optionalChain([flags, 'access',
|
|
3634
|
+
} else if (_optionalChain([flags, 'access', _140 => _140.locale, 'optionalAccess', _141 => _141.some, 'call', _142 => _142((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
3618
3635
|
throw new CLIError({
|
|
3619
3636
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
3620
3637
|
docUrl: "localeTargetNotFound"
|
|
3621
3638
|
});
|
|
3622
|
-
} else if (_optionalChain([flags, 'access',
|
|
3639
|
+
} else if (_optionalChain([flags, 'access', _143 => _143.bucket, 'optionalAccess', _144 => _144.some, 'call', _145 => _145((bucket) => !i18nConfig.buckets[bucket])])) {
|
|
3623
3640
|
throw new CLIError({
|
|
3624
3641
|
message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
|
|
3625
3642
|
docUrl: "bucketNotFound"
|
|
@@ -3899,7 +3916,7 @@ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").descri
|
|
|
3899
3916
|
// package.json
|
|
3900
3917
|
var package_default = {
|
|
3901
3918
|
name: "lingo.dev",
|
|
3902
|
-
version: "0.78.
|
|
3919
|
+
version: "0.78.12",
|
|
3903
3920
|
description: "Lingo.dev CLI",
|
|
3904
3921
|
private: false,
|
|
3905
3922
|
publishConfig: {
|