lingo.dev 0.74.11 → 0.74.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 CHANGED
@@ -25,9 +25,9 @@ function getSettings(explicitApiKey) {
25
25
  _legacyEnvVarWarning();
26
26
  return {
27
27
  auth: {
28
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _21 => _21.auth, 'optionalAccess', _22 => _22.apiKey]) || defaults.auth.apiKey,
29
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _23 => _23.auth, 'optionalAccess', _24 => _24.apiUrl]) || defaults.auth.apiUrl,
30
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _25 => _25.auth, 'optionalAccess', _26 => _26.webUrl]) || defaults.auth.webUrl
28
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _20 => _20.auth, 'optionalAccess', _21 => _21.apiKey]) || defaults.auth.apiKey,
29
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _22 => _22.auth, 'optionalAccess', _23 => _23.apiUrl]) || defaults.auth.apiUrl,
30
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _24 => _24.auth, 'optionalAccess', _25 => _25.webUrl]) || defaults.auth.webUrl
31
31
  }
32
32
  };
33
33
  }
@@ -137,7 +137,7 @@ function createAuthenticator(params) {
137
137
  });
138
138
  if (res.ok) {
139
139
  const payload = await res.json();
140
- if (!_optionalChain([payload, 'optionalAccess', _27 => _27.email])) {
140
+ if (!_optionalChain([payload, 'optionalAccess', _26 => _26.email])) {
141
141
  return null;
142
142
  }
143
143
  return {
@@ -373,7 +373,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
373
373
  });
374
374
  const auth2 = await newAuthenticator.whoami();
375
375
  if (auth2) {
376
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _28 => _28.email])}`);
376
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _27 => _27.email])}`);
377
377
  } else {
378
378
  _ora2.default.call(void 0, ).fail("Authentication failed.");
379
379
  }
@@ -452,7 +452,7 @@ var _glob = require('glob'); var glob = _interopRequireWildcard(_glob);
452
452
  function getBuckets(i18nConfig) {
453
453
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
454
454
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
455
- const excludeItems = _optionalChain([bucketEntry, 'access', _29 => _29.exclude, 'optionalAccess', _30 => _30.map, 'call', _31 => _31((item) => resolveBucketItem(item))]);
455
+ const excludeItems = _optionalChain([bucketEntry, 'access', _28 => _28.exclude, 'optionalAccess', _29 => _29.map, 'call', _30 => _30((item) => resolveBucketItem(item))]);
456
456
  return {
457
457
  type: bucketType,
458
458
  config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
@@ -469,7 +469,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
469
469
  })
470
470
  )
471
471
  );
472
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _32 => _32.flatMap, 'call', _33 => _33(
472
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _31 => _31.flatMap, 'call', _32 => _32(
473
473
  (pattern) => expandPlaceholderedGlob(pattern.path, __spec.resolveOverridenLocale.call(void 0, sourceLocale, pattern.delimiter)).map(
474
474
  (pathPattern) => ({
475
475
  pathPattern,
@@ -503,7 +503,7 @@ function expandPlaceholderedGlob(_pathPattern, sourceLocale) {
503
503
  }
504
504
  const pathPatternChunks = pathPattern.split(_path2.default.sep);
505
505
  const localeSegmentIndex = pathPatternChunks.findIndex((segment) => segment.includes("[locale]"));
506
- const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _34 => _34[localeSegmentIndex], 'optionalAccess', _35 => _35.indexOf, 'call', _36 => _36("[locale]")]), () => ( -1));
506
+ const localePlaceholderIndex = _nullishCoalesce(_optionalChain([pathPatternChunks, 'access', _33 => _33[localeSegmentIndex], 'optionalAccess', _34 => _34.indexOf, 'call', _35 => _35("[locale]")]), () => ( -1));
507
507
  const sourcePathPattern = pathPattern.replace(/\[locale\]/g, sourceLocale);
508
508
  const sourcePaths = glob.sync(sourcePathPattern, { follow: true, withFileTypes: true }).filter((file) => file.isFile() || file.isSymbolicLink()).map((file) => file.fullpath()).map((fullpath) => _path2.default.relative(process.cwd(), fullpath));
509
509
  const placeholderedPaths = sourcePaths.map((sourcePath) => {
@@ -588,12 +588,12 @@ function composeLoaders(...loaders) {
588
588
  return {
589
589
  init: async () => {
590
590
  for (const loader of loaders) {
591
- await _optionalChain([loader, 'access', _37 => _37.init, 'optionalCall', _38 => _38()]);
591
+ await _optionalChain([loader, 'access', _36 => _36.init, 'optionalCall', _37 => _37()]);
592
592
  }
593
593
  },
594
594
  setDefaultLocale(locale) {
595
595
  for (const loader of loaders) {
596
- _optionalChain([loader, 'access', _39 => _39.setDefaultLocale, 'optionalCall', _40 => _40(locale)]);
596
+ _optionalChain([loader, 'access', _38 => _38.setDefaultLocale, 'optionalCall', _39 => _39(locale)]);
597
597
  }
598
598
  return this;
599
599
  },
@@ -624,7 +624,7 @@ function createLoader(lDefinition) {
624
624
  if (state.initCtx) {
625
625
  return state.initCtx;
626
626
  }
627
- state.initCtx = await _optionalChain([lDefinition, 'access', _41 => _41.init, 'optionalCall', _42 => _42()]);
627
+ state.initCtx = await _optionalChain([lDefinition, 'access', _40 => _40.init, 'optionalCall', _41 => _41()]);
628
628
  return state.initCtx;
629
629
  },
630
630
  setDefaultLocale(locale) {
@@ -682,84 +682,26 @@ function createJsonLoader() {
682
682
 
683
683
  // src/cli/loaders/flat.ts
684
684
  var _flat = require('flat');
685
-
686
- var OBJECT_NUMERIC_KEY_PREFIX = "__lingodotdev__obj__";
687
685
  function createFlatLoader() {
688
- let denormalizedKeysMap;
689
686
  return createLoader({
690
687
  pull: async (locale, input) => {
691
- const denormalized = denormalizeObjectKeys(input || {});
692
- const flattened = _flat.flatten.call(void 0, denormalized, {
688
+ return _flat.flatten.call(void 0, input || {}, {
693
689
  delimiter: "/",
694
690
  transformKey(key) {
695
691
  return encodeURIComponent(String(key));
696
692
  }
697
693
  });
698
- denormalizedKeysMap = buildDenormalizedKeysMap(flattened);
699
- const normalized = normalizeObjectKeys(flattened);
700
- return normalized;
701
694
  },
702
695
  push: async (locale, data) => {
703
- const denormalized = mapDeormalizedKeys(data, denormalizedKeysMap);
704
- const unflattened = _flat.unflatten.call(void 0, denormalized || {}, {
696
+ return _flat.unflatten.call(void 0, data || {}, {
705
697
  delimiter: "/",
706
698
  transformKey(key) {
707
699
  return decodeURIComponent(String(key));
708
700
  }
709
701
  });
710
- const normalized = normalizeObjectKeys(unflattened);
711
- return normalized;
712
702
  }
713
703
  });
714
704
  }
715
- function buildDenormalizedKeysMap(obj) {
716
- return Object.keys(obj).reduce(
717
- (acc, key) => {
718
- const normalizedKey = `${key}`.replace(OBJECT_NUMERIC_KEY_PREFIX, "");
719
- acc[normalizedKey] = key;
720
- return acc;
721
- },
722
- {}
723
- );
724
- }
725
- function mapDeormalizedKeys(obj, denormalizedKeysMap) {
726
- return Object.keys(obj).reduce(
727
- (acc, key) => {
728
- const denormalizedKey = denormalizedKeysMap[key];
729
- acc[denormalizedKey] = obj[key];
730
- return acc;
731
- },
732
- {}
733
- );
734
- }
735
- function denormalizeObjectKeys(obj) {
736
- if (_lodash2.default.isObject(obj) && !_lodash2.default.isArray(obj)) {
737
- return _lodash2.default.transform(
738
- obj,
739
- (result, value, key) => {
740
- const newKey = !isNaN(Number(key)) ? `${OBJECT_NUMERIC_KEY_PREFIX}${key}` : key;
741
- result[newKey] = _lodash2.default.isObject(value) ? denormalizeObjectKeys(value) : value;
742
- },
743
- {}
744
- );
745
- } else {
746
- return obj;
747
- }
748
- }
749
- function normalizeObjectKeys(obj) {
750
- if (_lodash2.default.isObject(obj) && !_lodash2.default.isArray(obj)) {
751
- return _lodash2.default.transform(
752
- obj,
753
- (result, value, key) => {
754
- const newKey = `${key}`.replace(OBJECT_NUMERIC_KEY_PREFIX, "");
755
- result[newKey] = _lodash2.default.isObject(value) ? normalizeObjectKeys(value) : value;
756
- },
757
- {}
758
- );
759
- } else {
760
- return obj;
761
- }
762
- }
763
705
 
764
706
  // src/cli/loaders/text-file.ts
765
707
  var _promises3 = require('fs/promises'); var _promises4 = _interopRequireDefault(_promises3);
@@ -771,7 +713,7 @@ function createTextFileLoader(pathPattern) {
771
713
  const trimmedResult = result.trim();
772
714
  return trimmedResult;
773
715
  },
774
- async push(locale, data, _20, originalLocale) {
716
+ async push(locale, data, _19, originalLocale) {
775
717
  const draftPath = pathPattern.replace("[locale]", locale);
776
718
  const finalPath = _path2.default.resolve(draftPath);
777
719
  const dirPath = _path2.default.dirname(finalPath);
@@ -800,8 +742,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
800
742
  if (!templateData) {
801
743
  templateData = await readFileForLocale(pathPattern, originalLocale);
802
744
  }
803
- if (_optionalChain([templateData, 'optionalAccess', _43 => _43.match, 'call', _44 => _44(/[\r\n]$/)])) {
804
- const ending = _optionalChain([templateData, 'optionalAccess', _45 => _45.includes, 'call', _46 => _46("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _47 => _47.includes, 'call', _48 => _48("\r")]) ? "\r" : "\n";
745
+ if (_optionalChain([templateData, 'optionalAccess', _42 => _42.match, 'call', _43 => _43(/[\r\n]$/)])) {
746
+ const ending = _optionalChain([templateData, 'optionalAccess', _44 => _44.includes, 'call', _45 => _45("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _46 => _46.includes, 'call', _47 => _47("\r")]) ? "\r" : "\n";
805
747
  return ending;
806
748
  }
807
749
  return "";
@@ -1019,7 +961,7 @@ function createHtmlLoader() {
1019
961
  break;
1020
962
  }
1021
963
  const siblings = Array.from(parent.childNodes).filter(
1022
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _49 => _49.textContent, 'optionalAccess', _50 => _50.trim, 'call', _51 => _51()])
964
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _48 => _48.textContent, 'optionalAccess', _49 => _49.trim, 'call', _50 => _50()])
1023
965
  );
1024
966
  const index = siblings.indexOf(current);
1025
967
  if (index !== -1) {
@@ -1054,11 +996,11 @@ function createHtmlLoader() {
1054
996
  result[getPath(element, attr)] = value;
1055
997
  }
1056
998
  });
1057
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _52 => _52.textContent, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()])).forEach(processNode);
999
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _51 => _51.textContent, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()])).forEach(processNode);
1058
1000
  }
1059
1001
  };
1060
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _55 => _55.textContent, 'optionalAccess', _56 => _56.trim, 'call', _57 => _57()])).forEach(processNode);
1061
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _58 => _58.textContent, 'optionalAccess', _59 => _59.trim, 'call', _60 => _60()])).forEach(processNode);
1002
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _54 => _54.textContent, 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()])).forEach(processNode);
1003
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _57 => _57.textContent, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()])).forEach(processNode);
1062
1004
  return result;
1063
1005
  },
1064
1006
  async push(locale, data, originalInput) {
@@ -1080,7 +1022,7 @@ function createHtmlLoader() {
1080
1022
  for (let i = 0; i < indices.length; i++) {
1081
1023
  const index = parseInt(indices[i]);
1082
1024
  const siblings = Array.from(parent.childNodes).filter(
1083
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _61 => _61.textContent, 'optionalAccess', _62 => _62.trim, 'call', _63 => _63()])
1025
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _60 => _60.textContent, 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()])
1084
1026
  );
1085
1027
  if (index >= siblings.length) {
1086
1028
  if (i === indices.length - 1) {
@@ -1176,7 +1118,7 @@ function createPropertiesLoader() {
1176
1118
  return result;
1177
1119
  },
1178
1120
  async push(locale, payload) {
1179
- const result = Object.entries(payload).filter(([_20, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1121
+ const result = Object.entries(payload).filter(([_19, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1180
1122
  return result;
1181
1123
  }
1182
1124
  });
@@ -1187,7 +1129,7 @@ function isSkippableLine(line) {
1187
1129
  function parsePropertyLine(line) {
1188
1130
  const [key, ...valueParts] = line.split("=");
1189
1131
  return {
1190
- key: _optionalChain([key, 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]) || "",
1132
+ key: _optionalChain([key, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()]) || "",
1191
1133
  value: valueParts.join("=").trim()
1192
1134
  };
1193
1135
  }
@@ -1269,7 +1211,7 @@ function createXcodeXcstringsLoader() {
1269
1211
  const resultData = {};
1270
1212
  for (const [translationKey, _translationEntity] of Object.entries(input.strings)) {
1271
1213
  const rootTranslationEntity = _translationEntity;
1272
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _66 => _66.localizations, 'optionalAccess', _67 => _67[locale]]);
1214
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _65 => _65.localizations, 'optionalAccess', _66 => _66[locale]]);
1273
1215
  if (langTranslationEntity) {
1274
1216
  if ("stringUnit" in langTranslationEntity) {
1275
1217
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1278,7 +1220,7 @@ function createXcodeXcstringsLoader() {
1278
1220
  resultData[translationKey] = {};
1279
1221
  const pluralForms = langTranslationEntity.variations.plural;
1280
1222
  for (const form in pluralForms) {
1281
- if (_optionalChain([pluralForms, 'access', _68 => _68[form], 'optionalAccess', _69 => _69.stringUnit, 'optionalAccess', _70 => _70.value])) {
1223
+ if (_optionalChain([pluralForms, 'access', _67 => _67[form], 'optionalAccess', _68 => _68.stringUnit, 'optionalAccess', _69 => _69.value])) {
1282
1224
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1283
1225
  }
1284
1226
  }
@@ -1389,8 +1331,8 @@ function createUnlocalizableLoader() {
1389
1331
  }
1390
1332
  }
1391
1333
  return false;
1392
- }).map(([key, _20]) => key);
1393
- const result = _lodash2.default.omitBy(input, (_20, key) => passthroughKeys.includes(key));
1334
+ }).map(([key, _19]) => key);
1335
+ const result = _lodash2.default.omitBy(input, (_19, key) => passthroughKeys.includes(key));
1394
1336
  return result;
1395
1337
  },
1396
1338
  async push(locale, data, originalInput) {
@@ -1425,7 +1367,7 @@ function createPoDataLoader(params) {
1425
1367
  Object.entries(entries).forEach(([msgid, entry]) => {
1426
1368
  if (msgid && entry.msgid) {
1427
1369
  const context = entry.msgctxt || "";
1428
- const fullEntry = _optionalChain([parsedPo, 'access', _71 => _71.translations, 'access', _72 => _72[context], 'optionalAccess', _73 => _73[msgid]]);
1370
+ const fullEntry = _optionalChain([parsedPo, 'access', _70 => _70.translations, 'access', _71 => _71[context], 'optionalAccess', _72 => _72[msgid]]);
1429
1371
  if (fullEntry) {
1430
1372
  result[msgid] = fullEntry;
1431
1373
  }
@@ -1435,7 +1377,7 @@ function createPoDataLoader(params) {
1435
1377
  return result;
1436
1378
  },
1437
1379
  async push(locale, data, originalInput) {
1438
- const sections = _optionalChain([originalInput, 'optionalAccess', _74 => _74.split, 'call', _75 => _75("\n\n"), 'access', _76 => _76.filter, 'call', _77 => _77(Boolean)]) || [];
1380
+ const sections = _optionalChain([originalInput, 'optionalAccess', _73 => _73.split, 'call', _74 => _74("\n\n"), 'access', _75 => _75.filter, 'call', _76 => _76(Boolean)]) || [];
1439
1381
  const result = sections.map((section) => {
1440
1382
  const sectionPo = _gettextparser2.default.po.parse(section);
1441
1383
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
@@ -1477,7 +1419,7 @@ function createPoContentLoader() {
1477
1419
  entry.msgid,
1478
1420
  {
1479
1421
  ...entry,
1480
- msgstr: [_optionalChain([data, 'access', _78 => _78[entry.msgid], 'optionalAccess', _79 => _79.singular]), _optionalChain([data, 'access', _80 => _80[entry.msgid], 'optionalAccess', _81 => _81.plural]) || null].filter(Boolean)
1422
+ msgstr: [_optionalChain([data, 'access', _77 => _77[entry.msgid], 'optionalAccess', _78 => _78.singular]), _optionalChain([data, 'access', _79 => _79[entry.msgid], 'optionalAccess', _80 => _80.plural]) || null].filter(Boolean)
1481
1423
  }
1482
1424
  ]).fromPairs().value();
1483
1425
  return result;
@@ -1723,7 +1665,7 @@ function createDatoClient(params) {
1723
1665
  only_valid: "true",
1724
1666
  ids: !records.length ? void 0 : records.join(",")
1725
1667
  }
1726
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _82 => _82.response, 'optionalAccess', _83 => _83.body, 'optionalAccess', _84 => _84.data, 'optionalAccess', _85 => _85[0]]) || error));
1668
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _81 => _81.response, 'optionalAccess', _82 => _82.body, 'optionalAccess', _83 => _83.data, 'optionalAccess', _84 => _84[0]]) || error));
1727
1669
  },
1728
1670
  findRecordsForModel: async (modelId, records) => {
1729
1671
  try {
@@ -1733,9 +1675,9 @@ function createDatoClient(params) {
1733
1675
  filter: {
1734
1676
  type: modelId,
1735
1677
  only_valid: "true",
1736
- ids: !_optionalChain([records, 'optionalAccess', _86 => _86.length]) ? void 0 : records.join(",")
1678
+ ids: !_optionalChain([records, 'optionalAccess', _85 => _85.length]) ? void 0 : records.join(",")
1737
1679
  }
1738
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _87 => _87.response, 'optionalAccess', _88 => _88.body, 'optionalAccess', _89 => _89.data, 'optionalAccess', _90 => _90[0]]) || error));
1680
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _86 => _86.response, 'optionalAccess', _87 => _87.body, 'optionalAccess', _88 => _88.data, 'optionalAccess', _89 => _89[0]]) || error));
1739
1681
  return result;
1740
1682
  } catch (_error) {
1741
1683
  throw new Error(
@@ -1749,9 +1691,9 @@ function createDatoClient(params) {
1749
1691
  },
1750
1692
  updateRecord: async (id, payload) => {
1751
1693
  try {
1752
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _91 => _91.response, 'optionalAccess', _92 => _92.body, 'optionalAccess', _93 => _93.data, 'optionalAccess', _94 => _94[0]]) || error));
1694
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _90 => _90.response, 'optionalAccess', _91 => _91.body, 'optionalAccess', _92 => _92.data, 'optionalAccess', _93 => _93[0]]) || error));
1753
1695
  } catch (_error) {
1754
- if (_optionalChain([_error, 'optionalAccess', _95 => _95.attributes, 'optionalAccess', _96 => _96.details, 'optionalAccess', _97 => _97.message])) {
1696
+ if (_optionalChain([_error, 'optionalAccess', _94 => _94.attributes, 'optionalAccess', _95 => _95.details, 'optionalAccess', _96 => _96.message])) {
1755
1697
  throw new Error(
1756
1698
  [
1757
1699
  `${_error.attributes.details.message}`,
@@ -1772,9 +1714,9 @@ function createDatoClient(params) {
1772
1714
  },
1773
1715
  enableFieldLocalization: async (args) => {
1774
1716
  try {
1775
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _98 => _98.response, 'optionalAccess', _99 => _99.body, 'optionalAccess', _100 => _100.data, 'optionalAccess', _101 => _101[0]]) || error));
1717
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _97 => _97.response, 'optionalAccess', _98 => _98.body, 'optionalAccess', _99 => _99.data, 'optionalAccess', _100 => _100[0]]) || error));
1776
1718
  } catch (_error) {
1777
- if (_optionalChain([_error, 'optionalAccess', _102 => _102.attributes, 'optionalAccess', _103 => _103.code]) === "NOT_FOUND") {
1719
+ if (_optionalChain([_error, 'optionalAccess', _101 => _101.attributes, 'optionalAccess', _102 => _102.code]) === "NOT_FOUND") {
1778
1720
  throw new Error(
1779
1721
  [
1780
1722
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -1782,7 +1724,7 @@ function createDatoClient(params) {
1782
1724
  ].join("\n\n")
1783
1725
  );
1784
1726
  }
1785
- if (_optionalChain([_error, 'optionalAccess', _104 => _104.attributes, 'optionalAccess', _105 => _105.details, 'optionalAccess', _106 => _106.message])) {
1727
+ if (_optionalChain([_error, 'optionalAccess', _103 => _103.attributes, 'optionalAccess', _104 => _104.details, 'optionalAccess', _105 => _105.message])) {
1786
1728
  throw new Error(
1787
1729
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
1788
1730
  );
@@ -1848,7 +1790,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
1848
1790
  }
1849
1791
  }
1850
1792
  const records = await dato.findRecordsForModel(modelId);
1851
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _107 => _107.models, 'access', _108 => _108[modelId], 'optionalAccess', _109 => _109.records]) || [], project);
1793
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _106 => _106.models, 'access', _107 => _107[modelId], 'optionalAccess', _108 => _108.records]) || [], project);
1852
1794
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
1853
1795
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
1854
1796
  updatedConfig.models[modelId].records = selectedRecords;
@@ -1860,14 +1802,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
1860
1802
  },
1861
1803
  async pull(locale, input, initCtx) {
1862
1804
  const result = {};
1863
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _110 => _110.models]) || {})) {
1864
- let records = _optionalChain([initCtx, 'optionalAccess', _111 => _111.models, 'access', _112 => _112[modelId], 'access', _113 => _113.records]) || [];
1805
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _109 => _109.models]) || {})) {
1806
+ let records = _optionalChain([initCtx, 'optionalAccess', _110 => _110.models, 'access', _111 => _111[modelId], 'access', _112 => _112.records]) || [];
1865
1807
  const recordIds = records.map((record) => record.id);
1866
1808
  records = await dato.findRecords(recordIds);
1867
1809
  console.log(`Fetched ${records.length} records for model ${modelId}`);
1868
1810
  if (records.length > 0) {
1869
1811
  result[modelId] = {
1870
- fields: _optionalChain([initCtx, 'optionalAccess', _114 => _114.models, 'optionalAccess', _115 => _115[modelId], 'optionalAccess', _116 => _116.fields]) || [],
1812
+ fields: _optionalChain([initCtx, 'optionalAccess', _113 => _113.models, 'optionalAccess', _114 => _114[modelId], 'optionalAccess', _115 => _115.fields]) || [],
1871
1813
  records
1872
1814
  };
1873
1815
  }
@@ -1926,7 +1868,7 @@ function createRecordChoices(records, selectedIds = [], project) {
1926
1868
  return records.map((record) => ({
1927
1869
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
1928
1870
  value: record.id,
1929
- checked: _optionalChain([selectedIds, 'optionalAccess', _117 => _117.includes, 'call', _118 => _118(record.id)])
1871
+ checked: _optionalChain([selectedIds, 'optionalAccess', _116 => _116.includes, 'call', _117 => _117(record.id)])
1930
1872
  }));
1931
1873
  }
1932
1874
  async function promptRecordSelection(modelName, choices) {
@@ -2193,7 +2135,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2193
2135
  function createVttLoader() {
2194
2136
  return createLoader({
2195
2137
  async pull(locale, input) {
2196
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _119 => _119.parse, 'call', _120 => _120(input), 'optionalAccess', _121 => _121.cues]);
2138
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _118 => _118.parse, 'call', _119 => _119(input), 'optionalAccess', _120 => _120.cues]);
2197
2139
  if (Object.keys(vtt).length === 0) {
2198
2140
  return {};
2199
2141
  } else {
@@ -2245,7 +2187,7 @@ function variableExtractLoader(params) {
2245
2187
  for (let i = 0; i < matches.length; i++) {
2246
2188
  const match = matches[i];
2247
2189
  const currentValue = result[key].value;
2248
- const newValue = _optionalChain([currentValue, 'optionalAccess', _122 => _122.replace, 'call', _123 => _123(match, `{variable:${i}}`)]);
2190
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _121 => _121.replace, 'call', _122 => _122(match, `{variable:${i}}`)]);
2249
2191
  result[key].value = newValue;
2250
2192
  result[key].variables[i] = match;
2251
2193
  }
@@ -2259,7 +2201,7 @@ function variableExtractLoader(params) {
2259
2201
  for (let i = 0; i < valueObj.variables.length; i++) {
2260
2202
  const variable = valueObj.variables[i];
2261
2203
  const currentValue = result[key];
2262
- const newValue = _optionalChain([currentValue, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125(`{variable:${i}}`, variable)]);
2204
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _123 => _123.replace, 'call', _124 => _124(`{variable:${i}}`, variable)]);
2263
2205
  result[key] = newValue;
2264
2206
  }
2265
2207
  }
@@ -2699,11 +2641,11 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2699
2641
  const auth = await validateAuth(settings);
2700
2642
  ora.succeed(`Authenticated as ${auth.email}`);
2701
2643
  let buckets = getBuckets(i18nConfig);
2702
- if (_optionalChain([flags, 'access', _126 => _126.bucket, 'optionalAccess', _127 => _127.length])) {
2644
+ if (_optionalChain([flags, 'access', _125 => _125.bucket, 'optionalAccess', _126 => _126.length])) {
2703
2645
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
2704
2646
  }
2705
2647
  ora.succeed("Buckets retrieved");
2706
- const targetLocales = _optionalChain([flags, 'access', _128 => _128.locale, 'optionalAccess', _129 => _129.length]) ? flags.locale : i18nConfig.locale.targets;
2648
+ const targetLocales = _optionalChain([flags, 'access', _127 => _127.locale, 'optionalAccess', _128 => _128.length]) ? flags.locale : i18nConfig.locale.targets;
2707
2649
  const lockfileHelper = createLockfileHelper();
2708
2650
  ora.start("Ensuring i18n.lock exists...");
2709
2651
  if (!lockfileHelper.isLockfileExists()) {
@@ -2811,7 +2753,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
2811
2753
  targetData
2812
2754
  });
2813
2755
  if (flags.key) {
2814
- processableData = _lodash2.default.pickBy(processableData, (_20, key) => key === flags.key);
2756
+ processableData = _lodash2.default.pickBy(processableData, (_19, key) => key === flags.key);
2815
2757
  }
2816
2758
  if (flags.verbose) {
2817
2759
  bucketOra.info(JSON.stringify(processableData, null, 2));
@@ -2989,12 +2931,12 @@ function validateParams(i18nConfig, flags) {
2989
2931
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
2990
2932
  docUrl: "bucketNotFound"
2991
2933
  });
2992
- } else if (_optionalChain([flags, 'access', _130 => _130.locale, 'optionalAccess', _131 => _131.some, 'call', _132 => _132((locale) => !i18nConfig.locale.targets.includes(locale))])) {
2934
+ } else if (_optionalChain([flags, 'access', _129 => _129.locale, 'optionalAccess', _130 => _130.some, 'call', _131 => _131((locale) => !i18nConfig.locale.targets.includes(locale))])) {
2993
2935
  throw new CLIError({
2994
2936
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
2995
2937
  docUrl: "localeTargetNotFound"
2996
2938
  });
2997
- } else if (_optionalChain([flags, 'access', _133 => _133.bucket, 'optionalAccess', _134 => _134.some, 'call', _135 => _135((bucket) => !i18nConfig.buckets[bucket])])) {
2939
+ } else if (_optionalChain([flags, 'access', _132 => _132.bucket, 'optionalAccess', _133 => _133.some, 'call', _134 => _134((bucket) => !i18nConfig.buckets[bucket])])) {
2998
2940
  throw new CLIError({
2999
2941
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
3000
2942
  docUrl: "bucketNotFound"
@@ -3221,7 +3163,7 @@ function displaySummary(results) {
3221
3163
  // package.json
3222
3164
  var package_default = {
3223
3165
  name: "lingo.dev",
3224
- version: "0.74.11",
3166
+ version: "0.74.12",
3225
3167
  description: "Lingo.dev CLI",
3226
3168
  private: false,
3227
3169
  publishConfig: {
@@ -3258,7 +3200,6 @@ var package_default = {
3258
3200
  dev: "tsup --watch",
3259
3201
  build: "tsc --noEmit && tsup",
3260
3202
  test: "vitest run",
3261
- "test:watch": "vitest",
3262
3203
  clean: "rm -rf build"
3263
3204
  },
3264
3205
  keywords: [],