@crowdin/app-project-module 0.108.0 → 1.0.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 (202) hide show
  1. package/out/app-test/integration/get-integration-files.js +16 -4
  2. package/out/app-test/integration/types.d.ts +1 -1
  3. package/out/app-test/integration/update-crowdin.js +2 -2
  4. package/out/app-test/integration/update-integration.js +2 -2
  5. package/out/index.d.ts +2 -1
  6. package/out/index.js +73 -30
  7. package/out/middlewares/auto-credentials-masker.d.ts +4 -0
  8. package/out/middlewares/auto-credentials-masker.js +45 -0
  9. package/out/middlewares/crowdin-client.d.ts +1 -1
  10. package/out/middlewares/integration-credentials.d.ts +2 -2
  11. package/out/middlewares/integration-credentials.js +7 -4
  12. package/out/middlewares/render-ui-module.d.ts +3 -3
  13. package/out/middlewares/render-ui-module.js +10 -13
  14. package/out/middlewares/ui-module.d.ts +1 -1
  15. package/out/middlewares/ui-module.js +11 -1
  16. package/out/modules/about.d.ts +2 -1
  17. package/out/modules/about.js +10 -3
  18. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
  19. package/out/modules/ai-prompt-provider/handlers/compile.js +7 -1
  20. package/out/modules/ai-prompt-provider/index.js +2 -2
  21. package/out/modules/ai-prompt-provider/types.d.ts +7 -1
  22. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
  23. package/out/modules/ai-provider/handlers/chat-completions.js +1 -1
  24. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
  25. package/out/modules/ai-provider/index.js +2 -2
  26. package/out/modules/ai-provider/types.d.ts +4 -4
  27. package/out/modules/ai-request-processors/handler.d.ts +1 -1
  28. package/out/modules/ai-request-processors/handler.js +12 -2
  29. package/out/modules/ai-request-processors/types.d.ts +12 -2
  30. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
  31. package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
  32. package/out/modules/ai-tools/index.js +1 -1
  33. package/out/modules/ai-tools/types.d.ts +1 -1
  34. package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
  35. package/out/modules/auth-guard/index.js +1 -1
  36. package/out/modules/automation-action/handlers/execute.d.ts +1 -1
  37. package/out/modules/automation-action/handlers/execute.js +1 -1
  38. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
  39. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
  40. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
  41. package/out/modules/automation-action/handlers/validate-settings.js +1 -1
  42. package/out/modules/automation-action/index.js +1 -1
  43. package/out/modules/automation-action/types.d.ts +4 -4
  44. package/out/modules/automation-action/util/index.js +2 -5
  45. package/out/modules/context-menu/index.js +2 -2
  46. package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
  47. package/out/modules/custom-mt/handlers/translate.js +25 -9
  48. package/out/modules/custom-mt/index.js +3 -3
  49. package/out/modules/custom-mt/types.d.ts +10 -2
  50. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
  51. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
  52. package/out/modules/custom-spell-check/index.js +4 -4
  53. package/out/modules/editor-right-panel/index.js +1 -1
  54. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
  55. package/out/modules/external-qa-check/index.js +2 -2
  56. package/out/modules/file-processing/handlers/custom-file-format.d.ts +7 -2
  57. package/out/modules/file-processing/handlers/custom-file-format.js +62 -22
  58. package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
  59. package/out/modules/file-processing/handlers/file-download.js +5 -0
  60. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
  61. package/out/modules/file-processing/handlers/pre-post-process.js +41 -15
  62. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
  63. package/out/modules/file-processing/handlers/translations-alignment.js +10 -4
  64. package/out/modules/file-processing/index.js +12 -2
  65. package/out/modules/file-processing/types.d.ts +36 -5
  66. package/out/modules/file-processing/util/defaults.js +50 -6
  67. package/out/modules/file-processing/util/files.js +2 -1
  68. package/out/modules/form-data-display.d.ts +1 -1
  69. package/out/modules/form-data-save.d.ts +1 -1
  70. package/out/modules/install.d.ts +1 -1
  71. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
  72. package/out/modules/integration/handlers/crowdin-file-progress.js +5 -1
  73. package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +5 -0
  74. package/out/modules/integration/handlers/crowdin-files-target-languages.js +103 -0
  75. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
  76. package/out/modules/integration/handlers/crowdin-files.js +7 -1
  77. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
  78. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
  79. package/out/modules/integration/handlers/crowdin-update.js +59 -18
  80. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
  81. package/out/modules/integration/handlers/crowdin-webhook.js +15 -8
  82. package/out/modules/integration/handlers/integration-data.d.ts +1 -1
  83. package/out/modules/integration/handlers/integration-data.js +13 -6
  84. package/out/modules/integration/handlers/integration-login.d.ts +1 -1
  85. package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
  86. package/out/modules/integration/handlers/integration-logout.js +8 -3
  87. package/out/modules/integration/handlers/integration-update.d.ts +1 -1
  88. package/out/modules/integration/handlers/integration-update.js +44 -6
  89. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
  90. package/out/modules/integration/handlers/invite-users.d.ts +1 -1
  91. package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
  92. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
  93. package/out/modules/integration/handlers/job-info-deprecated.js +3 -2
  94. package/out/modules/integration/handlers/job-info.d.ts +1 -1
  95. package/out/modules/integration/handlers/job-list.d.ts +1 -1
  96. package/out/modules/integration/handlers/main.d.ts +1 -1
  97. package/out/modules/integration/handlers/main.js +32 -2
  98. package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
  99. package/out/modules/integration/handlers/oauth-login.js +28 -6
  100. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
  101. package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
  102. package/out/modules/integration/handlers/settings-save.d.ts +1 -1
  103. package/out/modules/integration/handlers/settings-save.js +9 -9
  104. package/out/modules/integration/handlers/settings.d.ts +1 -1
  105. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
  106. package/out/modules/integration/handlers/sync-settings-save.js +5 -9
  107. package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
  108. package/out/modules/integration/handlers/user-errors.d.ts +1 -1
  109. package/out/modules/integration/handlers/users.d.ts +1 -1
  110. package/out/modules/integration/index.js +19 -33
  111. package/out/modules/integration/types.d.ts +133 -29
  112. package/out/modules/integration/types.js +1 -0
  113. package/out/modules/integration/util/cron.d.ts +2 -2
  114. package/out/modules/integration/util/cron.js +40 -24
  115. package/out/modules/integration/util/defaults.d.ts +4 -0
  116. package/out/modules/integration/util/defaults.js +175 -15
  117. package/out/modules/integration/util/files.d.ts +2 -1
  118. package/out/modules/integration/util/files.js +19 -8
  119. package/out/modules/integration/util/job.js +4 -3
  120. package/out/modules/integration/util/snapshot.js +19 -3
  121. package/out/modules/integration/util/types.d.ts +1 -0
  122. package/out/modules/integration/util/types.js +1 -0
  123. package/out/modules/integration/util/webhooks.d.ts +8 -8
  124. package/out/modules/integration/util/webhooks.js +34 -17
  125. package/out/modules/manifest.js +12 -12
  126. package/out/modules/modal/index.js +2 -2
  127. package/out/modules/organization-menu/index.js +5 -4
  128. package/out/modules/organization-settings-menu/index.js +5 -4
  129. package/out/modules/profile-resources-menu/index.js +5 -4
  130. package/out/modules/profile-settings-menu/index.js +5 -4
  131. package/out/modules/project-menu/index.js +1 -1
  132. package/out/modules/project-menu-crowdsource/index.js +1 -1
  133. package/out/modules/project-reports/index.js +3 -2
  134. package/out/modules/project-tools/index.js +3 -2
  135. package/out/modules/status.d.ts +1 -1
  136. package/out/modules/status.js +12 -3
  137. package/out/modules/subscription-paid.d.ts +1 -1
  138. package/out/modules/uninstall.d.ts +1 -1
  139. package/out/modules/uninstall.js +1 -1
  140. package/out/modules/webhooks/handlers/webhook-handler.d.ts +2 -2
  141. package/out/modules/webhooks/handlers/webhook-handler.js +33 -22
  142. package/out/modules/webhooks/types.d.ts +7 -0
  143. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
  144. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
  145. package/out/modules/workflow-step-type/index.js +2 -2
  146. package/out/modules/workflow-step-type/util/index.js +3 -6
  147. package/out/static/js/dependent.js +16 -7
  148. package/out/static/ui/error.bundle.js +474 -0
  149. package/out/static/ui/error.bundle.js.map +1 -0
  150. package/out/static/ui/install.bundle.js +459 -0
  151. package/out/static/ui/install.bundle.js.map +1 -0
  152. package/out/static/ui/login.bundle.js +630 -0
  153. package/out/static/ui/login.bundle.js.map +1 -0
  154. package/out/static/ui/main.bundle.js +2109 -0
  155. package/out/static/ui/main.bundle.js.map +1 -0
  156. package/out/static/ui/oauth.bundle.js +467 -0
  157. package/out/static/ui/oauth.bundle.js.map +1 -0
  158. package/out/storage/d1.d.ts +107 -0
  159. package/out/storage/d1.js +831 -0
  160. package/out/storage/index.js +8 -1
  161. package/out/storage/mysql.js +22 -19
  162. package/out/storage/postgre.d.ts +0 -1
  163. package/out/storage/postgre.js +20 -30
  164. package/out/storage/sqlite.d.ts +2 -5
  165. package/out/storage/sqlite.js +29 -69
  166. package/out/types.d.ts +78 -18
  167. package/out/util/connection.js +1 -1
  168. package/out/util/credentials-masker.d.ts +3 -3
  169. package/out/util/credentials-masker.js +14 -20
  170. package/out/util/cron.d.ts +29 -0
  171. package/out/util/cron.js +87 -0
  172. package/out/util/index.d.ts +14 -1
  173. package/out/util/index.js +121 -10
  174. package/out/util/jsx-renderer.d.ts +14 -0
  175. package/out/util/jsx-renderer.js +35 -0
  176. package/out/util/logger.d.ts +1 -0
  177. package/out/util/logger.js +2 -2
  178. package/out/util/static-files.d.ts +19 -0
  179. package/out/util/static-files.js +87 -0
  180. package/out/util/subscription.js +1 -1
  181. package/out/views/AboutPage.d.ts +10 -0
  182. package/out/views/AboutPage.js +76 -0
  183. package/out/views/FormPage.d.ts +14 -0
  184. package/out/views/FormPage.js +28 -0
  185. package/out/views/SubscriptionPage.d.ts +7 -0
  186. package/out/views/SubscriptionPage.js +26 -0
  187. package/out/views/index.d.ts +8 -0
  188. package/out/views/index.js +15 -0
  189. package/out/views/layout/Head.d.ts +9 -0
  190. package/out/views/layout/Head.js +54 -0
  191. package/package.json +43 -41
  192. package/out/util/handlebars.d.ts +0 -1
  193. package/out/util/handlebars.js +0 -46
  194. package/out/views/about.handlebars +0 -102
  195. package/out/views/error.handlebars +0 -54
  196. package/out/views/form.handlebars +0 -31
  197. package/out/views/install.handlebars +0 -16
  198. package/out/views/login.handlebars +0 -332
  199. package/out/views/main.handlebars +0 -2042
  200. package/out/views/oauth.handlebars +0 -11
  201. package/out/views/partials/head.handlebars +0 -53
  202. package/out/views/subscription.handlebars +0 -26
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const util_1 = require("../../../util");
13
+ const logger_1 = require("../../../util/logger");
14
+ const files_1 = require("../util/files");
15
+ const defaults_1 = require("../util/defaults");
16
+ const job_1 = require("../util/job");
17
+ const types_1 = require("../util/types");
18
+ function handle(config, integration) {
19
+ return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
20
+ const projectId = req.crowdinContext.jwtPayload.context.project_id;
21
+ req.logInfo(`Updating target languages for Crowdin files in project ${projectId}`);
22
+ const { fileIds, languages } = req.body;
23
+ if (!fileIds || !Array.isArray(fileIds) || fileIds.length === 0) {
24
+ return res.status(400).json({
25
+ error: {
26
+ message: 'Missing required parameter: fileIds',
27
+ },
28
+ });
29
+ }
30
+ if (!languages || !Array.isArray(languages) || languages.length === 0) {
31
+ return res.status(400).json({
32
+ error: {
33
+ message: 'Missing required parameter: languages',
34
+ },
35
+ });
36
+ }
37
+ if (!integration.updateFilesTargetLanguages) {
38
+ return res.status(400).json({
39
+ error: {
40
+ message: 'Update files target languages is not supported',
41
+ },
42
+ });
43
+ }
44
+ const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, projectId);
45
+ let options = {};
46
+ if (rootFolder) {
47
+ options = {
48
+ directoryId: rootFolder.id,
49
+ recursion: 'true',
50
+ };
51
+ }
52
+ const allFiles = yield req.crowdinApiClient.sourceFilesApi.withFetchAll().listProjectFiles(projectId, options);
53
+ const fileIdsSet = new Set(fileIds);
54
+ const validFileIds = allFiles.data
55
+ .map((f) => f.data)
56
+ .filter((file) => fileIdsSet.has(file.id))
57
+ .map((file) => file.id);
58
+ if (validFileIds.length === 0) {
59
+ return res.status(400).json({
60
+ error: {
61
+ message: 'No valid files found. Directories and branches cannot have target languages updated.',
62
+ },
63
+ });
64
+ }
65
+ req.logInfo(`Filtered ${fileIds.length} items to ${validFileIds.length} valid files (excluded ${fileIds.length - validFileIds.length} directories/branches)`);
66
+ const excludedTargetLanguages = yield (0, files_1.getExcludedTargetLanguages)({
67
+ client: req.crowdinApiClient,
68
+ projectId,
69
+ languages,
70
+ });
71
+ yield (0, job_1.runAsJob)({
72
+ integrationId: req.crowdinContext.clientId,
73
+ crowdinId: req.crowdinContext.crowdinId,
74
+ type: types_1.JobType.UPDATE_TARGET_LANGUAGES,
75
+ title: 'Update files target languages',
76
+ payload: validFileIds,
77
+ res,
78
+ projectId,
79
+ client: req.crowdinApiClient,
80
+ jobType: types_1.JobClientType.MANUAL,
81
+ jobStoreType: integration.jobStoreType,
82
+ jobCallback: () => __awaiter(this, void 0, void 0, function* () {
83
+ yield integration.updateFilesTargetLanguages({
84
+ projectId,
85
+ client: req.crowdinApiClient,
86
+ fileIds: validFileIds,
87
+ excludedTargetLanguages,
88
+ });
89
+ return { message: `Successfully updated target languages for ${validFileIds.length} files` };
90
+ }),
91
+ onError: (e) => __awaiter(this, void 0, void 0, function* () {
92
+ yield (0, logger_1.handleUserError)({
93
+ action: 'Update files target languages',
94
+ error: e,
95
+ crowdinId: req.crowdinContext.crowdinId,
96
+ clientId: req.crowdinContext.clientId,
97
+ });
98
+ throw e;
99
+ }),
100
+ });
101
+ }));
102
+ }
103
+ exports.default = handle;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -23,7 +23,13 @@ function handle(config, integration) {
23
23
  req.logInfo(`Loading files ${rootFolder ? `from folder ${rootFolder.id}` : 'from root'}`);
24
24
  try {
25
25
  let files = integration.getCrowdinFiles
26
- ? yield integration.getCrowdinFiles(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, rootFolder, req.integrationSettings, mode)
26
+ ? yield integration.getCrowdinFiles({
27
+ projectId: req.crowdinContext.jwtPayload.context.project_id,
28
+ client: req.crowdinApiClient,
29
+ rootFolder,
30
+ settings: req.integrationSettings,
31
+ mode: mode,
32
+ })
27
33
  : [];
28
34
  req.logInfo('Marking files as unsynced');
29
35
  if (files.length > 0 && mode !== 'directories') {
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { CrowdinClientRequest } from '../../../types';
4
- export default function handle(): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -8,24 +8,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const lodash_uniqby_1 = __importDefault(require("lodash.uniqby"));
16
12
  const types_1 = require("../util/types");
17
13
  const util_1 = require("../../../util");
18
14
  const defaults_1 = require("../util/defaults");
19
15
  const logger_1 = require("../../../util/logger");
20
16
  const job_1 = require("../util/job");
21
17
  const files_1 = require("../util/files");
18
+ const logger_2 = require("../../../util/logger");
22
19
  const types_2 = require("../types");
20
+ const storage_1 = require("../../../storage");
23
21
  function handle(config, integration) {
24
22
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
25
23
  var _a, _b, _c, _d;
26
24
  const projectId = req.crowdinContext.jwtPayload.context.project_id || (req === null || req === void 0 ? void 0 : req.body.projectId);
27
25
  const uploadTranslations = req.query.uploadTranslations === 'true' || ((_a = req.body) === null || _a === void 0 ? void 0 : _a.uploadTranslations);
28
26
  const forcePushSources = req.query.forcePushSources === 'true' || ((_b = req.body) === null || _b === void 0 ? void 0 : _b.forcePushSources);
27
+ const matchFromCrowdin = req.query.matchFromCrowdin === 'true';
29
28
  req.logInfo(`Updating crowdin project ${projectId}`);
30
29
  const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, projectId);
31
30
  if (rootFolder) {
@@ -43,6 +42,32 @@ function handle(config, integration) {
43
42
  req.body = req.body.files;
44
43
  }
45
44
  let payload = req.body;
45
+ const matchingWarnings = [];
46
+ // If matchFromCrowdin is true, we need to match Crowdin files to integration files first
47
+ if (matchFromCrowdin && integration.matchCrowdinFilesToIntegrationFiles) {
48
+ const crowdinFiles = req.body;
49
+ const syncedData = yield (0, storage_1.getStorage)().getSyncedData(req.crowdinContext.clientId, req.crowdinContext.crowdinId, types_2.Provider.INTEGRATION);
50
+ // Let critical errors bubble up naturally
51
+ const matchingResult = yield integration.matchCrowdinFilesToIntegrationFiles({
52
+ projectId,
53
+ client: req.crowdinApiClient,
54
+ credentials: req.integrationCredentials,
55
+ crowdinFiles,
56
+ settings: req.integrationSettings,
57
+ rootFolder,
58
+ syncedData: (syncedData === null || syncedData === void 0 ? void 0 : syncedData.files) ? JSON.parse(syncedData.files) : [],
59
+ });
60
+ if ((0, files_1.isMatchingResultType)(matchingResult)) {
61
+ payload = matchingResult.data;
62
+ if (matchingResult.errors && matchingResult.errors.length > 0) {
63
+ matchingWarnings.push(...matchingResult.errors);
64
+ req.logInfo(`File matching completed with ${matchingResult.errors.length} warning(s). ${Array.isArray(payload) ? payload.length : Object.keys(payload).length} file(s) matched successfully and will be synced.`);
65
+ }
66
+ }
67
+ else {
68
+ payload = matchingResult;
69
+ }
70
+ }
46
71
  const excludedTargetLanguages = yield (0, files_1.getExcludedTargetLanguages)({
47
72
  client: req.crowdinApiClient,
48
73
  projectId,
@@ -62,7 +87,7 @@ function handle(config, integration) {
62
87
  jobCallback: (job) => __awaiter(this, void 0, void 0, function* () {
63
88
  if (payload && (payload === null || payload === void 0 ? void 0 : payload.length)) {
64
89
  payload = yield (0, files_1.expandFilesTree)(payload, req, integration, job);
65
- payload = (0, lodash_uniqby_1.default)(payload, 'id');
90
+ payload = (0, util_1.uniqBy)(payload, 'id');
66
91
  }
67
92
  if (integration.forcePushSources === true && !forcePushSources && (payload === null || payload === void 0 ? void 0 : payload.length)) {
68
93
  payload = yield (0, files_1.filterSyncedData)(payload);
@@ -73,7 +98,7 @@ function handle(config, integration) {
73
98
  credentials: req.integrationCredentials,
74
99
  request: payload,
75
100
  rootFolder,
76
- appSettings: req.integrationSettings,
101
+ settings: req.integrationSettings,
77
102
  uploadTranslations,
78
103
  job,
79
104
  excludedTargetLanguages: req.query.languages ? excludedTargetLanguages : undefined,
@@ -90,11 +115,21 @@ function handle(config, integration) {
90
115
  throw errors.toString();
91
116
  }
92
117
  try {
93
- yield (0, files_1.updateSyncedData)(req.crowdinContext.clientId, req.crowdinContext.crowdinId, payload, types_2.Provider.INTEGRATION);
118
+ let syncedDataPayload = payload;
119
+ if (currentJob === null || currentJob === void 0 ? void 0 : currentJob.processedEntities) {
120
+ syncedDataPayload = JSON.parse(currentJob.processedEntities);
121
+ }
122
+ yield (0, files_1.updateSyncedData)(req.crowdinContext.clientId, req.crowdinContext.crowdinId, syncedDataPayload, types_2.Provider.INTEGRATION);
94
123
  }
95
124
  catch (e) {
96
125
  (0, logger_1.logError)(e, req.crowdinContext);
97
126
  }
127
+ if (matchingWarnings.length > 0) {
128
+ req.logInfo(`Sync completed with warnings: ${matchingWarnings.length} file(s) could not be matched.`);
129
+ const error = new logger_2.AppModuleAggregateError(matchingWarnings, 'Finished with errors. See error logs.');
130
+ error.isPartialSuccess = true;
131
+ throw error;
132
+ }
98
133
  let message;
99
134
  if ((0, files_1.isExtendedResultType)(result)) {
100
135
  message = result.message;
@@ -102,23 +137,29 @@ function handle(config, integration) {
102
137
  return { message };
103
138
  }),
104
139
  onError: (e, job) => __awaiter(this, void 0, void 0, function* () {
105
- try {
106
- const currentJob = yield job.get();
107
- if (currentJob === null || currentJob === void 0 ? void 0 : currentJob.processedEntities) {
108
- const processedEntities = JSON.parse(currentJob.processedEntities);
109
- yield (0, files_1.updateSyncedData)(req.crowdinContext.clientId, req.crowdinContext.crowdinId, processedEntities, types_2.Provider.INTEGRATION);
140
+ const isPartialSuccess = (e === null || e === void 0 ? void 0 : e.isPartialSuccess) === true;
141
+ if (!isPartialSuccess) {
142
+ try {
143
+ const currentJob = yield job.get();
144
+ if (currentJob === null || currentJob === void 0 ? void 0 : currentJob.processedEntities) {
145
+ const processedEntities = JSON.parse(currentJob.processedEntities);
146
+ yield (0, files_1.updateSyncedData)(req.crowdinContext.clientId, req.crowdinContext.crowdinId, processedEntities, types_2.Provider.INTEGRATION);
147
+ }
148
+ }
149
+ catch (syncError) {
150
+ (0, logger_1.logError)(syncError, req.crowdinContext);
110
151
  }
111
152
  }
112
- catch (syncError) {
113
- (0, logger_1.logError)(syncError, req.crowdinContext);
114
- }
153
+ const errorToLog = !isPartialSuccess && matchingWarnings.length > 0
154
+ ? new logger_2.AppModuleAggregateError([e, ...matchingWarnings], 'Sync failed with multiple errors')
155
+ : e;
115
156
  yield (0, logger_1.handleUserError)({
116
- action: 'Sync files to Crowdin',
117
- error: e,
157
+ action: isPartialSuccess ? 'File matching warnings' : 'Sync files to Crowdin',
158
+ error: errorToLog,
118
159
  crowdinId: req.crowdinContext.crowdinId,
119
160
  clientId: req.crowdinContext.clientId,
120
161
  });
121
- throw e;
162
+ throw errorToLog;
122
163
  }),
123
164
  });
124
165
  }));
@@ -2,4 +2,4 @@
2
2
  import { Request, Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -19,7 +19,7 @@ const files_1 = require("../util/files");
19
19
  function filterSyncFiles(args) {
20
20
  var _a, _b;
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
- const { projectId, crowdinClient, events, syncFileSettings, appSettings } = args;
22
+ const { projectId, client, events, syncFileSettings, settings } = args;
23
23
  const files = {};
24
24
  let projectData;
25
25
  const addFileToResponse = (fileId, languages) => {
@@ -34,9 +34,9 @@ function filterSyncFiles(args) {
34
34
  const fileId = event.fileId;
35
35
  const language = event.language;
36
36
  // sync all new files
37
- if (event.event === webhooks_1.HookEvents.fileAdded && appSettings['new-crowdin-files']) {
37
+ if (event.event === webhooks_1.HookEvents.fileAdded && settings['new-crowdin-files']) {
38
38
  if (!projectData) {
39
- projectData = yield crowdinClient.projectsGroupsApi.getProject(projectId);
39
+ projectData = yield client.projectsGroupsApi.getProject(projectId);
40
40
  }
41
41
  const projectLanguages = projectData.data.targetLanguageIds;
42
42
  if (projectData.data.inContext) {
@@ -54,7 +54,7 @@ function filterSyncFiles(args) {
54
54
  }
55
55
  else {
56
56
  try {
57
- const crowdinFile = yield crowdinClient.sourceFilesApi.getFile(projectId, fileId);
57
+ const crowdinFile = yield client.sourceFilesApi.getFile(projectId, fileId);
58
58
  // sync file that in selected for sync schedule directory
59
59
  if (syncFileSettings[(_a = crowdinFile === null || crowdinFile === void 0 ? void 0 : crowdinFile.data) === null || _a === void 0 ? void 0 : _a.directoryId] &&
60
60
  syncFileSettings[(_b = crowdinFile === null || crowdinFile === void 0 ? void 0 : crowdinFile.data) === null || _b === void 0 ? void 0 : _b.directoryId].includes(language)) {
@@ -76,7 +76,7 @@ function handle(config, integration) {
76
76
  const webhookUrlParam = req.query[urlParam];
77
77
  let filesToSync;
78
78
  if (webhookUrlParam) {
79
- const { projectId, crowdinClient, rootFolder, appSettings, syncSettings } = yield (0, webhooks_1.prepareWebhookData)({
79
+ const { projectId, crowdinClient, rootFolder, settings, syncSettings } = yield (0, webhooks_1.prepareWebhookData)({
80
80
  config,
81
81
  integration,
82
82
  webhookUrlParam,
@@ -91,15 +91,22 @@ function handle(config, integration) {
91
91
  }
92
92
  const syncFileSettings = (0, files_1.prepareSyncFiles)(JSON.parse(syncSettings.files));
93
93
  if ((_b = integration.webhooks) === null || _b === void 0 ? void 0 : _b.crowdinWebhookInterceptor) {
94
- filesToSync = yield integration.webhooks.crowdinWebhookInterceptor(projectId, crowdinClient.client, rootFolder, appSettings, syncSettings, req.body);
94
+ filesToSync = yield integration.webhooks.crowdinWebhookInterceptor({
95
+ projectId,
96
+ client: crowdinClient.client,
97
+ rootFolder,
98
+ settings,
99
+ syncSettings,
100
+ webhookRequest: req.body,
101
+ });
95
102
  }
96
103
  else {
97
104
  filesToSync = yield filterSyncFiles({
98
105
  projectId,
99
- crowdinClient: crowdinClient.client,
106
+ client: crowdinClient.client,
100
107
  events: req.body.events,
101
108
  syncFileSettings,
102
- appSettings,
109
+ settings,
103
110
  });
104
111
  }
105
112
  for (const eventPayload of req.body.events) {
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { IntegrationLogic } from '../types';
4
- export default function handle(integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -24,9 +24,16 @@ function handle(integration) {
24
24
  let files = [];
25
25
  const { crowdinId, clientId } = req.crowdinContext;
26
26
  try {
27
- const appSettings = req.integrationSettings;
27
+ const settings = req.integrationSettings;
28
28
  const parsedPaginationData = paginationData ? JSON.parse(paginationData) : undefined;
29
- const result = yield integration.getIntegrationFiles(req.integrationCredentials, appSettings, parentId, search, page, parsedPaginationData);
29
+ const result = yield integration.getIntegrationFiles({
30
+ credentials: req.integrationCredentials,
31
+ settings,
32
+ parentId,
33
+ search,
34
+ page,
35
+ paginationData: parsedPaginationData,
36
+ });
30
37
  if ((0, files_1.isExtendedResultType)(result)) {
31
38
  files = result.data || [];
32
39
  message = result.message;
@@ -35,13 +42,13 @@ function handle(integration) {
35
42
  else {
36
43
  files = result || [];
37
44
  }
38
- if ((appSettings === null || appSettings === void 0 ? void 0 : appSettings.skipIntegrationNodesToggle) === true ||
39
- ((appSettings === null || appSettings === void 0 ? void 0 : appSettings.skipIntegrationNodesToggle) === undefined && ((_a = integration.skipIntegrationNodesToggle) === null || _a === void 0 ? void 0 : _a.value))) {
45
+ if ((settings === null || settings === void 0 ? void 0 : settings.skipIntegrationNodesToggle) === true ||
46
+ ((settings === null || settings === void 0 ? void 0 : settings.skipIntegrationNodesToggle) === undefined && ((_a = integration.skipIntegrationNodesToggle) === null || _a === void 0 ? void 0 : _a.value))) {
40
47
  files = (0, files_1.skipFilesByRegex)(files, integration.skipIntegrationNodes);
41
48
  }
42
49
  if (integration.filterByPathIntegrationFiles) {
43
- const includePatterns = (_b = appSettings === null || appSettings === void 0 ? void 0 : appSettings.includeByFilePath) === null || _b === void 0 ? void 0 : _b.split('\n').filter(Boolean);
44
- const excludePatterns = (_c = appSettings === null || appSettings === void 0 ? void 0 : appSettings.excludeByFilePath) === null || _c === void 0 ? void 0 : _c.split('\n').filter(Boolean);
50
+ const includePatterns = (_b = settings === null || settings === void 0 ? void 0 : settings.includeByFilePath) === null || _b === void 0 ? void 0 : _b.split('\n').filter(Boolean);
51
+ const excludePatterns = (_c = settings === null || settings === void 0 ? void 0 : settings.excludeByFilePath) === null || _c === void 0 ? void 0 : _c.split('\n').filter(Boolean);
45
52
  files = (0, files_1.filterFilesByPath)(files, includePatterns, excludePatterns);
46
53
  }
47
54
  const needsFileStatus = ((_e = (_d = integration.filtering) === null || _d === void 0 ? void 0 : _d.integrationFileStatus) === null || _e === void 0 ? void 0 : _e.isNew) ||
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config, CrowdinClientRequest } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -48,7 +48,12 @@ function handle(config, integration) {
48
48
  if (integration.onLogout) {
49
49
  try {
50
50
  req.logInfo('Invoking onLogout hook');
51
- yield integration.onLogout(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials, req.integrationSettings);
51
+ yield integration.onLogout({
52
+ projectId: req.crowdinContext.jwtPayload.context.project_id,
53
+ client: req.crowdinApiClient,
54
+ credentials: req.integrationCredentials,
55
+ settings: req.integrationSettings,
56
+ });
52
57
  }
53
58
  catch (e) {
54
59
  yield (0, logger_1.handleUserError)({
@@ -69,8 +74,8 @@ function handle(config, integration) {
69
74
  integration,
70
75
  client: req.crowdinApiClient,
71
76
  crowdinContext: req.crowdinContext,
72
- apiCredentials: req.integrationCredentials,
73
- appSettings: req.integrationSettings,
77
+ credentials: req.integrationCredentials,
78
+ settings: req.integrationSettings,
74
79
  });
75
80
  }
76
81
  res.status(204).end();
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -14,14 +14,18 @@ const util_1 = require("../../../util");
14
14
  const defaults_1 = require("../util/defaults");
15
15
  const job_1 = require("../util/job");
16
16
  const logger_1 = require("../../../util/logger");
17
+ const types_2 = require("../types");
17
18
  const files_1 = require("../util/files");
19
+ const logger_2 = require("../../../util/logger");
20
+ const storage_1 = require("../../../storage");
18
21
  function handle(config, integration) {
19
22
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
20
- var _a, _b, _c;
23
+ var _a, _b, _c, _d;
21
24
  req.logInfo('Updating integration data');
22
25
  const client = req.crowdinApiClient;
23
26
  const projectId = req.crowdinContext.jwtPayload.context.project_id;
24
27
  const forcePushTranslations = ((_a = req.query) === null || _a === void 0 ? void 0 : _a.forcePushTranslations) === 'true' || !!((_b = req.body) === null || _b === void 0 ? void 0 : _b.forcePushTranslations);
28
+ const matchFromIntegration = ((_c = req.query) === null || _c === void 0 ? void 0 : _c.matchFromIntegration) === 'true';
25
29
  const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, projectId);
26
30
  if (rootFolder) {
27
31
  req.logInfo(`Updating integration data for crowding root folder ${rootFolder.id}`);
@@ -34,10 +38,34 @@ function handle(config, integration) {
34
38
  });
35
39
  }
36
40
  // A request via API has a different structure
37
- if (((_c = config.api) === null || _c === void 0 ? void 0 : _c.default) && req.body.files) {
41
+ if (((_d = config.api) === null || _d === void 0 ? void 0 : _d.default) && req.body.files) {
38
42
  req.body = req.body.files;
39
43
  }
40
44
  let payload = req.body;
45
+ const matchingWarnings = [];
46
+ // If matchFromIntegration is true, we need to match integration files to Crowdin files first
47
+ if (matchFromIntegration && integration.matchCrowdinFilesToIntegrationFiles) {
48
+ const syncedData = yield (0, storage_1.getStorage)().getSyncedData(req.crowdinContext.clientId, req.crowdinContext.crowdinId, types_2.Provider.INTEGRATION);
49
+ const result = yield integration.matchCrowdinFilesToIntegrationFiles({
50
+ projectId,
51
+ client,
52
+ credentials: req.integrationCredentials,
53
+ integrationFiles: req.body,
54
+ settings: req.integrationSettings,
55
+ rootFolder,
56
+ syncedData,
57
+ });
58
+ if ((0, files_1.isMatchingResultType)(result)) {
59
+ payload = result.data;
60
+ if (result.errors && result.errors.length > 0) {
61
+ matchingWarnings.push(...result.errors);
62
+ req.logInfo(`File matching completed with ${result.errors.length} warning(s). ${Array.isArray(payload) ? payload.length : Object.keys(payload).length} file(s) matched successfully and will be synced.`);
63
+ }
64
+ }
65
+ else {
66
+ payload = result;
67
+ }
68
+ }
41
69
  if (integration.excludedTargetLanguages) {
42
70
  let options = {};
43
71
  if (rootFolder) {
@@ -67,9 +95,15 @@ function handle(config, integration) {
67
95
  credentials: req.integrationCredentials,
68
96
  request: payload,
69
97
  rootFolder,
70
- appSettings: req.integrationSettings,
98
+ settings: req.integrationSettings,
71
99
  job,
72
100
  });
101
+ if (matchingWarnings.length > 0) {
102
+ req.logInfo(`Sync completed with warnings: ${matchingWarnings.length} file(s) could not be matched.`);
103
+ const error = new logger_2.AppModuleAggregateError(matchingWarnings, 'Finished with errors. See error logs.');
104
+ error.isPartialSuccess = true;
105
+ throw error;
106
+ }
73
107
  let message;
74
108
  if ((0, files_1.isExtendedResultType)(result)) {
75
109
  message = result.message;
@@ -77,13 +111,17 @@ function handle(config, integration) {
77
111
  return { message };
78
112
  }),
79
113
  onError: (e) => __awaiter(this, void 0, void 0, function* () {
114
+ const isPartialSuccess = (e === null || e === void 0 ? void 0 : e.isPartialSuccess) === true;
115
+ const errorToLog = !isPartialSuccess && matchingWarnings.length > 0
116
+ ? new logger_2.AppModuleAggregateError([e, ...matchingWarnings], 'Sync failed with multiple errors')
117
+ : e;
80
118
  yield (0, logger_1.handleUserError)({
81
- action: 'Sync files to External Service',
82
- error: e,
119
+ action: isPartialSuccess ? 'File matching warnings' : 'Sync files to External Service',
120
+ error: errorToLog,
83
121
  crowdinId: req.crowdinContext.crowdinId,
84
122
  clientId: req.crowdinContext.clientId,
85
123
  });
86
- throw e;
124
+ throw errorToLog;
87
125
  }),
88
126
  forcePushTranslations,
89
127
  });
@@ -2,4 +2,4 @@
2
2
  import { Request, Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
- export default function handle(config: Config): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -36,8 +36,9 @@ function getHumanETA(ms) {
36
36
  }
37
37
  function handle(config) {
38
38
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b;
39
40
  const isApi = req.isApiCall;
40
- const id = req.query.jobId || req.body.jobId;
41
+ const id = ((_a = req.query) === null || _a === void 0 ? void 0 : _a.jobId) || ((_b = req.body) === null || _b === void 0 ? void 0 : _b.jobId);
41
42
  if (!id) {
42
43
  req.logInfo('Get active jobs');
43
44
  const jobs = yield (0, storage_1.getStorage)().getActiveJobs({
@@ -111,7 +112,7 @@ function handle(config) {
111
112
  context,
112
113
  credentials,
113
114
  rootFolder,
114
- appSettings: intConfig,
115
+ settings: intConfig,
115
116
  reRunJobId: id,
116
117
  });
117
118
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;