contensis-cli 1.0.0-beta.96 → 1.0.0-beta.97

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.
@@ -63,6 +63,9 @@ class ContensisCli {
63
63
  contensis;
64
64
  contensisOpts;
65
65
  currentProject;
66
+ clientDetailsLocation;
67
+ clientId;
68
+ clientSecret;
66
69
  sourceAlias;
67
70
  targetEnv;
68
71
  urls;
@@ -1373,6 +1376,67 @@ ${children}` : ""}`,
1373
1376
  log.help(messages.connect.tip());
1374
1377
  }
1375
1378
  };
1379
+ ImportNodes = async ({
1380
+ commit,
1381
+ fromFile,
1382
+ logOutput
1383
+ }) => {
1384
+ var _a, _b, _c;
1385
+ const { currentEnv, currentProject, log, messages } = this;
1386
+ const contensis = await this.ConnectContensisImport({
1387
+ commit,
1388
+ fromFile,
1389
+ importDataType: "nodes"
1390
+ });
1391
+ if (contensis) {
1392
+ log.line();
1393
+ if (contensis.isPreview) {
1394
+ console.log(log.successText(` -- IMPORT PREVIEW -- `));
1395
+ } else {
1396
+ console.log(log.warningText(` *** COMMITTING IMPORT *** `));
1397
+ }
1398
+ const [err, result] = await contensis.MigrateNodes();
1399
+ if (err)
1400
+ (0, import_logger.logError)(err);
1401
+ else
1402
+ this.HandleFormattingAndOutput(result, () => {
1403
+ (0, import_console.printMigrateResult)(this, result, {
1404
+ showAllEntries: logOutput === "all",
1405
+ showChangedEntries: logOutput === "changes"
1406
+ });
1407
+ });
1408
+ const nodesTotalCount = result == null ? void 0 : result.nodesToMigrate[currentProject].totalCount;
1409
+ const nodesCreated = ((_a = result == null ? void 0 : result.nodesResult) == null ? void 0 : _a["created"]) || 0;
1410
+ const nodesUpdated = ((_b = result == null ? void 0 : result.nodesResult) == null ? void 0 : _b["updated"]) || 0;
1411
+ const noChange = result.nodesToMigrate[currentProject]["no change"] !== 0;
1412
+ if (!err && !((_c = result.errors) == null ? void 0 : _c.length) && (!commit && nodesTotalCount || commit && (nodesCreated || nodesUpdated))) {
1413
+ let totalCount;
1414
+ if (commit) {
1415
+ let created = typeof nodesCreated === "number" ? nodesCreated : 0;
1416
+ let updated = typeof nodesUpdated === "number" ? nodesUpdated : 0;
1417
+ totalCount = created + updated;
1418
+ } else {
1419
+ totalCount = typeof nodesTotalCount === "number" ? nodesTotalCount : 0;
1420
+ }
1421
+ log.success(messages.nodes.imported(currentEnv, commit, totalCount));
1422
+ if (!commit) {
1423
+ log.raw(``);
1424
+ log.help(messages.nodes.commitTip());
1425
+ }
1426
+ } else {
1427
+ if (noChange) {
1428
+ log.help(messages.nodes.noChange(currentEnv), err);
1429
+ } else {
1430
+ log.error(messages.nodes.failedImport(currentEnv), err);
1431
+ if (!nodesTotalCount)
1432
+ log.help(messages.nodes.notFound(currentEnv));
1433
+ }
1434
+ }
1435
+ } else {
1436
+ log.warning(messages.models.noList(currentProject));
1437
+ log.help(messages.connect.tip());
1438
+ }
1439
+ };
1376
1440
  PrintWebhookSubscriptions = async (subscriptionIdsOrNames) => {
1377
1441
  const { currentEnv, log, messages } = this;
1378
1442
  const contensis = await this.ConnectContensis();