contensis-cli 1.0.12-beta.5 → 1.0.12-beta.7
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.
- package/dist/commands/get.js +12 -0
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/import.js +10 -5
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/list.js +9 -0
- package/dist/commands/list.js.map +2 -2
- package/dist/localisation/en-GB.js +6 -0
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/providers/file-provider.js +5 -1
- package/dist/providers/file-provider.js.map +2 -2
- package/dist/services/ContensisCliService.js +88 -11
- package/dist/services/ContensisCliService.js.map +2 -2
- package/dist/shell.js +2 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/console.printer.js +49 -45
- package/dist/util/console.printer.js.map +3 -3
- package/dist/util/error.js +36 -0
- package/dist/util/error.js.map +7 -0
- package/dist/util/find.js +10 -2
- package/dist/util/find.js.map +2 -2
- package/dist/util/logger.js +48 -9
- package/dist/util/logger.js.map +3 -3
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/get.ts +18 -0
- package/src/commands/import.ts +10 -4
- package/src/commands/list.ts +15 -0
- package/src/localisation/en-GB.ts +7 -0
- package/src/providers/file-provider.ts +5 -1
- package/src/services/ContensisCliService.ts +111 -11
- package/src/shell.ts +2 -0
- package/src/util/console.printer.ts +118 -54
- package/src/util/error.ts +7 -0
- package/src/util/find.ts +13 -2
- package/src/util/logger.ts +90 -17
- package/src/version.ts +1 -1
|
@@ -594,7 +594,7 @@ class ContensisCli {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
|
-
CreateApiKey = async (name, description) => {
|
|
597
|
+
CreateApiKey = async (name, description = "") => {
|
|
598
598
|
const { currentEnv, log, messages } = this;
|
|
599
599
|
const contensis = await this.ConnectContensis();
|
|
600
600
|
if (contensis) {
|
|
@@ -796,6 +796,78 @@ class ContensisCli {
|
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
798
|
};
|
|
799
|
+
PrintWorkflows = async () => {
|
|
800
|
+
const { currentEnv, log, messages } = this;
|
|
801
|
+
const contensis = await this.ConnectContensis();
|
|
802
|
+
if (contensis) {
|
|
803
|
+
const [workflowsErr, workflows] = await contensis.content.sourceRepo.workflows.GetWorkflows();
|
|
804
|
+
if (Array.isArray(workflows)) {
|
|
805
|
+
log.success(messages.workflows.list(currentEnv));
|
|
806
|
+
if (!workflows.length)
|
|
807
|
+
log.help(messages.workflows.noneExist());
|
|
808
|
+
const stringFromLanguageObject = (o) => {
|
|
809
|
+
var _a;
|
|
810
|
+
return (_a = Object.values(o || {})) == null ? void 0 : _a[0];
|
|
811
|
+
};
|
|
812
|
+
this.HandleFormattingAndOutput(workflows, () => {
|
|
813
|
+
for (const {
|
|
814
|
+
id,
|
|
815
|
+
name,
|
|
816
|
+
description,
|
|
817
|
+
states,
|
|
818
|
+
eventGroups,
|
|
819
|
+
isSystem
|
|
820
|
+
} of workflows) {
|
|
821
|
+
const color = isSystem ? (s) => s : log.infoText;
|
|
822
|
+
console.log(
|
|
823
|
+
color(
|
|
824
|
+
` - ${import_chalk.default.bold(
|
|
825
|
+
stringFromLanguageObject(name)
|
|
826
|
+
)} ${log.infoText(id)}`
|
|
827
|
+
)
|
|
828
|
+
);
|
|
829
|
+
if (description)
|
|
830
|
+
console.log(
|
|
831
|
+
log.infoText(` ${stringFromLanguageObject(description)}`)
|
|
832
|
+
);
|
|
833
|
+
if (isSystem === false)
|
|
834
|
+
console.log(` ${import_chalk.default.bold.grey("isSystem")}: false`);
|
|
835
|
+
if (states == null ? void 0 : states.length)
|
|
836
|
+
console.log(
|
|
837
|
+
` ${import_chalk.default.bold.grey("states")}: ${states.map((state) => state.id).join(", ")}`
|
|
838
|
+
);
|
|
839
|
+
if (eventGroups == null ? void 0 : eventGroups.length)
|
|
840
|
+
console.log(
|
|
841
|
+
` ${import_chalk.default.bold.grey("eventGroups")}: ${eventGroups.map((evtGrp) => evtGrp.id).join(", ")}`
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
if (workflowsErr) {
|
|
847
|
+
log.error(messages.workflows.noList(currentEnv));
|
|
848
|
+
log.error((0, import_json.jsonFormatter)(workflowsErr));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
PrintWorkflow = async (workflowNameOrId) => {
|
|
853
|
+
const { currentEnv, log, messages } = this;
|
|
854
|
+
const contensis = await this.ConnectContensis();
|
|
855
|
+
if (contensis) {
|
|
856
|
+
const [workflowsErr, workflows] = await contensis.content.sourceRepo.workflows.GetWorkflows();
|
|
857
|
+
if (Array.isArray(workflows)) {
|
|
858
|
+
log.success(messages.workflows.list(currentEnv));
|
|
859
|
+
const workflow = (0, import_find.findByIdOrName)(workflows, workflowNameOrId);
|
|
860
|
+
if (workflow)
|
|
861
|
+
this.HandleFormattingAndOutput(workflow, log.object);
|
|
862
|
+
else
|
|
863
|
+
log.error(messages.workflows.failedGet(currentEnv, workflowNameOrId));
|
|
864
|
+
}
|
|
865
|
+
if (workflowsErr) {
|
|
866
|
+
log.error(messages.workflows.noList(currentEnv));
|
|
867
|
+
log.error((0, import_json.jsonFormatter)(workflowsErr));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
};
|
|
799
871
|
CreateProject = async (project) => {
|
|
800
872
|
const { currentEnv, log, messages } = this;
|
|
801
873
|
const contensis = await this.ConnectContensis();
|
|
@@ -1344,6 +1416,7 @@ Components:`));
|
|
|
1344
1416
|
const root = contensis.nodes.sourceRepo.nodes.tree;
|
|
1345
1417
|
log.success(messages.nodes.get(currentProject, rootPath, depth));
|
|
1346
1418
|
this.HandleFormattingAndOutput(nodes, () => {
|
|
1419
|
+
log.object({ ...root, children: void 0, language: void 0 });
|
|
1347
1420
|
(0, import_console.printNodeTreeOutput)(this, root);
|
|
1348
1421
|
});
|
|
1349
1422
|
} else {
|
|
@@ -1354,9 +1427,10 @@ Components:`));
|
|
|
1354
1427
|
ImportNodes = async ({
|
|
1355
1428
|
commit,
|
|
1356
1429
|
fromFile,
|
|
1357
|
-
logOutput
|
|
1430
|
+
logOutput,
|
|
1431
|
+
logLimit
|
|
1358
1432
|
}) => {
|
|
1359
|
-
var _a, _b, _c, _d, _e;
|
|
1433
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1360
1434
|
const { currentEnv, currentProject, log, messages } = this;
|
|
1361
1435
|
const contensis = await this.ConnectContensisImport({
|
|
1362
1436
|
commit,
|
|
@@ -1371,39 +1445,42 @@ Components:`));
|
|
|
1371
1445
|
console.log(log.warningText(` *** COMMITTING IMPORT *** `));
|
|
1372
1446
|
}
|
|
1373
1447
|
const [err, result] = await contensis.MigrateNodes();
|
|
1448
|
+
const migrateTree = contensis.nodes.targetRepos[currentProject].nodes.migrateNodesTreeView;
|
|
1374
1449
|
if (err)
|
|
1375
|
-
|
|
1450
|
+
log.raw(``);
|
|
1376
1451
|
else
|
|
1377
1452
|
this.HandleFormattingAndOutput(result, () => {
|
|
1453
|
+
(0, import_console.printNodeTreeOutput)(this, migrateTree, logOutput, logLimit);
|
|
1378
1454
|
(0, import_console.printNodesMigrateResult)(this, result, {
|
|
1379
1455
|
showAll: logOutput === "all",
|
|
1380
1456
|
showChanged: logOutput === "changes"
|
|
1381
1457
|
});
|
|
1382
1458
|
});
|
|
1383
|
-
const
|
|
1459
|
+
const nodesMigrateCount = (_a = result == null ? void 0 : result.nodesToMigrate) == null ? void 0 : _a[currentProject].totalCount;
|
|
1384
1460
|
const nodesCreated = ((_b = result == null ? void 0 : result.nodesResult) == null ? void 0 : _b["created"]) || 0;
|
|
1385
1461
|
const nodesUpdated = ((_c = result == null ? void 0 : result.nodesResult) == null ? void 0 : _c["updated"]) || 0;
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1462
|
+
const nodesErrored = ((_d = result == null ? void 0 : result.nodesResult) == null ? void 0 : _d["errored"]) || 0;
|
|
1463
|
+
const noChanges = ((_e = result == null ? void 0 : result.nodesToMigrate) == null ? void 0 : _e[currentProject]["no change"]) && nodesMigrateCount === 0;
|
|
1464
|
+
if (!err && (!((_f = result.errors) == null ? void 0 : _f.length) || this.contensisOpts.ignoreErrors) && (!commit && nodesMigrateCount || commit && (nodesCreated || nodesUpdated || ((_g = result.errors) == null ? void 0 : _g.length)))) {
|
|
1388
1465
|
let totalCount;
|
|
1389
1466
|
if (commit) {
|
|
1390
1467
|
let created = typeof nodesCreated === "number" ? nodesCreated : 0;
|
|
1391
1468
|
let updated = typeof nodesUpdated === "number" ? nodesUpdated : 0;
|
|
1392
1469
|
totalCount = created + updated;
|
|
1393
1470
|
} else {
|
|
1394
|
-
totalCount = typeof
|
|
1471
|
+
totalCount = typeof nodesMigrateCount === "number" ? nodesMigrateCount : 0;
|
|
1395
1472
|
}
|
|
1396
1473
|
log.success(messages.nodes.imported(currentEnv, commit, totalCount));
|
|
1474
|
+
log.raw(``);
|
|
1397
1475
|
if (!commit) {
|
|
1398
|
-
log.raw(``);
|
|
1399
1476
|
log.help(messages.nodes.commitTip());
|
|
1400
1477
|
}
|
|
1401
1478
|
} else {
|
|
1402
|
-
if (
|
|
1479
|
+
if (noChanges && !err && !nodesErrored) {
|
|
1403
1480
|
log.help(messages.nodes.noChange(currentEnv));
|
|
1404
1481
|
} else {
|
|
1405
1482
|
log.error(messages.nodes.failedImport(currentEnv), err);
|
|
1406
|
-
if (!
|
|
1483
|
+
if (!nodesMigrateCount)
|
|
1407
1484
|
log.help(messages.nodes.notFound(currentEnv));
|
|
1408
1485
|
}
|
|
1409
1486
|
}
|