@celonis/content-cli 1.13.1 → 1.14.1
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 +17 -5
- package/commands/action-flows/action-flow/action-flow.service.js +9 -9
- package/commands/action-flows/module.js +2 -1
- package/commands/asset-registry/asset-registry-api.js +1 -30
- package/commands/asset-registry/asset-registry.service.js +20 -67
- package/commands/asset-registry/module.js +0 -26
- package/commands/bookmarks/bookmarks-api.js +49 -0
- package/commands/bookmarks/bookmarks-command.service.js +48 -0
- package/{core/utils/path.js → commands/bookmarks/bookmarks.interfaces.js} +0 -5
- package/commands/bookmarks/module.js +49 -0
- package/commands/configuration-management/api/node-api.js +17 -0
- package/commands/configuration-management/branch/api/branch.api.js +88 -0
- package/commands/configuration-management/branch/branch-export-import.command.service.js +283 -0
- package/commands/configuration-management/branch/branch.command.service.js +182 -0
- package/commands/configuration-management/branch/interfaces/branch.interfaces.js +41 -0
- package/commands/configuration-management/metadata.service.js +9 -5
- package/commands/configuration-management/module.js +170 -6
- package/commands/configuration-management/node-dependency.service.js +5 -3
- package/commands/configuration-management/node-diff.service.js +10 -6
- package/commands/configuration-management/node.service.js +14 -10
- package/commands/configuration-management/package-validation.service.js +11 -5
- package/commands/configuration-management/package-version.service.js +7 -5
- package/commands/configuration-management/single-package-export.service.js +6 -6
- package/commands/configuration-management/single-package-import.service.js +28 -24
- package/commands/configuration-management/staging-package.service.js +9 -5
- package/commands/configuration-management/variable.service.js +11 -7
- package/commands/data-pipeline/connection/connection.commands.js +4 -2
- package/commands/data-pipeline/data-pool/data-pool-service.js +13 -9
- package/commands/data-pipeline/data-pool/data-pool.commands.js +2 -1
- package/commands/deployment/deployment.service.js +15 -13
- package/commands/deployment/module.js +4 -7
- package/commands/studio/manager/space.manager.js +21 -10
- package/commands/studio/service/asset-service.js +5 -4
- package/commands/studio/service/package.service.js +9 -5
- package/commands/t2tc/diff.service.js +15 -9
- package/commands/t2tc/t2tc-package.service.js +25 -23
- package/content-cli.js +4 -0
- package/core/command/module-handler.js +8 -1
- package/core/feature-flag/feature-disabled-error.js +52 -0
- package/core/http/http-client.js +18 -0
- package/core/http/http-shared/base.manager.js +35 -59
- package/core/utils/branches.js +10 -0
- package/core/utils/cui-api.js +52 -0
- package/core/utils/cui-file-service.js +106 -0
- package/core/utils/file-service.js +7 -13
- package/lib/commands/action-flows/action-flow/action-flow.service.d.ts +1 -0
- package/lib/commands/asset-registry/asset-registry-api.d.ts +2 -6
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -17
- package/lib/commands/asset-registry/asset-registry.service.d.ts +3 -6
- package/lib/commands/asset-registry/module.d.ts +0 -2
- package/lib/commands/bookmarks/bookmarks-api.d.ts +8 -0
- package/lib/commands/bookmarks/bookmarks-command.service.d.ts +8 -0
- package/lib/commands/bookmarks/bookmarks.interfaces.d.ts +34 -0
- package/lib/commands/bookmarks/module.d.ts +8 -0
- package/lib/commands/configuration-management/api/node-api.d.ts +1 -0
- package/lib/commands/configuration-management/branch/api/branch.api.d.ts +12 -0
- package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +37 -0
- package/lib/commands/configuration-management/branch/branch.command.service.d.ts +19 -0
- package/lib/commands/configuration-management/branch/interfaces/branch.interfaces.d.ts +139 -0
- package/lib/commands/configuration-management/interfaces/package-validation.interfaces.d.ts +1 -1
- package/lib/commands/configuration-management/metadata.service.d.ts +1 -0
- package/lib/commands/configuration-management/module.d.ts +8 -0
- package/lib/commands/configuration-management/node-dependency.service.d.ts +1 -0
- package/lib/commands/configuration-management/node-diff.service.d.ts +1 -0
- package/lib/commands/configuration-management/node.service.d.ts +2 -1
- package/lib/commands/configuration-management/package-validation.service.d.ts +1 -0
- package/lib/commands/configuration-management/package-version.service.d.ts +1 -0
- package/lib/commands/configuration-management/single-package-export.service.d.ts +1 -0
- package/lib/commands/configuration-management/single-package-import.service.d.ts +6 -3
- package/lib/commands/configuration-management/staging-package.service.d.ts +1 -0
- package/lib/commands/configuration-management/variable.service.d.ts +1 -0
- package/lib/commands/data-pipeline/data-pool/data-pool-service.d.ts +1 -0
- package/lib/commands/deployment/deployment.service.d.ts +1 -0
- package/lib/commands/studio/service/asset-service.d.ts +1 -0
- package/lib/commands/studio/service/package.service.d.ts +1 -0
- package/lib/commands/t2tc/diff.service.d.ts +1 -0
- package/lib/commands/t2tc/t2tc-package.service.d.ts +1 -0
- package/lib/core/command/module-handler.d.ts +4 -4
- package/lib/core/feature-flag/feature-disabled-error.d.ts +16 -0
- package/lib/core/http/http-client.d.ts +4 -0
- package/lib/core/http/http-shared/base.manager.d.ts +7 -5
- package/lib/core/http/http-shared/manager-config.interface.d.ts +1 -1
- package/lib/core/utils/branches.d.ts +3 -0
- package/lib/core/utils/cui-api.d.ts +26 -0
- package/lib/core/utils/cui-file-service.d.ts +19 -0
- package/lib/core/utils/file-service.d.ts +0 -1
- package/package.json +3 -3
- package/lib/core/utils/path.d.ts +0 -1
package/README.md
CHANGED
|
@@ -9,11 +9,12 @@ teams and execute commands in a profile's context.
|
|
|
9
9
|
|
|
10
10
|
1. [Getting Started](#getting-started)
|
|
11
11
|
2. [About the Project](#about-the-project)
|
|
12
|
-
3. [
|
|
13
|
-
4. [
|
|
14
|
-
5. [
|
|
15
|
-
6. [
|
|
16
|
-
7. [
|
|
12
|
+
3. [Command Graph](#command-graph)
|
|
13
|
+
4. [Building the Project](#building-and-using-the-project-locally)
|
|
14
|
+
5. [Troubleshooting](#troubleshooting)
|
|
15
|
+
6. [Release Process](#release-process)
|
|
16
|
+
7. [Contributing](#contributing)
|
|
17
|
+
8. [License](#license)
|
|
17
18
|
|
|
18
19
|
## Getting Started
|
|
19
20
|
|
|
@@ -83,6 +84,17 @@ content-cli -h
|
|
|
83
84
|
content-cli pull package -h
|
|
84
85
|
```
|
|
85
86
|
|
|
87
|
+
## Command Graph
|
|
88
|
+
|
|
89
|
+
[**Open the interactive Command Graph**](https://raw.githack.com/celonis/content-cli/main/docs/command-graph.html) — a
|
|
90
|
+
searchable visualization of every Content CLI command, grouped by command area, with descriptions and options shown
|
|
91
|
+
on click. It's served live from the [`docs/command-graph.html`](./docs/command-graph.html) source file via
|
|
92
|
+
[raw.githack.com](https://raw.githack.com/), so it renders directly in your browser without needing to be downloaded.
|
|
93
|
+
|
|
94
|
+
> **Note for contributors:** this graph must be kept in sync manually. See
|
|
95
|
+
> [How to Add a Command](./docs/how-to-add-command.md#keeping-the-command-graph-up-to-date) for instructions on
|
|
96
|
+
> updating it whenever commands are added or changed.
|
|
97
|
+
|
|
86
98
|
## Building and Using the Project locally
|
|
87
99
|
|
|
88
100
|
This tool is tightly connected with the Celonis Platform and all capabilities require to have access to a Celonis Platform Team.
|
|
@@ -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", "../../../core/utils/file.constants"
|
|
16
|
+
define(["require", "exports", "uuid", "adm-zip", "form-data", "fs", "./action-flow-api", "../../../core/utils/file-service", "../../../core/utils/cui-file-service", "../../../core/utils/logger", "../../../core/utils/file.constants"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -25,12 +25,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
const fs = require("fs");
|
|
26
26
|
const action_flow_api_1 = require("./action-flow-api");
|
|
27
27
|
const file_service_1 = require("../../../core/utils/file-service");
|
|
28
|
+
const cui_file_service_1 = require("../../../core/utils/cui-file-service");
|
|
28
29
|
const logger_1 = require("../../../core/utils/logger");
|
|
29
30
|
const file_constants_1 = require("../../../core/utils/file.constants");
|
|
30
|
-
const node_path_1 = require("node:path");
|
|
31
31
|
class ActionFlowService {
|
|
32
32
|
constructor(context) {
|
|
33
33
|
this.actionFlowApi = new action_flow_api_1.ActionFlowApi(context);
|
|
34
|
+
this.cuiFileService = new cui_file_service_1.CuiFileService(context);
|
|
34
35
|
}
|
|
35
36
|
exportActionFlows(packageId, metadataFilePath) {
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -44,9 +45,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
45
|
this.attachMetadataFile(metadataFilePath, zip);
|
|
45
46
|
}
|
|
46
47
|
const fileName = "action-flows_export_" + (0, uuid_1.v4)() + ".zip";
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
|
|
48
|
+
const writtenFilename = yield this.cuiFileService.writeZipToFileWithGivenName(zip.toBuffer(), fileName);
|
|
49
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
analyzeActionFlows(packageId, outputToJsonFile) {
|
|
@@ -55,8 +55,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
55
55
|
const actionFlowsMetadataString = JSON.stringify(actionFlowsMetadata, null, 4);
|
|
56
56
|
if (outputToJsonFile) {
|
|
57
57
|
const metadataFileName = "action-flows_metadata_" + (0, uuid_1.v4)() + ".json";
|
|
58
|
-
|
|
59
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage +
|
|
58
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(actionFlowsMetadataString, metadataFileName);
|
|
59
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
logger_1.logger.info("Action flows analyze metadata: \n" + actionFlowsMetadataString);
|
|
@@ -70,8 +70,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
70
70
|
const eventLogString = JSON.stringify(eventLog, null, 4);
|
|
71
71
|
if (outputToJsonFile) {
|
|
72
72
|
const eventLogFileName = "action-flows_import_event_log_" + (0, uuid_1.v4)() + ".json";
|
|
73
|
-
|
|
74
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage +
|
|
73
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(eventLogString, eventLogFileName);
|
|
74
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
77
|
logger_1.logger.info("Action flows import event log: \n" + eventLogString);
|
|
@@ -25,7 +25,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
25
25
|
const skill_command_service_1 = require("./skill/skill-command.service");
|
|
26
26
|
class Module extends module_handler_1.IModule {
|
|
27
27
|
register(context, configurator) {
|
|
28
|
-
const analyzeCommand = configurator.command("analyze")
|
|
28
|
+
const analyzeCommand = configurator.command("analyze")
|
|
29
|
+
.description("Analyze action flows and return its dependencies");
|
|
29
30
|
analyzeCommand.command("action-flows")
|
|
30
31
|
.description("Analyze Action Flows dependencies for a certain package")
|
|
31
32
|
.requiredOption("--packageId <packageId>", "ID of the package from which you want to export Action Flows")
|
|
@@ -13,14 +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", "./asset-registry-error"
|
|
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
22
|
const asset_registry_error_1 = require("./asset-registry-error");
|
|
23
|
-
const path_1 = require("../../core/utils/path");
|
|
24
23
|
class AssetRegistryApi {
|
|
25
24
|
constructor(context) {
|
|
26
25
|
this.httpClient = () => context.httpClient;
|
|
@@ -32,13 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
31
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry types", e));
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
|
-
listSkills() {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
return this.httpClient()
|
|
38
|
-
.get(AssetRegistryApi.endpointUrl("skills"))
|
|
39
|
-
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry skills", e));
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
34
|
getType(assetType) {
|
|
43
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
36
|
return this.httpClient()
|
|
@@ -67,31 +59,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
67
59
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
|
|
68
60
|
});
|
|
69
61
|
}
|
|
70
|
-
getSkillFile(skillPath, filePath) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const operation = filePath
|
|
73
|
-
? `getting skill file '${filePath}' for '${skillPath}'`
|
|
74
|
-
: `getting SKILL.md for '${skillPath}'`;
|
|
75
|
-
const url = this.buildSkillFileUrl(skillPath, filePath);
|
|
76
|
-
return this.httpClient()
|
|
77
|
-
.getFile(url)
|
|
78
|
-
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(operation, e));
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
buildSkillFileUrl(skillPath, filePath) {
|
|
82
|
-
const segments = ["skills", encodePathSegments(skillPath)];
|
|
83
|
-
if (filePath) {
|
|
84
|
-
segments.push(encodePathSegments(filePath));
|
|
85
|
-
}
|
|
86
|
-
return AssetRegistryApi.endpointUrl(...segments);
|
|
87
|
-
}
|
|
88
62
|
static endpointUrl(...segments) {
|
|
89
63
|
return `${AssetRegistryApi.BASE_URL}/${segments.join("/")}`;
|
|
90
64
|
}
|
|
91
65
|
}
|
|
92
66
|
exports.AssetRegistryApi = AssetRegistryApi;
|
|
93
67
|
AssetRegistryApi.BASE_URL = "/pacman/api/core/asset-registry";
|
|
94
|
-
function encodePathSegments(value) {
|
|
95
|
-
return (0, path_1.trimSlashes)(value).split("/").map(encodeURIComponent).join("/");
|
|
96
|
-
}
|
|
97
68
|
});
|
|
@@ -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/
|
|
16
|
+
define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "uuid"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -21,13 +21,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
21
21
|
exports.AssetRegistryService = void 0;
|
|
22
22
|
const asset_registry_api_1 = require("./asset-registry-api");
|
|
23
23
|
const file_service_1 = require("../../core/utils/file-service");
|
|
24
|
+
const cui_file_service_1 = require("../../core/utils/cui-file-service");
|
|
24
25
|
const logger_1 = require("../../core/utils/logger");
|
|
25
|
-
const path_1 = require("../../core/utils/path");
|
|
26
26
|
const uuid_1 = require("uuid");
|
|
27
|
-
const path = require("node:path");
|
|
28
27
|
class AssetRegistryService {
|
|
29
28
|
constructor(context) {
|
|
30
29
|
this.api = new asset_registry_api_1.AssetRegistryApi(context);
|
|
30
|
+
this.cuiFileService = new cui_file_service_1.CuiFileService(context);
|
|
31
31
|
}
|
|
32
32
|
listTypes(jsonResponse) {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -35,8 +35,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
35
35
|
const descriptors = Object.values(metadata.types);
|
|
36
36
|
if (jsonResponse) {
|
|
37
37
|
const filename = (0, uuid_1.v4)() + ".json";
|
|
38
|
-
|
|
39
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage +
|
|
38
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(metadata), filename);
|
|
39
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
if (descriptors.length === 0) {
|
|
@@ -49,53 +49,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
getSkillFile(opts) {
|
|
53
|
-
var _a;
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const filename = this.resolveLocalFilename(opts.file);
|
|
56
|
-
const targetDir = (_a = opts.output) !== null && _a !== void 0 ? _a : ".";
|
|
57
|
-
const buffer = yield this.api.getSkillFile(opts.path, opts.file);
|
|
58
|
-
const absolutePath = file_service_1.fileService.writeBufferToPath(targetDir, filename, buffer);
|
|
59
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + absolutePath);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
resolveLocalFilename(file) {
|
|
63
|
-
if (!file) {
|
|
64
|
-
return "SKILL.md";
|
|
65
|
-
}
|
|
66
|
-
const trimmed = (0, path_1.trimSlashes)(file);
|
|
67
|
-
const base = trimmed ? path.basename(trimmed) : "";
|
|
68
|
-
if (!base) {
|
|
69
|
-
throw new logger_1.FatalError(`--file must point to a file, got '${file}'.`);
|
|
70
|
-
}
|
|
71
|
-
return base;
|
|
72
|
-
}
|
|
73
|
-
listSkills(jsonResponse) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
const response = yield this.api.listSkills();
|
|
76
|
-
if (jsonResponse) {
|
|
77
|
-
const filename = (0, uuid_1.v4)() + ".json";
|
|
78
|
-
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(response), filename);
|
|
79
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
if (response.skills.length === 0) {
|
|
83
|
-
logger_1.logger.info("No agent skills registered.");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
response.skills.forEach((skill) => {
|
|
87
|
-
this.logSkillSummary(skill);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
52
|
getType(assetType, jsonResponse) {
|
|
93
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
54
|
const descriptor = yield this.api.getType(assetType);
|
|
95
55
|
if (jsonResponse) {
|
|
96
56
|
const filename = (0, uuid_1.v4)() + ".json";
|
|
97
|
-
|
|
98
|
-
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage +
|
|
57
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(descriptor), filename);
|
|
58
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
99
59
|
}
|
|
100
60
|
else {
|
|
101
61
|
this.logDescriptorDetail(descriptor);
|
|
@@ -105,20 +65,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
105
65
|
getSchema(assetType, jsonResponse) {
|
|
106
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
67
|
const data = yield this.api.getSchema(assetType);
|
|
108
|
-
this.outputResponse(data, jsonResponse);
|
|
68
|
+
yield this.outputResponse(data, jsonResponse);
|
|
109
69
|
});
|
|
110
70
|
}
|
|
111
71
|
getExamples(assetType, jsonResponse) {
|
|
112
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
73
|
const data = yield this.api.getExamples(assetType);
|
|
114
|
-
this.outputResponse(data, jsonResponse);
|
|
74
|
+
yield this.outputResponse(data, jsonResponse);
|
|
115
75
|
});
|
|
116
76
|
}
|
|
117
77
|
validate(opts) {
|
|
118
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
79
|
const payload = this.buildValidatePayload(opts);
|
|
120
80
|
const data = yield this.api.validate(opts.assetType, payload);
|
|
121
|
-
this.outputResponse(data, opts.json);
|
|
81
|
+
yield this.outputResponse(data, opts.json);
|
|
122
82
|
});
|
|
123
83
|
}
|
|
124
84
|
buildValidatePayload(opts) {
|
|
@@ -163,14 +123,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
163
123
|
}
|
|
164
124
|
}
|
|
165
125
|
outputResponse(data, jsonResponse) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (jsonResponse) {
|
|
128
|
+
const filename = (0, uuid_1.v4)() + ".json";
|
|
129
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(data, null, 2), filename);
|
|
130
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
logger_1.logger.info(typeof data === "string" ? data : JSON.stringify(data, null, 2));
|
|
134
|
+
}
|
|
135
|
+
});
|
|
174
136
|
}
|
|
175
137
|
logDescriptorSummary(descriptor) {
|
|
176
138
|
const base = `${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}]`;
|
|
@@ -181,15 +143,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
181
143
|
logger_1.logger.info(base);
|
|
182
144
|
}
|
|
183
145
|
}
|
|
184
|
-
logSkillSummary(skill) {
|
|
185
|
-
const base = `${skill.name} (${skill.path})`;
|
|
186
|
-
if (skill.description) {
|
|
187
|
-
logger_1.logger.info(`${base} - ${skill.description}`);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
logger_1.logger.info(base);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
146
|
logDescriptorDetail(descriptor) {
|
|
194
147
|
logger_1.logger.info(`Asset Type: ${descriptor.assetType}`);
|
|
195
148
|
logger_1.logger.info(`Display Name: ${descriptor.displayName}`);
|
|
@@ -51,18 +51,6 @@ 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
|
-
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);
|
|
60
|
-
skillsCommand.command("get")
|
|
61
|
-
.description("Download a skill file (defaults to SKILL.md)")
|
|
62
|
-
.requiredOption("--path <path>", "Skill path from 'skills list' (e.g. platform/<skill> or asset/<assetType>/<skill>)")
|
|
63
|
-
.option("--file <file>", "Relative path of a reference file within the skill (defaults to SKILL.md)")
|
|
64
|
-
.option("--output <output>", "Destination directory (defaults to current working directory)")
|
|
65
|
-
.action(this.getSkillFile);
|
|
66
54
|
}
|
|
67
55
|
listTypes(context, command, options) {
|
|
68
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -96,20 +84,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
96
84
|
yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
|
|
97
85
|
});
|
|
98
86
|
}
|
|
99
|
-
listSkills(context, command, options) {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
yield new asset_registry_service_1.AssetRegistryService(context).listSkills(!!options.json);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
getSkillFile(context, command, options) {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
yield new asset_registry_service_1.AssetRegistryService(context).getSkillFile({
|
|
107
|
-
path: options.path,
|
|
108
|
-
file: options.file,
|
|
109
|
-
output: options.output,
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
87
|
}
|
|
114
88
|
return Module;
|
|
115
89
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
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.BookmarksApi = void 0;
|
|
22
|
+
const logger_1 = require("../../core/utils/logger");
|
|
23
|
+
class BookmarksApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
exportBookmarks(packageKey) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
return yield this.httpClient().get(`/package-manager/api/packages/${encodeURIComponent(packageKey)}/bookmarks/export`);
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
throw new logger_1.FatalError(`Problem exporting bookmarks for package ${packageKey}: ${e}`);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
importBookmarks(packageKey, payload) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
return yield this.httpClient().post(`/package-manager/api/packages/${encodeURIComponent(packageKey)}/bookmarks/import`, payload);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
throw new logger_1.FatalError(`Problem importing bookmarks for package ${packageKey}: ${e}`);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BookmarksApi = BookmarksApi;
|
|
49
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "./bookmarks-api", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.BookmarksCommandService = void 0;
|
|
22
|
+
const bookmarks_api_1 = require("./bookmarks-api");
|
|
23
|
+
const file_service_1 = require("../../core/utils/file-service");
|
|
24
|
+
const cui_file_service_1 = require("../../core/utils/cui-file-service");
|
|
25
|
+
const logger_1 = require("../../core/utils/logger");
|
|
26
|
+
class BookmarksCommandService {
|
|
27
|
+
constructor(context) {
|
|
28
|
+
this.bookmarksApi = new bookmarks_api_1.BookmarksApi(context);
|
|
29
|
+
this.cuiFileService = new cui_file_service_1.CuiFileService(context);
|
|
30
|
+
}
|
|
31
|
+
exportBookmarks(packageKey, file) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const exportData = yield this.bookmarksApi.exportBookmarks(packageKey);
|
|
34
|
+
const fileName = file !== null && file !== void 0 ? file : `bookmarks-${packageKey}.json`;
|
|
35
|
+
const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(exportData, null, 4), fileName);
|
|
36
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
importBookmarks(packageKey, file) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const payload = file_service_1.fileService.readFileToJson(file);
|
|
42
|
+
const result = yield this.bookmarksApi.importBookmarks(packageKey, payload);
|
|
43
|
+
logger_1.logger.info(`Bookmarks imported successfully: ${JSON.stringify(result, null, 4)}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.BookmarksCommandService = BookmarksCommandService;
|
|
48
|
+
});
|
|
@@ -9,9 +9,4 @@
|
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.trimSlashes = void 0;
|
|
13
|
-
function trimSlashes(value) {
|
|
14
|
-
return value.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
15
|
-
}
|
|
16
|
-
exports.trimSlashes = trimSlashes;
|
|
17
12
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../../core/command/module-handler", "./bookmarks-command.service"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
const module_handler_1 = require("../../core/command/module-handler");
|
|
21
|
+
const bookmarks_command_service_1 = require("./bookmarks-command.service");
|
|
22
|
+
class Module extends module_handler_1.IModule {
|
|
23
|
+
register(context, configurator) {
|
|
24
|
+
const exportCommand = configurator.command("export");
|
|
25
|
+
exportCommand.command("bookmarks")
|
|
26
|
+
.description("Export bookmarks for a package")
|
|
27
|
+
.requiredOption("--packageKey <packageKey>", "Key of the package to export bookmarks from")
|
|
28
|
+
.option("-f, --file <file>", "Output file path (defaults to bookmarks-<packageKey>.json)")
|
|
29
|
+
.action(this.exportBookmarks);
|
|
30
|
+
const importCommand = configurator.command("import");
|
|
31
|
+
importCommand.command("bookmarks")
|
|
32
|
+
.description("Import bookmarks into a package")
|
|
33
|
+
.requiredOption("--packageKey <packageKey>", "Key of the package to import bookmarks into")
|
|
34
|
+
.requiredOption("-f, --file <file>", "Bookmarks JSON file to import")
|
|
35
|
+
.action(this.importBookmarks);
|
|
36
|
+
}
|
|
37
|
+
exportBookmarks(context, _command, options) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
yield new bookmarks_command_service_1.BookmarksCommandService(context).exportBookmarks(options.packageKey, options.file);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
importBookmarks(context, _command, options) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
yield new bookmarks_command_service_1.BookmarksCommandService(context).importBookmarks(options.packageKey, options.file);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return Module;
|
|
49
|
+
});
|
|
@@ -78,6 +78,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
findStagingNodesByPackage(packageKey, withConfiguration, limit, offset) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const queryParams = new URLSearchParams();
|
|
84
|
+
queryParams.set("withConfiguration", withConfiguration.toString());
|
|
85
|
+
if (limit) {
|
|
86
|
+
queryParams.set("limit", limit.toString());
|
|
87
|
+
}
|
|
88
|
+
if (offset) {
|
|
89
|
+
queryParams.set("offset", offset.toString());
|
|
90
|
+
}
|
|
91
|
+
return this.httpClient()
|
|
92
|
+
.get(`/pacman/api/core/staging/packages/${packageKey}/nodes?${queryParams.toString()}`)
|
|
93
|
+
.catch(e => {
|
|
94
|
+
throw new logger_1.FatalError(`Problem fetching nodes from package ${packageKey}: ${e}`);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
81
98
|
findVersionedNodesByPackage(packageKey, version, withConfiguration, limit, offset) {
|
|
82
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
100
|
const queryParams = new URLSearchParams();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
(function (factory) {
|
|
11
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
12
|
+
var v = factory(require, exports);
|
|
13
|
+
if (v !== undefined) module.exports = v;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof define === "function" && define.amd) {
|
|
16
|
+
define(["require", "exports", "../../../../core/utils/logger"], factory);
|
|
17
|
+
}
|
|
18
|
+
})(function (require, exports) {
|
|
19
|
+
"use strict";
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.BranchApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../../core/utils/logger");
|
|
23
|
+
class BranchApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
configureBranchingSettings(packageKey, transport) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient()
|
|
30
|
+
.put(`/pacman/api/core/packages/${packageKey}/branch-settings`, transport)
|
|
31
|
+
.catch(e => {
|
|
32
|
+
throw new logger_1.FatalError(`Problem updating branch settings for package ${packageKey}: ${e}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
createBranch(packageKey, transport, validate = false) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const params = new URLSearchParams();
|
|
39
|
+
if (validate) {
|
|
40
|
+
params.set("validate", "true");
|
|
41
|
+
}
|
|
42
|
+
const query = params.toString().length ? `?${params.toString()}` : "";
|
|
43
|
+
return this.httpClient()
|
|
44
|
+
.post(`/pacman/api/core/packages/${packageKey}/branches${query}`, transport)
|
|
45
|
+
.catch(e => {
|
|
46
|
+
throw new logger_1.FatalError(`Problem creating branch '${transport.branchKey}' from package ${packageKey}: ${e}`);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
listBranches(packageKey) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return this.httpClient()
|
|
53
|
+
.get(`/pacman/api/core/packages/${packageKey}/branches`)
|
|
54
|
+
.catch(e => {
|
|
55
|
+
throw new logger_1.FatalError(`Problem listing branches for package ${packageKey}: ${e}`);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
mergePreview(packageKey, transport) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return this.httpClient()
|
|
62
|
+
.post(`/pacman/api/core/staging/packages/${packageKey}/merge/preview`, transport)
|
|
63
|
+
.catch(e => {
|
|
64
|
+
throw new logger_1.FatalError(`Problem previewing merge into package ${packageKey} from ${transport.sourceKey}@${transport.sourceVersion}: ${e}`);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
merge(packageKey, transport) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
return this.httpClient()
|
|
71
|
+
.post(`/pacman/api/core/staging/packages/${packageKey}/merge`, transport)
|
|
72
|
+
.catch(e => {
|
|
73
|
+
throw new logger_1.FatalError(`Problem merging into package ${packageKey} from ${transport.sourceKey}@${transport.sourceVersion}: ${e}`);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
deleteBranch(branchPackageKey) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return this.httpClient()
|
|
80
|
+
.delete(`/pacman/api/core/staging/packages/${branchPackageKey}/purge`)
|
|
81
|
+
.catch(e => {
|
|
82
|
+
throw new logger_1.FatalError(`Problem deleting branch ${branchPackageKey}: ${e}`);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.BranchApi = BranchApi;
|
|
88
|
+
});
|