@crowdin/app-project-module 1.4.1 → 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 = [];
@@ -43,25 +44,31 @@ function getTreeItems(integrationData) {
43
44
  }
44
45
  function getOneLevelFetchingFiles(integration, integrationCredentials, integrationSettings, parentFiles, client, projectId) {
45
46
  return __awaiter(this, void 0, void 0, function* () {
46
- for (const file of parentFiles) {
47
- if (!file.type) {
48
- let childs = yield integration.getIntegrationFiles({
47
+ const folders = parentFiles.filter((file) => !file.type);
48
+ if (folders.length === 0) {
49
+ return parentFiles;
50
+ }
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({
49
56
  credentials: integrationCredentials,
50
57
  client,
51
58
  projectId,
52
59
  settings: integrationSettings,
53
- parentId: file.id,
60
+ parentId: folder.id,
54
61
  search: '',
55
62
  page: 0,
56
- });
57
- childs = getTreeItems(childs);
58
- if (childs.length > 0) {
59
- const childFiles = yield getOneLevelFetchingFiles(integration, integrationCredentials, integrationSettings, childs, client, projectId);
60
- parentFiles = [...parentFiles, ...childFiles];
63
+ }));
64
+ if (childs.length === 0) {
65
+ return [];
61
66
  }
62
- }
67
+ return getOneLevelFetchingFiles(integration, integrationCredentials, integrationSettings, childs, client, projectId);
68
+ })));
69
+ results.push(...batchResults.flat());
63
70
  }
64
- return parentFiles;
71
+ return [...parentFiles, ...results];
65
72
  });
66
73
  }
67
74
  function getIntegrationSnapshot(_a) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@crowdin/crowdin-apps-functions": "^0.12.5",
23
- "@crowdin/logs-formatter": "^2.1.9",
23
+ "@crowdin/logs-formatter": "^2.1.10",
24
24
  "@godaddy/terminus": "^4.12.1",
25
25
  "ajv": "^8.17.1",
26
26
  "amqplib": "^0.10.9",
@@ -49,33 +49,21 @@
49
49
  }
50
50
  },
51
51
  "devDependencies": {
52
- "typescript": "^5.9.3",
53
- "auto-changelog": "^2.5.0",
54
52
  "@aws-sdk/client-s3": "^3.995.0",
55
53
  "@aws-sdk/s3-request-presigner": "^3.995.0",
54
+ "@cloudflare/workers-types": "^4.20260228.0",
55
+ "@eslint/eslintrc": "^3.3.3",
56
+ "@eslint/js": "^10.0.1",
57
+ "@monaco-editor/react": "^4.7.0",
56
58
  "@mui/material": "^7.3.8",
57
59
  "@rjsf/core": "^6.3.1",
58
60
  "@rjsf/mui": "^6.3.1",
59
61
  "@rjsf/validator-ajv8": "^6.3.1",
60
- "@monaco-editor/react": "^4.7.0",
61
- "rollup": "^4.59.0",
62
62
  "@rollup/plugin-commonjs": "^29.0.0",
63
63
  "@rollup/plugin-json": "^6.1.0",
64
64
  "@rollup/plugin-node-resolve": "^16.0.3",
65
65
  "@rollup/plugin-replace": "^6.0.3",
66
66
  "@rollup/plugin-typescript": "12.3.0",
67
- "eslint": "^10.0.1",
68
- "prettier": "^3.8.1",
69
- "eslint-config-prettier": "^10.1.8",
70
- "eslint-plugin-prettier": "^5.5.5",
71
- "@eslint/eslintrc": "^3.3.3",
72
- "@eslint/js": "^10.0.1",
73
- "@typescript-eslint/eslint-plugin": "^8.56.0",
74
- "@typescript-eslint/parser": "^8.56.0",
75
- "jest": "^30.2.0",
76
- "jest-junit": "^16.0.0",
77
- "ts-jest": "^29.4.6",
78
- "@cloudflare/workers-types": "^4.20260228.0",
79
67
  "@types/amqplib": "^0.10.7",
80
68
  "@types/better-sqlite3": "^7.6.13",
81
69
  "@types/cors": "^2.8.19",
@@ -86,7 +74,19 @@
86
74
  "@types/pg": "^8.16.0",
87
75
  "@types/react": "^18.3.18",
88
76
  "@types/react-dom": "^18.3.5",
89
- "@types/swagger-jsdoc": "^6.0.4"
77
+ "@types/swagger-jsdoc": "^6.0.4",
78
+ "@typescript-eslint/eslint-plugin": "^8.56.0",
79
+ "@typescript-eslint/parser": "^8.56.0",
80
+ "auto-changelog": "^2.5.0",
81
+ "eslint": "^10.0.1",
82
+ "eslint-config-prettier": "^10.1.8",
83
+ "eslint-plugin-prettier": "^5.5.5",
84
+ "jest": "^30.2.0",
85
+ "jest-junit": "^16.0.0",
86
+ "prettier": "^3.8.1",
87
+ "rollup": "^4.59.0",
88
+ "ts-jest": "^29.4.6",
89
+ "typescript": "^5.9.3"
90
90
  },
91
91
  "repository": {
92
92
  "type": "git",