contensis-cli 1.0.12-beta.0 → 1.0.12-beta.2

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.
@@ -119,7 +119,12 @@ Example call:
119
119
  logOutput: opts.outputEntries
120
120
  });
121
121
  });
122
- program.command("nodes").description("import nodes").addOption(import_globalOptions.commit).addHelpText(
122
+ program.command("nodes").description("import nodes").addOption(import_globalOptions.commit).addOption(
123
+ new import_commander.Option(
124
+ "-on --output-nodes <outputNodes>",
125
+ "how much detail to output from the nodes import"
126
+ ).choices(["errors", "changes", "all"]).default("errors")
127
+ ).addHelpText(
123
128
  "after",
124
129
  `
125
130
  Example call:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/commands/import.ts"],
4
- "sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { commit, mapContensisOpts } from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addOption(\n new Option(\n '-oe --output-entries <outputEntries>',\n 'which details of the entries included in the import to output'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes --from-file component-backup.json\n > import nodes --source-alias example-alias --source-project-id example-project\n`\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputNod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B,EAAE,YAAY;AAAA,MACZ,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,MACf,WAAW,KAAK;AAAA,IAClB,CAAC;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
4
+ "sourcesContent": ["import { Command, Option } from 'commander';\nimport { cliCommand } from '~/services/ContensisCliService';\nimport { commit, mapContensisOpts } from './globalOptions';\n\nexport const makeImportCommand = () => {\n const program = new Command()\n .command('import')\n .description('import command')\n .addHelpText('after', `\\n`)\n .showHelpAfterError(true)\n .exitOverride();\n\n program\n .command('models')\n .description('import complete content models')\n .argument('[modelIds...]', 'ids of the content models to import (optional)')\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import models blogPost --from-file contentmodels-backup.json\n > import models --source-alias example-dev\n`\n )\n .action(async (modelIds: string[], opts) => {\n await cliCommand(\n ['import', 'models', modelIds.join(' ')],\n opts,\n mapContensisOpts({ modelIds, ...opts })\n ).ImportContentModels({\n fromFile: opts.fromFile,\n commit: opts.commit,\n });\n });\n\n program\n .command('contenttypes')\n .description('import content types')\n .argument(\n '[contentTypeIds...]',\n 'Optional list of API id(s) of the content type(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import contenttypes {contentTypeIds} --from-file contenttypes-backup.json\n > import contenttypes {contentTypeIds} --source-alias example-dev\n`\n )\n .action(async (contentTypeIds: string[], opts) => {\n await cliCommand(\n ['import', 'contenttypes'],\n opts,\n mapContensisOpts({ contentTypeIds, ...opts })\n ).ImportContentTypes(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n contentTypeIds\n );\n });\n\n program\n .command('components')\n .description('import components')\n .argument(\n '[componentIds...]',\n 'Optional list of API id(s) of the component(s) to import'\n )\n .addOption(commit)\n .addHelpText(\n 'after',\n `\nExample call:\n > import components {componentIds} --from-file component-backup.json\n > import components {componentIds} --source-alias example-dev\n`\n )\n .action(async (componentIds: string[], opts) => {\n await cliCommand(\n ['import', 'component'],\n opts,\n mapContensisOpts({ componentIds, ...opts })\n ).ImportComponents(\n {\n fromFile: opts.fromFile,\n commit: opts.commit,\n },\n componentIds\n );\n });\n\n program\n .command('entries')\n .description('import entries')\n .argument(\n '[search phrase]',\n 'get entries with the search phrase, use quotes for multiple words'\n )\n .addOption(commit)\n .option(\n '-preserve --preserve-guids',\n 'include this flag when you are importing entries that you have previously exported and wish to update'\n )\n .addOption(\n new Option(\n '-oe --output-entries <outputEntries>',\n 'which details of the entries included in the import to output'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import entries --source-cms example-dev --source-project-id microsite --zenql \"sys.contentTypeId = blog\"\n`\n )\n .action(async (phrase: string, opts, cmd) => {\n await cliCommand(\n ['import', 'entries'],\n opts,\n mapContensisOpts({ phrase, ...opts })\n ).ImportEntries({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputEntries,\n });\n });\n\n // TODO: add options to import one an array of nodes? nodeIds: string[]\n program\n .command('nodes')\n .description('import nodes')\n .addOption(commit)\n .addOption(\n new Option(\n '-on --output-nodes <outputNodes>',\n 'how much detail to output from the nodes import'\n )\n .choices(['errors', 'changes', 'all'])\n .default('errors')\n )\n .addHelpText(\n 'after',\n `\nExample call:\n > import nodes --from-file component-backup.json\n > import nodes --source-alias example-alias --source-project-id example-project\n`\n )\n .action(async opts => {\n await cliCommand(\n ['import', 'nodes'],\n opts,\n mapContensisOpts({ ...opts })\n ).ImportNodes({\n commit: opts.commit,\n fromFile: opts.fromFile,\n logOutput: opts.outputNodes,\n });\n });\n\n return program;\n};\n\nexport const get = makeImportCommand();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAgC;AAChC,iCAA2B;AAC3B,2BAAyC;AAElC,MAAM,oBAAoB,MAAM;AACrC,QAAM,UAAU,IAAI,yBAAQ,EACzB,QAAQ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;AAAA,EACH,CAAC;AAEH,SAAO;AACT;AAEO,MAAM,MAAM,kBAAkB;",
6
6
  "names": []
7
7
  }
@@ -34,7 +34,15 @@ class ContensisAuthService {
34
34
  rootUrl
35
35
  }) {
36
36
  let credentials;
37
- if (username && password) {
37
+ if (clientId && clientSecret) {
38
+ credentials = {
39
+ clientType: "client_credentials",
40
+ clientDetails: {
41
+ clientId,
42
+ clientSecret
43
+ }
44
+ };
45
+ } else if (username && password) {
38
46
  credentials = {
39
47
  clientType: "contensis_classic",
40
48
  clientDetails: {
@@ -50,13 +58,7 @@ class ContensisAuthService {
50
58
  }
51
59
  };
52
60
  } else {
53
- credentials = {
54
- clientType: "client_credentials",
55
- clientDetails: {
56
- clientId,
57
- clientSecret
58
- }
59
- };
61
+ credentials = { clientType: "none", clientDetails: { refreshToken: "" } };
60
62
  }
61
63
  this.client = import_client.NodejsClient.create({
62
64
  ...credentials,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/services/ContensisAuthService.ts"],
4
- "sourcesContent": ["import { NodejsClient } from 'contensis-management-api/lib/client';\nimport { ClientGrants, ClientGrantType } from 'contensis-core-api';\n\nclass ContensisAuthService {\n private client: NodejsClient;\n\n constructor({\n clientId = '',\n clientSecret = '',\n username,\n password,\n refreshToken,\n projectId,\n rootUrl,\n }: {\n clientId?: string;\n clientSecret?: string;\n username?: string;\n password?: string;\n refreshToken?: string;\n projectId: string;\n rootUrl: string;\n }) {\n let credentials: {\n clientType: ClientGrantType;\n clientDetails: ClientGrants;\n };\n if (username && password) {\n credentials = {\n clientType: 'contensis_classic',\n clientDetails: {\n username,\n password,\n },\n };\n } else if (refreshToken) {\n credentials = {\n clientType: 'contensis_classic_refresh_token',\n clientDetails: {\n refreshToken,\n },\n };\n } else {\n credentials = {\n clientType: 'client_credentials',\n clientDetails: {\n clientId,\n clientSecret,\n },\n };\n }\n\n this.client = NodejsClient.create({\n ...credentials,\n projectId,\n rootUrl,\n });\n }\n\n ClassicToken = async () => {\n // make sure our token isn't expried.\n await this.client.ensureBearerToken();\n return (this.client as any).contensisClassicToken;\n };\n BearerToken = async () =>\n this.client.bearerToken || (await this.client.ensureBearerToken());\n RefreshToken = async () =>\n !this.client.isRefreshTokenExpired() ? this.client.refreshToken : null;\n\n /* PROJECTS */\n ProjectId = () => this.client.clientConfig.projectId;\n RootUrl = () => this.client.clientConfig.rootUrl;\n}\n\nexport default ContensisAuthService;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAG7B,MAAM,qBAAqB;AAAA,EACjB;AAAA,EAER,YAAY;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAQG;AACD,QAAI;AAIJ,QAAI,YAAY,UAAU;AACxB,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,WAAW,cAAc;AACvB,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,IACF,OAAO;AACL,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,SAAK,SAAS,2BAAa,OAAO;AAAA,MAChC,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,YAAY;AAEzB,UAAM,KAAK,OAAO,kBAAkB;AACpC,WAAQ,KAAK,OAAe;AAAA,EAC9B;AAAA,EACA,cAAc,YACZ,KAAK,OAAO,eAAgB,MAAM,KAAK,OAAO,kBAAkB;AAAA,EAClE,eAAe,YACb,CAAC,KAAK,OAAO,sBAAsB,IAAI,KAAK,OAAO,eAAe;AAAA,EAGpE,YAAY,MAAM,KAAK,OAAO,aAAa;AAAA,EAC3C,UAAU,MAAM,KAAK,OAAO,aAAa;AAC3C;AAEA,IAAO,+BAAQ;",
4
+ "sourcesContent": ["import { NodejsClient } from 'contensis-management-api/lib/client';\nimport { ClientGrants, ClientGrantType } from 'contensis-core-api';\n\nclass ContensisAuthService {\n private client: NodejsClient;\n\n constructor({\n clientId = '',\n clientSecret = '',\n username,\n password,\n refreshToken,\n projectId,\n rootUrl,\n }: {\n clientId?: string;\n clientSecret?: string;\n username?: string;\n password?: string;\n refreshToken?: string;\n projectId: string;\n rootUrl: string;\n }) {\n let credentials: {\n clientType: ClientGrantType;\n clientDetails: ClientGrants;\n };\n if (clientId && clientSecret) {\n credentials = {\n clientType: 'client_credentials',\n clientDetails: {\n clientId,\n clientSecret,\n },\n };\n } else if (username && password) {\n credentials = {\n clientType: 'contensis_classic',\n clientDetails: {\n username,\n password,\n },\n };\n } else if (refreshToken) {\n credentials = {\n clientType: 'contensis_classic_refresh_token',\n clientDetails: {\n refreshToken,\n },\n };\n } else {\n credentials = { clientType: 'none', clientDetails: { refreshToken: '' } };\n }\n\n this.client = NodejsClient.create({\n ...credentials,\n projectId,\n rootUrl,\n });\n }\n\n ClassicToken = async () => {\n // make sure our token isn't expried.\n await this.client.ensureBearerToken();\n return (this.client as any).contensisClassicToken;\n };\n BearerToken = async () =>\n this.client.bearerToken || (await this.client.ensureBearerToken());\n RefreshToken = async () =>\n !this.client.isRefreshTokenExpired() ? this.client.refreshToken : null;\n\n /* PROJECTS */\n ProjectId = () => this.client.clientConfig.projectId;\n RootUrl = () => this.client.clientConfig.rootUrl;\n}\n\nexport default ContensisAuthService;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAG7B,MAAM,qBAAqB;AAAA,EACjB;AAAA,EAER,YAAY;AAAA,IACV,WAAW;AAAA,IACX,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAQG;AACD,QAAI;AAIJ,QAAI,YAAY,cAAc;AAC5B,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,WAAW,YAAY,UAAU;AAC/B,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,WAAW,cAAc;AACvB,oBAAc;AAAA,QACZ,YAAY;AAAA,QACZ,eAAe;AAAA,UACb;AAAA,QACF;AAAA,MACF;AAAA,IACF,OAAO;AACL,oBAAc,EAAE,YAAY,QAAQ,eAAe,EAAE,cAAc,GAAG,EAAE;AAAA,IAC1E;AAEA,SAAK,SAAS,2BAAa,OAAO;AAAA,MAChC,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,eAAe,YAAY;AAEzB,UAAM,KAAK,OAAO,kBAAkB;AACpC,WAAQ,KAAK,OAAe;AAAA,EAC9B;AAAA,EACA,cAAc,YACZ,KAAK,OAAO,eAAgB,MAAM,KAAK,OAAO,kBAAkB;AAAA,EAClE,eAAe,YACb,CAAC,KAAK,OAAO,sBAAsB,IAAI,KAAK,OAAO,eAAe;AAAA,EAGpE,YAAY,MAAM,KAAK,OAAO,aAAa;AAAA,EAC3C,UAAU,MAAM,KAAK,OAAO,aAAa;AAC3C;AAEA,IAAO,+BAAQ;",
6
6
  "names": []
7
7
  }
@@ -341,14 +341,16 @@ class ContensisCli {
341
341
  }
342
342
  };
343
343
  Login = async (userId, {
344
- password = (0, import_util.isPassword)(this.env.passwordFallback),
344
+ password = "",
345
345
  promptPassword = true,
346
- sharedSecret = (0, import_util.isSharedSecret)(this.env.passwordFallback),
346
+ sharedSecret = "",
347
347
  silent = false,
348
348
  attempt = 1
349
349
  } = {}) => {
350
350
  var _a, _b, _c, _d;
351
351
  let inputPassword = password || sharedSecret;
352
+ if (!inputPassword)
353
+ inputPassword = (0, import_util.isSharedSecret)(this.env.passwordFallback) || (0, import_util.isPassword)(this.env.passwordFallback) || "";
352
354
  const { log, messages } = this;
353
355
  if (userId) {
354
356
  const { currentEnv, env } = this;
@@ -686,9 +688,7 @@ class ContensisCli {
686
688
  ` ${import_chalk.default.bold.grey(
687
689
  "contentTypes"
688
690
  )}: ${permissions.contentTypes.map(
689
- (p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(
690
- " "
691
- )}`
691
+ (p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(" ")}`
692
692
  ).join(", ")}`
693
693
  );
694
694
  }
@@ -1238,9 +1238,9 @@ Components:`));
1238
1238
  const [err, result] = await contensis.DeleteEntries();
1239
1239
  if (result)
1240
1240
  this.HandleFormattingAndOutput(result, () => {
1241
- (0, import_console.printMigrateResult)(this, result, {
1241
+ (0, import_console.printEntriesMigrateResult)(this, result, {
1242
1242
  action: "delete",
1243
- showAllEntries: true
1243
+ showAll: true
1244
1244
  });
1245
1245
  });
1246
1246
  if (!err && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && ((_a = result.migrateResult) == null ? void 0 : _a.deleted))) {
@@ -1268,11 +1268,11 @@ Components:`));
1268
1268
  entries,
1269
1269
  () => {
1270
1270
  var _a;
1271
- return (0, import_migratortron.logEntriesTable)(
1271
+ return (0, import_migratortron.logEntitiesTable)({
1272
1272
  entries,
1273
- currentProject,
1274
- (_a = contensis.payload.query) == null ? void 0 : _a.fields
1275
- );
1273
+ projectId: currentProject,
1274
+ fields: (_a = contensis.payload.query) == null ? void 0 : _a.fields
1275
+ });
1276
1276
  }
1277
1277
  );
1278
1278
  } else {
@@ -1304,9 +1304,9 @@ Components:`));
1304
1304
  (0, import_logger.logError)(err);
1305
1305
  else
1306
1306
  this.HandleFormattingAndOutput(result, () => {
1307
- (0, import_console.printMigrateResult)(this, result, {
1308
- showAllEntries: logOutput === "all",
1309
- showChangedEntries: logOutput === "changes"
1307
+ (0, import_console.printEntriesMigrateResult)(this, result, {
1308
+ showAll: logOutput === "all",
1309
+ showChanged: logOutput === "changes"
1310
1310
  });
1311
1311
  });
1312
1312
  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)))) {
@@ -1345,32 +1345,8 @@ Components:`));
1345
1345
  }
1346
1346
  const root = contensis.content.sourceRepo.nodes.tree;
1347
1347
  log.success(messages.nodes.get(currentProject, rootPath, depth));
1348
- const outputNode = (node, spaces) => `${node.entry ? log.highlightText("e") : log.infoText("-")}${node.isCanonical ? log.highlightText("c") : log.infoText("-")}${node.includeInMenu ? log.highlightText("m") : log.infoText("-")}${spaces}${node.isCanonical ? log.boldText(`/${node.slug}`) : `/${node.slug}`}${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ""}${node.childCount ? ` +${node.childCount}` : ``} ${log.infoText(node.displayName)}`;
1349
1348
  this.HandleFormattingAndOutput(root, () => {
1350
- log.object({ ...root, children: void 0 });
1351
- log.raw("");
1352
- log.info(
1353
- `${log.highlightText("e")} = has entry; ${log.highlightText(
1354
- "c"
1355
- )} = canonical; ${log.highlightText("m")} = include in menu`
1356
- );
1357
- log.line();
1358
- const outputChildren = (root2, depth2 = 2) => {
1359
- let str = "";
1360
- for (const node of root2 == null ? void 0 : root2.children) {
1361
- str += `${outputNode(node, Array(depth2 + 1).join(" "))}
1362
- `;
1363
- if ("children" in node)
1364
- str += outputChildren(node, depth2 + 1);
1365
- }
1366
- return str;
1367
- };
1368
- const children = outputChildren(root);
1369
- log.limits(
1370
- `${outputNode(root, " ")}${children ? `
1371
- ${children}` : ""}`,
1372
- 100
1373
- );
1349
+ (0, import_console.printNodeTreeOutput)(this, root);
1374
1350
  });
1375
1351
  } else {
1376
1352
  log.warning(messages.models.noList(currentProject));
@@ -1401,9 +1377,9 @@ ${children}` : ""}`,
1401
1377
  (0, import_logger.logError)(err);
1402
1378
  else
1403
1379
  this.HandleFormattingAndOutput(result, () => {
1404
- (0, import_console.printMigrateResult)(this, result, {
1405
- showAllEntries: logOutput === "all",
1406
- showChangedEntries: logOutput === "changes"
1380
+ (0, import_console.printNodesMigrateResult)(this, result, {
1381
+ showAll: logOutput === "all",
1382
+ showChanged: logOutput === "changes"
1407
1383
  });
1408
1384
  });
1409
1385
  const nodesTotalCount = result == null ? void 0 : result.nodesToMigrate[currentProject].totalCount;
@@ -1426,7 +1402,7 @@ ${children}` : ""}`,
1426
1402
  }
1427
1403
  } else {
1428
1404
  if (noChange) {
1429
- log.help(messages.nodes.noChange(currentEnv), err);
1405
+ log.help(messages.nodes.noChange(currentEnv));
1430
1406
  } else {
1431
1407
  log.error(messages.nodes.failedImport(currentEnv), err);
1432
1408
  if (!nodesTotalCount)