@celonis/content-cli 1.13.1 → 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.
Files changed (43) hide show
  1. package/README.md +17 -5
  2. package/commands/action-flows/module.js +2 -1
  3. package/commands/asset-registry/asset-registry-api.js +1 -30
  4. package/commands/asset-registry/asset-registry.service.js +1 -52
  5. package/commands/asset-registry/module.js +0 -26
  6. package/commands/bookmarks/bookmarks-api.js +49 -0
  7. package/commands/bookmarks/bookmarks-command.service.js +46 -0
  8. package/{core/utils/path.js → commands/bookmarks/bookmarks.interfaces.js} +0 -5
  9. package/commands/bookmarks/module.js +49 -0
  10. package/commands/configuration-management/branch/api/branch.api.js +88 -0
  11. package/commands/configuration-management/branch/branch-export-import.command.service.js +276 -0
  12. package/commands/configuration-management/branch/branch.command.service.js +178 -0
  13. package/commands/configuration-management/branch/interfaces/branch.interfaces.js +41 -0
  14. package/commands/configuration-management/module.js +164 -1
  15. package/commands/configuration-management/single-package-import.service.js +6 -6
  16. package/commands/data-pipeline/connection/connection.commands.js +4 -2
  17. package/commands/data-pipeline/data-pool/data-pool.commands.js +2 -1
  18. package/commands/deployment/module.js +4 -7
  19. package/content-cli.js +4 -0
  20. package/core/command/module-handler.js +8 -1
  21. package/core/feature-flag/feature-disabled-error.js +52 -0
  22. package/core/utils/branches.js +10 -0
  23. package/core/utils/file-service.js +0 -7
  24. package/lib/commands/asset-registry/asset-registry-api.d.ts +2 -6
  25. package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -17
  26. package/lib/commands/asset-registry/asset-registry.service.d.ts +2 -6
  27. package/lib/commands/asset-registry/module.d.ts +0 -2
  28. package/lib/commands/bookmarks/bookmarks-api.d.ts +8 -0
  29. package/lib/commands/bookmarks/bookmarks-command.service.d.ts +7 -0
  30. package/lib/commands/bookmarks/bookmarks.interfaces.d.ts +34 -0
  31. package/lib/commands/bookmarks/module.d.ts +8 -0
  32. package/lib/commands/configuration-management/branch/api/branch.api.d.ts +12 -0
  33. package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +36 -0
  34. package/lib/commands/configuration-management/branch/branch.command.service.d.ts +18 -0
  35. package/lib/commands/configuration-management/branch/interfaces/branch.interfaces.d.ts +139 -0
  36. package/lib/commands/configuration-management/module.d.ts +8 -0
  37. package/lib/commands/configuration-management/single-package-import.service.d.ts +5 -3
  38. package/lib/core/command/module-handler.d.ts +4 -4
  39. package/lib/core/feature-flag/feature-disabled-error.d.ts +16 -0
  40. package/lib/core/utils/branches.d.ts +3 -0
  41. package/lib/core/utils/file-service.d.ts +0 -1
  42. package/package.json +3 -3
  43. 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. [Building the Project](#building-and-using-the-project-locally)
13
- 4. [Troubleshooting](#troubleshooting)
14
- 5. [Release Process](#release-process)
15
- 6. [Contributing](#contributing)
16
- 7. [License](#license)
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.
@@ -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", "../../core/utils/path"], factory);
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/logger", "../../core/utils/path", "uuid", "node:path"], factory);
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";
@@ -22,9 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  const asset_registry_api_1 = require("./asset-registry-api");
23
23
  const file_service_1 = require("../../core/utils/file-service");
24
24
  const logger_1 = require("../../core/utils/logger");
25
- const path_1 = require("../../core/utils/path");
26
25
  const uuid_1 = require("uuid");
27
- const path = require("node:path");
28
26
  class AssetRegistryService {
29
27
  constructor(context) {
30
28
  this.api = new asset_registry_api_1.AssetRegistryApi(context);
@@ -49,46 +47,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
49
47
  }
50
48
  });
51
49
  }
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
50
  getType(assetType, jsonResponse) {
93
51
  return __awaiter(this, void 0, void 0, function* () {
94
52
  const descriptor = yield this.api.getType(assetType);
@@ -181,15 +139,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
181
139
  logger_1.logger.info(base);
182
140
  }
183
141
  }
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
142
  logDescriptorDetail(descriptor) {
194
143
  logger_1.logger.info(`Asset Type: ${descriptor.assetType}`);
195
144
  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,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
+ });
@@ -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
+ });
@@ -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
+ });