@crowdin/app-project-module 0.65.1 → 0.65.2
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 +2 -2
- package/out/modules/form-data-display.d.ts +2 -2
- package/out/modules/form-data-display.js +5 -2
- package/out/modules/form-data-save.d.ts +2 -2
- package/out/modules/form-data-save.js +5 -2
- package/out/modules/integration/handlers/crowdin-webhook.js +1 -1
- package/out/modules/integration/types.d.ts +4 -0
- package/out/modules/integration/util/cron.d.ts +1 -1
- package/out/modules/integration/util/cron.js +7 -4
- package/out/modules/integration/util/job.js +1 -1
- package/out/static/js/form.js +12 -12
- package/out/storage/mysql.js +2 -2
- package/out/storage/postgre.js +2 -2
- package/out/storage/sqlite.js +2 -2
- package/out/util/credentials-masker.d.ts +4 -1
- package/out/util/credentials-masker.js +11 -6
- package/out/util/index.d.ts +1 -0
- package/out/util/index.js +18 -1
- package/package.json +9 -9
package/out/storage/mysql.js
CHANGED
|
@@ -608,8 +608,8 @@ class MySQLStorage {
|
|
|
608
608
|
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
609
609
|
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
610
610
|
FROM job
|
|
611
|
-
WHERE status
|
|
612
|
-
`, [types_1.JobStatus.IN_PROGRESS]);
|
|
611
|
+
WHERE status IN (?, ?) AND finished_at is NULL
|
|
612
|
+
`, [types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED]);
|
|
613
613
|
return rows || [];
|
|
614
614
|
}));
|
|
615
615
|
});
|
package/out/storage/postgre.js
CHANGED
|
@@ -640,8 +640,8 @@ class PostgreStorage {
|
|
|
640
640
|
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
641
641
|
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
642
642
|
FROM job
|
|
643
|
-
WHERE status
|
|
644
|
-
`, [types_1.JobStatus.IN_PROGRESS]);
|
|
643
|
+
WHERE status IN ($1, $2) AND finished_at is NULL
|
|
644
|
+
`, [types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED]);
|
|
645
645
|
return (res === null || res === void 0 ? void 0 : res.rows) || [];
|
|
646
646
|
}));
|
|
647
647
|
});
|
package/out/storage/sqlite.js
CHANGED
|
@@ -612,8 +612,8 @@ class SQLiteStorage {
|
|
|
612
612
|
return this.each(`
|
|
613
613
|
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status, title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
614
614
|
FROM job
|
|
615
|
-
WHERE status
|
|
616
|
-
`, [types_1.JobStatus.IN_PROGRESS]);
|
|
615
|
+
WHERE status IN (?,?) AND finished_at is NULL
|
|
616
|
+
`, [types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED]);
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
saveTranslationCache({ integrationId, crowdinId, fileId, languageId, etag }) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="qs" />
|
|
2
2
|
import { CrowdinClientRequest, UiModule } from '../types';
|
|
3
3
|
import { Request, Response } from 'express';
|
|
4
|
-
declare function getRequestCredentialsMasker(moduleConfig
|
|
4
|
+
declare function getRequestCredentialsMasker({ moduleConfig, dataPath, }: {
|
|
5
|
+
moduleConfig?: UiModule;
|
|
6
|
+
dataPath?: string;
|
|
7
|
+
}): (req: Request | CrowdinClientRequest, res: Response, next: Function) => any;
|
|
5
8
|
declare function postRequestCredentialsMasker(moduleConfig?: UiModule, credentialsExtractor?: Function): (req: 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;
|
|
6
9
|
export { getRequestCredentialsMasker, postRequestCredentialsMasker };
|
|
@@ -32,7 +32,7 @@ function getMaskableFieldsKeys(moduleConfig) {
|
|
|
32
32
|
return (0, lodash_get_1.default)(moduleConfig, `formUiSchema[${fieldKey}]['ui:widget']`) === 'password';
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function getRequestCredentialsMasker(moduleConfig) {
|
|
35
|
+
function getRequestCredentialsMasker({ moduleConfig, dataPath = 'formData', }) {
|
|
36
36
|
return function (req, res, next) {
|
|
37
37
|
// we can't find "password" fields without ui schema
|
|
38
38
|
if (!moduleConfig || !moduleConfig.formSchema || !moduleConfig.formUiSchema) {
|
|
@@ -48,13 +48,18 @@ function getRequestCredentialsMasker(moduleConfig) {
|
|
|
48
48
|
}
|
|
49
49
|
const originalSend = res.send;
|
|
50
50
|
res.send = function (body) {
|
|
51
|
-
|
|
51
|
+
const maskFields = (target) => {
|
|
52
52
|
maskableFieldsKeys.forEach((fieldKey) => {
|
|
53
|
-
if (
|
|
54
|
-
|
|
53
|
+
if (target[fieldKey]) {
|
|
54
|
+
target[fieldKey] = maskKey(target[fieldKey]);
|
|
55
55
|
}
|
|
56
|
-
body.formData[fieldKey] = maskKey(body.formData[fieldKey]);
|
|
57
56
|
});
|
|
57
|
+
};
|
|
58
|
+
if (body[dataPath]) {
|
|
59
|
+
maskFields(body[dataPath]);
|
|
60
|
+
}
|
|
61
|
+
if (dataPath === '') {
|
|
62
|
+
maskFields(body);
|
|
58
63
|
}
|
|
59
64
|
return originalSend.apply(res, [body]);
|
|
60
65
|
};
|
|
@@ -98,7 +103,7 @@ function postRequestCredentialsMasker(moduleConfig, credentialsExtractor) {
|
|
|
98
103
|
return acc;
|
|
99
104
|
}, {}));
|
|
100
105
|
// run getRequestCredentialsMasker to mask fields that can be in response
|
|
101
|
-
return getRequestCredentialsMasker(moduleConfig)(req, res, next);
|
|
106
|
+
return getRequestCredentialsMasker({ moduleConfig })(req, res, next);
|
|
102
107
|
}));
|
|
103
108
|
}
|
|
104
109
|
exports.postRequestCredentialsMasker = postRequestCredentialsMasker;
|
package/out/util/index.d.ts
CHANGED
|
@@ -13,3 +13,4 @@ export declare function isAuthorizedConfig(config: Config | UnauthorizedConfig):
|
|
|
13
13
|
export declare function hasFormSchema(moduleConfig: any): boolean;
|
|
14
14
|
export declare function isJson(string: string): boolean;
|
|
15
15
|
export declare function getPreviousDate(days: number): Date;
|
|
16
|
+
export declare function prepareFormDataMetadataId(req: CrowdinClientRequest, config: Config): Promise<string>;
|
package/out/util/index.js
CHANGED
|
@@ -32,11 +32,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.getPreviousDate = exports.isJson = exports.hasFormSchema = exports.isAuthorizedConfig = exports.getLogoUrl = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.runAsyncWrapper = exports.CodeError = void 0;
|
|
35
|
+
exports.prepareFormDataMetadataId = exports.getPreviousDate = exports.isJson = exports.hasFormSchema = exports.isAuthorizedConfig = exports.getLogoUrl = exports.executeWithRetry = exports.decryptData = exports.encryptData = exports.runAsyncWrapper = exports.CodeError = void 0;
|
|
36
36
|
const crypto = __importStar(require("crypto-js"));
|
|
37
37
|
const storage_1 = require("../storage");
|
|
38
38
|
const types_1 = require("../types");
|
|
39
39
|
const logger_1 = require("./logger");
|
|
40
|
+
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
40
41
|
class CodeError extends Error {
|
|
41
42
|
constructor(message, code) {
|
|
42
43
|
super(message);
|
|
@@ -142,3 +143,19 @@ function getPreviousDate(days) {
|
|
|
142
143
|
return date;
|
|
143
144
|
}
|
|
144
145
|
exports.getPreviousDate = getPreviousDate;
|
|
146
|
+
function prepareFormDataMetadataId(req, config) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const jwtToken = req.query.jwtToken;
|
|
149
|
+
const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(jwtToken, config.clientSecret, config.jwtValidationOptions);
|
|
150
|
+
const context = jwtPayload.context;
|
|
151
|
+
const id = ['form-data'];
|
|
152
|
+
if (context.organization_id) {
|
|
153
|
+
id.push(`${context.organization_id}`);
|
|
154
|
+
}
|
|
155
|
+
if (context.project_id) {
|
|
156
|
+
id.push(`${context.project_id}`);
|
|
157
|
+
}
|
|
158
|
+
return id.join('-');
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
exports.prepareFormDataMetadataId = prepareFormDataMetadataId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.65.
|
|
3
|
+
"version": "0.65.2",
|
|
4
4
|
"description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@aws-sdk/client-s3": "^3.606.0",
|
|
22
22
|
"@aws-sdk/s3-request-presigner": "^3.598.0",
|
|
23
|
-
"@crowdin/crowdin-apps-functions": "0.8.
|
|
23
|
+
"@crowdin/crowdin-apps-functions": "0.8.1",
|
|
24
24
|
"@crowdin/logs-formatter": "^2.1.4",
|
|
25
25
|
"@godaddy/terminus": "^4.12.1",
|
|
26
|
-
"amqplib": "^0.10.
|
|
26
|
+
"amqplib": "^0.10.4",
|
|
27
27
|
"crypto-js": "^4.2.0",
|
|
28
28
|
"express": "4.19.2",
|
|
29
29
|
"express-handlebars": "^5.3.5",
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
"@babel/preset-react": "^7.24.7",
|
|
42
42
|
"@emotion/react": "^11.13.0",
|
|
43
43
|
"@emotion/styled": "^11.11.5",
|
|
44
|
-
"@mui/icons-material": "^5.16.
|
|
45
|
-
"@mui/material": "^5.16.
|
|
46
|
-
"@rjsf/core": "^5.
|
|
47
|
-
"@rjsf/mui": "^5.
|
|
44
|
+
"@mui/icons-material": "^5.16.7",
|
|
45
|
+
"@mui/material": "^5.16.7",
|
|
46
|
+
"@rjsf/core": "^5.20.1",
|
|
47
|
+
"@rjsf/mui": "^5.20.1",
|
|
48
48
|
"@rjsf/utils": "^5.18.4",
|
|
49
|
-
"@rjsf/validator-ajv8": "^5.
|
|
49
|
+
"@rjsf/validator-ajv8": "^5.20.1",
|
|
50
50
|
"@rollup/plugin-babel": "^6.0.4",
|
|
51
51
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
52
52
|
"@rollup/plugin-json": "^6.1.0",
|
|
53
53
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
54
|
-
"@rollup/plugin-replace": "^5.0.
|
|
54
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
55
55
|
"@rollup/plugin-terser": "^0.4.3",
|
|
56
56
|
"@types/amqplib": "^0.10.4",
|
|
57
57
|
"@types/crypto-js": "^4.2.2",
|