@celonis/content-cli 1.11.0 → 1.13.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.
Files changed (71) hide show
  1. package/commands/action-flows/action-flow/action-flow.service.js +4 -2
  2. package/commands/asset-registry/asset-registry-api.js +33 -7
  3. package/commands/asset-registry/asset-registry.service.js +25 -3
  4. package/commands/asset-registry/module.js +15 -0
  5. package/commands/configuration-management/api/metadata-api.js +38 -0
  6. package/commands/configuration-management/api/single-package-export-api.js +38 -0
  7. package/commands/configuration-management/api/{diff-api.js → single-package-import-api.js} +5 -10
  8. package/commands/configuration-management/api/staging-package-api.js +39 -0
  9. package/commands/configuration-management/api/variable-api.js +36 -0
  10. package/commands/configuration-management/config-command.service.js +1 -63
  11. package/commands/configuration-management/connection-variable.helper.js +30 -0
  12. package/commands/configuration-management/interfaces/single-package-import.interfaces.js +12 -0
  13. package/commands/configuration-management/metadata.service.js +50 -0
  14. package/commands/configuration-management/module.js +80 -16
  15. package/commands/configuration-management/single-package-export.service.js +64 -0
  16. package/commands/configuration-management/single-package-import.service.js +131 -0
  17. package/commands/configuration-management/staging-package.service.js +50 -0
  18. package/commands/configuration-management/variable.service.js +18 -21
  19. package/commands/studio/manager/package.manager.js +1 -1
  20. package/commands/studio/module.js +8 -4
  21. package/commands/t2tc/api/diff-api.js +40 -0
  22. package/commands/{configuration-management/api/batch-import-export-api.js → t2tc/api/t2tc-package-api.js} +3 -29
  23. package/commands/{configuration-management → t2tc}/diff.service.js +7 -7
  24. package/commands/t2tc/module.js +105 -0
  25. package/commands/{configuration-management → t2tc}/studio.service.js +2 -17
  26. package/commands/t2tc/t2tc-command.service.js +88 -0
  27. package/commands/{configuration-management/batch-import-export.service.js → t2tc/t2tc-package.service.js} +26 -52
  28. package/commands/view/module.js +54 -0
  29. package/commands/view/view-bookmarks-command.service.js +45 -0
  30. package/commands/view/view-bookmarks.manager-factory.js +39 -0
  31. package/commands/view/view-bookmarks.manager.js +60 -0
  32. package/content-cli.js +61 -35
  33. package/core/command/module-handler.js +5 -0
  34. package/core/utils/file-service.js +45 -16
  35. package/core/utils/path.js +17 -0
  36. package/lib/commands/asset-registry/asset-registry-api.d.ts +5 -0
  37. package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +5 -0
  38. package/lib/commands/asset-registry/asset-registry.service.d.ts +3 -1
  39. package/lib/commands/asset-registry/module.d.ts +1 -0
  40. package/lib/commands/configuration-management/api/metadata-api.d.ts +7 -0
  41. package/lib/commands/configuration-management/api/single-package-export-api.d.ts +7 -0
  42. package/lib/commands/configuration-management/api/single-package-import-api.d.ts +8 -0
  43. package/lib/commands/configuration-management/api/staging-package-api.d.ts +7 -0
  44. package/lib/commands/configuration-management/api/variable-api.d.ts +7 -0
  45. package/lib/commands/configuration-management/config-command.service.d.ts +0 -8
  46. package/lib/commands/configuration-management/connection-variable.helper.d.ts +2 -0
  47. package/lib/commands/configuration-management/interfaces/single-package-import.interfaces.d.ts +19 -0
  48. package/lib/commands/configuration-management/metadata.service.d.ts +7 -0
  49. package/lib/commands/configuration-management/module.d.ts +4 -1
  50. package/lib/commands/configuration-management/single-package-export.service.d.ts +8 -0
  51. package/lib/commands/configuration-management/single-package-import.service.d.ts +13 -0
  52. package/lib/commands/configuration-management/staging-package.service.d.ts +7 -0
  53. package/lib/commands/configuration-management/variable.service.d.ts +1 -2
  54. package/lib/commands/t2tc/api/diff-api.d.ts +9 -0
  55. package/lib/commands/{configuration-management/api/batch-import-export-api.d.ts → t2tc/api/t2tc-package-api.d.ts} +3 -6
  56. package/lib/commands/{configuration-management → t2tc}/diff.service.d.ts +1 -1
  57. package/lib/commands/t2tc/module.d.ts +10 -0
  58. package/lib/commands/{configuration-management → t2tc}/studio.service.d.ts +1 -3
  59. package/lib/commands/t2tc/t2tc-command.service.d.ts +12 -0
  60. package/lib/commands/{configuration-management/batch-import-export.service.d.ts → t2tc/t2tc-package.service.d.ts} +3 -5
  61. package/lib/commands/view/module.d.ts +11 -0
  62. package/lib/commands/view/view-bookmarks-command.service.d.ts +7 -0
  63. package/lib/commands/view/view-bookmarks.manager-factory.d.ts +8 -0
  64. package/lib/commands/view/view-bookmarks.manager.d.ts +20 -0
  65. package/lib/content-cli.d.ts +15 -1
  66. package/lib/core/utils/file-service.d.ts +8 -1
  67. package/lib/core/utils/path.d.ts +1 -0
  68. package/package.json +4 -4
  69. package/lib/commands/configuration-management/api/diff-api.d.ts +0 -9
  70. /package/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.js +0 -0
  71. /package/lib/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.d.ts +0 -0
@@ -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
- zip.writeZip(fileName, () => fs.chmodSync(fileName, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
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
  }
@@ -13,13 +13,14 @@ 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"], factory);
16
+ define(["require", "exports", "./asset-registry-error", "../../core/utils/path"], 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");
23
24
  class AssetRegistryApi {
24
25
  constructor(context) {
25
26
  this.httpClient = () => context.httpClient;
@@ -27,45 +28,70 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
27
28
  listTypes() {
28
29
  return __awaiter(this, void 0, void 0, function* () {
29
30
  return this.httpClient()
30
- .get("/pacman/api/core/asset-registry/types")
31
+ .get(AssetRegistryApi.endpointUrl("types"))
31
32
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry types", e));
32
33
  });
33
34
  }
34
35
  listSkills() {
35
36
  return __awaiter(this, void 0, void 0, function* () {
36
37
  return this.httpClient()
37
- .get("/pacman/api/core/asset-registry/skills")
38
+ .get(AssetRegistryApi.endpointUrl("skills"))
38
39
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry skills", e));
39
40
  });
40
41
  }
41
42
  getType(assetType) {
42
43
  return __awaiter(this, void 0, void 0, function* () {
43
44
  return this.httpClient()
44
- .get(`/pacman/api/core/asset-registry/types/${encodeURIComponent(assetType)}`)
45
+ .get(AssetRegistryApi.endpointUrl("types", encodeURIComponent(assetType)))
45
46
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting asset type '${assetType}'`, e));
46
47
  });
47
48
  }
48
49
  getSchema(assetType) {
49
50
  return __awaiter(this, void 0, void 0, function* () {
50
51
  return this.httpClient()
51
- .get(`/pacman/api/core/asset-registry/schemas/${encodeURIComponent(assetType)}`)
52
+ .get(AssetRegistryApi.endpointUrl("schemas", encodeURIComponent(assetType)))
52
53
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting schema for asset type '${assetType}'`, e));
53
54
  });
54
55
  }
55
56
  getExamples(assetType) {
56
57
  return __awaiter(this, void 0, void 0, function* () {
57
58
  return this.httpClient()
58
- .get(`/pacman/api/core/asset-registry/examples/${encodeURIComponent(assetType)}`)
59
+ .get(AssetRegistryApi.endpointUrl("examples", encodeURIComponent(assetType)))
59
60
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting examples for asset type '${assetType}'`, e));
60
61
  });
61
62
  }
62
63
  validate(assetType, body) {
63
64
  return __awaiter(this, void 0, void 0, function* () {
64
65
  return this.httpClient()
65
- .post(`/pacman/api/core/asset-registry/validate/${encodeURIComponent(assetType)}`, body)
66
+ .post(AssetRegistryApi.endpointUrl("validate", encodeURIComponent(assetType)), body)
66
67
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`validating asset type '${assetType}'`, e));
67
68
  });
68
69
  }
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
+ static endpointUrl(...segments) {
89
+ return `${AssetRegistryApi.BASE_URL}/${segments.join("/")}`;
90
+ }
69
91
  }
70
92
  exports.AssetRegistryApi = AssetRegistryApi;
93
+ AssetRegistryApi.BASE_URL = "/pacman/api/core/asset-registry";
94
+ function encodePathSegments(value) {
95
+ return (0, path_1.trimSlashes)(value).split("/").map(encodeURIComponent).join("/");
96
+ }
71
97
  });
@@ -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", "fs"], factory);
16
+ define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/path", "uuid", "node:path"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -22,8 +22,9 @@ 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");
25
26
  const uuid_1 = require("uuid");
26
- const fs = require("fs");
27
+ const path = require("node:path");
27
28
  class AssetRegistryService {
28
29
  constructor(context) {
29
30
  this.api = new asset_registry_api_1.AssetRegistryApi(context);
@@ -48,6 +49,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
48
49
  }
49
50
  });
50
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
+ }
51
73
  listSkills(jsonResponse) {
52
74
  return __awaiter(this, void 0, void 0, function* () {
53
75
  const response = yield this.api.listSkills();
@@ -107,7 +129,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
107
129
  throw new logger_1.FatalError("Option -f is mutually exclusive with --packageKey, --nodeKey and --configuration.");
108
130
  }
109
131
  if (hasFile) {
110
- return this.parseJson(fs.readFileSync(opts.file, "utf-8"), `-f ${opts.file}`);
132
+ return this.parseJson(file_service_1.fileService.readFile(opts.file), `-f ${opts.file}`);
111
133
  }
112
134
  if (hasNodeKey && hasConfig) {
113
135
  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.");
@@ -57,6 +57,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57
57
  .description("List all available agent skills (name, description, path)")
58
58
  .option("--json", "Return the response as a JSON file")
59
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);
60
66
  }
61
67
  listTypes(context, command, options) {
62
68
  return __awaiter(this, void 0, void 0, function* () {
@@ -95,6 +101,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
95
101
  yield new asset_registry_service_1.AssetRegistryService(context).listSkills(!!options.json);
96
102
  });
97
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
+ }
98
113
  }
99
114
  return Module;
100
115
  });
@@ -0,0 +1,38 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "../../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.MetadataApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
23
+ class MetadataApi {
24
+ constructor(context) {
25
+ this.httpClient = () => context.httpClient;
26
+ }
27
+ exportPackagesMetadata(packageKeys) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const queryParams = new URLSearchParams();
30
+ packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
31
+ return this.httpClient().get(`/package-manager/api/core/packages/metadata/export?${queryParams.toString()}`).catch(e => {
32
+ throw new logger_1.FatalError(`Problem exporting packages metadata: ${e}`);
33
+ });
34
+ });
35
+ }
36
+ }
37
+ exports.MetadataApi = MetadataApi;
38
+ });
@@ -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
+ });
@@ -18,21 +18,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.DiffApi = void 0;
22
- class DiffApi {
21
+ exports.SinglePackageImportApi = void 0;
22
+ class SinglePackageImportApi {
23
23
  constructor(context) {
24
24
  this.httpClient = () => context.httpClient;
25
25
  }
26
- diffPackages(data) {
26
+ importPackage(data, overwrite) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
- return this.httpClient().postFile("/package-manager/api/core/packages/diff/configuration", data);
29
- });
30
- }
31
- hasChanges(data) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- return this.httpClient().postFile("/package-manager/api/core/packages/diff/configuration/has-changes", data);
28
+ return this.httpClient().postFile("/pacman/api/core/staging/packages/import-file", data, { overwrite });
34
29
  });
35
30
  }
36
31
  }
37
- exports.DiffApi = DiffApi;
32
+ exports.SinglePackageImportApi = SinglePackageImportApi;
38
33
  });
@@ -0,0 +1,39 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "../../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.StagingPackageApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
23
+ class StagingPackageApi {
24
+ constructor(context) {
25
+ this.httpClient = () => context.httpClient;
26
+ }
27
+ findAllStagingPackages(flavors, includeBranches = false) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ const queryParams = new URLSearchParams();
30
+ queryParams.set("includeBranches", includeBranches.toString());
31
+ flavors.forEach(flavor => queryParams.append("flavors", flavor));
32
+ return this.httpClient().get(`/pacman/api/core/staging/packages/export/list?${queryParams.toString()}`).catch(e => {
33
+ throw new logger_1.FatalError(`Problem getting staging packages: ${e}`);
34
+ });
35
+ });
36
+ }
37
+ }
38
+ exports.StagingPackageApi = StagingPackageApi;
39
+ });
@@ -0,0 +1,36 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "../../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.VariableApi = void 0;
22
+ const logger_1 = require("../../../core/utils/logger");
23
+ class VariableApi {
24
+ constructor(context) {
25
+ this.httpClient = () => context.httpClient;
26
+ }
27
+ findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return this.httpClient().post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
30
+ throw new logger_1.FatalError(`Problem exporting package variables: ${e}`);
31
+ });
32
+ });
33
+ }
34
+ }
35
+ exports.VariableApi = VariableApi;
36
+ });
@@ -13,40 +13,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "./batch-import-export.service", "./variable.service", "./diff.service", "../../core/utils/file-service"], factory);
16
+ define(["require", "exports", "./variable.service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.ConfigCommandService = void 0;
22
- const batch_import_export_service_1 = require("./batch-import-export.service");
23
22
  const variable_service_1 = require("./variable.service");
24
- const diff_service_1 = require("./diff.service");
25
- const file_service_1 = require("../../core/utils/file-service");
26
23
  class ConfigCommandService {
27
24
  constructor(context) {
28
- this.batchImportExportService = new batch_import_export_service_1.BatchImportExportService(context);
29
25
  this.variableService = new variable_service_1.VariableService(context);
30
- this.diffService = new diff_service_1.DiffService(context);
31
- }
32
- listPackages(jsonResponse, flavors, withDependencies, packageKeys, keysByVersion, variableValue, variableType, includeBranches, staging) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- if (staging) {
35
- yield this.batchImportExportService.listStagingPackages(flavors !== null && flavors !== void 0 ? flavors : [], includeBranches, jsonResponse);
36
- }
37
- else if (variableValue) {
38
- yield this.listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType, includeBranches);
39
- }
40
- else if (jsonResponse) {
41
- yield this.batchImportExportService.findAndExportListOfPackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], keysByVersion !== null && keysByVersion !== void 0 ? keysByVersion : [], withDependencies, includeBranches);
42
- }
43
- else if (keysByVersion) {
44
- yield this.batchImportExportService.listPackagesByKeysWithVersion(keysByVersion, withDependencies);
45
- }
46
- else {
47
- yield this.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], includeBranches);
48
- }
49
- });
50
26
  }
51
27
  listVariables(jsonResponse, keysByVersion, keysByVersionFile, packageKeys) {
52
28
  return __awaiter(this, void 0, void 0, function* () {
@@ -66,44 +42,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
66
42
  }
67
43
  });
68
44
  }
69
- batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip) {
70
- return this.batchImportExportService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies, gitBranch, unzip);
71
- }
72
- batchExportPackagesMetadata(packageKeys, jsonResponse) {
73
- return this.batchImportExportService.batchExportPackagesMetadata(packageKeys, jsonResponse);
74
- }
75
- batchImportPackages(file, directory, overwrite, gitBranch, performValidation = false) {
76
- if ((directory || file) && gitBranch) {
77
- throw new Error("You cannot use both file/directory and gitBranch options at the same time. Only one import source can be defined.");
78
- }
79
- if (!directory && !file && !gitBranch) {
80
- throw new Error("You must provide either a file/directory or a gitBranch option to import packages.");
81
- }
82
- if (file && directory) {
83
- throw new Error("You cannot use both file and directory options at the same time. Only one import source can be defined.");
84
- }
85
- if (file && file_service_1.fileService.isDirectory(file)) {
86
- throw new Error("The file option accepts only zip files.");
87
- }
88
- if (directory && !file_service_1.fileService.isDirectory(directory)) {
89
- throw new Error("The directory option accepts only directories.");
90
- }
91
- const sourcePath = file !== null && file !== void 0 ? file : directory;
92
- return this.batchImportExportService.batchImportPackages(sourcePath, overwrite, gitBranch, performValidation);
93
- }
94
- diffPackages(file, hasChanges, jsonResponse) {
95
- return this.diffService.diffPackages(file, hasChanges, jsonResponse);
96
- }
97
- listPackagesByVariableValue(jsonResponse, flavors, variableValue, variableType, includeBranches) {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- if (jsonResponse) {
100
- yield this.batchImportExportService.findAndExportListOfActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
101
- }
102
- else {
103
- yield this.batchImportExportService.listActivePackagesByVariableValue(flavors !== null && flavors !== void 0 ? flavors : [], variableValue, variableType, includeBranches);
104
- }
105
- });
106
- }
107
45
  }
108
46
  exports.ConfigCommandService = ConfigCommandService;
109
47
  });
@@ -0,0 +1,30 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "../studio/interfaces/package-manager.interfaces"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.fixConnectionVariables = void 0;
13
+ const package_manager_interfaces_1 = require("../studio/interfaces/package-manager.interfaces");
14
+ function fixConnectionVariables(variables) {
15
+ return variables.map(variableManifest => (Object.assign(Object.assign({}, variableManifest), { variables: variableManifest.variables.map(variable => {
16
+ if (variable.type !== package_manager_interfaces_1.PackageManagerVariableType.CONNECTION) {
17
+ return variable;
18
+ }
19
+ return fixConnectionVariable(variable);
20
+ }) })));
21
+ }
22
+ exports.fixConnectionVariables = fixConnectionVariables;
23
+ function fixConnectionVariable(variable) {
24
+ var _a;
25
+ if (!((_a = variable.value) === null || _a === void 0 ? void 0 : _a.appName)) {
26
+ return variable;
27
+ }
28
+ return Object.assign(Object.assign({}, variable), { metadata: Object.assign(Object.assign({}, variable.metadata), { appName: variable.value.appName }) });
29
+ }
30
+ });
@@ -0,0 +1,12 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
@@ -0,0 +1,50 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "uuid", "../../core/utils/file-service", "../../core/utils/logger", "./api/metadata-api"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.MetadataService = void 0;
22
+ const uuid_1 = require("uuid");
23
+ const file_service_1 = require("../../core/utils/file-service");
24
+ const logger_1 = require("../../core/utils/logger");
25
+ const metadata_api_1 = require("./api/metadata-api");
26
+ class MetadataService {
27
+ constructor(context) {
28
+ this.metadataApi = new metadata_api_1.MetadataApi(context);
29
+ }
30
+ exportPackagesMetadata(packageKeys, jsonResponse) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const exportedPackagesMetadata = yield this.metadataApi.exportPackagesMetadata(packageKeys);
33
+ if (jsonResponse) {
34
+ this.exportListOfPackagesMetadata(exportedPackagesMetadata);
35
+ }
36
+ else {
37
+ exportedPackagesMetadata.forEach(pkg => {
38
+ logger_1.logger.info(`${pkg.key} - Has Unpublished Changes: ${pkg.hasUnpublishedChanges}`);
39
+ });
40
+ }
41
+ });
42
+ }
43
+ exportListOfPackagesMetadata(packagesMetadata) {
44
+ const filename = (0, uuid_1.v4)() + ".json";
45
+ file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packagesMetadata), filename);
46
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
47
+ }
48
+ }
49
+ exports.MetadataService = MetadataService;
50
+ });