@crowdin/app-project-module 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) 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.d.ts +1 -1
  191. package/out/storage/d1.js +29 -27
  192. package/out/storage/index.d.ts +1 -1
  193. package/out/storage/index.js +25 -11
  194. package/out/storage/mysql.d.ts +1 -1
  195. package/out/storage/mysql.js +35 -33
  196. package/out/storage/postgre.d.ts +1 -1
  197. package/out/storage/postgre.js +46 -44
  198. package/out/storage/sqlite.d.ts +1 -1
  199. package/out/storage/sqlite.js +18 -16
  200. package/out/types.d.ts +0 -2
  201. package/out/types.js +8 -8
  202. package/out/util/connection.js +34 -25
  203. package/out/util/credentials-masker.d.ts +1 -2
  204. package/out/util/credentials-masker.js +3 -4
  205. package/out/util/cron.js +20 -10
  206. package/out/util/form-schema.js +2 -3
  207. package/out/util/index.js +38 -28
  208. package/out/util/jsx-renderer.js +2 -3
  209. package/out/util/logger.js +41 -31
  210. package/out/util/static-files.d.ts +0 -1
  211. package/out/util/static-files.js +2 -3
  212. package/out/util/subscription.js +11 -12
  213. package/out/views/FormPage.js +3 -3
  214. package/package.json +28 -33
@@ -32,7 +32,7 @@ export declare class D1Storage implements Storage {
32
32
  ensureMigrated(): Promise<void>;
33
33
  private addColumn;
34
34
  private updateTables;
35
- migrate(): Promise<void>;
35
+ migrate(skipOnboarding?: boolean): Promise<void>;
36
36
  saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
37
37
  updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
38
38
  getCrowdinCredentials(id: string): Promise<CrowdinCredentials | undefined>;
package/out/storage/d1.js CHANGED
@@ -143,31 +143,33 @@ class D1Storage {
143
143
  yield this.addColumn('job', 'processed_entities', 'null');
144
144
  });
145
145
  }
146
- migrate() {
147
- return __awaiter(this, void 0, void 0, function* () {
148
- try {
149
- // Create all tables
150
- const statements = [];
151
- const tableEntries = Object.keys(this.tables).map((key) => [
152
- key,
153
- this.tables[key],
154
- ]);
155
- for (const [tableName, tableSchema] of tableEntries) {
156
- statements.push(this.db.prepare(`CREATE TABLE IF NOT EXISTS ${tableName} ${tableSchema}`));
146
+ migrate(skipOnboarding) {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ if (!skipOnboarding) {
149
+ try {
150
+ // Create all tables
151
+ const statements = [];
152
+ const tableEntries = Object.keys(this.tables).map((key) => [
153
+ key,
154
+ this.tables[key],
155
+ ]);
156
+ for (const [tableName, tableSchema] of tableEntries) {
157
+ statements.push(this.db.prepare(`CREATE TABLE IF NOT EXISTS ${tableName} ${tableSchema}`));
158
+ }
159
+ // Execute all table creation in batch
160
+ yield this.db.batch(statements);
161
+ // Update tables with new columns if needed
162
+ yield this.updateTables();
163
+ }
164
+ catch (e) {
165
+ console.error(e);
157
166
  }
158
- // Execute all table creation in batch
159
- yield this.db.batch(statements);
160
- // Update tables with new columns if needed
161
- yield this.updateTables();
162
- }
163
- catch (e) {
164
- console.error(e);
165
167
  }
166
168
  });
167
169
  }
168
170
  saveCrowdinCredentials(credentials) {
169
- var _a, _b, _c;
170
171
  return __awaiter(this, void 0, void 0, function* () {
172
+ var _a, _b, _c;
171
173
  yield this.db
172
174
  .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
175
  .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 +177,8 @@ class D1Storage {
175
177
  });
176
178
  }
177
179
  updateCrowdinCredentials(credentials) {
178
- var _a, _b, _c;
179
180
  return __awaiter(this, void 0, void 0, function* () {
181
+ var _a, _b, _c;
180
182
  yield this.db
181
183
  .prepare('UPDATE crowdin_credentials SET app_secret = ?, domain = ?, user_id = ?, agent_id = ?, organization_id = ?, base_url = ?, access_token = ?, refresh_token = ?, expire = ? WHERE id = ?')
182
184
  .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 +755,9 @@ class D1Storage {
753
755
  .run();
754
756
  });
755
757
  }
756
- selectRecords(tableName, options = {}, params = []) {
757
- var _a;
758
- return __awaiter(this, void 0, void 0, function* () {
758
+ selectRecords(tableName_1) {
759
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
760
+ var _a;
759
761
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
760
762
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
761
763
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -768,8 +770,8 @@ class D1Storage {
768
770
  return result.results || [];
769
771
  });
770
772
  }
771
- updateRecord(tableName, data, whereClause, params = []) {
772
- return __awaiter(this, void 0, void 0, function* () {
773
+ updateRecord(tableName_1, data_1, whereClause_1) {
774
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
773
775
  const setClause = Object.keys(data)
774
776
  .map((key) => `${key} = ?`)
775
777
  .join(', ');
@@ -781,8 +783,8 @@ class D1Storage {
781
783
  .run();
782
784
  });
783
785
  }
784
- deleteRecord(tableName, whereClause, params = []) {
785
- return __awaiter(this, void 0, void 0, function* () {
786
+ deleteRecord(tableName_1, whereClause_1) {
787
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
786
788
  const query = `DELETE FROM ${tableName} ${whereClause};`;
787
789
  const stmt = this.db.prepare(query);
788
790
  if (params.length > 0) {
@@ -18,7 +18,7 @@ export declare const TABLES: {
18
18
  };
19
19
  export interface Storage {
20
20
  tables: typeof TABLES;
21
- migrate(): Promise<void>;
21
+ migrate(skipOnboarding?: boolean): Promise<void>;
22
22
  saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
23
23
  updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
24
24
  getCrowdinCredentials(id: string): Promise<CrowdinCredentials | undefined>;
@@ -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
  }
93
- yield storage.migrate();
105
+ const skipOnboarding = !!process.env.SKIP_MIGRATIONS;
106
+ if (skipOnboarding) {
107
+ (0, logger_1.log)('Skipping database migrations (SKIP_MIGRATIONS is set)');
108
+ }
109
+ yield storage.migrate(skipOnboarding);
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);
@@ -38,7 +38,7 @@ export declare class MySQLStorage implements Storage {
38
38
  };
39
39
  constructor(config: MySQLStorageConfig);
40
40
  executeQuery<T>(command: (connection: any) => Promise<T>): Promise<T>;
41
- migrate(): Promise<void>;
41
+ migrate(skipOnboarding?: boolean): Promise<void>;
42
42
  addTables(connection: any): Promise<void>;
43
43
  saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
44
44
  updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
@@ -191,10 +191,12 @@ class MySQLStorage {
191
191
  }));
192
192
  });
193
193
  }
194
- migrate() {
194
+ migrate(skipOnboarding) {
195
195
  return __awaiter(this, void 0, void 0, function* () {
196
196
  try {
197
- yield this.executeQuery((connection) => this.addTables(connection));
197
+ if (!skipOnboarding) {
198
+ yield this.executeQuery((connection) => this.addTables(connection));
199
+ }
198
200
  this._res && this._res();
199
201
  }
200
202
  catch (e) {
@@ -599,8 +601,8 @@ class MySQLStorage {
599
601
  yield this.executeQuery((connection) => connection.execute('UPDATE integration_settings SET config = ? WHERE id = ?', [config, integrationId]));
600
602
  });
601
603
  }
602
- createJob({ integrationId, crowdinId, type, title, payload }) {
603
- return __awaiter(this, void 0, void 0, function* () {
604
+ createJob(_a) {
605
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, type, title, payload }) {
604
606
  const id = (0, crypto_1.randomUUID)();
605
607
  yield this.dbPromise;
606
608
  yield this.executeQuery((connection) => connection.execute(`
@@ -610,8 +612,8 @@ class MySQLStorage {
610
612
  return id;
611
613
  });
612
614
  }
613
- updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
614
- return __awaiter(this, void 0, void 0, function* () {
615
+ updateJob(_a) {
616
+ return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
615
617
  const updateFields = ['updated_at'];
616
618
  const updateParams = [Date.now().toString()];
617
619
  if (progress) {
@@ -659,8 +661,8 @@ class MySQLStorage {
659
661
  `, updateParams));
660
662
  });
661
663
  }
662
- getJob({ id }) {
663
- return __awaiter(this, void 0, void 0, function* () {
664
+ getJob(_a) {
665
+ return __awaiter(this, arguments, void 0, function* ({ id }) {
664
666
  yield this.dbPromise;
665
667
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
666
668
  const [rows] = yield connection.execute(`
@@ -687,8 +689,8 @@ class MySQLStorage {
687
689
  }));
688
690
  });
689
691
  }
690
- getActiveJobs({ integrationId, crowdinId }) {
691
- return __awaiter(this, void 0, void 0, function* () {
692
+ getActiveJobs(_a) {
693
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
692
694
  yield this.dbPromise;
693
695
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
694
696
  const [rows] = yield connection.execute(`
@@ -752,8 +754,8 @@ class MySQLStorage {
752
754
  }));
753
755
  });
754
756
  }
755
- getAllJobs({ integrationId, crowdinId, limit, offset }) {
756
- return __awaiter(this, void 0, void 0, function* () {
757
+ getAllJobs(_a) {
758
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
757
759
  yield this.dbPromise;
758
760
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
759
761
  const [rows] = yield connection.execute(`
@@ -782,8 +784,8 @@ class MySQLStorage {
782
784
  }));
783
785
  });
784
786
  }
785
- saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
786
- return __awaiter(this, void 0, void 0, function* () {
787
+ saveTranslationCache(_a) {
788
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
787
789
  yield this.dbPromise;
788
790
  yield this.executeQuery((connection) => connection.execute(`
789
791
  INSERT INTO translation_file_cache(integration_id, crowdin_id, file_id, language_id, etag)
@@ -791,8 +793,8 @@ class MySQLStorage {
791
793
  `, [integrationId, crowdinId, fileId, languageId, etag]));
792
794
  });
793
795
  }
794
- getFileTranslationCache({ integrationId, crowdinId, fileId, }) {
795
- return __awaiter(this, void 0, void 0, function* () {
796
+ getFileTranslationCache(_a) {
797
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, }) {
796
798
  yield this.dbPromise;
797
799
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
798
800
  const [rows] = yield connection.execute(`
@@ -810,8 +812,8 @@ class MySQLStorage {
810
812
  }));
811
813
  });
812
814
  }
813
- getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }) {
814
- return __awaiter(this, void 0, void 0, function* () {
815
+ getFileTranslationCacheByLanguage(_a) {
816
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, }) {
815
817
  yield this.dbPromise;
816
818
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
817
819
  const [rows] = yield connection.execute(`
@@ -830,8 +832,8 @@ class MySQLStorage {
830
832
  }));
831
833
  });
832
834
  }
833
- updateTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
834
- return __awaiter(this, void 0, void 0, function* () {
835
+ updateTranslationCache(_a) {
836
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
835
837
  yield this.dbPromise;
836
838
  yield this.executeQuery((connection) => connection.execute(`
837
839
  UPDATE translation_file_cache
@@ -843,8 +845,8 @@ class MySQLStorage {
843
845
  `, [etag, integrationId, crowdinId, fileId, languageId]));
844
846
  });
845
847
  }
846
- saveUnsyncedFiles({ integrationId, crowdinId, files }) {
847
- return __awaiter(this, void 0, void 0, function* () {
848
+ saveUnsyncedFiles(_a) {
849
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
848
850
  yield this.dbPromise;
849
851
  yield this.executeQuery((connection) => connection.execute(`
850
852
  INSERT INTO unsynced_files(integration_id, crowdin_id, files)
@@ -852,8 +854,8 @@ class MySQLStorage {
852
854
  `, [integrationId, crowdinId, files]));
853
855
  });
854
856
  }
855
- updateUnsyncedFiles({ integrationId, crowdinId, files }) {
856
- return __awaiter(this, void 0, void 0, function* () {
857
+ updateUnsyncedFiles(_a) {
858
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
857
859
  yield this.dbPromise;
858
860
  yield this.executeQuery((connection) => connection.execute(`
859
861
  UPDATE unsynced_files
@@ -863,8 +865,8 @@ class MySQLStorage {
863
865
  `, [files, integrationId, crowdinId]));
864
866
  });
865
867
  }
866
- getUnsyncedFiles({ integrationId, crowdinId }) {
867
- return __awaiter(this, void 0, void 0, function* () {
868
+ getUnsyncedFiles(_a) {
869
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
868
870
  yield this.dbPromise;
869
871
  return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
870
872
  const [rows] = yield connection.execute(`
@@ -907,9 +909,9 @@ class MySQLStorage {
907
909
  }));
908
910
  });
909
911
  }
910
- selectRecords(tableName, options = {}, params = []) {
911
- var _a;
912
- return __awaiter(this, void 0, void 0, function* () {
912
+ selectRecords(tableName_1) {
913
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
914
+ var _a;
913
915
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
914
916
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
915
917
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -928,8 +930,8 @@ class MySQLStorage {
928
930
  }));
929
931
  });
930
932
  }
931
- updateRecord(tableName, data, whereClause, params = []) {
932
- return __awaiter(this, void 0, void 0, function* () {
933
+ updateRecord(tableName_1, data_1, whereClause_1) {
934
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
933
935
  const setClause = Object.keys(data)
934
936
  .map((key) => `${key} = ?`)
935
937
  .join(', ');
@@ -942,8 +944,8 @@ class MySQLStorage {
942
944
  }));
943
945
  });
944
946
  }
945
- deleteRecord(tableName, whereClause, params = []) {
946
- return __awaiter(this, void 0, void 0, function* () {
947
+ deleteRecord(tableName_1, whereClause_1) {
948
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
947
949
  const query = `DELETE
948
950
  FROM ${tableName} ${whereClause};`;
949
951
  yield this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
@@ -47,7 +47,7 @@ export declare class PostgreStorage implements Storage {
47
47
  private generateLockId;
48
48
  executeQuery<T>(command: (client: Client) => Promise<T>): Promise<T>;
49
49
  private hasDumpFiles;
50
- migrate(): Promise<void>;
50
+ migrate(skipOnboarding?: boolean): Promise<void>;
51
51
  addColumns(client: Client, newColumns: string[], tableName: string): Promise<void>;
52
52
  addColumn(client: Client, columnName: string, tableName: string, columnType: string): Promise<void>;
53
53
  addTables(client: Client): Promise<void>;
@@ -210,22 +210,24 @@ class PostgreStorage {
210
210
  const files = fs_1.default.readdirSync(directoryPath).filter((file) => file.startsWith(name) && file.endsWith(extension));
211
211
  return files.length > 0;
212
212
  }
213
- migrate() {
213
+ migrate(skipOnboarding) {
214
214
  return __awaiter(this, void 0, void 0, function* () {
215
215
  try {
216
- if (this.directoryPath && this.hasDumpFiles(this.directoryPath)) {
217
- yield this.migrateFromSqlite(this.directoryPath);
218
- }
219
- // Use advisory lock to prevent concurrent migrations
220
- yield this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
221
- yield client.query('SELECT pg_advisory_lock($1)', [this.migrationLockId]);
222
- try {
223
- yield this.addTables(client);
224
- }
225
- finally {
226
- yield client.query('SELECT pg_advisory_unlock($1)', [this.migrationLockId]);
216
+ if (!skipOnboarding) {
217
+ if (this.directoryPath && this.hasDumpFiles(this.directoryPath)) {
218
+ yield this.migrateFromSqlite(this.directoryPath);
227
219
  }
228
- }));
220
+ // Use advisory lock to prevent concurrent migrations
221
+ yield this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
222
+ yield client.query('SELECT pg_advisory_lock($1)', [this.migrationLockId]);
223
+ try {
224
+ yield this.addTables(client);
225
+ }
226
+ finally {
227
+ yield client.query('SELECT pg_advisory_unlock($1)', [this.migrationLockId]);
228
+ }
229
+ }));
230
+ }
229
231
  this._res && this._res();
230
232
  }
231
233
  catch (e) {
@@ -643,8 +645,8 @@ class PostgreStorage {
643
645
  ]));
644
646
  });
645
647
  }
646
- createJob({ integrationId, crowdinId, type, payload, title }) {
647
- return __awaiter(this, void 0, void 0, function* () {
648
+ createJob(_a) {
649
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, type, payload, title }) {
648
650
  const id = (0, crypto_1.randomUUID)();
649
651
  yield this.dbPromise;
650
652
  yield this.executeQuery((client) => client.query(`
@@ -655,8 +657,8 @@ class PostgreStorage {
655
657
  return id;
656
658
  });
657
659
  }
658
- updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
659
- return __awaiter(this, void 0, void 0, function* () {
660
+ updateJob(_a) {
661
+ return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
660
662
  let parametersPointer = 1;
661
663
  const updateFields = [`updated_at = $${parametersPointer}`];
662
664
  const updateParams = [Date.now().toString()];
@@ -715,8 +717,8 @@ class PostgreStorage {
715
717
  `, updateParams));
716
718
  });
717
719
  }
718
- getJob({ id }) {
719
- return __awaiter(this, void 0, void 0, function* () {
720
+ getJob(_a) {
721
+ return __awaiter(this, arguments, void 0, function* ({ id }) {
720
722
  yield this.dbPromise;
721
723
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
722
724
  const res = yield client.query(`
@@ -729,8 +731,8 @@ class PostgreStorage {
729
731
  }));
730
732
  });
731
733
  }
732
- getActiveJobs({ integrationId, crowdinId }) {
733
- return __awaiter(this, void 0, void 0, function* () {
734
+ getActiveJobs(_a) {
735
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
734
736
  yield this.dbPromise;
735
737
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
736
738
  const res = yield client.query(`
@@ -763,8 +765,8 @@ class PostgreStorage {
763
765
  }));
764
766
  });
765
767
  }
766
- getAllJobs({ integrationId, crowdinId, limit, offset }) {
767
- return __awaiter(this, void 0, void 0, function* () {
768
+ getAllJobs(_a) {
769
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
768
770
  yield this.dbPromise;
769
771
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
770
772
  const res = yield client.query(`
@@ -792,8 +794,8 @@ class PostgreStorage {
792
794
  }));
793
795
  });
794
796
  }
795
- saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
796
- return __awaiter(this, void 0, void 0, function* () {
797
+ saveTranslationCache(_a) {
798
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
797
799
  yield this.dbPromise;
798
800
  yield this.executeQuery((client) => client.query(`
799
801
  INSERT
@@ -802,8 +804,8 @@ class PostgreStorage {
802
804
  `, [integrationId, crowdinId, fileId, languageId, etag]));
803
805
  });
804
806
  }
805
- getFileTranslationCache({ integrationId, crowdinId, fileId, }) {
806
- return __awaiter(this, void 0, void 0, function* () {
807
+ getFileTranslationCache(_a) {
808
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, }) {
807
809
  yield this.dbPromise;
808
810
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
809
811
  const res = yield client.query(`
@@ -815,8 +817,8 @@ class PostgreStorage {
815
817
  }));
816
818
  });
817
819
  }
818
- getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }) {
819
- return __awaiter(this, void 0, void 0, function* () {
820
+ getFileTranslationCacheByLanguage(_a) {
821
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, }) {
820
822
  yield this.dbPromise;
821
823
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
822
824
  const res = yield client.query(`
@@ -828,8 +830,8 @@ class PostgreStorage {
828
830
  }));
829
831
  });
830
832
  }
831
- updateTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
832
- return __awaiter(this, void 0, void 0, function* () {
833
+ updateTranslationCache(_a) {
834
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, fileId, languageId, etag, }) {
833
835
  yield this.dbPromise;
834
836
  yield this.executeQuery((client) => client.query(`
835
837
  UPDATE translation_file_cache
@@ -862,8 +864,8 @@ class PostgreStorage {
862
864
  yield this.resetSequences();
863
865
  });
864
866
  }
865
- saveUnsyncedFiles({ integrationId, crowdinId, files }) {
866
- return __awaiter(this, void 0, void 0, function* () {
867
+ saveUnsyncedFiles(_a) {
868
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
867
869
  yield this.dbPromise;
868
870
  yield this.executeQuery((client) => client.query(`
869
871
  INSERT
@@ -872,8 +874,8 @@ class PostgreStorage {
872
874
  `, [integrationId, crowdinId, files]));
873
875
  });
874
876
  }
875
- updateUnsyncedFiles({ integrationId, crowdinId, files }) {
876
- return __awaiter(this, void 0, void 0, function* () {
877
+ updateUnsyncedFiles(_a) {
878
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, files }) {
877
879
  yield this.dbPromise;
878
880
  yield this.executeQuery((client) => client.query(`
879
881
  UPDATE unsynced_files
@@ -882,8 +884,8 @@ class PostgreStorage {
882
884
  `, [files, integrationId, crowdinId]));
883
885
  });
884
886
  }
885
- getUnsyncedFiles({ integrationId, crowdinId }) {
886
- return __awaiter(this, void 0, void 0, function* () {
887
+ getUnsyncedFiles(_a) {
888
+ return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId }) {
887
889
  yield this.dbPromise;
888
890
  return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
889
891
  const res = yield client.query(`
@@ -923,9 +925,9 @@ class PostgreStorage {
923
925
  }));
924
926
  });
925
927
  }
926
- selectRecords(tableName, options = {}, params = []) {
927
- var _a;
928
- return __awaiter(this, void 0, void 0, function* () {
928
+ selectRecords(tableName_1) {
929
+ return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params = []) {
930
+ var _a;
929
931
  const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
930
932
  const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
931
933
  const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
@@ -939,8 +941,8 @@ class PostgreStorage {
939
941
  }));
940
942
  });
941
943
  }
942
- updateRecord(tableName, data, whereClause, params = []) {
943
- return __awaiter(this, void 0, void 0, function* () {
944
+ updateRecord(tableName_1, data_1, whereClause_1) {
945
+ return __awaiter(this, arguments, void 0, function* (tableName, data, whereClause, params = []) {
944
946
  const keys = Object.keys(data);
945
947
  const setClause = keys.map((key, index) => `"${key}" = $${index + 1}`).join(', ');
946
948
  const values = Object.values(data);
@@ -951,8 +953,8 @@ class PostgreStorage {
951
953
  }));
952
954
  });
953
955
  }
954
- deleteRecord(tableName, whereClause, params = []) {
955
- return __awaiter(this, void 0, void 0, function* () {
956
+ deleteRecord(tableName_1, whereClause_1) {
957
+ return __awaiter(this, arguments, void 0, function* (tableName, whereClause, params = []) {
956
958
  const query = `DELETE FROM ${tableName} ${whereClause};`;
957
959
  yield this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
958
960
  yield client.query(query, params);
@@ -24,7 +24,7 @@ export declare class SQLiteStorage implements Storage {
24
24
  synced_data: string;
25
25
  };
26
26
  constructor(config: SQLiteStorageConfig);
27
- migrate(): Promise<void>;
27
+ migrate(skipOnboarding?: boolean): Promise<void>;
28
28
  saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
29
29
  updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
30
30
  getCrowdinCredentials(id: string): Promise<CrowdinCredentials | undefined>;