@intlayer/cli 5.8.1 → 6.0.0-canary.1
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/dist/cjs/IntlayerEventListener.cjs +241 -0
- package/dist/cjs/IntlayerEventListener.cjs.map +1 -0
- package/dist/cjs/cli.cjs +29 -7
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +5 -1
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/fill/autoFill.cjs +105 -0
- package/dist/cjs/fill/autoFill.cjs.map +1 -0
- package/dist/cjs/fill/formatAutoFillData.cjs +108 -0
- package/dist/cjs/fill/formatAutoFillData.cjs.map +1 -0
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +46 -0
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -0
- package/dist/cjs/fill/getTargetDictionary.cjs +86 -0
- package/dist/cjs/fill/getTargetDictionary.cjs.map +1 -0
- package/dist/cjs/fill/index.cjs +257 -0
- package/dist/cjs/fill/index.cjs.map +1 -0
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listContentDeclaration.cjs +37 -19
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/liveSync.cjs +254 -0
- package/dist/cjs/liveSync.cjs.map +1 -0
- package/dist/cjs/pull.cjs +119 -117
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/pullLog.cjs +146 -0
- package/dist/cjs/pullLog.cjs.map +1 -0
- package/dist/cjs/push.cjs +74 -88
- package/dist/cjs/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +10 -25
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/cjs/pushLog.cjs +130 -0
- package/dist/cjs/pushLog.cjs.map +1 -0
- package/dist/cjs/reviewDoc.cjs +45 -36
- package/dist/cjs/reviewDoc.cjs.map +1 -1
- package/dist/cjs/test/index.cjs +91 -0
- package/dist/cjs/test/index.cjs.map +1 -0
- package/dist/cjs/test/listMissingTranslations.cjs +73 -0
- package/dist/cjs/test/listMissingTranslations.cjs.map +1 -0
- package/dist/cjs/translateDoc.cjs +42 -34
- package/dist/cjs/translateDoc.cjs.map +1 -1
- package/dist/cjs/utils/checkAIAccess.cjs +5 -1
- package/dist/cjs/utils/checkAIAccess.cjs.map +1 -1
- package/dist/cjs/utils/chunkInference.cjs +7 -14
- package/dist/cjs/utils/chunkInference.cjs.map +1 -1
- package/dist/esm/IntlayerEventListener.mjs +207 -0
- package/dist/esm/IntlayerEventListener.mjs.map +1 -0
- package/dist/esm/cli.mjs +26 -4
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +5 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/fill/autoFill.mjs +92 -0
- package/dist/esm/fill/autoFill.mjs.map +1 -0
- package/dist/esm/fill/formatAutoFillData.mjs +84 -0
- package/dist/esm/fill/formatAutoFillData.mjs.map +1 -0
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +22 -0
- package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -0
- package/dist/esm/fill/getTargetDictionary.mjs +51 -0
- package/dist/esm/fill/getTargetDictionary.mjs.map +1 -0
- package/dist/esm/fill/index.mjs +240 -0
- package/dist/esm/fill/index.mjs.map +1 -0
- package/dist/esm/index.mjs +2 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listContentDeclaration.mjs +38 -17
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/liveSync.mjs +220 -0
- package/dist/esm/liveSync.mjs.map +1 -0
- package/dist/esm/pull.mjs +123 -108
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/pullLog.mjs +127 -0
- package/dist/esm/pullLog.mjs.map +1 -0
- package/dist/esm/push.mjs +81 -90
- package/dist/esm/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +11 -26
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/esm/pushLog.mjs +111 -0
- package/dist/esm/pushLog.mjs.map +1 -0
- package/dist/esm/reviewDoc.mjs +55 -38
- package/dist/esm/reviewDoc.mjs.map +1 -1
- package/dist/esm/test/index.mjs +74 -0
- package/dist/esm/test/index.mjs.map +1 -0
- package/dist/esm/test/listMissingTranslations.mjs +41 -0
- package/dist/esm/test/listMissingTranslations.mjs.map +1 -0
- package/dist/esm/translateDoc.mjs +52 -37
- package/dist/esm/translateDoc.mjs.map +1 -1
- package/dist/esm/utils/checkAIAccess.mjs +5 -1
- package/dist/esm/utils/checkAIAccess.mjs.map +1 -1
- package/dist/esm/utils/chunkInference.mjs +14 -16
- package/dist/esm/utils/chunkInference.mjs.map +1 -1
- package/dist/types/IntlayerEventListener.d.ts +85 -0
- package/dist/types/IntlayerEventListener.d.ts.map +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/fill/autoFill.d.ts +4 -0
- package/dist/types/fill/autoFill.d.ts.map +1 -0
- package/dist/types/fill/formatAutoFillData.d.ts +9 -0
- package/dist/types/fill/formatAutoFillData.d.ts.map +1 -0
- package/dist/types/fill/formatAutoFilledFilePath.d.ts +3 -0
- package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -0
- package/dist/types/fill/getTargetDictionary.d.ts +4 -0
- package/dist/types/fill/getTargetDictionary.d.ts.map +1 -0
- package/dist/types/{fill.d.ts → fill/index.d.ts} +2 -5
- package/dist/types/fill/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listContentDeclaration.d.ts +4 -5
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts +6 -0
- package/dist/types/liveSync.d.ts.map +1 -0
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/pullLog.d.ts +24 -0
- package/dist/types/pullLog.d.ts.map +1 -0
- package/dist/types/push.d.ts +1 -1
- package/dist/types/push.d.ts.map +1 -1
- package/dist/types/pushConfig.d.ts +0 -1
- package/dist/types/pushConfig.d.ts.map +1 -1
- package/dist/types/pushLog.d.ts +23 -0
- package/dist/types/pushLog.d.ts.map +1 -0
- package/dist/types/reviewDoc.d.ts +1 -1
- package/dist/types/reviewDoc.d.ts.map +1 -1
- package/dist/types/test/index.d.ts +8 -0
- package/dist/types/test/index.d.ts.map +1 -0
- package/dist/types/test/listMissingTranslations.d.ts +12 -0
- package/dist/types/test/listMissingTranslations.d.ts.map +1 -0
- package/dist/types/translateDoc.d.ts +1 -1
- package/dist/types/translateDoc.d.ts.map +1 -1
- package/dist/types/utils/checkAIAccess.d.ts.map +1 -1
- package/dist/types/utils/chunkInference.d.ts +2 -1
- package/dist/types/utils/chunkInference.d.ts.map +1 -1
- package/package.json +19 -15
- package/dist/cjs/fill.cjs +0 -405
- package/dist/cjs/fill.cjs.map +0 -1
- package/dist/esm/fill.mjs +0 -385
- package/dist/esm/fill.mjs.map +0 -1
- package/dist/types/fill.d.ts.map +0 -1
package/dist/cjs/fill.cjs
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var fill_exports = {};
|
|
30
|
-
__export(fill_exports, {
|
|
31
|
-
fill: () => fill
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(fill_exports);
|
|
34
|
-
var import_api = require("@intlayer/api");
|
|
35
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
36
|
-
var import_config = require("@intlayer/config");
|
|
37
|
-
var import_core = require("@intlayer/core");
|
|
38
|
-
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
39
|
-
var import_unmerged_dictionaries_entry = __toESM(require("@intlayer/unmerged-dictionaries-entry"));
|
|
40
|
-
var import_p_limit = __toESM(require("p-limit"));
|
|
41
|
-
var import_path = require("path");
|
|
42
|
-
var import_checkAIAccess = require('./utils/checkAIAccess.cjs');
|
|
43
|
-
const NB_CONCURRENT_TRANSLATIONS = 5;
|
|
44
|
-
const ensureArray = (value) => [value].flat();
|
|
45
|
-
const getTargetDictionary = async (options) => {
|
|
46
|
-
const configuration = (0, import_config.getConfiguration)(options.configOptions);
|
|
47
|
-
const { baseDir } = configuration.content;
|
|
48
|
-
let result = Object.values(import_unmerged_dictionaries_entry.default).flat();
|
|
49
|
-
if (typeof options.file !== "undefined") {
|
|
50
|
-
const fileArray = ensureArray(options.file);
|
|
51
|
-
const absoluteFilePaths = fileArray.map((file) => (0, import_path.join)(baseDir, file));
|
|
52
|
-
result = result.filter(
|
|
53
|
-
(dict) => dict.filePath && (absoluteFilePaths.includes(dict.filePath) || absoluteFilePaths.includes((0, import_path.join)(baseDir, dict.filePath)))
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
if (typeof options.keys !== "undefined") {
|
|
57
|
-
result = result.filter(
|
|
58
|
-
(dict) => ensureArray(options.keys)?.includes(dict.key)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
if (typeof options.excludedKeys !== "undefined") {
|
|
62
|
-
result = result.filter(
|
|
63
|
-
(dict) => !ensureArray(options.excludedKeys)?.includes(dict.key)
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
if (typeof options.pathFilter !== "undefined") {
|
|
67
|
-
result = result.filter(
|
|
68
|
-
(dict) => ensureArray(options.pathFilter)?.includes(dict.filePath ?? "")
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
if (typeof options.filter !== "undefined") {
|
|
72
|
-
result = result.filter(options.filter);
|
|
73
|
-
}
|
|
74
|
-
const gitOptions = options.gitOptions;
|
|
75
|
-
if (gitOptions) {
|
|
76
|
-
const gitChangedFiles = await (0, import_chokidar.listGitFiles)(gitOptions);
|
|
77
|
-
if (gitChangedFiles) {
|
|
78
|
-
result = result.filter((dict) => {
|
|
79
|
-
if (!dict.filePath) return false;
|
|
80
|
-
return gitChangedFiles.some((gitFile) => dict.filePath === gitFile);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return result.filter((dict) => !dict.autoFilled);
|
|
85
|
-
};
|
|
86
|
-
const transformUriToAbsolutePath = (uri, filePath, baseDir) => {
|
|
87
|
-
if (uri.startsWith("/")) {
|
|
88
|
-
return (0, import_path.join)(baseDir, uri);
|
|
89
|
-
}
|
|
90
|
-
if (uri.startsWith("./")) {
|
|
91
|
-
return (0, import_path.join)((0, import_path.dirname)(filePath), uri);
|
|
92
|
-
}
|
|
93
|
-
return filePath;
|
|
94
|
-
};
|
|
95
|
-
const formatAutoFillData = (autoFillOptions, localeList, filePath, dictionaryKey, configuration) => {
|
|
96
|
-
const outputContentDeclarationFile = [];
|
|
97
|
-
if (!Boolean(autoFillOptions)) return outputContentDeclarationFile;
|
|
98
|
-
if (autoFillOptions === true) {
|
|
99
|
-
let jsonFilePath = filePath.replace((0, import_path.extname)(filePath), ".json");
|
|
100
|
-
if (filePath === jsonFilePath) {
|
|
101
|
-
jsonFilePath = jsonFilePath.replace((0, import_path.extname)(jsonFilePath), ".fill.json");
|
|
102
|
-
}
|
|
103
|
-
outputContentDeclarationFile.push({
|
|
104
|
-
localeList,
|
|
105
|
-
filePath: jsonFilePath
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
if (typeof autoFillOptions === "string") {
|
|
109
|
-
if (autoFillOptions.includes("{{locale}}")) {
|
|
110
|
-
const output = localeList.map((locale) => ({
|
|
111
|
-
localeList: [locale],
|
|
112
|
-
filePath: transformUriToAbsolutePath(
|
|
113
|
-
autoFillOptions.replace("{{locale}}", locale).replace("{{key}}", dictionaryKey),
|
|
114
|
-
filePath,
|
|
115
|
-
configuration.content.baseDir
|
|
116
|
-
)
|
|
117
|
-
}));
|
|
118
|
-
outputContentDeclarationFile.push(...output);
|
|
119
|
-
} else {
|
|
120
|
-
outputContentDeclarationFile.push({
|
|
121
|
-
localeList,
|
|
122
|
-
filePath: transformUriToAbsolutePath(
|
|
123
|
-
autoFillOptions,
|
|
124
|
-
filePath,
|
|
125
|
-
configuration.content.baseDir
|
|
126
|
-
)
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
return outputContentDeclarationFile;
|
|
130
|
-
}
|
|
131
|
-
if (typeof autoFillOptions === "object") {
|
|
132
|
-
const localeList2 = Object.keys(autoFillOptions).filter(
|
|
133
|
-
(locale) => typeof autoFillOptions[locale] === "string"
|
|
134
|
-
);
|
|
135
|
-
const output = localeList2.map((locale) => ({
|
|
136
|
-
localeList: [locale],
|
|
137
|
-
filePath: transformUriToAbsolutePath(
|
|
138
|
-
autoFillOptions[locale].replace("{{key}}", dictionaryKey),
|
|
139
|
-
filePath,
|
|
140
|
-
configuration.content.baseDir
|
|
141
|
-
)
|
|
142
|
-
}));
|
|
143
|
-
const groupedByFilePath = output.reduce((acc, curr) => {
|
|
144
|
-
const existing = acc.find((item) => item.filePath === curr.filePath);
|
|
145
|
-
if (existing) {
|
|
146
|
-
existing.localeList.push(...curr.localeList);
|
|
147
|
-
} else {
|
|
148
|
-
acc.push(curr);
|
|
149
|
-
}
|
|
150
|
-
return acc;
|
|
151
|
-
}, []);
|
|
152
|
-
outputContentDeclarationFile.push(...groupedByFilePath);
|
|
153
|
-
}
|
|
154
|
-
return outputContentDeclarationFile;
|
|
155
|
-
};
|
|
156
|
-
const autoFill = async (fullDictionary, contentDeclarationFile, autoFillOptions, outputLocales, parentLocales, configuration) => {
|
|
157
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
158
|
-
let localeList = (outputLocales ?? configuration.internationalization.locales).filter((locale) => !parentLocales?.includes(locale));
|
|
159
|
-
const filePath = contentDeclarationFile.filePath;
|
|
160
|
-
if (!filePath) {
|
|
161
|
-
appLogger("No file path found for dictionary", {
|
|
162
|
-
level: "error"
|
|
163
|
-
});
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const autoFillData = formatAutoFillData(
|
|
167
|
-
autoFillOptions,
|
|
168
|
-
localeList,
|
|
169
|
-
filePath,
|
|
170
|
-
fullDictionary.key,
|
|
171
|
-
configuration
|
|
172
|
-
);
|
|
173
|
-
appLogger(`Auto fill data: ${JSON.stringify(autoFillData, null, 2)}`, {
|
|
174
|
-
level: "info",
|
|
175
|
-
isVerbose: true
|
|
176
|
-
});
|
|
177
|
-
for await (const output of autoFillData) {
|
|
178
|
-
const reducedDictionary = (0, import_chokidar.reduceDictionaryContent)(
|
|
179
|
-
fullDictionary,
|
|
180
|
-
contentDeclarationFile
|
|
181
|
-
);
|
|
182
|
-
const isPerLocaleDeclarationFile = output.localeList.length === 1;
|
|
183
|
-
if (isPerLocaleDeclarationFile) {
|
|
184
|
-
const sourceLocale = output.localeList[0];
|
|
185
|
-
const sourceLocaleContent = (0, import_core.getLocalisedContent)(
|
|
186
|
-
reducedDictionary,
|
|
187
|
-
sourceLocale,
|
|
188
|
-
{ dictionaryKey: reducedDictionary.key, keyPath: [] }
|
|
189
|
-
);
|
|
190
|
-
await (0, import_chokidar.writeContentDeclaration)({
|
|
191
|
-
...fullDictionary,
|
|
192
|
-
locale: sourceLocale,
|
|
193
|
-
autoFilled: true,
|
|
194
|
-
autoFill: void 0,
|
|
195
|
-
content: sourceLocaleContent.content,
|
|
196
|
-
filePath: output.filePath
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
const content = (0, import_chokidar.getFilteredLocalesContent)(
|
|
200
|
-
reducedDictionary.content,
|
|
201
|
-
output.localeList,
|
|
202
|
-
{ dictionaryKey: reducedDictionary.key, keyPath: [] }
|
|
203
|
-
);
|
|
204
|
-
await (0, import_chokidar.writeContentDeclaration)({
|
|
205
|
-
...fullDictionary,
|
|
206
|
-
autoFilled: true,
|
|
207
|
-
autoFill: void 0,
|
|
208
|
-
content,
|
|
209
|
-
filePath: output.filePath
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const fill = async (options) => {
|
|
215
|
-
const configuration = (0, import_config.getConfiguration)(options.configOptions);
|
|
216
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
217
|
-
const { defaultLocale, locales } = configuration.internationalization;
|
|
218
|
-
const mode = options.mode ?? "review";
|
|
219
|
-
const baseLocale = options.sourceLocale ?? defaultLocale;
|
|
220
|
-
(0, import_checkAIAccess.checkAIAccess)(configuration, options.aiOptions);
|
|
221
|
-
let oAuth2AccessToken;
|
|
222
|
-
if (configuration.editor.clientId) {
|
|
223
|
-
const intlayerAuthAPI = (0, import_api.getOAuthAPI)(configuration);
|
|
224
|
-
const oAuth2TokenResult = await intlayerAuthAPI.getOAuth2AccessToken();
|
|
225
|
-
oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
|
|
226
|
-
}
|
|
227
|
-
appLogger("Starting fill function", {
|
|
228
|
-
level: "info"
|
|
229
|
-
});
|
|
230
|
-
const targetUnmergedDictionaries = await getTargetDictionary(options);
|
|
231
|
-
const outputLocalesList = (options.outputLocales ? ensureArray(options.outputLocales) : locales).filter(
|
|
232
|
-
(locale) => (
|
|
233
|
-
// If mode is review, translate all locales
|
|
234
|
-
// If mode is complete, translate only the locales that are not the source locale
|
|
235
|
-
mode === "review" ? true : locale !== baseLocale
|
|
236
|
-
)
|
|
237
|
-
);
|
|
238
|
-
const affectedDictionaryKeys = /* @__PURE__ */ new Set();
|
|
239
|
-
targetUnmergedDictionaries.forEach((dict) => {
|
|
240
|
-
affectedDictionaryKeys.add(dict.key);
|
|
241
|
-
});
|
|
242
|
-
appLogger(
|
|
243
|
-
[
|
|
244
|
-
"Affected dictionary keys for processing:",
|
|
245
|
-
Array.from(affectedDictionaryKeys).join(", ")
|
|
246
|
-
],
|
|
247
|
-
{
|
|
248
|
-
isVerbose: true
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
for (const targetUnmergedDictionary of targetUnmergedDictionaries) {
|
|
252
|
-
const dictionaryKey = targetUnmergedDictionary.key;
|
|
253
|
-
const mainDictionaryToProcess = import_dictionaries_entry.default[dictionaryKey];
|
|
254
|
-
const sourceLocale = targetUnmergedDictionary.locale ?? baseLocale;
|
|
255
|
-
if (!mainDictionaryToProcess) {
|
|
256
|
-
appLogger(
|
|
257
|
-
`Dictionary with key "${dictionaryKey}" not found in dictionariesRecord. Skipping.`,
|
|
258
|
-
{
|
|
259
|
-
level: "warn"
|
|
260
|
-
}
|
|
261
|
-
);
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (!targetUnmergedDictionary.filePath) {
|
|
265
|
-
appLogger(
|
|
266
|
-
`Dictionary with key "${dictionaryKey}" has no file path. Skipping.`,
|
|
267
|
-
{
|
|
268
|
-
level: "warn"
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
const relativePath = (0, import_path.relative)(
|
|
274
|
-
configuration.content.baseDir,
|
|
275
|
-
targetUnmergedDictionary.filePath
|
|
276
|
-
);
|
|
277
|
-
appLogger(`Processing content declaration: ${relativePath}`, {
|
|
278
|
-
isVerbose: true
|
|
279
|
-
});
|
|
280
|
-
const sourceLocaleContent = (0, import_core.getLocalisedContent)(
|
|
281
|
-
mainDictionaryToProcess,
|
|
282
|
-
sourceLocale,
|
|
283
|
-
{ dictionaryKey, keyPath: [] }
|
|
284
|
-
);
|
|
285
|
-
if (Object.keys(sourceLocaleContent).length === 0) {
|
|
286
|
-
appLogger(
|
|
287
|
-
`No content found for dictionary ${dictionaryKey} in source locale ${sourceLocale}. Skipping translation for this dictionary.`,
|
|
288
|
-
{
|
|
289
|
-
level: "warn"
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
const result = [];
|
|
295
|
-
const limit = (0, import_p_limit.default)(
|
|
296
|
-
options.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS
|
|
297
|
-
);
|
|
298
|
-
const translationPromises = outputLocalesList.map(
|
|
299
|
-
(targetLocale) => limit(async () => {
|
|
300
|
-
appLogger(
|
|
301
|
-
`Preparing translation for '${dictionaryKey}' dictionary from ${(0, import_core.getLocaleName)(
|
|
302
|
-
sourceLocale,
|
|
303
|
-
import_config.Locales.ENGLISH
|
|
304
|
-
)} (${sourceLocale}) to ${(0, import_core.getLocaleName)(targetLocale, import_config.Locales.ENGLISH)} (${targetLocale})`,
|
|
305
|
-
{
|
|
306
|
-
isVerbose: true
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
const presetOutputContent = (0, import_core.getLocalisedContent)(
|
|
310
|
-
mainDictionaryToProcess,
|
|
311
|
-
targetLocale,
|
|
312
|
-
{ dictionaryKey, keyPath: [] }
|
|
313
|
-
);
|
|
314
|
-
try {
|
|
315
|
-
const translationResult = await (0, import_api.getAiAPI)(
|
|
316
|
-
void 0,
|
|
317
|
-
configuration
|
|
318
|
-
).translateJSON(
|
|
319
|
-
{
|
|
320
|
-
entryFileContent: sourceLocaleContent.content,
|
|
321
|
-
// Should be JSON, ensure getLocalisedContent provides this.
|
|
322
|
-
presetOutputContent: presetOutputContent.content,
|
|
323
|
-
// Should be JSON
|
|
324
|
-
dictionaryDescription: mainDictionaryToProcess.description,
|
|
325
|
-
entryLocale: sourceLocale,
|
|
326
|
-
outputLocale: targetLocale,
|
|
327
|
-
mode,
|
|
328
|
-
aiOptions: options.aiOptions
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
...oAuth2AccessToken && {
|
|
332
|
-
headers: {
|
|
333
|
-
Authorization: `Bearer ${oAuth2AccessToken}`
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
if (!translationResult.data?.fileContent) {
|
|
339
|
-
appLogger(
|
|
340
|
-
`No content result found for ${dictionaryKey} to ${targetLocale}`,
|
|
341
|
-
{
|
|
342
|
-
level: "error"
|
|
343
|
-
}
|
|
344
|
-
);
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
const processedPerLocaleDictionary = (0, import_chokidar.processPerLocaleDictionary)({
|
|
348
|
-
...mainDictionaryToProcess,
|
|
349
|
-
content: translationResult.data?.fileContent,
|
|
350
|
-
locale: targetLocale
|
|
351
|
-
});
|
|
352
|
-
return processedPerLocaleDictionary;
|
|
353
|
-
} catch (error) {
|
|
354
|
-
appLogger(
|
|
355
|
-
`Error filling ${dictionaryKey} to ${targetLocale}:` + error,
|
|
356
|
-
{
|
|
357
|
-
level: "error"
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
362
|
-
})
|
|
363
|
-
);
|
|
364
|
-
const translationResults = await Promise.all(translationPromises);
|
|
365
|
-
translationResults.forEach((translationResult) => {
|
|
366
|
-
if (translationResult) {
|
|
367
|
-
result.push(translationResult);
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
const dictionaryToMerge = mode === "review" ? [...result, mainDictionaryToProcess] : [mainDictionaryToProcess, ...result];
|
|
371
|
-
const mergedResults = (0, import_chokidar.mergeDictionaries)(dictionaryToMerge);
|
|
372
|
-
let formattedDict = targetUnmergedDictionary;
|
|
373
|
-
if (formattedDict.locale) {
|
|
374
|
-
const presetOutputContent = (0, import_core.getLocalisedContent)(
|
|
375
|
-
mainDictionaryToProcess,
|
|
376
|
-
formattedDict.locale,
|
|
377
|
-
{ dictionaryKey, keyPath: [] }
|
|
378
|
-
);
|
|
379
|
-
formattedDict = {
|
|
380
|
-
...formattedDict,
|
|
381
|
-
content: presetOutputContent.content
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
const reducedResult = (0, import_chokidar.reduceDictionaryContent)(mergedResults, formattedDict);
|
|
385
|
-
await (0, import_chokidar.writeContentDeclaration)(
|
|
386
|
-
{ ...formattedDict, content: reducedResult.content },
|
|
387
|
-
configuration,
|
|
388
|
-
formattedDict.filePath
|
|
389
|
-
);
|
|
390
|
-
if (!formattedDict.autoFill) return;
|
|
391
|
-
await autoFill(
|
|
392
|
-
mergedResults,
|
|
393
|
-
targetUnmergedDictionary,
|
|
394
|
-
formattedDict.autoFill,
|
|
395
|
-
outputLocalesList,
|
|
396
|
-
[sourceLocale],
|
|
397
|
-
configuration
|
|
398
|
-
);
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
402
|
-
0 && (module.exports = {
|
|
403
|
-
fill
|
|
404
|
-
});
|
|
405
|
-
//# sourceMappingURL=fill.cjs.map
|
package/dist/cjs/fill.cjs.map
DELETED
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAiD;AACjD,sBAQO;AACP,oBAMO;AACP,kBAMO;AACP,gCAA+B;AAC/B,yCAAuC;AACvC,qBAAmB;AACnB,kBAAiD;AACjD,2BAA8B;AAE9B,MAAM,6BAA6B;AAmBnC,MAAM,cAAc,CAAI,UAAwB,CAAC,KAAK,EAAE,KAAK;AAE7D,MAAM,sBAAsB,OAAO,YAAyB;AAC1D,QAAM,oBAAgB,gCAAiB,QAAQ,aAAa;AAE5D,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,SAAS,OAAO,OAAO,mCAAAA,OAA0B,EAAE,KAAK;AAG5D,MAAI,OAAO,QAAQ,SAAS,aAAa;AACvC,UAAM,YAAY,YAAY,QAAQ,IAAI;AAC1C,UAAM,oBAAoB,UAAU,IAAI,CAAC,aAAS,kBAAK,SAAS,IAAI,CAAC;AAErE,aAAS,OAAO;AAAA,MACd,CAAC,SACC,KAAK,aACJ,kBAAkB,SAAS,KAAK,QAAQ,KACvC,kBAAkB,aAAS,kBAAK,SAAS,KAAK,QAAQ,CAAC;AAAA,IAC7D;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,SAAS,aAAa;AACvC,aAAS,OAAO;AAAA,MAAO,CAAC,SACtB,YAAY,QAAQ,IAAI,GAAG,SAAS,KAAK,GAAG;AAAA,IAC9C;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,iBAAiB,aAAa;AAC/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