@crowdin/app-project-module 0.106.0 → 0.107.0-cf-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 +0 -1
- package/out/app-test/integration/mocks/mock-axios.js +0 -1
- package/out/app-test/integration/update-crowdin.js +0 -1
- package/out/app-test/integration/update-integration.js +0 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +30 -12
- package/out/middlewares/crowdin-client.d.ts +1 -1
- package/out/middlewares/integration-credentials.d.ts +1 -1
- package/out/middlewares/integration-credentials.js +4 -1
- package/out/middlewares/render-ui-module.d.ts +3 -3
- package/out/middlewares/render-ui-module.js +9 -13
- package/out/middlewares/ui-module.d.ts +1 -1
- package/out/middlewares/ui-module.js +10 -1
- package/out/modules/about.d.ts +2 -1
- package/out/modules/about.js +10 -3
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
- package/out/modules/ai-prompt-provider/index.js +2 -2
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
- package/out/modules/ai-provider/handlers/chat-completions.js +0 -1
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
- package/out/modules/ai-provider/index.js +2 -2
- package/out/modules/ai-provider/types.d.ts +2 -2
- package/out/modules/ai-provider/util/index.js +0 -2
- 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 +0 -1
- package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
- package/out/modules/auth-guard/index.js +1 -1
- package/out/modules/automation-action/handlers/execute.d.ts +1 -1
- package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
- package/out/modules/automation-action/index.js +1 -1
- package/out/modules/context-menu/index.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +2 -2
- package/out/modules/custom-mt/handlers/translate.js +53 -4
- package/out/modules/custom-mt/index.js +6 -3
- package/out/modules/custom-mt/types.d.ts +14 -2
- 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 +7 -2
- package/out/modules/file-processing/handlers/custom-file-format.js +59 -19
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
- package/out/modules/file-processing/handlers/file-download.js +5 -0
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.js +34 -14
- package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
- package/out/modules/file-processing/index.js +12 -2
- package/out/modules/file-processing/util/defaults.js +50 -6
- package/out/modules/file-processing/util/files.js +2 -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-project.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
- 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-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 +1 -1
- package/out/modules/integration/handlers/job-info.d.ts +1 -1
- package/out/modules/integration/handlers/job-list.d.ts +1 -1
- package/out/modules/integration/handlers/main.d.ts +1 -1
- package/out/modules/integration/handlers/main.js +13 -1
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-login.js +10 -2
- 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-save.js +0 -2
- 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.js +12 -33
- package/out/modules/integration/util/cron.js +1 -10
- package/out/modules/integration/util/job.js +0 -4
- package/out/modules/integration/util/snapshot.js +1 -5
- package/out/modules/integration/util/webhooks.js +1 -8
- package/out/modules/manifest.js +15 -13
- package/out/modules/modal/index.js +2 -2
- package/out/modules/organization-menu/index.js +5 -4
- package/out/modules/organization-settings-menu/index.js +5 -4
- package/out/modules/profile-resources-menu/index.js +5 -4
- package/out/modules/profile-settings-menu/index.js +5 -4
- 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 +3 -2
- package/out/modules/project-tools/index.js +3 -2
- package/out/modules/status.d.ts +1 -1
- package/out/modules/status.js +12 -3
- 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/webhooks/handlers/webhook-handler.js +30 -15
- package/out/modules/webhooks/types.d.ts +7 -0
- 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 -2
- package/out/storage/d1.d.ts +107 -0
- package/out/storage/d1.js +829 -0
- package/out/storage/index.js +8 -2
- package/out/storage/mysql.js +0 -3
- package/out/storage/postgre.js +0 -1
- package/out/storage/sqlite.js +0 -3
- package/out/types.d.ts +41 -2
- package/out/util/axios.js +0 -1
- package/out/util/credentials-masker.d.ts +1 -1
- package/out/util/cron.d.ts +29 -0
- package/out/util/cron.js +87 -0
- package/out/util/index.d.ts +12 -1
- package/out/util/index.js +54 -6
- package/out/util/jsx-renderer.d.ts +6 -0
- package/out/util/jsx-renderer.js +13 -0
- package/out/util/logger.js +0 -4
- package/out/util/static-files.d.ts +19 -0
- package/out/util/static-files.js +87 -0
- package/out/views/AboutPage.d.ts +10 -0
- package/out/views/AboutPage.js +76 -0
- package/out/views/ErrorPage.d.ts +18 -0
- package/out/views/ErrorPage.js +56 -0
- package/out/views/FormPage.d.ts +14 -0
- package/out/views/FormPage.js +28 -0
- package/out/views/InstallPage.d.ts +10 -0
- package/out/views/InstallPage.js +22 -0
- package/out/views/LoginPage.d.ts +33 -0
- package/out/views/LoginPage.js +200 -0
- package/out/views/MainPage.d.ts +81 -0
- package/out/views/MainPage.js +1784 -0
- package/out/views/OAuthPage.d.ts +7 -0
- package/out/views/OAuthPage.js +17 -0
- package/out/views/SubscriptionPage.d.ts +7 -0
- package/out/views/SubscriptionPage.js +26 -0
- package/out/views/index.d.ts +13 -0
- package/out/views/index.js +25 -0
- package/out/views/layout/Head.d.ts +9 -0
- package/out/views/layout/Head.js +54 -0
- package/package.json +33 -18
- package/out/util/handlebars.d.ts +0 -1
- package/out/util/handlebars.js +0 -46
- package/out/views/about.handlebars +0 -102
- package/out/views/error.handlebars +0 -54
- package/out/views/form.handlebars +0 -31
- package/out/views/install.handlebars +0 -16
- package/out/views/login.handlebars +0 -332
- package/out/views/main.handlebars +0 -2042
- package/out/views/oauth.handlebars +0 -11
- package/out/views/partials/head.handlebars +0 -53
- package/out/views/subscription.handlebars +0 -26
|
@@ -7,16 +7,17 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.organizationMenu) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.
|
|
16
|
-
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
16
|
+
app.use('/logo/organization-menu', (0, util_2.serveLogo)(config, config.organizationMenu));
|
|
17
|
+
app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu, config));
|
|
17
18
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.
|
|
19
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu));
|
|
19
|
+
app.use('/logo/resources', (0, util_2.serveLogo)(config, config.organizationMenu));
|
|
20
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu, config));
|
|
20
21
|
// END TEMPORARY CODE
|
|
21
22
|
}
|
|
22
23
|
exports.register = register;
|
|
@@ -7,16 +7,17 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.organizationSettingsMenu) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.
|
|
16
|
-
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
16
|
+
app.use('/logo/organization-settings', (0, util_2.serveLogo)(config, config.organizationSettingsMenu));
|
|
17
|
+
app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
|
|
17
18
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.
|
|
19
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu));
|
|
19
|
+
app.use('/logo/settings', (0, util_2.serveLogo)(config, config.organizationSettingsMenu));
|
|
20
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
|
|
20
21
|
// END TEMPORARY CODE
|
|
21
22
|
}
|
|
22
23
|
exports.register = register;
|
|
@@ -7,16 +7,17 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.profileResourcesMenu) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
app.
|
|
15
|
+
app.use('/logo/profile-resources', (0, util_2.serveLogo)(config, config.profileResourcesMenu));
|
|
15
16
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
16
|
-
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
17
|
+
app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
|
|
17
18
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.
|
|
19
|
-
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu));
|
|
19
|
+
app.use('/logo/resources', (0, util_2.serveLogo)(config, config.profileResourcesMenu));
|
|
20
|
+
app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
|
|
20
21
|
// END TEMPORARY CODE
|
|
21
22
|
}
|
|
22
23
|
exports.register = register;
|
|
@@ -7,16 +7,17 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.profileSettingsMenu) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
app.
|
|
15
|
+
app.use('/logo/profile-settings', (0, util_2.serveLogo)(config, config.profileSettingsMenu));
|
|
15
16
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
16
|
-
app.use('/profile-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileSettingsMenu.key }), (0, render_ui_module_1.default)(config.profileSettingsMenu));
|
|
17
|
+
app.use('/profile-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileSettingsMenu.key }), (0, render_ui_module_1.default)(config.profileSettingsMenu, config));
|
|
17
18
|
// TEMPORARY CODE: it needs to support old path
|
|
18
|
-
app.
|
|
19
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileSettingsMenu));
|
|
19
|
+
app.use('/logo/settings', (0, util_2.serveLogo)(config, config.profileSettingsMenu));
|
|
20
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileSettingsMenu, config));
|
|
20
21
|
// END TEMPORARY CODE
|
|
21
22
|
}
|
|
22
23
|
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, config));
|
|
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, config));
|
|
16
16
|
}
|
|
17
17
|
exports.register = register;
|
|
@@ -7,12 +7,13 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.projectReports) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.
|
|
16
|
-
app.use('/reports', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectReports.key }), (0, render_ui_module_1.default)(config.projectReports));
|
|
16
|
+
app.use('/logo/reports', (0, util_2.serveLogo)(config, config.projectReports));
|
|
17
|
+
app.use('/reports', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectReports.key }), (0, render_ui_module_1.default)(config.projectReports, config));
|
|
17
18
|
}
|
|
18
19
|
exports.register = register;
|
|
@@ -7,12 +7,13 @@ 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 util_2 = require("../../util");
|
|
10
11
|
function register({ config, app }) {
|
|
11
12
|
if (!config.projectTools) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
|
|
15
|
-
app.
|
|
16
|
-
app.use('/tools', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectTools.key }), (0, render_ui_module_1.default)(config.projectTools));
|
|
16
|
+
app.use('/logo/tools', (0, util_2.serveLogo)(config, config.projectTools));
|
|
17
|
+
app.use('/tools', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectTools.key }), (0, render_ui_module_1.default)(config.projectTools, config));
|
|
17
18
|
}
|
|
18
19
|
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:
|
|
4
|
+
export default function handle(config: Config | UnauthorizedConfig): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
package/out/modules/status.js
CHANGED
|
@@ -47,9 +47,18 @@ function handle(config) {
|
|
|
47
47
|
let status = 'ok';
|
|
48
48
|
let message = 'Filesystem access successful';
|
|
49
49
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (config.fileStore) {
|
|
51
|
+
// Use custom fileStore if provided
|
|
52
|
+
const testContent = Buffer.from('test');
|
|
53
|
+
const fileRef = yield config.fileStore.storeFile(testContent);
|
|
54
|
+
yield config.fileStore.deleteFile(fileRef);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Fallback to default filesystem operations
|
|
58
|
+
const testFile = path_1.default.join(os_1.default.tmpdir(), `status-check-${Date.now()}.txt`);
|
|
59
|
+
yield promises_1.default.writeFile(testFile, 'test');
|
|
60
|
+
yield promises_1.default.unlink(testFile);
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
catch (e) {
|
|
55
64
|
status = 'error';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
|
-
export default function handle(): (req:
|
|
3
|
+
export default function handle(): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../types").CrowdinClientRequest, 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:
|
|
4
|
+
export default function handle(config: Config): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../types").CrowdinClientRequest, 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:
|
|
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>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -64,22 +64,37 @@ function webhookHandler(config, webhooks) {
|
|
|
64
64
|
res.status(403).send({ error: 'Invalid signature' });
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
const shouldDeferResponse = webhooks.some((webhook) => webhook.key === moduleKey && webhook.deferResponse);
|
|
68
|
+
if (!shouldDeferResponse) {
|
|
69
|
+
res.status(200).send();
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
const { client } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials, autoRenew: true });
|
|
73
|
+
const json = JSON.parse(req.body.toString());
|
|
74
|
+
for (const webhook of webhooks) {
|
|
75
|
+
if (webhook.key === moduleKey) {
|
|
76
|
+
yield webhook.callback({
|
|
77
|
+
events: json.events,
|
|
78
|
+
client,
|
|
79
|
+
webhookContext: {
|
|
80
|
+
domain: credentials.domain,
|
|
81
|
+
organizationId: credentials.organizationId,
|
|
82
|
+
userId: credentials.userId,
|
|
83
|
+
agentId: credentials.agentId,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!shouldDeferResponse) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
res.status(200).send();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (!shouldDeferResponse) {
|
|
95
|
+
throw error;
|
|
82
96
|
}
|
|
97
|
+
res.status(500).send({ error: 'Webhook processing failed' });
|
|
83
98
|
}
|
|
84
99
|
}));
|
|
85
100
|
}
|
|
@@ -13,6 +13,13 @@ export interface Webhook extends ModuleKey {
|
|
|
13
13
|
events: Event[];
|
|
14
14
|
client: Crowdin;
|
|
15
15
|
}) => Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* If true, response will be sent after webhook processing is complete.
|
|
18
|
+
* This is required for Cloudflare Workers where the execution context
|
|
19
|
+
* terminates after the response is sent.
|
|
20
|
+
* Default: false (response is sent immediately after signature verification)
|
|
21
|
+
*/
|
|
22
|
+
deferResponse?: boolean;
|
|
16
23
|
}
|
|
17
24
|
interface WebhookContext {
|
|
18
25
|
domain?: string;
|
|
@@ -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:
|
|
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>> | CrowdinClientRequest, 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:
|
|
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>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -42,10 +42,10 @@ function register({ config, app }) {
|
|
|
42
42
|
}), (0, delete_step_1.default)(workflowStep));
|
|
43
43
|
// END TEMPORARY CODE
|
|
44
44
|
if (workflowStep.imagePath) {
|
|
45
|
-
app.
|
|
45
|
+
app.use(`/logo-${workflowStep.key}`, (0, util_2.serveLogo)(config, workflowStep));
|
|
46
46
|
}
|
|
47
47
|
if (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));
|
|
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, config));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { D1Database } from '@cloudflare/workers-types';
|
|
2
|
+
import { Storage } from '.';
|
|
3
|
+
import { CrowdinCredentials } from '../types';
|
|
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, GetAllJobsParams } from '../modules/integration/util/types';
|
|
6
|
+
import { UserErrors } from './types';
|
|
7
|
+
export interface D1StorageConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Cloudflare D1 database binding
|
|
10
|
+
* This should be passed from env.DB in Workers/Pages Functions
|
|
11
|
+
*/
|
|
12
|
+
database: D1Database;
|
|
13
|
+
}
|
|
14
|
+
export declare class D1Storage implements Storage {
|
|
15
|
+
private db;
|
|
16
|
+
private migrated;
|
|
17
|
+
tables: {
|
|
18
|
+
crowdin_credentials: string;
|
|
19
|
+
integration_credentials: string;
|
|
20
|
+
sync_settings: string;
|
|
21
|
+
app_metadata: string;
|
|
22
|
+
files_snapshot: string;
|
|
23
|
+
webhooks: string;
|
|
24
|
+
user_errors: string;
|
|
25
|
+
integration_settings: string;
|
|
26
|
+
job: string;
|
|
27
|
+
translation_file_cache: string;
|
|
28
|
+
unsynced_files: string;
|
|
29
|
+
synced_data: string;
|
|
30
|
+
};
|
|
31
|
+
constructor(config: D1StorageConfig);
|
|
32
|
+
ensureMigrated(): Promise<void>;
|
|
33
|
+
private addColumn;
|
|
34
|
+
private updateTables;
|
|
35
|
+
migrate(): Promise<void>;
|
|
36
|
+
saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
|
|
37
|
+
updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
|
|
38
|
+
getCrowdinCredentials(id: string): Promise<CrowdinCredentials | undefined>;
|
|
39
|
+
getAllCrowdinCredentials(): Promise<CrowdinCredentials[]>;
|
|
40
|
+
deleteCrowdinCredentials(id: string): Promise<void>;
|
|
41
|
+
saveIntegrationCredentials(id: string, credentials: any, crowdinId: string): Promise<void>;
|
|
42
|
+
updateIntegrationCredentials(id: string, credentials: any): Promise<void>;
|
|
43
|
+
updateIntegrationManagers(id: string, managers: any): Promise<void>;
|
|
44
|
+
getIntegrationCredentials(id: string): Promise<IntegrationCredentials | undefined>;
|
|
45
|
+
getAllIntegrationCredentials(crowdinId: string): Promise<IntegrationCredentials[]>;
|
|
46
|
+
deleteIntegrationCredentials(id: string): Promise<void>;
|
|
47
|
+
deleteAllIntegrationCredentials(crowdinId: string): Promise<void>;
|
|
48
|
+
saveMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
|
|
49
|
+
updateMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
|
|
50
|
+
getMetadata(id: string): Promise<any>;
|
|
51
|
+
getAllMetadata(): Promise<any[]>;
|
|
52
|
+
deleteMetadata(id: string): Promise<void>;
|
|
53
|
+
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
54
|
+
getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
|
|
55
|
+
saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
56
|
+
updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
57
|
+
getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
58
|
+
saveFilesSnapshot(files: any, integrationId: string, crowdinId: string, provider: string): Promise<void>;
|
|
59
|
+
updateFilesSnapshot(files: any, integrationId: string, crowdinId: string, provider: string): Promise<void>;
|
|
60
|
+
getFilesSnapshot(integrationId: string, crowdinId: string, provider: string): Promise<IntegrationFilesSnapshot | undefined>;
|
|
61
|
+
getAllWebhooks(integrationId: string, crowdinId: string, provider: string): Promise<IntegrationWebhooks[] | undefined>;
|
|
62
|
+
getWebhooks(fileId: string, integrationId: string, crowdinId: string, provider: string): Promise<IntegrationWebhooks | undefined>;
|
|
63
|
+
saveWebhooks(fileId: string, integrationId: string, crowdinId: string, provider: string): Promise<void>;
|
|
64
|
+
deleteWebhooks(fileIds: any[], integrationId: string, crowdinId: string, provider: string): Promise<void>;
|
|
65
|
+
getAllUserErrors(crowdinId: string, integrationId?: string): Promise<UserErrors[] | undefined>;
|
|
66
|
+
saveUserError(action: string, message: string, data: any, createdAt: string, crowdinId: string, integrationId?: string): Promise<void>;
|
|
67
|
+
deleteUserErrors(date: string, crowdinId: string, integrationId?: string): Promise<void>;
|
|
68
|
+
deleteAllUsersErrorsOlderThan(date: string): Promise<void>;
|
|
69
|
+
saveIntegrationConfig(integrationId: string, crowdinId: string, config: any): Promise<void>;
|
|
70
|
+
getAllIntegrationConfigs(crowdinId: string): Promise<IntegrationConfig[]>;
|
|
71
|
+
getIntegrationConfig(integrationId: string): Promise<IntegrationConfig | undefined>;
|
|
72
|
+
updateIntegrationConfig(integrationId: string, config: any): Promise<void>;
|
|
73
|
+
createJob(params: CreateJobParams): Promise<string>;
|
|
74
|
+
updateJob(params: UpdateJobParams): Promise<void>;
|
|
75
|
+
getJob(params: GetJobParams): Promise<Job | undefined>;
|
|
76
|
+
getActiveJobs(params: GetActiveJobsParams): Promise<Job[] | undefined>;
|
|
77
|
+
deleteFinishedJobs(): Promise<void>;
|
|
78
|
+
getAllInProgressJobs(): Promise<Job[] | undefined>;
|
|
79
|
+
getAllJobs(params: GetAllJobsParams): Promise<Job[] | undefined>;
|
|
80
|
+
saveTranslationCache(params: TranslationCache): Promise<void>;
|
|
81
|
+
getFileTranslationCache(params: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
|
|
82
|
+
getFileTranslationCacheByLanguage(params: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
|
|
83
|
+
updateTranslationCache(params: UpdateTranslationCacheParams): Promise<void>;
|
|
84
|
+
saveUnsyncedFiles(params: UnsyncedFiles): Promise<void>;
|
|
85
|
+
updateUnsyncedFiles(params: UnsyncedFiles): Promise<void>;
|
|
86
|
+
getUnsyncedFiles(params: GetUnsyncedFiles): Promise<UnsyncedFiles | undefined>;
|
|
87
|
+
registerCustomTable(tableName: string, schema: Record<string, string>): Promise<void>;
|
|
88
|
+
insertRecord(tableName: string, data: Record<string, any>): Promise<void>;
|
|
89
|
+
selectRecords(tableName: string, options?: {
|
|
90
|
+
columns?: string[];
|
|
91
|
+
whereClause?: string;
|
|
92
|
+
orderBy?: string;
|
|
93
|
+
limit?: number;
|
|
94
|
+
offset?: number;
|
|
95
|
+
distinct?: boolean;
|
|
96
|
+
}, params?: any[]): Promise<any[]>;
|
|
97
|
+
updateRecord(tableName: string, data: Record<string, any>, whereClause: string, params?: any[]): Promise<void>;
|
|
98
|
+
deleteRecord(tableName: string, whereClause: string, params?: any[]): Promise<void>;
|
|
99
|
+
saveSyncedData(files: any, integrationId: string, crowdinId: string, type: string): Promise<void>;
|
|
100
|
+
updateSyncedData(files: any, integrationId: string, crowdinId: string, type: string): Promise<void>;
|
|
101
|
+
getSyncedData(integrationId: string, crowdinId: string, type: string): Promise<IntegrationSyncedData | undefined>;
|
|
102
|
+
/**
|
|
103
|
+
* Converts undefined values to null for D1 compatibility
|
|
104
|
+
* D1 does not support undefined values, so we convert them to null
|
|
105
|
+
*/
|
|
106
|
+
private sanitizeBindValues;
|
|
107
|
+
}
|