contensis-cli 1.6.1-beta.2 → 1.6.1-beta.20
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/index.js +58301 -11
- package/dist/index.js.map +4 -4
- package/dist/shell.js +58040 -52
- package/dist/shell.js.map +4 -4
- package/esbuild.config.js +8 -13
- package/package.json +3 -2
- package/src/commands/create.ts +48 -0
- package/src/commands/dev.ts +12 -2
- package/src/commands/globalOptions.ts +5 -3
- package/src/commands/import.ts +46 -5
- package/src/commands/push.ts +8 -1
- package/src/commands/set.ts +69 -1
- package/src/factories/RequestHandlerFactory.ts +19 -8
- package/src/localisation/en-GB.ts +22 -4
- package/src/mappers/DevRequests-to-RequestHanderCliArgs.ts +25 -17
- package/src/models/CliService.d.ts +5 -1
- package/src/providers/GitHubCliModuleProvider.ts +8 -8
- package/src/providers/HttpProvider.ts +2 -2
- package/src/providers/file-provider.ts +3 -0
- package/src/services/ContensisCliService.ts +265 -23
- package/src/services/ContensisDevService.ts +99 -35
- package/src/shell.ts +7 -1
- package/src/util/console.printer.ts +52 -0
- package/src/util/logger.ts +3 -4
- package/src/util/os.ts +5 -3
- package/src/version.ts +1 -1
- package/dist/commands/connect.js +0 -44
- package/dist/commands/connect.js.map +0 -7
- package/dist/commands/copy.js +0 -78
- package/dist/commands/copy.js.map +0 -7
- package/dist/commands/create.js +0 -170
- package/dist/commands/create.js.map +0 -7
- package/dist/commands/dev.js +0 -78
- package/dist/commands/dev.js.map +0 -7
- package/dist/commands/diff.js +0 -57
- package/dist/commands/diff.js.map +0 -7
- package/dist/commands/execute.js +0 -103
- package/dist/commands/execute.js.map +0 -7
- package/dist/commands/get.js +0 -330
- package/dist/commands/get.js.map +0 -7
- package/dist/commands/globalOptions.js +0 -252
- package/dist/commands/globalOptions.js.map +0 -7
- package/dist/commands/import.js +0 -229
- package/dist/commands/import.js.map +0 -7
- package/dist/commands/index.js +0 -107
- package/dist/commands/index.js.map +0 -7
- package/dist/commands/list.js +0 -195
- package/dist/commands/list.js.map +0 -7
- package/dist/commands/login.js +0 -55
- package/dist/commands/login.js.map +0 -7
- package/dist/commands/push.js +0 -229
- package/dist/commands/push.js.map +0 -7
- package/dist/commands/remove.js +0 -193
- package/dist/commands/remove.js.map +0 -7
- package/dist/commands/set.js +0 -180
- package/dist/commands/set.js.map +0 -7
- package/dist/commands/update.js +0 -70
- package/dist/commands/update.js.map +0 -7
- package/dist/factories/RequestHandlerFactory.js +0 -221
- package/dist/factories/RequestHandlerFactory.js.map +0 -7
- package/dist/localisation/en-GB.js +0 -552
- package/dist/localisation/en-GB.js.map +0 -7
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js +0 -56
- package/dist/mappers/ContensisCliService-to-RequestHanderSiteConfigYaml.js.map +0 -7
- package/dist/mappers/DevInit-to-CIWorkflow.js +0 -409
- package/dist/mappers/DevInit-to-CIWorkflow.js.map +0 -7
- package/dist/mappers/DevInit-to-RolePermissions.js +0 -56
- package/dist/mappers/DevInit-to-RolePermissions.js.map +0 -7
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js +0 -161
- package/dist/mappers/DevRequests-to-RequestHanderCliArgs.js.map +0 -7
- package/dist/mappers/MixedFileData.js +0 -83
- package/dist/mappers/MixedFileData.js.map +0 -7
- package/dist/models/AppError.d.js +0 -2
- package/dist/models/AppError.d.js.map +0 -7
- package/dist/models/Cache.d.js +0 -2
- package/dist/models/Cache.d.js.map +0 -7
- package/dist/models/CliService.d.js +0 -17
- package/dist/models/CliService.d.js.map +0 -7
- package/dist/models/DevService.d.js +0 -17
- package/dist/models/DevService.d.js.map +0 -7
- package/dist/models/JsModules.d.js +0 -2
- package/dist/models/JsModules.d.js.map +0 -7
- package/dist/providers/CredentialProvider.js +0 -126
- package/dist/providers/CredentialProvider.js.map +0 -7
- package/dist/providers/GitHubCliModuleProvider.js +0 -115
- package/dist/providers/GitHubCliModuleProvider.js.map +0 -7
- package/dist/providers/HttpProvider.js +0 -73
- package/dist/providers/HttpProvider.js.map +0 -7
- package/dist/providers/ManifestProvider.js +0 -50
- package/dist/providers/ManifestProvider.js.map +0 -7
- package/dist/providers/SessionCacheProvider.js +0 -132
- package/dist/providers/SessionCacheProvider.js.map +0 -7
- package/dist/providers/file-provider.js +0 -174
- package/dist/providers/file-provider.js.map +0 -7
- package/dist/services/ContensisAuthService.js +0 -88
- package/dist/services/ContensisAuthService.js.map +0 -7
- package/dist/services/ContensisCliService.js +0 -2598
- package/dist/services/ContensisCliService.js.map +0 -7
- package/dist/services/ContensisDevService.js +0 -387
- package/dist/services/ContensisDevService.js.map +0 -7
- package/dist/services/ContensisRoleService.js +0 -112
- package/dist/services/ContensisRoleService.js.map +0 -7
- package/dist/util/api-ids.js +0 -110
- package/dist/util/api-ids.js.map +0 -7
- package/dist/util/assert.js +0 -62
- package/dist/util/assert.js.map +0 -7
- package/dist/util/console.printer.js +0 -425
- package/dist/util/console.printer.js.map +0 -7
- package/dist/util/csv.formatter.js +0 -118
- package/dist/util/csv.formatter.js.map +0 -7
- package/dist/util/debug.js +0 -29
- package/dist/util/debug.js.map +0 -7
- package/dist/util/diff.js +0 -118
- package/dist/util/diff.js.map +0 -7
- package/dist/util/dotenv.js +0 -56
- package/dist/util/dotenv.js.map +0 -7
- package/dist/util/error.js +0 -36
- package/dist/util/error.js.map +0 -7
- package/dist/util/fetch.js +0 -69
- package/dist/util/fetch.js.map +0 -7
- package/dist/util/find.js +0 -39
- package/dist/util/find.js.map +0 -7
- package/dist/util/git.js +0 -145
- package/dist/util/git.js.map +0 -7
- package/dist/util/gitignore.js +0 -61
- package/dist/util/gitignore.js.map +0 -7
- package/dist/util/html.formatter.js +0 -70
- package/dist/util/html.formatter.js.map +0 -7
- package/dist/util/index.js +0 -68
- package/dist/util/index.js.map +0 -7
- package/dist/util/json.formatter.js +0 -66
- package/dist/util/json.formatter.js.map +0 -7
- package/dist/util/logger.js +0 -304
- package/dist/util/logger.js.map +0 -7
- package/dist/util/os.js +0 -46
- package/dist/util/os.js.map +0 -7
- package/dist/util/timers.js +0 -49
- package/dist/util/timers.js.map +0 -7
- package/dist/util/xml.formatter.js +0 -62
- package/dist/util/xml.formatter.js.map +0 -7
- package/dist/util/yaml.js +0 -44
- package/dist/util/yaml.js.map +0 -7
- package/dist/version.js +0 -29
- package/dist/version.js.map +0 -7
package/dist/util/api-ids.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var api_ids_exports = {};
|
|
20
|
-
__export(api_ids_exports, {
|
|
21
|
-
isApiId: () => isApiId,
|
|
22
|
-
sanitiseId: () => sanitiseId,
|
|
23
|
-
sanitiseIds: () => sanitiseIds,
|
|
24
|
-
toApiId: () => toApiId
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(api_ids_exports);
|
|
27
|
-
const sanitiseId = (id) => id.split(".").map((part) => toApiId(part, "camelCase", true)).join(".");
|
|
28
|
-
const sanitiseIds = (arr) => arr.map(sanitiseId);
|
|
29
|
-
function isApiId(id, mode) {
|
|
30
|
-
if (!id) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
const validChars = mode === "camelCase" ? /[^a-zA-Z0-9]/g : /[^a-z0-9-]/g;
|
|
34
|
-
if (id !== id.replace(validChars, "")) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (!id.substr(0, 1).replace(/[^a-z]/g, "")) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
function toApiId(name, mode, isId) {
|
|
43
|
-
if (!name) {
|
|
44
|
-
return name;
|
|
45
|
-
}
|
|
46
|
-
const validChars = mode === "camelCase" ? /[^a-zA-Z0-9 ]/g : /[^a-zA-Z0-9 -]/g;
|
|
47
|
-
let id = name.replace(validChars, "");
|
|
48
|
-
id = id.replace(/-/g, " ");
|
|
49
|
-
id = id.trim();
|
|
50
|
-
const noStart = "0123456789 ".split("");
|
|
51
|
-
id = id.split("").reduce(
|
|
52
|
-
(prev, char) => prev || !noStart.includes(char) ? prev + char : prev,
|
|
53
|
-
""
|
|
54
|
-
);
|
|
55
|
-
return mode === "camelCase" ? toCamelCase(id, isId) : toSnakeCase(id);
|
|
56
|
-
}
|
|
57
|
-
function toSnakeCase(sentence) {
|
|
58
|
-
sentence = (sentence || "").trim();
|
|
59
|
-
if (!sentence) {
|
|
60
|
-
return sentence;
|
|
61
|
-
}
|
|
62
|
-
sentence = sentence.toLowerCase();
|
|
63
|
-
return sentence.split(" ").filter((w) => !!w).join("-");
|
|
64
|
-
}
|
|
65
|
-
function toCamelCase(sentence, isId) {
|
|
66
|
-
sentence = (sentence || "").trim();
|
|
67
|
-
if (!sentence) {
|
|
68
|
-
return sentence;
|
|
69
|
-
}
|
|
70
|
-
if (sentence.length < 2) {
|
|
71
|
-
return sentence.toLowerCase();
|
|
72
|
-
}
|
|
73
|
-
const words = sentence.split(" ");
|
|
74
|
-
if (isId && words.length === 1) {
|
|
75
|
-
return words[0].substr(0, 1).toLowerCase() + words[0].substr(1);
|
|
76
|
-
}
|
|
77
|
-
const result = words.filter((w) => !!w).map(
|
|
78
|
-
(w, index) => index === 0 ? firstWordToCamelCase(w) : wordToCamelCase(w)
|
|
79
|
-
).join("");
|
|
80
|
-
return result.split(".").map((w, index) => index === 0 ? w : wordToCamelCase(w)).join(".");
|
|
81
|
-
}
|
|
82
|
-
function firstWordToCamelCase(word) {
|
|
83
|
-
return isUpperCase(word) ? word.toLowerCase() : lowerCaseInitialCapitalLettersExceptLast(word);
|
|
84
|
-
}
|
|
85
|
-
function wordToCamelCase(word) {
|
|
86
|
-
return word.substr(0, 1).toUpperCase() + word.substr(1);
|
|
87
|
-
}
|
|
88
|
-
function lowerCaseInitialCapitalLettersExceptLast(value) {
|
|
89
|
-
return value.split("").reduce((prev, char, index) => {
|
|
90
|
-
if (index === 0) {
|
|
91
|
-
char = char.toLowerCase();
|
|
92
|
-
} else if (isUpperCase(char)) {
|
|
93
|
-
if (index + 1 < value.length && isUpperCase(value.charAt(index + 1))) {
|
|
94
|
-
char = char.toLowerCase();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return prev + char;
|
|
98
|
-
}, "");
|
|
99
|
-
}
|
|
100
|
-
function isUpperCase(value) {
|
|
101
|
-
return value === value.toUpperCase();
|
|
102
|
-
}
|
|
103
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
104
|
-
0 && (module.exports = {
|
|
105
|
-
isApiId,
|
|
106
|
-
sanitiseId,
|
|
107
|
-
sanitiseIds,
|
|
108
|
-
toApiId
|
|
109
|
-
});
|
|
110
|
-
//# sourceMappingURL=api-ids.js.map
|
package/dist/util/api-ids.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/util/api-ids.ts"],
|
|
4
|
-
"sourcesContent": ["export const sanitiseId = (id: string) =>\n id\n .split('.')\n .map(part => toApiId(part, 'camelCase', true))\n .join('.');\n\nexport const sanitiseIds = (arr: string[]) => arr.map(sanitiseId);\n\n// borrowed from packages\\contensis\\components\\app\\src\\utils.ts\n\nexport function isApiId(id: string, mode: 'camelCase' | 'snake-case'): boolean {\n if (!id) {\n return false;\n }\n const validChars = mode === 'camelCase' ? /[^a-zA-Z0-9]/g : /[^a-z0-9-]/g;\n if (id !== id.replace(validChars, '')) {\n return false;\n }\n if (!id.substr(0, 1).replace(/[^a-z]/g, '')) {\n return false;\n }\n return true;\n}\n\nexport function toApiId(\n name: string,\n mode: 'camelCase' | 'snake-case',\n isId: boolean\n) {\n if (!name) {\n return name;\n }\n const validChars =\n mode === 'camelCase' ? /[^a-zA-Z0-9 ]/g : /[^a-zA-Z0-9 -]/g;\n let id = name.replace(validChars, '');\n id = id.replace(/-/g, ' ');\n id = id.trim();\n\n const noStart = '0123456789 '.split('');\n id = id\n .split('')\n .reduce(\n (prev, char) => (prev || !noStart.includes(char) ? prev + char : prev),\n ''\n );\n return mode === 'camelCase' ? toCamelCase(id, isId) : toSnakeCase(id);\n}\n\nfunction toSnakeCase(sentence: string): string {\n sentence = (sentence || '').trim();\n if (!sentence) {\n return sentence;\n }\n sentence = sentence.toLowerCase();\n return sentence\n .split(' ')\n .filter(w => !!w)\n .join('-');\n}\n\nfunction toCamelCase(sentence: string, isId: boolean): string {\n sentence = (sentence || '').trim();\n if (!sentence) {\n return sentence;\n }\n if (sentence.length < 2) {\n return sentence.toLowerCase();\n }\n const words = sentence.split(' ');\n if (isId && words.length === 1) {\n return words[0].substr(0, 1).toLowerCase() + words[0].substr(1);\n }\n const result = words\n .filter(w => !!w)\n .map((w, index) =>\n index === 0 ? firstWordToCamelCase(w) : wordToCamelCase(w)\n )\n .join('');\n\n return result\n .split('.')\n .map((w, index) => (index === 0 ? w : wordToCamelCase(w)))\n .join('.');\n}\n\nfunction firstWordToCamelCase(word: string) {\n return isUpperCase(word)\n ? word.toLowerCase()\n : lowerCaseInitialCapitalLettersExceptLast(word);\n}\n\nfunction wordToCamelCase(word: string) {\n return word.substr(0, 1).toUpperCase() + word.substr(1);\n}\n\nfunction lowerCaseInitialCapitalLettersExceptLast(value: string): string {\n return value.split('').reduce((prev, char, index) => {\n if (index === 0) {\n char = char.toLowerCase();\n } else if (isUpperCase(char)) {\n if (index + 1 < value.length && isUpperCase(value.charAt(index + 1))) {\n char = char.toLowerCase();\n }\n }\n return prev + char;\n }, '');\n}\n\nfunction isUpperCase(value: string): boolean {\n return value === value.toUpperCase();\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/util/assert.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var assert_exports = {};
|
|
20
|
-
__export(assert_exports, {
|
|
21
|
-
isJson: () => isJson,
|
|
22
|
-
isPassword: () => isPassword,
|
|
23
|
-
isSharedSecret: () => isSharedSecret,
|
|
24
|
-
isSysError: () => isSysError,
|
|
25
|
-
isUuid: () => isUuid,
|
|
26
|
-
tryParse: () => tryParse,
|
|
27
|
-
tryStringify: () => tryStringify
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(assert_exports);
|
|
30
|
-
const isSharedSecret = (str = "") => str.length > 80 && str.split("-").length === 3 ? str : void 0;
|
|
31
|
-
const isPassword = (str = "") => !isSharedSecret(str) ? str : void 0;
|
|
32
|
-
const tryParse = (str) => {
|
|
33
|
-
try {
|
|
34
|
-
return typeof str === "object" ? str : JSON.parse(str);
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const isJson = (str) => typeof str === "object" || !!tryParse(str);
|
|
40
|
-
const tryStringify = (obj) => {
|
|
41
|
-
try {
|
|
42
|
-
return typeof obj === "object" ? JSON.stringify(obj) : obj;
|
|
43
|
-
} catch (e) {
|
|
44
|
-
return obj;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const isSysError = (error) => (error == null ? void 0 : error.message) !== void 0 && error.stack;
|
|
48
|
-
const isUuid = (str) => {
|
|
49
|
-
const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;
|
|
50
|
-
return regexExp.test(str);
|
|
51
|
-
};
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
isJson,
|
|
55
|
-
isPassword,
|
|
56
|
-
isSharedSecret,
|
|
57
|
-
isSysError,
|
|
58
|
-
isUuid,
|
|
59
|
-
tryParse,
|
|
60
|
-
tryStringify
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=assert.js.map
|
package/dist/util/assert.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/util/assert.ts"],
|
|
4
|
-
"sourcesContent": ["export const isSharedSecret = (str = '') =>\n str.length > 80 && str.split('-').length === 3 ? str : undefined;\n\nexport const isPassword = (str = '') =>\n !isSharedSecret(str) ? str : undefined;\n\nexport const tryParse = (str: any) => {\n try {\n return typeof str === 'object' ? str : JSON.parse(str);\n } catch (e) {\n return false;\n }\n};\n\nexport const isJson = (str?: string) =>\n typeof str === 'object' || !!tryParse(str);\n\nexport const tryStringify = (obj: any) => {\n try {\n return typeof obj === 'object' ? JSON.stringify(obj) : obj;\n } catch (e) {\n return obj;\n }\n};\n\nexport const isSysError = (error: any): error is Error =>\n error?.message !== undefined && error.stack;\n\nexport const isUuid = (str: string) => {\n // Regular expression to check if string is a valid UUID\n const regexExp =\n /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/gi;\n\n return regexExp.test(str);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,iBAAiB,CAAC,MAAM,OACnC,IAAI,SAAS,MAAM,IAAI,MAAM,GAAG,EAAE,WAAW,IAAI,MAAM;AAElD,MAAM,aAAa,CAAC,MAAM,OAC/B,CAAC,eAAe,GAAG,IAAI,MAAM;AAExB,MAAM,WAAW,CAAC,QAAa;AACpC,MAAI;AACF,WAAO,OAAO,QAAQ,WAAW,MAAM,KAAK,MAAM,GAAG;AAAA,EACvD,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAEO,MAAM,SAAS,CAAC,QACrB,OAAO,QAAQ,YAAY,CAAC,CAAC,SAAS,GAAG;AAEpC,MAAM,eAAe,CAAC,QAAa;AACxC,MAAI;AACF,WAAO,OAAO,QAAQ,WAAW,KAAK,UAAU,GAAG,IAAI;AAAA,EACzD,SAAS,GAAG;AACV,WAAO;AAAA,EACT;AACF;AAEO,MAAM,aAAa,CAAC,WACzB,+BAAO,aAAY,UAAa,MAAM;AAEjC,MAAM,SAAS,CAAC,QAAgB;AAErC,QAAM,WACJ;AAEF,SAAO,SAAS,KAAK,GAAG;AAC1B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var console_printer_exports = {};
|
|
30
|
-
__export(console_printer_exports, {
|
|
31
|
-
printBlockVersion: () => printBlockVersion,
|
|
32
|
-
printEntriesMigrateResult: () => printEntriesMigrateResult,
|
|
33
|
-
printModelMigrationAnalysis: () => printModelMigrationAnalysis,
|
|
34
|
-
printModelMigrationResult: () => printModelMigrationResult,
|
|
35
|
-
printNodeTreeOutput: () => printNodeTreeOutput,
|
|
36
|
-
printNodesMigrateResult: () => printNodesMigrateResult
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(console_printer_exports);
|
|
39
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
40
|
-
var import_error = require("./error");
|
|
41
|
-
var import_logger = require("./logger");
|
|
42
|
-
const formatDate = (date, format = "DD/MM/YYYY HH:mm") => (0, import_dayjs.default)(date).format(format);
|
|
43
|
-
const printBlockVersion = ({ log, messages }, block, printOptions = {
|
|
44
|
-
showSource: true,
|
|
45
|
-
showStatus: true,
|
|
46
|
-
showStaticPaths: true,
|
|
47
|
-
showImage: true
|
|
48
|
-
}) => {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
console.log(
|
|
51
|
-
` ${log.standardText(`v${block.version.versionNo}`)} ${block.id}`
|
|
52
|
-
);
|
|
53
|
-
console.log(
|
|
54
|
-
` state: ${messages.blocks.runningStatus(
|
|
55
|
-
block.status.broken ? "broken" : block.status.running.global
|
|
56
|
-
)}`
|
|
57
|
-
);
|
|
58
|
-
console.log(
|
|
59
|
-
` released: ${log.infoText(
|
|
60
|
-
block.version.released ? `[${formatDate(block.version.released)}] ${block.version.releasedBy}` : "no"
|
|
61
|
-
)}`
|
|
62
|
-
);
|
|
63
|
-
if (block.version.madeLive)
|
|
64
|
-
console.log(
|
|
65
|
-
` live: ${log.infoText(
|
|
66
|
-
`[${formatDate(block.version.madeLive)}] ${block.version.madeLiveBy}`
|
|
67
|
-
)}`
|
|
68
|
-
);
|
|
69
|
-
if (printOptions.showStatus) {
|
|
70
|
-
console.log(` status:`);
|
|
71
|
-
console.log(` deployment: ${log.infoText(block.status.deployment)}`);
|
|
72
|
-
console.log(` workflow: ${log.infoText(block.status.workflow)}`);
|
|
73
|
-
console.log(
|
|
74
|
-
` running status: ${messages.blocks.runningStatus(
|
|
75
|
-
block.status.running.global
|
|
76
|
-
)}`
|
|
77
|
-
);
|
|
78
|
-
console.log(` datacentres:`);
|
|
79
|
-
console.log(
|
|
80
|
-
` hq: ${messages.blocks.runningStatus(
|
|
81
|
-
block.status.running.dataCenters.hq
|
|
82
|
-
)}`
|
|
83
|
-
);
|
|
84
|
-
console.log(
|
|
85
|
-
` london: ${messages.blocks.runningStatus(
|
|
86
|
-
block.status.running.dataCenters.london
|
|
87
|
-
)}`
|
|
88
|
-
);
|
|
89
|
-
console.log(
|
|
90
|
-
` manchester: ${messages.blocks.runningStatus(
|
|
91
|
-
block.status.running.dataCenters.manchester
|
|
92
|
-
)}`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
if (printOptions.showSource) {
|
|
96
|
-
console.log(` source:`);
|
|
97
|
-
console.log(` commit: ${log.helpText(block.source.commit.id)}`);
|
|
98
|
-
console.log(
|
|
99
|
-
` message: ${log.infoText(
|
|
100
|
-
(_a = block.source.commit.message) == null ? void 0 : _a.replaceAll("\n", "\\n").replaceAll("\\n\\n", "\\n").replaceAll("\\n", "; ")
|
|
101
|
-
)}`
|
|
102
|
-
);
|
|
103
|
-
console.log(
|
|
104
|
-
` committed: ${log.infoText(
|
|
105
|
-
`[${formatDate(block.source.commit.dateTime)}] ${block.source.commit.authorEmail}`
|
|
106
|
-
)}`
|
|
107
|
-
);
|
|
108
|
-
console.log(
|
|
109
|
-
` pushed: ${log.infoText(
|
|
110
|
-
`[${formatDate(block.version.pushed)}] ${block.version.pushedBy}`
|
|
111
|
-
)}`
|
|
112
|
-
);
|
|
113
|
-
console.log(` ${log.infoText(block.source.commit.commitUrl)}`);
|
|
114
|
-
}
|
|
115
|
-
if (printOptions.showImage) {
|
|
116
|
-
console.log(` image:`);
|
|
117
|
-
console.log(` uri: ${log.infoText(block.image.uri)}`);
|
|
118
|
-
console.log(` tag: ${log.helpText(block.image.tag)}`);
|
|
119
|
-
}
|
|
120
|
-
if (printOptions.showStaticPaths) {
|
|
121
|
-
if ((_b = block.staticPaths) == null ? void 0 : _b.length) {
|
|
122
|
-
console.log(` static paths:`);
|
|
123
|
-
for (const path of block.staticPaths) console.log(` - ${path}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (block.stagingUrl)
|
|
127
|
-
console.log(` staging url: ${log.infoText(block.stagingUrl)}`);
|
|
128
|
-
console.log("");
|
|
129
|
-
};
|
|
130
|
-
const printEntriesMigrateResult = (service, migrateResult, {
|
|
131
|
-
action = "import",
|
|
132
|
-
showDiff = false,
|
|
133
|
-
showAll = false,
|
|
134
|
-
showChanged = false
|
|
135
|
-
} = {}) => {
|
|
136
|
-
var _a, _b, _c;
|
|
137
|
-
console.log(``);
|
|
138
|
-
const { log, messages, currentProject } = service;
|
|
139
|
-
for (const [contentTypeId, entryRes] of Object.entries(
|
|
140
|
-
migrateResult.entriesToMigrate.entryIds
|
|
141
|
-
)) {
|
|
142
|
-
for (const [originalId, entryStatus] of Object.entries(entryRes)) {
|
|
143
|
-
const projectStatus = Object.entries(
|
|
144
|
-
Object.entries(entryStatus[currentProject])[0]
|
|
145
|
-
)[1][1];
|
|
146
|
-
if (showAll || showChanged && projectStatus.status !== "no change" && projectStatus.status !== "ignore") {
|
|
147
|
-
console.log(
|
|
148
|
-
log.infoText(
|
|
149
|
-
`${Object.entries(entryStatus || {}).filter((x) => x[0] !== "entryTitle").map(([projectId, projectStatus2]) => {
|
|
150
|
-
var _a2;
|
|
151
|
-
const [targetGuid, { status }] = ((_a2 = Object.entries(
|
|
152
|
-
projectStatus2 || {}
|
|
153
|
-
)) == null ? void 0 : _a2[0]) || [
|
|
154
|
-
"",
|
|
155
|
-
{ x: { status: void 0 } }
|
|
156
|
-
];
|
|
157
|
-
return `${messages.migrate.status(status)(
|
|
158
|
-
`${status}`
|
|
159
|
-
)} ${originalId}${targetGuid !== originalId ? ` -> ${targetGuid}
|
|
160
|
-
` : " "}`;
|
|
161
|
-
})}`
|
|
162
|
-
) + `${log.helpText(contentTypeId)} ${entryStatus.entryTitle}`
|
|
163
|
-
);
|
|
164
|
-
for (const [projectId, projectStatus2] of Object.entries(
|
|
165
|
-
entryStatus
|
|
166
|
-
).filter(([key]) => key !== "entryTitle")) {
|
|
167
|
-
const [targetGuid, { error, diff, status }] = Object.entries(
|
|
168
|
-
projectStatus2
|
|
169
|
-
)[0];
|
|
170
|
-
if (error) log.error(error);
|
|
171
|
-
if (diff && showDiff) {
|
|
172
|
-
console.log(
|
|
173
|
-
` ${log.infoText(`diff: ${highlightDiffText(diff)}`)}
|
|
174
|
-
`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (showAll || showChanged) console.log(``);
|
|
182
|
-
for (const [projectId, contentTypeCounts] of Object.entries(
|
|
183
|
-
migrateResult.entries || {}
|
|
184
|
-
)) {
|
|
185
|
-
log.help(
|
|
186
|
-
action === "update" ? `update entries in project ${log.boldText(
|
|
187
|
-
log.warningText(currentProject)
|
|
188
|
-
)}` : `${action}${action === "delete" ? ` from project ${log.warningText(currentProject)}` : `${projectId ? ` from project ${log.highlightText(projectId)}` : ""} to ${log.boldText(
|
|
189
|
-
log.warningText(currentProject)
|
|
190
|
-
)}`}`
|
|
191
|
-
);
|
|
192
|
-
for (const [contentTypeId, count] of Object.entries(contentTypeCounts)) {
|
|
193
|
-
const isTotalCountRow = contentTypeId === "totalCount";
|
|
194
|
-
const migrateStatusAndCount = migrateResult.entriesToMigrate[currentProject][contentTypeId];
|
|
195
|
-
const existingCount = ((_b = (_a = migrateResult.existing) == null ? void 0 : _a[currentProject]) == null ? void 0 : _b[contentTypeId]) || 0;
|
|
196
|
-
const existingPercent = (existingCount / count * 100).toFixed(0);
|
|
197
|
-
const noChangeOrTotalEntriesCount = typeof migrateStatusAndCount !== "number" ? ((migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0) + ((migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["ignore"]) || 0) : migrateStatusAndCount;
|
|
198
|
-
const changedPercentage = (noChangeOrTotalEntriesCount / count * 100).toFixed(0);
|
|
199
|
-
const existingColor = existingPercent === "0" || action === "delete" ? log.warningText : log.infoText;
|
|
200
|
-
const changedColor = isTotalCountRow ? log.helpText : changedPercentage === "100" ? log.successText : log.warningText;
|
|
201
|
-
if (isTotalCountRow && "nodes" in migrateResult) {
|
|
202
|
-
printNodesMigrateResult(service, migrateResult, {
|
|
203
|
-
showAll,
|
|
204
|
-
showDiff,
|
|
205
|
-
showChanged,
|
|
206
|
-
isEntriesMigration: true
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
console.log(
|
|
210
|
-
` - ${isTotalCountRow ? log.highlightText(
|
|
211
|
-
`${contentTypeId}: ${noChangeOrTotalEntriesCount}`
|
|
212
|
-
) : `${contentTypeId}: ${log.helpText(count)}`}${changedPercentage === "100" || isTotalCountRow ? "" : existingColor(` [existing: ${`${existingPercent}%`}]`)}${existingPercent === "0" || action === "import" && isTotalCountRow ? "" : changedColor(
|
|
213
|
-
` ${isTotalCountRow ? `[to ${action}: ${noChangeOrTotalEntriesCount}]` : changedPercentage === "100" ? "up to date" : `[needs update: ${100 - Number(changedPercentage)}%]`}`
|
|
214
|
-
)}`
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if ((_c = migrateResult.errors) == null ? void 0 : _c.length) {
|
|
219
|
-
console.log(
|
|
220
|
-
` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}
|
|
221
|
-
`
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
const printNodesMigrateResult = ({ log, currentProject }, migrateResult, {
|
|
226
|
-
action = "import",
|
|
227
|
-
logLimit = 50,
|
|
228
|
-
showDiff = false,
|
|
229
|
-
showAll = false,
|
|
230
|
-
showChanged = false,
|
|
231
|
-
isEntriesMigration = false
|
|
232
|
-
} = {}) => {
|
|
233
|
-
var _a, _b, _c;
|
|
234
|
-
if (!isEntriesMigration) log.raw(``);
|
|
235
|
-
for (const [projectId, counts] of Object.entries(migrateResult.nodes || {})) {
|
|
236
|
-
const importTitle = action === "delete" ? `Delete from project ${log.warningText(currentProject)}` : `Import ${projectId && projectId !== "null" ? `from project ${log.highlightText(projectId)} ` : ""}to ${log.boldText(log.warningText(currentProject))}`;
|
|
237
|
-
if (!isEntriesMigration) log.help(importTitle);
|
|
238
|
-
const migrateStatusAndCount = migrateResult.nodesToMigrate[currentProject];
|
|
239
|
-
const existingCount = ((_b = (_a = migrateResult.nodes) == null ? void 0 : _a[projectId]) == null ? void 0 : _b.totalCount) || 0;
|
|
240
|
-
const totalCount = Object.keys(migrateResult.nodesToMigrate.nodeIds).length;
|
|
241
|
-
const existingPercent = counts.totalCount ? (existingCount / totalCount * 100).toFixed(0) : "0";
|
|
242
|
-
const noChangeCount = (migrateStatusAndCount == null ? void 0 : migrateStatusAndCount["no change"]) || 0;
|
|
243
|
-
const changedPercentage = counts.totalCount ? (noChangeCount / totalCount * 100).toFixed(0) : "0";
|
|
244
|
-
const existingColor = existingPercent === "0" || action === "delete" ? log.warningText : log.infoText;
|
|
245
|
-
const changedColor = changedPercentage === "100" ? log.successText : log.warningText;
|
|
246
|
-
if (!isEntriesMigration || migrateStatusAndCount.totalCount > 0)
|
|
247
|
-
console.log(
|
|
248
|
-
` - ${log.highlightText(
|
|
249
|
-
`${isEntriesMigration ? " + nodes" : "totalCount"}: ${migrateStatusAndCount.totalCount}`
|
|
250
|
-
)}${changedPercentage === "100" ? "" : existingColor(` [existing: ${`${existingPercent}%`}]`)}${existingPercent === "0" ? "" : changedColor(
|
|
251
|
-
` ${changedPercentage === "100" ? "up to date" : `[needs update: ${100 - Number(changedPercentage)}%]`}`
|
|
252
|
-
)}`
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
if ((_c = migrateResult.errors) == null ? void 0 : _c.length) {
|
|
256
|
-
console.log(
|
|
257
|
-
` - ${log.errorText(`errors: ${migrateResult.errors.length}`)}
|
|
258
|
-
`
|
|
259
|
-
);
|
|
260
|
-
log.limits(
|
|
261
|
-
migrateResult.errors.map((error) => {
|
|
262
|
-
return log.errorText((0, import_error.deconstructApiError)(error));
|
|
263
|
-
}).join("\n"),
|
|
264
|
-
logLimit
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
const highlightDiffText = (str) => {
|
|
269
|
-
const addedRegex = new RegExp(/<<\+>>(.*?)<<\/\+>>/, "g");
|
|
270
|
-
const removedRegex = new RegExp(/<<->>(.*?)<<\/->>/, "g");
|
|
271
|
-
return str.replace(addedRegex, (match) => {
|
|
272
|
-
return import_logger.Logger.successText(
|
|
273
|
-
match.replace(/<<\+>>/g, "<+>").replace(/<<\/\+>>/g, "</+>")
|
|
274
|
-
);
|
|
275
|
-
}).replace(removedRegex, (match) => {
|
|
276
|
-
return import_logger.Logger.errorText(
|
|
277
|
-
match.replace(/<<->>/g, "<->").replace(/<<\/->>/g, "</->")
|
|
278
|
-
);
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
const printModelMigrationAnalysis = ({ log, messages }, result = {}) => {
|
|
282
|
-
for (const [contentTypeId, model] of Object.entries(result)) {
|
|
283
|
-
let mainOutput = log.standardText(
|
|
284
|
-
` - ${contentTypeId}${model.contentTypeId ? ` ${log.helpText(model.contentTypeId)}` : ""}`
|
|
285
|
-
);
|
|
286
|
-
let extraOutput = "";
|
|
287
|
-
let errorOutput = "";
|
|
288
|
-
let diffOutput = "";
|
|
289
|
-
for (const [key, details] of Object.entries(model)) {
|
|
290
|
-
if (key === "dependencies") {
|
|
291
|
-
extraOutput += log.infoText(
|
|
292
|
-
` references: [${details == null ? void 0 : details.join(", ")}]
|
|
293
|
-
`
|
|
294
|
-
);
|
|
295
|
-
}
|
|
296
|
-
if (key === "dependencyOf") {
|
|
297
|
-
extraOutput += log.infoText(
|
|
298
|
-
` required by: [${details == null ? void 0 : details.join(", ")}]
|
|
299
|
-
`
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
if (key === "projects") {
|
|
303
|
-
for (const [projectId, projectDetails] of Object.entries(details)) {
|
|
304
|
-
mainOutput += log.infoText(
|
|
305
|
-
` [${messages.migrate.status(projectDetails.status)(
|
|
306
|
-
`${projectId}: ${projectDetails.status}`
|
|
307
|
-
)}]${projectDetails.versionNo ? ` v${projectDetails.versionNo}` : ""}`
|
|
308
|
-
);
|
|
309
|
-
if (projectDetails.diff)
|
|
310
|
-
diffOutput += ` ${log.highlightText(`diff:`)} ${log.infoText(
|
|
311
|
-
highlightDiffText(projectDetails.diff)
|
|
312
|
-
)}`;
|
|
313
|
-
if (projectDetails.error)
|
|
314
|
-
errorOutput += ` ${log.highlightText(
|
|
315
|
-
`error:`
|
|
316
|
-
)} ${log.errorText(projectDetails.error)}`;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
console.log(mainOutput);
|
|
321
|
-
if (extraOutput) {
|
|
322
|
-
const search = "\n";
|
|
323
|
-
const replace = "";
|
|
324
|
-
console.log(
|
|
325
|
-
extraOutput.replace(
|
|
326
|
-
new RegExp(search + "([^" + search + "]*)$"),
|
|
327
|
-
replace + "$1"
|
|
328
|
-
)
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
if (diffOutput) console.log(diffOutput);
|
|
332
|
-
if (errorOutput) console.log(errorOutput);
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
const printModelMigrationResult = ({ log, messages }, result) => {
|
|
336
|
-
for (const [status, ids] of Object.entries(result)) {
|
|
337
|
-
if (ids == null ? void 0 : ids.length) {
|
|
338
|
-
if (status === "errors") {
|
|
339
|
-
const errors = ids;
|
|
340
|
-
log.raw(
|
|
341
|
-
` - ${status}: [ ${messages.migrate.models.result(status)(
|
|
342
|
-
ids.map((id) => id[0]).join(", ")
|
|
343
|
-
)} ]
|
|
344
|
-
`
|
|
345
|
-
);
|
|
346
|
-
for (const [contentTypeId, error] of errors)
|
|
347
|
-
log.error(
|
|
348
|
-
`${log.highlightText(contentTypeId)}: ${error.message}`,
|
|
349
|
-
error
|
|
350
|
-
);
|
|
351
|
-
} else
|
|
352
|
-
log.raw(
|
|
353
|
-
` - ${status}: [ ${messages.migrate.models.result(status)(
|
|
354
|
-
ids.join(", ")
|
|
355
|
-
)} ]`
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
const printNodeTreeOutput = ({ log, messages }, root, logDetail = "errors", logLimit = 1e3) => {
|
|
361
|
-
log.raw("");
|
|
362
|
-
const statusColour = messages.migrate.status;
|
|
363
|
-
if (root && "status" in root)
|
|
364
|
-
log.info(
|
|
365
|
-
`Migrate status: ${statusColour("no change")(
|
|
366
|
-
"N"
|
|
367
|
-
)} [no change]; ${statusColour("create")("C")} [create]; ${statusColour(
|
|
368
|
-
"update"
|
|
369
|
-
)("U")} [update]; ${statusColour("delete")("D")} [delete]; ${statusColour(
|
|
370
|
-
"error"
|
|
371
|
-
)("E")} [error];`
|
|
372
|
-
);
|
|
373
|
-
log.info(
|
|
374
|
-
`Node properties: ${log.highlightText(
|
|
375
|
-
"e"
|
|
376
|
-
)} = has entry; ${log.highlightText("c")} = canonical; ${log.highlightText(
|
|
377
|
-
"m"
|
|
378
|
-
)} = include in menu`
|
|
379
|
-
);
|
|
380
|
-
log.line();
|
|
381
|
-
const outputNode = (node, spaces, isRoot = false) => {
|
|
382
|
-
var _a, _b;
|
|
383
|
-
const errorOutput = "error" in node && node.error && (0, import_error.deconstructApiError)(node.error);
|
|
384
|
-
const fullOutput = logDetail === "all";
|
|
385
|
-
const changesOutput = logDetail === "changes" && "status" in node && node.status && ["create", "update"].includes(node.status);
|
|
386
|
-
const diffOutput = (fullOutput || changesOutput || errorOutput) && "diff" in node && ((_a = node.diff) == null ? void 0 : _a.replaceAll("\n", ""));
|
|
387
|
-
return `${"status" in node && node.status ? `${statusColour(node.status)(
|
|
388
|
-
node.status.substring(0, 1).toUpperCase()
|
|
389
|
-
)} ` : ""}${node.entry ? log.highlightText("e") : log.infoText("-")}${"isCanonical" in node && node.isCanonical ? log.highlightText("c") : log.infoText("-")}${node.includeInMenu ? log.highlightText("m") : log.infoText("-")}${spaces}${log["status" in node && node.status === "no change" ? "infoText" : "standardText"](
|
|
390
|
-
"isCanonical" in node && node.isCanonical ? log.boldText(
|
|
391
|
-
fullOutput || isRoot || !node.slug ? node.path : `/${node.slug}`
|
|
392
|
-
) : fullOutput || isRoot || !node.slug ? node.path : `/${node.slug}`
|
|
393
|
-
)}${node.entry ? ` ${log.helpText(node.entry.sys.contentTypeId)}` : ""}${node.childCount ? ` +${node.childCount}` : ``} ${"displayName" in node ? log.infoText(node.displayName) : ""}${fullOutput || changesOutput && node.id !== node.originalId ? `~n ${log.infoText(`id:`)} ${!("originalId" in node) || node.id === node.originalId ? node.id : `${node.id} ${log.infoText(`<= ${node.originalId}`)}`}` : ""}${(fullOutput || changesOutput && node.parentId !== node.originalParentId) && node.parentId ? `~n ${log.infoText(
|
|
394
|
-
`parentId: ${!("originalParentId" in node) || node.parentId === node.originalParentId ? node.parentId : `${node.parentId} <= ${node.originalParentId}`}`
|
|
395
|
-
)}` : ""}${fullOutput && ((_b = node.entry) == null ? void 0 : _b.sys.id) ? `~n ${log.infoText(`entryId: ${node.entry.sys.id}`)}` : ""}${errorOutput ? `~n${(0, import_logger.addNewLines)(` ${log.errorText(errorOutput)}`, "~n")}` : ""}${diffOutput ? `~n${(0, import_logger.addNewLines)(
|
|
396
|
-
` ${log.infoText(`diff: ${highlightDiffText(diffOutput)}`)}`,
|
|
397
|
-
"~n"
|
|
398
|
-
)}` : ""}`;
|
|
399
|
-
};
|
|
400
|
-
const outputChildren = (node, depth = 2) => {
|
|
401
|
-
let str = "";
|
|
402
|
-
for (const child of (node == null ? void 0 : node.children) || []) {
|
|
403
|
-
str += `${outputNode(child, Array(depth + 1).join(" "))}
|
|
404
|
-
`;
|
|
405
|
-
if ("children" in child) str += outputChildren(child, depth + 1);
|
|
406
|
-
}
|
|
407
|
-
return str;
|
|
408
|
-
};
|
|
409
|
-
const children = outputChildren(root);
|
|
410
|
-
log.limits(
|
|
411
|
-
`${outputNode(root || {}, " ", true)}${children ? `
|
|
412
|
-
${children}` : ""}`,
|
|
413
|
-
logLimit
|
|
414
|
-
);
|
|
415
|
-
};
|
|
416
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
417
|
-
0 && (module.exports = {
|
|
418
|
-
printBlockVersion,
|
|
419
|
-
printEntriesMigrateResult,
|
|
420
|
-
printModelMigrationAnalysis,
|
|
421
|
-
printModelMigrationResult,
|
|
422
|
-
printNodeTreeOutput,
|
|
423
|
-
printNodesMigrateResult
|
|
424
|
-
});
|
|
425
|
-
//# sourceMappingURL=console.printer.js.map
|