@intlayer/chokidar 5.8.1 → 6.0.0-canary.0

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.
Files changed (215) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +15 -20
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/fetchDistantDictionaries.cjs +18 -37
  4. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  5. package/dist/cjs/{fetchDistantDictionaryKeys.cjs → fetchDistantDictionaryKeysAndUpdateTimestamp.cjs} +10 -10
  6. package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +1 -0
  7. package/dist/cjs/filterInvalidDictionaries.cjs +70 -0
  8. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -0
  9. package/dist/cjs/getBuiltFetchDictionariesPath.cjs +52 -0
  10. package/dist/cjs/getBuiltFetchDictionariesPath.cjs.map +1 -0
  11. package/dist/cjs/getBuiltRemoteDictionariesPath.cjs +51 -0
  12. package/dist/cjs/getBuiltRemoteDictionariesPath.cjs.map +1 -0
  13. package/dist/cjs/index.cjs +10 -11
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/cjs/loadDictionaries/index.cjs +4 -4
  16. package/dist/cjs/loadDictionaries/index.cjs.map +1 -1
  17. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +57 -17
  18. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  19. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +128 -53
  20. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  21. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +101 -0
  22. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -0
  23. package/dist/cjs/loadDictionaries/log.cjs +144 -0
  24. package/dist/cjs/loadDictionaries/log.cjs.map +1 -0
  25. package/dist/cjs/mergeDictionaries.cjs +18 -22
  26. package/dist/cjs/mergeDictionaries.cjs.map +1 -1
  27. package/dist/cjs/orderDictionaries.cjs +71 -0
  28. package/dist/cjs/orderDictionaries.cjs.map +1 -0
  29. package/dist/cjs/prepareContentDeclaration.cjs +4 -1
  30. package/dist/cjs/prepareContentDeclaration.cjs.map +1 -1
  31. package/dist/cjs/prepareIntlayer.cjs +9 -4
  32. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  33. package/dist/cjs/processPerLocaleDictionary.cjs.map +1 -1
  34. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs +22 -8
  35. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -1
  36. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs +44 -42
  37. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -1
  38. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs +83 -0
  39. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs.map +1 -0
  40. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs +29 -21
  41. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -1
  42. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs +52 -0
  43. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs.map +1 -0
  44. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs +44 -29
  45. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -1
  46. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +39 -34
  47. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  48. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +4 -6
  49. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
  50. package/dist/cjs/transpiler/dictionary_to_type/createType.cjs +17 -16
  51. package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +1 -1
  52. package/dist/cjs/utils/formatter.cjs +50 -0
  53. package/dist/cjs/utils/formatter.cjs.map +1 -0
  54. package/dist/cjs/utils/parallelize.cjs +43 -0
  55. package/dist/cjs/utils/parallelize.cjs.map +1 -0
  56. package/dist/cjs/utils/runOnce.cjs +2 -1
  57. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  58. package/dist/cjs/writeContentDeclaration/formatCode.cjs +7 -4
  59. package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +1 -1
  60. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +5 -1
  61. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  62. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +43 -25
  63. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  64. package/dist/esm/chokidar/watcher.mjs +16 -21
  65. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  66. package/dist/esm/fetchDistantDictionaries.mjs +24 -28
  67. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  68. package/dist/esm/{fetchDistantDictionaryKeys.mjs → fetchDistantDictionaryKeysAndUpdateTimestamp.mjs} +6 -6
  69. package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +1 -0
  70. package/dist/esm/filterInvalidDictionaries.mjs +40 -0
  71. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -0
  72. package/dist/esm/getBuiltFetchDictionariesPath.mjs +18 -0
  73. package/dist/esm/getBuiltFetchDictionariesPath.mjs.map +1 -0
  74. package/dist/esm/getBuiltRemoteDictionariesPath.mjs +17 -0
  75. package/dist/esm/getBuiltRemoteDictionariesPath.mjs.map +1 -0
  76. package/dist/esm/index.mjs +8 -9
  77. package/dist/esm/index.mjs.map +1 -1
  78. package/dist/esm/loadDictionaries/index.mjs +2 -2
  79. package/dist/esm/loadDictionaries/index.mjs.map +1 -1
  80. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -18
  81. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  82. package/dist/esm/loadDictionaries/loadDictionaries.mjs +132 -53
  83. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  84. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +66 -0
  85. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -0
  86. package/dist/esm/loadDictionaries/log.mjs +125 -0
  87. package/dist/esm/loadDictionaries/log.mjs.map +1 -0
  88. package/dist/esm/mergeDictionaries.mjs +19 -23
  89. package/dist/esm/mergeDictionaries.mjs.map +1 -1
  90. package/dist/esm/orderDictionaries.mjs +37 -0
  91. package/dist/esm/orderDictionaries.mjs.map +1 -0
  92. package/dist/esm/prepareContentDeclaration.mjs +4 -1
  93. package/dist/esm/prepareContentDeclaration.mjs.map +1 -1
  94. package/dist/esm/prepareIntlayer.mjs +9 -4
  95. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  96. package/dist/esm/processPerLocaleDictionary.mjs.map +1 -1
  97. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs +25 -9
  98. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -1
  99. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs +45 -43
  100. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -1
  101. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs +58 -0
  102. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs.map +1 -0
  103. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs +29 -21
  104. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -1
  105. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs +28 -0
  106. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs.map +1 -0
  107. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs +45 -30
  108. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -1
  109. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +39 -34
  110. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  111. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +4 -6
  112. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
  113. package/dist/esm/transpiler/dictionary_to_type/createType.mjs +17 -16
  114. package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +1 -1
  115. package/dist/esm/utils/formatter.mjs +15 -0
  116. package/dist/esm/utils/formatter.mjs.map +1 -0
  117. package/dist/esm/utils/parallelize.mjs +9 -0
  118. package/dist/esm/utils/parallelize.mjs.map +1 -0
  119. package/dist/esm/utils/runOnce.mjs +2 -1
  120. package/dist/esm/utils/runOnce.mjs.map +1 -1
  121. package/dist/esm/writeContentDeclaration/formatCode.mjs +8 -5
  122. package/dist/esm/writeContentDeclaration/formatCode.mjs.map +1 -1
  123. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +5 -1
  124. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  125. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +40 -22
  126. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  127. package/dist/types/chokidar/watcher.d.ts.map +1 -1
  128. package/dist/types/fetchDistantDictionaries.d.ts +2 -1
  129. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  130. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts +3 -0
  131. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +1 -0
  132. package/dist/types/filterInvalidDictionaries.d.ts +3 -0
  133. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -0
  134. package/dist/types/getBuiltFetchDictionariesPath.d.ts +5 -0
  135. package/dist/types/getBuiltFetchDictionariesPath.d.ts.map +1 -0
  136. package/dist/types/getBuiltRemoteDictionariesPath.d.ts +5 -0
  137. package/dist/types/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
  138. package/dist/types/index.d.ts +3 -4
  139. package/dist/types/index.d.ts.map +1 -1
  140. package/dist/types/loadDictionaries/index.d.ts +2 -2
  141. package/dist/types/loadDictionaries/index.d.ts.map +1 -1
  142. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +4 -1
  143. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  144. package/dist/types/loadDictionaries/loadDictionaries.d.ts +11 -1
  145. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  146. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +6 -0
  147. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
  148. package/dist/types/loadDictionaries/log.d.ts +19 -0
  149. package/dist/types/loadDictionaries/log.d.ts.map +1 -0
  150. package/dist/types/mergeDictionaries.d.ts +1 -1
  151. package/dist/types/mergeDictionaries.d.ts.map +1 -1
  152. package/dist/types/orderDictionaries.d.ts +10 -0
  153. package/dist/types/orderDictionaries.d.ts.map +1 -0
  154. package/dist/types/prepareContentDeclaration.d.ts.map +1 -1
  155. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  156. package/dist/types/processPerLocaleDictionary.d.ts +1 -1
  157. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +1 -0
  158. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +1 -1
  159. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts +4 -3
  160. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -1
  161. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts +1 -1
  162. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -1
  163. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts +23 -0
  164. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts.map +1 -0
  165. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts +1 -1
  166. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -1
  167. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts +19 -0
  168. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts.map +1 -0
  169. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -1
  170. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts +1 -1
  171. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  172. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts +1 -1
  173. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
  174. package/dist/types/transpiler/dictionary_to_type/createType.d.ts +1 -1
  175. package/dist/types/transpiler/dictionary_to_type/createType.d.ts.map +1 -1
  176. package/dist/types/utils/formatter.d.ts +4 -0
  177. package/dist/types/utils/formatter.d.ts.map +1 -0
  178. package/dist/types/utils/parallelize.d.ts +2 -0
  179. package/dist/types/utils/parallelize.d.ts.map +1 -0
  180. package/dist/types/utils/runOnce.d.ts +1 -1
  181. package/dist/types/utils/runOnce.d.ts.map +1 -1
  182. package/dist/types/writeContentDeclaration/formatCode.d.ts.map +1 -1
  183. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +1 -1
  184. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  185. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +1 -1
  186. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  187. package/package.json +19 -17
  188. package/dist/cjs/checkDictionaryChanges.cjs +0 -58
  189. package/dist/cjs/checkDictionaryChanges.cjs.map +0 -1
  190. package/dist/cjs/fetchDistantDictionaryKeys.cjs.map +0 -1
  191. package/dist/cjs/getFilteredLocalesContent.cjs +0 -70
  192. package/dist/cjs/getFilteredLocalesContent.cjs.map +0 -1
  193. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs +0 -44
  194. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs.map +0 -1
  195. package/dist/cjs/log.cjs +0 -296
  196. package/dist/cjs/log.cjs.map +0 -1
  197. package/dist/esm/checkDictionaryChanges.mjs +0 -37
  198. package/dist/esm/checkDictionaryChanges.mjs.map +0 -1
  199. package/dist/esm/fetchDistantDictionaryKeys.mjs.map +0 -1
  200. package/dist/esm/getFilteredLocalesContent.mjs +0 -49
  201. package/dist/esm/getFilteredLocalesContent.mjs.map +0 -1
  202. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs +0 -20
  203. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs.map +0 -1
  204. package/dist/esm/log.mjs +0 -262
  205. package/dist/esm/log.mjs.map +0 -1
  206. package/dist/types/checkDictionaryChanges.d.ts +0 -3
  207. package/dist/types/checkDictionaryChanges.d.ts.map +0 -1
  208. package/dist/types/fetchDistantDictionaryKeys.d.ts +0 -3
  209. package/dist/types/fetchDistantDictionaryKeys.d.ts.map +0 -1
  210. package/dist/types/getFilteredLocalesContent.d.ts +0 -4
  211. package/dist/types/getFilteredLocalesContent.d.ts.map +0 -1
  212. package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts +0 -8
  213. package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts.map +0 -1
  214. package/dist/types/log.d.ts +0 -45
  215. package/dist/types/log.d.ts.map +0 -1
@@ -1,8 +1,12 @@
1
1
  import { getDictionaryAPI, getOAuthAPI } from "@intlayer/api";
2
- import { getAppLogger, getConfiguration } from "@intlayer/config";
3
- import pLimit from "p-limit";
4
- import { logger } from "./log.mjs";
5
- const fetchDistantDictionaries = async (options) => {
2
+ import {
3
+ ANSIColors,
4
+ colorize,
5
+ getAppLogger,
6
+ getConfiguration
7
+ } from "@intlayer/config";
8
+ import { parallelize } from "./utils/parallelize.mjs";
9
+ const fetchDistantDictionaries = async (options, onStatusUpdate) => {
6
10
  const config = getConfiguration();
7
11
  const appLogger = getAppLogger(config);
8
12
  try {
@@ -17,13 +21,12 @@ const fetchDistantDictionaries = async (options) => {
17
21
  const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();
18
22
  const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
19
23
  const distantDictionariesKeys = options.dictionaryKeys;
20
- const limit = pLimit(5);
21
24
  const processDictionary = async (dictionaryKey) => {
22
- logger.updateStatus([
25
+ onStatusUpdate?.([
23
26
  {
24
27
  dictionaryKey,
25
- type: "distant",
26
- status: { status: "fetching" }
28
+ type: "remote",
29
+ status: "fetching"
27
30
  }
28
31
  ]);
29
32
  try {
@@ -42,42 +45,35 @@ const fetchDistantDictionaries = async (options) => {
42
45
  if (!distantDictionary) {
43
46
  throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
44
47
  }
45
- logger.updateStatus([
46
- { dictionaryKey, type: "distant", status: { status: "imported" } }
48
+ onStatusUpdate?.([
49
+ { dictionaryKey, type: "remote", status: "fetched" }
47
50
  ]);
48
51
  return distantDictionary;
49
52
  } catch (error) {
50
- logger.updateStatus([
53
+ onStatusUpdate?.([
51
54
  {
52
55
  dictionaryKey,
53
- type: "distant",
54
- status: {
55
- status: "error",
56
- error,
57
- errorMessage: `${options?.logPrefix ?? ""}Error fetching dictionary ${dictionaryKey}: ${error}`
58
- }
56
+ type: "remote",
57
+ status: "error",
58
+ error: `Error fetching dictionary ${dictionaryKey}: ${error}`
59
59
  }
60
60
  ]);
61
61
  return void 0;
62
62
  }
63
63
  };
64
- const fetchPromises = distantDictionariesKeys.map(
65
- (dictionaryKey) => limit(async () => await processDictionary(dictionaryKey))
64
+ const result = await parallelize(
65
+ distantDictionariesKeys,
66
+ async (dictionaryKey) => await processDictionary(dictionaryKey)
66
67
  );
67
- const result = await Promise.all(fetchPromises);
68
- const statuses = logger.getStatuses();
69
- for (const statusObj of statuses) {
70
- const currentState = statusObj.state.find((s) => s.type === "distant");
71
- if (currentState && currentState.errorMessage) {
72
- appLogger(currentState.errorMessage, { level: "error" });
73
- }
74
- }
75
68
  const filteredResult = result.filter(
76
69
  (dict) => dict !== void 0
77
70
  );
78
71
  return filteredResult;
79
72
  } catch (error) {
80
- appLogger(error, { level: "error" });
73
+ appLogger(
74
+ `${colorize("\u2717", ANSIColors.RED)} Failed to fetch distant dictionaries`,
75
+ { level: "error" }
76
+ );
81
77
  return [];
82
78
  }
83
79
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getDictionaryAPI, getOAuthAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, getConfiguration } from '@intlayer/config';\nimport pLimit from 'p-limit';\nimport { logger } from './log';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getOAuthAPI(config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n const limit = pLimit(5); // Limit the number of concurrent requests\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: { status: 'fetching' },\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n logger.updateStatus([\n { dictionaryKey, type: 'distant', status: { status: 'imported' } },\n ]);\n\n return distantDictionary;\n } catch (error) {\n logger.updateStatus([\n {\n dictionaryKey,\n type: 'distant',\n status: {\n status: 'error',\n error: error as Error,\n errorMessage: `${options?.logPrefix ?? ''}Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n },\n ]);\n return undefined;\n }\n };\n\n const fetchPromises = distantDictionariesKeys.map((dictionaryKey) =>\n limit(async () => await processDictionary(dictionaryKey))\n );\n\n const result = await Promise.all(fetchPromises);\n\n // Output any error messages\n const statuses = logger.getStatuses();\n for (const statusObj of statuses) {\n const currentState = statusObj.state.find((s) => s.type === 'distant');\n if (currentState && currentState.errorMessage) {\n appLogger(currentState.errorMessage, { level: 'error' });\n }\n }\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict): dict is DictionaryAPI => dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(error, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,mBAAmB;AAG9C,SAAS,cAAc,wBAAwB;AAC/C,OAAO,YAAY;AACnB,SAAS,cAAc;AAWhB,MAAM,2BAA2B,OACtC,YAC6B;AAC7B,QAAM,SAAS,iBAAiB;AAChC,QAAM,YAAY,aAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,UAAU,YAAY,MAAM;AAClC,UAAM,gBAAgB,iBAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAGxC,UAAM,QAAQ,OAAO,CAAC;AAEtB,UAAM,oBAAoB,OACxB,kBACuC;AACvC,aAAO,aAAa;AAAA,QAClB;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ,EAAE,QAAQ,WAAW;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,GAAI,qBAAqB;AAAA,cACvB,SAAS;AAAA,gBACP,eAAe,UAAU,iBAAiB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,eAAO,aAAa;AAAA,UAClB,EAAE,eAAe,MAAM,WAAW,QAAQ,EAAE,QAAQ,WAAW,EAAE;AAAA,QACnE,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,eAAO,aAAa;AAAA,UAClB;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,QAAQ;AAAA,cACR;AAAA,cACA,cAAc,GAAG,SAAS,aAAa,EAAE,6BAA6B,aAAa,KAAK,KAAK;AAAA,YAC/F;AAAA,UACF;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,gBAAgB,wBAAwB;AAAA,MAAI,CAAC,kBACjD,MAAM,YAAY,MAAM,kBAAkB,aAAa,CAAC;AAAA,IAC1D;AAEA,UAAM,SAAS,MAAM,QAAQ,IAAI,aAAa;AAG9C,UAAM,WAAW,OAAO,YAAY;AACpC,eAAW,aAAa,UAAU;AAChC,YAAM,eAAe,UAAU,MAAM,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AACrE,UAAI,gBAAgB,aAAa,cAAc;AAC7C,kBAAU,aAAa,cAAc,EAAE,OAAO,QAAQ,CAAC;AAAA,MACzD;AAAA,IACF;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SAAgC,SAAS;AAAA,IAC5C;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,cAAU,OAAO,EAAE,OAAO,QAAQ,CAAC;AACnC,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getDictionaryAPI, getOAuthAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport {\n ANSIColors,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const { clientId, clientSecret } = config.editor;\n const authAPI = getOAuthAPI(config);\n const dictionaryAPI = getDictionaryAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await authAPI.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n const distantDictionariesKeys = options.dictionaryKeys;\n\n // Process dictionaries in parallel with a concurrency limit\n\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult = await dictionaryAPI.getDictionary(\n dictionaryKey,\n undefined,\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (error) {\n appLogger(\n `${colorize('✗', ANSIColors.RED)} Failed to fetch distant dictionaries`,\n { level: 'error' }\n );\n return [];\n }\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,mBAAmB;AAG9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,mBAAmB;AAWrB,MAAM,2BAA2B,OACtC,SACA,mBAC6B;AAC7B,QAAM,SAAS,iBAAiB;AAChC,QAAM,YAAY,aAAa,MAAM;AACrC,MAAI;AACF,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,UAAU,YAAY,MAAM;AAClC,UAAM,gBAAgB,iBAAiB,QAAW,MAAM;AAExD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,QAAQ,qBAAqB;AAE7D,UAAM,oBAAoB,kBAAkB,MAAM;AAElD,UAAM,0BAA0B,QAAQ;AAIxC,UAAM,oBAAoB,OACxB,kBACuC;AACvC,uBAAiB;AAAA,QACf;AAAA,UACE;AAAA,UACA,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,UAAI;AAEF,cAAM,sBAAsB,MAAM,cAAc;AAAA,UAC9C;AAAA,UACA;AAAA,UACA;AAAA,YACE,GAAI,qBAAqB;AAAA,cACvB,SAAS;AAAA,gBACP,eAAe,UAAU,iBAAiB;AAAA,cAC5C;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAEA,cAAM,oBAAoB,oBAAoB;AAE9C,YAAI,CAAC,mBAAmB;AACtB,gBAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,QACnE;AAEA,yBAAiB;AAAA,UACf,EAAE,eAAe,MAAM,UAAU,QAAQ,UAAU;AAAA,QACrD,CAAC;AAED,eAAO;AAAA,MACT,SAAS,OAAO;AACd,yBAAiB;AAAA,UACf;AAAA,YACE;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,OAAO,6BAA6B,aAAa,KAAK,KAAK;AAAA,UAC7D;AAAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AAAA,IACF;AAEA,UAAM,SAAS,MAAM;AAAA,MACnB;AAAA,MACA,OAAO,kBAAkB,MAAM,kBAAkB,aAAa;AAAA,IAChE;AAGA,UAAM,iBAAiB,OAAO;AAAA,MAC5B,CAAC,SACC,SAAS;AAAA,IACb;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd;AAAA,MACE,GAAG,SAAS,UAAK,WAAW,GAAG,CAAC;AAAA,MAChC,EAAE,OAAO,QAAQ;AAAA,IACnB;AACA,WAAO,CAAC;AAAA,EACV;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { getIntlayerAPI } from "@intlayer/api";
2
2
  import { getConfiguration } from "@intlayer/config";
3
- const fetchDistantDictionaryKeys = async (configuration = getConfiguration()) => {
3
+ const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = getConfiguration()) => {
4
4
  const { clientId, clientSecret } = configuration.editor;
5
5
  if (!clientId || !clientSecret) {
6
6
  throw new Error(
@@ -10,7 +10,7 @@ const fetchDistantDictionaryKeys = async (configuration = getConfiguration()) =>
10
10
  const intlayerAPI = getIntlayerAPI(void 0, configuration);
11
11
  const oAuth2TokenResult = await intlayerAPI.oAuth.getOAuth2AccessToken();
12
12
  const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
13
- const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesKeys({
13
+ const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp({
14
14
  ...oAuth2AccessToken && {
15
15
  headers: {
16
16
  Authorization: `Bearer ${oAuth2AccessToken}`
@@ -20,10 +20,10 @@ const fetchDistantDictionaryKeys = async (configuration = getConfiguration()) =>
20
20
  if (!getDictionariesKeysResult.data) {
21
21
  throw new Error("No distant dictionaries found");
22
22
  }
23
- const distantDictionariesKeys = getDictionariesKeysResult.data;
24
- return distantDictionariesKeys;
23
+ const distantDictionariesUpdateTimeStamp = getDictionariesKeysResult.data;
24
+ return distantDictionariesUpdateTimeStamp;
25
25
  };
26
26
  export {
27
- fetchDistantDictionaryKeys
27
+ fetchDistantDictionaryKeysAndUpdateTimestamp
28
28
  };
29
- //# sourceMappingURL=fetchDistantDictionaryKeys.mjs.map
29
+ //# sourceMappingURL=fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPI(undefined, configuration);\n\n const oAuth2TokenResult = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp({\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n });\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,wBAA6C;AAE/C,MAAM,+CAA+C,OAC1D,gBAAgC,iBAAiB,MACb;AACpC,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe,QAAW,aAAa;AAE3D,QAAM,oBAAoB,MAAM,YAAY,MAAM,qBAAqB;AAEvE,QAAM,oBAAoB,kBAAkB,MAAM;AAGlD,QAAM,4BACJ,MAAM,YAAY,WAAW,+BAA+B;AAAA,IAC1D,GAAI,qBAAqB;AAAA,MACvB,SAAS;AAAA,QACP,eAAe,UAAU,iBAAiB;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AAEH,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
@@ -0,0 +1,40 @@
1
+ import configuration from "@intlayer/config/built";
2
+ import {
3
+ colorizeKey,
4
+ colorizePath,
5
+ getAppLogger
6
+ } from "@intlayer/config/client";
7
+ import { formatPath } from "./utils/formatter.mjs";
8
+ const filterInvalidDictionaries = (dictionaries) => {
9
+ const appLogger = getAppLogger(configuration);
10
+ return (dictionaries ?? [])?.filter((dictionary) => {
11
+ if (!dictionary) return false;
12
+ const isLocal = Boolean(dictionary.location === "locale");
13
+ const location = isLocal ? "Local" : "Remote";
14
+ const hasKey = Boolean(dictionary.key);
15
+ const hasContent = Boolean(dictionary.content);
16
+ if (!hasKey) {
17
+ appLogger(`${location} dictionary has no key`, {
18
+ level: "error"
19
+ });
20
+ appLogger(JSON.stringify(dictionary, null, 2), {
21
+ level: "error"
22
+ });
23
+ return false;
24
+ }
25
+ if (!hasContent) {
26
+ appLogger(
27
+ `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath("Remote")}`,
28
+ {
29
+ level: "error"
30
+ }
31
+ );
32
+ return false;
33
+ }
34
+ return true;
35
+ });
36
+ };
37
+ export {
38
+ filterInvalidDictionaries
39
+ };
40
+ //# sourceMappingURL=filterInvalidDictionaries.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { formatPath } from './utils/formatter';\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined\n): Dictionary[] => {\n const appLogger = getAppLogger(configuration);\n\n return (dictionaries ?? [])?.filter((dictionary) => {\n if (!dictionary) return false;\n\n const isLocal = Boolean(dictionary.location === 'locale');\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n appLogger(JSON.stringify(dictionary, null, 2), {\n level: 'error',\n });\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n return true;\n }) as Dictionary[];\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kBAAkB;AAEpB,MAAM,4BAA4B,CACvC,iBACiB;AACjB,QAAM,YAAY,aAAa,aAAa;AAE5C,UAAQ,gBAAgB,CAAC,IAAI,OAAO,CAAC,eAAe;AAClD,QAAI,CAAC,WAAY,QAAO;AAExB,UAAM,UAAU,QAAQ,WAAW,aAAa,QAAQ;AACxD,UAAM,WAAW,UAAU,UAAU;AACrC,UAAM,SAAS,QAAQ,WAAW,GAAG;AACrC,UAAM,aAAa,QAAQ,WAAW,OAAO;AAE7C,QAAI,CAAC,QAAQ;AACX,gBAAU,GAAG,QAAQ,0BAA0B;AAAA,QAC7C,OAAO;AAAA,MACT,CAAC;AACD,gBAAU,KAAK,UAAU,YAAY,MAAM,CAAC,GAAG;AAAA,QAC7C,OAAO;AAAA,MACT,CAAC;AACD,aAAO;AAAA,IACT;AAEA,QAAI,CAAC,YAAY;AACf;AAAA,QACE,GAAG,QAAQ,eAAe,YAAY,WAAW,GAAG,CAAC,qBAAqB,WAAW,WAAW,WAAW,WAAW,QAAQ,IAAI,aAAa,QAAQ,CAAC;AAAA,QACxJ;AAAA,UACE,OAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,CAAC;AACH;","names":[]}
@@ -0,0 +1,18 @@
1
+ import { getConfiguration, normalizePath } from "@intlayer/config";
2
+ import fg from "fast-glob";
3
+ import { existsSync, mkdirSync } from "fs";
4
+ const getBuiltFetchDictionariesPath = (configuration = getConfiguration(), format = "esm") => {
5
+ const { fetchDictionariesDir, mainDir } = configuration.content;
6
+ if (!existsSync(mainDir)) {
7
+ mkdirSync(mainDir, { recursive: true });
8
+ }
9
+ const extension = format === "cjs" ? "cjs" : "mjs";
10
+ const dictionariesPath = fg.sync(
11
+ `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`
12
+ );
13
+ return dictionariesPath;
14
+ };
15
+ export {
16
+ getBuiltFetchDictionariesPath
17
+ };
18
+ //# sourceMappingURL=getBuiltFetchDictionariesPath.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = (\n configuration = getConfiguration(),\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,qBAAqB;AAChD,OAAO,QAAQ;AACf,SAAS,YAAY,iBAAiB;AAK/B,MAAM,gCAAgC,CAC3C,gBAAgB,iBAAiB,GACjC,SAAwB,UACrB;AACH,QAAM,EAAE,sBAAsB,QAAQ,IAAI,cAAc;AAGxD,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,YAAY,WAAW,QAAQ,QAAQ;AAE7C,QAAM,mBAA6B,GAAG;AAAA,IACpC,GAAG,cAAc,oBAAoB,CAAC,SAAS,SAAS;AAAA,EAC1D;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,17 @@
1
+ import { getConfiguration, normalizePath } from "@intlayer/config";
2
+ import fg from "fast-glob";
3
+ import { existsSync, mkdirSync } from "fs";
4
+ const getBuiltRemoteDictionariesPath = (configuration = getConfiguration()) => {
5
+ const { remoteDictionariesDir, mainDir } = configuration.content;
6
+ if (!existsSync(mainDir)) {
7
+ mkdirSync(mainDir, { recursive: true });
8
+ }
9
+ const dictionariesPath = fg.sync(
10
+ `${normalizePath(remoteDictionariesDir)}/**/*.json`
11
+ );
12
+ return dictionariesPath;
13
+ };
14
+ export {
15
+ getBuiltRemoteDictionariesPath
16
+ };
17
+ //# sourceMappingURL=getBuiltRemoteDictionariesPath.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltRemoteDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,qBAAqB;AAChD,OAAO,QAAQ;AACf,SAAS,YAAY,iBAAiB;AAK/B,MAAM,iCAAiC,CAC5C,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,uBAAuB,QAAQ,IAAI,cAAc;AAGzD,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,GAAG;AAAA,IACpC,GAAG,cAAc,qBAAqB,CAAC;AAAA,EACzC;AAEA,SAAO;AACT;","names":[]}
@@ -1,4 +1,3 @@
1
- import { checkDictionaryChanges } from "./checkDictionaryChanges.mjs";
2
1
  import {
3
2
  buildAndWatchIntlayer,
4
3
  handleAdditionalContentDeclarationFile,
@@ -7,10 +6,9 @@ import {
7
6
  } from "./chokidar/watcher.mjs";
8
7
  import { cleanOutputDir } from "./cleanOutputDir.mjs";
9
8
  import { fetchDistantDictionaries } from "./fetchDistantDictionaries.mjs";
10
- import { fetchDistantDictionaryKeys } from "./fetchDistantDictionaryKeys.mjs";
9
+ import { fetchDistantDictionaryKeysAndUpdateTimestamp } from "./fetchDistantDictionaryKeysAndUpdateTimestamp.mjs";
11
10
  import { getBuiltDictionariesPath } from "./getBuiltDictionariesPath.mjs";
12
11
  import { getBuiltUnmergedDictionariesPath } from "./getBuiltUnmergedDictionariesPath.mjs";
13
- import { getFilteredLocalesContent } from "./getFilteredLocalesContent.mjs";
14
12
  import { listDictionaries } from "./listDictionariesPath.mjs";
15
13
  import {
16
14
  listGitFiles,
@@ -18,8 +16,8 @@ import {
18
16
  } from "./listGitFiles.mjs";
19
17
  import {
20
18
  loadDictionaries,
21
- loadDistantDictionaries,
22
- loadLocalDictionaries
19
+ loadLocalDictionaries,
20
+ loadRemoteDictionaries
23
21
  } from "./loadDictionaries/index.mjs";
24
22
  import { mergeDictionaries } from "./mergeDictionaries.mjs";
25
23
  import { prepareContentDeclaration } from "./prepareContentDeclaration.mjs";
@@ -32,6 +30,7 @@ import {
32
30
  generateDictionaryListContent
33
31
  } from "./transpiler/dictionary_to_main/index.mjs";
34
32
  import { createModuleAugmentation } from "./transpiler/dictionary_to_type/createModuleAugmentation.mjs";
33
+ import { formatLocale, formatPath } from "./utils/formatter.mjs";
35
34
  import { getFileHash } from "./utils/getFileHash.mjs";
36
35
  import { kebabCaseToCamelCase } from "./utils/kebabCaseToCamelCase.mjs";
37
36
  import { resolveObjectPromises } from "./utils/resolveObjectPromises.mjs";
@@ -43,17 +42,17 @@ import {
43
42
  export {
44
43
  buildAndWatchIntlayer,
45
44
  buildDictionary,
46
- checkDictionaryChanges,
47
45
  cleanOutputDir,
48
46
  createDictionaryEntryPoint,
49
47
  createModuleAugmentation,
50
48
  fetchDistantDictionaries,
51
- fetchDistantDictionaryKeys,
49
+ fetchDistantDictionaryKeysAndUpdateTimestamp,
50
+ formatLocale,
51
+ formatPath,
52
52
  generateDictionaryListContent,
53
53
  getBuiltDictionariesPath,
54
54
  getBuiltUnmergedDictionariesPath,
55
55
  getFileHash,
56
- getFilteredLocalesContent,
57
56
  handleAdditionalContentDeclarationFile,
58
57
  handleContentDeclarationFileChange,
59
58
  kebabCaseToCamelCase,
@@ -61,8 +60,8 @@ export {
61
60
  listGitFiles,
62
61
  listGitLines,
63
62
  loadDictionaries,
64
- loadDistantDictionaries,
65
63
  loadLocalDictionaries,
64
+ loadRemoteDictionaries,
66
65
  mergeDictionaries,
67
66
  prepareContentDeclaration,
68
67
  prepareIntlayer,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { checkDictionaryChanges } from './checkDictionaryChanges';\nexport {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { getFilteredLocalesContent } from './getFilteredLocalesContent';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadDistantDictionaries,\n loadLocalDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,iCAAiC;AAC1C,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadLocalDictionaries,\n loadRemoteDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { formatLocale, formatPath } from './utils/formatter';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,oDAAoD;AAC7D,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,cAAc,kBAAkB;AACzC,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;","names":[]}
@@ -1,5 +1,5 @@
1
+ export * from "./loadContentDeclaration.mjs";
1
2
  export * from "./loadDictionaries.mjs";
2
- export * from "./loadDistantDictionaries.mjs";
3
3
  export * from "./loadLocalDictionaries.mjs";
4
- export * from "./loadContentDeclaration.mjs";
4
+ export * from "./loadRemoteDictionaries.mjs";
5
5
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/loadDictionaries/index.ts"],"sourcesContent":["export * from './loadDictionaries';\nexport * from './loadDistantDictionaries';\nexport * from './loadLocalDictionaries';\nexport * from './loadContentDeclaration';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/loadDictionaries/index.ts"],"sourcesContent":["export * from './loadContentDeclaration';\nexport * from './loadDictionaries';\nexport * from './loadLocalDictionaries';\nexport * from './loadRemoteDictionaries';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1,26 +1,69 @@
1
- import { ESMxCJSRequire, loadExternalFile } from "@intlayer/config";
1
+ import {
2
+ ESMxCJSRequire,
3
+ getConfiguration,
4
+ loadExternalFile
5
+ } from "@intlayer/config";
6
+ import { relative } from "path";
7
+ import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
2
8
  import { processContentDeclaration } from "../transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs";
3
- const loadContentDeclarations = async (contentDeclarationFilePath, projectRequire = ESMxCJSRequire) => {
4
- const contentDeclarations = contentDeclarationFilePath.map((path) => ({
5
- ...loadExternalFile(path, void 0, projectRequire),
6
- filePath: path
9
+ import { parallelize } from "../utils/parallelize.mjs";
10
+ const formatLocalDictionaries = (dictionariesRecord) => Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({
11
+ ...dict,
12
+ localId: `${dict.key}::local::${relativePath}`,
13
+ location: "locale",
14
+ filePath: relativePath
15
+ }));
16
+ const loadContentDeclarations = async (contentDeclarationFilePath, configuration = getConfiguration(), projectRequire = ESMxCJSRequire, onStatusUpdate) => {
17
+ const dictionariesRecord = contentDeclarationFilePath.reduce(
18
+ (acc, path) => {
19
+ const relativePath = relative(configuration.content.baseDir, path);
20
+ return {
21
+ ...acc,
22
+ [relativePath]: loadExternalFile(path, void 0, projectRequire)
23
+ };
24
+ },
25
+ {}
26
+ );
27
+ const contentDeclarations = formatLocalDictionaries(dictionariesRecord);
28
+ const listFoundDictionaries = contentDeclarations.map((declaration) => ({
29
+ dictionaryKey: declaration.key,
30
+ type: "local",
31
+ status: "found"
7
32
  }));
8
- const resultDictionariesPaths = [];
9
- for await (const contentDeclaration of contentDeclarations) {
10
- if (!contentDeclaration) {
11
- continue;
33
+ onStatusUpdate?.(listFoundDictionaries);
34
+ const processedDictionaries = await parallelize(
35
+ contentDeclarations,
36
+ async (contentDeclaration) => {
37
+ if (!contentDeclaration) {
38
+ return void 0;
39
+ }
40
+ onStatusUpdate?.([
41
+ {
42
+ dictionaryKey: contentDeclaration.key,
43
+ type: "local",
44
+ status: "building"
45
+ }
46
+ ]);
47
+ const processedContentDeclaration = await processContentDeclaration(
48
+ contentDeclaration
49
+ );
50
+ if (!processedContentDeclaration) {
51
+ return void 0;
52
+ }
53
+ onStatusUpdate?.([
54
+ {
55
+ dictionaryKey: processedContentDeclaration.key,
56
+ type: "local",
57
+ status: "built"
58
+ }
59
+ ]);
60
+ return processedContentDeclaration;
12
61
  }
13
- const processedContentDeclaration = await processContentDeclaration(
14
- contentDeclaration
15
- );
16
- if (!processedContentDeclaration) {
17
- continue;
18
- }
19
- resultDictionariesPaths.push(processedContentDeclaration);
20
- }
21
- return resultDictionariesPaths;
62
+ );
63
+ return filterInvalidDictionaries(processedDictionaries);
22
64
  };
23
65
  export {
66
+ formatLocalDictionaries,
24
67
  loadContentDeclarations
25
68
  };
26
69
  //# sourceMappingURL=loadContentDeclaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import { ESMxCJSRequire, loadExternalFile } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { processContentDeclaration } from '../transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration';\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n projectRequire = ESMxCJSRequire\n): Promise<Dictionary[]> => {\n const contentDeclarations = contentDeclarationFilePath.map((path) => ({\n ...loadExternalFile(path, undefined, projectRequire),\n filePath: path,\n }));\n const resultDictionariesPaths: Dictionary[] = [];\n\n for await (const contentDeclaration of contentDeclarations) {\n if (!contentDeclaration) {\n continue;\n }\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n continue;\n }\n\n resultDictionariesPaths.push(processedContentDeclaration);\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":"AAAA,SAAS,gBAAgB,wBAAwB;AAEjD,SAAS,iCAAiC;AAEnC,MAAM,0BAA0B,OACrC,4BACA,iBAAiB,mBACS;AAC1B,QAAM,sBAAsB,2BAA2B,IAAI,CAAC,UAAU;AAAA,IACpE,GAAG,iBAAiB,MAAM,QAAW,cAAc;AAAA,IACnD,UAAU;AAAA,EACZ,EAAE;AACF,QAAM,0BAAwC,CAAC;AAE/C,mBAAiB,sBAAsB,qBAAqB;AAC1D,QAAI,CAAC,oBAAoB;AACvB;AAAA,IACF;AAEA,UAAM,8BAA8B,MAAM;AAAA,MACxC;AAAA,IACF;AAEA,QAAI,CAAC,6BAA6B;AAChC;AAAA,IACF;AAEA,4BAAwB,KAAK,2BAA2B;AAAA,EAC1D;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n loadExternalFile,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { relative } from 'path';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { processContentDeclaration } from '../transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration';\nimport { parallelize } from '../utils/parallelize';\nimport { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>\n): Dictionary[] =>\n Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'locale' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const dictionariesRecord = contentDeclarationFilePath.reduce(\n (acc, path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n return {\n ...acc,\n [relativePath]: loadExternalFile(path, undefined, projectRequire),\n };\n },\n {} as Record<string, Dictionary>\n );\n const contentDeclarations: Dictionary[] =\n formatLocalDictionaries(dictionariesRecord);\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries);\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB;AAGrB,MAAM,0BAA0B,CACrC,uBAEA,OAAO,QAAQ,kBAAkB,EAAE,IAAI,CAAC,CAAC,cAAc,IAAI,OAAO;AAAA,EAChE,GAAG;AAAA,EACH,SAAS,GAAG,KAAK,GAAG,YAAY,YAAY;AAAA,EAC5C,UAAU;AAAA,EACV,UAAU;AACZ,EAAE;AAEG,MAAM,0BAA0B,OACrC,4BACA,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,mBAC0B;AAC1B,QAAM,qBAAqB,2BAA2B;AAAA,IACpD,CAAC,KAAK,SAAS;AACb,YAAM,eAAe,SAAS,cAAc,QAAQ,SAAS,IAAI;AACjE,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,YAAY,GAAG,iBAAiB,MAAM,QAAW,cAAc;AAAA,MAClE;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,sBACJ,wBAAwB,kBAAkB;AAE5C,QAAM,wBAAwB,oBAAoB,IAAI,CAAC,iBAAiB;AAAA,IACtE,eAAe,YAAY;AAAA,IAC3B,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,EAAE;AAEF,mBAAiB,qBAAqB;AAEtC,QAAM,wBAAwB,MAAM;AAAA,IAClC;AAAA,IACA,OAAO,uBAAwD;AAC7D,UAAI,CAAC,oBAAoB;AACvB,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,mBAAmB;AAAA,UAClC,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,YAAM,8BAA8B,MAAM;AAAA,QACxC;AAAA,MACF;AAEA,UAAI,CAAC,6BAA6B;AAChC,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,4BAA4B;AAAA,UAC3C,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,0BAA0B,qBAAqB;AACxD;","names":[]}