contensis-cli 1.5.1-beta.1 → 1.5.1-beta.10

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.
@@ -42,7 +42,7 @@ var import_rfdc = __toESM(require("rfdc"));
42
42
  var import_migratortron = require("migratortron");
43
43
  var import_ContensisAuthService = __toESM(require("./ContensisAuthService"));
44
44
  var import_en_GB = require("../localisation/en-GB");
45
- var import_file_provider = require("../providers/file-provider");
45
+ var import_MixedFileData = require("../mappers/MixedFileData");
46
46
  var import_SessionCacheProvider = __toESM(require("../providers/SessionCacheProvider"));
47
47
  var import_CredentialProvider = __toESM(require("../providers/CredentialProvider"));
48
48
  var import_util = require("../util");
@@ -121,7 +121,7 @@ class ContensisCli {
121
121
  );
122
122
  }
123
123
  this.format = outputOpts == null ? void 0 : outputOpts.format;
124
- this.output = (outputOpts == null ? void 0 : outputOpts.output) && import_path.default.join(process.cwd(), outputOpts.output);
124
+ this.output = (outputOpts == null ? void 0 : outputOpts.output) ? import_path.default.isAbsolute(outputOpts.output) ? outputOpts.output : import_path.default.join(process.cwd(), outputOpts.output) : void 0;
125
125
  const currentEnvironment = (outputOpts == null ? void 0 : outputOpts.alias) || this.currentEnv;
126
126
  const environments = this.cache.environments || {};
127
127
  this.currentEnv = currentEnvironment;
@@ -262,16 +262,13 @@ class ContensisCli {
262
262
  };
263
263
  ConnectContensisImport = async ({
264
264
  commit = false,
265
+ noSource = false,
265
266
  fromFile,
266
- importDataType,
267
- importData,
268
- mixedData
267
+ importData
269
268
  }) => {
270
269
  var _a, _b, _c, _d, _e, _f;
271
- const source = fromFile || importData || mixedData ? "file" : "contensis";
272
- const fileData = importData || (fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : []);
273
- if (typeof fileData === "string")
274
- throw new Error(`Import file format must be of type JSON`);
270
+ const source = fromFile || importData || noSource ? "user-input" : "contensis";
271
+ const mixedData = fromFile ? await new import_MixedFileData.MixedFileData().readFile(fromFile) : importData;
275
272
  const { contensisOpts, currentEnv, env, log, messages, sourceAlias } = this;
276
273
  const environments = this.cache.environments || {};
277
274
  const sourceEnvironment = environments[sourceAlias || ""] || {};
@@ -297,7 +294,7 @@ class ContensisCli {
297
294
  );
298
295
  const cachedTargetPassword = (_b = targetCredentials == null ? void 0 : targetCredentials.current) == null ? void 0 : _b.password;
299
296
  if (cachedSourcePassword && cachedTargetPassword) {
300
- if (source === "file" || importDataType === "user-input") {
297
+ if (source === "user-input") {
301
298
  this.contensis = new import_migratortron.ContensisMigrationService(
302
299
  {
303
300
  concurrency: 2,
@@ -312,7 +309,6 @@ class ContensisCli {
312
309
  targetProjects: [env.currentProject || ""],
313
310
  assetHostname: (_d = this.urls) == null ? void 0 : _d.previewWeb
314
311
  },
315
- ...importDataType ? { [importDataType]: fileData } : {},
316
312
  ...mixedData || {}
317
313
  },
318
314
  !commit
@@ -891,14 +887,16 @@ class ContensisCli {
891
887
  }) => {
892
888
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
893
889
  const { currentEnv, currentProject, log, messages } = this;
890
+ let importData;
891
+ if (tags) {
892
+ importData = new import_MixedFileData.MixedFileData();
893
+ importData.tags = tags;
894
+ importData.tagGroups = data || [];
895
+ }
894
896
  const contensis = await this.ConnectContensisImport({
895
897
  commit,
896
898
  fromFile,
897
- importDataType: tags ? "user-input" : "tagGroups",
898
- mixedData: {
899
- tagGroups: data,
900
- tags
901
- }
899
+ importData
902
900
  });
903
901
  if (contensis) {
904
902
  log.line();
@@ -994,10 +992,7 @@ class ContensisCli {
994
992
  withDependents
995
993
  });
996
994
  if (Array.isArray(result)) {
997
- let tags = [];
998
- const groups = [];
999
- if (withDependents) (0, import_util.splitTagsAndGroups)(result, tags, groups);
1000
- else tags = result;
995
+ const { tags, tagGroups } = new import_MixedFileData.MixedFileData(result);
1001
996
  log.success(messages.tags.list(currentEnv, tags.length));
1002
997
  if (tags)
1003
998
  await this.HandleFormattingAndOutput(result, () => {
@@ -1005,10 +1000,12 @@ class ContensisCli {
1005
1000
  log.raw("");
1006
1001
  log.object(tag);
1007
1002
  }
1008
- if (groups.length) {
1003
+ if (tagGroups.length) {
1009
1004
  log.raw("");
1010
- log.success(messages.taggroups.list(currentEnv, groups.length));
1011
- for (const group of groups) {
1005
+ log.success(
1006
+ messages.taggroups.list(currentEnv, tagGroups.length)
1007
+ );
1008
+ for (const group of tagGroups) {
1012
1009
  log.raw("");
1013
1010
  log.object(group);
1014
1011
  }
@@ -1027,10 +1024,7 @@ class ContensisCli {
1027
1024
  withDependents
1028
1025
  });
1029
1026
  if (Array.isArray(result)) {
1030
- let tags = [];
1031
- const groups = [];
1032
- if (withDependents) (0, import_util.splitTagsAndGroups)(result, tags, groups);
1033
- else tags = result;
1027
+ const { tags, tagGroups } = new import_MixedFileData.MixedFileData(result);
1034
1028
  log.success(messages.tags.list(currentEnv, tags.length));
1035
1029
  if (!tags.length) log.help(messages.tags.noneExist());
1036
1030
  await this.HandleFormattingAndOutput(result, () => {
@@ -1038,10 +1032,10 @@ class ContensisCli {
1038
1032
  log.raw("");
1039
1033
  log.object(tag);
1040
1034
  }
1041
- if (groups.length) {
1035
+ if (tagGroups.length) {
1042
1036
  log.raw("");
1043
- log.success(messages.taggroups.list(currentEnv, groups.length));
1044
- for (const { version, ...group } of groups) {
1037
+ log.success(messages.taggroups.list(currentEnv, tagGroups.length));
1038
+ for (const { version, ...group } of tagGroups) {
1045
1039
  log.raw("");
1046
1040
  log.object(group);
1047
1041
  }
@@ -1058,25 +1052,22 @@ class ContensisCli {
1058
1052
  data,
1059
1053
  save
1060
1054
  }) => {
1061
- var _a, _b, _c, _d, _e;
1055
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1062
1056
  const { currentEnv, currentProject, log, messages } = this;
1063
- const mixedData = { tags: [], tagGroups: [] };
1057
+ let importData;
1064
1058
  if (data) {
1065
- mixedData.tags = data;
1066
- mixedData.tagGroups = [...new Set(data.map((t) => t.groupId))].map(
1059
+ importData = new import_MixedFileData.MixedFileData();
1060
+ importData.tags = data;
1061
+ importData.tagGroups = [...new Set(data.map((t) => t.groupId))].map(
1067
1062
  (id) => ({
1068
1063
  id
1069
1064
  })
1070
1065
  );
1071
1066
  }
1072
- if (fromFile) {
1073
- const fileData = fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : [];
1074
- (0, import_util.splitTagsAndGroups)(fileData, mixedData.tags, mixedData.tagGroups);
1075
- }
1076
1067
  const contensis = await this.ConnectContensisImport({
1077
1068
  commit,
1078
- importDataType: "tags",
1079
- mixedData
1069
+ fromFile,
1070
+ importData
1080
1071
  });
1081
1072
  if (contensis) {
1082
1073
  log.line();
@@ -1112,13 +1103,18 @@ class ContensisCli {
1112
1103
  log.help(messages.migrate.commitTip());
1113
1104
  }
1114
1105
  } else {
1115
- log.error(
1116
- messages.tags.failedCreate(
1117
- currentEnv,
1118
- (data == null ? void 0 : data.length) === 1 ? data == null ? void 0 : data[0].label["en-GB"] : void 0
1119
- ),
1120
- err
1121
- );
1106
+ const noChanges = ((_g = (_f = result == null ? void 0 : result.tagsToMigrate) == null ? void 0 : _f[currentProject]) == null ? void 0 : _g["no change"]) && ((_h = result == null ? void 0 : result.tagsToMigrate) == null ? void 0 : _h[currentProject].totalCount) === 0 && ((_i = result == null ? void 0 : result.groupsToMigrate) == null ? void 0 : _i[currentProject].totalCount) === 0;
1107
+ if (noChanges && !err && !((_j = result.errors) == null ? void 0 : _j.length)) {
1108
+ log.help(messages.tags.noChange(currentEnv));
1109
+ } else {
1110
+ log.error(
1111
+ messages.tags.failedCreate(
1112
+ currentEnv,
1113
+ (data == null ? void 0 : data.length) === 1 ? data == null ? void 0 : data[0].label["en-GB"] : void 0
1114
+ ),
1115
+ err
1116
+ );
1117
+ }
1122
1118
  }
1123
1119
  } else {
1124
1120
  log.warning(messages.models.noList(currentProject));
@@ -1131,8 +1127,7 @@ class ContensisCli {
1131
1127
  this.contensisOpts.concurrency = 1;
1132
1128
  const contensis = await this.ConnectContensisImport({
1133
1129
  commit,
1134
- importDataType: "user-input"
1135
- // 'user-input' import type does not require a source cms
1130
+ noSource: true
1136
1131
  });
1137
1132
  if (contensis) {
1138
1133
  log.line();
@@ -1288,6 +1283,7 @@ class ContensisCli {
1288
1283
  const models = await contensis.models.contentModels();
1289
1284
  const contentTypes = await contensis.models.contentTypes();
1290
1285
  const components = await contensis.models.components();
1286
+ const tagGroups = await contensis.models.tagGroups();
1291
1287
  const returnModels = (modelIds == null ? void 0 : modelIds.length) ? models == null ? void 0 : models.filter(
1292
1288
  (m) => modelIds.some((id) => id.toLowerCase() === m.id.toLowerCase())
1293
1289
  ) : void 0;
@@ -1310,12 +1306,23 @@ class ContensisCli {
1310
1306
  }).flat()
1311
1307
  )
1312
1308
  );
1309
+ const tagGroupIds = Array.from(
1310
+ new Set(
1311
+ (returnModels || models || []).map((m) => {
1312
+ var _a, _b;
1313
+ return ((_b = (_a = m.dependencies) == null ? void 0 : _a.tagGroups) == null ? void 0 : _b.map((g) => g[0])) || [];
1314
+ }).flat()
1315
+ )
1316
+ );
1313
1317
  exportResources.push(
1314
1318
  ...contentTypes.filter(
1315
1319
  (c) => contentTypeIds.map((i) => i.toLowerCase()).includes(c.id.toLowerCase())
1316
1320
  ),
1317
1321
  ...components.filter(
1318
1322
  (c) => componentIds.map((i) => i.toLowerCase()).includes(c.id.toLowerCase())
1323
+ ),
1324
+ ...tagGroups.filter(
1325
+ (g) => tagGroupIds.map((i) => i.toLowerCase()).includes(g.id.toLowerCase())
1319
1326
  )
1320
1327
  );
1321
1328
  }
@@ -1349,17 +1356,18 @@ class ContensisCli {
1349
1356
  await this.HandleFormattingAndOutput(
1350
1357
  opts.export ? exportResources : models,
1351
1358
  () => {
1352
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1359
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
1353
1360
  for (const model of models) {
1354
1361
  const components2 = ((_a = model.components) == null ? void 0 : _a.length) || 0;
1355
1362
  const contentTypes2 = ((_b = model.contentTypes) == null ? void 0 : _b.length) || 0;
1356
- const defaults = (((_c = model.defaults) == null ? void 0 : _c.length) || 0) + (((_d = model.nodes) == null ? void 0 : _d.length) || 0);
1357
- const dependencies = (((_f = (_e = model.dependencies) == null ? void 0 : _e.components) == null ? void 0 : _f.length) || 0) + (((_h = (_g = model.dependencies) == null ? void 0 : _g.contentTypes) == null ? void 0 : _h.length) || 0);
1358
- const dependencyOf = (((_j = (_i = model.dependencyOf) == null ? void 0 : _i.components) == null ? void 0 : _j.length) || 0) + (((_l = (_k = model.dependencyOf) == null ? void 0 : _k.contentTypes) == null ? void 0 : _l.length) || 0);
1359
- const hasAny = components2 + contentTypes2 + dependencies + dependencyOf;
1363
+ const tagGroups2 = ((_c = model.tagGroups) == null ? void 0 : _c.length) || 0;
1364
+ const defaults = (((_d = model.defaults) == null ? void 0 : _d.length) || 0) + (((_e = model.nodes) == null ? void 0 : _e.length) || 0);
1365
+ const dependencies = (((_g = (_f = model.dependencies) == null ? void 0 : _f.components) == null ? void 0 : _g.length) || 0) + (((_i = (_h = model.dependencies) == null ? void 0 : _h.contentTypes) == null ? void 0 : _i.length) || 0) + (((_k = (_j = model.dependencies) == null ? void 0 : _j.tagGroups) == null ? void 0 : _k.length) || 0);
1366
+ const dependencyOf = (((_m = (_l = model.dependencyOf) == null ? void 0 : _l.components) == null ? void 0 : _m.length) || 0) + (((_o = (_n = model.dependencyOf) == null ? void 0 : _n.contentTypes) == null ? void 0 : _o.length) || 0);
1367
+ const hasAny = components2 + contentTypes2 + tagGroups2 + dependencies + dependencyOf;
1360
1368
  log.raw(
1361
1369
  ` - ${log.highlightText(log.boldText(model.id))} ${hasAny ? log.infoText(
1362
- `{ ${components2 ? `components: ${components2}, ` : ""}${contentTypes2 ? `contentTypes: ${contentTypes2}, ` : ""}${defaults ? `defaults: ${defaults}, ` : ""}${dependencies ? `references: ${dependencies}, ` : ""}${dependencyOf ? `required by: ${dependencyOf}` : ""} }`
1370
+ `{ ${components2 ? `components: ${components2}, ` : ""}${contentTypes2 ? `contentTypes: ${contentTypes2}, ` : ""}${tagGroups2 ? `tagGroups: ${tagGroups2}, ` : ""}${defaults ? `defaults: ${defaults}, ` : ""}${dependencies ? `references: ${dependencies}, ` : ""}${dependencyOf ? `required by: ${dependencyOf}` : ""} }`
1363
1371
  ) : ""}`
1364
1372
  );
1365
1373
  }
@@ -1375,13 +1383,9 @@ class ContensisCli {
1375
1383
  fromFile
1376
1384
  }) => {
1377
1385
  const { currentProject, log, messages } = this;
1378
- const fileData = fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : [];
1379
- if (typeof fileData === "string")
1380
- throw new Error(`Import file format must be of type JSON`);
1381
1386
  const contensis = await this.ConnectContensisImport({
1382
1387
  commit,
1383
- fromFile,
1384
- importDataType: "models"
1388
+ fromFile
1385
1389
  });
1386
1390
  if (contensis) {
1387
1391
  log.line();
@@ -1405,6 +1409,11 @@ Components:`));
1405
1409
  if (!result.components) log.info(`- None returned
1406
1410
  `);
1407
1411
  else (0, import_console.printModelMigrationAnalysis)(this, result.components);
1412
+ if (result.tagGroups && Object.keys(result.tagGroups).length) {
1413
+ log.raw(log.boldText(`
1414
+ Tag Groups:`));
1415
+ (0, import_console.printModelMigrationAnalysis)(this, result.tagGroups);
1416
+ }
1408
1417
  if (result.defaults && Object.keys(result.defaults).length) {
1409
1418
  log.raw(log.boldText(`
1410
1419
  Defaults:`));
@@ -1438,6 +1447,16 @@ Components:`));
1438
1447
  modelsResult[currentProject].components
1439
1448
  );
1440
1449
  }
1450
+ if (Object.values(modelsResult[currentProject].tagGroups || {}).some(
1451
+ (r) => r.length > 0
1452
+ )) {
1453
+ log.raw(log.boldText(`
1454
+ Tag Groups:`));
1455
+ (0, import_console.printModelMigrationResult)(
1456
+ this,
1457
+ modelsResult[currentProject].tagGroups
1458
+ );
1459
+ }
1441
1460
  if (Object.values(modelsResult[currentProject].defaults || {}).some(
1442
1461
  (r) => r.length > 0
1443
1462
  )) {
@@ -1510,8 +1529,7 @@ Nodes:`));
1510
1529
  const { currentProject, log, messages } = this;
1511
1530
  const contensis = await this.ConnectContensisImport({
1512
1531
  commit,
1513
- importDataType: "user-input"
1514
- // 'user-input' import type does not require a source cms
1532
+ noSource: true
1515
1533
  });
1516
1534
  if (contensis) {
1517
1535
  const [err, result] = await contensis.DeleteContentTypes(contentTypeIds);
@@ -1532,6 +1550,7 @@ Nodes:`));
1532
1550
  )
1533
1551
  );
1534
1552
  await this.HandleFormattingAndOutput(result, log.object);
1553
+ if (!commit) log.help(messages.migrate.commitTip());
1535
1554
  }
1536
1555
  }
1537
1556
  };
@@ -1540,17 +1559,15 @@ Nodes:`));
1540
1559
  fromFile
1541
1560
  }, contentTypeIds = []) => {
1542
1561
  const { currentProject, log, messages } = this;
1543
- let fileData = fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : [];
1544
- if (typeof fileData === "string")
1545
- throw new Error(`Import file format must be of type JSON`);
1546
- if (!Array.isArray(fileData)) fileData = [fileData];
1562
+ let importData;
1563
+ if (fromFile) importData = await new import_MixedFileData.MixedFileData().readFile(fromFile);
1547
1564
  const contensis = await this.ConnectContensisImport({
1548
1565
  commit,
1549
- importDataType: fromFile ? "user-input" : void 0
1566
+ noSource: !!fromFile
1550
1567
  });
1551
1568
  if (contensis) {
1552
1569
  if (fromFile)
1553
- for (const contentType of fileData) {
1570
+ for (const contentType of importData.models) {
1554
1571
  contentType.projectId = currentProject;
1555
1572
  delete contentType.uuid;
1556
1573
  const [err, , createStatus] = await contensis.models.targets[currentProject].repo.UpsertContentType(false, contentType);
@@ -1574,23 +1591,21 @@ Nodes:`));
1574
1591
  );
1575
1592
  await this.HandleFormattingAndOutput(result, log.object);
1576
1593
  }
1594
+ if (!commit) log.help(messages.migrate.commitTip());
1577
1595
  }
1578
1596
  };
1579
1597
  DiffModels = async ({
1580
1598
  fromFile
1581
1599
  }, modelIds = []) => {
1582
1600
  const { log } = this;
1583
- let fileData = fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : [];
1584
- if (typeof fileData === "string")
1585
- throw new Error(`Import file format must be of type JSON`);
1586
- if (!Array.isArray(fileData)) fileData = [fileData];
1587
- const contensis = await this.ConnectContensisImport({
1588
- fromFile,
1589
- importDataType: "models"
1590
- });
1601
+ let importData;
1602
+ if (fromFile) importData = await new import_MixedFileData.MixedFileData().readFile(fromFile);
1603
+ const contensis = await this.ConnectContensisImport({ fromFile });
1591
1604
  if (contensis) {
1592
1605
  const [err, result] = await (0, import_await_to_js.default)(
1593
- contensis.models.Diff(fileData.length ? fileData : modelIds)
1606
+ contensis.models.Diff(
1607
+ importData.models.length ? importData.models : modelIds
1608
+ )
1594
1609
  );
1595
1610
  if (err) log.error(err.message, err);
1596
1611
  if (result)
@@ -1657,8 +1672,7 @@ Components:`));
1657
1672
  const { currentProject, log, messages } = this;
1658
1673
  const contensis = await this.ConnectContensisImport({
1659
1674
  commit,
1660
- importDataType: "user-input"
1661
- // 'user-input' import type does not require a source cms
1675
+ noSource: true
1662
1676
  });
1663
1677
  if (contensis) {
1664
1678
  const [err, result] = await contensis.DeleteContentTypes(
@@ -1682,6 +1696,7 @@ Components:`));
1682
1696
  )
1683
1697
  );
1684
1698
  await this.HandleFormattingAndOutput(result, log.object);
1699
+ if (!commit) log.help(messages.migrate.commitTip());
1685
1700
  }
1686
1701
  }
1687
1702
  };
@@ -1690,17 +1705,15 @@ Components:`));
1690
1705
  fromFile
1691
1706
  }, componentIds = []) => {
1692
1707
  const { currentProject, log, messages } = this;
1693
- let fileData = fromFile ? await (0, import_file_provider.readFileAsJSON)(fromFile) || [] : [];
1694
- if (typeof fileData === "string")
1695
- throw new Error(`Import file format must be of type JSON`);
1696
- if (!Array.isArray(fileData)) fileData = [fileData];
1708
+ let importData;
1709
+ if (fromFile) importData = await new import_MixedFileData.MixedFileData().readFile(fromFile);
1697
1710
  const contensis = await this.ConnectContensisImport({
1698
1711
  commit,
1699
- importDataType: fromFile ? "user-input" : void 0
1712
+ noSource: !!fromFile
1700
1713
  });
1701
1714
  if (contensis) {
1702
1715
  if (fromFile)
1703
- for (const component of fileData) {
1716
+ for (const component of importData.models) {
1704
1717
  component.projectId = currentProject;
1705
1718
  delete component.uuid;
1706
1719
  const [err, , createStatus] = await contensis.models.targets[currentProject].repo.UpsertComponent(false, component);
@@ -1724,6 +1737,7 @@ Components:`));
1724
1737
  );
1725
1738
  await this.HandleFormattingAndOutput(result, log.object);
1726
1739
  }
1740
+ if (!commit) log.help(messages.migrate.commitTip());
1727
1741
  }
1728
1742
  };
1729
1743
  RemoveEntries = async (commit = false) => {
@@ -1732,8 +1746,7 @@ Components:`));
1732
1746
  this.contensisOpts.concurrency = 1;
1733
1747
  const contensis = await this.ConnectContensisImport({
1734
1748
  commit,
1735
- importDataType: "user-input"
1736
- // 'user-input' import type does not require a source cms
1749
+ noSource: true
1737
1750
  });
1738
1751
  if (contensis) {
1739
1752
  if (contensis.isPreview) {
@@ -1798,13 +1811,14 @@ Components:`));
1798
1811
  saveEntries,
1799
1812
  data
1800
1813
  }) => {
1801
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1814
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
1802
1815
  const { currentEnv, currentProject, log, messages } = this;
1816
+ let importData;
1817
+ if (data) importData = new import_MixedFileData.MixedFileData(data);
1803
1818
  const contensis = await this.ConnectContensisImport({
1804
1819
  commit,
1805
1820
  fromFile,
1806
- importDataType: "entries",
1807
- importData: data
1821
+ importData
1808
1822
  });
1809
1823
  if (contensis) {
1810
1824
  log.line();
@@ -1816,12 +1830,14 @@ Components:`));
1816
1830
  const [err, result] = await contensis.MigrateEntries();
1817
1831
  if (err) (0, import_logger.logError)(err);
1818
1832
  else {
1819
- const { entries, nodes } = contensis.content.targets[currentProject];
1833
+ const { entries, nodes, tags } = contensis.content.targets[currentProject];
1820
1834
  const output = saveEntries ? (
1821
- // include entries and dependent nodes when saving entries
1835
+ // include entries and dependent nodes (or tags) when saving entries
1822
1836
  [
1823
1837
  ((_a = entries.migrate) == null ? void 0 : _a.map((me) => me.toJSON())) || [],
1824
- nodes.migrateNodes.map((mn) => mn.node)
1838
+ nodes.migrateNodes.map((mn) => mn.node),
1839
+ tags.migrateTags.map((mt) => mt.toJSON()),
1840
+ tags.migrateGroups.map((mg) => mg.toJSON())
1825
1841
  ].flat()
1826
1842
  ) : result;
1827
1843
  await this.HandleFormattingAndOutput(output, () => {
@@ -1848,7 +1864,8 @@ Components:`));
1848
1864
  currentEnv,
1849
1865
  commit,
1850
1866
  commit ? (((_e = result.migrateResult) == null ? void 0 : _e.created) || 0) + (((_f = result.migrateResult) == null ? void 0 : _f.updated) || 0) : result.entriesToMigrate[currentProject].totalCount,
1851
- commit ? (((_g = result.nodesResult) == null ? void 0 : _g.created) || 0) + (((_h = result.nodesResult) == null ? void 0 : _h.updated) || 0) : ((_i = result.nodesToMigrate) == null ? void 0 : _i[currentProject].totalCount) || 0
1867
+ commit ? (((_g = result.nodesResult) == null ? void 0 : _g.created) || 0) + (((_h = result.nodesResult) == null ? void 0 : _h.updated) || 0) : ((_i = result.nodesToMigrate) == null ? void 0 : _i[currentProject].totalCount) || 0,
1868
+ commit ? (((_j = result.tagsResult) == null ? void 0 : _j.created) || 0) + (((_k = result.tagsResult) == null ? void 0 : _k.updated) || 0) : ((_l = result.tagsToMigrate) == null ? void 0 : _l[currentProject].totalCount) || 0
1852
1869
  )
1853
1870
  );
1854
1871
  if (!commit) {
@@ -1856,9 +1873,16 @@ Components:`));
1856
1873
  log.help(messages.migrate.commitTip());
1857
1874
  }
1858
1875
  } else {
1859
- log.error(messages.entries.failedImport(currentEnv), err);
1860
- if (!((_k = (_j = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _j[currentProject]) == null ? void 0 : _k.totalCount))
1861
- log.help(messages.entries.notFound(currentEnv));
1876
+ const noChanges = Object.values(((_m = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _m[currentProject]) || {}).every(
1877
+ (status) => typeof status === "number" || (status["no change"] || 0) > 0
1878
+ ) && ((_n = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _n[currentProject].totalCount) === 0;
1879
+ if (noChanges && !err && !((_o = result == null ? void 0 : result.migrateResult) == null ? void 0 : _o.errors) && !((_p = result == null ? void 0 : result.nodesResult) == null ? void 0 : _p.errors) && !((_q = result == null ? void 0 : result.tagsResult) == null ? void 0 : _q.errors)) {
1880
+ log.help(messages.entries.noChange(currentEnv));
1881
+ } else {
1882
+ log.error(messages.entries.failedImport(currentEnv), err);
1883
+ if (!((_s = (_r = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _r[currentProject]) == null ? void 0 : _s.totalCount))
1884
+ log.help(messages.entries.notFound(currentEnv));
1885
+ }
1862
1886
  }
1863
1887
  } else {
1864
1888
  log.warning(messages.models.noList(currentProject));
@@ -1875,8 +1899,7 @@ Components:`));
1875
1899
  const { currentEnv, currentProject, log, messages } = this;
1876
1900
  const contensis = await this.ConnectContensisImport({
1877
1901
  commit,
1878
- fromFile,
1879
- importDataType: "entries"
1902
+ fromFile
1880
1903
  });
1881
1904
  if (contensis) {
1882
1905
  log.line();
@@ -1933,8 +1956,7 @@ Components:`));
1933
1956
  const { currentEnv, currentProject, log, messages } = this;
1934
1957
  const contensis = await this.ConnectContensisImport({
1935
1958
  commit,
1936
- fromFile,
1937
- importDataType: "entries"
1959
+ fromFile
1938
1960
  });
1939
1961
  if (contensis) {
1940
1962
  log.line();
@@ -2011,8 +2033,7 @@ Components:`));
2011
2033
  const { currentEnv, currentProject, log, messages } = this;
2012
2034
  const contensis = await this.ConnectContensisImport({
2013
2035
  commit,
2014
- fromFile,
2015
- importDataType: "nodes"
2036
+ fromFile
2016
2037
  });
2017
2038
  if (contensis) {
2018
2039
  log.line();
@@ -2069,8 +2090,7 @@ Components:`));
2069
2090
  const { currentEnv, currentProject, log, messages } = this;
2070
2091
  const contensis = await this.ConnectContensisImport({
2071
2092
  commit,
2072
- importDataType: "user-input"
2073
- // 'user-input' import type does not require a source cms
2093
+ noSource: true
2074
2094
  });
2075
2095
  if (contensis) {
2076
2096
  if (contensis.isPreview) {