@celonis/content-cli 1.3.0 → 1.4.0
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/package-version-api.js +38 -0
- package/commands/configuration-management/interfaces/package-version.interfaces.js +12 -0
- package/commands/configuration-management/module.js +19 -5
- package/commands/configuration-management/package-version-command.service.js +34 -0
- package/commands/configuration-management/package-version.service.js +55 -0
- package/commands/git-profile/module.js +0 -5
- package/core/command/cli-context.js +1 -1
- package/core/profile/profile.service.js +13 -0
- package/lib/commands/configuration-management/api/package-version-api.d.ts +7 -0
- package/lib/commands/configuration-management/interfaces/package-version.interfaces.d.ts +10 -0
- package/lib/commands/configuration-management/module.d.ts +1 -0
- package/lib/commands/configuration-management/package-version-command.service.d.ts +6 -0
- package/lib/commands/configuration-management/package-version.service.d.ts +7 -0
- package/lib/core/profile/profile.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../../../core/utils/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PackageVersionApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
+
class PackageVersionApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
findOne(packageKey, version) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient()
|
|
30
|
+
.get(`/pacman/api/core/packages/${packageKey}/versions/${version}`)
|
|
31
|
+
.catch(e => {
|
|
32
|
+
throw new logger_1.FatalError(`Problem finding Package with key '${packageKey}' and version '${version}': ${e}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.PackageVersionApi = PackageVersionApi;
|
|
38
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
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"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -16,7 +16,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
16
16
|
if (v !== undefined) module.exports = v;
|
|
17
17
|
}
|
|
18
18
|
else if (typeof define === "function" && define.amd) {
|
|
19
|
-
define(["require", "exports", "../../core/command/module-handler", "./config-command.service", "./variable-command.service", "./node.service", "./node-diff.service", "./node-dependency.service"], factory);
|
|
19
|
+
define(["require", "exports", "../../core/command/module-handler", "./config-command.service", "./variable-command.service", "./node.service", "./node-diff.service", "./node-dependency.service", "./package-version-command.service"], factory);
|
|
20
20
|
}
|
|
21
21
|
})(function (require, exports) {
|
|
22
22
|
"use strict";
|
|
@@ -26,6 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
const node_service_1 = require("./node.service");
|
|
27
27
|
const node_diff_service_1 = require("./node-diff.service");
|
|
28
28
|
const node_dependency_service_1 = require("./node-dependency.service");
|
|
29
|
+
const package_version_command_service_1 = require("./package-version-command.service");
|
|
29
30
|
class Module extends module_handler_1.IModule {
|
|
30
31
|
register(context, configurator) {
|
|
31
32
|
const configCommand = configurator.command("config");
|
|
@@ -44,8 +45,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
45
|
.option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
|
|
45
46
|
.option("--withDependencies", "Include variables and dependencies", "")
|
|
46
47
|
.option("--unzip", "Unzip the exported file", "")
|
|
47
|
-
.
|
|
48
|
-
.
|
|
48
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
49
|
+
.option("--gitBranch <gitBranch>", "Git branch in which you want to push the exported file")
|
|
49
50
|
.action(this.batchExportPackages);
|
|
50
51
|
const metadataCommand = configCommand.command("metadata")
|
|
51
52
|
.description("Commands related to package metadata");
|
|
@@ -58,8 +59,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
58
59
|
configCommand.command("import")
|
|
59
60
|
.description("Command to import package configs")
|
|
60
61
|
.option("--overwrite", "Flag to allow overwriting of packages")
|
|
61
|
-
.
|
|
62
|
-
.
|
|
62
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
63
|
+
.option("--gitBranch <gitBranch>", "Git branch from which you want to pull the exported file and import")
|
|
63
64
|
.option("-f, --file <file>", "Exported packages file (relative path)")
|
|
64
65
|
.option("-d, --directory <directory>", "Exported packages directory (relative path)")
|
|
65
66
|
.action(this.batchImportPackages);
|
|
@@ -69,6 +70,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
69
70
|
.option("--json", "Return the response as a JSON file")
|
|
70
71
|
.requiredOption("-f, --file <file>", "Exported packages file (relative or absolute path)")
|
|
71
72
|
.action(this.diffPackages);
|
|
73
|
+
const configVersionCommand = configCommand.command("versions")
|
|
74
|
+
.description("Commands related to Package version metadata");
|
|
75
|
+
configVersionCommand.command("get")
|
|
76
|
+
.description("Get version metadata for a specific package version")
|
|
77
|
+
.requiredOption("--packageKey <packageKey>", "Identifier of the package")
|
|
78
|
+
.requiredOption("--packageVersion <packageVersion>", "Version of the package")
|
|
79
|
+
.option("--json", "Return the response as a JSON file")
|
|
80
|
+
.action(this.getPackageVersion);
|
|
72
81
|
const variablesCommand = configCommand.command("variables")
|
|
73
82
|
.description("Commands related to variable configs");
|
|
74
83
|
variablesCommand.command("list")
|
|
@@ -144,6 +153,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
144
153
|
yield new config_command_service_1.ConfigCommandService(context).batchExportPackagesMetadata(options.packageKeys, options.json);
|
|
145
154
|
});
|
|
146
155
|
}
|
|
156
|
+
getPackageVersion(context, command, options) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
yield new package_version_command_service_1.PackageVersionCommandService(context).getPackageVersion(options.packageKey, options.packageVersion, options.json);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
147
161
|
batchImportPackages(context, command, options) {
|
|
148
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
163
|
if (options.gitProfile && !options.gitBranch) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "./package-version.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PackageVersionCommandService = void 0;
|
|
22
|
+
const package_version_service_1 = require("./package-version.service");
|
|
23
|
+
class PackageVersionCommandService {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.packageVersionService = new package_version_service_1.PackageVersionService(context);
|
|
26
|
+
}
|
|
27
|
+
getPackageVersion(packageKey, version, jsonResponse) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
yield this.packageVersionService.findPackageVersion(packageKey, version, jsonResponse);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.PackageVersionCommandService = PackageVersionCommandService;
|
|
34
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../../core/utils/file-service", "../../core/utils/logger", "uuid", "./api/package-version-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PackageVersionService = void 0;
|
|
22
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
23
|
+
const logger_1 = require("../../core/utils/logger");
|
|
24
|
+
const uuid_1 = require("uuid");
|
|
25
|
+
const package_version_api_1 = require("./api/package-version-api");
|
|
26
|
+
class PackageVersionService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.packageVersionApi = new package_version_api_1.PackageVersionApi(context);
|
|
29
|
+
}
|
|
30
|
+
findPackageVersion(packageKey, version, jsonResponse) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const packageVersionTransport = yield this.packageVersionApi.findOne(packageKey, version);
|
|
33
|
+
if (jsonResponse) {
|
|
34
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
35
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packageVersionTransport, null, 2), filename);
|
|
36
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.printPackageVersionTransport(packageVersionTransport);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
printPackageVersionTransport(packageVersionTransport) {
|
|
44
|
+
logger_1.logger.info(`Package Key: ${packageVersionTransport.packageKey}`);
|
|
45
|
+
logger_1.logger.info(`Version: ${packageVersionTransport.version}`);
|
|
46
|
+
logger_1.logger.info(`History ID: ${packageVersionTransport.historyId}`);
|
|
47
|
+
logger_1.logger.info(`Change Date: ${new Date(packageVersionTransport.changeDate).toISOString()}`);
|
|
48
|
+
logger_1.logger.info(`Publish Date: ${new Date(packageVersionTransport.publishDate).toISOString()}`);
|
|
49
|
+
logger_1.logger.info(`Publish Message: ${packageVersionTransport.publishMessage}`);
|
|
50
|
+
logger_1.logger.info(`Deployed: ${packageVersionTransport.deployed}`);
|
|
51
|
+
logger_1.logger.info(`Published By: ${packageVersionTransport.publishedBy}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.PackageVersionService = PackageVersionService;
|
|
55
|
+
});
|
|
@@ -25,23 +25,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
class Module extends module_handler_1.IModule {
|
|
26
26
|
register(context, configurator) {
|
|
27
27
|
const gitCommand = configurator.command("git")
|
|
28
|
-
.beta()
|
|
29
28
|
.description("Commands related to Git settings");
|
|
30
29
|
const gitProfileCommand = gitCommand.command("profile")
|
|
31
|
-
.beta()
|
|
32
30
|
.description("Manage Git profiles required to use git-related operations.");
|
|
33
31
|
gitProfileCommand.command("list")
|
|
34
32
|
.description("Command to list all stored Git profiles")
|
|
35
|
-
.beta()
|
|
36
33
|
.action(this.listProfiles);
|
|
37
34
|
gitProfileCommand.command("create")
|
|
38
35
|
.description("Command to create a new Git profile")
|
|
39
36
|
.option("--setAsDefault", "Set this Git profile as default")
|
|
40
|
-
.beta()
|
|
41
37
|
.action(this.createProfile);
|
|
42
38
|
gitProfileCommand.command("default <profile>")
|
|
43
39
|
.description("Command to set a Git profile as default")
|
|
44
|
-
.beta()
|
|
45
40
|
.action(this.defaultProfile);
|
|
46
41
|
}
|
|
47
42
|
defaultProfile(context, command) {
|
|
@@ -38,7 +38,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
38
|
}
|
|
39
39
|
get httpClient() {
|
|
40
40
|
if (!this._httpClient) {
|
|
41
|
-
throw new logger_1.FatalError("No profile provided. Please provide a profile or a
|
|
41
|
+
throw new logger_1.FatalError("No profile provided. Please provide a profile or a team url and api token through env variables");
|
|
42
42
|
}
|
|
43
43
|
return this._httpClient;
|
|
44
44
|
}
|
|
@@ -40,6 +40,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
40
40
|
findProfile(profileName) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
return new Promise((resolve, reject) => {
|
|
43
|
+
this.mapCelonisEnvProfile();
|
|
43
44
|
this.checkIfMissingProfile(profileName, reject);
|
|
44
45
|
try {
|
|
45
46
|
if (process.env.TEAM_URL && process.env.API_TOKEN) {
|
|
@@ -311,6 +312,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
311
312
|
reject("Profile not found");
|
|
312
313
|
}
|
|
313
314
|
}
|
|
315
|
+
mapCelonisEnvProfile() {
|
|
316
|
+
if (!process.env.CELONIS_URL) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
process.env.TEAM_URL = process.env.CELONIS_URL;
|
|
320
|
+
if (process.env.CELONIS_API_TOKEN) {
|
|
321
|
+
process.env.API_TOKEN = process.env.CELONIS_API_TOKEN;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
delete process.env.API_TOKEN;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
314
327
|
}
|
|
315
328
|
exports.ProfileService = ProfileService;
|
|
316
329
|
exports.profileService = new ProfileService();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from "../../../core/command/cli-context";
|
|
2
|
+
import { PackageVersionTransport } from "../interfaces/package-version.interfaces";
|
|
3
|
+
export declare class PackageVersionApi {
|
|
4
|
+
private httpClient;
|
|
5
|
+
constructor(context: Context);
|
|
6
|
+
findOne(packageKey: string, version: string): Promise<PackageVersionTransport>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Context } from "../../core/command/cli-context";
|
|
2
|
+
export declare class PackageVersionCommandService {
|
|
3
|
+
private packageVersionService;
|
|
4
|
+
constructor(context: Context);
|
|
5
|
+
getPackageVersion(packageKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from "../../core/command/cli-context";
|
|
2
|
+
export declare class PackageVersionService {
|
|
3
|
+
private packageVersionApi;
|
|
4
|
+
constructor(context: Context);
|
|
5
|
+
findPackageVersion(packageKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
6
|
+
private printPackageVersionTransport;
|
|
7
|
+
}
|