@crowdin/app-project-module 1.2.1 → 1.3.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 (209) hide show
  1. package/out/app-test/integration/get-integration-files.js +1 -1
  2. package/out/app-test/integration/index.js +6 -6
  3. package/out/app-test/integration/mocks/crowdin-storage.d.ts +16 -16
  4. package/out/app-test/integration/mocks/mock-crowdin-api-client.js +17 -7
  5. package/out/app-test/integration/update-crowdin.js +1 -1
  6. package/out/app-test/integration/update-integration.js +1 -1
  7. package/out/app-test/util/index.js +1 -2
  8. package/out/index.js +23 -13
  9. package/out/middlewares/api-call.js +1 -1
  10. package/out/middlewares/auto-credentials-masker.js +2 -3
  11. package/out/middlewares/crowdin-client.d.ts +1 -2
  12. package/out/middlewares/crowdin-client.js +5 -6
  13. package/out/middlewares/integration-credentials.d.ts +1 -2
  14. package/out/middlewares/integration-credentials.js +18 -8
  15. package/out/middlewares/json-response.js +1 -1
  16. package/out/middlewares/render-ui-module.d.ts +1 -2
  17. package/out/middlewares/render-ui-module.js +1 -1
  18. package/out/middlewares/ui-module.d.ts +1 -2
  19. package/out/middlewares/ui-module.js +1 -1
  20. package/out/modules/about.js +2 -3
  21. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -2
  22. package/out/modules/ai-prompt-provider/handlers/compile.js +1 -1
  23. package/out/modules/ai-prompt-provider/index.js +1 -2
  24. package/out/modules/ai-prompt-provider/types.js +1 -1
  25. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -2
  26. package/out/modules/ai-provider/handlers/chat-completions.js +2 -2
  27. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -2
  28. package/out/modules/ai-provider/handlers/get-model-list.js +1 -1
  29. package/out/modules/ai-provider/index.js +1 -2
  30. package/out/modules/ai-provider/util/index.js +6 -6
  31. package/out/modules/ai-request-processors/handler.d.ts +1 -2
  32. package/out/modules/ai-request-processors/handler.js +1 -1
  33. package/out/modules/ai-request-processors/index.js +5 -5
  34. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -2
  35. package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
  36. package/out/modules/ai-tools/index.js +2 -3
  37. package/out/modules/ai-tools/util/index.js +4 -5
  38. package/out/modules/api/api.js +4 -5
  39. package/out/modules/api/index.js +1 -2
  40. package/out/modules/api/types.js +1 -1
  41. package/out/modules/auth-guard/handlers/verify.d.ts +1 -2
  42. package/out/modules/auth-guard/handlers/verify.js +1 -1
  43. package/out/modules/auth-guard/index.js +1 -2
  44. package/out/modules/automation-action/handlers/execute.d.ts +1 -2
  45. package/out/modules/automation-action/handlers/execute.js +1 -1
  46. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -2
  47. package/out/modules/automation-action/handlers/input-schema.js +1 -1
  48. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -2
  49. package/out/modules/automation-action/handlers/output-schema.js +1 -1
  50. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -2
  51. package/out/modules/automation-action/handlers/validate-settings.js +1 -1
  52. package/out/modules/automation-action/index.js +1 -2
  53. package/out/modules/automation-action/util/index.js +2 -3
  54. package/out/modules/automation-action/util/validate-input.js +1 -2
  55. package/out/modules/context-menu/index.js +1 -2
  56. package/out/modules/context-menu/types.js +2 -2
  57. package/out/modules/custom-mt/handlers/translate.d.ts +1 -2
  58. package/out/modules/custom-mt/handlers/translate.js +1 -1
  59. package/out/modules/custom-mt/index.js +1 -2
  60. package/out/modules/custom-mt/types.d.ts +0 -2
  61. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -2
  62. package/out/modules/custom-spell-check/handlers/get-languages-list.js +1 -1
  63. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -2
  64. package/out/modules/custom-spell-check/handlers/spell-check.js +1 -1
  65. package/out/modules/custom-spell-check/index.js +1 -2
  66. package/out/modules/editor-right-panel/index.js +1 -2
  67. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -2
  68. package/out/modules/external-qa-check/handlers/validate.js +1 -1
  69. package/out/modules/external-qa-check/index.js +1 -2
  70. package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -2
  71. package/out/modules/file-processing/handlers/custom-file-format.js +9 -9
  72. package/out/modules/file-processing/handlers/file-download.d.ts +1 -2
  73. package/out/modules/file-processing/handlers/file-download.js +1 -1
  74. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -2
  75. package/out/modules/file-processing/handlers/pre-post-process.js +1 -1
  76. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -2
  77. package/out/modules/file-processing/handlers/translations-alignment.js +1 -1
  78. package/out/modules/file-processing/index.js +6 -7
  79. package/out/modules/file-processing/types.d.ts +0 -2
  80. package/out/modules/file-processing/types.js +1 -1
  81. package/out/modules/file-processing/util/defaults.js +18 -9
  82. package/out/modules/file-processing/util/files.d.ts +0 -2
  83. package/out/modules/file-processing/util/files.js +4 -4
  84. package/out/modules/form-data-display.d.ts +1 -2
  85. package/out/modules/form-data-display.js +18 -8
  86. package/out/modules/form-data-save.d.ts +1 -2
  87. package/out/modules/form-data-save.js +18 -8
  88. package/out/modules/install.d.ts +1 -2
  89. package/out/modules/install.js +2 -2
  90. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -2
  91. package/out/modules/integration/handlers/crowdin-file-progress.js +1 -1
  92. package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +1 -2
  93. package/out/modules/integration/handlers/crowdin-files-target-languages.js +1 -1
  94. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -2
  95. package/out/modules/integration/handlers/crowdin-files.js +1 -1
  96. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -2
  97. package/out/modules/integration/handlers/crowdin-project.js +1 -1
  98. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -2
  99. package/out/modules/integration/handlers/crowdin-update.js +1 -1
  100. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -2
  101. package/out/modules/integration/handlers/crowdin-webhook.js +2 -2
  102. package/out/modules/integration/handlers/integration-data.d.ts +1 -2
  103. package/out/modules/integration/handlers/integration-data.js +1 -1
  104. package/out/modules/integration/handlers/integration-login.d.ts +1 -2
  105. package/out/modules/integration/handlers/integration-login.js +1 -1
  106. package/out/modules/integration/handlers/integration-logout.d.ts +1 -2
  107. package/out/modules/integration/handlers/integration-logout.js +18 -8
  108. package/out/modules/integration/handlers/integration-update.d.ts +1 -2
  109. package/out/modules/integration/handlers/integration-update.js +1 -1
  110. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -2
  111. package/out/modules/integration/handlers/integration-webhook.js +1 -1
  112. package/out/modules/integration/handlers/invite-users.d.ts +1 -2
  113. package/out/modules/integration/handlers/invite-users.js +1 -1
  114. package/out/modules/integration/handlers/job-cancel.d.ts +1 -2
  115. package/out/modules/integration/handlers/job-cancel.js +1 -1
  116. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -2
  117. package/out/modules/integration/handlers/job-info-deprecated.js +1 -1
  118. package/out/modules/integration/handlers/job-info.d.ts +1 -2
  119. package/out/modules/integration/handlers/job-info.js +1 -1
  120. package/out/modules/integration/handlers/job-list.d.ts +1 -2
  121. package/out/modules/integration/handlers/job-list.js +1 -1
  122. package/out/modules/integration/handlers/main.d.ts +1 -2
  123. package/out/modules/integration/handlers/main.js +1 -1
  124. package/out/modules/integration/handlers/oauth-login.d.ts +1 -2
  125. package/out/modules/integration/handlers/oauth-login.js +1 -1
  126. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -2
  127. package/out/modules/integration/handlers/oauth-polling.js +1 -1
  128. package/out/modules/integration/handlers/oauth-url.d.ts +1 -2
  129. package/out/modules/integration/handlers/oauth-url.js +1 -1
  130. package/out/modules/integration/handlers/settings-save.d.ts +1 -2
  131. package/out/modules/integration/handlers/settings-save.js +1 -1
  132. package/out/modules/integration/handlers/settings.d.ts +1 -2
  133. package/out/modules/integration/handlers/settings.js +1 -1
  134. package/out/modules/integration/handlers/subscription-info.js +1 -1
  135. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -2
  136. package/out/modules/integration/handlers/sync-settings-save.js +1 -1
  137. package/out/modules/integration/handlers/sync-settings.d.ts +1 -2
  138. package/out/modules/integration/handlers/sync-settings.js +1 -1
  139. package/out/modules/integration/handlers/user-errors.d.ts +1 -2
  140. package/out/modules/integration/handlers/user-errors.js +1 -1
  141. package/out/modules/integration/handlers/users.d.ts +1 -2
  142. package/out/modules/integration/handlers/users.js +4 -5
  143. package/out/modules/integration/index.js +1 -2
  144. package/out/modules/integration/types.js +4 -4
  145. package/out/modules/integration/util/cron.js +46 -37
  146. package/out/modules/integration/util/defaults.js +33 -24
  147. package/out/modules/integration/util/files.js +29 -30
  148. package/out/modules/integration/util/job.js +29 -20
  149. package/out/modules/integration/util/snapshot.js +7 -8
  150. package/out/modules/integration/util/types.js +3 -3
  151. package/out/modules/integration/util/webhooks.js +54 -44
  152. package/out/modules/manifest.js +1 -1
  153. package/out/modules/modal/index.js +1 -2
  154. package/out/modules/organization-menu/index.js +1 -2
  155. package/out/modules/organization-settings-menu/index.js +1 -2
  156. package/out/modules/profile-resources-menu/index.js +1 -2
  157. package/out/modules/profile-settings-menu/index.js +1 -2
  158. package/out/modules/project-menu/index.js +1 -2
  159. package/out/modules/project-menu-crowdsource/index.js +1 -2
  160. package/out/modules/project-reports/index.js +1 -2
  161. package/out/modules/project-tools/index.js +1 -2
  162. package/out/modules/status.d.ts +1 -2
  163. package/out/modules/status.js +1 -1
  164. package/out/modules/subscription-paid.d.ts +1 -2
  165. package/out/modules/subscription-paid.js +1 -1
  166. package/out/modules/uninstall.d.ts +1 -2
  167. package/out/modules/uninstall.js +1 -1
  168. package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -2
  169. package/out/modules/webhooks/handlers/webhook-handler.js +18 -9
  170. package/out/modules/webhooks/index.js +1 -2
  171. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -2
  172. package/out/modules/workflow-step-type/handlers/delete-step.js +18 -8
  173. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -2
  174. package/out/modules/workflow-step-type/handlers/step-settings-save.js +18 -8
  175. package/out/modules/workflow-step-type/index.js +1 -2
  176. package/out/modules/workflow-step-type/types.js +1 -1
  177. package/out/modules/workflow-step-type/util/index.js +2 -3
  178. package/out/static/ui/error.bundle.js +446 -379
  179. package/out/static/ui/error.bundle.js.map +1 -1
  180. package/out/static/ui/form.bundle.js +29793 -29989
  181. package/out/static/ui/form.bundle.js.map +1 -1
  182. package/out/static/ui/install.bundle.js +446 -379
  183. package/out/static/ui/install.bundle.js.map +1 -1
  184. package/out/static/ui/login.bundle.js +448 -379
  185. package/out/static/ui/login.bundle.js.map +1 -1
  186. package/out/static/ui/main.bundle.js +448 -379
  187. package/out/static/ui/main.bundle.js.map +1 -1
  188. package/out/static/ui/oauth.bundle.js +448 -379
  189. package/out/static/ui/oauth.bundle.js.map +1 -1
  190. package/out/storage/d1.js +9 -9
  191. package/out/storage/index.js +24 -10
  192. package/out/storage/mysql.js +31 -31
  193. package/out/storage/postgre.js +31 -31
  194. package/out/storage/sqlite.js +8 -8
  195. package/out/types.d.ts +0 -2
  196. package/out/types.js +8 -8
  197. package/out/util/connection.js +34 -25
  198. package/out/util/credentials-masker.d.ts +1 -2
  199. package/out/util/credentials-masker.js +3 -4
  200. package/out/util/cron.js +20 -10
  201. package/out/util/form-schema.js +2 -3
  202. package/out/util/index.js +38 -28
  203. package/out/util/jsx-renderer.js +2 -3
  204. package/out/util/logger.js +41 -31
  205. package/out/util/static-files.d.ts +0 -1
  206. package/out/util/static-files.js +2 -3
  207. package/out/util/subscription.js +11 -12
  208. package/out/views/FormPage.js +3 -3
  209. package/package.json +28 -33
package/out/storage/d1.js CHANGED
@@ -166,8 +166,8 @@ class D1Storage {
166
166
  });
167
167
  }
168
168
  saveCrowdinCredentials(credentials) {
169
- var _a, _b, _c;
170
169
  return __awaiter(this, void 0, void 0, function* () {
170
+ var _a, _b, _c;
171
171
  yield this.db
172
172
  .prepare('INSERT INTO crowdin_credentials(id, app_secret, domain, user_id, agent_id, organization_id, base_url, access_token, refresh_token, expire, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
173
173
  .bind(...this.sanitizeBindValues(credentials.id, credentials.appSecret, credentials.domain, (_a = credentials.userId) === null || _a === void 0 ? void 0 : _a.toString(), (_b = credentials.agentId) === null || _b === void 0 ? void 0 : _b.toString(), (_c = credentials.organizationId) === null || _c === void 0 ? void 0 : _c.toString(), credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.type))
@@ -175,8 +175,8 @@ class D1Storage {
175
175
  });
176
176
  }
177
177
  updateCrowdinCredentials(credentials) {
178
- var _a, _b, _c;
179
178
  return __awaiter(this, void 0, void 0, function* () {
179
+ var _a, _b, _c;
180
180
  yield this.db
181
181
  .prepare('UPDATE crowdin_credentials SET app_secret = ?, domain = ?, user_id = ?, agent_id = ?, organization_id = ?, base_url = ?, access_token = ?, refresh_token = ?, expire = ? WHERE id = ?')
182
182
  .bind(...this.sanitizeBindValues(credentials.appSecret, credentials.domain, (_a = credentials.userId) === null || _a === void 0 ? void 0 : _a.toString(), (_b = credentials.agentId) === null || _b === void 0 ? void 0 : _b.toString(), (_c = credentials.organizationId) === null || _c === void 0 ? void 0 : _c.toString(), credentials.baseUrl, credentials.accessToken, credentials.refreshToken, credentials.expire, credentials.id))
@@ -753,9 +753,9 @@ class D1Storage {
753
753
  .run();
754
754
  });
755
755
  }
756
- selectRecords(tableName, options = {}, params = []) {
757
- var _a;
758
- return __awaiter(this, void 0, void 0, function* () {
756
+ selectRecords(tableName_1) {
757
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
758
+ var _a;
759
759
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
760
760
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
761
761
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -768,8 +768,8 @@ class D1Storage {
768
768
  return result.results || [];
769
769
  });
770
770
  }
771
- updateRecord(tableName, data, whereClause, params = []) {
772
- return __awaiter(this, void 0, void 0, function* () {
771
+ updateRecord(tableName_1, data_1, whereClause_1) {
772
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
773
773
  const setClause = Object.keys(data)
774
774
  .map((key) => `${key} = ?`)
775
775
  .join(', ');
@@ -781,8 +781,8 @@ class D1Storage {
781
781
  .run();
782
782
  });
783
783
  }
784
- deleteRecord(tableName, whereClause, params = []) {
785
- return __awaiter(this, void 0, void 0, function* () {
784
+ deleteRecord(tableName_1, whereClause_1) {
785
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
786
786
  const query = `DELETE FROM ${tableName} ${whereClause};`;
787
787
  const stmt = this.db.prepare(query);
788
788
  if (params.length > 0) {
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -35,7 +45,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
46
  };
37
47
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.getStorage = exports.initialize = exports.TABLES = void 0;
48
+ exports.TABLES = void 0;
49
+ exports.initialize = initialize;
50
+ exports.getStorage = getStorage;
39
51
  const child_process_1 = require("child_process");
40
52
  const fs_1 = __importDefault(require("fs"));
41
53
  const util = __importStar(require("node:util"));
@@ -90,17 +102,19 @@ function initialize(config) {
90
102
  }
91
103
  storage = new sqlite_1.SQLiteStorage({ dbFolder: config.dbFolder });
92
104
  }
105
+ if (process.env.SKIP_MIGRATIONS) {
106
+ (0, logger_1.log)('Skipping database migrations (SKIP_MIGRATIONS is set)');
107
+ return;
108
+ }
93
109
  yield storage.migrate();
94
110
  });
95
111
  }
96
- exports.initialize = initialize;
97
112
  function getStorage() {
98
113
  if (!storage) {
99
114
  throw new Error('Storage not initialized');
100
115
  }
101
116
  return storage;
102
117
  }
103
- exports.getStorage = getStorage;
104
118
  function createDumpForMigration(config) {
105
119
  const sqliteFilePath = (0, path_1.join)(config.dbFolder, types_1.storageFiles.SQLITE);
106
120
  const backupFilePath = (0, path_1.join)(config.dbFolder, types_1.storageFiles.SQLITE_BACKUP);
@@ -599,8 +599,8 @@ class MySQLStorage {
599
599
  yield this.executeQuery((connection) => connection.execute('UPDATE integration_settings SET config = ? WHERE id = ?', [config, integrationId]));
600
600
  });
601
601
  }
602
- createJob({ integrationId, crowdinId, type, title, payload }) {
603
- return __awaiter(this, void 0, void 0, function* () {
602
+ createJob(_a) {
603
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, type, title, payload }) {
604
604
  const id = (0, crypto_1.randomUUID)();
605
605
  yield this.dbPromise;
606
606
  yield this.executeQuery((connection) => connection.execute(`
@@ -610,8 +610,8 @@ class MySQLStorage {
610
610
  return id;
611
611
  });
612
612
  }
613
- updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
614
- return __awaiter(this, void 0, void 0, function* () {
613
+ updateJob(_a) {
614
+ return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
615
615
  const updateFields = ['updated_at'];
616
616
  const updateParams = [Date.now().toString()];
617
617
  if (progress) {
@@ -659,8 +659,8 @@ class MySQLStorage {
659
659
  `, updateParams));
660
660
  });
661
661
  }
662
- getJob({ id }) {
663
- return __awaiter(this, void 0, void 0, function* () {
662
+ getJob(_a) {
663
+ return __awaiter(this, arguments, void 0, function* ({ id }) {
664
664
  yield this.dbPromise;
665
665
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
666
666
  const [rows] = yield connection.execute(`
@@ -687,8 +687,8 @@ class MySQLStorage {
687
687
  }));
688
688
  });
689
689
  }
690
- getActiveJobs({ integrationId, crowdinId }) {
691
- return __awaiter(this, void 0, void 0, function* () {
690
+ getActiveJobs(_a) {
691
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
692
692
  yield this.dbPromise;
693
693
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
694
694
  const [rows] = yield connection.execute(`
@@ -752,8 +752,8 @@ class MySQLStorage {
752
752
  }));
753
753
  });
754
754
  }
755
- getAllJobs({ integrationId, crowdinId, limit, offset }) {
756
- return __awaiter(this, void 0, void 0, function* () {
755
+ getAllJobs(_a) {
756
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
757
757
  yield this.dbPromise;
758
758
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
759
759
  const [rows] = yield connection.execute(`
@@ -782,8 +782,8 @@ class MySQLStorage {
782
782
  }));
783
783
  });
784
784
  }
785
- saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
786
- return __awaiter(this, void 0, void 0, function* () {
785
+ saveTranslationCache(_a) {
786
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
787
787
  yield this.dbPromise;
788
788
  yield this.executeQuery((connection) => connection.execute(`
789
789
  INSERT INTO translation_file_cache(integration_id, crowdin_id, file_id, language_id, etag)
@@ -791,8 +791,8 @@ class MySQLStorage {
791
791
  `, [integrationId, crowdinId, fileId, languageId, etag]));
792
792
  });
793
793
  }
794
- getFileTranslationCache({ integrationId, crowdinId, fileId, }) {
795
- return __awaiter(this, void 0, void 0, function* () {
794
+ getFileTranslationCache(_a) {
795
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, }) {
796
796
  yield this.dbPromise;
797
797
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
798
798
  const [rows] = yield connection.execute(`
@@ -810,8 +810,8 @@ class MySQLStorage {
810
810
  }));
811
811
  });
812
812
  }
813
- getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }) {
814
- return __awaiter(this, void 0, void 0, function* () {
813
+ getFileTranslationCacheByLanguage(_a) {
814
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, }) {
815
815
  yield this.dbPromise;
816
816
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
817
817
  const [rows] = yield connection.execute(`
@@ -830,8 +830,8 @@ class MySQLStorage {
830
830
  }));
831
831
  });
832
832
  }
833
- updateTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
834
- return __awaiter(this, void 0, void 0, function* () {
833
+ updateTranslationCache(_a) {
834
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
835
835
  yield this.dbPromise;
836
836
  yield this.executeQuery((connection) => connection.execute(`
837
837
  UPDATE translation_file_cache
@@ -843,8 +843,8 @@ class MySQLStorage {
843
843
  `, [etag, integrationId, crowdinId, fileId, languageId]));
844
844
  });
845
845
  }
846
- saveUnsyncedFiles({ integrationId, crowdinId, files }) {
847
- return __awaiter(this, void 0, void 0, function* () {
846
+ saveUnsyncedFiles(_a) {
847
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
848
848
  yield this.dbPromise;
849
849
  yield this.executeQuery((connection) => connection.execute(`
850
850
  INSERT INTO unsynced_files(integration_id, crowdin_id, files)
@@ -852,8 +852,8 @@ class MySQLStorage {
852
852
  `, [integrationId, crowdinId, files]));
853
853
  });
854
854
  }
855
- updateUnsyncedFiles({ integrationId, crowdinId, files }) {
856
- return __awaiter(this, void 0, void 0, function* () {
855
+ updateUnsyncedFiles(_a) {
856
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
857
857
  yield this.dbPromise;
858
858
  yield this.executeQuery((connection) => connection.execute(`
859
859
  UPDATE unsynced_files
@@ -863,8 +863,8 @@ class MySQLStorage {
863
863
  `, [files, integrationId, crowdinId]));
864
864
  });
865
865
  }
866
- getUnsyncedFiles({ integrationId, crowdinId }) {
867
- return __awaiter(this, void 0, void 0, function* () {
866
+ getUnsyncedFiles(_a) {
867
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
868
868
  yield this.dbPromise;
869
869
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
870
870
  const [rows] = yield connection.execute(`
@@ -907,9 +907,9 @@ class MySQLStorage {
907
907
  }));
908
908
  });
909
909
  }
910
- selectRecords(tableName, options = {}, params = []) {
911
- var _a;
912
- return __awaiter(this, void 0, void 0, function* () {
910
+ selectRecords(tableName_1) {
911
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
912
+ var _a;
913
913
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
914
914
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
915
915
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -928,8 +928,8 @@ class MySQLStorage {
928
928
  }));
929
929
  });
930
930
  }
931
- updateRecord(tableName, data, whereClause, params = []) {
932
- return __awaiter(this, void 0, void 0, function* () {
931
+ updateRecord(tableName_1, data_1, whereClause_1) {
932
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
933
933
  const setClause = Object.keys(data)
934
934
  .map((key) => `${key} = ?`)
935
935
  .join(', ');
@@ -942,8 +942,8 @@ class MySQLStorage {
942
942
  }));
943
943
  });
944
944
  }
945
- deleteRecord(tableName, whereClause, params = []) {
946
- return __awaiter(this, void 0, void 0, function* () {
945
+ deleteRecord(tableName_1, whereClause_1) {
946
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
947
947
  const query = `DELETE
948
948
  FROM ${tableName} ${whereClause};`;
949
949
  yield this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
@@ -643,8 +643,8 @@ class PostgreStorage {
643
643
  ]));
644
644
  });
645
645
  }
646
- createJob({ integrationId, crowdinId, type, payload, title }) {
647
- return __awaiter(this, void 0, void 0, function* () {
646
+ createJob(_a) {
647
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, type, payload, title }) {
648
648
  const id = (0, crypto_1.randomUUID)();
649
649
  yield this.dbPromise;
650
650
  yield this.executeQuery((client) => client.query(`
@@ -655,8 +655,8 @@ class PostgreStorage {
655
655
  return id;
656
656
  });
657
657
  }
658
- updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
659
- return __awaiter(this, void 0, void 0, function* () {
658
+ updateJob(_a) {
659
+ return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
660
660
  let parametersPointer = 1;
661
661
  const updateFields = [`updated_at = $${parametersPointer}`];
662
662
  const updateParams = [Date.now().toString()];
@@ -715,8 +715,8 @@ class PostgreStorage {
715
715
  `, updateParams));
716
716
  });
717
717
  }
718
- getJob({ id }) {
719
- return __awaiter(this, void 0, void 0, function* () {
718
+ getJob(_a) {
719
+ return __awaiter(this, arguments, void 0, function* ({ id }) {
720
720
  yield this.dbPromise;
721
721
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
722
722
  const res = yield client.query(`
@@ -729,8 +729,8 @@ class PostgreStorage {
729
729
  }));
730
730
  });
731
731
  }
732
- getActiveJobs({ integrationId, crowdinId }) {
733
- return __awaiter(this, void 0, void 0, function* () {
732
+ getActiveJobs(_a) {
733
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
734
734
  yield this.dbPromise;
735
735
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
736
736
  const res = yield client.query(`
@@ -763,8 +763,8 @@ class PostgreStorage {
763
763
  }));
764
764
  });
765
765
  }
766
- getAllJobs({ integrationId, crowdinId, limit, offset }) {
767
- return __awaiter(this, void 0, void 0, function* () {
766
+ getAllJobs(_a) {
767
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
768
768
  yield this.dbPromise;
769
769
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
770
770
  const res = yield client.query(`
@@ -792,8 +792,8 @@ class PostgreStorage {
792
792
  }));
793
793
  });
794
794
  }
795
- saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
796
- return __awaiter(this, void 0, void 0, function* () {
795
+ saveTranslationCache(_a) {
796
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
797
797
  yield this.dbPromise;
798
798
  yield this.executeQuery((client) => client.query(`
799
799
  INSERT
@@ -802,8 +802,8 @@ class PostgreStorage {
802
802
  `, [integrationId, crowdinId, fileId, languageId, etag]));
803
803
  });
804
804
  }
805
- getFileTranslationCache({ integrationId, crowdinId, fileId, }) {
806
- return __awaiter(this, void 0, void 0, function* () {
805
+ getFileTranslationCache(_a) {
806
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, }) {
807
807
  yield this.dbPromise;
808
808
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
809
809
  const res = yield client.query(`
@@ -815,8 +815,8 @@ class PostgreStorage {
815
815
  }));
816
816
  });
817
817
  }
818
- getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }) {
819
- return __awaiter(this, void 0, void 0, function* () {
818
+ getFileTranslationCacheByLanguage(_a) {
819
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, }) {
820
820
  yield this.dbPromise;
821
821
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
822
822
  const res = yield client.query(`
@@ -828,8 +828,8 @@ class PostgreStorage {
828
828
  }));
829
829
  });
830
830
  }
831
- updateTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
832
- return __awaiter(this, void 0, void 0, function* () {
831
+ updateTranslationCache(_a) {
832
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
833
833
  yield this.dbPromise;
834
834
  yield this.executeQuery((client) => client.query(`
835
835
  UPDATE translation_file_cache
@@ -862,8 +862,8 @@ class PostgreStorage {
862
862
  yield this.resetSequences();
863
863
  });
864
864
  }
865
- saveUnsyncedFiles({ integrationId, crowdinId, files }) {
866
- return __awaiter(this, void 0, void 0, function* () {
865
+ saveUnsyncedFiles(_a) {
866
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
867
867
  yield this.dbPromise;
868
868
  yield this.executeQuery((client) => client.query(`
869
869
  INSERT
@@ -872,8 +872,8 @@ class PostgreStorage {
872
872
  `, [integrationId, crowdinId, files]));
873
873
  });
874
874
  }
875
- updateUnsyncedFiles({ integrationId, crowdinId, files }) {
876
- return __awaiter(this, void 0, void 0, function* () {
875
+ updateUnsyncedFiles(_a) {
876
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
877
877
  yield this.dbPromise;
878
878
  yield this.executeQuery((client) => client.query(`
879
879
  UPDATE unsynced_files
@@ -882,8 +882,8 @@ class PostgreStorage {
882
882
  `, [files, integrationId, crowdinId]));
883
883
  });
884
884
  }
885
- getUnsyncedFiles({ integrationId, crowdinId }) {
886
- return __awaiter(this, void 0, void 0, function* () {
885
+ getUnsyncedFiles(_a) {
886
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
887
887
  yield this.dbPromise;
888
888
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
889
889
  const res = yield client.query(`
@@ -923,9 +923,9 @@ class PostgreStorage {
923
923
  }));
924
924
  });
925
925
  }
926
- selectRecords(tableName, options = {}, params = []) {
927
- var _a;
928
- return __awaiter(this, void 0, void 0, function* () {
926
+ selectRecords(tableName_1) {
927
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
928
+ var _a;
929
929
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
930
930
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
931
931
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -939,8 +939,8 @@ class PostgreStorage {
939
939
  }));
940
940
  });
941
941
  }
942
- updateRecord(tableName, data, whereClause, params = []) {
943
- return __awaiter(this, void 0, void 0, function* () {
942
+ updateRecord(tableName_1, data_1, whereClause_1) {
943
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
944
944
  const keys = Object.keys(data);
945
945
  const setClause = keys.map((key, index) => `"${key}" = $${index + 1}`).join(', ');
946
946
  const values = Object.values(data);
@@ -951,8 +951,8 @@ class PostgreStorage {
951
951
  }));
952
952
  });
953
953
  }
954
- deleteRecord(tableName, whereClause, params = []) {
955
- return __awaiter(this, void 0, void 0, function* () {
954
+ deleteRecord(tableName_1, whereClause_1) {
955
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
956
956
  const query = `DELETE FROM ${tableName} ${whereClause};`;
957
957
  yield this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
958
958
  yield client.query(query, params);
@@ -516,8 +516,8 @@ class SQLiteStorage {
516
516
  return id;
517
517
  });
518
518
  }
519
- updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
520
- return __awaiter(this, void 0, void 0, function* () {
519
+ updateJob(_a) {
520
+ return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
521
521
  const updateFields = ['updated_at = ?'];
522
522
  const updateParams = [Date.now().toString()];
523
523
  if (progress) {
@@ -598,8 +598,8 @@ class SQLiteStorage {
598
598
  `).all(types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED);
599
599
  });
600
600
  }
601
- getAllJobs({ integrationId, crowdinId, limit, offset }) {
602
- return __awaiter(this, void 0, void 0, function* () {
601
+ getAllJobs(_a) {
602
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
603
603
  return this.db.prepare(`
604
604
  SELECT
605
605
  id,
@@ -624,8 +624,8 @@ class SQLiteStorage {
624
624
  });
625
625
  }
626
626
  saveTranslationCache(params) {
627
- var _a;
628
627
  return __awaiter(this, void 0, void 0, function* () {
628
+ var _a;
629
629
  this.db.prepare(`
630
630
  INSERT INTO translation_file_cache
631
631
  (integration_id, crowdin_id, file_id, language_id, etag)
@@ -709,9 +709,9 @@ class SQLiteStorage {
709
709
  this.db.prepare(insertQuery).run(...values);
710
710
  });
711
711
  }
712
- selectRecords(tableName, options = {}, params) {
713
- var _a;
714
- return __awaiter(this, void 0, void 0, function* () {
712
+ selectRecords(tableName_1) {
713
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params) {
714
+ var _a;
715
715
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
716
716
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
717
717
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
package/out/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import Crowdin from '@crowdin/crowdin-api-client';
4
2
  import { JwtPayload, VerifyOptions } from '@crowdin/crowdin-apps-functions';
5
3
  import { Request } from 'express';
package/out/types.js CHANGED
@@ -8,7 +8,7 @@ var AuthenticationType;
8
8
  AuthenticationType["APP_WITH_CODE"] = "crowdin_app_with_code";
9
9
  AuthenticationType["AGENT"] = "crowdin_agent";
10
10
  AuthenticationType["NONE"] = "none";
11
- })(AuthenticationType = exports.AuthenticationType || (exports.AuthenticationType = {}));
11
+ })(AuthenticationType || (exports.AuthenticationType = AuthenticationType = {}));
12
12
  var Scope;
13
13
  (function (Scope) {
14
14
  Scope["ALL_SCOPES"] = "all";
@@ -36,17 +36,17 @@ var Scope;
36
36
  Scope["AI_PROMPTS"] = "ai.prompt";
37
37
  Scope["AI_PROXIES"] = "ai.proxy";
38
38
  Scope["APPLICATIONS"] = "application";
39
- })(Scope = exports.Scope || (exports.Scope = {}));
39
+ })(Scope || (exports.Scope = Scope = {}));
40
40
  var AccountType;
41
41
  (function (AccountType) {
42
42
  AccountType["NORMAL"] = "normal";
43
43
  AccountType["ENTERPRISE"] = "enterprise";
44
- })(AccountType = exports.AccountType || (exports.AccountType = {}));
44
+ })(AccountType || (exports.AccountType = AccountType = {}));
45
45
  var SubscriptionInfoType;
46
46
  (function (SubscriptionInfoType) {
47
47
  SubscriptionInfoType["TRIAL"] = "trial";
48
48
  SubscriptionInfoType["SUBSCRIPTION"] = "subscription";
49
- })(SubscriptionInfoType = exports.SubscriptionInfoType || (exports.SubscriptionInfoType = {}));
49
+ })(SubscriptionInfoType || (exports.SubscriptionInfoType = SubscriptionInfoType = {}));
50
50
  var EditorMode;
51
51
  (function (EditorMode) {
52
52
  EditorMode["ASSETS"] = "assets";
@@ -56,7 +56,7 @@ var EditorMode;
56
56
  EditorMode["COMFORTABLE"] = "comfortable";
57
57
  EditorMode["SIDE_BY_SIDE"] = "side-by-side";
58
58
  EditorMode["MULTILINGUAL"] = "multilingual";
59
- })(EditorMode = exports.EditorMode || (exports.EditorMode = {}));
59
+ })(EditorMode || (exports.EditorMode = EditorMode = {}));
60
60
  var UserPermissions;
61
61
  (function (UserPermissions) {
62
62
  UserPermissions["OWNER"] = "owner";
@@ -64,15 +64,15 @@ var UserPermissions;
64
64
  UserPermissions["ALL_MEMBERS"] = "all";
65
65
  UserPermissions["GUESTS"] = "guests";
66
66
  UserPermissions["RESTRICTED"] = "restricted";
67
- })(UserPermissions = exports.UserPermissions || (exports.UserPermissions = {}));
67
+ })(UserPermissions || (exports.UserPermissions = UserPermissions = {}));
68
68
  var ProjectPermissions;
69
69
  (function (ProjectPermissions) {
70
70
  ProjectPermissions["OWN"] = "own";
71
71
  ProjectPermissions["RESTRICTED"] = "restricted";
72
- })(ProjectPermissions = exports.ProjectPermissions || (exports.ProjectPermissions = {}));
72
+ })(ProjectPermissions || (exports.ProjectPermissions = ProjectPermissions = {}));
73
73
  var storageFiles;
74
74
  (function (storageFiles) {
75
75
  storageFiles["SQLITE"] = "app.sqlite";
76
76
  storageFiles["SQLITE_BACKUP"] = "backup_app.sqlite";
77
77
  storageFiles["DUMP"] = "dump_table_%s.sql";
78
- })(storageFiles = exports.storageFiles || (exports.storageFiles = {}));
78
+ })(storageFiles || (exports.storageFiles = storageFiles = {}));