@celonis/content-cli 1.0.6 → 1.0.8
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/commands/configuration-management/api/batch-import-export-api.js +10 -0
- package/commands/configuration-management/batch-import-export.service.js +8 -2
- package/commands/configuration-management/config-command.service.js +2 -2
- package/commands/configuration-management/module.js +6 -2
- package/commands/configuration-management/studio.service.js +2 -1
- package/content-cli.js +7 -1
- package/core/command/CustomHelp.js +30 -0
- package/core/command/module-handler.js +30 -1
- package/lib/commands/configuration-management/api/batch-import-export-api.d.ts +1 -0
- package/lib/commands/configuration-management/batch-import-export.service.d.ts +1 -1
- package/lib/commands/configuration-management/config-command.service.d.ts +1 -1
- package/lib/core/command/CustomHelp.d.ts +5 -0
- package/lib/core/command/module-handler.d.ts +4 -0
- package/package.json +1 -1
|
@@ -67,6 +67,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
exportPackagesByVersions(packageKeysWithVersion, withDependencies = false) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const queryParams = new URLSearchParams();
|
|
73
|
+
packageKeysWithVersion.forEach(packageKeyByVersion => queryParams.append("packageKeysWithVersion", packageKeyByVersion));
|
|
74
|
+
queryParams.set("withDependencies", withDependencies.toString());
|
|
75
|
+
return this.httpClient().getFile(`/package-manager/api/core/packages/versions/export/batch?${queryParams.toString()}`).catch(e => {
|
|
76
|
+
throw new logger_1.FatalError(`Problem exporting packages by versions: ${e}`);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
70
80
|
batchExportPackagesMetadata(packageKeys) {
|
|
71
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
82
|
const queryParams = new URLSearchParams();
|
|
@@ -57,9 +57,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
57
57
|
this.exportListOfPackages(packagesToExport);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
batchExportPackages(packageKeys, withDependencies = false) {
|
|
60
|
+
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies = false) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
|
|
62
|
+
let exportedPackagesData;
|
|
63
|
+
if (packageKeys) {
|
|
64
|
+
exportedPackagesData = yield this.batchImportExportApi.exportPackages(packageKeys, withDependencies);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
exportedPackagesData = yield this.batchImportExportApi.exportPackagesByVersions(packageKeysByVersion, withDependencies);
|
|
68
|
+
}
|
|
63
69
|
const exportedPackagesZip = new AdmZip(exportedPackagesData);
|
|
64
70
|
const manifest = (0, json_1.parse)(exportedPackagesZip.getEntry(batch_export_import_constants_1.BatchExportImportConstants.MANIFEST_FILE_NAME).getData().toString());
|
|
65
71
|
const versionsByPackageKey = this.getVersionsByPackageKey(manifest);
|
|
@@ -52,8 +52,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
batchExportPackages(packageKeys, withDependencies = false) {
|
|
56
|
-
return this.batchImportExportService.batchExportPackages(packageKeys, withDependencies);
|
|
55
|
+
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies = false) {
|
|
56
|
+
return this.batchImportExportService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies);
|
|
57
57
|
}
|
|
58
58
|
batchExportPackagesMetadata(packageKeys, jsonResponse) {
|
|
59
59
|
return this.batchImportExportService.batchExportPackagesMetadata(packageKeys, jsonResponse);
|
|
@@ -37,7 +37,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
37
37
|
.action(this.listActivePackages);
|
|
38
38
|
configCommand.command("export")
|
|
39
39
|
.description("Command to export package configs")
|
|
40
|
-
.
|
|
40
|
+
.option("--packageKeys <packageKeys...>", "Keys of packages to export. Exports the latest deployed version only")
|
|
41
|
+
.option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
|
|
41
42
|
.option("--withDependencies", "Include variables and dependencies", "")
|
|
42
43
|
.action(this.batchExportPackages);
|
|
43
44
|
const metadataCommand = configCommand.command("metadata")
|
|
@@ -82,7 +83,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
82
83
|
}
|
|
83
84
|
batchExportPackages(context, command, options) {
|
|
84
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
|
|
86
|
+
if ((options.packageKeys && options.keysByVersion) || (!options.packageKeys && !options.keysByVersion)) {
|
|
87
|
+
throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
|
|
88
|
+
}
|
|
89
|
+
yield new config_command_service_1.ConfigCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies);
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
batchExportPackagesMetadata(context, command, options) {
|
|
@@ -116,7 +116,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
fixConnectionVariable(variable) {
|
|
119
|
-
|
|
119
|
+
var _a;
|
|
120
|
+
if (!((_a = variable.value) === null || _a === void 0 ? void 0 : _a.appName)) {
|
|
120
121
|
return variable;
|
|
121
122
|
}
|
|
122
123
|
return Object.assign(Object.assign({}, variable), { metadata: Object.assign(Object.assign({}, variable.metadata), { appName: variable.value.appName }) });
|
package/content-cli.js
CHANGED
|
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
if (v !== undefined) module.exports = v;
|
|
15
15
|
}
|
|
16
16
|
else if (typeof define === "function" && define.amd) {
|
|
17
|
-
define(["require", "exports", "semver/functions/satisfies", "commander", "./core/command/module-handler", "./core/command/cli-context", "./core/utils/version", "./core/utils/logger"], factory);
|
|
17
|
+
define(["require", "exports", "semver/functions/satisfies", "commander", "./core/command/module-handler", "./core/command/cli-context", "./core/utils/version", "./core/utils/logger", "./core/command/CustomHelp"], factory);
|
|
18
18
|
}
|
|
19
19
|
})(function (require, exports) {
|
|
20
20
|
"use strict";
|
|
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
const cli_context_1 = require("./core/command/cli-context");
|
|
26
26
|
const version_1 = require("./core/utils/version");
|
|
27
27
|
const logger_1 = require("./core/utils/logger");
|
|
28
|
+
const CustomHelp_1 = require("./core/command/CustomHelp");
|
|
28
29
|
/**
|
|
29
30
|
* Celonis Content CLI.
|
|
30
31
|
*
|
|
@@ -38,6 +39,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
39
|
}
|
|
39
40
|
// Global configuration options
|
|
40
41
|
const program = new commander_1.Command();
|
|
42
|
+
program.configureHelp({
|
|
43
|
+
formatHelp: (cmd, helper) => new CustomHelp_1.ContentCLIHelp().formatHelp(cmd, helper),
|
|
44
|
+
subcommandTerm: cmd => new CustomHelp_1.ContentCLIHelp().subcommandTerm(cmd),
|
|
45
|
+
optionTerm: opt => new CustomHelp_1.ContentCLIHelp().optionTerm(opt),
|
|
46
|
+
});
|
|
41
47
|
program.version(version_1.VersionUtils.getCurrentCliVersion());
|
|
42
48
|
program.option("-q, --quietmode", "Reduce output to a minimum", false);
|
|
43
49
|
program.option("-p, --profile [profile]");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "commander", "chalk"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContentCLIHelp = void 0;
|
|
13
|
+
const commander_1 = require("commander");
|
|
14
|
+
const chalk = require("chalk");
|
|
15
|
+
class ContentCLIHelp extends commander_1.Help {
|
|
16
|
+
subcommandTerm(cmd) {
|
|
17
|
+
const base = super.subcommandTerm(cmd);
|
|
18
|
+
return cmd.isBeta === true
|
|
19
|
+
? `${base} ${chalk.yellow("(beta)")}`
|
|
20
|
+
: base;
|
|
21
|
+
}
|
|
22
|
+
optionTerm(option) {
|
|
23
|
+
const term = super.optionTerm(option);
|
|
24
|
+
return option.isBeta === true
|
|
25
|
+
? `${term} ${chalk.yellow("(beta)")}`
|
|
26
|
+
: term;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ContentCLIHelp = ContentCLIHelp;
|
|
30
|
+
});
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "path", "fs", "../utils/logger"], factory);
|
|
16
|
+
define(["require", "exports", "path", "fs", "commander", "../utils/logger", "chalk"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,7 +21,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.CommandConfig = exports.Configurator = exports.ModuleHandler = exports.IModule = void 0;
|
|
22
22
|
const path = require("path");
|
|
23
23
|
const fs = require("fs");
|
|
24
|
+
const commander_1 = require("commander");
|
|
24
25
|
const logger_1 = require("../utils/logger");
|
|
26
|
+
const chalk = require("chalk");
|
|
25
27
|
class IModule {
|
|
26
28
|
}
|
|
27
29
|
exports.IModule = IModule;
|
|
@@ -171,6 +173,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
171
173
|
this.cmd.option(flags, description, defaultValue);
|
|
172
174
|
return this;
|
|
173
175
|
}
|
|
176
|
+
betaOption(flags, description, defaultValue) {
|
|
177
|
+
const option = new commander_1.Option(flags, description).default(defaultValue);
|
|
178
|
+
option.isBeta = true;
|
|
179
|
+
this.cmd.addOption(option);
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
174
182
|
requiredOption(flags, description, defaultValue) {
|
|
175
183
|
this.cmd.requiredOption(flags, description, defaultValue);
|
|
176
184
|
return this;
|
|
@@ -179,9 +187,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
179
187
|
this.deprecationMessage = deprecationMessage;
|
|
180
188
|
return this;
|
|
181
189
|
}
|
|
190
|
+
beta() {
|
|
191
|
+
this.cmd.isBeta = true;
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
182
194
|
action(handler) {
|
|
183
195
|
this.cmd.action(() => __awaiter(this, void 0, void 0, function* () {
|
|
184
196
|
try {
|
|
197
|
+
this.printBetaNoticeIfBetaCommand();
|
|
198
|
+
this.printBetaNoticeIfBetaOptions();
|
|
185
199
|
this.printDeprecationNoticeIfDeprecated();
|
|
186
200
|
yield handler(this.ctx, this.cmd, this.cmd.opts());
|
|
187
201
|
}
|
|
@@ -195,6 +209,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
195
209
|
logger_1.logger.warn("⚠️ [DEPRECATION NOTICE] \n" + this.deprecationMessage);
|
|
196
210
|
}
|
|
197
211
|
}
|
|
212
|
+
printBetaNoticeIfBetaCommand() {
|
|
213
|
+
if (this.cmd.isBeta) {
|
|
214
|
+
logger_1.logger.info(chalk.yellow("This command is in beta and may change in future releases."));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
printBetaNoticeIfBetaOptions() {
|
|
218
|
+
if (this.cmd.isBeta) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
for (const option of this.cmd.options) {
|
|
222
|
+
if (option.isBeta) {
|
|
223
|
+
logger_1.logger.info(chalk.yellow(`The option '${option.long}' is in beta and may change in future releases.`));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
198
227
|
}
|
|
199
228
|
exports.CommandConfig = CommandConfig;
|
|
200
229
|
});
|
|
@@ -9,6 +9,7 @@ export declare class BatchImportExportApi {
|
|
|
9
9
|
findActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string): Promise<PackageExportTransport[]>;
|
|
10
10
|
findActivePackagesByKeys(packageKeys: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
|
|
11
11
|
exportPackages(packageKeys: string[], withDependencies?: boolean): Promise<Buffer>;
|
|
12
|
+
exportPackagesByVersions(packageKeysWithVersion: string[], withDependencies?: boolean): Promise<Buffer>;
|
|
12
13
|
batchExportPackagesMetadata(packageKeys: string[]): Promise<PackageMetadataExportTransport[]>;
|
|
13
14
|
importPackages(data: FormData, overwrite: boolean): Promise<PostPackageImportData[]>;
|
|
14
15
|
findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]>;
|
|
@@ -6,7 +6,7 @@ export declare class BatchImportExportService {
|
|
|
6
6
|
constructor(context: Context);
|
|
7
7
|
listActivePackages(flavors: string[]): Promise<void>;
|
|
8
8
|
findAndExportListOfActivePackages(flavors: string[], packageKeys: string[], withDependencies: boolean): Promise<void>;
|
|
9
|
-
batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
|
|
9
|
+
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies?: boolean): Promise<void>;
|
|
10
10
|
batchExportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
|
|
11
11
|
batchImportPackages(file: string, overwrite: boolean): Promise<void>;
|
|
12
12
|
findAndExportListOfActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string): Promise<void>;
|
|
@@ -6,7 +6,7 @@ export declare class ConfigCommandService {
|
|
|
6
6
|
constructor(context: Context);
|
|
7
7
|
listActivePackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[], variableValue: string, variableType: string): Promise<void>;
|
|
8
8
|
listVariables(jsonResponse: boolean, keysByVersion: string[], keysByVersionFile: string): Promise<void>;
|
|
9
|
-
batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
|
|
9
|
+
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies?: boolean): Promise<void>;
|
|
10
10
|
batchExportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
|
|
11
11
|
batchImportPackages(file: string, overwrite: boolean): Promise<void>;
|
|
12
12
|
diffPackages(file: string, hasChanges: boolean, jsonResponse: boolean): Promise<void>;
|
|
@@ -49,9 +49,13 @@ export declare class CommandConfig {
|
|
|
49
49
|
description(description: string): CommandConfig;
|
|
50
50
|
argument(name: string, description?: string, defaultValue?: unknown): CommandConfig;
|
|
51
51
|
option(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
52
|
+
betaOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
52
53
|
requiredOption(flags: string, description?: string, defaultValue?: string | boolean | string[]): CommandConfig;
|
|
53
54
|
deprecationNotice(deprecationMessage: string): CommandConfig;
|
|
55
|
+
beta(): CommandConfig;
|
|
54
56
|
action(handler: CommandHandler): void;
|
|
55
57
|
private printDeprecationNoticeIfDeprecated;
|
|
58
|
+
private printBetaNoticeIfBetaCommand;
|
|
59
|
+
private printBetaNoticeIfBetaOptions;
|
|
56
60
|
}
|
|
57
61
|
export {};
|