contensis-cli 1.0.12-beta.0 → 1.0.12-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.
- package/README.md +9 -9
- package/dist/commands/get.js +13 -1
- package/dist/commands/get.js.map +2 -2
- package/dist/commands/globalOptions.js +9 -10
- package/dist/commands/globalOptions.js.map +2 -2
- package/dist/commands/import.js +25 -10
- package/dist/commands/import.js.map +2 -2
- package/dist/commands/index.js +2 -2
- package/dist/commands/index.js.map +2 -2
- package/dist/commands/list.js +9 -0
- package/dist/commands/list.js.map +2 -2
- package/dist/commands/remove.js +13 -0
- package/dist/commands/remove.js.map +2 -2
- package/dist/localisation/en-GB.js +8 -2
- package/dist/localisation/en-GB.js.map +2 -2
- package/dist/mappers/DevInit-to-CIWorkflow.js +6 -8
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +2 -2
- package/dist/mappers/DevInit-to-RolePermissions.js.map +2 -2
- package/dist/providers/file-provider.js +5 -1
- package/dist/providers/file-provider.js.map +2 -2
- package/dist/services/ContensisAuthService.js +10 -8
- package/dist/services/ContensisAuthService.js.map +2 -2
- package/dist/services/ContensisCliService.js +168 -77
- package/dist/services/ContensisCliService.js.map +3 -3
- package/dist/services/ContensisDevService.js +47 -53
- package/dist/services/ContensisDevService.js.map +3 -3
- package/dist/shell.js +5 -0
- package/dist/shell.js.map +2 -2
- package/dist/util/console.printer.js +111 -10
- package/dist/util/console.printer.js.map +2 -2
- 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/git.js +1 -0
- package/dist/util/git.js.map +2 -2
- package/dist/util/logger.js +52 -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 +4 -4
- package/src/commands/get.ts +19 -1
- package/src/commands/globalOptions.ts +9 -7
- package/src/commands/import.ts +41 -13
- package/src/commands/index.ts +2 -3
- package/src/commands/list.ts +15 -0
- package/src/commands/remove.ts +20 -0
- package/src/localisation/en-GB.ts +10 -3
- package/src/mappers/DevInit-to-CIWorkflow.ts +6 -8
- package/src/mappers/DevInit-to-RolePermissions.ts +1 -0
- package/src/models/Cache.d.ts +1 -1
- package/src/providers/file-provider.ts +5 -1
- package/src/services/ContensisAuthService.ts +11 -9
- package/src/services/ContensisCliService.ts +215 -103
- package/src/services/ContensisDevService.ts +73 -66
- package/src/shell.ts +5 -0
- package/src/util/console.printer.ts +238 -12
- package/src/util/error.ts +7 -0
- package/src/util/find.ts +13 -2
- package/src/util/git.ts +2 -1
- package/src/util/logger.ts +90 -15
- package/src/version.ts +1 -1
|
@@ -56,14 +56,14 @@ class ContensisCli {
|
|
|
56
56
|
const exitCode = error ? 1 : 0;
|
|
57
57
|
process.exit(exitCode);
|
|
58
58
|
};
|
|
59
|
-
command;
|
|
60
59
|
format;
|
|
61
60
|
output;
|
|
62
61
|
session;
|
|
62
|
+
auth;
|
|
63
|
+
command;
|
|
63
64
|
contensis;
|
|
64
65
|
contensisOpts;
|
|
65
66
|
currentProject;
|
|
66
|
-
devinit;
|
|
67
67
|
sourceAlias;
|
|
68
68
|
targetEnv;
|
|
69
69
|
urls;
|
|
@@ -72,9 +72,6 @@ class ContensisCli {
|
|
|
72
72
|
verb;
|
|
73
73
|
noun;
|
|
74
74
|
thirdArg;
|
|
75
|
-
get invokedBy() {
|
|
76
|
-
return this.command.createdUserId;
|
|
77
|
-
}
|
|
78
75
|
get cache() {
|
|
79
76
|
return this.session.Get();
|
|
80
77
|
}
|
|
@@ -123,7 +120,12 @@ class ContensisCli {
|
|
|
123
120
|
if (outputOpts == null ? void 0 : outputOpts.clientId)
|
|
124
121
|
env.lastUserId = outputOpts.clientId;
|
|
125
122
|
if (outputOpts == null ? void 0 : outputOpts.sharedSecret)
|
|
126
|
-
|
|
123
|
+
if (outputOpts.sharedSecret.startsWith("-"))
|
|
124
|
+
throw new Error(
|
|
125
|
+
`Shared secret option provided a value of ${outputOpts.sharedSecret}`
|
|
126
|
+
);
|
|
127
|
+
else
|
|
128
|
+
env.passwordFallback = outputOpts.sharedSecret;
|
|
127
129
|
this.currentProject = (env == null ? void 0 : env.currentProject) || "null";
|
|
128
130
|
this.sourceAlias = (outputOpts == null ? void 0 : outputOpts.sourceAlias) || currentEnvironment;
|
|
129
131
|
if (currentEnvironment) {
|
|
@@ -132,7 +134,7 @@ class ContensisCli {
|
|
|
132
134
|
this.command = {
|
|
133
135
|
commandText,
|
|
134
136
|
createdDate: new Date().toISOString(),
|
|
135
|
-
|
|
137
|
+
invokedBy: env == null ? void 0 : env.lastUserId
|
|
136
138
|
};
|
|
137
139
|
if (currentEnvironment) {
|
|
138
140
|
env.history = [this.command];
|
|
@@ -324,7 +326,10 @@ class ContensisCli {
|
|
|
324
326
|
password
|
|
325
327
|
).Init();
|
|
326
328
|
if (credentialError && !credentials.current) {
|
|
327
|
-
log.error(
|
|
329
|
+
log.error(
|
|
330
|
+
`Unable to find credentials for user ${userId} at ${currentEnv}`,
|
|
331
|
+
credentialError
|
|
332
|
+
);
|
|
328
333
|
return;
|
|
329
334
|
}
|
|
330
335
|
if (credentials.remarks.secure !== true) {
|
|
@@ -341,14 +346,16 @@ class ContensisCli {
|
|
|
341
346
|
}
|
|
342
347
|
};
|
|
343
348
|
Login = async (userId, {
|
|
344
|
-
password =
|
|
349
|
+
password = "",
|
|
345
350
|
promptPassword = true,
|
|
346
|
-
sharedSecret =
|
|
351
|
+
sharedSecret = "",
|
|
347
352
|
silent = false,
|
|
348
353
|
attempt = 1
|
|
349
354
|
} = {}) => {
|
|
350
355
|
var _a, _b, _c, _d;
|
|
351
356
|
let inputPassword = password || sharedSecret;
|
|
357
|
+
if (!inputPassword)
|
|
358
|
+
inputPassword = (0, import_util.isSharedSecret)(this.env.passwordFallback) || (0, import_util.isPassword)(this.env.passwordFallback) || "";
|
|
352
359
|
const { log, messages } = this;
|
|
353
360
|
if (userId) {
|
|
354
361
|
const { currentEnv, env } = this;
|
|
@@ -369,7 +376,7 @@ class ContensisCli {
|
|
|
369
376
|
]));
|
|
370
377
|
}
|
|
371
378
|
if (inputPassword || cachedPassword || cachedSecret) {
|
|
372
|
-
|
|
379
|
+
this.auth = new import_ContensisAuthService.default({
|
|
373
380
|
username: userId,
|
|
374
381
|
password: inputPassword || cachedPassword,
|
|
375
382
|
projectId: (env == null ? void 0 : env.currentProject) || "website",
|
|
@@ -377,9 +384,7 @@ class ContensisCli {
|
|
|
377
384
|
clientId: userId,
|
|
378
385
|
clientSecret: sharedSecret || cachedSecret
|
|
379
386
|
});
|
|
380
|
-
const [authError, bearerToken] = await (0, import_await_to_js.default)(
|
|
381
|
-
authService.BearerToken()
|
|
382
|
-
);
|
|
387
|
+
const [authError, bearerToken] = await (0, import_await_to_js.default)(this.auth.BearerToken());
|
|
383
388
|
if (bearerToken) {
|
|
384
389
|
env.authToken = bearerToken;
|
|
385
390
|
env.lastUserId = userId;
|
|
@@ -592,7 +597,7 @@ class ContensisCli {
|
|
|
592
597
|
}
|
|
593
598
|
}
|
|
594
599
|
};
|
|
595
|
-
CreateApiKey = async (name, description) => {
|
|
600
|
+
CreateApiKey = async (name, description = "") => {
|
|
596
601
|
const { currentEnv, log, messages } = this;
|
|
597
602
|
const contensis = await this.ConnectContensis();
|
|
598
603
|
if (contensis) {
|
|
@@ -686,9 +691,7 @@ class ContensisCli {
|
|
|
686
691
|
` ${import_chalk.default.bold.grey(
|
|
687
692
|
"contentTypes"
|
|
688
693
|
)}: ${permissions.contentTypes.map(
|
|
689
|
-
(p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(
|
|
690
|
-
" "
|
|
691
|
-
)}`
|
|
694
|
+
(p) => `${p.id} [${p.actions.join(",")}] ${p.languages.join(" ")}`
|
|
692
695
|
).join(", ")}`
|
|
693
696
|
);
|
|
694
697
|
}
|
|
@@ -796,6 +799,78 @@ class ContensisCli {
|
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
801
|
};
|
|
802
|
+
PrintWorkflows = async () => {
|
|
803
|
+
const { currentEnv, log, messages } = this;
|
|
804
|
+
const contensis = await this.ConnectContensis();
|
|
805
|
+
if (contensis) {
|
|
806
|
+
const [workflowsErr, workflows] = await contensis.content.sourceRepo.workflows.GetWorkflows();
|
|
807
|
+
if (Array.isArray(workflows)) {
|
|
808
|
+
log.success(messages.workflows.list(currentEnv));
|
|
809
|
+
if (!workflows.length)
|
|
810
|
+
log.help(messages.workflows.noneExist());
|
|
811
|
+
const stringFromLanguageObject = (o) => {
|
|
812
|
+
var _a;
|
|
813
|
+
return (_a = Object.values(o || {})) == null ? void 0 : _a[0];
|
|
814
|
+
};
|
|
815
|
+
this.HandleFormattingAndOutput(workflows, () => {
|
|
816
|
+
for (const {
|
|
817
|
+
id,
|
|
818
|
+
name,
|
|
819
|
+
description,
|
|
820
|
+
states,
|
|
821
|
+
eventGroups,
|
|
822
|
+
isSystem
|
|
823
|
+
} of workflows) {
|
|
824
|
+
const color = isSystem ? (s) => s : log.infoText;
|
|
825
|
+
console.log(
|
|
826
|
+
color(
|
|
827
|
+
` - ${import_chalk.default.bold(
|
|
828
|
+
stringFromLanguageObject(name)
|
|
829
|
+
)} ${log.infoText(id)}`
|
|
830
|
+
)
|
|
831
|
+
);
|
|
832
|
+
if (description)
|
|
833
|
+
console.log(
|
|
834
|
+
log.infoText(` ${stringFromLanguageObject(description)}`)
|
|
835
|
+
);
|
|
836
|
+
if (isSystem === false)
|
|
837
|
+
console.log(` ${import_chalk.default.bold.grey("isSystem")}: false`);
|
|
838
|
+
if (states == null ? void 0 : states.length)
|
|
839
|
+
console.log(
|
|
840
|
+
` ${import_chalk.default.bold.grey("states")}: ${states.map((state) => state.id).join(", ")}`
|
|
841
|
+
);
|
|
842
|
+
if (eventGroups == null ? void 0 : eventGroups.length)
|
|
843
|
+
console.log(
|
|
844
|
+
` ${import_chalk.default.bold.grey("eventGroups")}: ${eventGroups.map((evtGrp) => evtGrp.id).join(", ")}`
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
if (workflowsErr) {
|
|
850
|
+
log.error(messages.workflows.noList(currentEnv));
|
|
851
|
+
log.error((0, import_json.jsonFormatter)(workflowsErr));
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
PrintWorkflow = async (workflowNameOrId) => {
|
|
856
|
+
const { currentEnv, log, messages } = this;
|
|
857
|
+
const contensis = await this.ConnectContensis();
|
|
858
|
+
if (contensis) {
|
|
859
|
+
const [workflowsErr, workflows] = await contensis.content.sourceRepo.workflows.GetWorkflows();
|
|
860
|
+
if (Array.isArray(workflows)) {
|
|
861
|
+
log.success(messages.workflows.list(currentEnv));
|
|
862
|
+
const workflow = (0, import_find.findByIdOrName)(workflows, workflowNameOrId);
|
|
863
|
+
if (workflow)
|
|
864
|
+
this.HandleFormattingAndOutput(workflow, log.object);
|
|
865
|
+
else
|
|
866
|
+
log.error(messages.workflows.failedGet(currentEnv, workflowNameOrId));
|
|
867
|
+
}
|
|
868
|
+
if (workflowsErr) {
|
|
869
|
+
log.error(messages.workflows.noList(currentEnv));
|
|
870
|
+
log.error((0, import_json.jsonFormatter)(workflowsErr));
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
};
|
|
799
874
|
CreateProject = async (project) => {
|
|
800
875
|
const { currentEnv, log, messages } = this;
|
|
801
876
|
const contensis = await this.ConnectContensis();
|
|
@@ -1223,7 +1298,7 @@ Components:`));
|
|
|
1223
1298
|
}
|
|
1224
1299
|
};
|
|
1225
1300
|
RemoveEntries = async (commit = false) => {
|
|
1226
|
-
var _a;
|
|
1301
|
+
var _a, _b, _c;
|
|
1227
1302
|
const { currentEnv, currentProject, log, messages } = this;
|
|
1228
1303
|
const contensis = await this.ConnectContensisImport({
|
|
1229
1304
|
commit,
|
|
@@ -1238,9 +1313,9 @@ Components:`));
|
|
|
1238
1313
|
const [err, result] = await contensis.DeleteEntries();
|
|
1239
1314
|
if (result)
|
|
1240
1315
|
this.HandleFormattingAndOutput(result, () => {
|
|
1241
|
-
(0, import_console.
|
|
1316
|
+
(0, import_console.printEntriesMigrateResult)(this, result, {
|
|
1242
1317
|
action: "delete",
|
|
1243
|
-
|
|
1318
|
+
showAll: true
|
|
1244
1319
|
});
|
|
1245
1320
|
});
|
|
1246
1321
|
if (!err && (!commit && result.entriesToMigrate[currentProject].totalCount || commit && ((_a = result.migrateResult) == null ? void 0 : _a.deleted))) {
|
|
@@ -1251,7 +1326,7 @@ Components:`));
|
|
|
1251
1326
|
}
|
|
1252
1327
|
} else {
|
|
1253
1328
|
log.error(messages.entries.failedRemove(currentEnv), err);
|
|
1254
|
-
if (!result.entriesToMigrate[currentProject].totalCount)
|
|
1329
|
+
if (!((_c = (_b = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _b[currentProject]) == null ? void 0 : _c.totalCount))
|
|
1255
1330
|
log.help(messages.entries.notFound(currentEnv));
|
|
1256
1331
|
}
|
|
1257
1332
|
}
|
|
@@ -1268,11 +1343,11 @@ Components:`));
|
|
|
1268
1343
|
entries,
|
|
1269
1344
|
() => {
|
|
1270
1345
|
var _a;
|
|
1271
|
-
return (0, import_migratortron.
|
|
1346
|
+
return (0, import_migratortron.logEntitiesTable)({
|
|
1272
1347
|
entries,
|
|
1273
|
-
currentProject,
|
|
1274
|
-
(_a = contensis.payload.query) == null ? void 0 : _a.fields
|
|
1275
|
-
);
|
|
1348
|
+
projectId: currentProject,
|
|
1349
|
+
fields: (_a = contensis.payload.query) == null ? void 0 : _a.fields
|
|
1350
|
+
});
|
|
1276
1351
|
}
|
|
1277
1352
|
);
|
|
1278
1353
|
} else {
|
|
@@ -1285,7 +1360,7 @@ Components:`));
|
|
|
1285
1360
|
fromFile,
|
|
1286
1361
|
logOutput
|
|
1287
1362
|
}) => {
|
|
1288
|
-
var _a, _b, _c, _d, _e;
|
|
1363
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1289
1364
|
const { currentEnv, currentProject, log, messages } = this;
|
|
1290
1365
|
const contensis = await this.ConnectContensisImport({
|
|
1291
1366
|
commit,
|
|
@@ -1304,9 +1379,9 @@ Components:`));
|
|
|
1304
1379
|
(0, import_logger.logError)(err);
|
|
1305
1380
|
else
|
|
1306
1381
|
this.HandleFormattingAndOutput(result, () => {
|
|
1307
|
-
(0, import_console.
|
|
1308
|
-
|
|
1309
|
-
|
|
1382
|
+
(0, import_console.printEntriesMigrateResult)(this, result, {
|
|
1383
|
+
showAll: logOutput === "all",
|
|
1384
|
+
showChanged: logOutput === "changes"
|
|
1310
1385
|
});
|
|
1311
1386
|
});
|
|
1312
1387
|
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)))) {
|
|
@@ -1323,7 +1398,7 @@ Components:`));
|
|
|
1323
1398
|
}
|
|
1324
1399
|
} else {
|
|
1325
1400
|
log.error(messages.entries.failedImport(currentEnv), err);
|
|
1326
|
-
if (!result.entriesToMigrate[currentProject].totalCount)
|
|
1401
|
+
if (!((_g = (_f = result == null ? void 0 : result.entriesToMigrate) == null ? void 0 : _f[currentProject]) == null ? void 0 : _g.totalCount))
|
|
1327
1402
|
log.help(messages.entries.notFound(currentEnv));
|
|
1328
1403
|
}
|
|
1329
1404
|
} else {
|
|
@@ -1336,41 +1411,16 @@ Components:`));
|
|
|
1336
1411
|
const contensis = await this.ConnectContensis();
|
|
1337
1412
|
if (contensis) {
|
|
1338
1413
|
log.line();
|
|
1339
|
-
const [err] = await (0, import_await_to_js.default)(
|
|
1340
|
-
contensis.content.sourceRepo.nodes.GetNodes(rootPath, depth)
|
|
1341
|
-
);
|
|
1414
|
+
const [err, nodes] = await (0, import_await_to_js.default)(contensis.nodes.GetNodes(rootPath, depth));
|
|
1342
1415
|
if (err) {
|
|
1343
1416
|
log.error(messages.nodes.failedGet(currentProject), err);
|
|
1344
1417
|
return;
|
|
1345
1418
|
}
|
|
1346
|
-
const root = contensis.
|
|
1419
|
+
const root = contensis.nodes.sourceRepo.nodes.tree;
|
|
1347
1420
|
log.success(messages.nodes.get(currentProject, rootPath, depth));
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
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
|
-
);
|
|
1421
|
+
this.HandleFormattingAndOutput(nodes, () => {
|
|
1422
|
+
log.object({ ...root, children: void 0, language: void 0 });
|
|
1423
|
+
(0, import_console.printNodeTreeOutput)(this, root);
|
|
1374
1424
|
});
|
|
1375
1425
|
} else {
|
|
1376
1426
|
log.warning(messages.models.noList(currentProject));
|
|
@@ -1380,9 +1430,10 @@ ${children}` : ""}`,
|
|
|
1380
1430
|
ImportNodes = async ({
|
|
1381
1431
|
commit,
|
|
1382
1432
|
fromFile,
|
|
1383
|
-
logOutput
|
|
1433
|
+
logOutput,
|
|
1434
|
+
logLimit
|
|
1384
1435
|
}) => {
|
|
1385
|
-
var _a, _b, _c;
|
|
1436
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1386
1437
|
const { currentEnv, currentProject, log, messages } = this;
|
|
1387
1438
|
const contensis = await this.ConnectContensisImport({
|
|
1388
1439
|
commit,
|
|
@@ -1397,39 +1448,42 @@ ${children}` : ""}`,
|
|
|
1397
1448
|
console.log(log.warningText(` *** COMMITTING IMPORT *** `));
|
|
1398
1449
|
}
|
|
1399
1450
|
const [err, result] = await contensis.MigrateNodes();
|
|
1451
|
+
const migrateTree = contensis.nodes.targetRepos[currentProject].nodes.migrateNodesTreeView;
|
|
1400
1452
|
if (err)
|
|
1401
|
-
|
|
1453
|
+
log.raw(``);
|
|
1402
1454
|
else
|
|
1403
1455
|
this.HandleFormattingAndOutput(result, () => {
|
|
1404
|
-
(0, import_console.
|
|
1405
|
-
|
|
1406
|
-
|
|
1456
|
+
(0, import_console.printNodeTreeOutput)(this, migrateTree, logOutput, logLimit);
|
|
1457
|
+
(0, import_console.printNodesMigrateResult)(this, result, {
|
|
1458
|
+
showAll: logOutput === "all",
|
|
1459
|
+
showChanged: logOutput === "changes"
|
|
1407
1460
|
});
|
|
1408
1461
|
});
|
|
1409
|
-
const
|
|
1410
|
-
const nodesCreated = ((
|
|
1411
|
-
const nodesUpdated = ((
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1462
|
+
const nodesMigrateCount = (_a = result == null ? void 0 : result.nodesToMigrate) == null ? void 0 : _a[currentProject].totalCount;
|
|
1463
|
+
const nodesCreated = ((_b = result == null ? void 0 : result.nodesResult) == null ? void 0 : _b["created"]) || 0;
|
|
1464
|
+
const nodesUpdated = ((_c = result == null ? void 0 : result.nodesResult) == null ? void 0 : _c["updated"]) || 0;
|
|
1465
|
+
const nodesErrored = ((_d = result == null ? void 0 : result.nodesResult) == null ? void 0 : _d["errors"]) || 0;
|
|
1466
|
+
const noChanges = ((_e = result == null ? void 0 : result.nodesToMigrate) == null ? void 0 : _e[currentProject]["no change"]) && nodesMigrateCount === 0;
|
|
1467
|
+
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)))) {
|
|
1414
1468
|
let totalCount;
|
|
1415
1469
|
if (commit) {
|
|
1416
1470
|
let created = typeof nodesCreated === "number" ? nodesCreated : 0;
|
|
1417
1471
|
let updated = typeof nodesUpdated === "number" ? nodesUpdated : 0;
|
|
1418
1472
|
totalCount = created + updated;
|
|
1419
1473
|
} else {
|
|
1420
|
-
totalCount = typeof
|
|
1474
|
+
totalCount = typeof nodesMigrateCount === "number" ? nodesMigrateCount : 0;
|
|
1421
1475
|
}
|
|
1422
1476
|
log.success(messages.nodes.imported(currentEnv, commit, totalCount));
|
|
1477
|
+
log.raw(``);
|
|
1423
1478
|
if (!commit) {
|
|
1424
|
-
log.raw(``);
|
|
1425
1479
|
log.help(messages.nodes.commitTip());
|
|
1426
1480
|
}
|
|
1427
1481
|
} else {
|
|
1428
|
-
if (
|
|
1429
|
-
log.help(messages.nodes.noChange(currentEnv)
|
|
1482
|
+
if (noChanges && !err && !nodesErrored) {
|
|
1483
|
+
log.help(messages.nodes.noChange(currentEnv));
|
|
1430
1484
|
} else {
|
|
1431
1485
|
log.error(messages.nodes.failedImport(currentEnv), err);
|
|
1432
|
-
if (!
|
|
1486
|
+
if (!nodesMigrateCount)
|
|
1433
1487
|
log.help(messages.nodes.notFound(currentEnv));
|
|
1434
1488
|
}
|
|
1435
1489
|
}
|
|
@@ -1438,6 +1492,43 @@ ${children}` : ""}`,
|
|
|
1438
1492
|
log.help(messages.connect.tip());
|
|
1439
1493
|
}
|
|
1440
1494
|
};
|
|
1495
|
+
RemoveNodes = async (commit = false) => {
|
|
1496
|
+
var _a, _b, _c;
|
|
1497
|
+
const { currentEnv, currentProject, log, messages } = this;
|
|
1498
|
+
const contensis = await this.ConnectContensisImport({
|
|
1499
|
+
commit,
|
|
1500
|
+
importDataType: "user-input"
|
|
1501
|
+
});
|
|
1502
|
+
if (contensis) {
|
|
1503
|
+
if (contensis.isPreview) {
|
|
1504
|
+
console.log(log.successText(` -- PREVIEW -- `));
|
|
1505
|
+
} else {
|
|
1506
|
+
console.log(log.warningText(` *** COMMITTING DELETE *** `));
|
|
1507
|
+
}
|
|
1508
|
+
const [err, result] = await contensis.DeleteNodes();
|
|
1509
|
+
if (result) {
|
|
1510
|
+
this.HandleFormattingAndOutput(result, () => {
|
|
1511
|
+
(0, import_console.printNodeTreeOutput)(
|
|
1512
|
+
this,
|
|
1513
|
+
contensis.nodes.targetRepos[currentProject].nodes.migrateNodesTreeView
|
|
1514
|
+
);
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
if (!err && (!commit && result.nodesToMigrate[currentProject].totalCount || commit && ((_a = result.nodesResult) == null ? void 0 : _a.deleted))) {
|
|
1518
|
+
log.success(
|
|
1519
|
+
messages.nodes.removed(currentEnv, commit, contensis.nodes.rootPath)
|
|
1520
|
+
);
|
|
1521
|
+
log.raw(``);
|
|
1522
|
+
if (!commit) {
|
|
1523
|
+
log.help(messages.nodes.commitTip());
|
|
1524
|
+
}
|
|
1525
|
+
} else {
|
|
1526
|
+
log.error(messages.nodes.failedRemove(currentEnv), err);
|
|
1527
|
+
if (!((_c = (_b = result == null ? void 0 : result.nodesToMigrate) == null ? void 0 : _b[currentProject]) == null ? void 0 : _c.totalCount))
|
|
1528
|
+
log.help(messages.nodes.notFound(currentEnv));
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1441
1532
|
PrintWebhookSubscriptions = async (subscriptionIdsOrNames) => {
|
|
1442
1533
|
const { currentEnv, log, messages } = this;
|
|
1443
1534
|
const contensis = await this.ConnectContensis();
|