@celonis/content-cli 1.16.0 → 1.18.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 +9 -0
- package/commands/configuration-management/module.js +10 -0
- package/commands/configuration-management/package-version-command.service.js +5 -0
- package/commands/configuration-management/package-version.service.js +16 -0
- package/commands/sdk/module.js +54 -0
- package/commands/sdk/sdk-api.js +48 -0
- package/commands/sdk/sdk.service.js +64 -0
- package/commands/t2tc/api/t2tc-package-api.js +10 -0
- package/commands/t2tc/batch-export-import.constants.js +1 -0
- package/commands/t2tc/module.js +5 -1
- package/commands/t2tc/t2tc-command.service.js +2 -2
- package/commands/t2tc/t2tc-package.service.js +39 -10
- package/core/http/http-client.js +15 -0
- package/core/profile/profile.service.js +10 -3
- package/lib/commands/configuration-management/api/package-version-api.d.ts +1 -0
- package/lib/commands/configuration-management/module.d.ts +1 -0
- package/lib/commands/configuration-management/package-version-command.service.d.ts +1 -0
- package/lib/commands/configuration-management/package-version.service.d.ts +1 -0
- package/lib/commands/sdk/module.d.ts +8 -0
- package/lib/commands/sdk/sdk-api.d.ts +11 -0
- package/lib/commands/sdk/sdk.service.d.ts +10 -0
- package/lib/commands/t2tc/api/t2tc-package-api.d.ts +1 -0
- package/lib/commands/t2tc/batch-export-import.constants.d.ts +2 -1
- package/lib/commands/t2tc/t2tc-command.service.d.ts +1 -1
- package/lib/commands/t2tc/t2tc-package.service.d.ts +3 -1
- package/lib/core/http/http-client.d.ts +2 -0
- package/package.json +1 -1
|
@@ -24,6 +24,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
constructor(context) {
|
|
25
25
|
this.httpClient = () => context.httpClient;
|
|
26
26
|
}
|
|
27
|
+
findAll(packageKey) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient()
|
|
30
|
+
.get(`/pacman/api/core/packages/${packageKey}/versions`)
|
|
31
|
+
.catch(e => {
|
|
32
|
+
throw new logger_1.FatalError(`Problem listing versions of Package with key '${packageKey}': ${e}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
27
36
|
findOne(packageKey, version) {
|
|
28
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
38
|
return this.httpClient()
|
|
@@ -202,6 +202,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
202
202
|
.requiredOption("--packageVersion <packageVersion>", "Version of the package. Can be a specific version or \"LATEST\" keyword, which will return the most recently created version.")
|
|
203
203
|
.option("--json", "Return the response as a JSON file")
|
|
204
204
|
.action(this.getPackageVersion);
|
|
205
|
+
configVersionCommand.command("list")
|
|
206
|
+
.description("List all created versions of a package or branch")
|
|
207
|
+
.requiredOption("--packageKey <packageKey>", "Identifier of the package. Use <projectKey>@<branchKey> for a branch.")
|
|
208
|
+
.option("--json", "Return the response as a JSON file")
|
|
209
|
+
.action(this.listPackageVersions);
|
|
205
210
|
configVersionCommand.command("create")
|
|
206
211
|
.description("Create a new version for a package")
|
|
207
212
|
.requiredOption("--packageKey <packageKey>", "Identifier of the package")
|
|
@@ -421,6 +426,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
421
426
|
yield new package_version_command_service_1.PackageVersionCommandService(context).getPackageVersion(options.packageKey, options.packageVersion, options.json);
|
|
422
427
|
});
|
|
423
428
|
}
|
|
429
|
+
listPackageVersions(context, command, options) {
|
|
430
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
431
|
+
yield new package_version_command_service_1.PackageVersionCommandService(context).listPackageVersions(options.packageKey, options.json);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
424
434
|
createPackageVersion(context, command, options) {
|
|
425
435
|
return __awaiter(this, void 0, void 0, function* () {
|
|
426
436
|
const hasExplicitVersion = !!options.packageVersion;
|
|
@@ -29,6 +29,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
29
29
|
yield this.packageVersionService.findPackageVersion(packageKey, version, jsonResponse);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
listPackageVersions(packageKey, jsonResponse) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
yield this.packageVersionService.listPackageVersions(packageKey, jsonResponse);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
32
37
|
createPackageVersion(packageKey, version, versionBumpOption, summaryOfChanges, nodeFilterKeys, jsonResponse) {
|
|
33
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
39
|
yield this.packageVersionService.createPackageVersion(packageKey, version, versionBumpOption, summaryOfChanges, nodeFilterKeys, jsonResponse);
|
|
@@ -42,6 +42,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
listPackageVersions(packageKey, jsonResponse) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const packageVersions = yield this.packageVersionApi.findAll(packageKey);
|
|
48
|
+
if (jsonResponse) {
|
|
49
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
50
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(packageVersions, null, 2), filename);
|
|
51
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
52
|
+
}
|
|
53
|
+
else if (packageVersions.length === 0) {
|
|
54
|
+
logger_1.logger.info(`Package ${packageKey} has no versions.`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
packageVersions.forEach(packageVersion => logger_1.logger.info(JSON.stringify(packageVersion)));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
45
61
|
createPackageVersion(packageKey, version, versionBumpOption, summaryOfChanges, nodeFilterKeys, jsonResponse) {
|
|
46
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
63
|
const request = {
|
|
@@ -0,0 +1,54 @@
|
|
|
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/command/module-handler", "./sdk.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
const module_handler_1 = require("../../core/command/module-handler");
|
|
21
|
+
const sdk_service_1 = require("./sdk.service");
|
|
22
|
+
class Module extends module_handler_1.IModule {
|
|
23
|
+
register(context, configurator) {
|
|
24
|
+
const sdkCommand = configurator
|
|
25
|
+
.command("sdk")
|
|
26
|
+
.beta()
|
|
27
|
+
.description("Implement custom apps for Codespace assets using the Celonis SDK");
|
|
28
|
+
sdkCommand
|
|
29
|
+
.command("download")
|
|
30
|
+
.beta()
|
|
31
|
+
.description("Download the latest Celonis SDK generated for a Codespace asset")
|
|
32
|
+
.requiredOption("--appId <appId>", "Identifier of the app to download the SDK for")
|
|
33
|
+
.action(this.downloadSdk);
|
|
34
|
+
sdkCommand
|
|
35
|
+
.command("publish")
|
|
36
|
+
.beta()
|
|
37
|
+
.description("Publish a build of a custom app as a new version of its Codespace asset")
|
|
38
|
+
.requiredOption("--appId <appId>", "Identifier of the app to publish the build for")
|
|
39
|
+
.requiredOption("--dist <dist>", "Directory containing the build of the app")
|
|
40
|
+
.action(this.publishApp);
|
|
41
|
+
}
|
|
42
|
+
downloadSdk(context, command, options) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
yield new sdk_service_1.SdkService(context).downloadSdk(options.appId);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
publishApp(context, command, options) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
yield new sdk_service_1.SdkService(context).publishApp(options.appId, options.dist);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return Module;
|
|
54
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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.SdkApi = void 0;
|
|
22
|
+
const logger_1 = require("../../core/utils/logger");
|
|
23
|
+
class SdkApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
downloadSdk(appId) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient()
|
|
30
|
+
.getFile(`/pro-code-app-manager/api/npm/@celonis-sdk/${appId}/-/${appId}-latest.tgz`)
|
|
31
|
+
.catch((e) => {
|
|
32
|
+
const problem = `Problem downloading SDK for app ${appId}`;
|
|
33
|
+
throw new logger_1.FatalError(e ? `${problem}: ${e}` : problem);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
publishApp(appId, bundle) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return this.httpClient()
|
|
40
|
+
.postBinary(`/pro-code-app-manager/api/codespace/apps/${appId}/publish`, bundle, "application/zip")
|
|
41
|
+
.catch((e) => {
|
|
42
|
+
throw new logger_1.FatalError(`Problem publishing app ${appId}: ${e}`);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.SdkApi = SdkApi;
|
|
48
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
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", "node:fs", "node:path", "adm-zip", "./sdk-api", "../../core/utils/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SdkService = void 0;
|
|
22
|
+
const fs = require("node:fs");
|
|
23
|
+
const path = require("node:path");
|
|
24
|
+
const AdmZip = require("adm-zip");
|
|
25
|
+
const sdk_api_1 = require("./sdk-api");
|
|
26
|
+
const logger_1 = require("../../core/utils/logger");
|
|
27
|
+
class SdkService {
|
|
28
|
+
constructor(context) {
|
|
29
|
+
this.sdkApi = new sdk_api_1.SdkApi(context);
|
|
30
|
+
}
|
|
31
|
+
downloadSdk(appId) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const sdk = yield this.sdkApi.downloadSdk(appId);
|
|
34
|
+
const sdkDirectory = path.resolve(process.cwd(), SdkService.SDK_DIRECTORY);
|
|
35
|
+
fs.rmSync(sdkDirectory, { recursive: true, force: true });
|
|
36
|
+
fs.mkdirSync(sdkDirectory, { recursive: true });
|
|
37
|
+
const sdkFile = path.join(SdkService.SDK_DIRECTORY, `${appId}.tgz`);
|
|
38
|
+
fs.writeFileSync(path.resolve(process.cwd(), sdkFile), sdk);
|
|
39
|
+
logger_1.logger.info(`SDK downloaded successfully: ${sdkFile}`);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
publishApp(appId, dist) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const distDirectory = path.resolve(process.cwd(), dist);
|
|
45
|
+
this.requireDirectory(distDirectory);
|
|
46
|
+
const bundle = this.compressDirectory(distDirectory);
|
|
47
|
+
const { version } = yield this.sdkApi.publishApp(appId, bundle);
|
|
48
|
+
logger_1.logger.info(`App published successfully as version '${version}'`);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
requireDirectory(directory) {
|
|
52
|
+
if (!fs.existsSync(directory) || !fs.statSync(directory).isDirectory()) {
|
|
53
|
+
throw new logger_1.FatalError(`The dist directory ${directory} does not exist or is no directory`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
compressDirectory(directory) {
|
|
57
|
+
const zip = new AdmZip();
|
|
58
|
+
zip.addLocalFolder(directory);
|
|
59
|
+
return zip.toBuffer();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.SdkService = SdkService;
|
|
63
|
+
SdkService.SDK_DIRECTORY = ".celonis-sdk";
|
|
64
|
+
});
|
|
@@ -79,6 +79,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
exportStagingPackages(packageKeys, withDependencies) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const queryParams = new URLSearchParams();
|
|
85
|
+
packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
|
|
86
|
+
queryParams.set("withDependencies", withDependencies.toString());
|
|
87
|
+
return this.httpClient().getFile(`/package-manager/api/core/staging/packages/export/batch?${queryParams.toString()}`).catch(e => {
|
|
88
|
+
throw new logger_1.FatalError(`Problem exporting staging packages: ${e}`);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
82
92
|
exportPackagesByVersions(packageKeysWithVersion, withDependencies) {
|
|
83
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
94
|
const queryParams = new URLSearchParams();
|
|
@@ -21,5 +21,6 @@
|
|
|
21
21
|
BatchExportImportConstants["JSON_EXTENSION"] = ".json";
|
|
22
22
|
BatchExportImportConstants["NODES_FOLDER_NAME"] = "nodes/";
|
|
23
23
|
BatchExportImportConstants["SCENARIO_NODE"] = "SCENARIO";
|
|
24
|
+
BatchExportImportConstants["STAGING_VERSION"] = "staging";
|
|
24
25
|
})(BatchExportImportConstants || (exports.BatchExportImportConstants = BatchExportImportConstants = {}));
|
|
25
26
|
});
|
package/commands/t2tc/module.js
CHANGED
|
@@ -45,6 +45,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
45
45
|
.option("--unzip", "Unzip the exported file", "")
|
|
46
46
|
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
47
47
|
.option("--gitBranch <gitBranch>", "Git branch in which you want to push the exported file")
|
|
48
|
+
.option("--staging", "Export the staging state of the given --packageKeys (including branch packages) instead of the latest deployed version", false)
|
|
48
49
|
.action(this.batchExportPackages);
|
|
49
50
|
t2tcPackageCommand.command("import")
|
|
50
51
|
.description("Import packages from a Team-to-Team Copy archive produced by 't2tc package export'. To import a single standalone package, use 'config package import'.")
|
|
@@ -83,8 +84,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
83
84
|
if (options.gitProfile && !options.gitBranch) {
|
|
84
85
|
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
85
86
|
}
|
|
87
|
+
if (options.staging && options.keysByVersion) {
|
|
88
|
+
throw new Error("Staging parameter is only supported with --packageKeys, not --keysByVersion.");
|
|
89
|
+
}
|
|
86
90
|
options.withDependencies = (_a = options.withDependencies) !== null && _a !== void 0 ? _a : false;
|
|
87
|
-
yield new t2tc_command_service_1.T2tcCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies, options.gitBranch, options.unzip);
|
|
91
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies, options.gitBranch, options.unzip, options.staging);
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
94
|
batchImportPackages(context, command, options) {
|
|
@@ -48,8 +48,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
|
|
52
|
-
return this.t2tcPackageService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip);
|
|
51
|
+
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip, staging = false) {
|
|
52
|
+
return this.t2tcPackageService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip, staging);
|
|
53
53
|
}
|
|
54
54
|
batchImportPackages(file, directory, overwrite, gitBranch, performValidation = false) {
|
|
55
55
|
if ((directory || file) && gitBranch) {
|
|
@@ -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", "uuid", "form-data", "stream", "adm-zip", "./batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/t2tc-package-api", "../configuration-management/api/variable-api", "../configuration-management/connection-variable.helper", "./studio.service", "../../core/git-profile/git/git.service", "fs", "../../core/utils/file.constants"], factory);
|
|
16
|
+
define(["require", "exports", "uuid", "form-data", "stream", "adm-zip", "./batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/t2tc-package-api", "../configuration-management/api/variable-api", "../configuration-management/api/staging-package-variables-api", "../configuration-management/connection-variable.helper", "./studio.service", "../../core/git-profile/git/git.service", "fs", "../../core/utils/file.constants"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -31,6 +31,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
const package_api_1 = require("../studio/api/package-api");
|
|
32
32
|
const t2tc_package_api_1 = require("./api/t2tc-package-api");
|
|
33
33
|
const variable_api_1 = require("../configuration-management/api/variable-api");
|
|
34
|
+
const staging_package_variables_api_1 = require("../configuration-management/api/staging-package-variables-api");
|
|
34
35
|
const connection_variable_helper_1 = require("../configuration-management/connection-variable.helper");
|
|
35
36
|
const studio_service_1 = require("./studio.service");
|
|
36
37
|
const git_service_1 = require("../../core/git-profile/git/git.service");
|
|
@@ -40,6 +41,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
40
41
|
constructor(context) {
|
|
41
42
|
this.t2tcPackageApi = new t2tc_package_api_1.T2tcPackageApi(context);
|
|
42
43
|
this.variableApi = new variable_api_1.VariableApi(context);
|
|
44
|
+
this.stagingPackageVariablesApi = new staging_package_variables_api_1.StagingPackageVariablesApi(context);
|
|
43
45
|
this.studioPackageApi = new package_api_1.PackageApi(context);
|
|
44
46
|
this.studioService = new studio_service_1.StudioService(context);
|
|
45
47
|
this.gitService = new git_service_1.GitService(context);
|
|
@@ -77,10 +79,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
77
79
|
});
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
|
-
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
|
|
82
|
+
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip, staging = false) {
|
|
81
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
84
|
let exportedPackagesData;
|
|
83
|
-
if (
|
|
85
|
+
if (staging) {
|
|
86
|
+
exportedPackagesData = yield this.t2tcPackageApi.exportStagingPackages(packageKeys, withDependencies);
|
|
87
|
+
}
|
|
88
|
+
else if (packageKeys) {
|
|
84
89
|
exportedPackagesData = yield this.t2tcPackageApi.exportPackages(packageKeys, withDependencies);
|
|
85
90
|
}
|
|
86
91
|
else {
|
|
@@ -178,16 +183,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
178
183
|
return versionsByPackageKey;
|
|
179
184
|
}
|
|
180
185
|
getVersionedVariablesForPackagesWithKeys(versionsByPackageKey) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
version
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const variableExportRequest = [];
|
|
188
|
+
const stagingPackageKeys = [];
|
|
189
|
+
versionsByPackageKey === null || versionsByPackageKey === void 0 ? void 0 : versionsByPackageKey.forEach((versions, key) => {
|
|
190
|
+
versions === null || versions === void 0 ? void 0 : versions.forEach(version => {
|
|
191
|
+
if (version === batch_export_import_constants_1.BatchExportImportConstants.STAGING_VERSION) {
|
|
192
|
+
stagingPackageKeys.push(key);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
variableExportRequest.push({
|
|
196
|
+
packageKey: key,
|
|
197
|
+
version: version,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
const versionedVariables = yield this.variableApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
|
|
202
|
+
const stagingVariables = stagingPackageKeys.length
|
|
203
|
+
? yield this.getStagingVariablesForPackagesWithKeys(stagingPackageKeys)
|
|
204
|
+
: [];
|
|
205
|
+
return [...versionedVariables, ...stagingVariables];
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
getStagingVariablesForPackagesWithKeys(packageKeys) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
const stagingVariables = yield this.stagingPackageVariablesApi.findAllByPackageKeys(packageKeys);
|
|
211
|
+
return stagingVariables.map(stagingVariable => {
|
|
212
|
+
var _a;
|
|
213
|
+
return ({
|
|
214
|
+
packageKey: stagingVariable.packageKey,
|
|
215
|
+
version: batch_export_import_constants_1.BatchExportImportConstants.STAGING_VERSION,
|
|
216
|
+
variables: (_a = stagingVariable.variables) !== null && _a !== void 0 ? _a : [],
|
|
187
217
|
});
|
|
188
218
|
});
|
|
189
219
|
});
|
|
190
|
-
return this.variableApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
|
|
191
220
|
}
|
|
192
221
|
buildBodyForImport(configs, sourcePath, variablesManifests) {
|
|
193
222
|
const formData = new FormData();
|
package/core/http/http-client.js
CHANGED
|
@@ -133,6 +133,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
+
postBinary(url, body, contentType) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
this.axios.post(this.resolveUrl(url), body, {
|
|
140
|
+
headers: this.buildHeaders(contentType)
|
|
141
|
+
}).then(response => {
|
|
142
|
+
this.handleResponse(response, resolve, reject);
|
|
143
|
+
}).catch(err => {
|
|
144
|
+
this.handleError(err, resolve, reject);
|
|
145
|
+
});
|
|
146
|
+
}).catch(e => {
|
|
147
|
+
throw new logger_1.FatalError(e);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
136
151
|
put(url, body) {
|
|
137
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
153
|
return new Promise((resolve, reject) => {
|
|
@@ -36,6 +36,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
36
36
|
const OAUTH_SCOPES = ["studio", "package-manager", "integration.data-pools", "action-engine.projects"];
|
|
37
37
|
/** Device code fallback: try without action-engine.projects if all 4 scopes fail. */
|
|
38
38
|
const DEVICE_CODE_SCOPES_WITHOUT_ACTION_ENGINE = ["studio", "package-manager", "integration.data-pools"];
|
|
39
|
+
/** First attempt for both auth flows: all scopes plus the pro-code-app-manager scopes, which are not yet available on every environment. */
|
|
40
|
+
const OAUTH_SCOPES_WITH_PRO_CODE = [...OAUTH_SCOPES, "pro-code-app-manager.sdk:read", "pro-code-app-manager.publish"];
|
|
39
41
|
class ProfileService {
|
|
40
42
|
constructor() {
|
|
41
43
|
this.profileContainerPath = path.resolve(homedir, ".celonis-content-cli-profiles");
|
|
@@ -216,13 +218,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
220
|
break;
|
|
219
|
-
case profile_interface_1.ProfileType.DEVICE_CODE:
|
|
221
|
+
case profile_interface_1.ProfileType.DEVICE_CODE: {
|
|
220
222
|
const deviceCodeIssuer = yield openid_client_1.Issuer.discover(profile.team);
|
|
221
223
|
const deviceCodeOAuthClient = new deviceCodeIssuer.Client({
|
|
222
224
|
client_id: "content-cli",
|
|
223
225
|
token_endpoint_auth_method: "none",
|
|
224
226
|
});
|
|
225
|
-
const deviceCodeScopeAttempts = [
|
|
227
|
+
const deviceCodeScopeAttempts = [
|
|
228
|
+
OAUTH_SCOPES_WITH_PRO_CODE,
|
|
229
|
+
OAUTH_SCOPES,
|
|
230
|
+
DEVICE_CODE_SCOPES_WITHOUT_ACTION_ENGINE,
|
|
231
|
+
];
|
|
226
232
|
let deviceCodeSuccess = false;
|
|
227
233
|
for (const scopeList of deviceCodeScopeAttempts) {
|
|
228
234
|
try {
|
|
@@ -245,6 +251,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
245
251
|
throw new logger_1.FatalError("Device code authorization failed. The provided team or requested scopes may be invalid.");
|
|
246
252
|
}
|
|
247
253
|
break;
|
|
254
|
+
}
|
|
248
255
|
case profile_interface_1.ProfileType.CLIENT_CREDENTIALS:
|
|
249
256
|
const clientCredentialsIssuer = yield openid_client_1.Issuer.discover(profile.team);
|
|
250
257
|
const basicResult = yield this.tryClientCredentialsGrant(clientCredentialsIssuer, profile, profile_interface_1.ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
|
|
@@ -411,7 +418,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
411
418
|
client_secret: profile.clientSecret,
|
|
412
419
|
token_endpoint_auth_method: tokenEndpointAuthMethod,
|
|
413
420
|
});
|
|
414
|
-
const scopeAttempts = this.getScopeCombinationsOrderedBySize(OAUTH_SCOPES);
|
|
421
|
+
const scopeAttempts = [OAUTH_SCOPES_WITH_PRO_CODE, ...this.getScopeCombinationsOrderedBySize(OAUTH_SCOPES)];
|
|
415
422
|
for (const scopeList of scopeAttempts) {
|
|
416
423
|
try {
|
|
417
424
|
const tokenSet = yield client.grant({
|
|
@@ -3,6 +3,7 @@ import { PackageVersionCreatedTransport, PackageVersionTransport, SavePackageVer
|
|
|
3
3
|
export declare class PackageVersionApi {
|
|
4
4
|
private httpClient;
|
|
5
5
|
constructor(context: Context);
|
|
6
|
+
findAll(packageKey: string): Promise<PackageVersionTransport[]>;
|
|
6
7
|
findOne(packageKey: string, version: string): Promise<PackageVersionTransport>;
|
|
7
8
|
createVersion(packageKey: string, request: SavePackageVersionTransport): Promise<PackageVersionCreatedTransport>;
|
|
8
9
|
}
|
|
@@ -18,6 +18,7 @@ declare class Module extends IModule {
|
|
|
18
18
|
private batchExportPackages;
|
|
19
19
|
private exportPackagesMetadata;
|
|
20
20
|
private getPackageVersion;
|
|
21
|
+
private listPackageVersions;
|
|
21
22
|
private createPackageVersion;
|
|
22
23
|
private batchImportPackages;
|
|
23
24
|
private importSinglePackage;
|
|
@@ -3,5 +3,6 @@ export declare class PackageVersionCommandService {
|
|
|
3
3
|
private packageVersionService;
|
|
4
4
|
constructor(context: Context);
|
|
5
5
|
getPackageVersion(packageKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
6
|
+
listPackageVersions(packageKey: string, jsonResponse: boolean): Promise<void>;
|
|
6
7
|
createPackageVersion(packageKey: string, version: string | undefined, versionBumpOption: string, summaryOfChanges: string | undefined, nodeFilterKeys: string[] | undefined, jsonResponse: boolean): Promise<void>;
|
|
7
8
|
}
|
|
@@ -4,6 +4,7 @@ export declare class PackageVersionService {
|
|
|
4
4
|
private readonly cuiFileService;
|
|
5
5
|
constructor(context: Context);
|
|
6
6
|
findPackageVersion(packageKey: string, version: string, jsonResponse: boolean): Promise<void>;
|
|
7
|
+
listPackageVersions(packageKey: string, jsonResponse: boolean): Promise<void>;
|
|
7
8
|
createPackageVersion(packageKey: string, version: string | undefined, versionBumpOption: string, summaryOfChanges: string | undefined, nodeFilterKeys: string[] | undefined, jsonResponse: boolean): Promise<void>;
|
|
8
9
|
private printPackageVersionTransport;
|
|
9
10
|
private printPackageVersionCreatedTransport;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Configurator, IModule } from "../../core/command/module-handler";
|
|
2
|
+
import { Context } from "../../core/command/cli-context";
|
|
3
|
+
declare class Module extends IModule {
|
|
4
|
+
register(context: Context, configurator: Configurator): void;
|
|
5
|
+
private downloadSdk;
|
|
6
|
+
private publishApp;
|
|
7
|
+
}
|
|
8
|
+
export = Module;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Context } from "../../core/command/cli-context";
|
|
3
|
+
export interface SdkPublishResponse {
|
|
4
|
+
version: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class SdkApi {
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
constructor(context: Context);
|
|
9
|
+
downloadSdk(appId: string): Promise<Buffer>;
|
|
10
|
+
publishApp(appId: string, bundle: Buffer): Promise<SdkPublishResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context } from "../../core/command/cli-context";
|
|
2
|
+
export declare class SdkService {
|
|
3
|
+
static readonly SDK_DIRECTORY = ".celonis-sdk";
|
|
4
|
+
private readonly sdkApi;
|
|
5
|
+
constructor(context: Context);
|
|
6
|
+
downloadSdk(appId: string): Promise<void>;
|
|
7
|
+
publishApp(appId: string, dist: string): Promise<void>;
|
|
8
|
+
private requireDirectory;
|
|
9
|
+
private compressDirectory;
|
|
10
|
+
}
|
|
@@ -10,6 +10,7 @@ export declare class T2tcPackageApi {
|
|
|
10
10
|
findActivePackagesByKeys(packageKeys: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
|
|
11
11
|
findPackagesByKeysAndVersion(packageKeysWithVersion: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
|
|
12
12
|
exportPackages(packageKeys: string[], withDependencies: boolean): Promise<Buffer>;
|
|
13
|
+
exportStagingPackages(packageKeys: string[], withDependencies: boolean): Promise<Buffer>;
|
|
13
14
|
exportPackagesByVersions(packageKeysWithVersion: string[], withDependencies: boolean): Promise<Buffer>;
|
|
14
15
|
importPackages(data: FormData, overwrite: boolean, performValidation: boolean): Promise<PostPackageImportData[]>;
|
|
15
16
|
}
|
|
@@ -5,7 +5,7 @@ export declare class T2tcCommandService {
|
|
|
5
5
|
private stagingPackageService;
|
|
6
6
|
constructor(context: Context);
|
|
7
7
|
listPackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[], keysByVersion: string[], variableValue: string, variableType: string, includeBranches: boolean, staging: boolean): Promise<void>;
|
|
8
|
-
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean): Promise<void>;
|
|
8
|
+
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean, staging?: boolean): Promise<void>;
|
|
9
9
|
batchImportPackages(file: string, directory: string, overwrite: boolean, gitBranch: string, performValidation?: boolean): Promise<void>;
|
|
10
10
|
diffPackages(file: string, hasChanges: boolean, baseVersion: string, jsonResponse: boolean): Promise<void>;
|
|
11
11
|
private listPackagesByVariableValue;
|
|
@@ -2,6 +2,7 @@ import { Context } from "../../core/command/cli-context";
|
|
|
2
2
|
export declare class T2tcPackageService {
|
|
3
3
|
private t2tcPackageApi;
|
|
4
4
|
private variableApi;
|
|
5
|
+
private stagingPackageVariablesApi;
|
|
5
6
|
private studioPackageApi;
|
|
6
7
|
private studioService;
|
|
7
8
|
private gitService;
|
|
@@ -10,13 +11,14 @@ export declare class T2tcPackageService {
|
|
|
10
11
|
listActivePackages(flavors: string[], includeBranches: boolean): Promise<void>;
|
|
11
12
|
findAndExportListOfPackages(flavors: string[], packageKeys: string[], keysByVersion: string[], withDependencies: boolean, includeBranches: boolean): Promise<void>;
|
|
12
13
|
listPackagesByKeysWithVersion(keysByVersion: string[], withDependencies: boolean): Promise<void>;
|
|
13
|
-
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean): Promise<void>;
|
|
14
|
+
batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean, staging?: boolean): Promise<void>;
|
|
14
15
|
batchImportPackages(sourcePath: string, overwrite: boolean, gitBranch: string, performValidation?: boolean): Promise<void>;
|
|
15
16
|
findAndExportListOfActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string, includeBranches: boolean): Promise<void>;
|
|
16
17
|
listActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string, includeBranches: boolean): Promise<void>;
|
|
17
18
|
private exportListOfPackages;
|
|
18
19
|
private getVersionsByPackageKey;
|
|
19
20
|
private getVersionedVariablesForPackagesWithKeys;
|
|
21
|
+
private getStagingVariablesForPackagesWithKeys;
|
|
20
22
|
private buildBodyForImport;
|
|
21
23
|
private assertUncompressedSizeWithinLimit;
|
|
22
24
|
private getReadableStream;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import * as FormData from "form-data";
|
|
2
3
|
import { Context } from "../command/cli-context";
|
|
3
4
|
/**
|
|
@@ -16,6 +17,7 @@ export declare class HttpClient {
|
|
|
16
17
|
getFile(url: string): Promise<any>;
|
|
17
18
|
postFile(url: string, formData: FormData, parameters?: {}): Promise<any>;
|
|
18
19
|
post(url: string, body: any): Promise<any>;
|
|
20
|
+
postBinary(url: string, body: Buffer, contentType: string): Promise<any>;
|
|
19
21
|
put(url: string, body: object): Promise<any>;
|
|
20
22
|
delete(url: string): Promise<any>;
|
|
21
23
|
downloadFile(url: string): Promise<any>;
|