@crowdin/app-project-module 1.2.0 → 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.
- package/out/app-test/integration/get-integration-files.js +1 -1
- package/out/app-test/integration/index.js +6 -6
- package/out/app-test/integration/mocks/crowdin-storage.d.ts +16 -16
- package/out/app-test/integration/mocks/mock-crowdin-api-client.js +17 -7
- package/out/app-test/integration/update-crowdin.js +1 -1
- package/out/app-test/integration/update-integration.js +1 -1
- package/out/app-test/util/index.js +1 -2
- package/out/index.js +23 -13
- package/out/middlewares/api-call.js +1 -1
- package/out/middlewares/auto-credentials-masker.js +2 -3
- package/out/middlewares/crowdin-client.d.ts +1 -2
- package/out/middlewares/crowdin-client.js +5 -6
- package/out/middlewares/integration-credentials.d.ts +1 -2
- package/out/middlewares/integration-credentials.js +18 -8
- package/out/middlewares/json-response.js +1 -1
- package/out/middlewares/render-ui-module.d.ts +1 -2
- package/out/middlewares/render-ui-module.js +1 -1
- package/out/middlewares/ui-module.d.ts +1 -2
- package/out/middlewares/ui-module.js +1 -1
- package/out/modules/about.js +2 -3
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -2
- package/out/modules/ai-prompt-provider/handlers/compile.js +1 -1
- package/out/modules/ai-prompt-provider/index.js +1 -2
- package/out/modules/ai-prompt-provider/types.js +1 -1
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -2
- package/out/modules/ai-provider/handlers/chat-completions.js +2 -2
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -2
- package/out/modules/ai-provider/handlers/get-model-list.js +1 -1
- package/out/modules/ai-provider/index.js +1 -2
- package/out/modules/ai-provider/util/index.js +6 -6
- package/out/modules/ai-request-processors/handler.d.ts +1 -2
- package/out/modules/ai-request-processors/handler.js +1 -1
- package/out/modules/ai-request-processors/index.js +5 -5
- package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -2
- package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
- package/out/modules/ai-tools/index.js +2 -3
- package/out/modules/ai-tools/util/index.js +4 -5
- package/out/modules/api/api.js +4 -5
- package/out/modules/api/index.js +1 -2
- package/out/modules/api/types.js +1 -1
- package/out/modules/auth-guard/handlers/verify.d.ts +1 -2
- package/out/modules/auth-guard/handlers/verify.js +1 -1
- package/out/modules/auth-guard/index.js +1 -2
- package/out/modules/automation-action/handlers/execute.d.ts +1 -2
- package/out/modules/automation-action/handlers/execute.js +1 -1
- package/out/modules/automation-action/handlers/input-schema.d.ts +1 -2
- package/out/modules/automation-action/handlers/input-schema.js +1 -1
- package/out/modules/automation-action/handlers/output-schema.d.ts +1 -2
- package/out/modules/automation-action/handlers/output-schema.js +1 -1
- package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -2
- package/out/modules/automation-action/handlers/validate-settings.js +1 -1
- package/out/modules/automation-action/index.js +1 -2
- package/out/modules/automation-action/util/index.js +2 -3
- package/out/modules/automation-action/util/validate-input.js +1 -2
- package/out/modules/context-menu/index.js +1 -2
- package/out/modules/context-menu/types.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +1 -2
- package/out/modules/custom-mt/handlers/translate.js +1 -1
- package/out/modules/custom-mt/index.js +1 -2
- package/out/modules/custom-mt/types.d.ts +0 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.js +1 -1
- package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -2
- package/out/modules/custom-spell-check/handlers/spell-check.js +1 -1
- package/out/modules/custom-spell-check/index.js +1 -2
- package/out/modules/editor-right-panel/index.js +1 -2
- package/out/modules/external-qa-check/handlers/validate.d.ts +1 -2
- package/out/modules/external-qa-check/handlers/validate.js +1 -1
- package/out/modules/external-qa-check/index.js +1 -2
- package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -2
- package/out/modules/file-processing/handlers/custom-file-format.js +9 -9
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -2
- package/out/modules/file-processing/handlers/file-download.js +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -2
- package/out/modules/file-processing/handlers/pre-post-process.js +1 -1
- package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -2
- package/out/modules/file-processing/handlers/translations-alignment.js +1 -1
- package/out/modules/file-processing/index.js +6 -7
- package/out/modules/file-processing/types.d.ts +0 -2
- package/out/modules/file-processing/types.js +1 -1
- package/out/modules/file-processing/util/defaults.js +18 -9
- package/out/modules/file-processing/util/files.d.ts +0 -2
- package/out/modules/file-processing/util/files.js +4 -4
- package/out/modules/form-data-display.d.ts +1 -2
- package/out/modules/form-data-display.js +18 -8
- package/out/modules/form-data-save.d.ts +1 -2
- package/out/modules/form-data-save.js +18 -8
- package/out/modules/install.d.ts +1 -2
- package/out/modules/install.js +2 -2
- package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-file-progress.js +1 -1
- package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-files-target-languages.js +1 -1
- package/out/modules/integration/handlers/crowdin-files.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-files.js +1 -1
- package/out/modules/integration/handlers/crowdin-project.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-project.js +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-update.js +1 -1
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-webhook.js +2 -2
- package/out/modules/integration/handlers/integration-data.d.ts +1 -2
- package/out/modules/integration/handlers/integration-data.js +1 -1
- package/out/modules/integration/handlers/integration-login.d.ts +1 -2
- package/out/modules/integration/handlers/integration-login.js +1 -1
- package/out/modules/integration/handlers/integration-logout.d.ts +1 -2
- package/out/modules/integration/handlers/integration-logout.js +18 -8
- package/out/modules/integration/handlers/integration-update.d.ts +1 -2
- package/out/modules/integration/handlers/integration-update.js +1 -1
- package/out/modules/integration/handlers/integration-webhook.d.ts +1 -2
- package/out/modules/integration/handlers/integration-webhook.js +1 -1
- package/out/modules/integration/handlers/invite-users.d.ts +1 -2
- package/out/modules/integration/handlers/invite-users.js +1 -1
- package/out/modules/integration/handlers/job-cancel.d.ts +1 -2
- package/out/modules/integration/handlers/job-cancel.js +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -2
- package/out/modules/integration/handlers/job-info-deprecated.js +1 -1
- package/out/modules/integration/handlers/job-info.d.ts +1 -2
- package/out/modules/integration/handlers/job-info.js +1 -1
- package/out/modules/integration/handlers/job-list.d.ts +1 -2
- package/out/modules/integration/handlers/job-list.js +1 -1
- package/out/modules/integration/handlers/main.d.ts +1 -2
- package/out/modules/integration/handlers/main.js +1 -1
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-login.js +1 -1
- package/out/modules/integration/handlers/oauth-polling.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-polling.js +1 -1
- package/out/modules/integration/handlers/oauth-url.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-url.js +1 -1
- package/out/modules/integration/handlers/settings-save.d.ts +1 -2
- package/out/modules/integration/handlers/settings-save.js +1 -1
- package/out/modules/integration/handlers/settings.d.ts +1 -2
- package/out/modules/integration/handlers/settings.js +1 -1
- package/out/modules/integration/handlers/subscription-info.js +1 -1
- package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -2
- package/out/modules/integration/handlers/sync-settings-save.js +1 -1
- package/out/modules/integration/handlers/sync-settings.d.ts +1 -2
- package/out/modules/integration/handlers/sync-settings.js +1 -1
- package/out/modules/integration/handlers/user-errors.d.ts +1 -2
- package/out/modules/integration/handlers/user-errors.js +1 -1
- package/out/modules/integration/handlers/users.d.ts +1 -2
- package/out/modules/integration/handlers/users.js +4 -5
- package/out/modules/integration/index.js +1 -2
- package/out/modules/integration/types.js +4 -4
- package/out/modules/integration/util/cron.js +46 -37
- package/out/modules/integration/util/defaults.js +33 -24
- package/out/modules/integration/util/files.js +29 -30
- package/out/modules/integration/util/job.js +29 -20
- package/out/modules/integration/util/snapshot.js +7 -8
- package/out/modules/integration/util/types.js +3 -3
- package/out/modules/integration/util/webhooks.js +54 -44
- package/out/modules/manifest.js +1 -1
- package/out/modules/modal/index.js +1 -2
- package/out/modules/organization-menu/index.js +1 -2
- package/out/modules/organization-settings-menu/index.js +1 -2
- package/out/modules/profile-resources-menu/index.js +1 -2
- package/out/modules/profile-settings-menu/index.js +1 -2
- package/out/modules/project-menu/index.js +1 -2
- package/out/modules/project-menu-crowdsource/index.js +1 -2
- package/out/modules/project-reports/index.js +1 -2
- package/out/modules/project-tools/index.js +1 -2
- package/out/modules/status.d.ts +1 -2
- package/out/modules/status.js +1 -1
- package/out/modules/subscription-paid.d.ts +1 -2
- package/out/modules/subscription-paid.js +1 -1
- package/out/modules/uninstall.d.ts +1 -2
- package/out/modules/uninstall.js +1 -1
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -2
- package/out/modules/webhooks/handlers/webhook-handler.js +18 -9
- package/out/modules/webhooks/index.js +1 -2
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -2
- package/out/modules/workflow-step-type/handlers/delete-step.js +18 -8
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -2
- package/out/modules/workflow-step-type/handlers/step-settings-save.js +18 -8
- package/out/modules/workflow-step-type/index.js +1 -2
- package/out/modules/workflow-step-type/types.js +1 -1
- package/out/modules/workflow-step-type/util/index.js +2 -3
- package/out/static/ui/error.bundle.js +446 -379
- package/out/static/ui/error.bundle.js.map +1 -1
- package/out/static/ui/form.bundle.js +29793 -29989
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/static/ui/install.bundle.js +446 -379
- package/out/static/ui/install.bundle.js.map +1 -1
- package/out/static/ui/login.bundle.js +448 -379
- package/out/static/ui/login.bundle.js.map +1 -1
- package/out/static/ui/main.bundle.js +448 -379
- package/out/static/ui/main.bundle.js.map +1 -1
- package/out/static/ui/oauth.bundle.js +448 -379
- package/out/static/ui/oauth.bundle.js.map +1 -1
- package/out/storage/d1.js +9 -9
- package/out/storage/index.js +24 -10
- package/out/storage/mysql.js +31 -31
- package/out/storage/postgre.js +31 -31
- package/out/storage/sqlite.js +9 -8
- package/out/types.d.ts +0 -2
- package/out/types.js +8 -8
- package/out/util/connection.js +34 -25
- package/out/util/credentials-masker.d.ts +1 -2
- package/out/util/credentials-masker.js +3 -4
- package/out/util/cron.js +20 -10
- package/out/util/form-schema.js +2 -3
- package/out/util/index.js +38 -28
- package/out/util/jsx-renderer.js +2 -3
- package/out/util/logger.js +41 -31
- package/out/util/static-files.d.ts +0 -1
- package/out/util/static-files.js +2 -3
- package/out/util/subscription.js +11 -12
- package/out/views/FormPage.js +3 -3
- 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(
|
|
757
|
-
|
|
758
|
-
|
|
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(
|
|
772
|
-
return __awaiter(this,
|
|
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(
|
|
785
|
-
return __awaiter(this,
|
|
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) {
|
package/out/storage/index.js
CHANGED
|
@@ -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 (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
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);
|
package/out/storage/mysql.js
CHANGED
|
@@ -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(
|
|
603
|
-
return __awaiter(this,
|
|
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(
|
|
614
|
-
return __awaiter(this,
|
|
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(
|
|
663
|
-
return __awaiter(this,
|
|
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(
|
|
691
|
-
return __awaiter(this,
|
|
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(
|
|
756
|
-
return __awaiter(this,
|
|
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(
|
|
786
|
-
return __awaiter(this,
|
|
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(
|
|
795
|
-
return __awaiter(this,
|
|
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(
|
|
814
|
-
return __awaiter(this,
|
|
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(
|
|
834
|
-
return __awaiter(this,
|
|
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(
|
|
847
|
-
return __awaiter(this,
|
|
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(
|
|
856
|
-
return __awaiter(this,
|
|
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(
|
|
867
|
-
return __awaiter(this,
|
|
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(
|
|
911
|
-
|
|
912
|
-
|
|
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(
|
|
932
|
-
return __awaiter(this,
|
|
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(
|
|
946
|
-
return __awaiter(this,
|
|
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* () {
|
package/out/storage/postgre.js
CHANGED
|
@@ -643,8 +643,8 @@ class PostgreStorage {
|
|
|
643
643
|
]));
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
|
-
createJob(
|
|
647
|
-
return __awaiter(this,
|
|
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(
|
|
659
|
-
return __awaiter(this,
|
|
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(
|
|
719
|
-
return __awaiter(this,
|
|
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(
|
|
733
|
-
return __awaiter(this,
|
|
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(
|
|
767
|
-
return __awaiter(this,
|
|
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(
|
|
796
|
-
return __awaiter(this,
|
|
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(
|
|
806
|
-
return __awaiter(this,
|
|
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(
|
|
819
|
-
return __awaiter(this,
|
|
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(
|
|
832
|
-
return __awaiter(this,
|
|
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(
|
|
866
|
-
return __awaiter(this,
|
|
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(
|
|
876
|
-
return __awaiter(this,
|
|
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(
|
|
886
|
-
return __awaiter(this,
|
|
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(
|
|
927
|
-
|
|
928
|
-
|
|
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(
|
|
943
|
-
return __awaiter(this,
|
|
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(
|
|
955
|
-
return __awaiter(this,
|
|
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);
|
package/out/storage/sqlite.js
CHANGED
|
@@ -516,8 +516,8 @@ class SQLiteStorage {
|
|
|
516
516
|
return id;
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
|
-
updateJob(
|
|
520
|
-
return __awaiter(this,
|
|
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(
|
|
602
|
-
return __awaiter(this,
|
|
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,
|
|
@@ -625,12 +625,13 @@ class SQLiteStorage {
|
|
|
625
625
|
}
|
|
626
626
|
saveTranslationCache(params) {
|
|
627
627
|
return __awaiter(this, void 0, void 0, function* () {
|
|
628
|
+
var _a;
|
|
628
629
|
this.db.prepare(`
|
|
629
630
|
INSERT INTO translation_file_cache
|
|
630
631
|
(integration_id, crowdin_id, file_id, language_id, etag)
|
|
631
632
|
VALUES
|
|
632
633
|
(@integrationId, @crowdinId, @fileId, @languageId, @etag)
|
|
633
|
-
`).run(params);
|
|
634
|
+
`).run(Object.assign(Object.assign({}, params), { etag: (_a = params.etag) !== null && _a !== void 0 ? _a : null }));
|
|
634
635
|
});
|
|
635
636
|
}
|
|
636
637
|
getFileTranslationCache(params) {
|
|
@@ -708,9 +709,9 @@ class SQLiteStorage {
|
|
|
708
709
|
this.db.prepare(insertQuery).run(...values);
|
|
709
710
|
});
|
|
710
711
|
}
|
|
711
|
-
selectRecords(
|
|
712
|
-
|
|
713
|
-
|
|
712
|
+
selectRecords(tableName_1) {
|
|
713
|
+
return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params) {
|
|
714
|
+
var _a;
|
|
714
715
|
const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
|
|
715
716
|
const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
|
|
716
717
|
const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
|
package/out/types.d.ts
CHANGED
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
78
|
+
})(storageFiles || (exports.storageFiles = storageFiles = {}));
|