@crowdin/app-project-module 0.98.0-cf-3 → 0.99.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/index.js +12 -28
- package/out/middlewares/crowdin-client.d.ts +1 -1
- package/out/middlewares/integration-credentials.d.ts +1 -1
- package/out/middlewares/integration-credentials.js +1 -4
- package/out/middlewares/render-ui-module.d.ts +3 -3
- package/out/middlewares/render-ui-module.js +13 -9
- package/out/middlewares/ui-module.d.ts +1 -1
- package/out/middlewares/ui-module.js +1 -4
- package/out/modules/about.d.ts +1 -1
- package/out/modules/about.js +2 -8
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
- package/out/modules/ai-prompt-provider/index.js +2 -4
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
- package/out/modules/ai-provider/index.js +2 -4
- package/out/modules/ai-request-processors/handler.d.ts +1 -1
- package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
- package/out/modules/ai-tools/index.js +1 -1
- package/out/modules/api/api.js +87 -2
- package/out/modules/context-menu/index.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
- package/out/modules/custom-mt/index.js +1 -3
- package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
- package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
- package/out/modules/custom-spell-check/index.js +4 -4
- package/out/modules/editor-right-panel/index.js +1 -1
- package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
- package/out/modules/external-qa-check/index.js +2 -2
- package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -1
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
- package/out/modules/form-data-display.d.ts +1 -1
- package/out/modules/form-data-save.d.ts +1 -1
- package/out/modules/install.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-files.js +6 -4
- package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.js +18 -4
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/integration-data.d.ts +1 -1
- package/out/modules/integration/handlers/integration-data.js +17 -13
- package/out/modules/integration/handlers/integration-login.d.ts +1 -1
- package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
- package/out/modules/integration/handlers/integration-update.d.ts +1 -1
- package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/invite-users.d.ts +1 -1
- package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.d.ts +4 -0
- package/out/modules/integration/handlers/job-info-deprecated.js +138 -0
- package/out/modules/integration/handlers/job-info.d.ts +1 -2
- package/out/modules/integration/handlers/job-info.js +20 -75
- package/out/modules/integration/handlers/job-list.d.ts +3 -0
- package/out/modules/integration/handlers/job-list.js +46 -0
- package/out/modules/integration/handlers/main.d.ts +1 -1
- package/out/modules/integration/handlers/main.js +3 -13
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-login.js +2 -10
- package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
- package/out/modules/integration/handlers/settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/settings.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
- package/out/modules/integration/handlers/user-errors.d.ts +1 -1
- package/out/modules/integration/handlers/users.d.ts +1 -1
- package/out/modules/integration/index.d.ts +1 -3
- package/out/modules/integration/index.js +37 -38
- package/out/modules/integration/types.d.ts +11 -1
- package/out/modules/integration/util/defaults.js +51 -45
- package/out/modules/integration/util/files.d.ts +1 -0
- package/out/modules/integration/util/files.js +52 -4
- package/out/modules/integration/util/job.d.ts +1 -1
- package/out/modules/integration/util/job.js +3 -2
- package/out/modules/integration/util/types.d.ts +8 -0
- package/out/modules/modal/index.js +2 -2
- package/out/modules/organization-menu/index.js +4 -6
- package/out/modules/organization-settings-menu/index.js +4 -6
- package/out/modules/profile-resources-menu/index.js +4 -6
- package/out/modules/profile-settings-menu/index.js +4 -6
- package/out/modules/project-menu/index.js +1 -1
- package/out/modules/project-menu-crowdsource/index.js +1 -1
- package/out/modules/project-reports/index.js +2 -4
- package/out/modules/project-tools/index.js +2 -4
- package/out/modules/status.d.ts +1 -1
- package/out/modules/subscription-paid.d.ts +1 -1
- package/out/modules/uninstall.d.ts +1 -1
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -1
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
- package/out/modules/workflow-step-type/index.js +2 -3
- package/out/storage/index.d.ts +2 -1
- package/out/storage/index.js +1 -8
- package/out/storage/mysql.d.ts +3 -2
- package/out/storage/mysql.js +42 -1
- package/out/storage/postgre.d.ts +3 -2
- package/out/storage/postgre.js +43 -4
- package/out/storage/sqlite.d.ts +3 -2
- package/out/storage/sqlite.js +38 -4
- package/out/types.d.ts +1 -18
- package/out/util/credentials-masker.d.ts +1 -1
- package/out/util/handlebars.d.ts +1 -0
- package/out/util/handlebars.js +46 -0
- package/out/util/index.d.ts +0 -2
- package/out/util/index.js +2 -14
- package/out/views/about.handlebars +102 -0
- package/out/views/error.handlebars +54 -0
- package/out/views/form.handlebars +30 -0
- package/out/views/install.handlebars +16 -0
- package/out/views/login.handlebars +331 -0
- package/out/views/main.handlebars +1901 -0
- package/out/views/oauth.handlebars +11 -0
- package/out/views/partials/head.handlebars +53 -0
- package/out/views/subscription.handlebars +26 -0
- package/package.json +11 -12
- package/out/storage/d1.d.ts +0 -99
- package/out/storage/d1.js +0 -769
- package/out/util/jsx-renderer.d.ts +0 -6
- package/out/util/jsx-renderer.js +0 -13
- package/out/util/static-files.d.ts +0 -19
- package/out/util/static-files.js +0 -82
- package/out/views/AboutPage.d.ts +0 -9
- package/out/views/AboutPage.js +0 -79
- package/out/views/ErrorPage.d.ts +0 -18
- package/out/views/ErrorPage.js +0 -56
- package/out/views/FormPage.d.ts +0 -13
- package/out/views/FormPage.js +0 -27
- package/out/views/InstallPage.d.ts +0 -10
- package/out/views/InstallPage.js +0 -22
- package/out/views/LoginPage.d.ts +0 -33
- package/out/views/LoginPage.js +0 -199
- package/out/views/MainPage.d.ts +0 -79
- package/out/views/MainPage.js +0 -1613
- package/out/views/OAuthPage.d.ts +0 -7
- package/out/views/OAuthPage.js +0 -17
- package/out/views/SubscriptionPage.d.ts +0 -7
- package/out/views/SubscriptionPage.js +0 -26
- package/out/views/index.d.ts +0 -13
- package/out/views/index.js +0 -25
- package/out/views/layout/Head.d.ts +0 -9
- package/out/views/layout/Head.js +0 -54
|
@@ -7,18 +7,16 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a, _b;
|
|
13
11
|
if (!config.organizationMenu) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
17
|
-
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/organization-menu'), (
|
|
18
|
-
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu
|
|
15
|
+
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/organization-menu'), (req, res) => { var _a; return res.sendFile(((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
16
|
+
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
19
17
|
// TEMPORARY CODE: it needs to support old path
|
|
20
|
-
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/resources'), (
|
|
21
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu
|
|
18
|
+
app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/resources'), (req, res) => { var _a; return res.sendFile(((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
19
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
22
20
|
// END TEMPORARY CODE
|
|
23
21
|
}
|
|
24
22
|
exports.register = register;
|
|
@@ -7,18 +7,16 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a, _b;
|
|
13
11
|
if (!config.organizationSettingsMenu) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
17
|
-
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/organization-settings'), (
|
|
18
|
-
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu
|
|
15
|
+
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/organization-settings'), (req, res) => { var _a; return res.sendFile(((_a = config.organizationSettingsMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
16
|
+
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
19
17
|
// TEMPORARY CODE: it needs to support old path
|
|
20
|
-
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/settings'), (
|
|
21
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu
|
|
18
|
+
app.get((0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/settings'), (req, res) => { var _a; return res.sendFile(((_a = config.organizationSettingsMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
19
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
22
20
|
// END TEMPORARY CODE
|
|
23
21
|
}
|
|
24
22
|
exports.register = register;
|
|
@@ -7,18 +7,16 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a, _b;
|
|
13
11
|
if (!config.profileResourcesMenu) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
|
-
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/profile-resources'), (
|
|
14
|
+
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/profile-resources'), (req, res) => { var _a; return res.sendFile(((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
17
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
18
|
-
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu
|
|
16
|
+
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
19
17
|
// TEMPORARY CODE: it needs to support old path
|
|
20
|
-
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'), (
|
|
21
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu
|
|
18
|
+
app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'), (req, res) => { var _a; return res.sendFile(((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
19
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
22
20
|
// END TEMPORARY CODE
|
|
23
21
|
}
|
|
24
22
|
exports.register = register;
|
|
@@ -7,18 +7,16 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a, _b;
|
|
13
11
|
if (!config.profileSettingsMenu) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
|
-
app.get((0, util_1.getLogoUrl)(config.profileSettingsMenu, '/profile-settings'), (
|
|
14
|
+
app.get((0, util_1.getLogoUrl)(config.profileSettingsMenu, '/profile-settings'), (req, res) => { var _a; return res.sendFile(((_a = config.profileSettingsMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
17
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
18
|
-
app.use('/profile-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileSettingsMenu.key }), (0, render_ui_module_1.default)(config.profileSettingsMenu
|
|
16
|
+
app.use('/profile-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileSettingsMenu.key }), (0, render_ui_module_1.default)(config.profileSettingsMenu));
|
|
19
17
|
// TEMPORARY CODE: it needs to support old path
|
|
20
|
-
app.get((0, util_1.getLogoUrl)(config.profileSettingsMenu, '/settings'), (
|
|
21
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileSettingsMenu
|
|
18
|
+
app.get((0, util_1.getLogoUrl)(config.profileSettingsMenu, '/settings'), (req, res) => { var _a; return res.sendFile(((_a = config.profileSettingsMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
19
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileSettingsMenu));
|
|
22
20
|
// END TEMPORARY CODE
|
|
23
21
|
}
|
|
24
22
|
exports.register = register;
|
|
@@ -12,6 +12,6 @@ function register({ config, app }) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.use('/project-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenu.key }), (0, render_ui_module_1.default)(config.projectMenu
|
|
15
|
+
app.use('/project-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenu.key }), (0, render_ui_module_1.default)(config.projectMenu));
|
|
16
16
|
}
|
|
17
17
|
exports.register = register;
|
|
@@ -12,6 +12,6 @@ function register({ config, app }) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.use('/project-menu-crowdsource', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenuCrowdsource.key }), (0, render_ui_module_1.default)(config.projectMenuCrowdsource
|
|
15
|
+
app.use('/project-menu-crowdsource', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenuCrowdsource.key }), (0, render_ui_module_1.default)(config.projectMenuCrowdsource));
|
|
16
16
|
}
|
|
17
17
|
exports.register = register;
|
|
@@ -7,14 +7,12 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a;
|
|
13
11
|
if (!config.projectReports) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
17
|
-
app.get((0, util_1.getLogoUrl)(config.projectReports, '/reports'), (
|
|
18
|
-
app.use('/reports', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectReports.key }), (0, render_ui_module_1.default)(config.projectReports
|
|
15
|
+
app.get((0, util_1.getLogoUrl)(config.projectReports, '/reports'), (req, res) => { var _a; return res.sendFile(((_a = config.projectReports) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
16
|
+
app.use('/reports', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectReports.key }), (0, render_ui_module_1.default)(config.projectReports));
|
|
19
17
|
}
|
|
20
18
|
exports.register = register;
|
|
@@ -7,14 +7,12 @@ exports.register = void 0;
|
|
|
7
7
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const util_1 = require("../../util");
|
|
10
|
-
const static_files_1 = require("../../util/static-files");
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a;
|
|
13
11
|
if (!config.projectTools) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
17
|
-
app.get((0, util_1.getLogoUrl)(config.projectTools, '/tools'), (
|
|
18
|
-
app.use('/tools', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectTools.key }), (0, render_ui_module_1.default)(config.projectTools
|
|
15
|
+
app.get((0, util_1.getLogoUrl)(config.projectTools, '/tools'), (req, res) => { var _a; return res.sendFile(((_a = config.projectTools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
16
|
+
app.use('/tools', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectTools.key }), (0, render_ui_module_1.default)(config.projectTools));
|
|
19
17
|
}
|
|
20
18
|
exports.register = register;
|
package/out/modules/status.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Config, UnauthorizedConfig } from '../types';
|
|
4
|
-
export default function handle(config: Config | UnauthorizedConfig): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
4
|
+
export default function handle(config: Config | UnauthorizedConfig): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
export default function handle(): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
3
|
+
export default function handle(): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Config } from '../types';
|
|
4
|
-
export default function handle(config: Config): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
4
|
+
export default function handle(config: Config): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Config, CrowdinClientRequest } from '../../../types';
|
|
3
3
|
import { Response } from 'express';
|
|
4
4
|
import { Webhook } from '../types';
|
|
5
|
-
export declare function webhookHandler(config: Config, webhooks: Webhook[]): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export declare function webhookHandler(config: Config, webhooks: Webhook[]): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { WorkflowStepTypeModule } from '../types';
|
|
5
|
-
export default function handle(workflowStep: WorkflowStepTypeModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(workflowStep: WorkflowStepTypeModule): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { WorkflowStepTypeModule } from '../types';
|
|
5
|
-
export default function handle(workflowStep: WorkflowStepTypeModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(workflowStep: WorkflowStepTypeModule): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -11,7 +11,6 @@ const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-clie
|
|
|
11
11
|
const step_settings_save_1 = __importDefault(require("./handlers/step-settings-save"));
|
|
12
12
|
const delete_step_1 = __importDefault(require("./handlers/delete-step"));
|
|
13
13
|
const util_2 = require("../../util");
|
|
14
|
-
const static_files_1 = require("../../util/static-files");
|
|
15
14
|
function register({ config, app }) {
|
|
16
15
|
if (!config.workflowStepType) {
|
|
17
16
|
return;
|
|
@@ -43,10 +42,10 @@ function register({ config, app }) {
|
|
|
43
42
|
}), (0, delete_step_1.default)(workflowStep));
|
|
44
43
|
// END TEMPORARY CODE
|
|
45
44
|
if (workflowStep.imagePath) {
|
|
46
|
-
app.get((0, util_2.getLogoUrl)(workflowStep, `-${workflowStep.key}`), (
|
|
45
|
+
app.get((0, util_2.getLogoUrl)(workflowStep, `-${workflowStep.key}`), (req, res) => res.sendFile(workflowStep.imagePath || config.imagePath));
|
|
47
46
|
}
|
|
48
47
|
if (workflowStep.settingsUiModule) {
|
|
49
|
-
app.use((0, util_1.getWorkflowStepUrl)('/workflow-step', workflowStep), (0, ui_module_1.default)({ config, moduleType: workflowStep.key }), (0, render_ui_module_1.default)(workflowStep.settingsUiModule
|
|
48
|
+
app.use((0, util_1.getWorkflowStepUrl)('/workflow-step', workflowStep), (0, ui_module_1.default)({ config, moduleType: workflowStep.key }), (0, render_ui_module_1.default)(workflowStep.settingsUiModule));
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
}
|
package/out/storage/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks, Provider } from '../modules/integration/types';
|
|
2
2
|
import { Config, CrowdinCredentials, UnauthorizedConfig } from '../types';
|
|
3
|
-
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData } from '../modules/integration/util/types';
|
|
3
|
+
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData, GetAllJobsParams } from '../modules/integration/util/types';
|
|
4
4
|
import { UserErrors } from './types';
|
|
5
5
|
export declare const TABLES: {
|
|
6
6
|
crowdin_credentials: string;
|
|
@@ -62,6 +62,7 @@ export interface Storage {
|
|
|
62
62
|
getActiveJobs(params: GetActiveJobsParams): Promise<Job[] | undefined>;
|
|
63
63
|
deleteFinishedJobs(): Promise<void>;
|
|
64
64
|
getAllInProgressJobs(): Promise<Job[] | undefined>;
|
|
65
|
+
getAllJobs(params: GetAllJobsParams): Promise<Job[] | undefined>;
|
|
65
66
|
saveTranslationCache(params: TranslationCache): Promise<void>;
|
|
66
67
|
getFileTranslationCache(params: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
|
|
67
68
|
getFileTranslationCacheByLanguage(params: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
|
package/out/storage/index.js
CHANGED
|
@@ -42,7 +42,6 @@ const logger_1 = require("../util/logger");
|
|
|
42
42
|
const mysql_1 = require("./mysql");
|
|
43
43
|
const postgre_1 = require("./postgre");
|
|
44
44
|
const sqlite_1 = require("./sqlite");
|
|
45
|
-
const d1_1 = require("./d1");
|
|
46
45
|
const path_1 = __importStar(require("path"));
|
|
47
46
|
const fs_1 = __importDefault(require("fs"));
|
|
48
47
|
const child_process_1 = require("child_process");
|
|
@@ -64,13 +63,7 @@ exports.TABLES = {
|
|
|
64
63
|
let storage;
|
|
65
64
|
function initialize(config) {
|
|
66
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
if (config.
|
|
68
|
-
(0, logger_1.log)('Using Cloudflare D1 database');
|
|
69
|
-
storage = new d1_1.D1Storage(config.d1Config);
|
|
70
|
-
// Skip migration for D1 - it will be done lazily on first request
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
else if (config.postgreConfig) {
|
|
66
|
+
if (config.postgreConfig) {
|
|
74
67
|
(0, logger_1.log)('Using PostgreSQL database');
|
|
75
68
|
let dumpDirectory = null;
|
|
76
69
|
if (config.migrateToPostgreFromSQLite) {
|
package/out/storage/mysql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Storage } from '.';
|
|
2
2
|
import { CrowdinCredentials } from '../types';
|
|
3
|
-
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData } from '../modules/integration/util/types';
|
|
3
|
+
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData, GetAllJobsParams } from '../modules/integration/util/types';
|
|
4
4
|
import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
|
|
5
5
|
import { UserErrors } from './types';
|
|
6
6
|
export interface MySQLStorageConfig {
|
|
@@ -78,11 +78,12 @@ export declare class MySQLStorage implements Storage {
|
|
|
78
78
|
getIntegrationConfig(integrationId: string): Promise<IntegrationConfig | undefined>;
|
|
79
79
|
updateIntegrationConfig(integrationId: string, config: any): Promise<void>;
|
|
80
80
|
createJob({ integrationId, crowdinId, type, title, payload }: CreateJobParams): Promise<string>;
|
|
81
|
-
updateJob({ id, progress, status, info, data, attempt, errors }: UpdateJobParams): Promise<void>;
|
|
81
|
+
updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }: UpdateJobParams): Promise<void>;
|
|
82
82
|
getJob({ id }: GetJobParams): Promise<Job | undefined>;
|
|
83
83
|
getActiveJobs({ integrationId, crowdinId }: GetActiveJobsParams): Promise<Job[] | undefined>;
|
|
84
84
|
deleteFinishedJobs(): Promise<void>;
|
|
85
85
|
getAllInProgressJobs(): Promise<Job[] | undefined>;
|
|
86
|
+
getAllJobs({ integrationId, crowdinId, limit, offset }: GetAllJobsParams): Promise<Job[] | undefined>;
|
|
86
87
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }: TranslationCache): Promise<void>;
|
|
87
88
|
getFileTranslationCache({ integrationId, crowdinId, fileId, }: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
|
|
88
89
|
getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
|
package/out/storage/mysql.js
CHANGED
|
@@ -140,6 +140,7 @@ class MySQLStorage {
|
|
|
140
140
|
data text,
|
|
141
141
|
attempt int 0,
|
|
142
142
|
errors text,
|
|
143
|
+
processed_entities text,
|
|
143
144
|
created_at varchar(255) not null,
|
|
144
145
|
updated_at varchar(255),
|
|
145
146
|
finished_at varchar(255)
|
|
@@ -288,6 +289,7 @@ class MySQLStorage {
|
|
|
288
289
|
yield connection.execute('DELETE FROM job WHERE crowdin_id = ?', [id]);
|
|
289
290
|
yield connection.execute('DELETE FROM translation_file_cache WHERE crowdin_id = ?', [id]);
|
|
290
291
|
yield connection.execute('DELETE FROM unsynced_files WHERE crowdin_id = ?', [id]);
|
|
292
|
+
yield connection.execute('DELETE FROM synced_data WHERE crowdin_id = ?', [id]);
|
|
291
293
|
}));
|
|
292
294
|
});
|
|
293
295
|
}
|
|
@@ -341,6 +343,7 @@ class MySQLStorage {
|
|
|
341
343
|
yield connection.execute('DELETE FROM webhooks where integration_id = ?', [id]);
|
|
342
344
|
yield connection.execute('DELETE FROM job where integration_id = ?', [id]);
|
|
343
345
|
yield connection.execute('DELETE FROM unsynced_files where integration_id = ?', [id]);
|
|
346
|
+
yield connection.execute('DELETE FROM synced_data where integration_id = ?', [id]);
|
|
344
347
|
}));
|
|
345
348
|
});
|
|
346
349
|
}
|
|
@@ -355,6 +358,7 @@ class MySQLStorage {
|
|
|
355
358
|
yield connection.execute('DELETE FROM user_errors where crowdin_id = ?', [crowdinId]);
|
|
356
359
|
yield connection.execute('DELETE FROM job where crowdin_id = ?', [crowdinId]);
|
|
357
360
|
yield connection.execute('DELETE FROM unsynced_files where crowdin_id = ?', [crowdinId]);
|
|
361
|
+
yield connection.execute('DELETE FROM synced_data where crowdin_id = ?', [crowdinId]);
|
|
358
362
|
}));
|
|
359
363
|
});
|
|
360
364
|
}
|
|
@@ -606,7 +610,7 @@ class MySQLStorage {
|
|
|
606
610
|
return id;
|
|
607
611
|
});
|
|
608
612
|
}
|
|
609
|
-
updateJob({ id, progress, status, info, data, attempt, errors }) {
|
|
613
|
+
updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
|
|
610
614
|
return __awaiter(this, void 0, void 0, function* () {
|
|
611
615
|
const updateFields = ['updated_at'];
|
|
612
616
|
const updateParams = [Date.now().toString()];
|
|
@@ -642,6 +646,10 @@ class MySQLStorage {
|
|
|
642
646
|
updateFields.push('errors = ?');
|
|
643
647
|
updateParams.push(JSON.stringify(errors));
|
|
644
648
|
}
|
|
649
|
+
if (processedEntities) {
|
|
650
|
+
updateFields.push('processed_entities = ?');
|
|
651
|
+
updateParams.push(processedEntities);
|
|
652
|
+
}
|
|
645
653
|
updateParams.push(id);
|
|
646
654
|
yield this.dbPromise;
|
|
647
655
|
yield this.executeQuery((connection) => connection.execute(`
|
|
@@ -668,6 +676,7 @@ class MySQLStorage {
|
|
|
668
676
|
data,
|
|
669
677
|
attempt,
|
|
670
678
|
errors,
|
|
679
|
+
processed_entities as "processedEntities",
|
|
671
680
|
created_at as "createdAt",
|
|
672
681
|
updated_at as "updatedAt",
|
|
673
682
|
finished_at as "finishedAt"
|
|
@@ -695,6 +704,7 @@ class MySQLStorage {
|
|
|
695
704
|
data,
|
|
696
705
|
attempt,
|
|
697
706
|
errors,
|
|
707
|
+
processed_entities as "processedEntities",
|
|
698
708
|
created_at as "createdAt",
|
|
699
709
|
updated_at as "updatedAt",
|
|
700
710
|
finished_at as "finishedAt"
|
|
@@ -730,6 +740,7 @@ class MySQLStorage {
|
|
|
730
740
|
data,
|
|
731
741
|
attempt,
|
|
732
742
|
errors,
|
|
743
|
+
processed_entities as "processedEntities",
|
|
733
744
|
created_at as "createdAt",
|
|
734
745
|
updated_at as "updatedAt",
|
|
735
746
|
finished_at as "finishedAt"
|
|
@@ -741,6 +752,36 @@ class MySQLStorage {
|
|
|
741
752
|
}));
|
|
742
753
|
});
|
|
743
754
|
}
|
|
755
|
+
getAllJobs({ integrationId, crowdinId, limit, offset }) {
|
|
756
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
757
|
+
yield this.dbPromise;
|
|
758
|
+
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
759
|
+
const [rows] = yield connection.execute(`
|
|
760
|
+
SELECT
|
|
761
|
+
id,
|
|
762
|
+
integration_id as "integrationId",
|
|
763
|
+
crowdin_id as "crowdinId",
|
|
764
|
+
type,
|
|
765
|
+
payload,
|
|
766
|
+
progress,
|
|
767
|
+
status,
|
|
768
|
+
title,
|
|
769
|
+
info,
|
|
770
|
+
data,
|
|
771
|
+
attempt,
|
|
772
|
+
created_at as "createdAt",
|
|
773
|
+
updated_at as "updatedAt",
|
|
774
|
+
finished_at as "finishedAt"
|
|
775
|
+
FROM job
|
|
776
|
+
WHERE integration_id = ?
|
|
777
|
+
AND crowdin_id = ?
|
|
778
|
+
ORDER BY created_at DESC
|
|
779
|
+
LIMIT ? OFFSET ?
|
|
780
|
+
`, [integrationId, crowdinId, limit, offset]);
|
|
781
|
+
return rows || [];
|
|
782
|
+
}));
|
|
783
|
+
});
|
|
784
|
+
}
|
|
744
785
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
|
|
745
786
|
return __awaiter(this, void 0, void 0, function* () {
|
|
746
787
|
yield this.dbPromise;
|
package/out/storage/postgre.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Client } from 'pg';
|
|
|
2
2
|
import { Storage } from '.';
|
|
3
3
|
import { CrowdinCredentials } from '../types';
|
|
4
4
|
import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
|
|
5
|
-
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData } from '../modules/integration/util/types';
|
|
5
|
+
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData, GetAllJobsParams } from '../modules/integration/util/types';
|
|
6
6
|
import { UserErrors } from './types';
|
|
7
7
|
export interface PostgreStorageConfig {
|
|
8
8
|
host?: string;
|
|
@@ -88,11 +88,12 @@ export declare class PostgreStorage implements Storage {
|
|
|
88
88
|
getIntegrationConfig(integrationId: string): Promise<IntegrationConfig | undefined>;
|
|
89
89
|
updateIntegrationConfig(integrationId: string, config: any): Promise<void>;
|
|
90
90
|
createJob({ integrationId, crowdinId, type, payload, title }: CreateJobParams): Promise<string>;
|
|
91
|
-
updateJob({ id, progress, status, info, data, attempt, errors }: UpdateJobParams): Promise<void>;
|
|
91
|
+
updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }: UpdateJobParams): Promise<void>;
|
|
92
92
|
getJob({ id }: GetJobParams): Promise<Job | undefined>;
|
|
93
93
|
getActiveJobs({ integrationId, crowdinId }: GetActiveJobsParams): Promise<Job[] | undefined>;
|
|
94
94
|
deleteFinishedJobs(): Promise<void>;
|
|
95
95
|
getAllInProgressJobs(): Promise<Job[] | undefined>;
|
|
96
|
+
getAllJobs({ integrationId, crowdinId, limit, offset }: GetAllJobsParams): Promise<Job[] | undefined>;
|
|
96
97
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }: TranslationCache): Promise<void>;
|
|
97
98
|
getFileTranslationCache({ integrationId, crowdinId, fileId, }: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
|
|
98
99
|
getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
|
package/out/storage/postgre.js
CHANGED
|
@@ -103,6 +103,7 @@ class PostgreStorage {
|
|
|
103
103
|
data varchar null,
|
|
104
104
|
attempt int default 0,
|
|
105
105
|
errors varchar null,
|
|
106
|
+
processed_entities varchar null,
|
|
106
107
|
created_at varchar not null,
|
|
107
108
|
updated_at varchar null,
|
|
108
109
|
finished_at varchar null
|
|
@@ -226,6 +227,7 @@ class PostgreStorage {
|
|
|
226
227
|
yield this.addColumns(client, ['agent_id'], 'crowdin_credentials');
|
|
227
228
|
yield this.addColumn(client, 'attempt', 'job', 'int default 0');
|
|
228
229
|
yield this.addColumn(client, 'errors', 'job', 'varchar NULL');
|
|
230
|
+
yield this.addColumn(client, 'processed_entities', 'job', 'varchar NULL');
|
|
229
231
|
yield this.addColumn(client, 'managers', 'integration_credentials', 'varchar NULL');
|
|
230
232
|
});
|
|
231
233
|
}
|
|
@@ -332,6 +334,7 @@ class PostgreStorage {
|
|
|
332
334
|
yield client.query('DELETE FROM job WHERE crowdin_id = $1', [id]);
|
|
333
335
|
yield client.query('DELETE FROM translation_file_cache WHERE crowdin_id = $1', [id]);
|
|
334
336
|
yield client.query('DELETE FROM unsynced_files WHERE crowdin_id = $1', [id]);
|
|
337
|
+
yield client.query('DELETE FROM synced_data WHERE crowdin_id = $1', [id]);
|
|
335
338
|
}));
|
|
336
339
|
});
|
|
337
340
|
}
|
|
@@ -385,6 +388,7 @@ class PostgreStorage {
|
|
|
385
388
|
yield client.query('DELETE FROM webhooks where integration_id = $1', [id]);
|
|
386
389
|
yield client.query('DELETE FROM job where integration_id = $1', [id]);
|
|
387
390
|
yield client.query('DELETE FROM unsynced_files where integration_id = $1', [id]);
|
|
391
|
+
yield client.query('DELETE FROM synced_data where integration_id = $1', [id]);
|
|
388
392
|
}));
|
|
389
393
|
});
|
|
390
394
|
}
|
|
@@ -399,6 +403,7 @@ class PostgreStorage {
|
|
|
399
403
|
yield client.query('DELETE FROM user_errors where crowdin_id = $1', [crowdinId]);
|
|
400
404
|
yield client.query('DELETE FROM job where crowdin_id = $1', [crowdinId]);
|
|
401
405
|
yield client.query('DELETE FROM unsynced_files where crowdin_id = $1', [crowdinId]);
|
|
406
|
+
yield client.query('DELETE FROM synced_data where crowdin_id = $1', [crowdinId]);
|
|
402
407
|
}));
|
|
403
408
|
});
|
|
404
409
|
}
|
|
@@ -644,7 +649,7 @@ class PostgreStorage {
|
|
|
644
649
|
return id;
|
|
645
650
|
});
|
|
646
651
|
}
|
|
647
|
-
updateJob({ id, progress, status, info, data, attempt, errors }) {
|
|
652
|
+
updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
|
|
648
653
|
return __awaiter(this, void 0, void 0, function* () {
|
|
649
654
|
let parametersPointer = 1;
|
|
650
655
|
const updateFields = [`updated_at = $${parametersPointer}`];
|
|
@@ -689,6 +694,11 @@ class PostgreStorage {
|
|
|
689
694
|
updateFields.push('errors = $' + parametersPointer);
|
|
690
695
|
updateParams.push(JSON.stringify(errors));
|
|
691
696
|
}
|
|
697
|
+
if (processedEntities) {
|
|
698
|
+
parametersPointer++;
|
|
699
|
+
updateFields.push('processed_entities = $' + parametersPointer);
|
|
700
|
+
updateParams.push(processedEntities);
|
|
701
|
+
}
|
|
692
702
|
parametersPointer++;
|
|
693
703
|
updateParams.push(id);
|
|
694
704
|
yield this.dbPromise;
|
|
@@ -705,7 +715,7 @@ class PostgreStorage {
|
|
|
705
715
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
706
716
|
const res = yield client.query(`
|
|
707
717
|
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
708
|
-
title, info, data, attempt, errors, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
718
|
+
title, info, data, attempt, errors, processed_entities as "processedEntities", created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
709
719
|
FROM job
|
|
710
720
|
WHERE id = $1
|
|
711
721
|
`, [id]);
|
|
@@ -719,7 +729,7 @@ class PostgreStorage {
|
|
|
719
729
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
720
730
|
const res = yield client.query(`
|
|
721
731
|
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
722
|
-
title, info, data, attempt, errors, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
732
|
+
title, info, data, attempt, errors, processed_entities as "processedEntities", created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
723
733
|
FROM job
|
|
724
734
|
WHERE integration_id = $1 AND crowdin_id = $2 AND finished_at is NULL
|
|
725
735
|
`, [integrationId, crowdinId]);
|
|
@@ -739,7 +749,7 @@ class PostgreStorage {
|
|
|
739
749
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
740
750
|
const res = yield client.query(`
|
|
741
751
|
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
742
|
-
title, info, data, attempt, errors, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
752
|
+
title, info, data, attempt, errors, processed_entities as "processedEntities", created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
743
753
|
FROM job
|
|
744
754
|
WHERE status IN ($1, $2) AND finished_at is NULL
|
|
745
755
|
`, [types_2.JobStatus.IN_PROGRESS, types_2.JobStatus.CREATED]);
|
|
@@ -747,6 +757,35 @@ class PostgreStorage {
|
|
|
747
757
|
}));
|
|
748
758
|
});
|
|
749
759
|
}
|
|
760
|
+
getAllJobs({ integrationId, crowdinId, limit, offset }) {
|
|
761
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
762
|
+
yield this.dbPromise;
|
|
763
|
+
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
764
|
+
const res = yield client.query(`
|
|
765
|
+
SELECT
|
|
766
|
+
id,
|
|
767
|
+
integration_id as "integrationId",
|
|
768
|
+
crowdin_id as "crowdinId",
|
|
769
|
+
type,
|
|
770
|
+
payload,
|
|
771
|
+
progress,
|
|
772
|
+
status,
|
|
773
|
+
title,
|
|
774
|
+
info,
|
|
775
|
+
data,
|
|
776
|
+
attempt,
|
|
777
|
+
created_at as "createdAt",
|
|
778
|
+
updated_at as "updatedAt",
|
|
779
|
+
finished_at as "finishedAt"
|
|
780
|
+
FROM job
|
|
781
|
+
WHERE integration_id = $1 AND crowdin_id = $2
|
|
782
|
+
ORDER BY created_at DESC
|
|
783
|
+
LIMIT $3 OFFSET $4
|
|
784
|
+
`, [integrationId, crowdinId, limit, offset]);
|
|
785
|
+
return (res === null || res === void 0 ? void 0 : res.rows) || [];
|
|
786
|
+
}));
|
|
787
|
+
});
|
|
788
|
+
}
|
|
750
789
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag, }) {
|
|
751
790
|
return __awaiter(this, void 0, void 0, function* () {
|
|
752
791
|
yield this.dbPromise;
|
package/out/storage/sqlite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Storage } from '.';
|
|
2
2
|
import { CrowdinCredentials } from '../types';
|
|
3
3
|
import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
|
|
4
|
-
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData } from '../modules/integration/util/types';
|
|
4
|
+
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData, GetAllJobsParams } from '../modules/integration/util/types';
|
|
5
5
|
import { UserErrors } from './types';
|
|
6
6
|
export interface SQLiteStorageConfig {
|
|
7
7
|
dbFolder: string;
|
|
@@ -76,11 +76,12 @@ export declare class SQLiteStorage implements Storage {
|
|
|
76
76
|
getIntegrationConfig(integrationId: string): Promise<IntegrationConfig | undefined>;
|
|
77
77
|
updateIntegrationConfig(integrationId: string, config: any): Promise<void>;
|
|
78
78
|
createJob({ integrationId, crowdinId, type, title, payload }: CreateJobParams): Promise<string>;
|
|
79
|
-
updateJob({ id, progress, status, info, data, attempt, errors }: UpdateJobParams): Promise<void>;
|
|
79
|
+
updateJob({ id, progress, status, info, data, attempt, errors, processedEntities, }: UpdateJobParams): Promise<void>;
|
|
80
80
|
getJob({ id }: GetJobParams): Promise<Job | undefined>;
|
|
81
81
|
getActiveJobs({ integrationId, crowdinId }: GetActiveJobsParams): Promise<Job[] | undefined>;
|
|
82
82
|
deleteFinishedJobs(): Promise<void>;
|
|
83
83
|
getAllInProgressJobs(): Promise<Job[] | undefined>;
|
|
84
|
+
getAllJobs({ integrationId, crowdinId, limit, offset }: GetAllJobsParams): Promise<Job[] | undefined>;
|
|
84
85
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag }: TranslationCache): Promise<void>;
|
|
85
86
|
getFileTranslationCache({ integrationId, crowdinId, fileId, }: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
|
|
86
87
|
getFileTranslationCacheByLanguage({ integrationId, crowdinId, fileId, languageId, }: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
|