@crowdin/app-project-module 1.13.0 → 1.13.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.
|
@@ -306,6 +306,7 @@ function processSyncSettings(_a) {
|
|
|
306
306
|
onlyApproved,
|
|
307
307
|
onlyTranslated,
|
|
308
308
|
context,
|
|
309
|
+
integration,
|
|
309
310
|
});
|
|
310
311
|
filesToProcess = result.filteredFiles;
|
|
311
312
|
deletedFileIds = result.deletedFiles;
|
|
@@ -494,22 +495,36 @@ function getNewFoldersFile(folders, snapshotFiles) {
|
|
|
494
495
|
return files;
|
|
495
496
|
}
|
|
496
497
|
function getOnlyTranslatedOrApprovedFiles(_a) {
|
|
497
|
-
return __awaiter(this, arguments, void 0, function* ({ projectId, crowdinFiles, crowdinClient, onlyApproved, onlyTranslated, context, }) {
|
|
498
|
+
return __awaiter(this, arguments, void 0, function* ({ projectId, crowdinFiles, crowdinClient, onlyApproved, onlyTranslated, context, integration, }) {
|
|
498
499
|
const deletedFiles = [];
|
|
499
500
|
(0, logger_1.log)(`Filtering files to process only ${onlyApproved ? 'approved' : 'translated'} files`);
|
|
500
501
|
const filesInfo = yield Promise.all(Object.keys(crowdinFiles).map((fileId) => __awaiter(this, void 0, void 0, function* () {
|
|
502
|
+
var _a, _b, _c, _d, _e;
|
|
501
503
|
try {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
.getFileProgress(
|
|
504
|
+
let info;
|
|
505
|
+
if (integration.getFileProgress) {
|
|
506
|
+
const progress = yield integration.getFileProgress({
|
|
507
|
+
projectId,
|
|
508
|
+
client: crowdinClient,
|
|
509
|
+
fileId: Number(fileId),
|
|
510
|
+
});
|
|
511
|
+
info = (_b = (_a = progress[Number(fileId)]) !== null && _a !== void 0 ? _a : progress[fileId]) !== null && _b !== void 0 ? _b : [];
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
const res = yield crowdinClient.translationStatusApi
|
|
515
|
+
.withFetchAll()
|
|
516
|
+
.getFileProgress(projectId, Number(fileId));
|
|
517
|
+
info = res.data.map((e) => e.data);
|
|
518
|
+
}
|
|
505
519
|
return {
|
|
506
520
|
id: fileId,
|
|
507
|
-
info
|
|
521
|
+
info,
|
|
508
522
|
};
|
|
509
523
|
}
|
|
510
524
|
catch (e) {
|
|
511
525
|
delete crowdinFiles[fileId];
|
|
512
|
-
|
|
526
|
+
const status = (_e = (_d = (_c = e === null || e === void 0 ? void 0 : e.response) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : e === null || e === void 0 ? void 0 : e.status) !== null && _e !== void 0 ? _e : e === null || e === void 0 ? void 0 : e.code;
|
|
527
|
+
if (status === 404) {
|
|
513
528
|
(0, logger_1.log)(`File ${fileId} not found in Crowdin (404), marking for removal from sync settings`);
|
|
514
529
|
deletedFiles.push(Number(fileId));
|
|
515
530
|
}
|
package/package.json
CHANGED