@contentstack/cli-cm-import 1.25.1 → 1.26.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/README.md +3 -3
- package/lib/commands/cm/stacks/import.d.ts +1 -0
- package/lib/commands/cm/stacks/import.js +33 -12
- package/lib/import/module-importer.js +1 -1
- package/lib/import/modules/assets.d.ts +1 -1
- package/lib/import/modules/assets.js +93 -39
- package/lib/import/modules/content-types.js +76 -31
- package/lib/import/modules/custom-roles.js +95 -19
- package/lib/import/modules/entries.js +128 -57
- package/lib/import/modules/environments.js +48 -14
- package/lib/import/modules/extensions.js +78 -16
- package/lib/import/modules/global-fields.js +85 -20
- package/lib/import/modules/labels.d.ts +4 -4
- package/lib/import/modules/labels.js +60 -18
- package/lib/import/modules/locales.js +63 -20
- package/lib/import/modules/marketplace-apps.js +160 -31
- package/lib/import/modules/personalize.js +33 -7
- package/lib/import/modules/stack.js +5 -0
- package/lib/import/modules/taxonomies.js +52 -13
- package/lib/import/modules/variant-entries.js +21 -3
- package/lib/import/modules/webhooks.js +44 -12
- package/lib/import/modules/workflows.js +65 -21
- package/lib/types/import-config.d.ts +3 -1
- package/lib/types/index.d.ts +22 -0
- package/lib/utils/asset-helper.js +24 -1
- package/lib/utils/backup-handler.js +15 -1
- package/lib/utils/common-helper.js +41 -16
- package/lib/utils/content-type-helper.js +35 -2
- package/lib/utils/entries-helper.js +24 -2
- package/lib/utils/extension-helper.js +35 -1
- package/lib/utils/import-config-handler.js +21 -0
- package/lib/utils/login-handler.js +8 -4
- package/lib/utils/marketplace-app-helper.js +50 -11
- package/lib/utils/taxonomies-helper.js +22 -4
- package/oclif.manifest.json +2 -2
- package/package.json +5 -5
|
@@ -17,6 +17,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
17
17
|
constructor({ importConfig, stackAPIClient }) {
|
|
18
18
|
super({ importConfig, stackAPIClient });
|
|
19
19
|
this.entriesForVariant = [];
|
|
20
|
+
this.importConfig.context.module = 'entries';
|
|
20
21
|
this.assetUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'assets', 'uid-mapping.json');
|
|
21
22
|
this.assetUrlMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'assets', 'url-mapping.json');
|
|
22
23
|
this.entriesMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'entries');
|
|
@@ -47,73 +48,95 @@ class EntriesImport extends base_class_1.default {
|
|
|
47
48
|
try {
|
|
48
49
|
this.cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, 'schema.json'));
|
|
49
50
|
if (!this.cTs || (0, lodash_1.isEmpty)(this.cTs)) {
|
|
50
|
-
|
|
51
|
+
cli_utilities_1.log.info('No content type found', this.importConfig.context);
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
54
|
+
cli_utilities_1.log.debug(`Found ${this.cTs.length} content types for entry import`, this.importConfig.context);
|
|
53
55
|
this.installedExtensions = ((await utils_1.fsUtil.readFile(this.marketplaceAppMapperPath)) || { extension_uid: {} }).extension_uid;
|
|
56
|
+
cli_utilities_1.log.debug('Loaded installed extensions for entry processing', this.importConfig.context);
|
|
54
57
|
this.assetUidMapper = utils_1.fsUtil.readFile(this.assetUidMapperPath) || {};
|
|
55
58
|
this.assetUrlMapper = utils_1.fsUtil.readFile(this.assetUrlMapperPath) || {};
|
|
59
|
+
cli_utilities_1.log.debug(`Loaded asset mappings - UIDs: ${Object.keys(this.assetUidMapper).length}, URLs: ${Object.keys(this.assetUrlMapper).length}`, this.importConfig.context);
|
|
56
60
|
this.taxonomies = utils_1.fsUtil.readFile(this.taxonomiesPath);
|
|
61
|
+
cli_utilities_1.log.debug('Loaded taxonomy data for entry processing', this.importConfig.context);
|
|
57
62
|
utils_1.fsUtil.makeDirectory(this.entriesMapperPath);
|
|
63
|
+
cli_utilities_1.log.debug('Created entries mapper directory', this.importConfig.context);
|
|
64
|
+
cli_utilities_1.log.info('Preparing content types for entry import', this.importConfig.context);
|
|
58
65
|
await this.disableMandatoryCTReferences();
|
|
59
66
|
this.locales = (0, lodash_1.values)(utils_1.fsUtil.readFile(this.localesPath));
|
|
60
67
|
this.locales.unshift(this.importConfig.master_locale); // adds master locale to the list
|
|
68
|
+
cli_utilities_1.log.debug(`Processing entries for ${(0, lodash_1.values)(this.locales).length} locales`, this.importConfig.context);
|
|
61
69
|
//Create Entries
|
|
70
|
+
cli_utilities_1.log.info('Starting entry creation process', this.importConfig.context);
|
|
62
71
|
const entryRequestOptions = this.populateEntryCreatePayload();
|
|
72
|
+
cli_utilities_1.log.debug(`Generated ${entryRequestOptions.length} entry creation tasks`, this.importConfig.context);
|
|
63
73
|
for (let entryRequestOption of entryRequestOptions) {
|
|
64
74
|
await this.createEntries(entryRequestOption);
|
|
65
75
|
}
|
|
76
|
+
cli_utilities_1.log.success('Entry creation process completed', this.importConfig.context);
|
|
66
77
|
if (this.importConfig.replaceExisting) {
|
|
67
78
|
// Note: Instead of using entryRequestOptions, we can prepare request options for replace, to avoid unnecessary operations
|
|
79
|
+
cli_utilities_1.log.info('Starting entry replacement process', this.importConfig.context);
|
|
68
80
|
for (let entryRequestOption of entryRequestOptions) {
|
|
69
81
|
await this.replaceEntries(entryRequestOption).catch((error) => {
|
|
70
|
-
(0,
|
|
82
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: entryRequestOption.cTUid, locale: entryRequestOption.locale }), 'Error while replacing existing entries');
|
|
71
83
|
});
|
|
72
84
|
}
|
|
85
|
+
cli_utilities_1.log.success('Entry replacement process completed', this.importConfig.context);
|
|
73
86
|
}
|
|
87
|
+
cli_utilities_1.log.debug('Writing entry UID mappings to file', this.importConfig.context);
|
|
74
88
|
await utils_1.fileHelper.writeLargeFile(path.join(this.entriesMapperPath, 'uid-mapping.json'), this.entriesUidMapper); // TBD: manages mapper in one file, should find an alternative
|
|
75
89
|
utils_1.fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries);
|
|
76
90
|
if (((_a = this.autoCreatedEntries) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
77
|
-
|
|
91
|
+
cli_utilities_1.log.info(`Removing ${this.autoCreatedEntries.length} entries from master language which got created by default`, this.importConfig.context);
|
|
78
92
|
await this.removeAutoCreatedEntries().catch((error) => {
|
|
79
|
-
(0,
|
|
93
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context), 'Error while removing auto created entries in master locale');
|
|
80
94
|
});
|
|
95
|
+
cli_utilities_1.log.success('Auto-created entries cleanup completed', this.importConfig.context);
|
|
81
96
|
}
|
|
82
97
|
// Update entries with references
|
|
98
|
+
cli_utilities_1.log.info('Starting entry references update process', this.importConfig.context);
|
|
83
99
|
const entryUpdateRequestOptions = this.populateEntryUpdatePayload();
|
|
100
|
+
cli_utilities_1.log.debug(`Generated ${entryUpdateRequestOptions.length} entry update tasks`, this.importConfig.context);
|
|
84
101
|
for (let entryUpdateRequestOption of entryUpdateRequestOptions) {
|
|
85
102
|
await this.updateEntriesWithReferences(entryUpdateRequestOption).catch((error) => {
|
|
86
|
-
(0,
|
|
87
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
103
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: entryUpdateRequestOption.cTUid, locale: entryUpdateRequestOption.locale }), `Error while updating entries references of ${entryUpdateRequestOption.cTUid} in locale ${entryUpdateRequestOption.locale}`);
|
|
88
104
|
});
|
|
89
105
|
}
|
|
90
106
|
utils_1.fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries);
|
|
91
|
-
|
|
107
|
+
cli_utilities_1.log.success('Entry references update process completed', this.importConfig.context);
|
|
108
|
+
cli_utilities_1.log.info('Restoring content type changes', this.importConfig.context);
|
|
92
109
|
await this.enableMandatoryCTReferences().catch((error) => {
|
|
93
|
-
(0,
|
|
110
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context), 'Error while updating content type references');
|
|
94
111
|
});
|
|
112
|
+
cli_utilities_1.log.success('Content type references restored successfully', this.importConfig.context);
|
|
95
113
|
// Update field rule of content types which are got removed earlier
|
|
96
|
-
|
|
114
|
+
cli_utilities_1.log.info('Updating the field rules of content type', this.importConfig.context);
|
|
97
115
|
await this.updateFieldRules().catch((error) => {
|
|
98
|
-
(0,
|
|
116
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context), 'Error while updating field rules of content type');
|
|
99
117
|
});
|
|
100
|
-
|
|
118
|
+
cli_utilities_1.log.success('Entries imported successfully', this.importConfig.context);
|
|
101
119
|
// Publishing entries
|
|
102
120
|
if (!this.importConfig.skipEntriesPublish) {
|
|
103
|
-
|
|
121
|
+
cli_utilities_1.log.info('Starting entry publishing process', this.importConfig.context);
|
|
104
122
|
this.envs = utils_1.fileHelper.readFileSync(this.envPath);
|
|
123
|
+
cli_utilities_1.log.debug(`Loaded ${Object.keys(this.envs).length} environments for publishing`, this.importConfig.context);
|
|
105
124
|
for (let entryRequestOption of entryRequestOptions) {
|
|
106
125
|
await this.publishEntries(entryRequestOption).catch((error) => {
|
|
107
|
-
(0,
|
|
126
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: entryRequestOption.cTUid, locale: entryRequestOption.locale }), `Error in publishing entries of ${entryRequestOption.cTUid} in locale ${entryRequestOption.locale}`);
|
|
108
127
|
});
|
|
109
128
|
}
|
|
110
|
-
|
|
129
|
+
cli_utilities_1.log.success('All the entries have been published successfully', this.importConfig.context);
|
|
111
130
|
}
|
|
131
|
+
else {
|
|
132
|
+
cli_utilities_1.log.info('Skipping entry publishing as per configuration', this.importConfig.context);
|
|
133
|
+
}
|
|
134
|
+
cli_utilities_1.log.debug('Creating entry data for variant entries', this.importConfig.context);
|
|
112
135
|
this.createEntryDataForVariantEntry();
|
|
113
136
|
}
|
|
114
137
|
catch (error) {
|
|
115
138
|
this.createEntryDataForVariantEntry();
|
|
116
|
-
(0,
|
|
139
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context));
|
|
117
140
|
throw new Error('Error while importing entries');
|
|
118
141
|
}
|
|
119
142
|
}
|
|
@@ -128,11 +151,13 @@ class EntriesImport extends base_class_1.default {
|
|
|
128
151
|
}
|
|
129
152
|
}
|
|
130
153
|
async disableMandatoryCTReferences() {
|
|
154
|
+
cli_utilities_1.log.debug(`Starting to disable mandatory CT references for ${this.cTs.length} content types`, this.importConfig.context);
|
|
131
155
|
const onSuccess = ({ response: contentType, apiData: { uid } }) => {
|
|
132
|
-
|
|
156
|
+
cli_utilities_1.log.success(`${uid} content type references removed temporarily`, this.importConfig.context);
|
|
157
|
+
cli_utilities_1.log.debug(`Successfully processed content type: ${uid}`, this.importConfig.context);
|
|
133
158
|
};
|
|
134
159
|
const onReject = ({ error, apiData: { uid } }) => {
|
|
135
|
-
(0,
|
|
160
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { uid }));
|
|
136
161
|
throw new Error(`${uid} content type references removal failed`);
|
|
137
162
|
};
|
|
138
163
|
return await this.makeConcurrentCall({
|
|
@@ -147,7 +172,9 @@ class EntriesImport extends base_class_1.default {
|
|
|
147
172
|
},
|
|
148
173
|
concurrencyLimit: this.importConcurrency,
|
|
149
174
|
}).then(() => {
|
|
175
|
+
cli_utilities_1.log.debug(`Writing ${this.modifiedCTs.length} modified content types to file`, this.importConfig.context);
|
|
150
176
|
utils_1.fsUtil.writeFile(this.modifiedCTsPath, this.modifiedCTs);
|
|
177
|
+
cli_utilities_1.log.success('Content type reference removal completed', this.importConfig.context);
|
|
151
178
|
});
|
|
152
179
|
}
|
|
153
180
|
/**
|
|
@@ -227,10 +254,12 @@ class EntriesImport extends base_class_1.default {
|
|
|
227
254
|
const indexer = fs.indexFileContent;
|
|
228
255
|
const indexerCount = (0, lodash_1.values)(indexer).length;
|
|
229
256
|
if (indexerCount === 0) {
|
|
257
|
+
cli_utilities_1.log.debug(`No entries found for content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
230
258
|
return Promise.resolve();
|
|
231
259
|
}
|
|
232
|
-
|
|
260
|
+
cli_utilities_1.log.debug(`Starting to create entries for ${cTUid} in locale ${locale} - ${indexerCount} chunks to process`, this.importConfig.context);
|
|
233
261
|
const isMasterLocale = locale === ((_b = (_a = this.importConfig) === null || _a === void 0 ? void 0 : _a.master_locale) === null || _b === void 0 ? void 0 : _b.code);
|
|
262
|
+
cli_utilities_1.log.debug(`Processing ${isMasterLocale ? 'master' : 'non-master'} locale: ${locale}`, this.importConfig.context);
|
|
234
263
|
// Write created entries
|
|
235
264
|
const entriesCreateFileHelper = new cli_utilities_1.FsUtility({
|
|
236
265
|
moduleName: 'entries',
|
|
@@ -250,19 +279,22 @@ class EntriesImport extends base_class_1.default {
|
|
|
250
279
|
omitKeys: this.entriesConfig.invalidKeys,
|
|
251
280
|
});
|
|
252
281
|
const contentType = (0, lodash_1.find)(this.cTs, { uid: cTUid });
|
|
282
|
+
cli_utilities_1.log.debug(`Found content type schema for ${cTUid}`, this.importConfig.context);
|
|
253
283
|
const onSuccess = ({ response, apiData: entry, additionalInfo }) => {
|
|
254
284
|
var _a, _b;
|
|
255
285
|
if ((_a = additionalInfo[entry.uid]) === null || _a === void 0 ? void 0 : _a.isLocalized) {
|
|
256
286
|
let oldUid = additionalInfo[entry.uid].entryOldUid;
|
|
257
287
|
this.entriesForVariant.push({ content_type: cTUid, entry_uid: oldUid, locale });
|
|
258
|
-
|
|
288
|
+
cli_utilities_1.log.info(`Localized entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
289
|
+
cli_utilities_1.log.debug(`Mapped localized entry UID: ${entry.uid} → ${oldUid}`, this.importConfig.context);
|
|
259
290
|
entry.uid = oldUid;
|
|
260
291
|
entry.entryOldUid = oldUid;
|
|
261
292
|
entry.sourceEntryFilePath = path.join((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(additionalInfo.entryFileName)); // stores source file path temporarily
|
|
262
293
|
entriesCreateFileHelper.writeIntoFile({ [oldUid]: entry }, { mapKeyVal: true });
|
|
263
294
|
}
|
|
264
295
|
else {
|
|
265
|
-
|
|
296
|
+
cli_utilities_1.log.info(`Created entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
297
|
+
cli_utilities_1.log.debug(`Created entry UID mapping: ${entry.uid} → ${response.uid}`, this.importConfig.context);
|
|
266
298
|
this.entriesForVariant.push({ content_type: cTUid, entry_uid: entry.uid, locale });
|
|
267
299
|
// This is for creating localized entries that do not have a counterpart in master locale.
|
|
268
300
|
// For example : To create entry1 in fr-fr, where en-us is the master locale
|
|
@@ -270,6 +302,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
270
302
|
// thus entry1 has to be removed from en-us at the end.
|
|
271
303
|
if (!isMasterLocale && !((_b = additionalInfo[entry.uid]) === null || _b === void 0 ? void 0 : _b.isLocalized)) {
|
|
272
304
|
this.autoCreatedEntries.push({ cTUid, locale, entryUid: response.uid });
|
|
305
|
+
cli_utilities_1.log.debug(`Marked entry for auto-cleanup: ${response.uid} in master locale`, this.importConfig.context);
|
|
273
306
|
}
|
|
274
307
|
this.entriesUidMapper[entry.uid] = response.uid;
|
|
275
308
|
entry.sourceEntryFilePath = path.join((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(additionalInfo.entryFileName)); // stores source file path temporarily
|
|
@@ -282,6 +315,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
282
315
|
const { title, uid } = entry;
|
|
283
316
|
// NOTE Remove from list if any entry import failed
|
|
284
317
|
this.entriesForVariant = this.entriesForVariant.filter((item) => !(item.locale === locale && item.entry_uid === uid));
|
|
318
|
+
cli_utilities_1.log.debug(`Removed failed entry from variant list: ${uid}`, this.importConfig.context);
|
|
285
319
|
// NOTE: write existing entries into files to handler later
|
|
286
320
|
if (error.errorCode === 119) {
|
|
287
321
|
if (((_a = error === null || error === void 0 ? void 0 : error.errors) === null || _a === void 0 ? void 0 : _a.title) || ((_b = error === null || error === void 0 ? void 0 : error.errors) === null || _b === void 0 ? void 0 : _b.uid)) {
|
|
@@ -289,29 +323,30 @@ class EntriesImport extends base_class_1.default {
|
|
|
289
323
|
entry.entryOldUid = uid;
|
|
290
324
|
entry.sourceEntryFilePath = path.join((0, cli_utilities_1.sanitizePath)(basePath), (0, cli_utilities_1.sanitizePath)(additionalInfo.entryFileName)); // stores source file path temporarily
|
|
291
325
|
existingEntriesFileHelper.writeIntoFile({ [uid]: entry }, { mapKeyVal: true });
|
|
326
|
+
cli_utilities_1.log.debug(`Queued existing entry for replacement: ${title} (${uid})`, this.importConfig.context);
|
|
292
327
|
}
|
|
293
328
|
if (!this.importConfig.skipExisting) {
|
|
294
|
-
|
|
329
|
+
cli_utilities_1.log.info(`Entry '${title}' already exists`, this.importConfig.context);
|
|
295
330
|
}
|
|
296
331
|
}
|
|
297
332
|
else {
|
|
298
|
-
(0,
|
|
299
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
333
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: cTUid, locale }));
|
|
300
334
|
this.failedEntries.push({ content_type: cTUid, locale, entry: { uid, title } });
|
|
301
335
|
}
|
|
302
336
|
}
|
|
303
337
|
else {
|
|
304
|
-
(0,
|
|
305
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
338
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: cTUid, locale }));
|
|
306
339
|
this.failedEntries.push({ content_type: cTUid, locale, entry: { uid, title } });
|
|
307
340
|
}
|
|
308
341
|
};
|
|
309
342
|
for (const index in indexer) {
|
|
343
|
+
cli_utilities_1.log.debug(`Processing chunk ${index} of ${indexerCount} for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
310
344
|
const chunk = await fs.readChunkFiles.next().catch((error) => {
|
|
311
|
-
(0,
|
|
345
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid: cTUid, locale }));
|
|
312
346
|
});
|
|
313
347
|
if (chunk) {
|
|
314
348
|
let apiContent = (0, lodash_1.values)(chunk);
|
|
349
|
+
cli_utilities_1.log.debug(`Processing ${apiContent.length} entries in chunk ${index}`, this.importConfig.context);
|
|
315
350
|
await this.makeConcurrentCall({
|
|
316
351
|
apiContent,
|
|
317
352
|
processName,
|
|
@@ -329,7 +364,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
329
364
|
}).then(() => {
|
|
330
365
|
entriesCreateFileHelper === null || entriesCreateFileHelper === void 0 ? void 0 : entriesCreateFileHelper.completeFile(true);
|
|
331
366
|
existingEntriesFileHelper === null || existingEntriesFileHelper === void 0 ? void 0 : existingEntriesFileHelper.completeFile(true);
|
|
332
|
-
|
|
367
|
+
cli_utilities_1.log.success(`Created entries for content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
333
368
|
});
|
|
334
369
|
}
|
|
335
370
|
}
|
|
@@ -342,23 +377,29 @@ class EntriesImport extends base_class_1.default {
|
|
|
342
377
|
serializeEntries(apiOptions) {
|
|
343
378
|
let { apiData: entry, additionalInfo: { cTUid, locale, contentType, isMasterLocale }, } = apiOptions;
|
|
344
379
|
try {
|
|
380
|
+
cli_utilities_1.log.debug(`Serializing entry: ${entry.title} (${entry.uid}) for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
345
381
|
if (this.jsonRteCTs.indexOf(cTUid) > -1) {
|
|
346
382
|
entry = (0, utils_1.removeUidsFromJsonRteFields)(entry, contentType.schema);
|
|
383
|
+
cli_utilities_1.log.debug(`Removed UIDs from JSON RTE fields for entry: ${entry.uid}`, this.importConfig.context);
|
|
347
384
|
}
|
|
348
385
|
// remove entry references from json-rte fields
|
|
349
386
|
if (this.jsonRteCTsWithRef.indexOf(cTUid) > -1) {
|
|
350
387
|
entry = (0, utils_1.removeEntryRefsFromJSONRTE)(entry, contentType.schema);
|
|
388
|
+
cli_utilities_1.log.debug(`Removed entry references from JSON RTE fields for entry: ${entry.uid}`, this.importConfig.context);
|
|
351
389
|
}
|
|
352
390
|
if (this.rteCTsWithRef.indexOf(cTUid) > -1) {
|
|
353
391
|
entry = (0, utils_1.removeEntryRefsFromJSONRTE)(entry, contentType.schema);
|
|
392
|
+
cli_utilities_1.log.debug(`Removed entry references from RTE fields for entry: ${entry.uid}`, this.importConfig.context);
|
|
354
393
|
}
|
|
355
394
|
//will remove term if term doesn't exists in taxonomy
|
|
356
395
|
(0, utils_1.lookUpTerms)(contentType === null || contentType === void 0 ? void 0 : contentType.schema, entry, this.taxonomies, this.importConfig);
|
|
396
|
+
cli_utilities_1.log.debug(`Processed taxonomy terms for entry: ${entry.uid}`, this.importConfig.context);
|
|
357
397
|
// will replace all old asset uid/urls with new ones
|
|
358
398
|
entry = (0, utils_1.lookupAssets)({
|
|
359
399
|
content_type: contentType,
|
|
360
400
|
entry: entry,
|
|
361
401
|
}, this.assetUidMapper, this.assetUrlMapper, path.join(this.entriesPath, cTUid), this.installedExtensions);
|
|
402
|
+
cli_utilities_1.log.debug(`Processed asset lookups for entry: ${entry.uid}`, this.importConfig.context);
|
|
362
403
|
delete entry.publish_details;
|
|
363
404
|
// checking the entry is a localized one or not
|
|
364
405
|
if (!isMasterLocale && this.entriesUidMapper.hasOwnProperty(entry.uid)) {
|
|
@@ -369,13 +410,14 @@ class EntriesImport extends base_class_1.default {
|
|
|
369
410
|
isLocalized: true,
|
|
370
411
|
entryOldUid: entry.uid,
|
|
371
412
|
};
|
|
413
|
+
cli_utilities_1.log.debug(`Prepared localized entry: ${entry.uid} → ${this.entriesUidMapper[entry.uid]}`, this.importConfig.context);
|
|
372
414
|
return apiOptions;
|
|
373
415
|
}
|
|
374
416
|
apiOptions.apiData = entry;
|
|
417
|
+
cli_utilities_1.log.debug(`Entry serialization completed for: ${entry.uid}`, this.importConfig.context);
|
|
375
418
|
}
|
|
376
419
|
catch (error) {
|
|
377
|
-
(0,
|
|
378
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
420
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
379
421
|
this.failedEntries.push({ content_type: cTUid, locale, entry: { uid: entry.uid, title: entry.title } });
|
|
380
422
|
apiOptions.apiData = null;
|
|
381
423
|
}
|
|
@@ -389,8 +431,10 @@ class EntriesImport extends base_class_1.default {
|
|
|
389
431
|
const indexer = fs.indexFileContent;
|
|
390
432
|
const indexerCount = (0, lodash_1.values)(indexer).length;
|
|
391
433
|
if (indexerCount === 0) {
|
|
434
|
+
cli_utilities_1.log.debug(`No existing entries found for replacement in ${cTUid} - ${locale}`, this.importConfig.context);
|
|
392
435
|
return Promise.resolve();
|
|
393
436
|
}
|
|
437
|
+
cli_utilities_1.log.debug(`Starting to replace entries for ${cTUid} in locale ${locale} - ${indexerCount} chunks to process`, this.importConfig.context);
|
|
394
438
|
// Write updated entries
|
|
395
439
|
const entriesReplaceFileHelper = new cli_utilities_1.FsUtility({
|
|
396
440
|
moduleName: 'entries',
|
|
@@ -401,18 +445,19 @@ class EntriesImport extends base_class_1.default {
|
|
|
401
445
|
useIndexer: true,
|
|
402
446
|
omitKeys: this.entriesConfig.invalidKeys,
|
|
403
447
|
});
|
|
404
|
-
// log(this.importConfig, `Starting to update entries with references for ${cTUid} in locale ${locale}`, 'info');
|
|
405
448
|
const contentType = (0, lodash_1.find)(this.cTs, { uid: cTUid });
|
|
449
|
+
cli_utilities_1.log.debug(`Found content type schema for replacement: ${cTUid}`, this.importConfig.context);
|
|
406
450
|
const onSuccess = ({ response, apiData: entry, additionalInfo }) => {
|
|
407
|
-
|
|
451
|
+
cli_utilities_1.log.info(`Replaced entry: '${entry.title}' of content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
452
|
+
cli_utilities_1.log.debug(`Replaced entry UID mapping: ${entry.uid} → ${response.uid}`, this.importConfig.context);
|
|
408
453
|
this.entriesUidMapper[entry.uid] = response.uid;
|
|
409
454
|
entriesReplaceFileHelper.writeIntoFile({ [entry.uid]: entry }, { mapKeyVal: true });
|
|
410
455
|
};
|
|
411
456
|
const onReject = ({ error, apiData: { uid, title } }) => {
|
|
412
457
|
// NOTE Remove from list if any entry import failed
|
|
413
458
|
this.entriesForVariant = this.entriesForVariant.filter((item) => !(item.locale === locale && item.entry_uid === uid));
|
|
414
|
-
|
|
415
|
-
(0,
|
|
459
|
+
cli_utilities_1.log.debug(`Removed failed replacement entry from variant list: ${uid}`, this.importConfig.context);
|
|
460
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
416
461
|
this.failedEntries.push({
|
|
417
462
|
content_type: cTUid,
|
|
418
463
|
locale,
|
|
@@ -421,11 +466,13 @@ class EntriesImport extends base_class_1.default {
|
|
|
421
466
|
});
|
|
422
467
|
};
|
|
423
468
|
for (const index in indexer) {
|
|
469
|
+
cli_utilities_1.log.debug(`Processing replacement chunk ${index} of ${indexerCount} for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
424
470
|
const chunk = await fs.readChunkFiles.next().catch((error) => {
|
|
425
|
-
(0,
|
|
471
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
426
472
|
});
|
|
427
473
|
if (chunk) {
|
|
428
474
|
let apiContent = (0, lodash_1.values)(chunk);
|
|
475
|
+
cli_utilities_1.log.debug(`Processing ${apiContent.length} entries for replacement in chunk ${index}`, this.importConfig.context);
|
|
429
476
|
await this.makeConcurrentCall({
|
|
430
477
|
apiContent,
|
|
431
478
|
processName,
|
|
@@ -441,7 +488,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
441
488
|
concurrencyLimit: this.importConcurrency,
|
|
442
489
|
}, this.replaceEntriesHandler.bind(this)).then(() => {
|
|
443
490
|
entriesReplaceFileHelper === null || entriesReplaceFileHelper === void 0 ? void 0 : entriesReplaceFileHelper.completeFile(true);
|
|
444
|
-
|
|
491
|
+
cli_utilities_1.log.success(`Replaced entries for content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
445
492
|
});
|
|
446
493
|
}
|
|
447
494
|
}
|
|
@@ -515,18 +562,21 @@ class EntriesImport extends base_class_1.default {
|
|
|
515
562
|
const indexer = fs.indexFileContent;
|
|
516
563
|
const indexerCount = (0, lodash_1.values)(indexer).length;
|
|
517
564
|
if (indexerCount === 0) {
|
|
565
|
+
cli_utilities_1.log.debug(`No entries found for reference updates in ${cTUid} - ${locale}`, this.importConfig.context);
|
|
518
566
|
return Promise.resolve();
|
|
519
567
|
}
|
|
520
|
-
|
|
568
|
+
cli_utilities_1.log.debug(`Starting to update entries with references for ${cTUid} in locale ${locale} - ${indexerCount} chunks to process`, this.importConfig.context);
|
|
521
569
|
const contentType = (0, lodash_1.find)(this.cTs, { uid: cTUid });
|
|
570
|
+
cli_utilities_1.log.debug(`Found content type schema for reference updates: ${cTUid}`, this.importConfig.context);
|
|
522
571
|
const onSuccess = ({ response, apiData: { uid, url, title } }) => {
|
|
523
|
-
|
|
572
|
+
cli_utilities_1.log.info(`Updated entry: '${title}' of content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
573
|
+
cli_utilities_1.log.debug(`Updated entry references for: ${uid}`, this.importConfig.context);
|
|
524
574
|
};
|
|
525
575
|
const onReject = ({ error, apiData: { uid, title } }) => {
|
|
526
576
|
// NOTE Remove from list if any entry import failed
|
|
527
577
|
this.entriesForVariant = this.entriesForVariant.filter((item) => !(item.locale === locale && item.entry_uid === uid));
|
|
528
|
-
|
|
529
|
-
(0,
|
|
578
|
+
cli_utilities_1.log.debug(`Removed failed reference update entry from variant list: ${uid}`, this.importConfig.context);
|
|
579
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
530
580
|
this.failedEntries.push({
|
|
531
581
|
content_type: cTUid,
|
|
532
582
|
locale,
|
|
@@ -535,11 +585,13 @@ class EntriesImport extends base_class_1.default {
|
|
|
535
585
|
});
|
|
536
586
|
};
|
|
537
587
|
for (const index in indexer) {
|
|
588
|
+
cli_utilities_1.log.debug(`Processing reference update chunk ${index} of ${indexerCount} for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
538
589
|
const chunk = await fs.readChunkFiles.next().catch((error) => {
|
|
539
|
-
(0,
|
|
590
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }), 'Error');
|
|
540
591
|
});
|
|
541
592
|
if (chunk) {
|
|
542
593
|
let apiContent = (0, lodash_1.values)(chunk);
|
|
594
|
+
cli_utilities_1.log.debug(`Processing ${apiContent.length} entries for reference updates in chunk ${index}`, this.importConfig.context);
|
|
543
595
|
await this.makeConcurrentCall({
|
|
544
596
|
apiContent,
|
|
545
597
|
processName,
|
|
@@ -555,7 +607,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
555
607
|
},
|
|
556
608
|
concurrencyLimit: this.importConcurrency,
|
|
557
609
|
}).then(() => {
|
|
558
|
-
|
|
610
|
+
cli_utilities_1.log.success(`Updated entries for content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
559
611
|
});
|
|
560
612
|
}
|
|
561
613
|
}
|
|
@@ -568,9 +620,11 @@ class EntriesImport extends base_class_1.default {
|
|
|
568
620
|
serializeUpdateEntries(apiOptions) {
|
|
569
621
|
let { apiData: entry, additionalInfo: { cTUid, locale, contentType }, } = apiOptions;
|
|
570
622
|
try {
|
|
623
|
+
cli_utilities_1.log.debug(`Serializing entry update: ${entry.title} (${entry.uid}) for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
571
624
|
const sourceEntryFilePath = entry.sourceEntryFilePath;
|
|
572
625
|
const sourceEntry = (utils_1.fsUtil.readFile(sourceEntryFilePath) || {})[entry.entryOldUid];
|
|
573
626
|
const newUid = this.entriesUidMapper[entry.entryOldUid];
|
|
627
|
+
cli_utilities_1.log.debug(`Updating entry references: ${entry.entryOldUid} → ${newUid}`, this.importConfig.context);
|
|
574
628
|
// Removing temp values
|
|
575
629
|
delete entry.sourceEntryFilePath;
|
|
576
630
|
delete entry.entryOldUid;
|
|
@@ -581,33 +635,36 @@ class EntriesImport extends base_class_1.default {
|
|
|
581
635
|
mappedAssetUids: this.assetUidMapper,
|
|
582
636
|
mappedAssetUrls: this.assetUrlMapper,
|
|
583
637
|
});
|
|
638
|
+
cli_utilities_1.log.debug(`Restored JSON RTE entry references for: ${newUid}`, this.importConfig.context);
|
|
584
639
|
}
|
|
585
640
|
entry = (0, utils_1.lookupAssets)({
|
|
586
641
|
content_type: contentType,
|
|
587
642
|
entry: entry,
|
|
588
643
|
}, this.assetUidMapper, this.assetUrlMapper, path.join(this.entriesPath, cTUid), this.installedExtensions);
|
|
644
|
+
cli_utilities_1.log.debug(`Processed asset lookups for entry update: ${newUid}`, this.importConfig.context);
|
|
589
645
|
entry = (0, utils_1.lookupEntries)({
|
|
590
646
|
content_type: contentType,
|
|
591
647
|
entry,
|
|
592
648
|
}, this.entriesUidMapper, path.join(this.entriesMapperPath, cTUid, locale));
|
|
649
|
+
cli_utilities_1.log.debug(`Processed entry lookups for entry update: ${newUid}`, this.importConfig.context);
|
|
593
650
|
const entryResponse = this.stack.contentType(contentType.uid).entry(newUid);
|
|
594
651
|
Object.assign(entryResponse, (0, lodash_1.cloneDeep)(entry), { uid: newUid });
|
|
595
652
|
delete entryResponse.publish_details;
|
|
596
653
|
apiOptions.apiData = entryResponse;
|
|
654
|
+
cli_utilities_1.log.debug(`Entry update serialization completed for: ${newUid}`, this.importConfig.context);
|
|
597
655
|
}
|
|
598
656
|
catch (error) {
|
|
599
|
-
(0,
|
|
600
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
657
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
601
658
|
apiOptions.apiData = null;
|
|
602
659
|
}
|
|
603
660
|
return apiOptions;
|
|
604
661
|
}
|
|
605
662
|
async enableMandatoryCTReferences() {
|
|
606
663
|
const onSuccess = ({ response: contentType, apiData: { uid } }) => {
|
|
607
|
-
|
|
664
|
+
cli_utilities_1.log.success(`${uid} content type references updated`, this.importConfig.context);
|
|
608
665
|
};
|
|
609
666
|
const onReject = ({ error, apiData: { uid } }) => {
|
|
610
|
-
(0,
|
|
667
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { uid }), 'Error');
|
|
611
668
|
throw new Error(`Failed to update references of content type ${uid}`);
|
|
612
669
|
};
|
|
613
670
|
return await this.makeConcurrentCall({
|
|
@@ -645,12 +702,12 @@ class EntriesImport extends base_class_1.default {
|
|
|
645
702
|
const onSuccess = ({ response, apiData: { entryUid } }) => {
|
|
646
703
|
// NOTE Remove entry from list
|
|
647
704
|
this.entriesForVariant = this.entriesForVariant.filter((item) => { var _a, _b; return !(item.entry_uid === entryUid && item.locale === ((_b = (_a = this.importConfig) === null || _a === void 0 ? void 0 : _a.master_locale) === null || _b === void 0 ? void 0 : _b.code)); });
|
|
648
|
-
|
|
705
|
+
cli_utilities_1.log.success(`Auto created entry in master locale removed - entry uid ${entryUid} `, this.importConfig.context);
|
|
649
706
|
};
|
|
650
707
|
const onReject = ({ error, apiData: { entryUid } }) => {
|
|
651
708
|
// NOTE Remove entry from list
|
|
652
709
|
this.entriesForVariant = this.entriesForVariant.filter((item) => { var _a, _b; return !(item.entry_uid === entryUid && item.locale === ((_b = (_a = this.importConfig) === null || _a === void 0 ? void 0 : _a.master_locale) === null || _b === void 0 ? void 0 : _b.code)); });
|
|
653
|
-
(0,
|
|
710
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.importConfig.context), `Failed to remove auto created entry in master locale - entry uid ${entryUid}`);
|
|
654
711
|
};
|
|
655
712
|
return await this.makeConcurrentCall({
|
|
656
713
|
processName: 'Remove auto created entry in master locale',
|
|
@@ -669,18 +726,24 @@ class EntriesImport extends base_class_1.default {
|
|
|
669
726
|
var _a, _b, _c;
|
|
670
727
|
let cTsWithFieldRules = utils_1.fsUtil.readFile(path.join(this.cTsPath + '/field_rules_uid.json'));
|
|
671
728
|
if (!cTsWithFieldRules || (cTsWithFieldRules === null || cTsWithFieldRules === void 0 ? void 0 : cTsWithFieldRules.length) === 0) {
|
|
729
|
+
cli_utilities_1.log.debug('No content types with field rules found to update', this.importConfig.context);
|
|
672
730
|
return;
|
|
673
731
|
}
|
|
732
|
+
cli_utilities_1.log.debug(`Found ${cTsWithFieldRules.length} content types with field rules to update`, this.importConfig.context);
|
|
674
733
|
for (let cTUid of cTsWithFieldRules) {
|
|
734
|
+
cli_utilities_1.log.debug(`Processing field rules for content type: ${cTUid}`, this.importConfig.context);
|
|
675
735
|
const cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, 'schema.json'));
|
|
676
736
|
const contentType = (0, lodash_1.find)(cTs, { uid: cTUid });
|
|
677
737
|
if (contentType.field_rules) {
|
|
738
|
+
cli_utilities_1.log.debug(`Found ${contentType.field_rules.length} field rules for content type: ${cTUid}`, this.importConfig.context);
|
|
678
739
|
const fieldDatatypeMap = {};
|
|
679
740
|
for (let i = 0; i < ((_a = contentType.schema) === null || _a === void 0 ? void 0 : _a.length); i++) {
|
|
680
741
|
const field = contentType.schema[i].uid;
|
|
681
742
|
fieldDatatypeMap[field] = contentType.schema[i].data_type;
|
|
682
743
|
}
|
|
744
|
+
cli_utilities_1.log.debug(`Built field datatype map for ${Object.keys(fieldDatatypeMap).length} fields`, this.importConfig.context);
|
|
683
745
|
let fieldRuleLength = (_b = contentType.field_rules) === null || _b === void 0 ? void 0 : _b.length;
|
|
746
|
+
let updatedRulesCount = 0;
|
|
684
747
|
for (let k = 0; k < fieldRuleLength; k++) {
|
|
685
748
|
let fieldRuleConditionLength = (_c = contentType.field_rules[k].conditions) === null || _c === void 0 ? void 0 : _c.length;
|
|
686
749
|
for (let i = 0; i < fieldRuleConditionLength; i++) {
|
|
@@ -692,32 +755,36 @@ class EntriesImport extends base_class_1.default {
|
|
|
692
755
|
let splittedFieldRulesValue = element;
|
|
693
756
|
if (this.entriesUidMapper.hasOwnProperty(splittedFieldRulesValue)) {
|
|
694
757
|
updatedValue.push(this.entriesUidMapper[splittedFieldRulesValue]);
|
|
758
|
+
cli_utilities_1.log.debug(`Updated field rule reference: ${splittedFieldRulesValue} → ${this.entriesUidMapper[splittedFieldRulesValue]}`, this.importConfig.context);
|
|
695
759
|
}
|
|
696
760
|
else {
|
|
697
761
|
updatedValue.push(element);
|
|
698
762
|
}
|
|
699
763
|
}
|
|
700
764
|
contentType.field_rules[k].conditions[i].value = updatedValue.join('.');
|
|
765
|
+
updatedRulesCount++;
|
|
701
766
|
}
|
|
702
767
|
}
|
|
703
768
|
}
|
|
769
|
+
cli_utilities_1.log.debug(`Updated ${updatedRulesCount} field rule references for content type: ${cTUid}`, this.importConfig.context);
|
|
704
770
|
const contentTypeResponse = await this.stack
|
|
705
771
|
.contentType(contentType.uid)
|
|
706
772
|
.fetch()
|
|
707
773
|
.catch((error) => {
|
|
708
|
-
(0,
|
|
774
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid }));
|
|
709
775
|
});
|
|
710
776
|
if (!contentTypeResponse) {
|
|
777
|
+
cli_utilities_1.log.debug(`Skipping field rules update for ${cTUid} - content type not found`, this.importConfig.context);
|
|
711
778
|
continue;
|
|
712
779
|
}
|
|
713
780
|
contentTypeResponse.field_rules = contentType.field_rules;
|
|
714
781
|
await contentTypeResponse.update().catch((error) => {
|
|
715
|
-
(0,
|
|
782
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid }));
|
|
716
783
|
});
|
|
717
|
-
|
|
784
|
+
cli_utilities_1.log.success(`Updated the field rules of ${cTUid}`, this.importConfig.context);
|
|
718
785
|
}
|
|
719
786
|
else {
|
|
720
|
-
|
|
787
|
+
cli_utilities_1.log.info(`No field rules found in content type ${cTUid} to update`, this.importConfig.context);
|
|
721
788
|
}
|
|
722
789
|
}
|
|
723
790
|
}
|
|
@@ -730,19 +797,21 @@ class EntriesImport extends base_class_1.default {
|
|
|
730
797
|
const indexerCount = (0, lodash_1.values)(indexer).length;
|
|
731
798
|
const contentType = (0, lodash_1.find)(this.cTs, { uid: cTUid });
|
|
732
799
|
if (indexerCount === 0) {
|
|
800
|
+
cli_utilities_1.log.debug(`No entries found for publishing in ${cTUid} - ${locale}`, this.importConfig.context);
|
|
733
801
|
return Promise.resolve();
|
|
734
802
|
}
|
|
735
|
-
|
|
803
|
+
cli_utilities_1.log.debug(`Starting to publish entries for ${cTUid} in locale ${locale} - ${indexerCount} chunks to process`, this.importConfig.context);
|
|
736
804
|
const onSuccess = ({ response, apiData: { environments, entryUid, locales }, additionalInfo }) => {
|
|
737
|
-
|
|
805
|
+
cli_utilities_1.log.success(`Published the entry: '${entryUid}' of Content Type '${cTUid}' and Locale '${locale}' in Environments '${environments === null || environments === void 0 ? void 0 : environments.join(',')}' and Locales '${locales === null || locales === void 0 ? void 0 : locales.join(',')}'`, this.importConfig.context);
|
|
806
|
+
cli_utilities_1.log.debug(`Published entry ${entryUid} to ${(environments === null || environments === void 0 ? void 0 : environments.length) || 0} environments and ${(locales === null || locales === void 0 ? void 0 : locales.length) || 0} locales`, this.importConfig.context);
|
|
738
807
|
};
|
|
739
808
|
const onReject = ({ error, apiData: { environments, entryUid, locales }, additionalInfo }) => {
|
|
740
|
-
(0,
|
|
741
|
-
(0, utils_1.log)(this.importConfig, (0, utils_1.formatError)(error), 'error');
|
|
809
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }), `Failed to publish: '${entryUid}' entry of Content Type '${cTUid}' and Locale '${locale}' in Environments '${environments === null || environments === void 0 ? void 0 : environments.join(',')}' and Locales '${locales === null || locales === void 0 ? void 0 : locales.join(',')}'`);
|
|
742
810
|
};
|
|
743
811
|
for (const index in indexer) {
|
|
812
|
+
cli_utilities_1.log.debug(`Processing publish chunk ${index} of ${indexerCount} for ${cTUid} in ${locale}`, this.importConfig.context);
|
|
744
813
|
const chunk = await fs.readChunkFiles.next().catch((error) => {
|
|
745
|
-
(0,
|
|
814
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
746
815
|
});
|
|
747
816
|
if (chunk) {
|
|
748
817
|
let apiContent = (0, lodash_1.values)(chunk);
|
|
@@ -755,7 +824,9 @@ class EntriesImport extends base_class_1.default {
|
|
|
755
824
|
return []; // Return an empty array if publish_details is empty
|
|
756
825
|
});
|
|
757
826
|
apiContent = apiContentDuplicate;
|
|
827
|
+
cli_utilities_1.log.debug(`Processing ${apiContent.length} publishable entries in chunk ${index}`, this.importConfig.context);
|
|
758
828
|
if ((apiContent === null || apiContent === void 0 ? void 0 : apiContent.length) === 0) {
|
|
829
|
+
cli_utilities_1.log.debug(`No publishable entries found in chunk ${index}`, this.importConfig.context);
|
|
759
830
|
continue;
|
|
760
831
|
}
|
|
761
832
|
else {
|
|
@@ -774,7 +845,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
774
845
|
},
|
|
775
846
|
concurrencyLimit: this.importConcurrency,
|
|
776
847
|
}).then(() => {
|
|
777
|
-
|
|
848
|
+
cli_utilities_1.log.success(`Published entries for content type ${cTUid} in locale ${locale}`, this.importConfig.context);
|
|
778
849
|
});
|
|
779
850
|
}
|
|
780
851
|
}
|