contensis-cli 1.0.12-beta.1 → 1.0.12-beta.11

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.
Files changed (61) hide show
  1. package/README.md +9 -9
  2. package/dist/commands/get.js +13 -1
  3. package/dist/commands/get.js.map +2 -2
  4. package/dist/commands/globalOptions.js +9 -10
  5. package/dist/commands/globalOptions.js.map +2 -2
  6. package/dist/commands/import.js +25 -10
  7. package/dist/commands/import.js.map +2 -2
  8. package/dist/commands/index.js +2 -2
  9. package/dist/commands/index.js.map +2 -2
  10. package/dist/commands/list.js +9 -0
  11. package/dist/commands/list.js.map +2 -2
  12. package/dist/commands/remove.js +13 -0
  13. package/dist/commands/remove.js.map +2 -2
  14. package/dist/localisation/en-GB.js +8 -2
  15. package/dist/localisation/en-GB.js.map +2 -2
  16. package/dist/mappers/DevInit-to-CIWorkflow.js +6 -8
  17. package/dist/mappers/DevInit-to-CIWorkflow.js.map +2 -2
  18. package/dist/mappers/DevInit-to-RolePermissions.js.map +2 -2
  19. package/dist/providers/file-provider.js +5 -1
  20. package/dist/providers/file-provider.js.map +2 -2
  21. package/dist/services/ContensisAuthService.js.map +2 -2
  22. package/dist/services/ContensisCliService.js +164 -75
  23. package/dist/services/ContensisCliService.js.map +3 -3
  24. package/dist/services/ContensisDevService.js +48 -53
  25. package/dist/services/ContensisDevService.js.map +3 -3
  26. package/dist/shell.js +5 -0
  27. package/dist/shell.js.map +2 -2
  28. package/dist/util/console.printer.js +111 -10
  29. package/dist/util/console.printer.js.map +2 -2
  30. package/dist/util/error.js +36 -0
  31. package/dist/util/error.js.map +7 -0
  32. package/dist/util/find.js +10 -2
  33. package/dist/util/find.js.map +2 -2
  34. package/dist/util/git.js +1 -0
  35. package/dist/util/git.js.map +2 -2
  36. package/dist/util/logger.js +52 -9
  37. package/dist/util/logger.js.map +3 -3
  38. package/dist/version.js +1 -1
  39. package/dist/version.js.map +1 -1
  40. package/package.json +4 -4
  41. package/src/commands/get.ts +19 -1
  42. package/src/commands/globalOptions.ts +9 -7
  43. package/src/commands/import.ts +41 -13
  44. package/src/commands/index.ts +2 -3
  45. package/src/commands/list.ts +15 -0
  46. package/src/commands/remove.ts +20 -0
  47. package/src/localisation/en-GB.ts +10 -3
  48. package/src/mappers/DevInit-to-CIWorkflow.ts +6 -8
  49. package/src/mappers/DevInit-to-RolePermissions.ts +1 -0
  50. package/src/models/Cache.d.ts +1 -1
  51. package/src/providers/file-provider.ts +5 -1
  52. package/src/services/ContensisAuthService.ts +1 -1
  53. package/src/services/ContensisCliService.ts +206 -101
  54. package/src/services/ContensisDevService.ts +70 -66
  55. package/src/shell.ts +5 -0
  56. package/src/util/console.printer.ts +238 -12
  57. package/src/util/error.ts +7 -0
  58. package/src/util/find.ts +13 -2
  59. package/src/util/git.ts +2 -1
  60. package/src/util/logger.ts +90 -15
  61. package/src/version.ts +1 -1
@@ -6,18 +6,17 @@ import fetch from 'node-fetch';
6
6
  import path from 'path';
7
7
 
8
8
  import { Component, ContentType, Project } from 'contensis-core-api';
9
- import { Node } from 'contensis-delivery-api/lib/models';
10
9
  import { Entry, Role } from 'contensis-management-api/lib/models';
11
10
  import {
12
11
  ContensisMigrationService,
13
12
  MigrateRequest,
14
13
  PushBlockParams,
15
14
  SourceCms,
16
- logEntriesTable,
17
15
  ContentTypesResult,
18
16
  Model,
19
17
  MigrateModelsResult,
20
18
  BlockActionType,
19
+ logEntitiesTable,
21
20
  } from 'migratortron';
22
21
 
23
22
  import ContensisAuthService from './ContensisAuthService';
@@ -39,9 +38,11 @@ import {
39
38
  } from '~/util';
40
39
  import {
41
40
  printBlockVersion,
42
- printMigrateResult,
41
+ printEntriesMigrateResult,
43
42
  printModelMigrationAnalysis,
44
43
  printModelMigrationResult,
44
+ printNodeTreeOutput,
45
+ printNodesMigrateResult,
45
46
  } from '~/util/console.printer';
46
47
  import { csvFormatter } from '~/util/csv.formatter';
47
48
  import { xmlFormatter } from '~/util/xml.formatter';
@@ -62,23 +63,16 @@ class ContensisCli {
62
63
  process.exit(exitCode);
63
64
  };
64
65
 
65
- private command: CliCommand;
66
66
  private format?: OutputFormat;
67
67
  private output?: string;
68
68
  private session: SessionCacheProvider;
69
-
69
+
70
+ auth?: ContensisAuthService;
71
+ command: CliCommand;
70
72
  contensis?: ContensisMigrationService;
71
73
  contensisOpts: Partial<MigrateRequest>;
72
74
  currentProject: string;
73
75
 
74
- devinit!: {
75
- invokedBy: string;
76
- credentials: {
77
- clientId: string;
78
- clientSecret: string;
79
- };
80
- };
81
-
82
76
  sourceAlias?: string;
83
77
  targetEnv?: string;
84
78
  urls:
@@ -98,10 +92,6 @@ class ContensisCli {
98
92
  noun: string;
99
93
  thirdArg: string;
100
94
 
101
- get invokedBy() {
102
- return this.command.createdUserId;
103
- }
104
-
105
95
  get cache() {
106
96
  return this.session.Get();
107
97
  }
@@ -131,11 +121,6 @@ class ContensisCli {
131
121
  }
132
122
  }
133
123
 
134
- constructor(
135
- args: string[],
136
- outputOpts?: OutputOptionsConstructorArg,
137
- contensisOpts?: Partial<MigrateRequest>
138
- );
139
124
  constructor(
140
125
  args: string[],
141
126
  outputOpts?: OutputOptionsConstructorArg,
@@ -163,15 +148,19 @@ class ContensisCli {
163
148
  const environments = this.cache.environments || {};
164
149
  this.currentEnv = currentEnvironment;
165
150
 
151
+ // Set env from command options
166
152
  const env = this.env;
167
-
168
153
  if (outputOpts?.projectId) env.currentProject = outputOpts.projectId;
169
154
  if (outputOpts?.user) env.lastUserId = outputOpts.user;
170
155
  // setting this in env means passwordFallback is written to environments.json
171
156
  if (outputOpts?.password) env.passwordFallback = outputOpts.password;
172
157
  if (outputOpts?.clientId) env.lastUserId = outputOpts.clientId;
173
158
  if (outputOpts?.sharedSecret)
174
- env.passwordFallback = outputOpts.sharedSecret;
159
+ if (outputOpts.sharedSecret.startsWith('-'))
160
+ throw new Error(
161
+ `Shared secret option provided a value of ${outputOpts.sharedSecret}`
162
+ );
163
+ else env.passwordFallback = outputOpts.sharedSecret;
175
164
 
176
165
  this.currentProject = env?.currentProject || 'null';
177
166
  this.sourceAlias = outputOpts?.sourceAlias || currentEnvironment;
@@ -183,7 +172,7 @@ class ContensisCli {
183
172
  this.command = {
184
173
  commandText,
185
174
  createdDate: new Date().toISOString(),
186
- createdUserId: env?.lastUserId,
175
+ invokedBy: env?.lastUserId,
187
176
  };
188
177
 
189
178
  if (currentEnvironment) {
@@ -423,7 +412,10 @@ class ContensisCli {
423
412
 
424
413
  if (credentialError && !credentials.current) {
425
414
  // Log problem with Credential Provider
426
- log.error(credentialError as any);
415
+ log.error(
416
+ `Unable to find credentials for user ${userId} at ${currentEnv}`,
417
+ credentialError as any
418
+ );
427
419
  return;
428
420
  }
429
421
 
@@ -491,7 +483,7 @@ class ContensisCli {
491
483
  }
492
484
 
493
485
  if (inputPassword || cachedPassword || cachedSecret) {
494
- const authService = new ContensisAuthService({
486
+ this.auth = new ContensisAuthService({
495
487
  username: userId,
496
488
  password: inputPassword || cachedPassword,
497
489
  projectId: env?.currentProject || 'website',
@@ -500,9 +492,7 @@ class ContensisCli {
500
492
  clientSecret: sharedSecret || cachedSecret,
501
493
  });
502
494
 
503
- const [authError, bearerToken] = await to(
504
- authService.BearerToken()
505
- );
495
+ const [authError, bearerToken] = await to(this.auth.BearerToken());
506
496
 
507
497
  // Login successful
508
498
  if (bearerToken) {
@@ -783,7 +773,7 @@ class ContensisCli {
783
773
  }
784
774
  };
785
775
 
786
- CreateApiKey = async (name: string, description?: string) => {
776
+ CreateApiKey = async (name: string, description = '') => {
787
777
  const { currentEnv, log, messages } = this;
788
778
  const contensis = await this.ConnectContensis();
789
779
 
@@ -897,9 +887,9 @@ class ContensisCli {
897
887
  )}: ${permissions.contentTypes
898
888
  .map(
899
889
  p =>
900
- `${p.id} [${p.actions.join(',')}] ${p.languages.join(
901
- ' '
902
- )}`
890
+ `${p.id} [${p.actions.join(',')}] ${(
891
+ p as any
892
+ ).languages.join(' ')}`
903
893
  )
904
894
  .join(', ')}`
905
895
  );
@@ -1037,6 +1027,98 @@ class ContensisCli {
1037
1027
  }
1038
1028
  };
1039
1029
 
1030
+ PrintWorkflows = async () => {
1031
+ const { currentEnv, log, messages } = this;
1032
+ const contensis = await this.ConnectContensis();
1033
+
1034
+ if (contensis) {
1035
+ // Retrieve workflows list for env
1036
+ const [workflowsErr, workflows] =
1037
+ await contensis.content.sourceRepo.workflows.GetWorkflows();
1038
+
1039
+ if (Array.isArray(workflows)) {
1040
+ log.success(messages.workflows.list(currentEnv));
1041
+
1042
+ if (!workflows.length) log.help(messages.workflows.noneExist());
1043
+
1044
+ const stringFromLanguageObject = (o: { [lang: string]: string }) =>
1045
+ Object.values(o || {})?.[0];
1046
+
1047
+ this.HandleFormattingAndOutput(workflows, () => {
1048
+ // print the workflows to console
1049
+ // log.object(workflows);
1050
+ for (const {
1051
+ id,
1052
+ name,
1053
+ description,
1054
+ states,
1055
+ eventGroups,
1056
+ isSystem,
1057
+ } of workflows as any) {
1058
+ const color = isSystem ? (s: string) => s : log.infoText;
1059
+
1060
+ console.log(
1061
+ color(
1062
+ ` - ${chalk.bold(
1063
+ stringFromLanguageObject(name)
1064
+ )} ${log.infoText(id)}`
1065
+ )
1066
+ );
1067
+ if (description)
1068
+ console.log(
1069
+ log.infoText(` ${stringFromLanguageObject(description)}`)
1070
+ );
1071
+ if (isSystem === false)
1072
+ console.log(` ${chalk.bold.grey('isSystem')}: false`);
1073
+ if (states?.length)
1074
+ console.log(
1075
+ ` ${chalk.bold.grey('states')}: ${states
1076
+ .map((state: any) => state.id)
1077
+ .join(', ')}`
1078
+ );
1079
+ if (eventGroups?.length)
1080
+ console.log(
1081
+ ` ${chalk.bold.grey('eventGroups')}: ${eventGroups
1082
+ .map((evtGrp: any) => evtGrp.id)
1083
+ .join(', ')}`
1084
+ );
1085
+ }
1086
+ });
1087
+ }
1088
+
1089
+ if (workflowsErr) {
1090
+ log.error(messages.workflows.noList(currentEnv));
1091
+ log.error(jsonFormatter(workflowsErr));
1092
+ }
1093
+ }
1094
+ };
1095
+
1096
+ PrintWorkflow = async (workflowNameOrId: string) => {
1097
+ const { currentEnv, log, messages } = this;
1098
+ const contensis = await this.ConnectContensis();
1099
+
1100
+ if (contensis) {
1101
+ // Retrieve workflows list for env
1102
+ const [workflowsErr, workflows] =
1103
+ await contensis.content.sourceRepo.workflows.GetWorkflows();
1104
+
1105
+ if (Array.isArray(workflows)) {
1106
+ log.success(messages.workflows.list(currentEnv));
1107
+
1108
+ const workflow = findByIdOrName(workflows, workflowNameOrId);
1109
+
1110
+ if (workflow) this.HandleFormattingAndOutput(workflow, log.object);
1111
+ else
1112
+ log.error(messages.workflows.failedGet(currentEnv, workflowNameOrId));
1113
+ }
1114
+
1115
+ if (workflowsErr) {
1116
+ log.error(messages.workflows.noList(currentEnv));
1117
+ log.error(jsonFormatter(workflowsErr));
1118
+ }
1119
+ }
1120
+ };
1121
+
1040
1122
  CreateProject = async (project: Project) => {
1041
1123
  const { currentEnv, log, messages } = this;
1042
1124
  const contensis = await this.ConnectContensis();
@@ -1304,7 +1386,7 @@ class ContensisCli {
1304
1386
  const { currentProject, log, messages } = this;
1305
1387
  const contensis = await this.ConnectContensisImport({
1306
1388
  commit,
1307
- importDataType: 'user-input',
1389
+ importDataType: 'user-input', // 'user-input' import type does not require a source cms
1308
1390
  });
1309
1391
  if (contensis) {
1310
1392
  const [err, result] = await contensis.DeleteContentTypes(contentTypeIds);
@@ -1481,7 +1563,7 @@ class ContensisCli {
1481
1563
  const { currentProject, log, messages } = this;
1482
1564
  const contensis = await this.ConnectContensisImport({
1483
1565
  commit,
1484
- importDataType: 'user-input',
1566
+ importDataType: 'user-input', // 'user-input' import type does not require a source cms
1485
1567
  });
1486
1568
  if (contensis) {
1487
1569
  const [err, result] = await contensis.DeleteContentTypes(
@@ -1567,7 +1649,7 @@ class ContensisCli {
1567
1649
  const { currentEnv, currentProject, log, messages } = this;
1568
1650
  const contensis = await this.ConnectContensisImport({
1569
1651
  commit,
1570
- importDataType: 'user-input',
1652
+ importDataType: 'user-input', // 'user-input' import type does not require a source cms
1571
1653
  });
1572
1654
 
1573
1655
  if (contensis) {
@@ -1580,9 +1662,9 @@ class ContensisCli {
1580
1662
  if (result)
1581
1663
  this.HandleFormattingAndOutput(result, () => {
1582
1664
  // print the migrateResult to console
1583
- printMigrateResult(this, result, {
1665
+ printEntriesMigrateResult(this, result, {
1584
1666
  action: 'delete',
1585
- showAllEntries: true,
1667
+ showAll: true,
1586
1668
  });
1587
1669
  });
1588
1670
  if (
@@ -1597,7 +1679,7 @@ class ContensisCli {
1597
1679
  }
1598
1680
  } else {
1599
1681
  log.error(messages.entries.failedRemove(currentEnv), err);
1600
- if (!result.entriesToMigrate[currentProject].totalCount)
1682
+ if (!result?.entriesToMigrate?.[currentProject]?.totalCount)
1601
1683
  log.help(messages.entries.notFound(currentEnv));
1602
1684
  }
1603
1685
  }
@@ -1616,11 +1698,11 @@ class ContensisCli {
1616
1698
  const entries = await contensis.GetEntries({ withDependents });
1617
1699
  this.HandleFormattingAndOutput(entries, () =>
1618
1700
  // print the entries to console
1619
- logEntriesTable(
1701
+ logEntitiesTable({
1620
1702
  entries,
1621
- currentProject,
1622
- contensis.payload.query?.fields
1623
- )
1703
+ projectId: currentProject,
1704
+ fields: contensis.payload.query?.fields,
1705
+ })
1624
1706
  );
1625
1707
  } else {
1626
1708
  log.warning(messages.models.noList(currentProject));
@@ -1659,9 +1741,9 @@ class ContensisCli {
1659
1741
  else
1660
1742
  this.HandleFormattingAndOutput(result, () => {
1661
1743
  // print the migrateResult to console
1662
- printMigrateResult(this, result, {
1663
- showAllEntries: logOutput === 'all',
1664
- showChangedEntries: logOutput === 'changes',
1744
+ printEntriesMigrateResult(this, result, {
1745
+ showAll: logOutput === 'all',
1746
+ showChanged: logOutput === 'changes',
1665
1747
  });
1666
1748
  });
1667
1749
 
@@ -1688,7 +1770,7 @@ class ContensisCli {
1688
1770
  }
1689
1771
  } else {
1690
1772
  log.error(messages.entries.failedImport(currentEnv), err);
1691
- if (!result.entriesToMigrate[currentProject].totalCount)
1773
+ if (!result?.entriesToMigrate?.[currentProject]?.totalCount)
1692
1774
  log.help(messages.entries.notFound(currentEnv));
1693
1775
  }
1694
1776
  } else {
@@ -1703,52 +1785,19 @@ class ContensisCli {
1703
1785
 
1704
1786
  if (contensis) {
1705
1787
  log.line();
1706
- const [err] = await to(
1707
- contensis.content.sourceRepo.nodes.GetNodes(rootPath, depth)
1708
- );
1788
+ const [err, nodes] = await to(contensis.nodes.GetNodes(rootPath, depth));
1709
1789
  if (err) {
1710
1790
  log.error(messages.nodes.failedGet(currentProject), err);
1711
1791
  return;
1712
1792
  }
1713
- const root = contensis.content.sourceRepo.nodes.tree;
1793
+ const root = contensis.nodes.sourceRepo.nodes.tree;
1714
1794
 
1715
1795
  log.success(messages.nodes.get(currentProject, rootPath, depth));
1716
1796
 
1717
- const outputNode = (node: Node | any, spaces: string) =>
1718
- `${node.entry ? log.highlightText('e') : log.infoText('-')}${
1719
- node.isCanonical ? log.highlightText('c') : log.infoText('-')
1720
- }${
1721
- node.includeInMenu ? log.highlightText('m') : log.infoText('-')
1722
- }${spaces}${
1723
- node.isCanonical ? log.boldText(`/${node.slug}`) : `/${node.slug}`
1724
- }${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ''}${
1725
- node.childCount ? ` +${node.childCount}` : ``
1726
- } ${log.infoText(node.displayName)}`;
1727
-
1728
- this.HandleFormattingAndOutput(root, () => {
1797
+ this.HandleFormattingAndOutput(nodes, () => {
1729
1798
  // print the nodes to console
1730
- log.object({ ...root, children: undefined });
1731
- log.raw('');
1732
- log.info(
1733
- `${log.highlightText('e')} = has entry; ${log.highlightText(
1734
- 'c'
1735
- )} = canonical; ${log.highlightText('m')} = include in menu`
1736
- );
1737
- log.line();
1738
- const outputChildren = (root: Node | undefined, depth = 2) => {
1739
- let str = '';
1740
- for (const node of (root as any)?.children as Node[]) {
1741
- str += `${outputNode(node, Array(depth + 1).join(' '))}\n`;
1742
- if ('children' in node) str += outputChildren(node, depth + 1);
1743
- }
1744
- return str;
1745
- };
1746
-
1747
- const children = outputChildren(root);
1748
- log.limits(
1749
- `${outputNode(root, ' ')}${children ? `\n${children}` : ''}`,
1750
- 100
1751
- );
1799
+ log.object({ ...root, children: undefined, language: undefined });
1800
+ printNodeTreeOutput(this, root);
1752
1801
  });
1753
1802
  } else {
1754
1803
  log.warning(messages.models.noList(currentProject));
@@ -1760,10 +1809,12 @@ class ContensisCli {
1760
1809
  commit,
1761
1810
  fromFile,
1762
1811
  logOutput,
1812
+ logLimit,
1763
1813
  }: {
1764
1814
  commit: boolean;
1765
1815
  fromFile: string;
1766
1816
  logOutput: string;
1817
+ logLimit: number;
1767
1818
  }) => {
1768
1819
  const { currentEnv, currentProject, log, messages } = this;
1769
1820
 
@@ -1782,28 +1833,34 @@ class ContensisCli {
1782
1833
  }
1783
1834
 
1784
1835
  const [err, result] = await contensis.MigrateNodes();
1836
+ const migrateTree =
1837
+ contensis.nodes.targetRepos[currentProject].nodes.migrateNodesTreeView;
1785
1838
 
1786
- if (err) logError(err);
1839
+ if (err) log.raw(``);
1787
1840
  else
1788
1841
  this.HandleFormattingAndOutput(result, () => {
1789
1842
  // print the migrateResult to console
1790
- // TODO: fix
1791
- printMigrateResult(this, result, {
1792
- showAllEntries: logOutput === 'all',
1793
- showChangedEntries: logOutput === 'changes',
1843
+ printNodeTreeOutput(this, migrateTree, logOutput, logLimit);
1844
+ printNodesMigrateResult(this, result, {
1845
+ showAll: logOutput === 'all',
1846
+ showChanged: logOutput === 'changes',
1794
1847
  });
1795
1848
  });
1796
1849
 
1797
- const nodesTotalCount = result?.nodesToMigrate[currentProject].totalCount;
1850
+ const nodesMigrateCount =
1851
+ result?.nodesToMigrate?.[currentProject].totalCount;
1798
1852
  const nodesCreated = result?.nodesResult?.['created'] || 0;
1799
1853
  const nodesUpdated = result?.nodesResult?.['updated'] || 0;
1800
- const noChange = result.nodesToMigrate[currentProject]['no change'] !== 0;
1854
+ const nodesErrored = result?.nodesResult?.['errors'] || 0;
1855
+ const noChanges =
1856
+ result?.nodesToMigrate?.[currentProject]['no change'] &&
1857
+ nodesMigrateCount === 0;
1801
1858
 
1802
1859
  if (
1803
1860
  !err &&
1804
- !result.errors?.length &&
1805
- ((!commit && nodesTotalCount) ||
1806
- (commit && (nodesCreated || nodesUpdated)))
1861
+ (!result.errors?.length || this.contensisOpts.ignoreErrors) &&
1862
+ ((!commit && nodesMigrateCount) ||
1863
+ (commit && (nodesCreated || nodesUpdated || result.errors?.length)))
1807
1864
  ) {
1808
1865
  let totalCount: number;
1809
1866
  if (commit) {
@@ -1813,20 +1870,20 @@ class ContensisCli {
1813
1870
  totalCount = created + updated;
1814
1871
  } else {
1815
1872
  totalCount =
1816
- typeof nodesTotalCount === 'number' ? nodesTotalCount : 0;
1873
+ typeof nodesMigrateCount === 'number' ? nodesMigrateCount : 0;
1817
1874
  }
1818
1875
 
1819
1876
  log.success(messages.nodes.imported(currentEnv, commit, totalCount));
1877
+ log.raw(``);
1820
1878
  if (!commit) {
1821
- log.raw(``);
1822
1879
  log.help(messages.nodes.commitTip());
1823
1880
  }
1824
1881
  } else {
1825
- if (noChange) {
1826
- log.help(messages.nodes.noChange(currentEnv), err);
1882
+ if (noChanges && !err && !nodesErrored) {
1883
+ log.help(messages.nodes.noChange(currentEnv));
1827
1884
  } else {
1828
1885
  log.error(messages.nodes.failedImport(currentEnv), err);
1829
- if (!nodesTotalCount) log.help(messages.nodes.notFound(currentEnv));
1886
+ if (!nodesMigrateCount) log.help(messages.nodes.notFound(currentEnv));
1830
1887
  }
1831
1888
  }
1832
1889
  } else {
@@ -1835,6 +1892,54 @@ class ContensisCli {
1835
1892
  }
1836
1893
  };
1837
1894
 
1895
+ RemoveNodes = async (commit = false) => {
1896
+ const { currentEnv, currentProject, log, messages } = this;
1897
+ const contensis = await this.ConnectContensisImport({
1898
+ commit,
1899
+ importDataType: 'user-input', // 'user-input' import type does not require a source cms
1900
+ });
1901
+
1902
+ if (contensis) {
1903
+ if (contensis.isPreview) {
1904
+ console.log(log.successText(` -- PREVIEW -- `));
1905
+ } else {
1906
+ console.log(log.warningText(` *** COMMITTING DELETE *** `));
1907
+ }
1908
+ const [err, result] = await contensis.DeleteNodes();
1909
+ if (result) {
1910
+ this.HandleFormattingAndOutput(result, () => {
1911
+ // print the migrateResult to console
1912
+ printNodeTreeOutput(
1913
+ this,
1914
+ contensis.nodes.targetRepos[currentProject].nodes
1915
+ .migrateNodesTreeView
1916
+ );
1917
+ // printNodesMigrateResult(this, result, {
1918
+ // action: 'delete',
1919
+ // showAll: true,
1920
+ // });
1921
+ });
1922
+ }
1923
+ if (
1924
+ !err &&
1925
+ ((!commit && result.nodesToMigrate[currentProject].totalCount) ||
1926
+ (commit && result.nodesResult?.deleted))
1927
+ ) {
1928
+ log.success(
1929
+ messages.nodes.removed(currentEnv, commit, contensis.nodes.rootPath)
1930
+ );
1931
+ log.raw(``);
1932
+ if (!commit) {
1933
+ log.help(messages.nodes.commitTip());
1934
+ }
1935
+ } else {
1936
+ log.error(messages.nodes.failedRemove(currentEnv), err);
1937
+ if (!result?.nodesToMigrate?.[currentProject]?.totalCount)
1938
+ log.help(messages.nodes.notFound(currentEnv));
1939
+ }
1940
+ }
1941
+ };
1942
+
1838
1943
  PrintWebhookSubscriptions = async (subscriptionIdsOrNames?: string[]) => {
1839
1944
  const { currentEnv, log, messages } = this;
1840
1945
  const contensis = await this.ConnectContensis();