@crowdin/app-project-module 0.82.0 → 0.82.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 +15 -17
- package/out/middlewares/render-ui-module.js +6 -2
- package/out/modules/integration/util/cron.js +1 -1
- package/out/storage/index.d.ts +1 -1
- 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/package.json +1 -1
package/out/index.js
CHANGED
|
@@ -220,28 +220,26 @@ function addCrowdinEndpoints(app, clientConfig) {
|
|
|
220
220
|
}
|
|
221
221
|
exports.addCrowdinEndpoints = addCrowdinEndpoints;
|
|
222
222
|
function addFormSchema({ app, config }) {
|
|
223
|
-
let moduleConfigWithForm = null;
|
|
224
223
|
for (const moduleKey of Object.keys(config)) {
|
|
225
224
|
const moduleConfig = config[moduleKey];
|
|
226
225
|
if ((0, form_schema_1.hasFormSchema)(moduleConfig)) {
|
|
227
|
-
moduleConfigWithForm = (0, form_schema_1.getLowCodeUiConfigFromModuleConfig)(moduleConfig);
|
|
228
|
-
|
|
226
|
+
const moduleConfigWithForm = (0, form_schema_1.getLowCodeUiConfigFromModuleConfig)(moduleConfig);
|
|
227
|
+
if (moduleConfigWithForm) {
|
|
228
|
+
app.get(`/api/${moduleConfigWithForm.key}/form-data`, json_response_1.default, (0, crowdin_client_1.default)({
|
|
229
|
+
config,
|
|
230
|
+
optional: false,
|
|
231
|
+
checkSubscriptionExpiration: true,
|
|
232
|
+
moduleKey: moduleConfigWithForm.key,
|
|
233
|
+
}), (0, credentials_masker_1.getRequestCredentialsMasker)({ moduleConfig: moduleConfigWithForm }), (0, form_data_display_1.default)(config));
|
|
234
|
+
app.post(`/api/${moduleConfigWithForm.key}/form-data`, (0, crowdin_client_1.default)({
|
|
235
|
+
config,
|
|
236
|
+
optional: false,
|
|
237
|
+
checkSubscriptionExpiration: true,
|
|
238
|
+
moduleKey: moduleConfigWithForm.key,
|
|
239
|
+
}), (0, credentials_masker_1.postRequestCredentialsMasker)(moduleConfigWithForm), (0, form_data_save_1.default)(config));
|
|
240
|
+
}
|
|
229
241
|
}
|
|
230
242
|
}
|
|
231
|
-
if (moduleConfigWithForm) {
|
|
232
|
-
app.get('/api/form-data', json_response_1.default, (0, crowdin_client_1.default)({
|
|
233
|
-
config,
|
|
234
|
-
optional: false,
|
|
235
|
-
checkSubscriptionExpiration: true,
|
|
236
|
-
moduleKey: moduleConfigWithForm.key,
|
|
237
|
-
}), (0, credentials_masker_1.getRequestCredentialsMasker)({ moduleConfig: moduleConfigWithForm }), (0, form_data_display_1.default)(config));
|
|
238
|
-
app.post('/api/form-data', (0, crowdin_client_1.default)({
|
|
239
|
-
config,
|
|
240
|
-
optional: false,
|
|
241
|
-
checkSubscriptionExpiration: true,
|
|
242
|
-
moduleKey: moduleConfigWithForm.key,
|
|
243
|
-
}), (0, credentials_masker_1.postRequestCredentialsMasker)(moduleConfigWithForm), (0, form_data_save_1.default)(config));
|
|
244
|
-
}
|
|
245
243
|
}
|
|
246
244
|
function convertClientConfig(clientConfig) {
|
|
247
245
|
const baseUrl = clientConfig.baseUrl || process.env.URL;
|
|
@@ -18,8 +18,12 @@ function handle(moduleConfig) {
|
|
|
18
18
|
return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
if (moduleConfig.formSchema) {
|
|
20
20
|
return res.render('form', {
|
|
21
|
-
formGetDataUrl: moduleConfig.formGetDataUrl
|
|
22
|
-
|
|
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`,
|
|
23
27
|
formSchema: JSON.stringify(moduleConfig.formSchema),
|
|
24
28
|
formUiSchema: moduleConfig.formUiSchema ? JSON.stringify(moduleConfig.formUiSchema) : '{}',
|
|
25
29
|
});
|
|
@@ -130,7 +130,7 @@ exports.runUpdateProviderJob = runUpdateProviderJob;
|
|
|
130
130
|
function filesCron({ config, integration, period, }) {
|
|
131
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
132
|
(0, logger_1.log)(`Starting files cron job with period [${period}]`);
|
|
133
|
-
const syncSettingsList = yield (0, storage_1.getStorage)().
|
|
133
|
+
const syncSettingsList = yield (0, storage_1.getStorage)().getSyncSettingsBySchedule('schedule', period);
|
|
134
134
|
const crowdinSyncSettings = syncSettingsList.filter((syncSettings) => syncSettings.provider === types_1.Provider.CROWDIN);
|
|
135
135
|
const integrationSyncSettings = syncSettingsList.filter((syncSettings) => syncSettings.provider === types_1.Provider.INTEGRATION);
|
|
136
136
|
yield Promise.all(crowdinSyncSettings.map((syncSettings) => processSyncSettings({ config, integration, period, syncSettings })));
|
package/out/storage/index.d.ts
CHANGED
|
@@ -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>;
|
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/package.json
CHANGED