@crowdin/app-project-module 1.5.0 → 1.5.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.
|
@@ -16,6 +16,7 @@ const types_1 = require("../types");
|
|
|
16
16
|
const storage_1 = require("../../../storage");
|
|
17
17
|
const defaults_1 = require("./defaults");
|
|
18
18
|
const files_1 = require("./files");
|
|
19
|
+
const SNAPSHOT_FETCH_CONCURRENCY = 5;
|
|
19
20
|
function getCrowdinSnapshot(config, integration, crowdinApiClient, projectId, integrationSettings) {
|
|
20
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
22
|
let files = [];
|
|
@@ -47,22 +48,27 @@ function getOneLevelFetchingFiles(integration, integrationCredentials, integrati
|
|
|
47
48
|
if (folders.length === 0) {
|
|
48
49
|
return parentFiles;
|
|
49
50
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
const results = [];
|
|
52
|
+
for (let i = 0; i < folders.length; i += SNAPSHOT_FETCH_CONCURRENCY) {
|
|
53
|
+
const batch = folders.slice(i, i + SNAPSHOT_FETCH_CONCURRENCY);
|
|
54
|
+
const batchResults = yield Promise.all(batch.map((folder) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const childs = getTreeItems(yield integration.getIntegrationFiles({
|
|
56
|
+
credentials: integrationCredentials,
|
|
57
|
+
client,
|
|
58
|
+
projectId,
|
|
59
|
+
settings: integrationSettings,
|
|
60
|
+
parentId: folder.id,
|
|
61
|
+
search: '',
|
|
62
|
+
page: 0,
|
|
63
|
+
}));
|
|
64
|
+
if (childs.length === 0) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
return getOneLevelFetchingFiles(integration, integrationCredentials, integrationSettings, childs, client, projectId);
|
|
68
|
+
})));
|
|
69
|
+
results.push(...batchResults.flat());
|
|
70
|
+
}
|
|
71
|
+
return [...parentFiles, ...results];
|
|
66
72
|
});
|
|
67
73
|
}
|
|
68
74
|
function getIntegrationSnapshot(_a) {
|
package/package.json
CHANGED