@crowdin/app-project-module 0.100.3 → 0.101.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 +2 -0
- package/out/middlewares/render-ui-module.js +1 -0
- package/out/middlewares/ui-module.js +14 -10
- package/out/modules/automation-action/handlers/execute.d.ts +5 -0
- package/out/modules/automation-action/handlers/execute.js +78 -0
- package/out/modules/automation-action/handlers/input-schema.d.ts +5 -0
- package/out/modules/automation-action/handlers/input-schema.js +29 -0
- package/out/modules/automation-action/handlers/output-schema.d.ts +5 -0
- package/out/modules/automation-action/handlers/output-schema.js +29 -0
- package/out/modules/automation-action/handlers/validate-settings.d.ts +5 -0
- package/out/modules/automation-action/handlers/validate-settings.js +35 -0
- package/out/modules/automation-action/index.d.ts +6 -0
- package/out/modules/automation-action/index.js +45 -0
- package/out/modules/automation-action/types.d.ts +49 -0
- package/out/modules/automation-action/types.js +2 -0
- package/out/modules/automation-action/util/index.d.ts +3 -0
- package/out/modules/automation-action/util/index.js +15 -0
- package/out/modules/automation-action/util/validate-input.d.ts +9 -0
- package/out/modules/automation-action/util/validate-input.js +60 -0
- package/out/modules/install.js +19 -2
- package/out/modules/manifest.js +25 -0
- package/out/static/js/form.js +12 -20
- package/out/types.d.ts +11 -0
- package/out/types.js +1 -0
- package/out/util/connection.js +24 -3
- package/out/views/form.handlebars +1 -0
- package/package.json +8 -3
package/out/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { ExternalQaCheckModule } from './modules/external-qa-check/types';
|
|
|
19
19
|
import { Webhook } from './modules/webhooks/types';
|
|
20
20
|
import { WorkflowStepTypeModule } from './modules/workflow-step-type/types';
|
|
21
21
|
import { AiRequestProcessorModule, AiStreamProcessorModule } from './modules/ai-request-processors/types';
|
|
22
|
+
import { AutomationActionModule } from './modules/automation-action/types';
|
|
22
23
|
export interface ClientConfig extends ImagePath {
|
|
23
24
|
/**
|
|
24
25
|
* Authentication Crowdin App type: "authorization_code", "crowdin_app", "crowdin_agent". Default: "crowdin_app"
|
|
@@ -263,6 +264,10 @@ export interface ClientConfig extends ImagePath {
|
|
|
263
264
|
* property that tells backend that AiProvider and AiPromptProvider modules can cooperate only with each one
|
|
264
265
|
*/
|
|
265
266
|
restrictAiToSameApp?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Automation action module
|
|
269
|
+
*/
|
|
270
|
+
automationAction?: AutomationActionModule | AutomationActionModule[];
|
|
266
271
|
}
|
|
267
272
|
export interface Environments {
|
|
268
273
|
environments?: Environment | Environment[];
|
|
@@ -283,6 +288,7 @@ export type UnauthorizedConfig = Omit<Config, 'clientId' | 'clientSecret'> & {
|
|
|
283
288
|
export declare enum AuthenticationType {
|
|
284
289
|
CODE = "authorization_code",
|
|
285
290
|
APP = "crowdin_app",
|
|
291
|
+
APP_WITH_CODE = "crowdin_app_with_code",
|
|
286
292
|
AGENT = "crowdin_agent",
|
|
287
293
|
NONE = "none"
|
|
288
294
|
}
|
|
@@ -419,6 +425,11 @@ export interface UiModule extends ModuleKey {
|
|
|
419
425
|
* Endpoint should accept GET requests.
|
|
420
426
|
*/
|
|
421
427
|
formGetDataUrl?: string;
|
|
428
|
+
/**
|
|
429
|
+
* URL to custom endpoint for patching form data.
|
|
430
|
+
* Endpoint should accept PATCH requests.
|
|
431
|
+
*/
|
|
432
|
+
formPatchDataUrl?: string;
|
|
422
433
|
/**
|
|
423
434
|
* Additional attributes for react-jsonschema-doc
|
|
424
435
|
*/
|
package/out/types.js
CHANGED
|
@@ -5,6 +5,7 @@ var AuthenticationType;
|
|
|
5
5
|
(function (AuthenticationType) {
|
|
6
6
|
AuthenticationType["CODE"] = "authorization_code";
|
|
7
7
|
AuthenticationType["APP"] = "crowdin_app";
|
|
8
|
+
AuthenticationType["APP_WITH_CODE"] = "crowdin_app_with_code";
|
|
8
9
|
AuthenticationType["AGENT"] = "crowdin_agent";
|
|
9
10
|
AuthenticationType["NONE"] = "none";
|
|
10
11
|
})(AuthenticationType = exports.AuthenticationType || (exports.AuthenticationType = {}));
|
package/out/util/connection.js
CHANGED
|
@@ -49,7 +49,7 @@ const defaults_1 = require("../modules/integration/util/defaults");
|
|
|
49
49
|
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
50
50
|
const axiosCustom = new axios_2.AxiosProvider().axios;
|
|
51
51
|
function prepareCrowdinClient({ config, credentials, autoRenew = false, context, }) {
|
|
52
|
-
var _a, _b;
|
|
52
|
+
var _a, _b, _c, _d, _e;
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
let userAgent;
|
|
55
55
|
if (config.crowdinApiUserAgent) {
|
|
@@ -61,6 +61,27 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
61
61
|
//2 min as an extra buffer
|
|
62
62
|
const isExpired = +credentials.expire - 120 < Date.now() / 1000;
|
|
63
63
|
const organization = credentials.type === types_1.AccountType.ENTERPRISE ? credentials.id : undefined;
|
|
64
|
+
if (config.authenticationType === types_1.AuthenticationType.APP_WITH_CODE) {
|
|
65
|
+
const code = (_a = context === null || context === void 0 ? void 0 : context.jwtPayload) === null || _a === void 0 ? void 0 : _a.code;
|
|
66
|
+
if (!code) {
|
|
67
|
+
throw new Error(`Missing code in JWT payload for ${types_1.AuthenticationType.APP_WITH_CODE} authentication`);
|
|
68
|
+
}
|
|
69
|
+
const freshToken = yield (0, crowdin_apps_functions_1.fetchAppWithCodeToken)({
|
|
70
|
+
appId: config.identifier,
|
|
71
|
+
appSecret: credentials.appSecret,
|
|
72
|
+
clientId: config.clientId,
|
|
73
|
+
clientSecret: config.clientSecret,
|
|
74
|
+
domain: credentials.domain || '',
|
|
75
|
+
userId: credentials.userId,
|
|
76
|
+
code,
|
|
77
|
+
url: (_b = config.crowdinUrls) === null || _b === void 0 ? void 0 : _b.accountUrl,
|
|
78
|
+
});
|
|
79
|
+
const token = freshToken.accessToken;
|
|
80
|
+
return {
|
|
81
|
+
client: new crowdin_api_client_1.default({ token, organization, baseUrl: (_c = config.crowdinUrls) === null || _c === void 0 ? void 0 : _c.apiUrl }, { userAgent }),
|
|
82
|
+
token,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
64
85
|
let token;
|
|
65
86
|
let crowdinCreds;
|
|
66
87
|
if (!isExpired) {
|
|
@@ -74,7 +95,7 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
74
95
|
}
|
|
75
96
|
if (!autoRenew) {
|
|
76
97
|
return {
|
|
77
|
-
client: new crowdin_api_client_1.default({ token, organization, baseUrl: (
|
|
98
|
+
client: new crowdin_api_client_1.default({ token, organization, baseUrl: (_d = config.crowdinUrls) === null || _d === void 0 ? void 0 : _d.apiUrl }, { userAgent }),
|
|
78
99
|
token,
|
|
79
100
|
};
|
|
80
101
|
}
|
|
@@ -104,7 +125,7 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
104
125
|
client: new crowdin_api_client_1.default({
|
|
105
126
|
token,
|
|
106
127
|
organization,
|
|
107
|
-
baseUrl: (
|
|
128
|
+
baseUrl: (_e = config.crowdinUrls) === null || _e === void 0 ? void 0 : _e.apiUrl,
|
|
108
129
|
}, {
|
|
109
130
|
httpClient: {
|
|
110
131
|
get(url, httpConfig) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.101.0",
|
|
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",
|
|
@@ -21,16 +21,21 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@aws-sdk/client-s3": "^3.758.0",
|
|
23
23
|
"@aws-sdk/s3-request-presigner": "^3.758.0",
|
|
24
|
-
"@crowdin/crowdin-apps-functions": "^0.12.
|
|
25
|
-
"@crowdin/logs-formatter": "^2.1.
|
|
24
|
+
"@crowdin/crowdin-apps-functions": "^0.12.4",
|
|
25
|
+
"@crowdin/logs-formatter": "^2.1.9",
|
|
26
26
|
"@godaddy/terminus": "^4.12.1",
|
|
27
|
+
"@types/cors": "^2.8.19",
|
|
28
|
+
"@types/lodash.kebabcase": "^4.1.9",
|
|
29
|
+
"ajv": "^8.17.1",
|
|
27
30
|
"amqplib": "^0.10.8",
|
|
31
|
+
"cors": "^2.8.5",
|
|
28
32
|
"crypto-js": "^4.2.0",
|
|
29
33
|
"express": "^4.21.2",
|
|
30
34
|
"express-handlebars": "^5.3.5",
|
|
31
35
|
"express-rate-limit": "^7.5.0",
|
|
32
36
|
"lodash.get": "^4.4.2",
|
|
33
37
|
"lodash.isstring": "^4.0.1",
|
|
38
|
+
"lodash.kebabcase": "^4.1.1",
|
|
34
39
|
"lodash.snakecase": "^4.1.1",
|
|
35
40
|
"lodash.uniqby": "^4.7.0",
|
|
36
41
|
"minimatch": "^10.0.3",
|