contensis-cli 1.2.1 → 1.2.2-beta.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.
@@ -920,7 +920,7 @@ class ContensisCli {
920
920
  }
921
921
  }
922
922
  };
923
- PrintContentModels = async (modelIds = []) => {
923
+ PrintContentModels = async (modelIds = [], printRequiredBy) => {
924
924
  const { currentProject, log, messages } = this;
925
925
  const contensis = await this.ConnectContensis();
926
926
  if (contensis) {
@@ -958,7 +958,15 @@ class ContensisCli {
958
958
  if (Array.isArray(returnModels)) {
959
959
  log.success(messages.models.list(currentProject));
960
960
  await this.HandleFormattingAndOutput(contentModelBackup, () => {
961
+ var _a, _b;
961
962
  for (const model of returnModels) {
963
+ if (!printRequiredBy) {
964
+ delete model.dependencyOf;
965
+ if ((_a = model.dependencies) == null ? void 0 : _a.contentTypes)
966
+ model.dependencies.contentTypes.forEach((id) => id[1] = []);
967
+ if ((_b = model.dependencies) == null ? void 0 : _b.components)
968
+ model.dependencies.components.forEach((id) => id[1] = []);
969
+ }
962
970
  log.raw("");
963
971
  log.object(model);
964
972
  }
@@ -1378,9 +1386,10 @@ Components:`));
1378
1386
  ImportEntries = async ({
1379
1387
  commit,
1380
1388
  fromFile,
1381
- logOutput
1389
+ logOutput,
1390
+ saveEntries
1382
1391
  }) => {
1383
- var _a, _b, _c, _d, _e, _f, _g;
1392
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1384
1393
  const { currentEnv, currentProject, log, messages } = this;
1385
1394
  const contensis = await this.ConnectContensisImport({
1386
1395
  commit,
@@ -1397,20 +1406,24 @@ Components:`));
1397
1406
  const [err, result] = await contensis.MigrateEntries();
1398
1407
  if (err)
1399
1408
  (0, import_logger.logError)(err);
1400
- else
1401
- await this.HandleFormattingAndOutput(result, () => {
1409
+ else {
1410
+ const output = saveEntries ? (_a = contensis.content.targets[currentProject].migrateEntries) == null ? void 0 : _a.map(
1411
+ (me) => me.finalEntry
1412
+ ) : result;
1413
+ await this.HandleFormattingAndOutput(output, () => {
1402
1414
  (0, import_console.printEntriesMigrateResult)(this, result, {
1403
1415
  showAll: logOutput === "all",
1404
1416
  showDiff: logOutput === "all" || logOutput === "changes",
1405
1417
  showChanged: logOutput === "changes"
1406
1418
  });
1407
1419
  });
1408
- if (!err && !((_a = result.errors) == null ? void 0 : _a.length) && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && (((_b = result.migrateResult) == null ? void 0 : _b.created) || ((_c = result.migrateResult) == null ? void 0 : _c.updated)))) {
1420
+ }
1421
+ if (!err && !((_b = result.errors) == null ? void 0 : _b.length) && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && (((_c = result.migrateResult) == null ? void 0 : _c.created) || ((_d = result.migrateResult) == null ? void 0 : _d.updated)))) {
1409
1422
  log.success(
1410
1423
  messages.entries.imported(
1411
1424
  currentEnv,
1412
1425
  commit,
1413
- commit ? (((_d = result.migrateResult) == null ? void 0 : _d.created) || 0) + (((_e = result.migrateResult) == null ? void 0 : _e.updated) || 0) : result.entriesToMigrate[currentProject].totalCount
1426
+ commit ? (((_e = result.migrateResult) == null ? void 0 : _e.created) || 0) + (((_f = result.migrateResult) == null ? void 0 : _f.updated) || 0) : result.entriesToMigrate[currentProject].totalCount
1414
1427
  )
1415
1428
  );
1416
1429
  if (!commit) {
@@ -1419,7 +1432,7 @@ Components:`));
1419
1432
  }
1420
1433
  } else {
1421
1434
  log.error(messages.entries.failedImport(currentEnv), err);
1422
- if (!((_g = (_f = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _f[currentProject]) == null ? void 0 : _g.totalCount))
1435
+ if (!((_h = (_g = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _g[currentProject]) == null ? void 0 : _h.totalCount))
1423
1436
  log.help(messages.entries.notFound(currentEnv));
1424
1437
  }
1425
1438
  } else {