@celonis/content-cli 1.12.0 → 1.14.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 +17 -5
- package/commands/action-flows/action-flow/action-flow.service.js +4 -2
- package/commands/action-flows/module.js +2 -1
- package/commands/asset-registry/asset-registry-api.js +9 -12
- package/commands/asset-registry/asset-registry.service.js +2 -31
- package/commands/asset-registry/module.js +0 -11
- package/commands/bookmarks/bookmarks-api.js +49 -0
- package/commands/bookmarks/bookmarks-command.service.js +46 -0
- package/commands/bookmarks/bookmarks.interfaces.js +12 -0
- package/commands/bookmarks/module.js +49 -0
- package/commands/configuration-management/api/single-package-export-api.js +38 -0
- package/commands/configuration-management/branch/api/branch.api.js +88 -0
- package/commands/configuration-management/branch/branch-export-import.command.service.js +276 -0
- package/commands/configuration-management/branch/branch.command.service.js +178 -0
- package/commands/configuration-management/branch/interfaces/branch.interfaces.js +41 -0
- package/commands/configuration-management/module.js +189 -5
- package/commands/configuration-management/single-package-export.service.js +64 -0
- package/commands/configuration-management/single-package-import.service.js +37 -17
- package/commands/configuration-management/variable.service.js +12 -14
- package/commands/data-pipeline/connection/connection.commands.js +4 -2
- package/commands/data-pipeline/data-pool/data-pool.commands.js +2 -1
- package/commands/deployment/module.js +4 -7
- package/commands/studio/manager/package.manager.js +1 -1
- package/commands/studio/module.js +8 -4
- package/commands/t2tc/module.js +1 -1
- package/commands/t2tc/t2tc-package.service.js +5 -3
- package/content-cli.js +65 -35
- package/core/command/module-handler.js +13 -1
- package/core/feature-flag/feature-disabled-error.js +52 -0
- package/core/utils/branches.js +10 -0
- package/core/utils/file-service.js +27 -17
- package/lib/commands/asset-registry/asset-registry-api.d.ts +4 -3
- package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -12
- package/lib/commands/asset-registry/asset-registry.service.d.ts +1 -3
- package/lib/commands/asset-registry/module.d.ts +0 -1
- package/lib/commands/bookmarks/bookmarks-api.d.ts +8 -0
- package/lib/commands/bookmarks/bookmarks-command.service.d.ts +7 -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/single-package-export-api.d.ts +7 -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 +36 -0
- package/lib/commands/configuration-management/branch/branch.command.service.d.ts +18 -0
- package/lib/commands/configuration-management/branch/interfaces/branch.interfaces.d.ts +139 -0
- package/lib/commands/configuration-management/module.d.ts +9 -0
- package/lib/commands/configuration-management/single-package-export.service.d.ts +8 -0
- package/lib/commands/configuration-management/single-package-import.service.d.ts +7 -4
- package/lib/content-cli.d.ts +15 -1
- 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/utils/branches.d.ts +3 -0
- package/lib/core/utils/file-service.d.ts +6 -1
- package/package.json +5 -5
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"], 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", "node:path"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -27,6 +27,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
27
|
const file_service_1 = require("../../../core/utils/file-service");
|
|
28
28
|
const logger_1 = require("../../../core/utils/logger");
|
|
29
29
|
const file_constants_1 = require("../../../core/utils/file.constants");
|
|
30
|
+
const node_path_1 = require("node:path");
|
|
30
31
|
class ActionFlowService {
|
|
31
32
|
constructor(context) {
|
|
32
33
|
this.actionFlowApi = new action_flow_api_1.ActionFlowApi(context);
|
|
@@ -43,7 +44,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
44
|
this.attachMetadataFile(metadataFilePath, zip);
|
|
44
45
|
}
|
|
45
46
|
const fileName = "action-flows_export_" + (0, uuid_1.v4)() + ".zip";
|
|
46
|
-
|
|
47
|
+
const fullFilePath = (0, node_path_1.resolve)(process.cwd(), fileName);
|
|
48
|
+
zip.writeZip(fullFilePath, () => fs.chmodSync(fullFilePath, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
|
|
47
49
|
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
|
|
48
50
|
});
|
|
49
51
|
}
|
|
@@ -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")
|
|
@@ -27,45 +27,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
27
|
listTypes() {
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
return this.httpClient()
|
|
30
|
-
.get("
|
|
30
|
+
.get(AssetRegistryApi.endpointUrl("types"))
|
|
31
31
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry types", e));
|
|
32
32
|
});
|
|
33
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));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
34
|
getType(assetType) {
|
|
42
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
36
|
return this.httpClient()
|
|
44
|
-
.get(
|
|
37
|
+
.get(AssetRegistryApi.endpointUrl("types", encodeURIComponent(assetType)))
|
|
45
38
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting asset type '${assetType}'`, e));
|
|
46
39
|
});
|
|
47
40
|
}
|
|
48
41
|
getSchema(assetType) {
|
|
49
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
43
|
return this.httpClient()
|
|
51
|
-
.get(
|
|
44
|
+
.get(AssetRegistryApi.endpointUrl("schemas", encodeURIComponent(assetType)))
|
|
52
45
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting schema for asset type '${assetType}'`, e));
|
|
53
46
|
});
|
|
54
47
|
}
|
|
55
48
|
getExamples(assetType) {
|
|
56
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
50
|
return this.httpClient()
|
|
58
|
-
.get(
|
|
51
|
+
.get(AssetRegistryApi.endpointUrl("examples", encodeURIComponent(assetType)))
|
|
59
52
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting examples for asset type '${assetType}'`, e));
|
|
60
53
|
});
|
|
61
54
|
}
|
|
62
55
|
validate(assetType, body) {
|
|
63
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
57
|
return this.httpClient()
|
|
65
|
-
.post(
|
|
58
|
+
.post(AssetRegistryApi.endpointUrl("validate", encodeURIComponent(assetType)), body)
|
|
66
59
|
.catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
|
|
67
60
|
});
|
|
68
61
|
}
|
|
62
|
+
static endpointUrl(...segments) {
|
|
63
|
+
return `${AssetRegistryApi.BASE_URL}/${segments.join("/")}`;
|
|
64
|
+
}
|
|
69
65
|
}
|
|
70
66
|
exports.AssetRegistryApi = AssetRegistryApi;
|
|
67
|
+
AssetRegistryApi.BASE_URL = "/pacman/api/core/asset-registry";
|
|
71
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/logger", "uuid"
|
|
16
|
+
define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
|
|
17
17
|
}
|
|
18
18
|
})(function (require, exports) {
|
|
19
19
|
"use strict";
|
|
@@ -23,7 +23,6 @@ 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");
|
|
27
26
|
class AssetRegistryService {
|
|
28
27
|
constructor(context) {
|
|
29
28
|
this.api = new asset_registry_api_1.AssetRegistryApi(context);
|
|
@@ -48,25 +47,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
}
|
|
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
|
-
}
|
|
70
50
|
getType(assetType, jsonResponse) {
|
|
71
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
52
|
const descriptor = yield this.api.getType(assetType);
|
|
@@ -107,7 +87,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
107
87
|
throw new logger_1.FatalError("Option -f is mutually exclusive with --packageKey, --nodeKey and --configuration.");
|
|
108
88
|
}
|
|
109
89
|
if (hasFile) {
|
|
110
|
-
return this.parseJson(
|
|
90
|
+
return this.parseJson(file_service_1.fileService.readFile(opts.file), `-f ${opts.file}`);
|
|
111
91
|
}
|
|
112
92
|
if (hasNodeKey && hasConfig) {
|
|
113
93
|
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.");
|
|
@@ -159,15 +139,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
159
139
|
logger_1.logger.info(base);
|
|
160
140
|
}
|
|
161
141
|
}
|
|
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
|
-
}
|
|
170
|
-
}
|
|
171
142
|
logDescriptorDetail(descriptor) {
|
|
172
143
|
logger_1.logger.info(`Asset Type: ${descriptor.assetType}`);
|
|
173
144
|
logger_1.logger.info(`Display Name: ${descriptor.displayName}`);
|
|
@@ -51,12 +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
54
|
}
|
|
61
55
|
listTypes(context, command, options) {
|
|
62
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -90,11 +84,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
90
84
|
yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
|
|
91
85
|
});
|
|
92
86
|
}
|
|
93
|
-
listSkills(context, command, options) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
yield new asset_registry_service_1.AssetRegistryService(context).listSkills(!!options.json);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
87
|
}
|
|
99
88
|
return Module;
|
|
100
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,46 @@
|
|
|
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/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 logger_1 = require("../../core/utils/logger");
|
|
25
|
+
class BookmarksCommandService {
|
|
26
|
+
constructor(context) {
|
|
27
|
+
this.bookmarksApi = new bookmarks_api_1.BookmarksApi(context);
|
|
28
|
+
}
|
|
29
|
+
exportBookmarks(packageKey, file) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const exportData = yield this.bookmarksApi.exportBookmarks(packageKey);
|
|
32
|
+
const fileName = file !== null && file !== void 0 ? file : `bookmarks-${packageKey}.json`;
|
|
33
|
+
file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(exportData, null, 4), fileName);
|
|
34
|
+
logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
importBookmarks(packageKey, file) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const payload = file_service_1.fileService.readFileToJson(file);
|
|
40
|
+
const result = yield this.bookmarksApi.importBookmarks(packageKey, payload);
|
|
41
|
+
logger_1.logger.info(`Bookmarks imported successfully: ${JSON.stringify(result, null, 4)}`);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.BookmarksCommandService = BookmarksCommandService;
|
|
46
|
+
});
|
|
@@ -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,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
|
+
});
|
|
@@ -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.SinglePackageExportApi = void 0;
|
|
22
|
+
const logger_1 = require("../../../core/utils/logger");
|
|
23
|
+
class SinglePackageExportApi {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.httpClient = () => context.httpClient;
|
|
26
|
+
}
|
|
27
|
+
exportPackage(packageKey) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.httpClient()
|
|
30
|
+
.getFile(`/pacman/api/core/staging/packages/${packageKey}/export-file`)
|
|
31
|
+
.catch(e => {
|
|
32
|
+
throw new logger_1.FatalError(`Problem exporting package ${packageKey}: ${e}`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.SinglePackageExportApi = SinglePackageExportApi;
|
|
38
|
+
});
|
|
@@ -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
|
+
});
|