@crowdin/app-project-module 0.69.0 → 0.70.1
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 +16 -3
- package/out/modules/ai-provider/handlers/chat-completions.js +20 -21
- package/out/modules/ai-provider/handlers/get-model-list.js +3 -2
- package/out/modules/ai-provider/types.d.ts +112 -7
- package/out/modules/ai-provider/util/index.d.ts +5 -0
- package/out/modules/ai-provider/util/index.js +72 -1
- package/out/modules/file-processing/handlers/pre-post-process.js +6 -0
- package/out/modules/file-processing/types.d.ts +16 -8
- package/out/modules/manifest.js +34 -0
- package/out/modules/organization-settings-menu/index.d.ts +6 -0
- package/out/modules/organization-settings-menu/index.js +18 -0
- package/out/modules/profile-settings-menu/index.d.ts +6 -0
- package/out/modules/profile-settings-menu/index.js +18 -0
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +2 -2
- package/out/modules/webhooks/handlers/webhook-handler.js +9 -6
- package/out/modules/webhooks/index.js +1 -1
- package/out/modules/webhooks/types.d.ts +2 -0
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +5 -0
- package/out/modules/workflow-step-type/handlers/delete-step.js +70 -0
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +5 -0
- package/out/modules/workflow-step-type/handlers/step-settings-save.js +80 -0
- package/out/modules/workflow-step-type/index.d.ts +6 -0
- package/out/modules/workflow-step-type/index.js +36 -0
- package/out/modules/workflow-step-type/types.d.ts +57 -0
- package/out/modules/workflow-step-type/types.js +2 -0
- package/out/modules/workflow-step-type/util/index.d.ts +3 -0
- package/out/modules/workflow-step-type/util/index.js +16 -0
- package/out/static/js/form.js +32 -32
- package/out/storage/index.d.ts +1 -0
- package/out/storage/mysql.d.ts +1 -0
- package/out/storage/mysql.js +9 -0
- package/out/storage/postgre.d.ts +1 -0
- package/out/storage/postgre.js +9 -0
- package/out/storage/sqlite.d.ts +1 -0
- package/out/storage/sqlite.js +3 -0
- package/out/types.d.ts +14 -1
- package/out/util/logger.d.ts +5 -2
- package/out/util/logger.js +26 -10
- package/package.json +14 -8
package/out/storage/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface Storage {
|
|
|
18
18
|
saveMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
19
19
|
updateMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
20
20
|
getMetadata(id: string): Promise<any | undefined>;
|
|
21
|
+
getAllMetadata(): Promise<any[] | undefined>;
|
|
21
22
|
deleteMetadata(id: string): Promise<void>;
|
|
22
23
|
getSyncSettingsByProvider(integrationId: string, provider: Provider): Promise<IntegrationSyncSettings | undefined>;
|
|
23
24
|
getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
|
package/out/storage/mysql.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare class MySQLStorage implements Storage {
|
|
|
35
35
|
saveMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
|
|
36
36
|
updateMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
37
37
|
getMetadata(id: string): Promise<any>;
|
|
38
|
+
getAllMetadata(): Promise<any[]>;
|
|
38
39
|
deleteMetadata(id: string): Promise<void>;
|
|
39
40
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
40
41
|
getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
|
package/out/storage/mysql.js
CHANGED
|
@@ -340,6 +340,15 @@ class MySQLStorage {
|
|
|
340
340
|
}));
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
|
+
getAllMetadata() {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
+
yield this.dbPromise;
|
|
346
|
+
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
const [rows] = yield connection.execute('SELECT * FROM app_metadata');
|
|
348
|
+
return rows || [];
|
|
349
|
+
}));
|
|
350
|
+
});
|
|
351
|
+
}
|
|
343
352
|
deleteMetadata(id) {
|
|
344
353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
345
354
|
yield this.dbPromise;
|
package/out/storage/postgre.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare class PostgreStorage implements Storage {
|
|
|
42
42
|
saveMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
|
|
43
43
|
updateMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
44
44
|
getMetadata(id: string): Promise<any>;
|
|
45
|
+
getAllMetadata(): Promise<any[]>;
|
|
45
46
|
deleteMetadata(id: string): Promise<void>;
|
|
46
47
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
47
48
|
getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
|
package/out/storage/postgre.js
CHANGED
|
@@ -367,6 +367,15 @@ class PostgreStorage {
|
|
|
367
367
|
}));
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
|
+
getAllMetadata() {
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
yield this.dbPromise;
|
|
373
|
+
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
374
|
+
const res = yield client.query('SELECT * FROM app_metadata');
|
|
375
|
+
return (res === null || res === void 0 ? void 0 : res.rows) || [];
|
|
376
|
+
}));
|
|
377
|
+
});
|
|
378
|
+
}
|
|
370
379
|
deleteMetadata(id) {
|
|
371
380
|
return __awaiter(this, void 0, void 0, function* () {
|
|
372
381
|
yield this.dbPromise;
|
package/out/storage/sqlite.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export declare class SQLiteStorage implements Storage {
|
|
|
37
37
|
saveMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
38
38
|
updateMetadata(id: string, metadata: any, crowdinId?: string): Promise<void>;
|
|
39
39
|
getMetadata(id: string): Promise<any>;
|
|
40
|
+
getAllMetadata(): Promise<any[]>;
|
|
40
41
|
deleteMetadata(id: string): Promise<void>;
|
|
41
42
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
42
43
|
getAllSyncSettingsByType(type: string): Promise<IntegrationSyncSettings[]>;
|
package/out/storage/sqlite.js
CHANGED
|
@@ -405,6 +405,9 @@ class SQLiteStorage {
|
|
|
405
405
|
}
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
|
+
getAllMetadata() {
|
|
409
|
+
return this.each('SELECT * FROM app_metadata', []);
|
|
410
|
+
}
|
|
408
411
|
deleteMetadata(id) {
|
|
409
412
|
return __awaiter(this, void 0, void 0, function* () {
|
|
410
413
|
yield this.run('DELETE FROM app_metadata where id = ?', [id]);
|
package/out/types.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { AiPromptProviderModule } from './modules/ai-prompt-provider/types';
|
|
|
16
16
|
import { AiTool, AiToolWidget } from './modules/ai-tools/types';
|
|
17
17
|
import { ExternalQaCheckModule } from './modules/external-qa-check/types';
|
|
18
18
|
import { Webhook } from './modules/webhooks/types';
|
|
19
|
+
import { WorkflowStepTypeModule } from './modules/workflow-step-type/types';
|
|
19
20
|
export interface ClientConfig extends ImagePath {
|
|
20
21
|
/**
|
|
21
22
|
* Authentication Crowdin App type: "authorization_code", "crowdin_app", "crowdin_agent". Default: "crowdin_app"
|
|
@@ -105,10 +106,18 @@ export interface ClientConfig extends ImagePath {
|
|
|
105
106
|
* resources module
|
|
106
107
|
*/
|
|
107
108
|
profileResourcesMenu?: UiModule & ImagePath & Environments;
|
|
109
|
+
/**
|
|
110
|
+
* profile-settings-menu module
|
|
111
|
+
*/
|
|
112
|
+
profileSettingsMenu?: UiModule & ImagePath & Environments;
|
|
108
113
|
/**
|
|
109
114
|
* organization-menu module
|
|
110
115
|
*/
|
|
111
116
|
organizationMenu?: UiModule & ImagePath;
|
|
117
|
+
/**
|
|
118
|
+
* organization-settings-menu module
|
|
119
|
+
*/
|
|
120
|
+
organizationSettingsMenu?: UiModule & ImagePath;
|
|
112
121
|
/**
|
|
113
122
|
* editor-right-panel module
|
|
114
123
|
*/
|
|
@@ -211,6 +220,10 @@ export interface ClientConfig extends ImagePath {
|
|
|
211
220
|
* webhook modules
|
|
212
221
|
*/
|
|
213
222
|
webhooks?: Webhook | Webhook[];
|
|
223
|
+
/**
|
|
224
|
+
* workflow step modules
|
|
225
|
+
*/
|
|
226
|
+
workflowStepType?: WorkflowStepTypeModule | WorkflowStepTypeModule[];
|
|
214
227
|
}
|
|
215
228
|
export interface Environments {
|
|
216
229
|
environments?: Environment | Environment[];
|
|
@@ -331,7 +344,7 @@ export interface CrowdinAppUtilities extends CrowdinMetadataStore {
|
|
|
331
344
|
crowdinId: string;
|
|
332
345
|
extra: Record<string, any>;
|
|
333
346
|
}) => string;
|
|
334
|
-
dencryptCrowdinConnection: (hash: string) => Promise<{
|
|
347
|
+
dencryptCrowdinConnection: (hash: string, autoRenew?: boolean) => Promise<{
|
|
335
348
|
client: Crowdin;
|
|
336
349
|
extra: Record<string, any>;
|
|
337
350
|
}>;
|
package/out/util/logger.d.ts
CHANGED
|
@@ -26,9 +26,12 @@ export declare class AppModuleError extends Error {
|
|
|
26
26
|
isAxiosError: boolean;
|
|
27
27
|
constructor(error: CustomAxiosError | Error | string, data?: any);
|
|
28
28
|
}
|
|
29
|
+
export declare class AppUserModuleError extends AppModuleError {
|
|
30
|
+
constructor(error: CustomAxiosError | Error | string, data?: any);
|
|
31
|
+
}
|
|
29
32
|
export declare class AppModuleAggregateError extends Error {
|
|
30
|
-
errors: Error[] | AppModuleError[];
|
|
31
|
-
constructor(errors: Error[] | AppModuleError[], message: string);
|
|
33
|
+
errors: Error[] | AppModuleError[] | AppUserModuleError[];
|
|
34
|
+
constructor(errors: Error[] | AppModuleError[] | AppUserModuleError[], message: string);
|
|
32
35
|
}
|
|
33
36
|
export declare function handleUserError({ action, error, crowdinId, clientId, }: {
|
|
34
37
|
action: string;
|
package/out/util/logger.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.temporaryErrorDebug = exports.handleUserError = exports.AppModuleAggregateError = exports.AppModuleError = exports.getErrorMessage = exports.isAxiosError = exports.logError = exports.log = exports.withContextError = exports.withContext = exports.prepareContext = exports.initialize = void 0;
|
|
35
|
+
exports.temporaryErrorDebug = exports.handleUserError = exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = exports.getErrorMessage = exports.isAxiosError = exports.logError = exports.log = exports.withContextError = exports.withContext = exports.prepareContext = exports.initialize = void 0;
|
|
36
36
|
const logsFormatter = __importStar(require("@crowdin/logs-formatter"));
|
|
37
37
|
const storage_1 = require("../storage");
|
|
38
38
|
let logConfig;
|
|
@@ -138,6 +138,9 @@ function logError(e, context) {
|
|
|
138
138
|
exports.logError = logError;
|
|
139
139
|
function errorOutputByType(error) {
|
|
140
140
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
141
|
+
if (error instanceof AppUserModuleError) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
141
144
|
const message = error.message || error;
|
|
142
145
|
if (isAxiosError(error)) {
|
|
143
146
|
const request = (error === null || error === void 0 ? void 0 : error.config) || ((_a = error.data) === null || _a === void 0 ? void 0 : _a.config)
|
|
@@ -193,6 +196,13 @@ class AppModuleError extends Error {
|
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
exports.AppModuleError = AppModuleError;
|
|
199
|
+
class AppUserModuleError extends AppModuleError {
|
|
200
|
+
constructor(error, data) {
|
|
201
|
+
super(error, data);
|
|
202
|
+
this.name = 'AppUserModuleError';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.AppUserModuleError = AppUserModuleError;
|
|
196
206
|
class AppModuleAggregateError extends Error {
|
|
197
207
|
constructor(errors, message) {
|
|
198
208
|
super(message);
|
|
@@ -218,7 +228,7 @@ function storeUserError({ action, error, crowdinId, clientId, }) {
|
|
|
218
228
|
statusText: ((_u = error === null || error === void 0 ? void 0 : error.response) === null || _u === void 0 ? void 0 : _u.statusText) || ((_w = (_v = error === null || error === void 0 ? void 0 : error.data) === null || _v === void 0 ? void 0 : _v.response) === null || _w === void 0 ? void 0 : _w.statusText),
|
|
219
229
|
};
|
|
220
230
|
}
|
|
221
|
-
if (error instanceof AppModuleError && error.appData) {
|
|
231
|
+
if ((error instanceof AppModuleError || error instanceof AppUserModuleError) && error.appData) {
|
|
222
232
|
data.appData = error.appData;
|
|
223
233
|
}
|
|
224
234
|
yield (0, storage_1.getStorage)().saveUserError(action, (error === null || error === void 0 ? void 0 : error.message) || JSON.stringify(error, null, 2), JSON.stringify(data), `${Date.now()}`, crowdinId, clientId);
|
|
@@ -226,28 +236,34 @@ function storeUserError({ action, error, crowdinId, clientId, }) {
|
|
|
226
236
|
}
|
|
227
237
|
function mergeAppModuleAggregateErrors(errors) {
|
|
228
238
|
const result = [];
|
|
229
|
-
const mergedData = {
|
|
239
|
+
const mergedData = {
|
|
240
|
+
AppModuleError: {},
|
|
241
|
+
AppUserModuleError: {},
|
|
242
|
+
};
|
|
230
243
|
for (const errorItem of errors) {
|
|
231
|
-
if (errorItem instanceof AppModuleError) {
|
|
244
|
+
if (errorItem instanceof AppModuleError || errorItem instanceof AppUserModuleError) {
|
|
232
245
|
if (typeof errorItem.appData === 'object' &&
|
|
233
246
|
errorItem.appData !== null &&
|
|
234
247
|
!Array.isArray(errorItem.appData)) {
|
|
235
|
-
if (!mergedData[errorItem.message]) {
|
|
236
|
-
mergedData[errorItem.message] = {};
|
|
248
|
+
if (!mergedData[errorItem.name][errorItem.message]) {
|
|
249
|
+
mergedData[errorItem.name][errorItem.message] = {};
|
|
237
250
|
}
|
|
238
251
|
for (const key in errorItem.appData) {
|
|
239
|
-
mergedData[errorItem.message][key] = (mergedData[errorItem.message][key] || []).concat(errorItem.appData[key]);
|
|
252
|
+
mergedData[errorItem.name][errorItem.message][key] = (mergedData[errorItem.name][errorItem.message][key] || []).concat(errorItem.appData[key]);
|
|
240
253
|
}
|
|
241
254
|
}
|
|
242
255
|
else if (errorItem.appData) {
|
|
243
|
-
mergedData[errorItem.message] = (mergedData[errorItem.message] || []).concat(errorItem.appData);
|
|
256
|
+
mergedData[errorItem.name][errorItem.message] = (mergedData[errorItem.name][errorItem.message] || []).concat(errorItem.appData);
|
|
244
257
|
}
|
|
245
258
|
continue;
|
|
246
259
|
}
|
|
247
260
|
result.push(errorItem);
|
|
248
261
|
}
|
|
249
|
-
for (const key in mergedData) {
|
|
250
|
-
result.push(new AppModuleError(key, mergedData[key]));
|
|
262
|
+
for (const key in mergedData.AppModuleError) {
|
|
263
|
+
result.push(new AppModuleError(key, mergedData.AppModuleError[key]));
|
|
264
|
+
}
|
|
265
|
+
for (const key in mergedData.AppUserModuleError) {
|
|
266
|
+
result.push(new AppUserModuleError(key, mergedData.AppUserModuleError[key]));
|
|
251
267
|
}
|
|
252
268
|
return result;
|
|
253
269
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.1",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -p ./ && cp -R views out && cp -R static out && cp logo.png out && rollup -c rollup.config.mjs",
|
|
9
9
|
"build-main": "tsc -p ./ && cp -R views out && cp -R static out && cp logo.png out",
|
|
10
|
+
"build-form": "tsc -p ./ && cp -R static/js/form out/static/js && rollup -c rollup.config.mjs",
|
|
10
11
|
"watch-main": "tsc --watch -p ./ && cp -R views out && cp -R static out && cp logo.png out",
|
|
11
12
|
"lint": "eslint --fix \"{src,tests}/**/*.{js,ts}\"",
|
|
12
13
|
"prettier": "prettier --config .prettierrc src/**/*.ts --write",
|
|
@@ -19,18 +20,20 @@
|
|
|
19
20
|
],
|
|
20
21
|
"dependencies": {
|
|
21
22
|
"@aws-sdk/client-s3": "^3.606.0",
|
|
22
|
-
"@aws-sdk/s3-request-presigner": "^3.
|
|
23
|
+
"@aws-sdk/s3-request-presigner": "^3.682.0",
|
|
23
24
|
"@crowdin/crowdin-apps-functions": "0.9.0",
|
|
24
25
|
"@crowdin/logs-formatter": "^2.1.6",
|
|
25
26
|
"@godaddy/terminus": "^4.12.1",
|
|
27
|
+
"@monaco-editor/react": "^4.6.0",
|
|
26
28
|
"amqplib": "^0.10.4",
|
|
27
29
|
"crypto-js": "^4.2.0",
|
|
28
30
|
"express": "^4.21.0",
|
|
29
31
|
"express-handlebars": "^5.3.5",
|
|
30
32
|
"lodash.get": "^4.4.2",
|
|
31
33
|
"lodash.isstring": "^4.0.1",
|
|
34
|
+
"lodash.snakecase": "^4.1.1",
|
|
32
35
|
"lodash.uniqby": "^4.7.0",
|
|
33
|
-
"mysql2": "^3.
|
|
36
|
+
"mysql2": "^3.11.3",
|
|
34
37
|
"node-cron": "^3.0.3",
|
|
35
38
|
"pg": "^8.13.0",
|
|
36
39
|
"redoc-express": "^2.1.0",
|
|
@@ -40,17 +43,18 @@
|
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"@babel/preset-react": "^7.24.7",
|
|
43
|
-
"@emotion/react": "^11.13.
|
|
46
|
+
"@emotion/react": "^11.13.3",
|
|
44
47
|
"@emotion/styled": "^11.11.5",
|
|
45
48
|
"@mui/icons-material": "^5.16.7",
|
|
46
49
|
"@mui/material": "^5.16.7",
|
|
47
|
-
"@rjsf/core": "^5.
|
|
48
|
-
"@rjsf/mui": "^5.
|
|
50
|
+
"@rjsf/core": "^5.22.3",
|
|
51
|
+
"@rjsf/mui": "^5.22.3",
|
|
49
52
|
"@rjsf/utils": "^5.21.1",
|
|
50
|
-
"@rjsf/validator-ajv8": "^5.
|
|
53
|
+
"@rjsf/validator-ajv8": "^5.22.3",
|
|
51
54
|
"@rollup/plugin-babel": "^6.0.4",
|
|
52
55
|
"@rollup/plugin-commonjs": "^24.1.0",
|
|
53
56
|
"@rollup/plugin-json": "^6.1.0",
|
|
57
|
+
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
54
58
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
55
59
|
"@rollup/plugin-replace": "^5.0.7",
|
|
56
60
|
"@rollup/plugin-terser": "^0.4.3",
|
|
@@ -61,6 +65,7 @@
|
|
|
61
65
|
"@types/jest": "^29.5.12",
|
|
62
66
|
"@types/lodash.get": "^4.4.9",
|
|
63
67
|
"@types/lodash.isstring": "^4.0.9",
|
|
68
|
+
"@types/lodash.snakecase": "^4.1.9",
|
|
64
69
|
"@types/lodash.uniqby": "^4.7.9",
|
|
65
70
|
"@types/node": "^16.18.112",
|
|
66
71
|
"@types/node-cron": "^3.0.11",
|
|
@@ -79,7 +84,8 @@
|
|
|
79
84
|
"react": "^18.3.1",
|
|
80
85
|
"react-dom": "^18.3.1",
|
|
81
86
|
"rollup": "^3.29.4",
|
|
82
|
-
"
|
|
87
|
+
"rollup-plugin-delete": "^2.1.0",
|
|
88
|
+
"ts-jest": "^29.2.5",
|
|
83
89
|
"typescript": "^4.9.5"
|
|
84
90
|
},
|
|
85
91
|
"repository": {
|