@intlayer/cli 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 (114) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +240 -0
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -0
  3. package/dist/cjs/cli.cjs +29 -7
  4. package/dist/cjs/cli.cjs.map +1 -1
  5. package/dist/cjs/config.cjs +5 -1
  6. package/dist/cjs/config.cjs.map +1 -1
  7. package/dist/cjs/fill/autoFill.cjs +105 -0
  8. package/dist/cjs/fill/autoFill.cjs.map +1 -0
  9. package/dist/cjs/fill/formatAutoFillData.cjs +108 -0
  10. package/dist/cjs/fill/formatAutoFillData.cjs.map +1 -0
  11. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +46 -0
  12. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -0
  13. package/dist/cjs/fill/getTargetDictionary.cjs +86 -0
  14. package/dist/cjs/fill/getTargetDictionary.cjs.map +1 -0
  15. package/dist/cjs/fill/index.cjs +257 -0
  16. package/dist/cjs/fill/index.cjs.map +1 -0
  17. package/dist/cjs/index.cjs +4 -2
  18. package/dist/cjs/index.cjs.map +1 -1
  19. package/dist/cjs/listContentDeclaration.cjs +37 -19
  20. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  21. package/dist/cjs/liveSync.cjs +254 -0
  22. package/dist/cjs/liveSync.cjs.map +1 -0
  23. package/dist/cjs/pull.cjs +18 -22
  24. package/dist/cjs/pull.cjs.map +1 -1
  25. package/dist/cjs/push.cjs +28 -27
  26. package/dist/cjs/push.cjs.map +1 -1
  27. package/dist/cjs/pushConfig.cjs +8 -15
  28. package/dist/cjs/pushConfig.cjs.map +1 -1
  29. package/dist/cjs/reviewDoc.cjs +43 -26
  30. package/dist/cjs/reviewDoc.cjs.map +1 -1
  31. package/dist/cjs/test/index.cjs +91 -0
  32. package/dist/cjs/test/index.cjs.map +1 -0
  33. package/dist/cjs/test/listMissingTranslations.cjs +73 -0
  34. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -0
  35. package/dist/cjs/translateDoc.cjs +40 -24
  36. package/dist/cjs/translateDoc.cjs.map +1 -1
  37. package/dist/cjs/utils/checkAIAccess.cjs +5 -1
  38. package/dist/cjs/utils/checkAIAccess.cjs.map +1 -1
  39. package/dist/esm/IntlayerEventListener.mjs +206 -0
  40. package/dist/esm/IntlayerEventListener.mjs.map +1 -0
  41. package/dist/esm/cli.mjs +26 -4
  42. package/dist/esm/cli.mjs.map +1 -1
  43. package/dist/esm/config.mjs +5 -1
  44. package/dist/esm/config.mjs.map +1 -1
  45. package/dist/esm/fill/autoFill.mjs +92 -0
  46. package/dist/esm/fill/autoFill.mjs.map +1 -0
  47. package/dist/esm/fill/formatAutoFillData.mjs +84 -0
  48. package/dist/esm/fill/formatAutoFillData.mjs.map +1 -0
  49. package/dist/esm/fill/formatAutoFilledFilePath.mjs +22 -0
  50. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -0
  51. package/dist/esm/fill/getTargetDictionary.mjs +51 -0
  52. package/dist/esm/fill/getTargetDictionary.mjs.map +1 -0
  53. package/dist/esm/fill/index.mjs +240 -0
  54. package/dist/esm/fill/index.mjs.map +1 -0
  55. package/dist/esm/index.mjs +2 -1
  56. package/dist/esm/index.mjs.map +1 -1
  57. package/dist/esm/listContentDeclaration.mjs +38 -17
  58. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  59. package/dist/esm/liveSync.mjs +220 -0
  60. package/dist/esm/liveSync.mjs.map +1 -0
  61. package/dist/esm/pull.mjs +19 -21
  62. package/dist/esm/pull.mjs.map +1 -1
  63. package/dist/esm/push.mjs +33 -27
  64. package/dist/esm/push.mjs.map +1 -1
  65. package/dist/esm/pushConfig.mjs +8 -15
  66. package/dist/esm/pushConfig.mjs.map +1 -1
  67. package/dist/esm/reviewDoc.mjs +53 -28
  68. package/dist/esm/reviewDoc.mjs.map +1 -1
  69. package/dist/esm/test/index.mjs +74 -0
  70. package/dist/esm/test/index.mjs.map +1 -0
  71. package/dist/esm/test/listMissingTranslations.mjs +41 -0
  72. package/dist/esm/test/listMissingTranslations.mjs.map +1 -0
  73. package/dist/esm/translateDoc.mjs +50 -27
  74. package/dist/esm/translateDoc.mjs.map +1 -1
  75. package/dist/esm/utils/checkAIAccess.mjs +5 -1
  76. package/dist/esm/utils/checkAIAccess.mjs.map +1 -1
  77. package/dist/types/IntlayerEventListener.d.ts +85 -0
  78. package/dist/types/IntlayerEventListener.d.ts.map +1 -0
  79. package/dist/types/cli.d.ts.map +1 -1
  80. package/dist/types/config.d.ts.map +1 -1
  81. package/dist/types/fill/autoFill.d.ts +4 -0
  82. package/dist/types/fill/autoFill.d.ts.map +1 -0
  83. package/dist/types/fill/formatAutoFillData.d.ts +9 -0
  84. package/dist/types/fill/formatAutoFillData.d.ts.map +1 -0
  85. package/dist/types/fill/formatAutoFilledFilePath.d.ts +3 -0
  86. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -0
  87. package/dist/types/fill/getTargetDictionary.d.ts +4 -0
  88. package/dist/types/fill/getTargetDictionary.d.ts.map +1 -0
  89. package/dist/types/{fill.d.ts → fill/index.d.ts} +2 -5
  90. package/dist/types/fill/index.d.ts.map +1 -0
  91. package/dist/types/index.d.ts +1 -0
  92. package/dist/types/index.d.ts.map +1 -1
  93. package/dist/types/listContentDeclaration.d.ts +4 -5
  94. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  95. package/dist/types/liveSync.d.ts +6 -0
  96. package/dist/types/liveSync.d.ts.map +1 -0
  97. package/dist/types/pull.d.ts.map +1 -1
  98. package/dist/types/push.d.ts +1 -1
  99. package/dist/types/push.d.ts.map +1 -1
  100. package/dist/types/pushConfig.d.ts +0 -1
  101. package/dist/types/pushConfig.d.ts.map +1 -1
  102. package/dist/types/reviewDoc.d.ts.map +1 -1
  103. package/dist/types/test/index.d.ts +8 -0
  104. package/dist/types/test/index.d.ts.map +1 -0
  105. package/dist/types/test/listMissingTranslations.d.ts +12 -0
  106. package/dist/types/test/listMissingTranslations.d.ts.map +1 -0
  107. package/dist/types/translateDoc.d.ts.map +1 -1
  108. package/dist/types/utils/checkAIAccess.d.ts.map +1 -1
  109. package/package.json +17 -15
  110. package/dist/cjs/fill.cjs +0 -405
  111. package/dist/cjs/fill.cjs.map +0 -1
  112. package/dist/esm/fill.mjs +0 -385
  113. package/dist/esm/fill.mjs.map +0 -1
  114. package/dist/types/fill.d.ts.map +0 -1
package/dist/esm/fill.mjs DELETED
@@ -1,385 +0,0 @@
1
- import { getAiAPI, getOAuthAPI } from "@intlayer/api";
2
- import {
3
- getFilteredLocalesContent,
4
- listGitFiles,
5
- mergeDictionaries,
6
- processPerLocaleDictionary,
7
- reduceDictionaryContent,
8
- writeContentDeclaration
9
- } from "@intlayer/chokidar";
10
- import {
11
- getAppLogger,
12
- getConfiguration,
13
- Locales
14
- } from "@intlayer/config";
15
- import {
16
- getLocaleName,
17
- getLocalisedContent
18
- } from "@intlayer/core";
19
- import dictionariesRecord from "@intlayer/dictionaries-entry";
20
- import unmergedDictionariesRecord from "@intlayer/unmerged-dictionaries-entry";
21
- import pLimit from "p-limit";
22
- import { dirname, extname, join, relative } from "path";
23
- import { checkAIAccess } from "./utils/checkAIAccess.mjs";
24
- const NB_CONCURRENT_TRANSLATIONS = 5;
25
- const ensureArray = (value) => [value].flat();
26
- const getTargetDictionary = async (options) => {
27
- const configuration = getConfiguration(options.configOptions);
28
- const { baseDir } = configuration.content;
29
- let result = Object.values(unmergedDictionariesRecord).flat();
30
- if (typeof options.file !== "undefined") {
31
- const fileArray = ensureArray(options.file);
32
- const absoluteFilePaths = fileArray.map((file) => join(baseDir, file));
33
- result = result.filter(
34
- (dict) => dict.filePath && (absoluteFilePaths.includes(dict.filePath) || absoluteFilePaths.includes(join(baseDir, dict.filePath)))
35
- );
36
- }
37
- if (typeof options.keys !== "undefined") {
38
- result = result.filter(
39
- (dict) => ensureArray(options.keys)?.includes(dict.key)
40
- );
41
- }
42
- if (typeof options.excludedKeys !== "undefined") {
43
- result = result.filter(
44
- (dict) => !ensureArray(options.excludedKeys)?.includes(dict.key)
45
- );
46
- }
47
- if (typeof options.pathFilter !== "undefined") {
48
- result = result.filter(
49
- (dict) => ensureArray(options.pathFilter)?.includes(dict.filePath ?? "")
50
- );
51
- }
52
- if (typeof options.filter !== "undefined") {
53
- result = result.filter(options.filter);
54
- }
55
- const gitOptions = options.gitOptions;
56
- if (gitOptions) {
57
- const gitChangedFiles = await listGitFiles(gitOptions);
58
- if (gitChangedFiles) {
59
- result = result.filter((dict) => {
60
- if (!dict.filePath) return false;
61
- return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);
62
- });
63
- }
64
- }
65
- return result.filter((dict) => !dict.autoFilled);
66
- };
67
- const transformUriToAbsolutePath = (uri, filePath, baseDir) => {
68
- if (uri.startsWith("/")) {
69
- return join(baseDir, uri);
70
- }
71
- if (uri.startsWith("./")) {
72
- return join(dirname(filePath), uri);
73
- }
74
- return filePath;
75
- };
76
- const formatAutoFillData = (autoFillOptions, localeList, filePath, dictionaryKey, configuration) => {
77
- const outputContentDeclarationFile = [];
78
- if (!Boolean(autoFillOptions)) return outputContentDeclarationFile;
79
- if (autoFillOptions === true) {
80
- let jsonFilePath = filePath.replace(extname(filePath), ".json");
81
- if (filePath === jsonFilePath) {
82
- jsonFilePath = jsonFilePath.replace(extname(jsonFilePath), ".fill.json");
83
- }
84
- outputContentDeclarationFile.push({
85
- localeList,
86
- filePath: jsonFilePath
87
- });
88
- }
89
- if (typeof autoFillOptions === "string") {
90
- if (autoFillOptions.includes("{{locale}}")) {
91
- const output = localeList.map((locale) => ({
92
- localeList: [locale],
93
- filePath: transformUriToAbsolutePath(
94
- autoFillOptions.replace("{{locale}}", locale).replace("{{key}}", dictionaryKey),
95
- filePath,
96
- configuration.content.baseDir
97
- )
98
- }));
99
- outputContentDeclarationFile.push(...output);
100
- } else {
101
- outputContentDeclarationFile.push({
102
- localeList,
103
- filePath: transformUriToAbsolutePath(
104
- autoFillOptions,
105
- filePath,
106
- configuration.content.baseDir
107
- )
108
- });
109
- }
110
- return outputContentDeclarationFile;
111
- }
112
- if (typeof autoFillOptions === "object") {
113
- const localeList2 = Object.keys(autoFillOptions).filter(
114
- (locale) => typeof autoFillOptions[locale] === "string"
115
- );
116
- const output = localeList2.map((locale) => ({
117
- localeList: [locale],
118
- filePath: transformUriToAbsolutePath(
119
- autoFillOptions[locale].replace("{{key}}", dictionaryKey),
120
- filePath,
121
- configuration.content.baseDir
122
- )
123
- }));
124
- const groupedByFilePath = output.reduce((acc, curr) => {
125
- const existing = acc.find((item) => item.filePath === curr.filePath);
126
- if (existing) {
127
- existing.localeList.push(...curr.localeList);
128
- } else {
129
- acc.push(curr);
130
- }
131
- return acc;
132
- }, []);
133
- outputContentDeclarationFile.push(...groupedByFilePath);
134
- }
135
- return outputContentDeclarationFile;
136
- };
137
- const autoFill = async (fullDictionary, contentDeclarationFile, autoFillOptions, outputLocales, parentLocales, configuration) => {
138
- const appLogger = getAppLogger(configuration);
139
- let localeList = (outputLocales ?? configuration.internationalization.locales).filter((locale) => !parentLocales?.includes(locale));
140
- const filePath = contentDeclarationFile.filePath;
141
- if (!filePath) {
142
- appLogger("No file path found for dictionary", {
143
- level: "error"
144
- });
145
- return;
146
- }
147
- const autoFillData = formatAutoFillData(
148
- autoFillOptions,
149
- localeList,
150
- filePath,
151
- fullDictionary.key,
152
- configuration
153
- );
154
- appLogger(`Auto fill data: ${JSON.stringify(autoFillData, null, 2)}`, {
155
- level: "info",
156
- isVerbose: true
157
- });
158
- for await (const output of autoFillData) {
159
- const reducedDictionary = reduceDictionaryContent(
160
- fullDictionary,
161
- contentDeclarationFile
162
- );
163
- const isPerLocaleDeclarationFile = output.localeList.length === 1;
164
- if (isPerLocaleDeclarationFile) {
165
- const sourceLocale = output.localeList[0];
166
- const sourceLocaleContent = getLocalisedContent(
167
- reducedDictionary,
168
- sourceLocale,
169
- { dictionaryKey: reducedDictionary.key, keyPath: [] }
170
- );
171
- await writeContentDeclaration({
172
- ...fullDictionary,
173
- locale: sourceLocale,
174
- autoFilled: true,
175
- autoFill: void 0,
176
- content: sourceLocaleContent.content,
177
- filePath: output.filePath
178
- });
179
- } else {
180
- const content = getFilteredLocalesContent(
181
- reducedDictionary.content,
182
- output.localeList,
183
- { dictionaryKey: reducedDictionary.key, keyPath: [] }
184
- );
185
- await writeContentDeclaration({
186
- ...fullDictionary,
187
- autoFilled: true,
188
- autoFill: void 0,
189
- content,
190
- filePath: output.filePath
191
- });
192
- }
193
- }
194
- };
195
- const fill = async (options) => {
196
- const configuration = getConfiguration(options.configOptions);
197
- const appLogger = getAppLogger(configuration);
198
- const { defaultLocale, locales } = configuration.internationalization;
199
- const mode = options.mode ?? "review";
200
- const baseLocale = options.sourceLocale ?? defaultLocale;
201
- checkAIAccess(configuration, options.aiOptions);
202
- let oAuth2AccessToken;
203
- if (configuration.editor.clientId) {
204
- const intlayerAuthAPI = getOAuthAPI(configuration);
205
- const oAuth2TokenResult = await intlayerAuthAPI.getOAuth2AccessToken();
206
- oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
207
- }
208
- appLogger("Starting fill function", {
209
- level: "info"
210
- });
211
- const targetUnmergedDictionaries = await getTargetDictionary(options);
212
- const outputLocalesList = (options.outputLocales ? ensureArray(options.outputLocales) : locales).filter(
213
- (locale) => (
214
- // If mode is review, translate all locales
215
- // If mode is complete, translate only the locales that are not the source locale
216
- mode === "review" ? true : locale !== baseLocale
217
- )
218
- );
219
- const affectedDictionaryKeys = /* @__PURE__ */ new Set();
220
- targetUnmergedDictionaries.forEach((dict) => {
221
- affectedDictionaryKeys.add(dict.key);
222
- });
223
- appLogger(
224
- [
225
- "Affected dictionary keys for processing:",
226
- Array.from(affectedDictionaryKeys).join(", ")
227
- ],
228
- {
229
- isVerbose: true
230
- }
231
- );
232
- for (const targetUnmergedDictionary of targetUnmergedDictionaries) {
233
- const dictionaryKey = targetUnmergedDictionary.key;
234
- const mainDictionaryToProcess = dictionariesRecord[dictionaryKey];
235
- const sourceLocale = targetUnmergedDictionary.locale ?? baseLocale;
236
- if (!mainDictionaryToProcess) {
237
- appLogger(
238
- `Dictionary with key "${dictionaryKey}" not found in dictionariesRecord. Skipping.`,
239
- {
240
- level: "warn"
241
- }
242
- );
243
- continue;
244
- }
245
- if (!targetUnmergedDictionary.filePath) {
246
- appLogger(
247
- `Dictionary with key "${dictionaryKey}" has no file path. Skipping.`,
248
- {
249
- level: "warn"
250
- }
251
- );
252
- continue;
253
- }
254
- const relativePath = relative(
255
- configuration.content.baseDir,
256
- targetUnmergedDictionary.filePath
257
- );
258
- appLogger(`Processing content declaration: ${relativePath}`, {
259
- isVerbose: true
260
- });
261
- const sourceLocaleContent = getLocalisedContent(
262
- mainDictionaryToProcess,
263
- sourceLocale,
264
- { dictionaryKey, keyPath: [] }
265
- );
266
- if (Object.keys(sourceLocaleContent).length === 0) {
267
- appLogger(
268
- `No content found for dictionary ${dictionaryKey} in source locale ${sourceLocale}. Skipping translation for this dictionary.`,
269
- {
270
- level: "warn"
271
- }
272
- );
273
- continue;
274
- }
275
- const result = [];
276
- const limit = pLimit(
277
- options.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS
278
- );
279
- const translationPromises = outputLocalesList.map(
280
- (targetLocale) => limit(async () => {
281
- appLogger(
282
- `Preparing translation for '${dictionaryKey}' dictionary from ${getLocaleName(
283
- sourceLocale,
284
- Locales.ENGLISH
285
- )} (${sourceLocale}) to ${getLocaleName(targetLocale, Locales.ENGLISH)} (${targetLocale})`,
286
- {
287
- isVerbose: true
288
- }
289
- );
290
- const presetOutputContent = getLocalisedContent(
291
- mainDictionaryToProcess,
292
- targetLocale,
293
- { dictionaryKey, keyPath: [] }
294
- );
295
- try {
296
- const translationResult = await getAiAPI(
297
- void 0,
298
- configuration
299
- ).translateJSON(
300
- {
301
- entryFileContent: sourceLocaleContent.content,
302
- // Should be JSON, ensure getLocalisedContent provides this.
303
- presetOutputContent: presetOutputContent.content,
304
- // Should be JSON
305
- dictionaryDescription: mainDictionaryToProcess.description,
306
- entryLocale: sourceLocale,
307
- outputLocale: targetLocale,
308
- mode,
309
- aiOptions: options.aiOptions
310
- },
311
- {
312
- ...oAuth2AccessToken && {
313
- headers: {
314
- Authorization: `Bearer ${oAuth2AccessToken}`
315
- }
316
- }
317
- }
318
- );
319
- if (!translationResult.data?.fileContent) {
320
- appLogger(
321
- `No content result found for ${dictionaryKey} to ${targetLocale}`,
322
- {
323
- level: "error"
324
- }
325
- );
326
- return null;
327
- }
328
- const processedPerLocaleDictionary = processPerLocaleDictionary({
329
- ...mainDictionaryToProcess,
330
- content: translationResult.data?.fileContent,
331
- locale: targetLocale
332
- });
333
- return processedPerLocaleDictionary;
334
- } catch (error) {
335
- appLogger(
336
- `Error filling ${dictionaryKey} to ${targetLocale}:` + error,
337
- {
338
- level: "error"
339
- }
340
- );
341
- return null;
342
- }
343
- })
344
- );
345
- const translationResults = await Promise.all(translationPromises);
346
- translationResults.forEach((translationResult) => {
347
- if (translationResult) {
348
- result.push(translationResult);
349
- }
350
- });
351
- const dictionaryToMerge = mode === "review" ? [...result, mainDictionaryToProcess] : [mainDictionaryToProcess, ...result];
352
- const mergedResults = mergeDictionaries(dictionaryToMerge);
353
- let formattedDict = targetUnmergedDictionary;
354
- if (formattedDict.locale) {
355
- const presetOutputContent = getLocalisedContent(
356
- mainDictionaryToProcess,
357
- formattedDict.locale,
358
- { dictionaryKey, keyPath: [] }
359
- );
360
- formattedDict = {
361
- ...formattedDict,
362
- content: presetOutputContent.content
363
- };
364
- }
365
- const reducedResult = reduceDictionaryContent(mergedResults, formattedDict);
366
- await writeContentDeclaration(
367
- { ...formattedDict, content: reducedResult.content },
368
- configuration,
369
- formattedDict.filePath
370
- );
371
- if (!formattedDict.autoFill) return;
372
- await autoFill(
373
- mergedResults,
374
- targetUnmergedDictionary,
375
- formattedDict.autoFill,
376
- outputLocalesList,
377
- [sourceLocale],
378
- configuration
379
- );
380
- }
381
- };
382
- export {
383
- fill
384
- };
385
- //# sourceMappingURL=fill.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/fill.ts"],"sourcesContent":["import { AIOptions, getAiAPI, getOAuthAPI } from '@intlayer/api'; // Importing only getAiAPI for now\nimport {\n getFilteredLocalesContent,\n listGitFiles,\n ListGitFilesOptions,\n mergeDictionaries,\n processPerLocaleDictionary,\n reduceDictionaryContent,\n writeContentDeclaration,\n} from '@intlayer/chokidar';\nimport {\n getAppLogger,\n getConfiguration,\n GetConfigurationOptions,\n type IntlayerConfig,\n Locales,\n} from '@intlayer/config';\nimport {\n type AutoFill,\n type ContentNode,\n type Dictionary,\n getLocaleName,\n getLocalisedContent,\n} from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/dictionaries-entry';\nimport unmergedDictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport pLimit from 'p-limit';\nimport { dirname, extname, join, relative } from 'path';\nimport { checkAIAccess } from './utils/checkAIAccess';\n\nconst NB_CONCURRENT_TRANSLATIONS = 5;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locales;\n outputLocales?: Locales | Locales[];\n file?: string | string[];\n mode?: 'complete' | 'review';\n keys?: string | string[];\n excludedKeys?: string | string[];\n filter?: (entry: Dictionary) => boolean; // DictionaryEntry needs to be defined\n pathFilter?: string | string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n};\n\nconst ensureArray = <T>(value: T | T[]): T[] => [value].flat() as T[];\n\nconst getTargetDictionary = async (options: FillOptions) => {\n const configuration = getConfiguration(options.configOptions);\n\n const { baseDir } = configuration.content;\n\n let result = Object.values(unmergedDictionariesRecord).flat();\n\n // 1. if filePath not defined, list all content declaration files based on unmerged dictionaries list\n if (typeof options.file !== 'undefined') {\n const fileArray = ensureArray(options.file);\n const absoluteFilePaths = fileArray.map((file) => join(baseDir, file));\n\n result = result.filter(\n (dict) =>\n dict.filePath &&\n (absoluteFilePaths.includes(dict.filePath) ||\n absoluteFilePaths.includes(join(baseDir, dict.filePath)))\n );\n }\n\n if (typeof options.keys !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options.keys)?.includes(dict.key)\n );\n }\n\n if (typeof options.excludedKeys !== 'undefined') {\n result = result.filter(\n (dict) => !ensureArray(options.excludedKeys)?.includes(dict.key)\n );\n }\n\n if (typeof options.pathFilter !== 'undefined') {\n result = result.filter((dict) =>\n ensureArray(options.pathFilter)?.includes(dict.filePath ?? '')\n );\n }\n\n if (typeof options.filter !== 'undefined') {\n result = result.filter(options.filter);\n }\n\n const gitOptions = options.gitOptions;\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n result = result.filter((dict) => {\n if (!dict.filePath) return false;\n\n return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);\n });\n }\n }\n\n return result.filter((dict) => !dict.autoFilled);\n};\n\nconst transformUriToAbsolutePath = (\n uri: string,\n filePath: string,\n baseDir: string\n) => {\n if (uri.startsWith('/')) {\n return join(baseDir, uri);\n }\n\n if (uri.startsWith('./')) {\n return join(dirname(filePath), uri);\n }\n\n return filePath;\n};\n\nexport type AutoFillData = {\n localeList: Locales[];\n filePath: string;\n};\n\nconst formatAutoFillData = (\n autoFillOptions: AutoFill,\n localeList: Locales[],\n filePath: string,\n dictionaryKey: string,\n configuration: IntlayerConfig\n): AutoFillData[] => {\n const outputContentDeclarationFile: AutoFillData[] = [];\n\n if (!Boolean(autoFillOptions)) return outputContentDeclarationFile;\n\n if (autoFillOptions === true) {\n // wanted jsonFilePath: /..../src/components/home/index.content.json\n // replace file extension in json\n let jsonFilePath = filePath.replace(extname(filePath), '.json');\n\n // if both filePath jsonFilePath are same path, change it as : /..../src/components/home/index.fill.content.json\n if (filePath === jsonFilePath) {\n jsonFilePath = jsonFilePath.replace(extname(jsonFilePath), '.fill.json');\n }\n\n outputContentDeclarationFile.push({\n localeList,\n filePath: jsonFilePath,\n });\n }\n\n if (typeof autoFillOptions === 'string') {\n if (autoFillOptions.includes('{{locale}}')) {\n const output = localeList.map((locale) => ({\n localeList: [locale],\n filePath: transformUriToAbsolutePath(\n autoFillOptions\n .replace('{{locale}}', locale)\n .replace('{{key}}', dictionaryKey),\n filePath,\n configuration.content.baseDir\n ),\n }));\n\n outputContentDeclarationFile.push(...output);\n } else {\n outputContentDeclarationFile.push({\n localeList,\n filePath: transformUriToAbsolutePath(\n autoFillOptions,\n filePath,\n configuration.content.baseDir\n ),\n });\n }\n\n return outputContentDeclarationFile;\n }\n\n if (typeof autoFillOptions === 'object') {\n const localeList = Object.keys(autoFillOptions).filter(\n (locale) => typeof autoFillOptions[locale] === 'string'\n ) as Locales[];\n\n const output: AutoFillData[] = localeList.map((locale) => ({\n localeList: [locale],\n filePath: transformUriToAbsolutePath(\n autoFillOptions[locale].replace('{{key}}', dictionaryKey),\n filePath,\n configuration.content.baseDir\n ),\n }));\n\n // Group by filePath and merge localeList\n const groupedByFilePath = output.reduce((acc, curr) => {\n const existing = acc.find((item) => item.filePath === curr.filePath);\n if (existing) {\n existing.localeList.push(...curr.localeList);\n } else {\n acc.push(curr);\n }\n return acc;\n }, [] as AutoFillData[]);\n\n outputContentDeclarationFile.push(...groupedByFilePath);\n }\n\n return outputContentDeclarationFile;\n};\n\nconst autoFill = async (\n fullDictionary: Dictionary,\n contentDeclarationFile: Dictionary,\n autoFillOptions: AutoFill,\n outputLocales: Locales[],\n parentLocales: Locales[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n let localeList: Locales[] = (\n outputLocales ?? configuration.internationalization.locales\n ).filter((locale) => !parentLocales?.includes(locale));\n\n const filePath = contentDeclarationFile.filePath;\n\n if (!filePath) {\n appLogger('No file path found for dictionary', {\n level: 'error',\n });\n return;\n }\n\n const autoFillData: AutoFillData[] = formatAutoFillData(\n autoFillOptions,\n localeList,\n filePath,\n fullDictionary.key,\n configuration\n );\n\n appLogger(`Auto fill data: ${JSON.stringify(autoFillData, null, 2)}`, {\n level: 'info',\n isVerbose: true,\n });\n\n for await (const output of autoFillData) {\n const reducedDictionary = reduceDictionaryContent(\n fullDictionary,\n contentDeclarationFile\n );\n\n const isPerLocaleDeclarationFile = output.localeList.length === 1;\n\n if (isPerLocaleDeclarationFile) {\n const sourceLocale = output.localeList[0];\n\n const sourceLocaleContent = getLocalisedContent(\n reducedDictionary as unknown as ContentNode,\n sourceLocale,\n { dictionaryKey: reducedDictionary.key, keyPath: [] }\n );\n\n await writeContentDeclaration({\n ...fullDictionary,\n locale: sourceLocale,\n autoFilled: true,\n autoFill: undefined,\n content: sourceLocaleContent.content,\n filePath: output.filePath,\n });\n } else {\n const content = getFilteredLocalesContent(\n reducedDictionary.content as unknown as ContentNode,\n output.localeList,\n { dictionaryKey: reducedDictionary.key, keyPath: [] }\n );\n\n // write file\n await writeContentDeclaration({\n ...fullDictionary,\n autoFilled: true,\n autoFill: undefined,\n content,\n filePath: output.filePath,\n });\n }\n }\n};\n\n/**\n * Fill translations based on the provided options.\n */\nexport const fill = async (options: FillOptions): Promise<void> => {\n const configuration = getConfiguration(options.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options.mode ?? 'review';\n const baseLocale = options.sourceLocale ?? defaultLocale;\n\n checkAIAccess(configuration, options.aiOptions);\n\n let oAuth2AccessToken: string | undefined;\n if (configuration.editor.clientId) {\n const intlayerAuthAPI = getOAuthAPI(configuration);\n const oAuth2TokenResult = await intlayerAuthAPI.getOAuth2AccessToken();\n\n oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n }\n\n appLogger('Starting fill function', {\n level: 'info',\n });\n\n const targetUnmergedDictionaries = await getTargetDictionary(options);\n\n // Determine output locales\n const outputLocalesList: Locales[] = (\n options.outputLocales ? ensureArray(options.outputLocales) : locales\n ).filter((locale) =>\n // If mode is review, translate all locales\n // If mode is complete, translate only the locales that are not the source locale\n mode === 'review' ? true : locale !== baseLocale\n );\n\n const affectedDictionaryKeys = new Set<string>();\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n appLogger(\n [\n 'Affected dictionary keys for processing:',\n Array.from(affectedDictionaryKeys).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n\n for (const targetUnmergedDictionary of targetUnmergedDictionaries) {\n const dictionaryKey = targetUnmergedDictionary.key;\n const mainDictionaryToProcess = dictionariesRecord[dictionaryKey];\n const sourceLocale: Locales =\n (targetUnmergedDictionary.locale as Locales) ?? baseLocale;\n\n if (!mainDictionaryToProcess) {\n appLogger(\n `Dictionary with key \"${dictionaryKey}\" not found in dictionariesRecord. Skipping.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n if (!targetUnmergedDictionary.filePath) {\n appLogger(\n `Dictionary with key \"${dictionaryKey}\" has no file path. Skipping.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n const relativePath = relative(\n configuration.content.baseDir,\n targetUnmergedDictionary.filePath\n );\n\n appLogger(`Processing content declaration: ${relativePath}`, {\n isVerbose: true,\n });\n\n const sourceLocaleContent = getLocalisedContent(\n mainDictionaryToProcess as unknown as ContentNode,\n sourceLocale,\n { dictionaryKey, keyPath: [] }\n );\n\n if (Object.keys(sourceLocaleContent).length === 0) {\n appLogger(\n `No content found for dictionary ${dictionaryKey} in source locale ${sourceLocale}. Skipping translation for this dictionary.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n const result: Dictionary[] = [];\n\n // 5. for each locale to translate (exclude base locale) generate json translations\n // Limit concurrent translations to 5 at a time\n const limit = pLimit(\n options.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS\n );\n\n const translationPromises = outputLocalesList.map((targetLocale) =>\n limit(async () => {\n appLogger(\n `Preparing translation for '${dictionaryKey}' dictionary from ${getLocaleName(\n sourceLocale,\n Locales.ENGLISH\n )} (${sourceLocale}) to ${getLocaleName(targetLocale, Locales.ENGLISH)} (${targetLocale})`,\n {\n isVerbose: true,\n }\n );\n\n const presetOutputContent = getLocalisedContent(\n mainDictionaryToProcess as unknown as ContentNode,\n targetLocale,\n { dictionaryKey, keyPath: [] }\n );\n\n try {\n const translationResult = await getAiAPI(\n undefined,\n configuration\n ).translateJSON(\n {\n entryFileContent: sourceLocaleContent.content, // Should be JSON, ensure getLocalisedContent provides this.\n presetOutputContent: presetOutputContent.content, // Should be JSON\n dictionaryDescription: mainDictionaryToProcess.description,\n entryLocale: sourceLocale,\n outputLocale: targetLocale,\n mode,\n aiOptions: options.aiOptions,\n },\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n }\n );\n\n if (!translationResult.data?.fileContent) {\n appLogger(\n `No content result found for ${dictionaryKey} to ${targetLocale}`,\n {\n level: 'error',\n }\n );\n return null;\n }\n\n const processedPerLocaleDictionary = processPerLocaleDictionary({\n ...mainDictionaryToProcess,\n content: translationResult.data?.fileContent,\n locale: targetLocale,\n });\n\n return processedPerLocaleDictionary;\n } catch (error) {\n appLogger(\n `Error filling ${dictionaryKey} to ${targetLocale}:` + error,\n {\n level: 'error',\n }\n );\n return null;\n }\n })\n );\n\n // Wait for all translations to complete\n const translationResults = await Promise.all(translationPromises);\n\n // Filter out null results and add to result array\n translationResults.forEach((translationResult) => {\n if (translationResult) {\n result.push(translationResult);\n }\n });\n\n const dictionaryToMerge =\n mode === 'review'\n ? [...result, mainDictionaryToProcess] // Mode review: generated content will override the base one\n : [mainDictionaryToProcess, ...result]; // Mode complete: base content will override the generated one\n\n const mergedResults = mergeDictionaries(dictionaryToMerge);\n\n let formattedDict = targetUnmergedDictionary;\n\n if (formattedDict.locale) {\n const presetOutputContent = getLocalisedContent(\n mainDictionaryToProcess as unknown as ContentNode,\n formattedDict.locale,\n { dictionaryKey, keyPath: [] }\n );\n\n formattedDict = {\n ...formattedDict,\n content: presetOutputContent.content,\n };\n }\n\n const reducedResult = reduceDictionaryContent(mergedResults, formattedDict);\n\n await writeContentDeclaration(\n { ...formattedDict, content: reducedResult.content },\n configuration,\n formattedDict.filePath\n );\n\n if (!formattedDict.autoFill) return;\n\n await autoFill(\n mergedResults,\n targetUnmergedDictionary,\n formattedDict.autoFill,\n outputLocalesList,\n [sourceLocale],\n configuration\n );\n }\n};\n"],"mappings":"AAAA,SAAoB,UAAU,mBAAmB;AACjD;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAIE;AAAA,EACA;AAAA,OACK;AACP,OAAO,wBAAwB;AAC/B,OAAO,gCAAgC;AACvC,OAAO,YAAY;AACnB,SAAS,SAAS,SAAS,MAAM,gBAAgB;AACjD,SAAS,qBAAqB;AAE9B,MAAM,6BAA6B;AAmBnC,MAAM,cAAc,CAAI,UAAwB,CAAC,KAAK,EAAE,KAAK;AAE7D,MAAM,sBAAsB,OAAO,YAAyB;AAC1D,QAAM,gBAAgB,iBAAiB,QAAQ,aAAa;AAE5D,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,SAAS,OAAO,OAAO,0BAA0B,EAAE,KAAK;AAG5D,MAAI,OAAO,QAAQ,SAAS,aAAa;AACvC,UAAM,YAAY,YAAY,QAAQ,IAAI;AAC1C,UAAM,oBAAoB,UAAU,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC;AAErE,aAAS,OAAO;AAAA,MACd,CAAC,SACC,KAAK,aACJ,kBAAkB,SAAS,KAAK,QAAQ,KACvC,kBAAkB,SAAS,KAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,IAC7D;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,SAAS,aAAa;AACv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