@celonis/content-cli 1.9.1 → 1.11.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/action-flows/action-flow/action-flow.service.js +5 -4
- package/commands/asset-registry/asset-registry-api.js +16 -19
- package/commands/asset-registry/asset-registry-error.js +57 -0
- package/commands/asset-registry/asset-registry.service.js +86 -8
- package/commands/asset-registry/module.js +27 -5
- package/commands/configuration-management/api/batch-import-export-api.js +14 -2
- package/commands/configuration-management/api/node-api.js +31 -0
- package/commands/configuration-management/api/node-diff-api.js +15 -1
- package/commands/configuration-management/batch-import-export.service.js +30 -13
- package/commands/configuration-management/config-command.service.js +12 -10
- package/commands/configuration-management/module.js +57 -5
- package/commands/configuration-management/node-diff.service.js +40 -17
- package/commands/configuration-management/node.service.js +54 -0
- package/commands/configuration-management/studio.service.js +3 -2
- package/commands/studio/manager/widget.manager-factory.js +3 -2
- package/core/git-profile/git/git.service.js +4 -3
- package/core/git-profile/git-profile.service.js +5 -3
- package/core/http/http-shared/base.manager.js +4 -2
- package/core/profile/profile.service.js +5 -3
- package/core/utils/branches.js +23 -0
- package/core/utils/file-service.js +25 -8
- package/core/utils/file.constants.js +18 -0
- package/core/utils/logger.js +3 -2
- package/lib/commands/asset-registry/asset-registry-api.d.ts +3 -2
- package/lib/commands/asset-registry/asset-registry-error.d.ts +3 -0
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +21 -1
- package/lib/commands/asset-registry/asset-registry.service.d.ts +7 -1
- package/lib/commands/asset-registry/module.d.ts +2 -1
- package/lib/commands/configuration-management/api/batch-import-export-api.d.ts +3 -2
- package/lib/commands/configuration-management/api/node-api.d.ts +4 -1
- package/lib/commands/configuration-management/api/node-diff-api.d.ts +2 -1
- package/lib/commands/configuration-management/batch-import-export.service.d.ts +5 -4
- package/lib/commands/configuration-management/config-command.service.d.ts +1 -1
- package/lib/commands/configuration-management/interfaces/node-diff.interfaces.d.ts +8 -0
- package/lib/commands/configuration-management/interfaces/node.interfaces.d.ts +20 -0
- package/lib/commands/configuration-management/module.d.ts +3 -0
- package/lib/commands/configuration-management/node-diff.service.d.ts +3 -0
- package/lib/commands/configuration-management/node.service.d.ts +4 -0
- package/lib/core/utils/branches.d.ts +4 -0
- package/lib/core/utils/file-service.d.ts +1 -0
- package/lib/core/utils/file.constants.d.ts +4 -0
- package/package.json +1 -1
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,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", "adm-zip", "form-data", "fs", "./action-flow-api", "../../../core/utils/file-service", "../../../core/utils/logger"], factory);
|
|
16
|
+
define(["require", "exports", "uuid", "adm-zip", "form-data", "fs", "./action-flow-api", "../../../core/utils/file-service", "../../../core/utils/logger", "../../../core/utils/file.constants"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -26,6 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
26
26
|
const action_flow_api_1 = require("./action-flow-api");
|
|
27
27
|
const file_service_1 = require("../../../core/utils/file-service");
|
|
28
28
|
const logger_1 = require("../../../core/utils/logger");
|
|
29
|
+
const file_constants_1 = require("../../../core/utils/file.constants");
|
|
29
30
|
class ActionFlowService {
|
|
30
31
|
constructor(context) {
|
|
31
32
|
this.actionFlowApi = new action_flow_api_1.ActionFlowApi(context);
|
|
@@ -36,13 +37,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
36
37
|
const tmpZip = new AdmZip(exportedActionFlowsData);
|
|
37
38
|
const zip = new AdmZip();
|
|
38
39
|
tmpZip.getEntries().forEach(entry => {
|
|
39
|
-
zip.addFile(entry.entryName, entry.getData());
|
|
40
|
+
zip.addFile(entry.entryName, entry.getData(), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
40
41
|
});
|
|
41
42
|
if (metadataFilePath) {
|
|
42
43
|
this.attachMetadataFile(metadataFilePath, zip);
|
|
43
44
|
}
|
|
44
45
|
const fileName = "action-flows_export_" + (0, uuid_1.v4)() + ".zip";
|
|
45
|
-
zip.writeZip(fileName);
|
|
46
|
+
zip.writeZip(fileName, () => fs.chmodSync(fileName, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
|
|
46
47
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
|
|
47
48
|
});
|
|
48
49
|
}
|
|
@@ -84,7 +85,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
84
85
|
attachMetadataFile(fileName, zip) {
|
|
85
86
|
fileName = fileName + (fileName.endsWith(".json") ? "" : ".json");
|
|
86
87
|
const metadata = file_service_1.fileService.readFile(fileName);
|
|
87
|
-
zip.addFile(ActionFlowService.METADATA_FILE_NAME, Buffer.from(metadata));
|
|
88
|
+
zip.addFile(ActionFlowService.METADATA_FILE_NAME, Buffer.from(metadata), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
exports.ActionFlowService = ActionFlowService;
|
|
@@ -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,45 +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
|
-
});
|
|
59
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting examples for asset type '${assetType}'`, e));
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
|
-
|
|
62
|
+
validate(assetType, body) {
|
|
64
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
64
|
return this.httpClient()
|
|
66
|
-
.
|
|
67
|
-
.catch((e) => {
|
|
68
|
-
throw new logger_1.FatalError(`Problem getting methodology for asset type '${assetType}': ${e}`);
|
|
69
|
-
});
|
|
65
|
+
.post(`/pacman/api/core/asset-registry/validate/${encodeURIComponent(assetType)}`, body)
|
|
66
|
+
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
|
|
70
67
|
});
|
|
71
68
|
}
|
|
72
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
|
+
});
|
|
@@ -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", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
|
|
16
|
+
define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid", "fs"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -23,6 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
23
|
const file_service_1 = require("../../core/utils/file-service");
|
|
24
24
|
const logger_1 = require("../../core/utils/logger");
|
|
25
25
|
const uuid_1 = require("uuid");
|
|
26
|
+
const fs = require("fs");
|
|
26
27
|
class AssetRegistryService {
|
|
27
28
|
constructor(context) {
|
|
28
29
|
this.api = new asset_registry_api_1.AssetRegistryApi(context);
|
|
@@ -47,6 +48,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
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
|
+
}
|
|
50
70
|
getType(assetType, jsonResponse) {
|
|
51
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
72
|
const descriptor = yield this.api.getType(assetType);
|
|
@@ -72,12 +92,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
72
92
|
this.outputResponse(data, jsonResponse);
|
|
73
93
|
});
|
|
74
94
|
}
|
|
75
|
-
|
|
95
|
+
validate(opts) {
|
|
76
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const
|
|
78
|
-
this.
|
|
97
|
+
const payload = this.buildValidatePayload(opts);
|
|
98
|
+
const data = yield this.api.validate(opts.assetType, payload);
|
|
99
|
+
this.outputResponse(data, opts.json);
|
|
79
100
|
});
|
|
80
101
|
}
|
|
102
|
+
buildValidatePayload(opts) {
|
|
103
|
+
const hasNodeKey = !!opts.nodeKey;
|
|
104
|
+
const hasConfig = !!opts.configuration;
|
|
105
|
+
const hasFile = !!opts.file;
|
|
106
|
+
if (hasFile && (hasNodeKey || hasConfig || !!opts.packageKey)) {
|
|
107
|
+
throw new logger_1.FatalError("Option -f is mutually exclusive with --packageKey, --nodeKey and --configuration.");
|
|
108
|
+
}
|
|
109
|
+
if (hasFile) {
|
|
110
|
+
return this.parseJson(fs.readFileSync(opts.file, "utf-8"), `-f ${opts.file}`);
|
|
111
|
+
}
|
|
112
|
+
if (hasNodeKey && hasConfig) {
|
|
113
|
+
throw new logger_1.FatalError("Options --nodeKey and --configuration are mutually exclusive. Use --nodeKey to validate a stored node, or --configuration to validate a configuration. For full control, use -f.");
|
|
114
|
+
}
|
|
115
|
+
if (!hasNodeKey && !hasConfig) {
|
|
116
|
+
throw new logger_1.FatalError("Provide --packageKey with one of --nodeKey (validate a stored node) or --configuration (validate a configuration), or use -f for a full request file.");
|
|
117
|
+
}
|
|
118
|
+
if (!opts.packageKey) {
|
|
119
|
+
throw new logger_1.FatalError("--packageKey is required when using --nodeKey or --configuration.");
|
|
120
|
+
}
|
|
121
|
+
if (hasNodeKey) {
|
|
122
|
+
return {
|
|
123
|
+
assetType: opts.assetType,
|
|
124
|
+
packageKey: opts.packageKey,
|
|
125
|
+
nodeKeys: [opts.nodeKey],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const configJson = this.parseJson(opts.configuration, "--configuration");
|
|
129
|
+
return {
|
|
130
|
+
assetType: opts.assetType,
|
|
131
|
+
packageKey: opts.packageKey,
|
|
132
|
+
nodes: [{ key: AssetRegistryService.INLINE_VALIDATION_NODE_KEY, configuration: configJson }],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
parseJson(raw, source) {
|
|
136
|
+
try {
|
|
137
|
+
return JSON.parse(raw);
|
|
138
|
+
}
|
|
139
|
+
catch (_a) {
|
|
140
|
+
throw new logger_1.FatalError(`Invalid JSON in ${source}.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
81
143
|
outputResponse(data, jsonResponse) {
|
|
82
144
|
if (jsonResponse) {
|
|
83
145
|
const filename = (0, uuid_1.v4)() + ".json";
|
|
@@ -89,7 +151,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
89
151
|
}
|
|
90
152
|
}
|
|
91
153
|
logDescriptorSummary(descriptor) {
|
|
92
|
-
|
|
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
|
+
}
|
|
93
170
|
}
|
|
94
171
|
logDescriptorDetail(descriptor) {
|
|
95
172
|
logger_1.logger.info(`Asset Type: ${descriptor.assetType}`);
|
|
@@ -103,13 +180,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
103
180
|
logger_1.logger.info(`Endpoints:`);
|
|
104
181
|
logger_1.logger.info(` schema: ${descriptor.endpoints.schema}`);
|
|
105
182
|
logger_1.logger.info(` validate: ${descriptor.endpoints.validate}`);
|
|
106
|
-
if (descriptor.endpoints.methodology) {
|
|
107
|
-
logger_1.logger.info(` methodology: ${descriptor.endpoints.methodology}`);
|
|
108
|
-
}
|
|
109
183
|
if (descriptor.endpoints.examples) {
|
|
110
184
|
logger_1.logger.info(` examples: ${descriptor.endpoints.examples}`);
|
|
111
185
|
}
|
|
186
|
+
if (descriptor.endpoints.skills) {
|
|
187
|
+
logger_1.logger.info(` skills: ${descriptor.endpoints.skills}`);
|
|
188
|
+
}
|
|
112
189
|
}
|
|
113
190
|
}
|
|
114
191
|
exports.AssetRegistryService = AssetRegistryService;
|
|
192
|
+
AssetRegistryService.INLINE_VALIDATION_NODE_KEY = "validation-node";
|
|
115
193
|
});
|
|
@@ -42,11 +42,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
42
42
|
.requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
|
|
43
43
|
.option("--json", "Return the response as a JSON file")
|
|
44
44
|
.action(this.getExamples);
|
|
45
|
-
assetRegistryCommand.command("
|
|
46
|
-
.description("
|
|
45
|
+
assetRegistryCommand.command("validate")
|
|
46
|
+
.description("Validate asset configuration against the asset service's validate endpoint.")
|
|
47
47
|
.requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
|
|
48
|
+
.option("--packageKey <packageKey>", "Package key. Required when validating with --nodeKey or --configuration.")
|
|
49
|
+
.option("--nodeKey <nodeKey>", "Key of an already-stored node to validate (use with --packageKey).")
|
|
50
|
+
.option("--configuration <configuration>", "Inline JSON of a configuration to validate (use with --packageKey).")
|
|
51
|
+
.option("-f, --file <file>", "Path to a JSON file containing a full ValidateRequest body. Mutually exclusive with the build-from-options flags.")
|
|
48
52
|
.option("--json", "Return the response as a JSON file")
|
|
49
|
-
.action(this.
|
|
53
|
+
.action(this.validate);
|
|
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)")
|
|
58
|
+
.option("--json", "Return the response as a JSON file")
|
|
59
|
+
.action(this.listSkills);
|
|
50
60
|
}
|
|
51
61
|
listTypes(context, command, options) {
|
|
52
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -63,14 +73,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
63
73
|
yield new asset_registry_service_1.AssetRegistryService(context).getSchema(options.assetType, !!options.json);
|
|
64
74
|
});
|
|
65
75
|
}
|
|
76
|
+
validate(context, command, options) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
yield new asset_registry_service_1.AssetRegistryService(context).validate({
|
|
79
|
+
assetType: options.assetType,
|
|
80
|
+
packageKey: options.packageKey,
|
|
81
|
+
nodeKey: options.nodeKey,
|
|
82
|
+
configuration: options.configuration,
|
|
83
|
+
file: options.file,
|
|
84
|
+
json: !!options.json,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
66
88
|
getExamples(context, command, options) {
|
|
67
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
90
|
yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
|
|
69
91
|
});
|
|
70
92
|
}
|
|
71
|
-
|
|
93
|
+
listSkills(context, command, options) {
|
|
72
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
yield new asset_registry_service_1.AssetRegistryService(context).
|
|
95
|
+
yield new asset_registry_service_1.AssetRegistryService(context).listSkills(!!options.json);
|
|
74
96
|
});
|
|
75
97
|
}
|
|
76
98
|
}
|
|
@@ -24,23 +24,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
constructor(context) {
|
|
25
25
|
this.httpClient = () => context.httpClient;
|
|
26
26
|
}
|
|
27
|
-
findAllActivePackages(flavors, withDependencies = false) {
|
|
27
|
+
findAllActivePackages(flavors, withDependencies = false, includeBranches = false) {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
const queryParams = new URLSearchParams();
|
|
30
30
|
queryParams.set("withDependencies", withDependencies.toString());
|
|
31
|
+
queryParams.set("includeBranches", includeBranches.toString());
|
|
31
32
|
flavors.forEach(flavor => queryParams.append("flavors", flavor));
|
|
32
33
|
return this.httpClient().get(`/package-manager/api/core/packages/export/list?${queryParams.toString()}`).catch(e => {
|
|
33
34
|
throw new logger_1.FatalError(`Problem getting active packages: ${e}`);
|
|
34
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
|
+
findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches = false) {
|
|
38
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
50
|
const queryParams = new URLSearchParams();
|
|
40
51
|
queryParams.set("variableValue", variableValue);
|
|
41
52
|
if (variableType) {
|
|
42
53
|
queryParams.set("variableType", variableType);
|
|
43
54
|
}
|
|
55
|
+
queryParams.set("includeBranches", includeBranches.toString());
|
|
44
56
|
flavors.forEach(flavor => queryParams.append("flavors", flavor));
|
|
45
57
|
return this.httpClient().get(`/package-manager/api/core/packages/export/list-by-variable-value?${queryParams.toString()}`).catch(e => {
|
|
46
58
|
throw new logger_1.FatalError(`Problem getting active packages by variable value: ${e}`);
|
|
@@ -47,6 +47,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
createStagingNode(packageKey, transport, validateOnly) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const suffix = validateOnly ? "?validate=true" : "";
|
|
53
|
+
return this.httpClient()
|
|
54
|
+
.post(`/pacman/api/core/staging/packages/${packageKey}/nodes${suffix}`, transport)
|
|
55
|
+
.catch((e) => {
|
|
56
|
+
throw new logger_1.FatalError(`Problem creating node in package ${packageKey}: ${e}`);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
updateStagingNode(packageKey, nodeKey, transport, validateOnly) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const suffix = validateOnly ? "?validate=true" : "";
|
|
63
|
+
return this.httpClient()
|
|
64
|
+
.put(`/pacman/api/core/staging/packages/${packageKey}/nodes/${nodeKey}${suffix}`, transport)
|
|
65
|
+
.catch((e) => {
|
|
66
|
+
throw new logger_1.FatalError(`Problem updating node ${nodeKey} in package ${packageKey}: ${e}`);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
archiveStagingNode(packageKey, nodeKey, force) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const queryParams = new URLSearchParams();
|
|
73
|
+
queryParams.set("force", force.toString());
|
|
74
|
+
return this.httpClient()
|
|
75
|
+
.delete(`/pacman/api/core/staging/packages/${packageKey}/nodes/${nodeKey}/archive?${queryParams.toString()}`)
|
|
76
|
+
.catch((e) => {
|
|
77
|
+
throw new logger_1.FatalError(`Problem archiving node ${nodeKey} in package ${packageKey}: ${e}`);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
50
81
|
findVersionedNodesByPackage(packageKey, version, withConfiguration, limit, offset) {
|
|
51
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
83
|
const queryParams = new URLSearchParams();
|
|
@@ -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
|
});
|
|
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
if (v !== undefined) module.exports = v;
|
|
14
14
|
}
|
|
15
15
|
else if (typeof define === "function" && define.amd) {
|
|
16
|
-
define(["require", "exports", "uuid", "form-data", "stream", "adm-zip", "./interfaces/batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/batch-import-export-api", "./studio.service", "../../core/git-profile/git/git.service", "fs"], factory);
|
|
16
|
+
define(["require", "exports", "uuid", "form-data", "stream", "adm-zip", "./interfaces/batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/batch-import-export-api", "./studio.service", "../../core/git-profile/git/git.service", "fs", "../../core/utils/file.constants"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -32,6 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
const studio_service_1 = require("./studio.service");
|
|
33
33
|
const git_service_1 = require("../../core/git-profile/git/git.service");
|
|
34
34
|
const fs = require("fs");
|
|
35
|
+
const file_constants_1 = require("../../core/utils/file.constants");
|
|
35
36
|
class BatchImportExportService {
|
|
36
37
|
constructor(context) {
|
|
37
38
|
this.batchImportExportApi = new batch_import_export_api_1.BatchImportExportApi(context);
|
|
@@ -39,15 +40,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
39
40
|
this.studioService = new studio_service_1.StudioService(context);
|
|
40
41
|
this.gitService = new git_service_1.GitService(context);
|
|
41
42
|
}
|
|
42
|
-
listActivePackages(flavors) {
|
|
43
|
+
listActivePackages(flavors, includeBranches) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const activePackages = yield this.batchImportExportApi.findAllActivePackages(flavors);
|
|
45
|
+
const activePackages = yield this.batchImportExportApi.findAllActivePackages(flavors, false, includeBranches);
|
|
45
46
|
activePackages.forEach(pkg => {
|
|
46
47
|
logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
|
|
47
48
|
});
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
listStagingPackages(flavors, includeBranches, jsonResponse) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
const stagingPackages = yield this.batchImportExportApi.findAllStagingPackages(flavors, includeBranches);
|
|
54
|
+
if (jsonResponse) {
|
|
55
|
+
this.exportListOfPackages(stagingPackages);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
stagingPackages.forEach(pkg => {
|
|
59
|
+
logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
findAndExportListOfPackages(flavors, packageKeys, keysByVersion, withDependencies, includeBranches) {
|
|
51
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
66
|
let packagesToExport;
|
|
53
67
|
if (keysByVersion.length) {
|
|
@@ -57,7 +71,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
57
71
|
packagesToExport = yield this.batchImportExportApi.findActivePackagesByKeys(packageKeys, withDependencies);
|
|
58
72
|
}
|
|
59
73
|
else {
|
|
60
|
-
packagesToExport = yield this.batchImportExportApi.findAllActivePackages(flavors, withDependencies);
|
|
74
|
+
packagesToExport = yield this.batchImportExportApi.findAllActivePackages(flavors, withDependencies, includeBranches);
|
|
61
75
|
}
|
|
62
76
|
packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, withDependencies);
|
|
63
77
|
this.exportListOfPackages(packagesToExport);
|
|
@@ -85,11 +99,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
85
99
|
const versionsByPackageKey = this.getVersionsByPackageKey(manifest);
|
|
86
100
|
let exportedVariables = yield this.getVersionedVariablesForPackagesWithKeys(versionsByPackageKey);
|
|
87
101
|
exportedVariables = this.studioService.fixConnectionVariables(exportedVariables);
|
|
88
|
-
exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME, Buffer.from((0, json_1.stringify)(exportedVariables), "utf8"));
|
|
102
|
+
exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME, Buffer.from((0, json_1.stringify)(exportedVariables), "utf8"), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
89
103
|
const studioPackageKeys = manifest.filter(packageManifest => packageManifest.flavor === batch_export_import_constants_1.BatchExportImportConstants.STUDIO)
|
|
90
104
|
.map(packageManifest => packageManifest.packageKey);
|
|
91
105
|
const studioData = yield this.studioService.getStudioPackageManifests(studioPackageKeys);
|
|
92
|
-
exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.STUDIO_FILE_NAME, Buffer.from((0, json_1.stringify)(studioData), "utf8"));
|
|
106
|
+
exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.STUDIO_FILE_NAME, Buffer.from((0, json_1.stringify)(studioData), "utf8"), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
|
|
93
107
|
exportedPackagesZip.getEntries().forEach(entry => {
|
|
94
108
|
if (entry.name.endsWith(batch_export_import_constants_1.BatchExportImportConstants.ZIP_EXTENSION)) {
|
|
95
109
|
const lastUnderscoreIndex = entry.name.lastIndexOf("_");
|
|
@@ -127,8 +141,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
127
141
|
batchImportPackages(sourcePath, overwrite, gitBranch, performValidation = false) {
|
|
128
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
129
143
|
let sourceToBeImported;
|
|
144
|
+
let temporaryGitFolder;
|
|
130
145
|
if (gitBranch) {
|
|
131
146
|
sourceToBeImported = yield this.gitService.pullFromBranch(gitBranch);
|
|
147
|
+
temporaryGitFolder = sourceToBeImported;
|
|
132
148
|
}
|
|
133
149
|
else {
|
|
134
150
|
sourceToBeImported = sourcePath;
|
|
@@ -145,23 +161,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
145
161
|
const postPackageImportData = yield this.batchImportExportApi.importPackages(formData, overwrite, performValidation);
|
|
146
162
|
yield this.studioService.processImportedPackages(configs, existingStudioPackages, studioManifests);
|
|
147
163
|
if (gitBranch) {
|
|
148
|
-
fs.rmSync(
|
|
164
|
+
fs.rmSync(temporaryGitFolder, { recursive: true });
|
|
149
165
|
}
|
|
166
|
+
fs.rmSync(sourceToBeImported);
|
|
150
167
|
const reportFileName = "config_import_report_" + (0, uuid_1.v4)() + ".json";
|
|
151
168
|
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(postPackageImportData), reportFileName);
|
|
152
169
|
logger_1.logger.info("Config import report file: " + reportFileName);
|
|
153
170
|
});
|
|
154
171
|
}
|
|
155
|
-
findAndExportListOfActivePackagesByVariableValue(flavors, variableValue, variableType) {
|
|
172
|
+
findAndExportListOfActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches) {
|
|
156
173
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
let packagesToExport = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
|
|
174
|
+
let packagesToExport = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
|
|
158
175
|
packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, false);
|
|
159
176
|
this.exportListOfPackages(packagesToExport);
|
|
160
177
|
});
|
|
161
178
|
}
|
|
162
|
-
listActivePackagesByVariableValue(flavors, variableValue, variableType) {
|
|
179
|
+
listActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches) {
|
|
163
180
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
const packagesByVariableValue = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType);
|
|
181
|
+
const packagesByVariableValue = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
|
|
165
182
|
packagesByVariableValue.forEach(pkg => {
|
|
166
183
|
logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
|
|
167
184
|
});
|
|
@@ -240,7 +257,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
240
257
|
else {
|
|
241
258
|
const fileDownloadedMessage = "File downloaded successfully. New filename: ";
|
|
242
259
|
const filename = `export_${(0, uuid_1.v4)()}.zip`;
|
|
243
|
-
exportedZip.writeZip(filename);
|
|
260
|
+
exportedZip.writeZip(filename, () => fs.chmodSync(filename, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
|
|
244
261
|
logger_1.logger.info(fileDownloadedMessage + filename);
|
|
245
262
|
}
|
|
246
263
|
}
|