lingo.dev 0.74.10 → 0.74.11

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