@celonis/content-cli 1.10.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/README.md +1 -1
- package/commands/asset-registry/asset-registry-api.js +14 -26
- package/commands/asset-registry/asset-registry-error.js +57 -0
- package/commands/asset-registry/asset-registry.service.js +38 -10
- package/commands/asset-registry/module.js +7 -6
- package/commands/configuration-management/api/metadata-api.js +38 -0
- package/commands/configuration-management/api/node-diff-api.js +15 -1
- 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 -61
- 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 +76 -19
- package/commands/configuration-management/node-diff.service.js +40 -17
- 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} +7 -21
- 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 +4 -18
- package/commands/t2tc/t2tc-command.service.js +88 -0
- package/commands/{configuration-management/batch-import-export.service.js → t2tc/t2tc-package.service.js} +26 -41
- 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/branches.js +23 -0
- package/core/utils/file-service.js +12 -0
- package/lib/commands/asset-registry/asset-registry-api.d.ts +2 -2
- package/lib/commands/asset-registry/asset-registry-error.d.ts +3 -0
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +13 -1
- package/lib/commands/asset-registry/asset-registry.service.d.ts +2 -1
- package/lib/commands/asset-registry/module.d.ts +1 -1
- package/lib/commands/configuration-management/api/metadata-api.d.ts +7 -0
- package/lib/commands/configuration-management/api/node-diff-api.d.ts +2 -1
- 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/node-diff.interfaces.d.ts +8 -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/node-diff.service.d.ts +3 -0
- 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} +5 -7
- 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} +7 -8
- 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/branches.d.ts +4 -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
package/README.md
CHANGED
|
@@ -168,5 +168,5 @@ For details on command development, refer to the [How to Add a Command](https://
|
|
|
168
168
|
|
|
169
169
|
Copyright (c) 2021 Celonis SE
|
|
170
170
|
|
|
171
|
-
This project is licensed under the MIT License -
|
|
171
|
+
This project is licensed under the MIT License -
|
|
172
172
|
see [LICENSE](https://github.com/celonis/content-cli/blob/main/LICENSE) file for details.
|
|
@@ -13,13 +13,13 @@ 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", "./asset-registry-error"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.AssetRegistryApi = void 0;
|
|
22
|
-
const
|
|
22
|
+
const asset_registry_error_1 = require("./asset-registry-error");
|
|
23
23
|
class AssetRegistryApi {
|
|
24
24
|
constructor(context) {
|
|
25
25
|
this.httpClient = () => context.httpClient;
|
|
@@ -28,54 +28,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
return this.httpClient()
|
|
30
30
|
.get("/pacman/api/core/asset-registry/types")
|
|
31
|
-
.catch((e) =>
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry types", e));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
listSkills() {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return this.httpClient()
|
|
37
|
+
.get("/pacman/api/core/asset-registry/skills")
|
|
38
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry skills", e));
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
41
|
getType(assetType) {
|
|
37
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
43
|
return this.httpClient()
|
|
39
44
|
.get(`/pacman/api/core/asset-registry/types/${encodeURIComponent(assetType)}`)
|
|
40
|
-
.catch((e) => {
|
|
41
|
-
throw new logger_1.FatalError(`Problem getting asset type '${assetType}': ${e}`);
|
|
42
|
-
});
|
|
45
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting asset type '${assetType}'`, e));
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
getSchema(assetType) {
|
|
46
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
50
|
return this.httpClient()
|
|
48
51
|
.get(`/pacman/api/core/asset-registry/schemas/${encodeURIComponent(assetType)}`)
|
|
49
|
-
.catch((e) => {
|
|
50
|
-
throw new logger_1.FatalError(`Problem getting schema for asset type '${assetType}': ${e}`);
|
|
51
|
-
});
|
|
52
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting schema for asset type '${assetType}'`, e));
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
getExamples(assetType) {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
return this.httpClient()
|
|
57
58
|
.get(`/pacman/api/core/asset-registry/examples/${encodeURIComponent(assetType)}`)
|
|
58
|
-
.catch((e) => {
|
|
59
|
-
throw new logger_1.FatalError(`Problem getting examples for asset type '${assetType}': ${e}`);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
getMethodology(assetType) {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
return this.httpClient()
|
|
66
|
-
.get(`/pacman/api/core/asset-registry/methodologies/${encodeURIComponent(assetType)}`)
|
|
67
|
-
.catch((e) => {
|
|
68
|
-
throw new logger_1.FatalError(`Problem getting methodology for asset type '${assetType}': ${e}`);
|
|
69
|
-
});
|
|
59
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting examples for asset type '${assetType}'`, e));
|
|
70
60
|
});
|
|
71
61
|
}
|
|
72
62
|
validate(assetType, body) {
|
|
73
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
64
|
return this.httpClient()
|
|
75
65
|
.post(`/pacman/api/core/asset-registry/validate/${encodeURIComponent(assetType)}`, body)
|
|
76
|
-
.catch((e) => {
|
|
77
|
-
throw new logger_1.FatalError(`Problem validating asset type '${assetType}': ${e}`);
|
|
78
|
-
});
|
|
66
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
|
|
79
67
|
});
|
|
80
68
|
}
|
|
81
69
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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", "../../core/utils/logger"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.handleAssetRegistryApiError = exports.ASSET_REGISTRY_DISABLED_USER_MESSAGE = exports.ASSET_REGISTRY_DISABLED_ERROR = void 0;
|
|
13
|
+
const logger_1 = require("../../core/utils/logger");
|
|
14
|
+
exports.ASSET_REGISTRY_DISABLED_ERROR = "Asset registry feature is currently disabled";
|
|
15
|
+
exports.ASSET_REGISTRY_DISABLED_USER_MESSAGE = "Asset registry is not enabled for this team. Contact your administrator to enable the feature.";
|
|
16
|
+
function extractErrorText(error) {
|
|
17
|
+
if (typeof error === "string") {
|
|
18
|
+
return error;
|
|
19
|
+
}
|
|
20
|
+
if (error instanceof Error) {
|
|
21
|
+
return error.message;
|
|
22
|
+
}
|
|
23
|
+
return String(error);
|
|
24
|
+
}
|
|
25
|
+
function parseErrorField(error) {
|
|
26
|
+
const payload = extractJsonPayload(extractErrorText(error));
|
|
27
|
+
if (!payload) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(payload);
|
|
32
|
+
return typeof parsed.error === "string" ? parsed.error : undefined;
|
|
33
|
+
}
|
|
34
|
+
catch (_a) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function extractJsonPayload(text) {
|
|
39
|
+
let candidate = text.trim();
|
|
40
|
+
const fatalErrorPrefix = "FatalError: ";
|
|
41
|
+
const fatalErrorIndex = candidate.lastIndexOf(fatalErrorPrefix);
|
|
42
|
+
if (fatalErrorIndex >= 0) {
|
|
43
|
+
candidate = candidate.slice(fatalErrorIndex + fatalErrorPrefix.length).trim();
|
|
44
|
+
}
|
|
45
|
+
if (!candidate.startsWith("{")) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return candidate;
|
|
49
|
+
}
|
|
50
|
+
function handleAssetRegistryApiError(operation, error) {
|
|
51
|
+
if (parseErrorField(error) === exports.ASSET_REGISTRY_DISABLED_ERROR) {
|
|
52
|
+
throw new logger_1.FatalError(exports.ASSET_REGISTRY_DISABLED_USER_MESSAGE);
|
|
53
|
+
}
|
|
54
|
+
throw new logger_1.FatalError(`Problem ${operation}: ${extractErrorText(error)}`);
|
|
55
|
+
}
|
|
56
|
+
exports.handleAssetRegistryApiError = handleAssetRegistryApiError;
|
|
57
|
+
});
|
|
@@ -48,6 +48,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
listSkills(jsonResponse) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const response = yield this.api.listSkills();
|
|
54
|
+
if (jsonResponse) {
|
|
55
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
56
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(response), filename);
|
|
57
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (response.skills.length === 0) {
|
|
61
|
+
logger_1.logger.info("No agent skills registered.");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
response.skills.forEach((skill) => {
|
|
65
|
+
this.logSkillSummary(skill);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
51
70
|
getType(assetType, jsonResponse) {
|
|
52
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
72
|
const descriptor = yield this.api.getType(assetType);
|
|
@@ -73,12 +92,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
73
92
|
this.outputResponse(data, jsonResponse);
|
|
74
93
|
});
|
|
75
94
|
}
|
|
76
|
-
getMethodology(assetType, jsonResponse) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const data = yield this.api.getMethodology(assetType);
|
|
79
|
-
this.outputResponse(data, jsonResponse);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
95
|
validate(opts) {
|
|
83
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
97
|
const payload = this.buildValidatePayload(opts);
|
|
@@ -138,7 +151,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
138
151
|
}
|
|
139
152
|
}
|
|
140
153
|
logDescriptorSummary(descriptor) {
|
|
141
|
-
|
|
154
|
+
const base = `${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}]`;
|
|
155
|
+
if (descriptor.description) {
|
|
156
|
+
logger_1.logger.info(`${base} - ${descriptor.description}`);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
logger_1.logger.info(base);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
logSkillSummary(skill) {
|
|
163
|
+
const base = `${skill.name} (${skill.path})`;
|
|
164
|
+
if (skill.description) {
|
|
165
|
+
logger_1.logger.info(`${base} - ${skill.description}`);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
logger_1.logger.info(base);
|
|
169
|
+
}
|
|
142
170
|
}
|
|
143
171
|
logDescriptorDetail(descriptor) {
|
|
144
172
|
logger_1.logger.info(`Asset Type: ${descriptor.assetType}`);
|
|
@@ -152,12 +180,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
152
180
|
logger_1.logger.info(`Endpoints:`);
|
|
153
181
|
logger_1.logger.info(` schema: ${descriptor.endpoints.schema}`);
|
|
154
182
|
logger_1.logger.info(` validate: ${descriptor.endpoints.validate}`);
|
|
155
|
-
if (descriptor.endpoints.methodology) {
|
|
156
|
-
logger_1.logger.info(` methodology: ${descriptor.endpoints.methodology}`);
|
|
157
|
-
}
|
|
158
183
|
if (descriptor.endpoints.examples) {
|
|
159
184
|
logger_1.logger.info(` examples: ${descriptor.endpoints.examples}`);
|
|
160
185
|
}
|
|
186
|
+
if (descriptor.endpoints.skills) {
|
|
187
|
+
logger_1.logger.info(` skills: ${descriptor.endpoints.skills}`);
|
|
188
|
+
}
|
|
161
189
|
}
|
|
162
190
|
}
|
|
163
191
|
exports.AssetRegistryService = AssetRegistryService;
|
|
@@ -51,11 +51,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
51
51
|
.option("-f, --file <file>", "Path to a JSON file containing a full ValidateRequest body. Mutually exclusive with the build-from-options flags.")
|
|
52
52
|
.option("--json", "Return the response as a JSON file")
|
|
53
53
|
.action(this.validate);
|
|
54
|
-
assetRegistryCommand.command("
|
|
55
|
-
.description("
|
|
56
|
-
|
|
54
|
+
const skillsCommand = assetRegistryCommand.command("skills")
|
|
55
|
+
.description("Discover agent skills exposed by the asset registry");
|
|
56
|
+
skillsCommand.command("list")
|
|
57
|
+
.description("List all available agent skills (name, description, path)")
|
|
57
58
|
.option("--json", "Return the response as a JSON file")
|
|
58
|
-
.action(this.
|
|
59
|
+
.action(this.listSkills);
|
|
59
60
|
}
|
|
60
61
|
listTypes(context, command, options) {
|
|
61
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,9 +90,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
89
90
|
yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
listSkills(context, command, options) {
|
|
93
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield new asset_registry_service_1.AssetRegistryService(context).
|
|
95
|
+
yield new asset_registry_service_1.AssetRegistryService(context).listSkills(!!options.json);
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
}
|
|
@@ -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
|
+
});
|
|
@@ -13,12 +13,13 @@ 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", "../../../core/utils/logger"], factory);
|
|
16
|
+
define(["require", "exports", "form-data", "../../../core/utils/logger"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.NodeDiffApi = void 0;
|
|
22
|
+
const FormData = require("form-data");
|
|
22
23
|
const logger_1 = require("../../../core/utils/logger");
|
|
23
24
|
class NodeDiffApi {
|
|
24
25
|
constructor(context) {
|
|
@@ -36,6 +37,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
39
|
}
|
|
40
|
+
diffWithFile(request) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const queryParams = new URLSearchParams();
|
|
43
|
+
queryParams.set("baseVersion", request.baseVersion);
|
|
44
|
+
const formData = new FormData();
|
|
45
|
+
formData.append("file", request.file);
|
|
46
|
+
return this.httpClient()
|
|
47
|
+
.postFile(`/pacman/api/core/packages/${request.packageKey}/nodes/${request.nodeKey}/diff/configuration/with-file?${queryParams.toString()}`, formData)
|
|
48
|
+
.catch(exception => {
|
|
49
|
+
throw new logger_1.FatalError(`Problem getting the node diff: ${exception}`);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
39
53
|
}
|
|
40
54
|
exports.NodeDiffApi = NodeDiffApi;
|
|
41
55
|
});
|
|
@@ -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,38 +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) {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
if (variableValue) {
|
|
35
|
-
yield this.listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
if (jsonResponse) {
|
|
39
|
-
yield this.batchImportExportService.findAndExportListOfPackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], keysByVersion !== null && keysByVersion !== void 0 ? keysByVersion : [], withDependencies);
|
|
40
|
-
}
|
|
41
|
-
else if (keysByVersion) {
|
|
42
|
-
yield this.batchImportExportService.listPackagesByKeysWithVersion(keysByVersion, withDependencies);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
yield this.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : []);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
26
|
}
|
|
49
27
|
listVariables(jsonResponse, keysByVersion, keysByVersionFile, packageKeys) {
|
|
50
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -64,44 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
64
42
|
}
|
|
65
43
|
});
|
|
66
44
|
}
|
|
67
|
-
batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
|
|
68
|
-
return this.batchImportExportService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip);
|
|
69
|
-
}
|
|
70
|
-
batchExportPackagesMetadata(packageKeys, jsonResponse) {
|
|
71
|
-
return this.batchImportExportService.batchExportPackagesMetadata(packageKeys, jsonResponse);
|
|
72
|
-
}
|
|
73
|
-
batchImportPackages(file, directory, overwrite, gitBranch, performValidation = false) {
|
|
74
|
-
if ((directory || file) && gitBranch) {
|
|
75
|
-
throw new Error("You cannot use both file/directory and gitBranch options at the same time. Only one import source can be defined.");
|
|
76
|
-
}
|
|
77
|
-
if (!directory && !file && !gitBranch) {
|
|
78
|
-
throw new Error("You must provide either a file/directory or a gitBranch option to import packages.");
|
|
79
|
-
}
|
|
80
|
-
if (file && directory) {
|
|
81
|
-
throw new Error("You cannot use both file and directory options at the same time. Only one import source can be defined.");
|
|
82
|
-
}
|
|
83
|
-
if (file && file_service_1.fileService.isDirectory(file)) {
|
|
84
|
-
throw new Error("The file option accepts only zip files.");
|
|
85
|
-
}
|
|
86
|
-
if (directory && !file_service_1.fileService.isDirectory(directory)) {
|
|
87
|
-
throw new Error("The directory option accepts only directories.");
|
|
88
|
-
}
|
|
89
|
-
const sourcePath = file !== null && file !== void 0 ? file : directory;
|
|
90
|
-
return this.batchImportExportService.batchImportPackages(sourcePath, overwrite, gitBranch, performValidation);
|
|
91
|
-
}
|
|
92
|
-
diffPackages(file, hasChanges, jsonResponse) {
|
|
93
|
-
return this.diffService.diffPackages(file, hasChanges, jsonResponse);
|
|
94
|
-
}
|
|
95
|
-
listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
if (jsonResponse) {
|
|
98
|
-
yield this.batchImportExportService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
yield this.batchImportExportService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
45
|
}
|
|
106
46
|
exports.ConfigCommandService = ConfigCommandService;
|
|
107
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
|
+
});
|