@crowdin/app-project-module 0.93.0 → 0.94.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/modules/integration/util/cron.js +22 -2
- package/out/modules/integration/util/defaults.js +10 -11
- package/out/static/js/form.js +1 -1
- package/out/storage/index.d.ts +1 -0
- package/out/storage/index.js +1 -0
- package/out/storage/postgre.d.ts +1 -0
- package/out/storage/postgre.js +9 -1
- package/out/views/main.handlebars +63 -10
- package/package.json +1 -1
|
@@ -149,7 +149,7 @@ function filesCron({ config, integration, period, }) {
|
|
|
149
149
|
}
|
|
150
150
|
exports.filesCron = filesCron;
|
|
151
151
|
function processSyncSettings({ config, integration, period, syncSettings, }) {
|
|
152
|
-
var _a;
|
|
152
|
+
var _a, _b, _c;
|
|
153
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
154
|
let projectData;
|
|
155
155
|
let crowdinClient;
|
|
@@ -330,12 +330,32 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
|
|
|
330
330
|
parent_id: file.parent_id || file.parentId,
|
|
331
331
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
332
332
|
node_type: file.nodeType || file.node_type }, (file.type ? { type: file.type } : {}))));
|
|
333
|
-
|
|
333
|
+
let intFiles = allIntFiles.filter((file) => 'type' in file);
|
|
334
334
|
if (intFiles.length <= 0) {
|
|
335
335
|
return;
|
|
336
336
|
}
|
|
337
337
|
(0, logger_1.log)(`Executing updateCrowdin task for files cron job with period [${period}] for project ${projectId}. Files ${intFiles.length}`);
|
|
338
338
|
const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
|
|
339
|
+
if (integration.filterByPathIntegrationFiles) {
|
|
340
|
+
const includePatterns = (_b = intConfig === null || intConfig === void 0 ? void 0 : intConfig.includeByFilePath) === null || _b === void 0 ? void 0 : _b.split('\n').filter(Boolean);
|
|
341
|
+
const excludePatterns = (_c = intConfig === null || intConfig === void 0 ? void 0 : intConfig.excludeByFilePath) === null || _c === void 0 ? void 0 : _c.split('\n').filter(Boolean);
|
|
342
|
+
try {
|
|
343
|
+
const fullTreeResult = yield integration.getIntegrationFiles(apiCredentials, intConfig);
|
|
344
|
+
const fullTree = (0, files_1.isExtendedResultType)(fullTreeResult) ? fullTreeResult.data || [] : fullTreeResult;
|
|
345
|
+
const filteredFiles = (0, files_1.filterFilesByPath)(fullTree, includePatterns, excludePatterns);
|
|
346
|
+
const filteredFileIds = new Set(filteredFiles.map((f) => f.id));
|
|
347
|
+
const filteredIntFiles = intFiles.filter((file) => filteredFileIds.has(file.id));
|
|
348
|
+
(0, logger_1.log)(`Path filtering applied: ${intFiles.length} -> ${filteredIntFiles.length} files`);
|
|
349
|
+
if (filteredIntFiles.length === 0) {
|
|
350
|
+
(0, logger_1.log)('No files passed path filtering, skipping sync');
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
intFiles = filteredIntFiles;
|
|
354
|
+
}
|
|
355
|
+
catch (e) {
|
|
356
|
+
(0, logger_1.logError)(e, context);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
339
359
|
try {
|
|
340
360
|
yield runUpdateProviderJob({
|
|
341
361
|
integrationId: syncSettings.integrationId,
|
|
@@ -228,24 +228,26 @@ function applyIntegrationModuleDefaults(config, integration) {
|
|
|
228
228
|
if (integration.uploadTranslations) {
|
|
229
229
|
defaultSettings.push({
|
|
230
230
|
labelHtml: `<b>Translation sync settings (${config.name} → Crowdin)</b>`,
|
|
231
|
+
category: types_1.DefaultCategory.SYNC,
|
|
232
|
+
position: 3,
|
|
231
233
|
}, {
|
|
232
234
|
key: 'importEqSuggestions',
|
|
233
235
|
label: 'Add translations that are the same as the source text',
|
|
234
236
|
type: 'checkbox',
|
|
235
237
|
category: types_1.DefaultCategory.SYNC,
|
|
236
|
-
position:
|
|
238
|
+
position: 4,
|
|
237
239
|
}, {
|
|
238
240
|
key: 'autoApproveImported',
|
|
239
241
|
label: 'Mark added translations as Approved in Crowdin',
|
|
240
242
|
type: 'checkbox',
|
|
241
243
|
category: types_1.DefaultCategory.SYNC,
|
|
242
|
-
position:
|
|
244
|
+
position: 5,
|
|
243
245
|
}, {
|
|
244
246
|
key: 'translateHidden',
|
|
245
247
|
label: 'Add translations for hidden source strings in Crowdin',
|
|
246
248
|
type: 'checkbox',
|
|
247
249
|
category: types_1.DefaultCategory.SYNC,
|
|
248
|
-
position:
|
|
250
|
+
position: 6,
|
|
249
251
|
});
|
|
250
252
|
}
|
|
251
253
|
defaultSettings.push({
|
|
@@ -255,7 +257,7 @@ function applyIntegrationModuleDefaults(config, integration) {
|
|
|
255
257
|
defaultValue: '0',
|
|
256
258
|
dependencySettings: JSON.stringify([{ '#schedule-settings': { type: '!equal', value: ['0'] } }]),
|
|
257
259
|
category: types_1.DefaultCategory.SYNC,
|
|
258
|
-
position:
|
|
260
|
+
position: 7,
|
|
259
261
|
options: [
|
|
260
262
|
{
|
|
261
263
|
value: '0',
|
|
@@ -295,7 +297,6 @@ function applyIntegrationModuleDefaults(config, integration) {
|
|
|
295
297
|
helpText: integration.skipIntegrationNodesToggle.description,
|
|
296
298
|
defaultValue: integration.skipIntegrationNodesToggle.value,
|
|
297
299
|
category: types_1.DefaultCategory.GENERAL,
|
|
298
|
-
position: 7,
|
|
299
300
|
});
|
|
300
301
|
}
|
|
301
302
|
return [...defaultSettings, ...fields];
|
|
@@ -402,13 +403,11 @@ function getOAuthLoginFormId(clientId) {
|
|
|
402
403
|
exports.getOAuthLoginFormId = getOAuthLoginFormId;
|
|
403
404
|
function groupFieldsByCategory(fields) {
|
|
404
405
|
const groupedFields = fields.reduce((acc, field) => {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
acc[category] = [];
|
|
409
|
-
}
|
|
410
|
-
acc[category].push(field);
|
|
406
|
+
const category = (field === null || field === void 0 ? void 0 : field.category) || types_1.DefaultCategory.GENERAL;
|
|
407
|
+
if (!acc[category]) {
|
|
408
|
+
acc[category] = [];
|
|
411
409
|
}
|
|
410
|
+
acc[category].push(field);
|
|
412
411
|
return acc;
|
|
413
412
|
}, {});
|
|
414
413
|
// Sort fields by position within each category
|