@crowdin/app-project-module 0.82.0 → 0.83.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 +43 -17
- package/out/middlewares/render-ui-module.js +6 -2
- package/out/modules/integration/handlers/oauth-login.js +3 -1
- package/out/modules/integration/handlers/oauth-url.js +1 -1
- package/out/modules/integration/util/cron.js +1 -1
- package/out/modules/manifest.js +1 -1
- package/out/modules/status.d.ts +4 -0
- package/out/modules/status.js +74 -0
- package/out/static/js/form.js +11 -11
- package/out/storage/index.d.ts +2 -3
- package/out/storage/index.js +3 -3
- package/out/storage/mysql.d.ts +1 -1
- package/out/storage/mysql.js +11 -2
- package/out/storage/postgre.d.ts +1 -1
- package/out/storage/postgre.js +11 -2
- package/out/storage/sqlite.d.ts +1 -1
- package/out/storage/sqlite.js +11 -2
- package/out/types.d.ts +12 -0
- package/package.json +2 -1
package/out/storage/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, In
|
|
|
2
2
|
import { Config, CrowdinCredentials, UnauthorizedConfig } from '../types';
|
|
3
3
|
import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles } from '../modules/integration/util/types';
|
|
4
4
|
import { UserErrors } from './types';
|
|
5
|
-
declare const TABLES: {
|
|
5
|
+
export declare const TABLES: {
|
|
6
6
|
crowdin_credentials: string;
|
|
7
7
|
integration_credentials: string;
|
|
8
8
|
sync_settings: string;
|
|
@@ -36,7 +36,7 @@ export interface Storage {
|
|
|
36
36
|
getAllMetadata(): Promise<any[] | undefined>;
|
|
37
37
|
deleteMetadata(id: string): Promise<void>;
|
|
38
38
|
getSyncSettingsByProvider(integrationId: string, provider: Provider): Promise<IntegrationSyncSettings | undefined>;
|
|
39
|
-
|
|
39
|
+
getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
|
|
40
40
|
saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<void>;
|
|
41
41
|
updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<void>;
|
|
42
42
|
getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: Provider): Promise<IntegrationSyncSettings | undefined>;
|
|
@@ -82,4 +82,3 @@ export interface Storage {
|
|
|
82
82
|
}
|
|
83
83
|
export declare function initialize(config: Config | UnauthorizedConfig): Promise<void>;
|
|
84
84
|
export declare function getStorage(): Storage;
|
|
85
|
-
export {};
|
package/out/storage/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getStorage = exports.initialize = void 0;
|
|
39
|
+
exports.getStorage = exports.initialize = exports.TABLES = void 0;
|
|
40
40
|
const types_1 = require("../types");
|
|
41
41
|
const logger_1 = require("../util/logger");
|
|
42
42
|
const mysql_1 = require("./mysql");
|
|
@@ -46,7 +46,7 @@ const path_1 = __importStar(require("path"));
|
|
|
46
46
|
const fs_1 = __importDefault(require("fs"));
|
|
47
47
|
const child_process_1 = require("child_process");
|
|
48
48
|
const util = __importStar(require("node:util"));
|
|
49
|
-
|
|
49
|
+
exports.TABLES = {
|
|
50
50
|
crowdin_credentials: 'crowdin_credentials',
|
|
51
51
|
integration_credentials: 'integration_credentials',
|
|
52
52
|
sync_settings: 'sync_settings',
|
|
@@ -102,7 +102,7 @@ function createDumpForMigration(config) {
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
(0, logger_1.log)('Creating dump for migration from SQLite to PostgreSQL');
|
|
105
|
-
for (const tableName in TABLES) {
|
|
105
|
+
for (const tableName in exports.TABLES) {
|
|
106
106
|
(0, logger_1.log)(`Creating dump for table ${tableName}`);
|
|
107
107
|
const dumpFileName = util.format(types_1.storageFiles.DUMP, tableName);
|
|
108
108
|
const dumpFilePath = path_1.default.join(config.dbFolder, dumpFileName);
|
package/out/storage/mysql.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class MySQLStorage implements Storage {
|
|
|
52
52
|
getAllMetadata(): Promise<any[]>;
|
|
53
53
|
deleteMetadata(id: string): Promise<void>;
|
|
54
54
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
55
|
-
|
|
55
|
+
getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
|
|
56
56
|
saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
57
57
|
updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
58
58
|
getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
package/out/storage/mysql.js
CHANGED
|
@@ -356,11 +356,20 @@ class MySQLStorage {
|
|
|
356
356
|
}));
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
getSyncSettingsBySchedule(type, schedule) {
|
|
360
360
|
return __awaiter(this, void 0, void 0, function* () {
|
|
361
361
|
yield this.dbPromise;
|
|
362
362
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
363
|
-
const [rows] = yield connection.execute(
|
|
363
|
+
const [rows] = yield connection.execute(`
|
|
364
|
+
SELECT s.id, s.files, s.integration_id as "integrationId", s.crowdin_id as "crowdinId", s.type, s.provider
|
|
365
|
+
FROM sync_settings s
|
|
366
|
+
INNER JOIN integration_settings i ON s.integration_id = i.integration_id
|
|
367
|
+
WHERE s.type = ?
|
|
368
|
+
AND CASE
|
|
369
|
+
WHEN i.config IS NULL THEN false
|
|
370
|
+
ELSE JSON_EXTRACT(i.config, '$.schedule') = ?
|
|
371
|
+
END
|
|
372
|
+
`, [type, schedule]);
|
|
364
373
|
return rows || [];
|
|
365
374
|
}));
|
|
366
375
|
});
|
package/out/storage/postgre.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export declare class PostgreStorage implements Storage {
|
|
|
66
66
|
getAllMetadata(): Promise<any[]>;
|
|
67
67
|
deleteMetadata(id: string): Promise<void>;
|
|
68
68
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
69
|
-
|
|
69
|
+
getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
|
|
70
70
|
saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
71
71
|
updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
72
72
|
getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
package/out/storage/postgre.js
CHANGED
|
@@ -439,11 +439,20 @@ class PostgreStorage {
|
|
|
439
439
|
}));
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
|
-
|
|
442
|
+
getSyncSettingsBySchedule(type, schedule) {
|
|
443
443
|
return __awaiter(this, void 0, void 0, function* () {
|
|
444
444
|
yield this.dbPromise;
|
|
445
445
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
446
|
-
const res = yield client.query(
|
|
446
|
+
const res = yield client.query(`
|
|
447
|
+
SELECT s.id, s.files, s.integration_id as "integrationId", s.crowdin_id as "crowdinId", s.type, s.provider
|
|
448
|
+
FROM sync_settings s
|
|
449
|
+
INNER JOIN integration_settings i ON s.integration_id = i.integration_id
|
|
450
|
+
WHERE s.type = $1
|
|
451
|
+
AND CASE
|
|
452
|
+
WHEN i.config IS NULL THEN false
|
|
453
|
+
ELSE (i.config::json->>'schedule') = $2
|
|
454
|
+
END
|
|
455
|
+
`, [type, schedule]);
|
|
447
456
|
return (res === null || res === void 0 ? void 0 : res.rows) || [];
|
|
448
457
|
}));
|
|
449
458
|
});
|
package/out/storage/sqlite.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare class SQLiteStorage implements Storage {
|
|
|
55
55
|
getAllMetadata(): Promise<any[]>;
|
|
56
56
|
deleteMetadata(id: string): Promise<void>;
|
|
57
57
|
getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
|
58
|
-
|
|
58
|
+
getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
|
|
59
59
|
saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
60
60
|
updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
|
|
61
61
|
getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
|
package/out/storage/sqlite.js
CHANGED
|
@@ -432,8 +432,17 @@ class SQLiteStorage {
|
|
|
432
432
|
}
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
|
-
|
|
436
|
-
return this.each(
|
|
435
|
+
getSyncSettingsBySchedule(type, schedule) {
|
|
436
|
+
return this.each(`
|
|
437
|
+
SELECT s.id, s.files, s.integration_id as integrationId, s.crowdin_id as crowdinId, s.type, s.provider
|
|
438
|
+
FROM sync_settings s
|
|
439
|
+
INNER JOIN integration_settings i ON s.integration_id = i.integration_id
|
|
440
|
+
WHERE s.type = ?
|
|
441
|
+
AND CASE
|
|
442
|
+
WHEN i.config IS NULL THEN 0
|
|
443
|
+
ELSE json_extract(i.config, '$.schedule') = ?
|
|
444
|
+
END
|
|
445
|
+
`, [type, schedule]);
|
|
437
446
|
}
|
|
438
447
|
saveSyncSettings(files, integrationId, crowdinId, type, provider) {
|
|
439
448
|
return this.run('INSERT INTO sync_settings(files, integration_id, crowdin_id, type, provider) VALUES (?, ?, ?, ?, ?)', [files, integrationId, crowdinId, type, provider]);
|
package/out/types.d.ts
CHANGED
|
@@ -183,6 +183,14 @@ export interface ClientConfig extends ImagePath {
|
|
|
183
183
|
* Configuration to log everything that are happening in the app
|
|
184
184
|
*/
|
|
185
185
|
logger?: Logger;
|
|
186
|
+
/**
|
|
187
|
+
* Enable status page with optional db and filesystem checks
|
|
188
|
+
*/
|
|
189
|
+
enableStatusPage?: {
|
|
190
|
+
database?: boolean;
|
|
191
|
+
filesystem?: boolean;
|
|
192
|
+
rateLimit?: number;
|
|
193
|
+
};
|
|
186
194
|
/**
|
|
187
195
|
* Configuration of app pricing
|
|
188
196
|
*/
|
|
@@ -246,6 +254,10 @@ export interface ClientConfig extends ImagePath {
|
|
|
246
254
|
* workflow step modules
|
|
247
255
|
*/
|
|
248
256
|
workflowStepType?: WorkflowStepTypeModule | WorkflowStepTypeModule[];
|
|
257
|
+
/**
|
|
258
|
+
* property that tells backend that AiProvider and AiPromptProvider modules can cooperate only with each one
|
|
259
|
+
*/
|
|
260
|
+
restrictAiToSameApp: boolean;
|
|
249
261
|
}
|
|
250
262
|
export interface Environments {
|
|
251
263
|
environments?: Environment | Environment[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.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",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"crypto-js": "^4.2.0",
|
|
30
30
|
"express": "^4.21.2",
|
|
31
31
|
"express-handlebars": "^5.3.5",
|
|
32
|
+
"express-rate-limit": "^7.5.0",
|
|
32
33
|
"lodash.get": "^4.4.2",
|
|
33
34
|
"lodash.isstring": "^4.0.1",
|
|
34
35
|
"lodash.snakecase": "^4.1.1",
|