@crowdin/app-project-module 1.15.1 → 2.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 (101) hide show
  1. package/out/index.js +8 -15
  2. package/out/middlewares/auto-credentials-masker.js +5 -2
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/crowdin-client.js +1 -1
  5. package/out/middlewares/export.d.ts +2 -2
  6. package/out/middlewares/export.js +4 -35
  7. package/out/middlewares/json-response.d.ts +1 -1
  8. package/out/middlewares/json-response.js +1 -1
  9. package/out/modules/ai-prompt-provider/index.js +6 -6
  10. package/out/modules/ai-provider/index.js +7 -7
  11. package/out/modules/ai-provider/types.d.ts +10 -0
  12. package/out/modules/ai-provider/types.js +12 -0
  13. package/out/modules/ai-provider/util/index.d.ts +0 -10
  14. package/out/modules/ai-provider/util/index.js +2 -13
  15. package/out/modules/ai-request-processors/index.js +4 -4
  16. package/out/modules/api/api.js +18 -18
  17. package/out/modules/auth-guard/index.js +4 -5
  18. package/out/modules/automation-action/index.js +4 -6
  19. package/out/modules/context-menu/index.js +4 -13
  20. package/out/modules/custom-mt/index.js +4 -4
  21. package/out/modules/custom-spell-check/index.js +11 -11
  22. package/out/modules/editor-right-panel/index.js +1 -1
  23. package/out/modules/external-qa-check/index.js +7 -7
  24. package/out/modules/file-processing/index.js +14 -14
  25. package/out/modules/integration/index.js +26 -26
  26. package/out/modules/integration/types.d.ts +4 -4
  27. package/out/modules/integration/util/files.js +1 -1
  28. package/out/modules/integration/util/types.d.ts +1 -1
  29. package/out/modules/manifest.js +70 -281
  30. package/out/modules/modal/index.js +4 -13
  31. package/out/modules/organization-menu/index.js +1 -1
  32. package/out/modules/organization-settings-menu/index.js +1 -1
  33. package/out/modules/profile-resources-menu/index.js +1 -1
  34. package/out/modules/profile-settings-menu/index.js +1 -1
  35. package/out/modules/project-menu/index.js +1 -1
  36. package/out/modules/project-menu-crowdsource/index.js +1 -1
  37. package/out/modules/project-reports/index.js +1 -1
  38. package/out/modules/project-tools/index.js +1 -1
  39. package/out/modules/webhooks/index.js +3 -6
  40. package/out/modules/workflow-step-type/index.js +6 -6
  41. package/out/static/ui/form.bundle.js +7947 -6975
  42. package/out/static/ui/form.bundle.js.map +1 -1
  43. package/out/storage/drizzle/d1/index.d.ts +7 -0
  44. package/out/storage/drizzle/d1/index.js +48 -0
  45. package/out/storage/drizzle/d1/migrations/init.d.ts +2 -0
  46. package/out/storage/drizzle/d1/migrations/init.js +122 -0
  47. package/out/storage/drizzle/d1/types.d.ts +13 -0
  48. package/out/storage/drizzle/d1/types.js +38 -0
  49. package/out/storage/{sqlite.d.ts → drizzle/index.d.ts} +37 -58
  50. package/out/storage/drizzle/index.js +939 -0
  51. package/out/storage/drizzle/postgresql/config.d.ts +5 -0
  52. package/out/storage/drizzle/postgresql/config.js +11 -0
  53. package/out/storage/drizzle/postgresql/index.d.ts +14 -0
  54. package/out/storage/drizzle/postgresql/index.js +144 -0
  55. package/out/storage/drizzle/postgresql/migrations/0000_init.sql +113 -0
  56. package/out/storage/drizzle/postgresql/migrations/0001_init_indexes.sql +28 -0
  57. package/out/storage/drizzle/postgresql/migrations/meta/0000_snapshot.json +646 -0
  58. package/out/storage/drizzle/postgresql/migrations/meta/0001_snapshot.json +646 -0
  59. package/out/storage/drizzle/postgresql/migrations/meta/_journal.json +20 -0
  60. package/out/storage/drizzle/postgresql/schema.d.ts +1410 -0
  61. package/out/storage/drizzle/postgresql/schema.js +106 -0
  62. package/out/storage/drizzle/sqlite/config.d.ts +5 -0
  63. package/out/storage/drizzle/sqlite/config.js +11 -0
  64. package/out/storage/drizzle/sqlite/index.d.ts +8 -0
  65. package/out/storage/drizzle/sqlite/index.js +63 -0
  66. package/out/storage/drizzle/sqlite/migrations/0000_init.sql +113 -0
  67. package/out/storage/drizzle/sqlite/migrations/meta/0000_snapshot.json +687 -0
  68. package/out/storage/drizzle/sqlite/migrations/meta/_journal.json +13 -0
  69. package/out/storage/drizzle/sqlite/schema.d.ts +1544 -0
  70. package/out/storage/drizzle/sqlite/schema.js +106 -0
  71. package/out/storage/index.d.ts +2 -88
  72. package/out/storage/index.js +12 -128
  73. package/out/storage/internal/backup.d.ts +3 -0
  74. package/out/storage/internal/backup.js +94 -0
  75. package/out/storage/types.d.ts +66 -0
  76. package/out/types.d.ts +43 -47
  77. package/out/util/credentials-masker.js +2 -2
  78. package/out/util/export.d.ts +1 -0
  79. package/out/util/export.js +2 -1
  80. package/out/util/index.d.ts +2 -1
  81. package/out/util/index.js +12 -9
  82. package/out/util/normalize-module.d.ts +0 -1
  83. package/out/util/normalize-module.js +0 -4
  84. package/package.json +23 -23
  85. package/out/modules/ai-tools/handlers/tool-calls.d.ts +0 -4
  86. package/out/modules/ai-tools/handlers/tool-calls.js +0 -52
  87. package/out/modules/ai-tools/index.d.ts +0 -10
  88. package/out/modules/ai-tools/index.js +0 -46
  89. package/out/modules/ai-tools/types.d.ts +0 -63
  90. package/out/modules/ai-tools/types.js +0 -2
  91. package/out/modules/ai-tools/util/index.d.ts +0 -5
  92. package/out/modules/ai-tools/util/index.js +0 -24
  93. package/out/storage/d1.d.ts +0 -107
  94. package/out/storage/d1.js +0 -837
  95. package/out/storage/export.d.ts +0 -1
  96. package/out/storage/export.js +0 -2
  97. package/out/storage/mysql.d.ts +0 -109
  98. package/out/storage/mysql.js +0 -984
  99. package/out/storage/postgre.d.ts +0 -124
  100. package/out/storage/postgre.js +0 -1027
  101. package/out/storage/sqlite.js +0 -786
@@ -8,22 +8,13 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  function register({ config, app }) {
11
- var _a, _b;
12
11
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
13
12
  if (!config.contextMenu) {
14
13
  return;
15
14
  }
16
- if (Array.isArray(config.contextMenu)) {
17
- config.contextMenu.forEach((contextMenu) => {
18
- if ((contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.uiPath) || (contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.formSchema)) {
19
- app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu, config));
20
- }
21
- });
22
- }
23
- else {
24
- // backward compatibility will be removed after migration
25
- if (((_a = config.contextMenu) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.contextMenu) === null || _b === void 0 ? void 0 : _b.formSchema)) {
26
- app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu, config));
15
+ config.contextMenu.forEach((contextMenu) => {
16
+ if ((contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.uiPath) || (contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.formSchema)) {
17
+ app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu, config));
27
18
  }
28
- }
19
+ });
29
20
  }
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.register = register;
7
- const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
7
+ const crowdin_client_1 = require("../../middlewares/crowdin-client");
8
8
  const util_1 = require("../../util");
9
9
  const normalize_module_1 = require("../../util/normalize-module");
10
10
  const file_download_1 = __importDefault(require("../file-processing/handlers/file-download"));
@@ -15,7 +15,7 @@ function register({ config, app }) {
15
15
  if (!config.customMT) {
16
16
  return;
17
17
  }
18
- const items = (0, normalize_module_1.normalizeToArray)(config.customMT);
18
+ const items = config.customMT;
19
19
  const isSingle = items.length === 1;
20
20
  for (const [index, mt] of items.entries()) {
21
21
  const key = (_a = mt.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'mt', item: mt, index, isSingle });
@@ -24,7 +24,7 @@ function register({ config, app }) {
24
24
  const translatePath = isSingle ? '/mt/translate' : `/mt/${key}/translate`;
25
25
  const downloadPath = isSingle ? '/file/download/custom-mt' : `/file/download/custom-mt-${key}`;
26
26
  app.use(logoPath, (0, util_1.serveLogo)(config, mt));
27
- app.post(translatePath, (0, crowdin_client_1.default)({
27
+ app.post(translatePath, (0, crowdin_client_1.handle)({
28
28
  config,
29
29
  optional: false,
30
30
  checkSubscriptionExpiration: true,
@@ -36,7 +36,7 @@ function register({ config, app }) {
36
36
  const mt = items[0];
37
37
  const folder = mt.filesFolder || config.dbFolder;
38
38
  // TEMPORARY CODE: it needs to support old path
39
- app.post('/translate', (0, crowdin_client_1.default)({
39
+ app.post('/translate', (0, crowdin_client_1.handle)({
40
40
  config,
41
41
  optional: false,
42
42
  checkSubscriptionExpiration: true,
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.register = register;
7
- const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
8
- const json_response_1 = __importDefault(require("../../middlewares/json-response"));
7
+ const crowdin_client_1 = require("../../middlewares/crowdin-client");
8
+ const json_response_1 = require("../../middlewares/json-response");
9
9
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
10
10
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
11
11
  const util_1 = require("../../util");
@@ -17,7 +17,7 @@ function register({ config, app }) {
17
17
  if (!config.customSpellchecker) {
18
18
  return;
19
19
  }
20
- const items = (0, normalize_module_1.normalizeToArray)(config.customSpellchecker);
20
+ const items = config.customSpellchecker;
21
21
  const isSingle = items.length === 1;
22
22
  if ((0, util_1.isAuthorizedConfig)(config)) {
23
23
  for (const [index, spellchecker] of items.entries()) {
@@ -32,13 +32,13 @@ function register({ config, app }) {
32
32
  if (spellchecker.settingsUiModule) {
33
33
  app.use(`${base}/settings`, (0, ui_module_1.default)({ config, moduleType: key }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
34
34
  }
35
- app.get(`${base}/languages`, json_response_1.default, (0, crowdin_client_1.default)({
35
+ app.get(`${base}/languages`, json_response_1.handle, (0, crowdin_client_1.handle)({
36
36
  config,
37
37
  optional: false,
38
38
  checkSubscriptionExpiration: true,
39
39
  moduleKey: key,
40
40
  }), (0, get_languages_list_1.default)(spellchecker));
41
- app.post(`${base}/spellcheck`, json_response_1.default, (0, crowdin_client_1.default)({
41
+ app.post(`${base}/spellcheck`, json_response_1.handle, (0, crowdin_client_1.handle)({
42
42
  config,
43
43
  optional: false,
44
44
  checkSubscriptionExpiration: true,
@@ -51,12 +51,12 @@ function register({ config, app }) {
51
51
  if (spellchecker.settingsUiModule) {
52
52
  app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
53
53
  }
54
- app.get('/languages', json_response_1.default, (0, crowdin_client_1.default)({
54
+ app.get('/languages', json_response_1.handle, (0, crowdin_client_1.handle)({
55
55
  config,
56
56
  optional: false,
57
57
  checkSubscriptionExpiration: true,
58
58
  }), (0, get_languages_list_1.default)(spellchecker));
59
- app.post('/spellcheck', json_response_1.default, (0, crowdin_client_1.default)({
59
+ app.post('/spellcheck', json_response_1.handle, (0, crowdin_client_1.handle)({
60
60
  config,
61
61
  optional: false,
62
62
  checkSubscriptionExpiration: true,
@@ -77,8 +77,8 @@ function register({ config, app }) {
77
77
  if (spellchecker.settingsUiModule) {
78
78
  app.use(`${base}/settings`, (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: key }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
79
79
  }
80
- app.get(`${base}/languages`, json_response_1.default, (0, get_languages_list_1.default)(spellchecker));
81
- app.post(`${base}/spellcheck`, json_response_1.default, (0, spell_check_1.default)(spellchecker));
80
+ app.get(`${base}/languages`, json_response_1.handle, (0, get_languages_list_1.default)(spellchecker));
81
+ app.post(`${base}/spellcheck`, json_response_1.handle, (0, spell_check_1.default)(spellchecker));
82
82
  }
83
83
  if (isSingle) {
84
84
  const spellchecker = items[0];
@@ -86,8 +86,8 @@ function register({ config, app }) {
86
86
  if (spellchecker.settingsUiModule) {
87
87
  app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
88
88
  }
89
- app.get('/languages', json_response_1.default, (0, get_languages_list_1.default)(spellchecker));
90
- app.post('/spellcheck', json_response_1.default, (0, spell_check_1.default)(spellchecker));
89
+ app.get('/languages', json_response_1.handle, (0, get_languages_list_1.default)(spellchecker));
90
+ app.post('/spellcheck', json_response_1.handle, (0, spell_check_1.default)(spellchecker));
91
91
  // END TEMPORARY CODE
92
92
  }
93
93
  }
@@ -13,7 +13,7 @@ function register({ config, app }) {
13
13
  if (!config.editorRightPanel) {
14
14
  return;
15
15
  }
16
- const items = (0, normalize_module_1.normalizeToArray)(config.editorRightPanel);
16
+ const items = config.editorRightPanel;
17
17
  const isSingle = items.length === 1;
18
18
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
19
19
  for (const [index, item] of items.entries()) {
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.register = register;
7
- const json_response_1 = __importDefault(require("../../middlewares/json-response"));
7
+ const json_response_1 = require("../../middlewares/json-response");
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
10
- const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
10
+ const crowdin_client_1 = require("../../middlewares/crowdin-client");
11
11
  const normalize_module_1 = require("../../util/normalize-module");
12
12
  const validate_1 = __importDefault(require("./handlers/validate"));
13
13
  function register({ config, app }) {
@@ -15,7 +15,7 @@ function register({ config, app }) {
15
15
  if (!config.externalQaCheck) {
16
16
  return;
17
17
  }
18
- const items = (0, normalize_module_1.normalizeToArray)(config.externalQaCheck);
18
+ const items = config.externalQaCheck;
19
19
  const isSingle = items.length === 1;
20
20
  for (const [index, qaCheck] of items.entries()) {
21
21
  const key = (_a = qaCheck.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
@@ -27,11 +27,11 @@ function register({ config, app }) {
27
27
  });
28
28
  const base = isSingle ? '/qa-check' : `/qa-check/${key}`;
29
29
  if (qaCheck === null || qaCheck === void 0 ? void 0 : qaCheck.batchSize) {
30
- app.use(`${base}/batch-size`, json_response_1.default, (req, res) => {
30
+ app.use(`${base}/batch-size`, json_response_1.handle, (req, res) => {
31
31
  res.send({ data: { size: qaCheck.batchSize } });
32
32
  });
33
33
  }
34
- app.use(`${base}/validate`, json_response_1.default, (0, crowdin_client_1.default)({
34
+ app.use(`${base}/validate`, json_response_1.handle, (0, crowdin_client_1.handle)({
35
35
  config,
36
36
  optional: false,
37
37
  checkSubscriptionExpiration: true,
@@ -45,11 +45,11 @@ function register({ config, app }) {
45
45
  const qaCheck = items[0];
46
46
  // TEMPORARY CODE: it needs to support old path
47
47
  if (qaCheck === null || qaCheck === void 0 ? void 0 : qaCheck.batchSize) {
48
- app.use('/batch-size', json_response_1.default, (req, res) => {
48
+ app.use('/batch-size', json_response_1.handle, (req, res) => {
49
49
  res.send({ data: { size: qaCheck.batchSize } });
50
50
  });
51
51
  }
52
- app.use('/validate', json_response_1.default, (0, crowdin_client_1.default)({
52
+ app.use('/validate', json_response_1.handle, (0, crowdin_client_1.handle)({
53
53
  config,
54
54
  optional: false,
55
55
  checkSubscriptionExpiration: true,
@@ -9,7 +9,7 @@ exports.registerFilePostImport = registerFilePostImport;
9
9
  exports.registerFilePreExport = registerFilePreExport;
10
10
  exports.registerFilePostExport = registerFilePostExport;
11
11
  exports.registerFileTranslationsAlignmentExport = registerFileTranslationsAlignmentExport;
12
- const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
12
+ const crowdin_client_1 = require("../../middlewares/crowdin-client");
13
13
  const normalize_module_1 = require("../../util/normalize-module");
14
14
  const custom_file_format_1 = __importDefault(require("./handlers/custom-file-format"));
15
15
  const file_download_1 = __importDefault(require("./handlers/file-download"));
@@ -23,13 +23,13 @@ function registerCustomFileFormat({ config, app }) {
23
23
  if (!config.customFileFormat) {
24
24
  return;
25
25
  }
26
- const items = (0, normalize_module_1.normalizeToArray)(config.customFileFormat);
26
+ const items = config.customFileFormat;
27
27
  const isSingle = items.length === 1;
28
28
  for (const [index, ff] of items.entries()) {
29
29
  const key = (_a = ff.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ff', item: ff, index, isSingle });
30
30
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, ff);
31
31
  const processUrl = isSingle ? '/file/process' : `/file/${key}/process`;
32
- app.post(processUrl, (0, crowdin_client_1.default)({
32
+ app.post(processUrl, (0, crowdin_client_1.handle)({
33
33
  config,
34
34
  optional: false,
35
35
  checkSubscriptionExpiration: true,
@@ -45,7 +45,7 @@ function registerCustomFileFormat({ config, app }) {
45
45
  if (isSingle) {
46
46
  const ff = items[0];
47
47
  // TEMPORARY CODE: it needs to support old path
48
- app.post('/process', (0, crowdin_client_1.default)({
48
+ app.post('/process', (0, crowdin_client_1.handle)({
49
49
  config,
50
50
  optional: false,
51
51
  checkSubscriptionExpiration: true,
@@ -63,13 +63,13 @@ function registerFilePreImport({ config, app }) {
63
63
  if (!config.filePreImport) {
64
64
  return;
65
65
  }
66
- const items = (0, normalize_module_1.normalizeToArray)(config.filePreImport);
66
+ const items = config.filePreImport;
67
67
  const isSingle = items.length === 1;
68
68
  for (const [index, item] of items.entries()) {
69
69
  const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pri', item, index, isSingle });
70
70
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
71
71
  const processUrl = isSingle ? '/pre-import' : `/pre-import/${key}`;
72
- app.post(processUrl, (0, crowdin_client_1.default)({
72
+ app.post(processUrl, (0, crowdin_client_1.handle)({
73
73
  config,
74
74
  optional: false,
75
75
  checkSubscriptionExpiration: true,
@@ -84,13 +84,13 @@ function registerFilePostImport({ config, app }) {
84
84
  if (!config.filePostImport) {
85
85
  return;
86
86
  }
87
- const items = (0, normalize_module_1.normalizeToArray)(config.filePostImport);
87
+ const items = config.filePostImport;
88
88
  const isSingle = items.length === 1;
89
89
  for (const [index, item] of items.entries()) {
90
90
  const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poi', item, index, isSingle });
91
91
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
92
92
  const processUrl = isSingle ? '/post-import' : `/post-import/${key}`;
93
- app.post(processUrl, (0, crowdin_client_1.default)({
93
+ app.post(processUrl, (0, crowdin_client_1.handle)({
94
94
  config,
95
95
  optional: false,
96
96
  checkSubscriptionExpiration: true,
@@ -105,13 +105,13 @@ function registerFilePreExport({ config, app }) {
105
105
  if (!config.filePreExport) {
106
106
  return;
107
107
  }
108
- const items = (0, normalize_module_1.normalizeToArray)(config.filePreExport);
108
+ const items = config.filePreExport;
109
109
  const isSingle = items.length === 1;
110
110
  for (const [index, item] of items.entries()) {
111
111
  const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pre', item, index, isSingle });
112
112
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
113
113
  const processUrl = isSingle ? '/pre-export' : `/pre-export/${key}`;
114
- app.post(processUrl, (0, crowdin_client_1.default)({
114
+ app.post(processUrl, (0, crowdin_client_1.handle)({
115
115
  config,
116
116
  optional: false,
117
117
  checkSubscriptionExpiration: true,
@@ -126,13 +126,13 @@ function registerFilePostExport({ config, app }) {
126
126
  if (!config.filePostExport) {
127
127
  return;
128
128
  }
129
- const items = (0, normalize_module_1.normalizeToArray)(config.filePostExport);
129
+ const items = config.filePostExport;
130
130
  const isSingle = items.length === 1;
131
131
  for (const [index, item] of items.entries()) {
132
132
  const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poe', item, index, isSingle });
133
133
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
134
134
  const processUrl = isSingle ? '/post-export' : `/post-export/${key}`;
135
- app.post(processUrl, (0, crowdin_client_1.default)({
135
+ app.post(processUrl, (0, crowdin_client_1.handle)({
136
136
  config,
137
137
  optional: false,
138
138
  checkSubscriptionExpiration: true,
@@ -147,13 +147,13 @@ function registerFileTranslationsAlignmentExport({ config, app }) {
147
147
  if (!config.fileTranslationsAlignmentExport) {
148
148
  return;
149
149
  }
150
- const items = (0, normalize_module_1.normalizeToArray)(config.fileTranslationsAlignmentExport);
150
+ const items = config.fileTranslationsAlignmentExport;
151
151
  const isSingle = items.length === 1;
152
152
  for (const [index, item] of items.entries()) {
153
153
  const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ftae', item, index, isSingle });
154
154
  (0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
155
155
  const processUrl = isSingle ? '/translations-alignment' : `/translations-alignment/${key}`;
156
- app.post(processUrl, (0, crowdin_client_1.default)({
156
+ app.post(processUrl, (0, crowdin_client_1.handle)({
157
157
  config,
158
158
  optional: false,
159
159
  checkSubscriptionExpiration: true,
@@ -13,9 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.register = register;
16
- const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
16
+ const crowdin_client_1 = require("../../middlewares/crowdin-client");
17
17
  const integration_credentials_1 = __importDefault(require("../../middlewares/integration-credentials"));
18
- const json_response_1 = __importDefault(require("../../middlewares/json-response"));
18
+ const json_response_1 = require("../../middlewares/json-response");
19
19
  const util_1 = require("../../util");
20
20
  const util_2 = require("../../util");
21
21
  const cron_1 = require("../../util/cron");
@@ -57,62 +57,62 @@ function register({ config, app }) {
57
57
  }
58
58
  (0, defaults_1.applyIntegrationModuleDefaults)(config, integrationLogic);
59
59
  app.use('/logo/integration', (0, util_2.serveLogo)(config, integrationLogic));
60
- app.get('/', (0, crowdin_client_1.default)({
60
+ app.get('/', (0, crowdin_client_1.handle)({
61
61
  config,
62
62
  optional: true,
63
63
  checkSubscriptionExpiration: false,
64
64
  moduleKey: integrationLogic.key,
65
65
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic, optional: true }), (0, main_1.default)(config, integrationLogic));
66
- app.get('/api/subscription-info', json_response_1.default, (0, crowdin_client_1.default)({
66
+ app.get('/api/subscription-info', json_response_1.handle, (0, crowdin_client_1.handle)({
67
67
  config,
68
68
  optional: false,
69
69
  checkSubscriptionExpiration: true,
70
70
  moduleKey: integrationLogic.key,
71
71
  isIntegration: true,
72
72
  }), (0, subscription_info_1.default)(config));
73
- app.get('/api/all-jobs', json_response_1.default, (0, crowdin_client_1.default)({
73
+ app.get('/api/all-jobs', json_response_1.handle, (0, crowdin_client_1.handle)({
74
74
  config,
75
75
  optional: false,
76
76
  checkSubscriptionExpiration: true,
77
77
  moduleKey: integrationLogic.key,
78
78
  isIntegration: true,
79
79
  }), (0, job_list_1.default)());
80
- app.get('/api/job-info', json_response_1.default, (0, crowdin_client_1.default)({
80
+ app.get('/api/job-info', json_response_1.handle, (0, crowdin_client_1.handle)({
81
81
  config,
82
82
  optional: false,
83
83
  checkSubscriptionExpiration: true,
84
84
  moduleKey: integrationLogic.key,
85
85
  isIntegration: true,
86
86
  }), (0, job_info_1.default)());
87
- app.get('/api/jobs', json_response_1.default, (0, crowdin_client_1.default)({
87
+ app.get('/api/jobs', json_response_1.handle, (0, crowdin_client_1.handle)({
88
88
  config,
89
89
  optional: false,
90
90
  checkSubscriptionExpiration: true,
91
91
  moduleKey: integrationLogic.key,
92
92
  isIntegration: true,
93
93
  }), (0, job_info_deprecated_1.default)(config));
94
- app.delete('/api/jobs', json_response_1.default, (0, crowdin_client_1.default)({
94
+ app.delete('/api/jobs', json_response_1.handle, (0, crowdin_client_1.handle)({
95
95
  config,
96
96
  optional: false,
97
97
  checkSubscriptionExpiration: true,
98
98
  moduleKey: integrationLogic.key,
99
99
  isIntegration: true,
100
100
  }), (0, job_cancel_1.default)());
101
- app.post('/api/settings', (0, crowdin_client_1.default)({
101
+ app.post('/api/settings', (0, crowdin_client_1.handle)({
102
102
  config,
103
103
  optional: false,
104
104
  checkSubscriptionExpiration: true,
105
105
  moduleKey: integrationLogic.key,
106
106
  isIntegration: true,
107
107
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, settings_save_1.default)(config, integrationLogic));
108
- app.post('/api/login', (0, crowdin_client_1.default)({
108
+ app.post('/api/login', (0, crowdin_client_1.handle)({
109
109
  config,
110
110
  optional: false,
111
111
  checkSubscriptionExpiration: false,
112
112
  moduleKey: integrationLogic.key,
113
113
  isIntegration: true,
114
114
  }), (0, integration_login_1.default)(config, integrationLogic));
115
- app.post('/api/logout', (0, crowdin_client_1.default)({
115
+ app.post('/api/logout', (0, crowdin_client_1.handle)({
116
116
  config,
117
117
  optional: false,
118
118
  checkSubscriptionExpiration: false,
@@ -120,63 +120,63 @@ function register({ config, app }) {
120
120
  isIntegration: true,
121
121
  isLogout: true,
122
122
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic, isLogout: true }), (0, integration_logout_1.default)(config, integrationLogic));
123
- app.get('/api/crowdin/files', json_response_1.default, (0, crowdin_client_1.default)({
123
+ app.get('/api/crowdin/files', json_response_1.handle, (0, crowdin_client_1.handle)({
124
124
  config,
125
125
  optional: false,
126
126
  checkSubscriptionExpiration: true,
127
127
  moduleKey: integrationLogic.key,
128
128
  isIntegration: true,
129
129
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, crowdin_files_1.default)(config, integrationLogic));
130
- app.get('/api/crowdin/project', json_response_1.default, (0, crowdin_client_1.default)({
130
+ app.get('/api/crowdin/project', json_response_1.handle, (0, crowdin_client_1.handle)({
131
131
  config,
132
132
  optional: false,
133
133
  checkSubscriptionExpiration: true,
134
134
  moduleKey: integrationLogic.key,
135
135
  isIntegration: true,
136
136
  }), (0, crowdin_project_1.default)());
137
- app.get('/api/crowdin/file-progress/:fileId', (0, crowdin_client_1.default)({
137
+ app.get('/api/crowdin/file-progress/:fileId', (0, crowdin_client_1.handle)({
138
138
  config,
139
139
  optional: false,
140
140
  checkSubscriptionExpiration: true,
141
141
  moduleKey: integrationLogic.key,
142
142
  isIntegration: true,
143
143
  }), (0, crowdin_file_progress_1.default)(integrationLogic));
144
- app.get('/api/integration/data', json_response_1.default, (0, crowdin_client_1.default)({
144
+ app.get('/api/integration/data', json_response_1.handle, (0, crowdin_client_1.handle)({
145
145
  config,
146
146
  optional: false,
147
147
  checkSubscriptionExpiration: true,
148
148
  moduleKey: integrationLogic.key,
149
149
  isIntegration: true,
150
150
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, integration_data_1.default)(integrationLogic));
151
- app.post('/api/crowdin/update', json_response_1.default, (0, crowdin_client_1.default)({
151
+ app.post('/api/crowdin/update', json_response_1.handle, (0, crowdin_client_1.handle)({
152
152
  config,
153
153
  optional: false,
154
154
  checkSubscriptionExpiration: true,
155
155
  moduleKey: integrationLogic.key,
156
156
  isIntegration: true,
157
157
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, crowdin_update_1.default)(config, integrationLogic));
158
- app.post('/api/crowdin/files-target-languages', json_response_1.default, (0, crowdin_client_1.default)({
158
+ app.post('/api/crowdin/files-target-languages', json_response_1.handle, (0, crowdin_client_1.handle)({
159
159
  config,
160
160
  optional: false,
161
161
  checkSubscriptionExpiration: true,
162
162
  moduleKey: integrationLogic.key,
163
163
  isIntegration: true,
164
164
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, crowdin_files_target_languages_1.default)(config, integrationLogic));
165
- app.post('/api/integration/update', json_response_1.default, (0, crowdin_client_1.default)({
165
+ app.post('/api/integration/update', json_response_1.handle, (0, crowdin_client_1.handle)({
166
166
  config,
167
167
  optional: false,
168
168
  checkSubscriptionExpiration: true,
169
169
  moduleKey: integrationLogic.key,
170
170
  isIntegration: true,
171
171
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, integration_update_1.default)(config, integrationLogic));
172
- app.get('/api/sync-settings/:provider', json_response_1.default, (0, crowdin_client_1.default)({
172
+ app.get('/api/sync-settings/:provider', json_response_1.handle, (0, crowdin_client_1.handle)({
173
173
  config,
174
174
  optional: false,
175
175
  checkSubscriptionExpiration: true,
176
176
  moduleKey: integrationLogic.key,
177
177
  isIntegration: true,
178
178
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, sync_settings_1.default)());
179
- app.post('/api/sync-settings', json_response_1.default, (0, crowdin_client_1.default)({
179
+ app.post('/api/sync-settings', json_response_1.handle, (0, crowdin_client_1.handle)({
180
180
  config,
181
181
  optional: false,
182
182
  checkSubscriptionExpiration: true,
@@ -185,7 +185,7 @@ function register({ config, app }) {
185
185
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, sync_settings_save_1.default)(config, integrationLogic));
186
186
  if (integrationLogic.oauthLogin) {
187
187
  app.get((0, defaults_1.getOauthRoute)(integrationLogic), (0, oauth_login_1.default)(config, integrationLogic));
188
- app.post('/api/oauth-url', json_response_1.default, (0, crowdin_client_1.default)({
188
+ app.post('/api/oauth-url', json_response_1.handle, (0, crowdin_client_1.handle)({
189
189
  config,
190
190
  optional: false,
191
191
  checkSubscriptionExpiration: false,
@@ -193,7 +193,7 @@ function register({ config, app }) {
193
193
  isIntegration: true,
194
194
  }), (0, oauth_url_1.default)(config, integrationLogic));
195
195
  if (integrationLogic.oauthLogin.mode === 'polling') {
196
- app.post('/api/oauth-polling', json_response_1.default, (0, crowdin_client_1.default)({
196
+ app.post('/api/oauth-polling', json_response_1.handle, (0, crowdin_client_1.handle)({
197
197
  config,
198
198
  optional: false,
199
199
  checkSubscriptionExpiration: false,
@@ -226,7 +226,7 @@ function register({ config, app }) {
226
226
  if (integrationLogic.webhooks) {
227
227
  app.post(`${integrationLogic.webhooks.crowdinWebhookUrl
228
228
  ? integrationLogic.webhooks.crowdinWebhookUrl
229
- : '/api/crowdin/webhook'}`, json_response_1.default, (0, crowdin_webhook_1.default)(config, integrationLogic));
229
+ : '/api/crowdin/webhook'}`, json_response_1.handle, (0, crowdin_webhook_1.default)(config, integrationLogic));
230
230
  if (((_a = integrationLogic.webhooks) === null || _a === void 0 ? void 0 : _a.integrationWebhookInterceptor) && !((_b = integrationLogic.webhooks) === null || _b === void 0 ? void 0 : _b.queueUrl)) {
231
231
  app.post(`${integrationLogic.webhooks.integrationWebhookUrl
232
232
  ? integrationLogic.webhooks.integrationWebhookUrl
@@ -241,21 +241,21 @@ function register({ config, app }) {
241
241
  });
242
242
  }
243
243
  }
244
- app.get('/api/user-errors', json_response_1.default, (0, crowdin_client_1.default)({
244
+ app.get('/api/user-errors', json_response_1.handle, (0, crowdin_client_1.handle)({
245
245
  config,
246
246
  optional: false,
247
247
  checkSubscriptionExpiration: true,
248
248
  moduleKey: integrationLogic.key,
249
249
  isIntegration: true,
250
250
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, user_errors_1.default)());
251
- app.get('/api/users', json_response_1.default, (0, crowdin_client_1.default)({
251
+ app.get('/api/users', json_response_1.handle, (0, crowdin_client_1.handle)({
252
252
  config,
253
253
  optional: false,
254
254
  checkSubscriptionExpiration: true,
255
255
  moduleKey: integrationLogic.key,
256
256
  isIntegration: true,
257
257
  }), (0, integration_credentials_1.default)({ config, integration: integrationLogic }), (0, users_1.default)());
258
- app.post('/api/invite-users', json_response_1.default, (0, crowdin_client_1.default)({
258
+ app.post('/api/invite-users', json_response_1.handle, (0, crowdin_client_1.handle)({
259
259
  config,
260
260
  optional: false,
261
261
  checkSubscriptionExpiration: true,
@@ -519,15 +519,15 @@ export interface FormField {
519
519
  type NoticeType = 'info' | 'warning' | 'danger' | 'success' | 'error' | 'dataLostWarning';
520
520
  export interface IntegrationCredentials {
521
521
  id: string;
522
- credentials: any;
522
+ credentials: string;
523
523
  crowdinId: string;
524
- managers?: any;
524
+ managers?: string;
525
525
  }
526
526
  export interface IntegrationConfig {
527
527
  id: number;
528
528
  integrationId: string;
529
529
  crowdinId: string;
530
- config: any;
530
+ config: string;
531
531
  }
532
532
  export interface IntegrationFile {
533
533
  id: string;
@@ -594,7 +594,7 @@ export interface IntegrationFilesSnapshot {
594
594
  }
595
595
  export interface IntegrationWebhooks {
596
596
  id: number;
597
- fileId: number;
597
+ fileId: string;
598
598
  integrationId: string;
599
599
  crowdinId: string;
600
600
  provider: Provider;
@@ -396,7 +396,7 @@ function updateSyncedData(clientId_1, crowdinId_1, payload_1) {
396
396
  const currentTimestamp = Date.now().toString();
397
397
  const filesWithTimestamp = (payload === null || payload === void 0 ? void 0 : payload.map((file) => (Object.assign(Object.assign({}, file), { syncedAt: currentTimestamp })))) || [];
398
398
  if (existingSyncedData) {
399
- const existingFiles = JSON.parse(existingSyncedData.files);
399
+ const existingFiles = existingSyncedData.files ? JSON.parse(existingSyncedData.files) : [];
400
400
  const mergedFiles = (0, util_1.uniqBy)([...filesWithTimestamp, ...existingFiles], 'id');
401
401
  yield (0, storage_1.getStorage)().updateSyncedData(JSON.stringify(mergedFiles), clientId, crowdinId, provider);
402
402
  }
@@ -124,7 +124,7 @@ export interface IntegrationSyncedData {
124
124
  crowdinId: string;
125
125
  type: string;
126
126
  updatedAt: string;
127
- files?: any;
127
+ files?: string;
128
128
  }
129
129
  export type GetAllJobsParams = {
130
130
  integrationId: string;