@crowdin/app-project-module 0.98.0-cf-1 → 0.98.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 +10 -25
- 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/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.d.ts +1 -1
- 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.js +21 -27
- 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 +2 -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.js +1 -8
- package/out/storage/mysql.d.ts +1 -1
- package/out/storage/mysql.js +9 -1
- package/out/storage/postgre.d.ts +1 -1
- package/out/storage/postgre.js +11 -4
- package/out/storage/sqlite.d.ts +1 -1
- package/out/storage/sqlite.js +10 -4
- package/out/types.d.ts +1 -11
- 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 -80
- 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
package/out/index.js
CHANGED
|
@@ -50,11 +50,11 @@ const subscription_paid_1 = __importDefault(require("./modules/subscription-paid
|
|
|
50
50
|
const uninstall_1 = __importDefault(require("./modules/uninstall"));
|
|
51
51
|
const status_1 = __importDefault(require("./modules/status"));
|
|
52
52
|
const storage = __importStar(require("./storage"));
|
|
53
|
-
const d1_1 = require("./storage/d1");
|
|
54
53
|
const types_1 = require("./types");
|
|
55
54
|
const util_1 = require("./util");
|
|
56
55
|
const form_schema_1 = require("./util/form-schema");
|
|
57
56
|
const connection_1 = require("./util/connection");
|
|
57
|
+
const handlebars_1 = require("./util/handlebars");
|
|
58
58
|
const logger = __importStar(require("./util/logger"));
|
|
59
59
|
const logger_1 = require("./util/logger");
|
|
60
60
|
const terminus_express_1 = __importDefault(require("./util/terminus-express"));
|
|
@@ -63,7 +63,6 @@ const credentials_masker_1 = require("./util/credentials-masker");
|
|
|
63
63
|
Object.defineProperty(exports, "getRequestCredentialsMasker", { enumerable: true, get: function () { return credentials_masker_1.getRequestCredentialsMasker; } });
|
|
64
64
|
Object.defineProperty(exports, "postRequestCredentialsMasker", { enumerable: true, get: function () { return credentials_masker_1.postRequestCredentialsMasker; } });
|
|
65
65
|
Object.defineProperty(exports, "maskKey", { enumerable: true, get: function () { return credentials_masker_1.maskKey; } });
|
|
66
|
-
const static_files_1 = require("./util/static-files");
|
|
67
66
|
//apps
|
|
68
67
|
const apiApp = __importStar(require("./modules/api"));
|
|
69
68
|
const contextMenuApp = __importStar(require("./modules/context-menu"));
|
|
@@ -139,26 +138,6 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
139
138
|
}
|
|
140
139
|
storage.initialize(config);
|
|
141
140
|
logger.initialize(config);
|
|
142
|
-
// Middleware to ensure D1 migration before handling requests
|
|
143
|
-
app.use((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
try {
|
|
145
|
-
const storageInstance = storage.getStorage();
|
|
146
|
-
if (storageInstance instanceof d1_1.D1Storage) {
|
|
147
|
-
yield storageInstance.ensureMigrated();
|
|
148
|
-
}
|
|
149
|
-
next();
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
next(error);
|
|
153
|
-
}
|
|
154
|
-
}));
|
|
155
|
-
// Middleware to detect and cache baseUrl from request if not provided
|
|
156
|
-
app.use((req, res, next) => {
|
|
157
|
-
if (!config.baseUrl) {
|
|
158
|
-
config.baseUrl = (0, util_1.extractBaseUrlFromRequest)(req);
|
|
159
|
-
}
|
|
160
|
-
next();
|
|
161
|
-
});
|
|
162
141
|
app.use((req, res, next) => {
|
|
163
142
|
if (config.webhooks && req.path === '/webhooks') {
|
|
164
143
|
return terminus_express_1.default.raw({ type: '*/*', limit: '50mb' })(req, res, next);
|
|
@@ -172,8 +151,11 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
172
151
|
app.use(logsFormatter.contextResolverMiddleware());
|
|
173
152
|
app.use(logsFormatter.expressMiddleware());
|
|
174
153
|
}
|
|
175
|
-
app.use('/assets', (0,
|
|
176
|
-
app.
|
|
154
|
+
app.use('/assets', terminus_express_1.default.static((0, path_1.join)(__dirname, 'static')));
|
|
155
|
+
app.set('views', (0, path_1.join)(__dirname, 'views'));
|
|
156
|
+
app.engine('handlebars', handlebars_1.engine);
|
|
157
|
+
app.set('view engine', 'handlebars');
|
|
158
|
+
app.get((0, util_1.getLogoUrl)(), (req, res) => res.sendFile(config.imagePath));
|
|
177
159
|
app.get('/manifest.json', json_response_1.default, (0, manifest_1.default)(config));
|
|
178
160
|
app.get('/', (0, about_1.default)(config));
|
|
179
161
|
if (((_a = config === null || config === void 0 ? void 0 : config.enableStatusPage) === null || _a === void 0 ? void 0 : _a.database) || ((_b = config === null || config === void 0 ? void 0 : config.enableStatusPage) === null || _b === void 0 ? void 0 : _b.filesystem)) {
|
|
@@ -292,6 +274,9 @@ function convertClientConfig(clientConfig) {
|
|
|
292
274
|
const clientSecret = clientConfig.clientSecret || process.env.CROWDIN_CLIENT_SECRET;
|
|
293
275
|
const port = clientConfig.port || process.env.PORT || 3000;
|
|
294
276
|
const { region = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION, tmpBucketName = process.env.AWS_TMP_BUCKET_NAME, } = clientConfig.awsConfig || {};
|
|
277
|
+
if (!baseUrl) {
|
|
278
|
+
throw new Error('Missing baseUrl parameter');
|
|
279
|
+
}
|
|
295
280
|
if (clientConfig.authenticationType !== types_1.AuthenticationType.NONE) {
|
|
296
281
|
if (!clientId && !clientSecret) {
|
|
297
282
|
throw new Error('Missing [clientId, clientSecret] parameters');
|
|
@@ -301,7 +286,7 @@ function convertClientConfig(clientConfig) {
|
|
|
301
286
|
clientConfig.api = Object.assign({ default: true }, clientConfig.api);
|
|
302
287
|
}
|
|
303
288
|
clientConfig.enableStatusPage = Object.assign({ database: true, filesystem: true }, (clientConfig.enableStatusPage || {}));
|
|
304
|
-
return Object.assign(Object.assign({}, clientConfig), { baseUrl: baseUrl
|
|
289
|
+
return Object.assign(Object.assign({}, clientConfig), { baseUrl: baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl, clientId,
|
|
305
290
|
clientSecret, awsConfig: {
|
|
306
291
|
tmpBucketName,
|
|
307
292
|
region,
|
|
@@ -21,5 +21,5 @@ export default function handle({ config, optional, checkSubscriptionExpiration,
|
|
|
21
21
|
optional: boolean;
|
|
22
22
|
checkSubscriptionExpiration: boolean;
|
|
23
23
|
moduleKey?: string[] | string | undefined;
|
|
24
|
-
}): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
24
|
+
}): (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;
|
|
25
25
|
export declare function getToken(req: CrowdinClientRequest): string | undefined;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { Config } from '../types';
|
|
4
4
|
import { IntegrationLogic } from '../modules/integration/types';
|
|
5
|
-
export default function handle(config: Config, integration: IntegrationLogic, optional?: boolean): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(config: Config, integration: IntegrationLogic, optional?: boolean): (req: import("../types").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;
|
|
@@ -37,7 +37,6 @@ const util_1 = require("../util");
|
|
|
37
37
|
const connection_1 = require("../util/connection");
|
|
38
38
|
const logger_1 = require("../util/logger");
|
|
39
39
|
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
40
|
-
const views_1 = require("../views");
|
|
41
40
|
function handle(config, integration, optional = false) {
|
|
42
41
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
43
42
|
let clientId = req.crowdinContext.clientId;
|
|
@@ -90,9 +89,7 @@ function handle(config, integration, optional = false) {
|
|
|
90
89
|
else {
|
|
91
90
|
(0, logger_1.temporaryErrorDebug)('Access denied: integration-credentials', req);
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
95
|
-
return res.send(html);
|
|
92
|
+
return res.render('error', errorOptions);
|
|
96
93
|
}
|
|
97
94
|
try {
|
|
98
95
|
req.integrationCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
|
-
import
|
|
3
|
-
import { UiModule
|
|
4
|
-
export default function handle(moduleConfig: UiModule
|
|
2
|
+
import express from 'express';
|
|
3
|
+
import { UiModule } from '../types';
|
|
4
|
+
export default function handle(moduleConfig: UiModule): (req: import("../types").CrowdinClientRequest | express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -8,24 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const express_1 = __importDefault(require("express"));
|
|
12
16
|
const util_1 = require("../util");
|
|
13
|
-
|
|
14
|
-
const views_1 = require("../views");
|
|
15
|
-
function handle(moduleConfig, config) {
|
|
17
|
+
function handle(moduleConfig) {
|
|
16
18
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
17
19
|
if (moduleConfig.formSchema) {
|
|
18
|
-
|
|
19
|
-
formGetDataUrl: moduleConfig.formGetDataUrl
|
|
20
|
-
|
|
20
|
+
return res.render('form', {
|
|
21
|
+
formGetDataUrl: moduleConfig.formGetDataUrl
|
|
22
|
+
? moduleConfig.formGetDataUrl
|
|
23
|
+
: `/api/${moduleConfig.key}/form-data`,
|
|
24
|
+
formPostDataUrl: moduleConfig.formPostDataUrl
|
|
25
|
+
? moduleConfig.formPostDataUrl
|
|
26
|
+
: `/api/${moduleConfig.key}/form-data`,
|
|
21
27
|
formSchema: JSON.stringify(moduleConfig.formSchema),
|
|
22
28
|
formUiSchema: moduleConfig.formUiSchema ? JSON.stringify(moduleConfig.formUiSchema) : '{}',
|
|
23
29
|
});
|
|
24
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
25
|
-
return res.send(html);
|
|
26
30
|
}
|
|
27
31
|
if (moduleConfig.uiPath) {
|
|
28
|
-
return
|
|
32
|
+
return express_1.default.static(moduleConfig.uiPath)(req, res, next);
|
|
29
33
|
}
|
|
30
34
|
throw new Error('uiPath or formSchema should be provided for module');
|
|
31
35
|
}));
|
|
@@ -5,4 +5,4 @@ export default function handle({ config, allowUnauthorized, moduleType, }: {
|
|
|
5
5
|
config: Config | UnauthorizedConfig;
|
|
6
6
|
allowUnauthorized?: boolean;
|
|
7
7
|
moduleType?: string | undefined;
|
|
8
|
-
}): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
8
|
+
}): (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;
|
|
@@ -15,7 +15,6 @@ const util_1 = require("../util");
|
|
|
15
15
|
const connection_1 = require("../util/connection");
|
|
16
16
|
const logger_1 = require("../util/logger");
|
|
17
17
|
const subscription_1 = require("../util/subscription");
|
|
18
|
-
const views_1 = require("../views");
|
|
19
18
|
function handle({ config, allowUnauthorized = false, moduleType, }) {
|
|
20
19
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
21
20
|
if (allowUnauthorized) {
|
|
@@ -58,9 +57,7 @@ function handle({ config, allowUnauthorized = false, moduleType, }) {
|
|
|
58
57
|
accountType: credentials.type,
|
|
59
58
|
});
|
|
60
59
|
if (expired) {
|
|
61
|
-
|
|
62
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
63
|
-
return res.send(html);
|
|
60
|
+
return res.render('subscription', { subscribeLink });
|
|
64
61
|
}
|
|
65
62
|
next();
|
|
66
63
|
}));
|
package/out/modules/about.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare function getAboutPageOptions(config: Config | UnauthorizedConfig)
|
|
|
6
6
|
manifest: string;
|
|
7
7
|
storeLink: string;
|
|
8
8
|
}>;
|
|
9
|
-
export default function handle(config: Config | UnauthorizedConfig): (req: Request, res: Response, next: NextFunction) => Promise<
|
|
9
|
+
export default function handle(config: Config | UnauthorizedConfig): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
package/out/modules/about.js
CHANGED
|
@@ -16,8 +16,6 @@ exports.getAboutPageOptions = void 0;
|
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const util_1 = require("../util");
|
|
18
18
|
const crowdin_client_1 = require("../middlewares/crowdin-client");
|
|
19
|
-
const jsx_renderer_1 = require("../util/jsx-renderer");
|
|
20
|
-
const views_1 = require("../views");
|
|
21
19
|
function getAboutPageOptions(config) {
|
|
22
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
21
|
let detailPage = '';
|
|
@@ -45,9 +43,7 @@ function handle(config) {
|
|
|
45
43
|
const jwtToken = (0, crowdin_client_1.getToken)(req);
|
|
46
44
|
if (!jwtToken) {
|
|
47
45
|
const options = yield getAboutPageOptions(config);
|
|
48
|
-
|
|
49
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
50
|
-
return res.send(html);
|
|
46
|
+
return res.render('about', options);
|
|
51
47
|
}
|
|
52
48
|
else {
|
|
53
49
|
next();
|
|
@@ -55,9 +51,7 @@ function handle(config) {
|
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
const options = yield getAboutPageOptions(config);
|
|
58
|
-
|
|
59
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
60
|
-
return res.send(html);
|
|
54
|
+
return res.render('about', options);
|
|
61
55
|
});
|
|
62
56
|
}
|
|
63
57
|
exports.default = handle;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { AiPromptProviderModule } from '../types';
|
|
5
|
-
export default function handle(aiPromptProvider: AiPromptProviderModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(aiPromptProvider: AiPromptProviderModule): (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;
|
|
@@ -8,11 +8,9 @@ const json_response_1 = __importDefault(require("../../middlewares/json-response
|
|
|
8
8
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
9
9
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
10
10
|
const util_1 = require("../../util");
|
|
11
|
-
const static_files_1 = require("../../util/static-files");
|
|
12
11
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
13
12
|
const compile_1 = __importDefault(require("./handlers/compile"));
|
|
14
13
|
function register({ config, app }) {
|
|
15
|
-
var _a;
|
|
16
14
|
if (!config.aiPromptProvider) {
|
|
17
15
|
return;
|
|
18
16
|
}
|
|
@@ -23,8 +21,8 @@ function register({ config, app }) {
|
|
|
23
21
|
moduleKey: config.aiPromptProvider.key,
|
|
24
22
|
}), (0, compile_1.default)(config.aiPromptProvider));
|
|
25
23
|
if (config.aiPromptProvider.formSchema || config.aiPromptProvider.uiPath) {
|
|
26
|
-
app.use('/prompt-provider/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiPromptProvider.key }), (0, render_ui_module_1.default)(config.aiPromptProvider
|
|
24
|
+
app.use('/prompt-provider/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiPromptProvider.key }), (0, render_ui_module_1.default)(config.aiPromptProvider));
|
|
27
25
|
}
|
|
28
|
-
app.get((0, util_1.getLogoUrl)(config.aiPromptProvider, '/ai-prompt-provider'), (
|
|
26
|
+
app.get((0, util_1.getLogoUrl)(config.aiPromptProvider, '/ai-prompt-provider'), (req, res) => { var _a; return res.sendFile(((_a = config.aiPromptProvider) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
29
27
|
}
|
|
30
28
|
exports.register = register;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { AiProviderModule } from '../types';
|
|
5
|
-
export default function handle(aiProvider: AiProviderModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(aiProvider: AiProviderModule): (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;
|
|
@@ -3,4 +3,4 @@ import { Response } from 'express';
|
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { AiProviderModule } from '../types';
|
|
5
5
|
export declare const CONTEXT_WINDOW_LIMIT = 4096;
|
|
6
|
-
export default function handle(aiProvider: AiProviderModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
6
|
+
export default function handle(aiProvider: AiProviderModule): (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;
|
|
@@ -10,17 +10,15 @@ const chat_completions_1 = __importDefault(require("./handlers/chat-completions"
|
|
|
10
10
|
const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
|
|
11
11
|
const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
|
|
12
12
|
const util_1 = require("../../util");
|
|
13
|
-
const static_files_1 = require("../../util/static-files");
|
|
14
13
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
15
14
|
function register({ config, app }) {
|
|
16
|
-
var _a;
|
|
17
15
|
if (!config.aiProvider) {
|
|
18
16
|
return;
|
|
19
17
|
}
|
|
20
18
|
if (config.aiProvider.settingsUiModule) {
|
|
21
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiProvider.key }), (0, render_ui_module_1.default)(config.aiProvider.settingsUiModule
|
|
19
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiProvider.key }), (0, render_ui_module_1.default)(config.aiProvider.settingsUiModule));
|
|
22
20
|
}
|
|
23
|
-
app.get((0, util_1.getLogoUrl)(config.aiProvider, '/aiprovider'), (
|
|
21
|
+
app.get((0, util_1.getLogoUrl)(config.aiProvider, '/aiprovider'), (req, res) => { var _a; return res.sendFile(((_a = config.aiProvider) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
24
22
|
app.get('/ai-provider/models', json_response_1.default, (0, crowdin_client_1.default)({
|
|
25
23
|
config,
|
|
26
24
|
optional: false,
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../types';
|
|
4
4
|
import { AiRequestProcessorModule, AiStreamProcessorModule } from './types';
|
|
5
|
-
export default function handle(module: AiRequestProcessorModule | AiStreamProcessorModule, canHandleStream?: boolean): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(module: AiRequestProcessorModule | AiStreamProcessorModule, canHandleStream?: boolean): (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 { AiTool } from '../types';
|
|
5
|
-
export default function handle(aiTool: AiTool): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(aiTool: AiTool): (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;
|
|
@@ -37,7 +37,7 @@ function registerAiToolWidgets({ config, app }) {
|
|
|
37
37
|
const tools = Array.isArray(config.aiToolsWidget) ? config.aiToolsWidget : [config.aiToolsWidget];
|
|
38
38
|
for (const tool of tools) {
|
|
39
39
|
if ((0, util_1.isUniqueFunctionName)(tool)) {
|
|
40
|
-
app.use((0, util_1.getAiToolWidgetUrl)(tool), (0, ui_module_1.default)({ config, moduleType: tool.key }), (0, render_ui_module_1.default)(tool
|
|
40
|
+
app.use((0, util_1.getAiToolWidgetUrl)(tool), (0, ui_module_1.default)({ config, moduleType: tool.key }), (0, render_ui_module_1.default)(tool));
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
throw new Error(`The function name '${tool.function.name}' is not unique within aiTools and aiToolsWidget`);
|
|
@@ -16,14 +16,14 @@ function register({ config, app }) {
|
|
|
16
16
|
if (Array.isArray(config.contextMenu)) {
|
|
17
17
|
config.contextMenu.forEach((contextMenu) => {
|
|
18
18
|
if ((contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.uiPath) || (contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.formSchema)) {
|
|
19
|
-
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu
|
|
19
|
+
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
// backward compatibility will be removed after migration
|
|
25
25
|
if (((_a = config.contextMenu) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.contextMenu) === null || _b === void 0 ? void 0 : _b.formSchema)) {
|
|
26
|
-
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu
|
|
26
|
+
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomMTLogic } from '../types';
|
|
5
|
-
export default function handle(config: CustomMTLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(config: CustomMTLogic): (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;
|
|
@@ -6,14 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.register = void 0;
|
|
7
7
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
8
8
|
const util_1 = require("../../util");
|
|
9
|
-
const static_files_1 = require("../../util/static-files");
|
|
10
9
|
const translate_1 = __importDefault(require("./handlers/translate"));
|
|
11
10
|
function register({ config, app }) {
|
|
12
|
-
var _a;
|
|
13
11
|
if (!config.customMT) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
|
-
app.get((0, util_1.getLogoUrl)(config.customMT, '/mt'), (
|
|
14
|
+
app.get((0, util_1.getLogoUrl)(config.customMT, '/mt'), (req, res) => { var _a; return res.sendFile(((_a = config.customMT) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
|
|
17
15
|
app.post('/mt/translate', (0, crowdin_client_1.default)({
|
|
18
16
|
config,
|
|
19
17
|
optional: false,
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomSpellcheckerModule } from '../types';
|
|
5
|
-
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(customSpellchecker: CustomSpellcheckerModule): (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 { CustomSpellcheckerModule } from '../types';
|
|
5
|
-
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(customSpellchecker: CustomSpellcheckerModule): (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;
|
|
@@ -17,9 +17,9 @@ function register({ config, app }) {
|
|
|
17
17
|
}
|
|
18
18
|
if ((0, util_1.isAuthorizedConfig)(config)) {
|
|
19
19
|
if (config.customSpellchecker.settingsUiModule) {
|
|
20
|
-
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule
|
|
20
|
+
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
21
21
|
// TEMPORARY CODE: it needs to support old path
|
|
22
|
-
app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule
|
|
22
|
+
app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
23
23
|
// END TEMPORARY CODE
|
|
24
24
|
}
|
|
25
25
|
app.get('/spellchecker/languages', json_response_1.default, (0, crowdin_client_1.default)({
|
|
@@ -49,9 +49,9 @@ function register({ config, app }) {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
if (config.customSpellchecker.settingsUiModule) {
|
|
52
|
-
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule
|
|
52
|
+
app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
53
53
|
// TEMPORARY CODE: it needs to support old path
|
|
54
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule
|
|
54
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule));
|
|
55
55
|
// END TEMPORARY CODE
|
|
56
56
|
}
|
|
57
57
|
app.get('/spellchecker/languages', json_response_1.default, (0, get_languages_list_1.default)(config.customSpellchecker));
|
|
@@ -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('/editor-panels', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.editorRightPanel.key }), (0, render_ui_module_1.default)(config.editorRightPanel
|
|
15
|
+
app.use('/editor-panels', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.editorRightPanel.key }), (0, render_ui_module_1.default)(config.editorRightPanel));
|
|
16
16
|
}
|
|
17
17
|
exports.register = register;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { ExternalQaCheckModule } from '../types';
|
|
5
|
-
export default function handle(externalQaCheck: ExternalQaCheckModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(externalQaCheck: ExternalQaCheckModule): (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;
|
|
@@ -38,9 +38,9 @@ function register({ config, app }) {
|
|
|
38
38
|
}), (0, validate_1.default)(qaCheck));
|
|
39
39
|
// END TEMPORARY CODE
|
|
40
40
|
if (qaCheck.settingsUiModule) {
|
|
41
|
-
app.use('/qa-check/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: qaCheck.key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule
|
|
41
|
+
app.use('/qa-check/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: qaCheck.key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule));
|
|
42
42
|
// TEMPORARY CODE: it needs to support old path
|
|
43
|
-
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule
|
|
43
|
+
app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule));
|
|
44
44
|
// END TEMPORARY CODE
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomFileFormatLogic } from '../types';
|
|
5
|
-
export default function handle(baseUrl: string, folder: string, config: CustomFileFormatLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(baseUrl: string, folder: string, config: CustomFileFormatLogic): (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 { Request, Response } from 'express';
|
|
3
3
|
import { Config } from '../../../types';
|
|
4
4
|
import { FileProcessLogic } from '../types';
|
|
5
|
-
export default function handle(config: Config, processingConfig: FileProcessLogic, folderName: string): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(config: Config, processingConfig: FileProcessLogic, folderName: string): (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 { Response } from 'express';
|
|
3
3
|
import { Config, CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { FileImportExportLogic } from '../types';
|
|
5
|
-
export default function handle(baseConfig: Config, config: FileImportExportLogic, folderName: string): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(baseConfig: Config, config: FileImportExportLogic, folderName: string): (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Config, CrowdinClientRequest } from '../types';
|
|
3
3
|
import { Response } from 'express';
|
|
4
|
-
export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
4
|
+
export default function handle(config: Config): (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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Config, CrowdinClientRequest } from '../types';
|
|
3
3
|
import { Response } from 'express';
|
|
4
|
-
export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
4
|
+
export default function handle(config: Config): (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;
|
package/out/modules/install.d.ts
CHANGED
|
@@ -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 { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { IntegrationLogic } from '../types';
|
|
5
|
-
export default function handle(integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(integration: IntegrationLogic): (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 { Config } from '../../../types';
|
|
4
4
|
import { IntegrationLogic } from '../types';
|
|
5
|
-
export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").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;
|
|
@@ -15,16 +15,18 @@ const logger_1 = require("../../../util/logger");
|
|
|
15
15
|
const files_1 = require("../util/files");
|
|
16
16
|
function handle(config, integration) {
|
|
17
17
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
|
|
18
|
+
var _a;
|
|
19
|
+
const mode = (_a = req.query) === null || _a === void 0 ? void 0 : _a.mode;
|
|
20
|
+
req.logInfo(`Loading crowdin files${mode ? ` (mode: ${mode})` : ''}`);
|
|
19
21
|
if (integration.getCrowdinFiles) {
|
|
20
22
|
const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, req.crowdinContext.jwtPayload.context.project_id);
|
|
21
23
|
req.logInfo(`Loading files ${rootFolder ? `from folder ${rootFolder.id}` : 'from root'}`);
|
|
22
24
|
try {
|
|
23
25
|
let files = integration.getCrowdinFiles
|
|
24
|
-
? yield integration.getCrowdinFiles(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, rootFolder, req.integrationSettings)
|
|
26
|
+
? yield integration.getCrowdinFiles(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, rootFolder, req.integrationSettings, mode)
|
|
25
27
|
: [];
|
|
26
28
|
req.logInfo('Marking files as unsynced');
|
|
27
|
-
if (files.length > 0) {
|
|
29
|
+
if (files.length > 0 && mode !== 'directories') {
|
|
28
30
|
files = yield (0, files_1.markUnsyncedFiles)({
|
|
29
31
|
integrationId: req.crowdinContext.clientId,
|
|
30
32
|
crowdinId: req.crowdinContext.crowdinId,
|
|
@@ -32,7 +34,7 @@ function handle(config, integration) {
|
|
|
32
34
|
files,
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
|
-
req.logInfo(`Returning ${files.length}
|
|
37
|
+
req.logInfo(`Returning ${files.length} items`);
|
|
36
38
|
res.send(files);
|
|
37
39
|
}
|
|
38
40
|
catch (e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
|
-
export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
4
|
+
export default function handle(): (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 { Config } from '../../../types';
|
|
4
4
|
import { IntegrationLogic } from '../types';
|
|
5
|
-
export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any
|
|
5
|
+
export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").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;
|