@celonis/content-cli 1.11.0 → 1.12.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/metadata-api.js +38 -0
- package/commands/configuration-management/api/{diff-api.js → single-package-import-api.js} +5 -10
- package/commands/configuration-management/api/staging-package-api.js +39 -0
- package/commands/configuration-management/api/variable-api.js +36 -0
- package/commands/configuration-management/config-command.service.js +1 -63
- package/commands/configuration-management/connection-variable.helper.js +30 -0
- package/commands/configuration-management/interfaces/single-package-import.interfaces.js +12 -0
- package/commands/configuration-management/metadata.service.js +50 -0
- package/commands/configuration-management/module.js +58 -15
- package/commands/configuration-management/single-package-import.service.js +111 -0
- package/commands/configuration-management/staging-package.service.js +50 -0
- package/commands/configuration-management/variable.service.js +6 -7
- package/commands/t2tc/api/diff-api.js +40 -0
- package/commands/{configuration-management/api/batch-import-export-api.js → t2tc/api/t2tc-package-api.js} +3 -29
- package/commands/{configuration-management → t2tc}/diff.service.js +7 -7
- package/commands/t2tc/module.js +105 -0
- package/commands/{configuration-management → t2tc}/studio.service.js +2 -17
- package/commands/t2tc/t2tc-command.service.js +88 -0
- package/commands/{configuration-management/batch-import-export.service.js → t2tc/t2tc-package.service.js} +22 -50
- package/commands/view/module.js +54 -0
- package/commands/view/view-bookmarks-command.service.js +45 -0
- package/commands/view/view-bookmarks.manager-factory.js +39 -0
- package/commands/view/view-bookmarks.manager.js +60 -0
- package/core/utils/file-service.js +12 -0
- package/lib/commands/configuration-management/api/metadata-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/single-package-import-api.d.ts +8 -0
- package/lib/commands/configuration-management/api/staging-package-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/variable-api.d.ts +7 -0
- package/lib/commands/configuration-management/config-command.service.d.ts +0 -8
- package/lib/commands/configuration-management/connection-variable.helper.d.ts +2 -0
- package/lib/commands/configuration-management/interfaces/single-package-import.interfaces.d.ts +19 -0
- package/lib/commands/configuration-management/metadata.service.d.ts +7 -0
- package/lib/commands/configuration-management/module.d.ts +3 -1
- package/lib/commands/configuration-management/single-package-import.service.d.ts +12 -0
- package/lib/commands/configuration-management/staging-package.service.d.ts +7 -0
- package/lib/commands/configuration-management/variable.service.d.ts +1 -2
- package/lib/commands/t2tc/api/diff-api.d.ts +9 -0
- package/lib/commands/{configuration-management/api/batch-import-export-api.d.ts → t2tc/api/t2tc-package-api.d.ts} +3 -6
- package/lib/commands/{configuration-management → t2tc}/diff.service.d.ts +1 -1
- package/lib/commands/t2tc/module.d.ts +10 -0
- package/lib/commands/{configuration-management → t2tc}/studio.service.d.ts +1 -3
- package/lib/commands/t2tc/t2tc-command.service.d.ts +12 -0
- package/lib/commands/{configuration-management/batch-import-export.service.d.ts → t2tc/t2tc-package.service.d.ts} +3 -5
- package/lib/commands/view/module.d.ts +11 -0
- package/lib/commands/view/view-bookmarks-command.service.d.ts +7 -0
- package/lib/commands/view/view-bookmarks.manager-factory.d.ts +8 -0
- package/lib/commands/view/view-bookmarks.manager.d.ts +20 -0
- package/lib/core/utils/file-service.d.ts +1 -0
- package/package.json +1 -1
- package/lib/commands/configuration-management/api/diff-api.d.ts +0 -9
- /package/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.js +0 -0
- /package/lib/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.d.ts +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
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", "uuid", "../../core/utils/file-service", "../../core/utils/logger", "./api/staging-package-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.StagingPackageService = void 0;
|
|
22
|
+
const uuid_1 = require("uuid");
|
|
23
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
24
|
+
const logger_1 = require("../../core/utils/logger");
|
|
25
|
+
const staging_package_api_1 = require("./api/staging-package-api");
|
|
26
|
+
class StagingPackageService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.stagingPackageApi = new staging_package_api_1.StagingPackageApi(context);
|
|
29
|
+
}
|
|
30
|
+
listStagingPackages(flavors, includeBranches, jsonResponse) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const stagingPackages = yield this.stagingPackageApi.findAllStagingPackages(flavors, includeBranches);
|
|
33
|
+
if (jsonResponse) {
|
|
34
|
+
this.exportListOfPackages(stagingPackages);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
stagingPackages.forEach(pkg => {
|
|
38
|
+
logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exportListOfPackages(packages) {
|
|
44
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
45
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packages), filename);
|
|
46
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.StagingPackageService = StagingPackageService;
|
|
50
|
+
});
|
|
@@ -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", "../../core/utils/logger", "./
|
|
16
|
+
define(["require", "exports", "uuid", "../../core/utils/logger", "./connection-variable.helper", "../../core/utils/file-service", "./api/variable-api", "url", "./api/variable-assignment-candidates-api", "./api/staging-package-variables-api"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,18 +21,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.VariableService = void 0;
|
|
22
22
|
const uuid_1 = require("uuid");
|
|
23
23
|
const logger_1 = require("../../core/utils/logger");
|
|
24
|
-
const
|
|
24
|
+
const connection_variable_helper_1 = require("./connection-variable.helper");
|
|
25
25
|
const file_service_1 = require("../../core/utils/file-service");
|
|
26
|
-
const
|
|
26
|
+
const variable_api_1 = require("./api/variable-api");
|
|
27
27
|
const url_1 = require("url");
|
|
28
28
|
const variable_assignment_candidates_api_1 = require("./api/variable-assignment-candidates-api");
|
|
29
29
|
const staging_package_variables_api_1 = require("./api/staging-package-variables-api");
|
|
30
30
|
class VariableService {
|
|
31
31
|
constructor(context) {
|
|
32
|
-
this.
|
|
32
|
+
this.variableApi = new variable_api_1.VariableApi(context);
|
|
33
33
|
this.variableAssignmentCandidatesApi = new variable_assignment_candidates_api_1.VariableAssignmentCandidatesApi(context);
|
|
34
34
|
this.stagingPackageVariablesApi = new staging_package_variables_api_1.StagingPackageVariablesApi(context);
|
|
35
|
-
this.studioService = new studio_service_1.StudioService(context);
|
|
36
35
|
}
|
|
37
36
|
listVariables(keysByVersion, keysByVersionFile) {
|
|
38
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -86,8 +85,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
86
85
|
getVersionedVariablesByKeyVersionPairs(keysByVersion, keysByVersionFile) {
|
|
87
86
|
return __awaiter(this, void 0, void 0, function* () {
|
|
88
87
|
const variablesExportRequest = yield this.buildKeyVersionPairs(keysByVersion, keysByVersionFile);
|
|
89
|
-
const variableManifests = yield this.
|
|
90
|
-
return
|
|
88
|
+
const variableManifests = yield this.variableApi.findVariablesWithValuesByPackageKeysAndVersion(variablesExportRequest);
|
|
89
|
+
return (0, connection_variable_helper_1.fixConnectionVariables)(variableManifests);
|
|
91
90
|
});
|
|
92
91
|
}
|
|
93
92
|
buildKeyVersionPairs(keysByVersion, keysByVersionFile) {
|
|
@@ -0,0 +1,40 @@
|
|
|
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"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.DiffApi = void 0;
|
|
22
|
+
class DiffApi {
|
|
23
|
+
constructor(context) {
|
|
24
|
+
this.httpClient = () => context.httpClient;
|
|
25
|
+
}
|
|
26
|
+
diffPackages(baseVersion, data) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const paramString = baseVersion ? "?" + new URLSearchParams({ "baseVersion": baseVersion }).toString() : "";
|
|
29
|
+
return this.httpClient().postFile(`/package-manager/api/core/packages/diff/configuration${paramString}`, data);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
hasChanges(baseVersion, data) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const paramString = baseVersion ? "?" + new URLSearchParams({ "baseVersion": baseVersion }).toString() : "";
|
|
35
|
+
return this.httpClient().postFile(`/package-manager/api/core/packages/diff/configuration/has-changes${paramString}`, data);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.DiffApi = DiffApi;
|
|
40
|
+
});
|
|
@@ -18,9 +18,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
21
|
+
exports.T2tcPackageApi = void 0;
|
|
22
22
|
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
-
class
|
|
23
|
+
class T2tcPackageApi {
|
|
24
24
|
constructor(context) {
|
|
25
25
|
this.httpClient = () => context.httpClient;
|
|
26
26
|
}
|
|
@@ -35,16 +35,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
-
findAllStagingPackages(flavors, includeBranches = false) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const queryParams = new URLSearchParams();
|
|
41
|
-
queryParams.set("includeBranches", includeBranches.toString());
|
|
42
|
-
flavors.forEach(flavor => queryParams.append("flavors", flavor));
|
|
43
|
-
return this.httpClient().get(`/pacman/api/core/staging/packages/export/list?${queryParams.toString()}`).catch(e => {
|
|
44
|
-
throw new logger_1.FatalError(`Problem getting staging packages: ${e}`);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
38
|
findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches = false) {
|
|
49
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
40
|
const queryParams = new URLSearchParams();
|
|
@@ -99,27 +89,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
99
89
|
});
|
|
100
90
|
});
|
|
101
91
|
}
|
|
102
|
-
batchExportPackagesMetadata(packageKeys) {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const queryParams = new URLSearchParams();
|
|
105
|
-
packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
|
|
106
|
-
return this.httpClient().get(`/package-manager/api/core/packages/metadata/export?${queryParams.toString()}`).catch(e => {
|
|
107
|
-
throw new logger_1.FatalError(`Problem exporting packages metadata: ${e}`);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
92
|
importPackages(data, overwrite, performValidation) {
|
|
112
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
94
|
return this.httpClient().postFile("/package-manager/api/core/packages/import/batch", data, { overwrite, performValidation });
|
|
114
95
|
});
|
|
115
96
|
}
|
|
116
|
-
findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
return this.httpClient().post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
|
|
119
|
-
throw new logger_1.FatalError(`Problem exporting package variables: ${e}`);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
97
|
}
|
|
124
|
-
exports.
|
|
98
|
+
exports.T2tcPackageApi = T2tcPackageApi;
|
|
125
99
|
});
|
|
@@ -30,21 +30,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
30
30
|
constructor(context) {
|
|
31
31
|
this.diffApi = new diff_api_1.DiffApi(context);
|
|
32
32
|
}
|
|
33
|
-
diffPackages(file, hasChanges, jsonResponse) {
|
|
33
|
+
diffPackages(file, hasChanges, baseVersion, jsonResponse) {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
if (hasChanges) {
|
|
36
|
-
yield this.hasChanges(file, jsonResponse);
|
|
36
|
+
yield this.hasChanges(baseVersion, file, jsonResponse);
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
yield this.diffPackagesAndReturnDiff(file, jsonResponse);
|
|
39
|
+
yield this.diffPackagesAndReturnDiff(baseVersion, file, jsonResponse);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
hasChanges(file, jsonResponse) {
|
|
43
|
+
hasChanges(baseVersion, file, jsonResponse) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const packages = new AdmZip(file);
|
|
46
46
|
const formData = this.buildBodyForDiff(packages);
|
|
47
|
-
const returnedHasChangesData = yield this.diffApi.hasChanges(formData);
|
|
47
|
+
const returnedHasChangesData = yield this.diffApi.hasChanges(baseVersion, formData);
|
|
48
48
|
if (jsonResponse) {
|
|
49
49
|
this.exportListOfPackageDiffMetadata(returnedHasChangesData);
|
|
50
50
|
}
|
|
@@ -53,11 +53,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
diffPackagesAndReturnDiff(file, jsonResponse) {
|
|
56
|
+
diffPackagesAndReturnDiff(baseVersion, file, jsonResponse) {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
58
|
const packages = new AdmZip(file);
|
|
59
59
|
const formData = this.buildBodyForDiff(packages);
|
|
60
|
-
const returnedHasChangesData = yield this.diffApi.diffPackages(formData);
|
|
60
|
+
const returnedHasChangesData = yield this.diffApi.diffPackages(baseVersion, formData);
|
|
61
61
|
if (jsonResponse) {
|
|
62
62
|
this.exportListOfPackageDiffs(returnedHasChangesData);
|
|
63
63
|
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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", "./t2tc-command.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
const module_handler_1 = require("../../core/command/module-handler");
|
|
21
|
+
const t2tc_command_service_1 = require("./t2tc-command.service");
|
|
22
|
+
class Module extends module_handler_1.IModule {
|
|
23
|
+
register(context, configurator) {
|
|
24
|
+
const t2tcCommand = configurator.command("t2tc")
|
|
25
|
+
.description("Team-to-Team Copy (T2TC) commands for moving whole packages and their dependencies between teams using the batch transport archive format.");
|
|
26
|
+
const t2tcPackageCommand = t2tcCommand.command("package")
|
|
27
|
+
.description("Team-to-Team Copy package commands: list, export, import and diff packages using the batch transport archive.");
|
|
28
|
+
t2tcPackageCommand.command("list")
|
|
29
|
+
.description("List packages in the target team. Part of the Team-to-Team Copy export/import workflow.")
|
|
30
|
+
.option("--json", "Return response as json type", "")
|
|
31
|
+
.option("--flavors <flavors...>", "Lists only packages of the given flavors")
|
|
32
|
+
.option("--withDependencies", "Include dependencies", "")
|
|
33
|
+
.option("--packageKeys <packageKeys...>", "Lists only active versions of given package keys")
|
|
34
|
+
.option("--keysByVersion <keysByVersion...>", "Lists packages by given key and version [packageKey.version]")
|
|
35
|
+
.option("--variableValue <variableValue>", "Variable value for filtering packages by.")
|
|
36
|
+
.option("--variableType <variableType>", "Variable type for filtering packages by.")
|
|
37
|
+
.option("--branches", "Include branches", false)
|
|
38
|
+
.option("--staging", "List staging packages instead", false)
|
|
39
|
+
.action(this.listPackages);
|
|
40
|
+
t2tcPackageCommand.command("export")
|
|
41
|
+
.description("Export one or more packages into a Team-to-Team Copy archive. The archive is consumed by 't2tc package import' / 't2tc package diff'.")
|
|
42
|
+
.option("--packageKeys <packageKeys...>", "Keys of packages to export. Exports the latest deployed version only")
|
|
43
|
+
.option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
|
|
44
|
+
.option("--withDependencies", "Include variables and dependencies", "")
|
|
45
|
+
.option("--unzip", "Unzip the exported file", "")
|
|
46
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
47
|
+
.option("--gitBranch <gitBranch>", "Git branch in which you want to push the exported file")
|
|
48
|
+
.action(this.batchExportPackages);
|
|
49
|
+
t2tcPackageCommand.command("import")
|
|
50
|
+
.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'.")
|
|
51
|
+
.option("--overwrite", "Flag to allow overwriting of packages")
|
|
52
|
+
.option("--validate", "Validate node configurations before import", false)
|
|
53
|
+
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
54
|
+
.option("--gitBranch <gitBranch>", "Git branch from which you want to pull the exported file and import")
|
|
55
|
+
.option("-f, --file <file>", "Exported packages file (relative path)")
|
|
56
|
+
.option("-d, --directory <directory>", "Exported packages directory (relative path)")
|
|
57
|
+
.action(this.batchImportPackages);
|
|
58
|
+
t2tcPackageCommand.command("diff")
|
|
59
|
+
.description("Diff a local Team-to-Team Copy archive (from 't2tc package export') against deployed or staging packages.")
|
|
60
|
+
.option("--hasChanges", "Flag to return only the information if the package has changes without the actual changes")
|
|
61
|
+
.option("--baseVersion <version>", "Compare against a given version or STAGING")
|
|
62
|
+
.option("--json", "Return the response as a JSON file")
|
|
63
|
+
.requiredOption("-f, --file <file>", "Exported packages file (relative or absolute path)")
|
|
64
|
+
.action(this.diffPackages);
|
|
65
|
+
}
|
|
66
|
+
listPackages(context, command, options) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
if (options.staging && (options.withDependencies || options.packageKeys || options.keysByVersion || options.variableValue || options.variableType)) {
|
|
69
|
+
throw new Error("Staging parameter is not compatible with --withDependencies, --packageKeys, --keysByVersion, --variableValue, --variableType");
|
|
70
|
+
}
|
|
71
|
+
if (options.packageKeys && options.keysByVersion) {
|
|
72
|
+
throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
|
|
73
|
+
}
|
|
74
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).listPackages(options.json, options.flavors, options.withDependencies, options.packageKeys, options.keysByVersion, options.variableValue, options.variableType, options.branches, options.staging);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
batchExportPackages(context, command, options) {
|
|
78
|
+
var _a;
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
if ((options.packageKeys && options.keysByVersion) || (!options.packageKeys && !options.keysByVersion)) {
|
|
81
|
+
throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
|
|
82
|
+
}
|
|
83
|
+
if (options.gitProfile && !options.gitBranch) {
|
|
84
|
+
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
85
|
+
}
|
|
86
|
+
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);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
batchImportPackages(context, command, options) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
if (options.gitProfile && !options.gitBranch) {
|
|
93
|
+
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
94
|
+
}
|
|
95
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchImportPackages(options.file, options.directory, options.overwrite, options.gitBranch, options.validate);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
diffPackages(context, command, options) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).diffPackages(options.file, options.hasChanges, options.baseVersion, options.json);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return Module;
|
|
105
|
+
});
|
|
@@ -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", "adm-zip", "../studio/interfaces/package-manager.interfaces", "./
|
|
16
|
+
define(["require", "exports", "adm-zip", "../studio/interfaces/package-manager.interfaces", "./batch-export-import.constants", "../../core/utils/json", "../studio/api/package-api", "../studio/service/data-model.service", "../studio/api/node-api", "../studio/api/space-api", "../studio/api/studio-variables-api", "../studio/service/space.service", "../studio/service/studio-variable.service", "../../core/utils/branches"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.StudioService = void 0;
|
|
22
22
|
const AdmZip = require("adm-zip");
|
|
23
23
|
const package_manager_interfaces_1 = require("../studio/interfaces/package-manager.interfaces");
|
|
24
|
-
const batch_export_import_constants_1 = require("./
|
|
24
|
+
const batch_export_import_constants_1 = require("./batch-export-import.constants");
|
|
25
25
|
const json_1 = require("../../core/utils/json");
|
|
26
26
|
const package_api_1 = require("../studio/api/package-api");
|
|
27
27
|
const data_model_service_1 = require("../studio/service/data-model.service");
|
|
@@ -52,14 +52,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
52
52
|
return packagesToExport;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
fixConnectionVariables(variables) {
|
|
56
|
-
return variables.map(variableManifest => (Object.assign(Object.assign({}, variableManifest), { variables: variableManifest.variables.map(variable => {
|
|
57
|
-
if (variable.type !== package_manager_interfaces_1.PackageManagerVariableType.CONNECTION) {
|
|
58
|
-
return variable;
|
|
59
|
-
}
|
|
60
|
-
return this.fixConnectionVariable(variable);
|
|
61
|
-
}) })));
|
|
62
|
-
}
|
|
63
55
|
getStudioPackageManifests(studioPackageKeys) {
|
|
64
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
57
|
return Promise.all(studioPackageKeys.map((packageKey) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -116,13 +108,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
116
108
|
})) }) : pkg;
|
|
117
109
|
});
|
|
118
110
|
}
|
|
119
|
-
fixConnectionVariable(variable) {
|
|
120
|
-
var _a;
|
|
121
|
-
if (!((_a = variable.value) === null || _a === void 0 ? void 0 : _a.appName)) {
|
|
122
|
-
return variable;
|
|
123
|
-
}
|
|
124
|
-
return Object.assign(Object.assign({}, variable), { metadata: Object.assign(Object.assign({}, variable.metadata), { appName: variable.value.appName }) });
|
|
125
|
-
}
|
|
126
111
|
deleteScenarioAssets(packageZip) {
|
|
127
112
|
packageZip.getEntries().filter(entry => entry.entryName.startsWith(batch_export_import_constants_1.BatchExportImportConstants.NODES_FOLDER_NAME) && entry.entryName.endsWith(batch_export_import_constants_1.BatchExportImportConstants.JSON_EXTENSION))
|
|
128
113
|
.forEach(entry => {
|
|
@@ -0,0 +1,88 @@
|
|
|
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", "./t2tc-package.service", "./diff.service", "../configuration-management/staging-package.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.T2tcCommandService = void 0;
|
|
22
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
23
|
+
const t2tc_package_service_1 = require("./t2tc-package.service");
|
|
24
|
+
const diff_service_1 = require("./diff.service");
|
|
25
|
+
const staging_package_service_1 = require("../configuration-management/staging-package.service");
|
|
26
|
+
class T2tcCommandService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.t2tcPackageService = new t2tc_package_service_1.T2tcPackageService(context);
|
|
29
|
+
this.diffService = new diff_service_1.DiffService(context);
|
|
30
|
+
this.stagingPackageService = new staging_package_service_1.StagingPackageService(context);
|
|
31
|
+
}
|
|
32
|
+
listPackages(jsonResponse, flavors, withDependencies, packageKeys, keysByVersion, variableValue, variableType, includeBranches, staging) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (staging) {
|
|
35
|
+
yield this.stagingPackageService.listStagingPackages(flavors !== null && flavors !== void 0 ? flavors : [], includeBranches, jsonResponse);
|
|
36
|
+
}
|
|
37
|
+
else if (variableValue) {
|
|
38
|
+
yield this.listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType, includeBranches);
|
|
39
|
+
}
|
|
40
|
+
else if (jsonResponse) {
|
|
41
|
+
yield this.t2tcPackageService.findAndExportListOfPackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], keysByVersion !== null && keysByVersion !== void 0 ? keysByVersion : [], withDependencies, includeBranches);
|
|
42
|
+
}
|
|
43
|
+
else if (keysByVersion) {
|
|
44
|
+
yield this.t2tcPackageService.listPackagesByKeysWithVersion(keysByVersion, withDependencies);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
yield this.t2tcPackageService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], includeBranches);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
|
|
52
|
+
return this.t2tcPackageService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip);
|
|
53
|
+
}
|
|
54
|
+
batchImportPackages(file, directory, overwrite, gitBranch, performValidation = false) {
|
|
55
|
+
if ((directory || file) && gitBranch) {
|
|
56
|
+
throw new Error("You cannot use both file/directory and gitBranch options at the same time. Only one import source can be defined.");
|
|
57
|
+
}
|
|
58
|
+
if (!directory && !file && !gitBranch) {
|
|
59
|
+
throw new Error("You must provide either a file/directory or a gitBranch option to import packages.");
|
|
60
|
+
}
|
|
61
|
+
if (file && directory) {
|
|
62
|
+
throw new Error("You cannot use both file and directory options at the same time. Only one import source can be defined.");
|
|
63
|
+
}
|
|
64
|
+
if (file && file_service_1.fileService.isDirectory(file)) {
|
|
65
|
+
throw new Error("The file option accepts only zip files.");
|
|
66
|
+
}
|
|
67
|
+
if (directory && !file_service_1.fileService.isDirectory(directory)) {
|
|
68
|
+
throw new Error("The directory option accepts only directories.");
|
|
69
|
+
}
|
|
70
|
+
const sourcePath = file !== null && file !== void 0 ? file : directory;
|
|
71
|
+
return this.t2tcPackageService.batchImportPackages(sourcePath, overwrite, gitBranch, performValidation);
|
|
72
|
+
}
|
|
73
|
+
diffPackages(file, hasChanges, baseVersion, jsonResponse) {
|
|
74
|
+
return this.diffService.diffPackages(file, hasChanges, baseVersion, jsonResponse);
|
|
75
|
+
}
|
|
76
|
+
listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType, includeBranches) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
if (jsonResponse) {
|
|
79
|
+
yield this.t2tcPackageService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
yield this.t2tcPackageService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.T2tcCommandService = T2tcCommandService;
|
|
88
|
+
});
|