@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,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.MetadataApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
+
class MetadataApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
exportPackagesMetadata(packageKeys) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const queryParams = new URLSearchParams();
|
|
30
|
+
packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
|
|
31
|
+
return this.httpClient().get(`/package-manager/api/core/packages/metadata/export?${queryParams.toString()}`).catch(e => {
|
|
32
|
+
throw new logger_1.FatalError(`Problem exporting packages metadata: ${e}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.MetadataApi = MetadataApi;
|
|
38
|
+
});
|
|
@@ -18,21 +18,16 @@ 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.
|
|
22
|
-
class
|
|
21
|
+
exports.SinglePackageImportApi = void 0;
|
|
22
|
+
class SinglePackageImportApi {
|
|
23
23
|
constructor(context) {
|
|
24
24
|
this.httpClient = () => context.httpClient;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
importPackage(data, overwrite) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
return this.httpClient().postFile("/
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
hasChanges(data) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return this.httpClient().postFile("/package-manager/api/core/packages/diff/configuration/has-changes", data);
|
|
28
|
+
return this.httpClient().postFile("/pacman/api/core/staging/packages/import-file", data, { overwrite });
|
|
34
29
|
});
|
|
35
30
|
}
|
|
36
31
|
}
|
|
37
|
-
exports.
|
|
32
|
+
exports.SinglePackageImportApi = SinglePackageImportApi;
|
|
38
33
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
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.StagingPackageApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
+
class StagingPackageApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
findAllStagingPackages(flavors, includeBranches = false) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const queryParams = new URLSearchParams();
|
|
30
|
+
queryParams.set("includeBranches", includeBranches.toString());
|
|
31
|
+
flavors.forEach(flavor => queryParams.append("flavors", flavor));
|
|
32
|
+
return this.httpClient().get(`/pacman/api/core/staging/packages/export/list?${queryParams.toString()}`).catch(e => {
|
|
33
|
+
throw new logger_1.FatalError(`Problem getting staging packages: ${e}`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.StagingPackageApi = StagingPackageApi;
|
|
39
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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.VariableApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
+
class VariableApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient().post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
|
|
30
|
+
throw new logger_1.FatalError(`Problem exporting package variables: ${e}`);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.VariableApi = VariableApi;
|
|
36
|
+
});
|
|
@@ -13,40 +13,16 @@ 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", "./
|
|
16
|
+
define(["require", "exports", "./variable.service"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.ConfigCommandService = void 0;
|
|
22
|
-
const batch_import_export_service_1 = require("./batch-import-export.service");
|
|
23
22
|
const variable_service_1 = require("./variable.service");
|
|
24
|
-
const diff_service_1 = require("./diff.service");
|
|
25
|
-
const file_service_1 = require("../../core/utils/file-service");
|
|
26
23
|
class ConfigCommandService {
|
|
27
24
|
constructor(context) {
|
|
28
|
-
this.batchImportExportService = new batch_import_export_service_1.BatchImportExportService(context);
|
|
29
25
|
this.variableService = new variable_service_1.VariableService(context);
|
|
30
|
-
this.diffService = new diff_service_1.DiffService(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.batchImportExportService.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.batchImportExportService.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.batchImportExportService.listPackagesByKeysWithVersion(keysByVersion, withDependencies);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
yield this.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], includeBranches);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
26
|
}
|
|
51
27
|
listVariables(jsonResponse, keysByVersion, keysByVersionFile, packageKeys) {
|
|
52
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -66,44 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
66
42
|
}
|
|
67
43
|
});
|
|
68
44
|
}
|
|
69
|
-
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
|
|
70
|
-
return this.batchImportExportService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip);
|
|
71
|
-
}
|
|
72
|
-
batchExportPackagesMetadata(packageKeys, jsonResponse) {
|
|
73
|
-
return this.batchImportExportService.batchExportPackagesMetadata(packageKeys, jsonResponse);
|
|
74
|
-
}
|
|
75
|
-
batchImportPackages(file, directory, overwrite, gitBranch, performValidation = false) {
|
|
76
|
-
if ((directory || file) && gitBranch) {
|
|
77
|
-
throw new Error("You cannot use both file/directory and gitBranch options at the same time. Only one import source can be defined.");
|
|
78
|
-
}
|
|
79
|
-
if (!directory && !file && !gitBranch) {
|
|
80
|
-
throw new Error("You must provide either a file/directory or a gitBranch option to import packages.");
|
|
81
|
-
}
|
|
82
|
-
if (file && directory) {
|
|
83
|
-
throw new Error("You cannot use both file and directory options at the same time. Only one import source can be defined.");
|
|
84
|
-
}
|
|
85
|
-
if (file && file_service_1.fileService.isDirectory(file)) {
|
|
86
|
-
throw new Error("The file option accepts only zip files.");
|
|
87
|
-
}
|
|
88
|
-
if (directory && !file_service_1.fileService.isDirectory(directory)) {
|
|
89
|
-
throw new Error("The directory option accepts only directories.");
|
|
90
|
-
}
|
|
91
|
-
const sourcePath = file !== null && file !== void 0 ? file : directory;
|
|
92
|
-
return this.batchImportExportService.batchImportPackages(sourcePath, overwrite, gitBranch, performValidation);
|
|
93
|
-
}
|
|
94
|
-
diffPackages(file, hasChanges, jsonResponse) {
|
|
95
|
-
return this.diffService.diffPackages(file, hasChanges, jsonResponse);
|
|
96
|
-
}
|
|
97
|
-
listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType, includeBranches) {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
if (jsonResponse) {
|
|
100
|
-
yield this.batchImportExportService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
yield this.batchImportExportService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
45
|
}
|
|
108
46
|
exports.ConfigCommandService = ConfigCommandService;
|
|
109
47
|
});
|
|
@@ -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", "../studio/interfaces/package-manager.interfaces"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.fixConnectionVariables = void 0;
|
|
13
|
+
const package_manager_interfaces_1 = require("../studio/interfaces/package-manager.interfaces");
|
|
14
|
+
function fixConnectionVariables(variables) {
|
|
15
|
+
return variables.map(variableManifest => (Object.assign(Object.assign({}, variableManifest), { variables: variableManifest.variables.map(variable => {
|
|
16
|
+
if (variable.type !== package_manager_interfaces_1.PackageManagerVariableType.CONNECTION) {
|
|
17
|
+
return variable;
|
|
18
|
+
}
|
|
19
|
+
return fixConnectionVariable(variable);
|
|
20
|
+
}) })));
|
|
21
|
+
}
|
|
22
|
+
exports.fixConnectionVariables = fixConnectionVariables;
|
|
23
|
+
function fixConnectionVariable(variable) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (!((_a = variable.value) === null || _a === void 0 ? void 0 : _a.appName)) {
|
|
26
|
+
return variable;
|
|
27
|
+
}
|
|
28
|
+
return Object.assign(Object.assign({}, variable), { metadata: Object.assign(Object.assign({}, variable.metadata), { appName: variable.value.appName }) });
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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/metadata-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.MetadataService = 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 metadata_api_1 = require("./api/metadata-api");
|
|
26
|
+
class MetadataService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.metadataApi = new metadata_api_1.MetadataApi(context);
|
|
29
|
+
}
|
|
30
|
+
exportPackagesMetadata(packageKeys, jsonResponse) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const exportedPackagesMetadata = yield this.metadataApi.exportPackagesMetadata(packageKeys);
|
|
33
|
+
if (jsonResponse) {
|
|
34
|
+
this.exportListOfPackagesMetadata(exportedPackagesMetadata);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
exportedPackagesMetadata.forEach(pkg => {
|
|
38
|
+
logger_1.logger.info(`${pkg.key} - Has Unpublished Changes: ${pkg.hasUnpublishedChanges}`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exportListOfPackagesMetadata(packagesMetadata) {
|
|
44
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
45
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packagesMetadata), filename);
|
|
46
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.MetadataService = MetadataService;
|
|
50
|
+
});
|
|
@@ -16,23 +16,29 @@ 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", "./package-version-command.service", "./package-validation.service"], factory);
|
|
19
|
+
define(["require", "exports", "../../core/command/module-handler", "./config-command.service", "./staging-package.service", "./metadata.service", "../t2tc/t2tc-command.service", "./variable-command.service", "./node.service", "./node-diff.service", "./node-dependency.service", "./package-version-command.service", "./package-validation.service", "./single-package-import.service"], factory);
|
|
20
20
|
}
|
|
21
21
|
})(function (require, exports) {
|
|
22
22
|
"use strict";
|
|
23
23
|
const module_handler_1 = require("../../core/command/module-handler");
|
|
24
24
|
const config_command_service_1 = require("./config-command.service");
|
|
25
|
+
const staging_package_service_1 = require("./staging-package.service");
|
|
26
|
+
const metadata_service_1 = require("./metadata.service");
|
|
27
|
+
const t2tc_command_service_1 = require("../t2tc/t2tc-command.service");
|
|
25
28
|
const variable_command_service_1 = require("./variable-command.service");
|
|
26
29
|
const node_service_1 = require("./node.service");
|
|
27
30
|
const node_diff_service_1 = require("./node-diff.service");
|
|
28
31
|
const node_dependency_service_1 = require("./node-dependency.service");
|
|
29
32
|
const package_version_command_service_1 = require("./package-version-command.service");
|
|
30
33
|
const package_validation_service_1 = require("./package-validation.service");
|
|
34
|
+
const single_package_import_service_1 = require("./single-package-import.service");
|
|
31
35
|
class Module extends module_handler_1.IModule {
|
|
32
36
|
register(context, configurator) {
|
|
33
|
-
const configCommand = configurator.command("config")
|
|
37
|
+
const configCommand = configurator.command("config")
|
|
38
|
+
.description("Manage package configurations and their resources (package, nodes, versions, variables, metadata). Note: 'config list/export/import/diff' are deprecated — bulk Team-to-Team Copy operations have moved to the 't2tc package' group, and single-package operations live under 'config package'.");
|
|
34
39
|
configCommand.command("list")
|
|
35
|
-
.description("
|
|
40
|
+
.description("[Deprecated] Use 't2tc package list' instead. List packages in the target team.")
|
|
41
|
+
.deprecationNotice("'config list' is deprecated and will be removed in a future release. Use 't2tc package list' instead.")
|
|
36
42
|
.option("--json", "Return response as json type", "")
|
|
37
43
|
.option("--flavors <flavors...>", "Lists only packages of the given flavors")
|
|
38
44
|
.option("--withDependencies", "Include dependencies", "")
|
|
@@ -44,7 +50,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
50
|
.option("--staging", "List staging packages instead", false)
|
|
45
51
|
.action(this.listPackages);
|
|
46
52
|
configCommand.command("export")
|
|
47
|
-
.description("
|
|
53
|
+
.description("[Deprecated] Use 't2tc package export' instead. Export one or more packages into a Team-to-Team Copy archive.")
|
|
54
|
+
.deprecationNotice("'config export' is deprecated and will be removed in a future release. Use 't2tc package export' instead.")
|
|
48
55
|
.option("--packageKeys <packageKeys...>", "Keys of packages to export. Exports the latest deployed version only")
|
|
49
56
|
.option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
|
|
50
57
|
.option("--withDependencies", "Include variables and dependencies", "")
|
|
@@ -56,12 +63,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
56
63
|
.description("Commands related to package metadata");
|
|
57
64
|
metadataCommand
|
|
58
65
|
.command("export")
|
|
59
|
-
.description("
|
|
66
|
+
.description("Show whether multiple packages have unpublished changes (bulk metadata export).")
|
|
60
67
|
.requiredOption("--packageKeys <packageKeys...>", "Keys of packages to find the metadata of")
|
|
61
68
|
.option("--json", "Return response as json type", "")
|
|
62
|
-
.action(this.
|
|
69
|
+
.action(this.exportPackagesMetadata);
|
|
63
70
|
configCommand.command("import")
|
|
64
|
-
.description("
|
|
71
|
+
.description("[Deprecated] Use 't2tc package import' (batch) or 'config package import' (single package) instead. Import packages from a Team-to-Team Copy archive.")
|
|
72
|
+
.deprecationNotice("'config import' is deprecated and will be removed in a future release. Use 't2tc package import' (batch archive) or 'config package import' (single package) instead.")
|
|
65
73
|
.option("--overwrite", "Flag to allow overwriting of packages")
|
|
66
74
|
.option("--validate", "Validate node configurations before import", false)
|
|
67
75
|
.option("--gitProfile <gitProfile>", "Git profile which you want to use for the Git operations")
|
|
@@ -69,16 +77,40 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
69
77
|
.option("-f, --file <file>", "Exported packages file (relative path)")
|
|
70
78
|
.option("-d, --directory <directory>", "Exported packages directory (relative path)")
|
|
71
79
|
.action(this.batchImportPackages);
|
|
72
|
-
configCommand.command("
|
|
80
|
+
const packageCommand = configCommand.command("package")
|
|
81
|
+
.description("Commands for working with a single package.");
|
|
82
|
+
packageCommand.command("import")
|
|
83
|
+
.description("Import a package from a zip file or directory. Uses the package format, which is not interchangeable with the 't2tc package export' / 't2tc package import' batch archive.")
|
|
84
|
+
.option("-f, --file <file>", "Package zip file (relative path)")
|
|
85
|
+
.option("-d, --directory <directory>", "Package directory (relative path)")
|
|
86
|
+
.option("--overwrite", "Flag to allow overwriting an existing package with the same key")
|
|
87
|
+
.option("--json", "Return the response as a JSON file")
|
|
88
|
+
.action(this.importSinglePackage);
|
|
89
|
+
packageCommand.command("validate")
|
|
73
90
|
.description("Validate package node configurations")
|
|
74
91
|
.requiredOption("--packageKey <packageKey>", "Key of the package to validate")
|
|
75
92
|
.option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS). Defaults to SCHEMA.", ["SCHEMA"])
|
|
76
93
|
.option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
|
|
77
94
|
.option("--json", "Return the response as a JSON file")
|
|
78
95
|
.action(this.validatePackage);
|
|
96
|
+
packageCommand.command("list")
|
|
97
|
+
.description("List packages in the target team. Lists staging packages by default.")
|
|
98
|
+
.option("--json", "Return response as json type", "")
|
|
99
|
+
.option("--flavors <flavors...>", "Lists only packages of the given flavors")
|
|
100
|
+
.action(this.listStagingPackages);
|
|
101
|
+
configCommand.command("validate")
|
|
102
|
+
.description("[Deprecated] Use 'config package validate' instead. Validate package node configurations.")
|
|
103
|
+
.deprecationNotice("'config validate' is deprecated and will be removed in a future release. Use 'config package validate' instead.")
|
|
104
|
+
.requiredOption("--packageKey <packageKey>", "Key of the package to validate")
|
|
105
|
+
.option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS). Defaults to SCHEMA.", ["SCHEMA"])
|
|
106
|
+
.option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
|
|
107
|
+
.option("--json", "Return the response as a JSON file")
|
|
108
|
+
.action(this.validatePackage);
|
|
79
109
|
configCommand.command("diff")
|
|
80
|
-
.description("
|
|
110
|
+
.description("[Deprecated] Use 't2tc package diff' instead. Diff a local Team-to-Team Copy archive against deployed or staging packages.")
|
|
111
|
+
.deprecationNotice("'config diff' is deprecated and will be removed in a future release. Use 't2tc package diff' instead.")
|
|
81
112
|
.option("--hasChanges", "Flag to return only the information if the package has changes without the actual changes")
|
|
113
|
+
.option("--baseVersion <version>", "Compare against a given version or STAGING")
|
|
82
114
|
.option("--json", "Return the response as a JSON file")
|
|
83
115
|
.requiredOption("-f, --file <file>", "Exported packages file (relative or absolute path)")
|
|
84
116
|
.action(this.diffPackages);
|
|
@@ -184,7 +216,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
184
216
|
if (options.packageKeys && options.keysByVersion) {
|
|
185
217
|
throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
|
|
186
218
|
}
|
|
187
|
-
yield new
|
|
219
|
+
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);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
listStagingPackages(context, command, options) {
|
|
223
|
+
var _a;
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
yield new staging_package_service_1.StagingPackageService(context).listStagingPackages((_a = options.flavors) !== null && _a !== void 0 ? _a : [], false, options.json);
|
|
188
226
|
});
|
|
189
227
|
}
|
|
190
228
|
batchExportPackages(context, command, options) {
|
|
@@ -197,12 +235,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
197
235
|
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
198
236
|
}
|
|
199
237
|
options.withDependencies = (_a = options.withDependencies) !== null && _a !== void 0 ? _a : false;
|
|
200
|
-
yield new
|
|
238
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies, options.gitBranch, options.unzip);
|
|
201
239
|
});
|
|
202
240
|
}
|
|
203
|
-
|
|
241
|
+
exportPackagesMetadata(context, command, options) {
|
|
204
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
-
yield new
|
|
243
|
+
yield new metadata_service_1.MetadataService(context).exportPackagesMetadata(options.packageKeys, options.json);
|
|
206
244
|
});
|
|
207
245
|
}
|
|
208
246
|
getPackageVersion(context, command, options) {
|
|
@@ -228,12 +266,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
228
266
|
if (options.gitProfile && !options.gitBranch) {
|
|
229
267
|
throw new Error("Please specify a branch using --gitBranch when using a Git profile.");
|
|
230
268
|
}
|
|
231
|
-
yield new
|
|
269
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).batchImportPackages(options.file, options.directory, options.overwrite, options.gitBranch, options.validate);
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
importSinglePackage(context, command, options) {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
yield new single_package_import_service_1.SinglePackageImportService(context).importPackage(options.file, options.directory, options.overwrite, options.json);
|
|
232
275
|
});
|
|
233
276
|
}
|
|
234
277
|
diffPackages(context, command, options) {
|
|
235
278
|
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
-
yield new
|
|
279
|
+
yield new t2tc_command_service_1.T2tcCommandService(context).diffPackages(options.file, options.hasChanges, options.baseVersion, options.json);
|
|
237
280
|
});
|
|
238
281
|
}
|
|
239
282
|
validatePackage(context, command, options) {
|
|
@@ -0,0 +1,111 @@
|
|
|
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", "form-data", "node:stream", "adm-zip", "node:fs", "../../core/utils/file-service", "../../core/utils/logger", "./api/single-package-import-api"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SinglePackageImportService = void 0;
|
|
22
|
+
const uuid_1 = require("uuid");
|
|
23
|
+
const FormData = require("form-data");
|
|
24
|
+
const node_stream_1 = require("node:stream");
|
|
25
|
+
const AdmZip = require("adm-zip");
|
|
26
|
+
const fs = require("node:fs");
|
|
27
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
28
|
+
const logger_1 = require("../../core/utils/logger");
|
|
29
|
+
const single_package_import_api_1 = require("./api/single-package-import-api");
|
|
30
|
+
class SinglePackageImportService {
|
|
31
|
+
constructor(context) {
|
|
32
|
+
this.singlePackageImportApi = new single_package_import_api_1.SinglePackageImportApi(context);
|
|
33
|
+
}
|
|
34
|
+
importPackage(file, directory, overwrite, jsonResponse) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const resolvedSource = this.resolveSource(file, directory);
|
|
37
|
+
try {
|
|
38
|
+
const packageZip = new AdmZip(resolvedSource.zipPath);
|
|
39
|
+
const formData = this.buildBodyForImport(packageZip, resolvedSource.zipPath);
|
|
40
|
+
const result = yield this.singlePackageImportApi.importPackage(formData, overwrite);
|
|
41
|
+
this.outputResult(result, jsonResponse);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
if (resolvedSource.isTemporary) {
|
|
45
|
+
fs.rmSync(resolvedSource.zipPath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
resolveSource(file, directory) {
|
|
51
|
+
if (file && directory) {
|
|
52
|
+
throw new Error("You cannot use both --file and --directory options at the same time. Only one import source can be defined.");
|
|
53
|
+
}
|
|
54
|
+
if (!file && !directory) {
|
|
55
|
+
throw new Error("You must provide either a --file or a --directory option to import a package.");
|
|
56
|
+
}
|
|
57
|
+
if (file) {
|
|
58
|
+
if (file_service_1.fileService.isDirectory(file)) {
|
|
59
|
+
throw new Error("The --file option accepts only zip files.");
|
|
60
|
+
}
|
|
61
|
+
return { zipPath: file, isTemporary: false };
|
|
62
|
+
}
|
|
63
|
+
if (!file_service_1.fileService.isDirectory(directory)) {
|
|
64
|
+
throw new Error("The --directory option accepts only directories.");
|
|
65
|
+
}
|
|
66
|
+
return { zipPath: file_service_1.fileService.zipDirectoryAsSinglePackage(directory), isTemporary: true };
|
|
67
|
+
}
|
|
68
|
+
buildBodyForImport(packageZip, sourcePath) {
|
|
69
|
+
this.assertUncompressedSizeWithinLimit(packageZip, sourcePath);
|
|
70
|
+
const formData = new FormData();
|
|
71
|
+
formData.append("packageFile", this.getReadableStream(packageZip), { filename: "package.zip" });
|
|
72
|
+
return formData;
|
|
73
|
+
}
|
|
74
|
+
assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
|
|
75
|
+
const totalUncompressedBytes = packageZip.getEntries().reduce((sum, entry) => sum + entry.header.size, 0);
|
|
76
|
+
if (totalUncompressedBytes > SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE) {
|
|
77
|
+
throw new Error(`Failed to handle zip file "${sourcePath}": uncompressed size ${(totalUncompressedBytes / (Math.pow(1024, 3))).toFixed(2)} GB exceeds the 4 GB limit.`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
getReadableStream(packageZip) {
|
|
81
|
+
return new node_stream_1.Readable({
|
|
82
|
+
read() {
|
|
83
|
+
this.push(packageZip.toBuffer());
|
|
84
|
+
this.push(null);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
outputResult(result, jsonResponse) {
|
|
89
|
+
var _a;
|
|
90
|
+
if (jsonResponse) {
|
|
91
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
92
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(result, null, 2), filename);
|
|
93
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const importedPackage = result.importedPackage;
|
|
97
|
+
const importedNodes = (_a = result.importedNodes) !== null && _a !== void 0 ? _a : [];
|
|
98
|
+
logger_1.logger.info(`Successfully imported package: ${importedPackage.key}`);
|
|
99
|
+
logger_1.logger.info(`Name: ${importedPackage.name}`);
|
|
100
|
+
if (importedPackage.flavor) {
|
|
101
|
+
logger_1.logger.info(`Flavor: ${importedPackage.flavor}`);
|
|
102
|
+
}
|
|
103
|
+
logger_1.logger.info(`Imported ${importedNodes.length} node(s).`);
|
|
104
|
+
importedNodes.forEach(node => {
|
|
105
|
+
logger_1.logger.info(` - ${node.key} (${node.type})`);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.SinglePackageImportService = SinglePackageImportService;
|
|
110
|
+
SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE = 4 * 1024 * 1024 * 1024;
|
|
111
|
+
});
|