@celonis/content-cli 1.14.0 → 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.
Files changed (58) hide show
  1. package/commands/action-flows/action-flow/action-flow.service.js +9 -9
  2. package/commands/asset-registry/asset-registry.service.js +20 -16
  3. package/commands/bookmarks/bookmarks-command.service.js +5 -3
  4. package/commands/configuration-management/api/node-api.js +17 -0
  5. package/commands/configuration-management/branch/branch-export-import.command.service.js +31 -24
  6. package/commands/configuration-management/branch/branch.command.service.js +14 -10
  7. package/commands/configuration-management/metadata.service.js +9 -5
  8. package/commands/configuration-management/module.js +6 -5
  9. package/commands/configuration-management/node-dependency.service.js +5 -3
  10. package/commands/configuration-management/node-diff.service.js +10 -6
  11. package/commands/configuration-management/node.service.js +14 -10
  12. package/commands/configuration-management/package-validation.service.js +11 -5
  13. package/commands/configuration-management/package-version.service.js +7 -5
  14. package/commands/configuration-management/single-package-export.service.js +6 -6
  15. package/commands/configuration-management/single-package-import.service.js +22 -18
  16. package/commands/configuration-management/staging-package.service.js +9 -5
  17. package/commands/configuration-management/variable.service.js +11 -7
  18. package/commands/data-pipeline/data-pool/data-pool-service.js +13 -9
  19. package/commands/deployment/deployment.service.js +15 -13
  20. package/commands/studio/manager/space.manager.js +21 -10
  21. package/commands/studio/service/asset-service.js +5 -4
  22. package/commands/studio/service/package.service.js +9 -5
  23. package/commands/t2tc/diff.service.js +15 -9
  24. package/commands/t2tc/t2tc-package.service.js +25 -23
  25. package/core/http/http-client.js +18 -0
  26. package/core/http/http-shared/base.manager.js +35 -59
  27. package/core/utils/cui-api.js +52 -0
  28. package/core/utils/cui-file-service.js +106 -0
  29. package/core/utils/file-service.js +7 -6
  30. package/lib/commands/action-flows/action-flow/action-flow.service.d.ts +1 -0
  31. package/lib/commands/asset-registry/asset-registry.service.d.ts +1 -0
  32. package/lib/commands/bookmarks/bookmarks-command.service.d.ts +1 -0
  33. package/lib/commands/configuration-management/api/node-api.d.ts +1 -0
  34. package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +2 -1
  35. package/lib/commands/configuration-management/branch/branch.command.service.d.ts +2 -1
  36. package/lib/commands/configuration-management/interfaces/package-validation.interfaces.d.ts +1 -1
  37. package/lib/commands/configuration-management/metadata.service.d.ts +1 -0
  38. package/lib/commands/configuration-management/node-dependency.service.d.ts +1 -0
  39. package/lib/commands/configuration-management/node-diff.service.d.ts +1 -0
  40. package/lib/commands/configuration-management/node.service.d.ts +2 -1
  41. package/lib/commands/configuration-management/package-validation.service.d.ts +1 -0
  42. package/lib/commands/configuration-management/package-version.service.d.ts +1 -0
  43. package/lib/commands/configuration-management/single-package-export.service.d.ts +1 -0
  44. package/lib/commands/configuration-management/single-package-import.service.d.ts +1 -0
  45. package/lib/commands/configuration-management/staging-package.service.d.ts +1 -0
  46. package/lib/commands/configuration-management/variable.service.d.ts +1 -0
  47. package/lib/commands/data-pipeline/data-pool/data-pool-service.d.ts +1 -0
  48. package/lib/commands/deployment/deployment.service.d.ts +1 -0
  49. package/lib/commands/studio/service/asset-service.d.ts +1 -0
  50. package/lib/commands/studio/service/package.service.d.ts +1 -0
  51. package/lib/commands/t2tc/diff.service.d.ts +1 -0
  52. package/lib/commands/t2tc/t2tc-package.service.d.ts +1 -0
  53. package/lib/core/http/http-client.d.ts +4 -0
  54. package/lib/core/http/http-shared/base.manager.d.ts +7 -5
  55. package/lib/core/http/http-shared/manager-config.interface.d.ts +1 -1
  56. package/lib/core/utils/cui-api.d.ts +26 -0
  57. package/lib/core/utils/cui-file-service.d.ts +19 -0
  58. package/package.json +1 -1
@@ -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", "node:path"], factory);
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 fullFilePath = (0, node_path_1.resolve)(process.cwd(), fileName);
48
- zip.writeZip(fullFilePath, () => fs.chmodSync(fullFilePath, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
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
- file_service_1.fileService.writeToFileWithGivenName(actionFlowsMetadataString, metadataFileName);
59
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + metadataFileName);
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
- file_service_1.fileService.writeToFileWithGivenName(eventLogString, eventLogFileName);
74
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + eventLogFileName);
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);
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
16
+ define(["require", "exports", "./asset-registry-api", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "uuid"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -21,11 +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
26
  const uuid_1 = require("uuid");
26
27
  class AssetRegistryService {
27
28
  constructor(context) {
28
29
  this.api = new asset_registry_api_1.AssetRegistryApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  listTypes(jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
@@ -33,8 +35,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
35
  const descriptors = Object.values(metadata.types);
34
36
  if (jsonResponse) {
35
37
  const filename = (0, uuid_1.v4)() + ".json";
36
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(metadata), filename);
37
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
38
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(metadata), filename);
39
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
38
40
  }
39
41
  else {
40
42
  if (descriptors.length === 0) {
@@ -52,8 +54,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
52
54
  const descriptor = yield this.api.getType(assetType);
53
55
  if (jsonResponse) {
54
56
  const filename = (0, uuid_1.v4)() + ".json";
55
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(descriptor), filename);
56
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
57
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(descriptor), filename);
58
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
57
59
  }
58
60
  else {
59
61
  this.logDescriptorDetail(descriptor);
@@ -63,20 +65,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
63
65
  getSchema(assetType, jsonResponse) {
64
66
  return __awaiter(this, void 0, void 0, function* () {
65
67
  const data = yield this.api.getSchema(assetType);
66
- this.outputResponse(data, jsonResponse);
68
+ yield this.outputResponse(data, jsonResponse);
67
69
  });
68
70
  }
69
71
  getExamples(assetType, jsonResponse) {
70
72
  return __awaiter(this, void 0, void 0, function* () {
71
73
  const data = yield this.api.getExamples(assetType);
72
- this.outputResponse(data, jsonResponse);
74
+ yield this.outputResponse(data, jsonResponse);
73
75
  });
74
76
  }
75
77
  validate(opts) {
76
78
  return __awaiter(this, void 0, void 0, function* () {
77
79
  const payload = this.buildValidatePayload(opts);
78
80
  const data = yield this.api.validate(opts.assetType, payload);
79
- this.outputResponse(data, opts.json);
81
+ yield this.outputResponse(data, opts.json);
80
82
  });
81
83
  }
82
84
  buildValidatePayload(opts) {
@@ -121,14 +123,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
121
123
  }
122
124
  }
123
125
  outputResponse(data, jsonResponse) {
124
- if (jsonResponse) {
125
- const filename = (0, uuid_1.v4)() + ".json";
126
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(data, null, 2), filename);
127
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
128
- }
129
- else {
130
- logger_1.logger.info(typeof data === "string" ? data : JSON.stringify(data, null, 2));
131
- }
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
+ });
132
136
  }
133
137
  logDescriptorSummary(descriptor) {
134
138
  const base = `${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}]`;
@@ -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", "./bookmarks-api", "../../core/utils/file-service", "../../core/utils/logger"], factory);
16
+ define(["require", "exports", "./bookmarks-api", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -21,17 +21,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  exports.BookmarksCommandService = void 0;
22
22
  const bookmarks_api_1 = require("./bookmarks-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
26
  class BookmarksCommandService {
26
27
  constructor(context) {
27
28
  this.bookmarksApi = new bookmarks_api_1.BookmarksApi(context);
29
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
28
30
  }
29
31
  exportBookmarks(packageKey, file) {
30
32
  return __awaiter(this, void 0, void 0, function* () {
31
33
  const exportData = yield this.bookmarksApi.exportBookmarks(packageKey);
32
34
  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
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(exportData, null, 4), fileName);
36
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
35
37
  });
36
38
  }
37
39
  importBookmarks(packageKey, file) {
@@ -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();
@@ -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", "node:fs", "node:os", "node:path", "uuid", "adm-zip", "node:path", "../../../core/utils/file-service", "../../../core/utils/logger", "../../../core/git-profile/git/git.service", "../api/single-package-export-api", "../api/single-package-import-api", "../single-package-import.service", "./api/branch.api", "../../../core/utils/branches"], factory);
16
+ define(["require", "exports", "node:fs", "node:os", "node:path", "uuid", "adm-zip", "node:path", "../../../core/utils/file-service", "../../../core/utils/cui-file-service", "../../../core/utils/logger", "../../../core/git-profile/git/git.service", "../api/single-package-export-api", "../api/single-package-import-api", "../single-package-import.service", "./api/branch.api", "../../../core/utils/branches"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -26,6 +26,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
26
26
  const AdmZip = require("adm-zip");
27
27
  const node_path_1 = require("node:path");
28
28
  const file_service_1 = require("../../../core/utils/file-service");
29
+ const cui_file_service_1 = require("../../../core/utils/cui-file-service");
29
30
  const logger_1 = require("../../../core/utils/logger");
30
31
  const git_service_1 = require("../../../core/git-profile/git/git.service");
31
32
  const single_package_export_api_1 = require("../api/single-package-export-api");
@@ -40,6 +41,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
40
41
  this.singlePackageImportApi = new single_package_import_api_1.SinglePackageImportApi(context);
41
42
  this.branchApi = new branch_api_1.BranchApi(context);
42
43
  this.gitService = new git_service_1.GitService(context);
44
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
43
45
  }
44
46
  exportBranch(packageKey, branchKey, options = {}) {
45
47
  return __awaiter(this, void 0, void 0, function* () {
@@ -47,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
47
49
  if (options.gitEnabled) {
48
50
  const pushedKey = yield this.pushBranchToGit(packageKey, branchKey);
49
51
  if (jsonResponse) {
50
- BranchExportImportCommandService.writeJson({ packageKey: pushedKey, branchName: branchKey });
52
+ yield this.writeJson({ packageKey: pushedKey, branchName: branchKey });
51
53
  }
52
54
  else {
53
55
  logger_1.logger.info(`Exported ${pushedKey} to Git branch '${branchKey}'.`);
@@ -57,9 +59,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57
59
  const branchPackageKey = branches_1.BranchUtils.constructBranchKey(packageKey, branchKey);
58
60
  const sourceDir = yield this.exportRewrittenPackageDir(branchPackageKey);
59
61
  try {
60
- const message = this.writeLocalArtifact(sourceDir, packageKey, !!options.zip);
62
+ const message = yield this.writeLocalArtifact(sourceDir, packageKey, !!options.zip);
61
63
  if (jsonResponse) {
62
- BranchExportImportCommandService.writeJson({ packageKey: branchPackageKey, branchName: branchKey });
64
+ yield this.writeJson({ packageKey: branchPackageKey, branchName: branchKey });
63
65
  }
64
66
  else {
65
67
  logger_1.logger.info(message);
@@ -90,7 +92,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
90
92
  }
91
93
  const summary = { packageKey: mainKey, branchName: branches_1.BranchUtils.MAIN_BRANCH_KEY, synced };
92
94
  if (jsonResponse) {
93
- BranchExportImportCommandService.writeJson(summary);
95
+ yield this.writeJson(summary);
94
96
  }
95
97
  else {
96
98
  logger_1.logger.info(`Exported Git mirror for ${mainKey}: ${synced.length} package(s) pushed.`);
@@ -108,7 +110,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
108
110
  this.restoreBranchKey(workingDir, packageKey, branchPackageKey);
109
111
  yield this.importPackageSourceDir(workingDir, !!options.overwrite);
110
112
  if (options.jsonResponse) {
111
- BranchExportImportCommandService.writeJson({ packageKey: branchPackageKey, branchName: branchKey });
113
+ yield this.writeJson({ packageKey: branchPackageKey, branchName: branchKey });
112
114
  }
113
115
  else {
114
116
  const origin = options.gitEnabled ? `Git branch '${branchKey}'` : ((_a = options.file) !== null && _a !== void 0 ? _a : options.directory);
@@ -155,21 +157,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
155
157
  });
156
158
  }
157
159
  writeLocalArtifact(sourceDir, packageKey, zip) {
158
- if (zip) {
159
- const zipPath = file_service_1.fileService.zipDirectoryAsSinglePackage(sourceDir);
160
- try {
161
- const fileName = `${packageKey}.zip`;
162
- file_service_1.fileService.writeBufferToFileWithGivenName(fs.readFileSync(zipPath), (0, node_path_1.resolve)(process.cwd(), fileName));
163
- return file_service_1.FileService.fileDownloadedMessage + fileName;
164
- }
165
- finally {
166
- fs.rmSync(zipPath, { force: true });
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ if (zip) {
162
+ const zipPath = file_service_1.fileService.zipDirectoryAsSinglePackage(sourceDir);
163
+ try {
164
+ const fileName = yield this.cuiFileService.writeZipToFileWithGivenName(fs.readFileSync(zipPath), `${packageKey}.zip`);
165
+ return file_service_1.FileService.fileDownloadedMessage + fileName;
166
+ }
167
+ finally {
168
+ fs.rmSync(zipPath, { force: true });
169
+ }
167
170
  }
168
- }
169
- const targetDir = (0, node_path_1.resolve)(process.cwd(), packageKey);
170
- fs.rmSync(targetDir, { recursive: true, force: true });
171
- fs.cpSync(sourceDir, targetDir, { recursive: true });
172
- return `Successful export. Exported directory: ${packageKey}`;
171
+ const directoryName = yield this.cuiFileService.writeDirectoryWithGivenName(name => {
172
+ const targetDir = (0, node_path_1.resolve)(process.cwd(), name);
173
+ fs.rmSync(targetDir, { recursive: true, force: true });
174
+ fs.cpSync(sourceDir, targetDir, { recursive: true });
175
+ }, packageKey);
176
+ return `Successful export. Exported directory: ${directoryName}`;
177
+ });
173
178
  }
174
179
  prepareLocalWorkingDir(file, directory) {
175
180
  const workingDir = fs.mkdtempSync(path.join(os.tmpdir(), "content-cli-"));
@@ -266,10 +271,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
266
271
  return branches_1.BranchUtils.isBranchPackageKey(branch.packageKey)
267
272
  && ((_a = branch.branchKey) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== branches_1.BranchUtils.MAIN_BRANCH_KEY;
268
273
  }
269
- static writeJson(payload) {
270
- const filename = `${(0, uuid_1.v4)()}.json`;
271
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(payload, null, 2), filename);
272
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
274
+ writeJson(payload) {
275
+ return __awaiter(this, void 0, void 0, function* () {
276
+ const filename = `${(0, uuid_1.v4)()}.json`;
277
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(payload, null, 2), filename);
278
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
279
+ });
273
280
  }
274
281
  }
275
282
  exports.BranchExportImportCommandService = BranchExportImportCommandService;
@@ -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", "../../../core/utils/file-service", "../../../core/utils/logger", "./api/branch.api", "./interfaces/branch.interfaces"], factory);
16
+ define(["require", "exports", "uuid", "../../../core/utils/file-service", "../../../core/utils/cui-file-service", "../../../core/utils/logger", "./api/branch.api", "./interfaces/branch.interfaces"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -21,19 +21,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  exports.BranchCommandService = void 0;
22
22
  const uuid_1 = require("uuid");
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
26
  const branch_api_1 = require("./api/branch.api");
26
27
  const branch_interfaces_1 = require("./interfaces/branch.interfaces");
27
28
  class BranchCommandService {
28
29
  constructor(context) {
29
30
  this.branchApi = new branch_api_1.BranchApi(context);
31
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
30
32
  }
31
33
  setBranchingEnabled(packageKey, enabled, jsonResponse) {
32
34
  return __awaiter(this, void 0, void 0, function* () {
33
35
  const transport = { branchingEnabled: enabled };
34
36
  const result = yield this.branchApi.configureBranchingSettings(packageKey, transport);
35
37
  if (jsonResponse) {
36
- BranchCommandService.writeJson(result);
38
+ yield this.writeJson(result);
37
39
  }
38
40
  else {
39
41
  logger_1.logger.info(`Branching ${result.branchingEnabled ? "enabled" : "disabled"} for package ${packageKey}.`);
@@ -50,7 +52,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
50
52
  return;
51
53
  }
52
54
  if (jsonResponse) {
53
- BranchCommandService.writeJson(result);
55
+ yield this.writeJson(result);
54
56
  }
55
57
  else if (result) {
56
58
  BranchCommandService.printBranch(result);
@@ -62,7 +64,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
62
64
  return __awaiter(this, void 0, void 0, function* () {
63
65
  const branches = yield this.branchApi.listBranches(packageKey);
64
66
  if (jsonResponse) {
65
- BranchCommandService.writeJson(branches);
67
+ yield this.writeJson(branches);
66
68
  }
67
69
  else if (branches.length === 0) {
68
70
  logger_1.logger.info(`No branches found for ${packageKey}.`);
@@ -87,7 +89,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
87
89
  const transport = { sourceKey, sourceVersion };
88
90
  const preview = yield this.branchApi.mergePreview(targetPackageKey, transport);
89
91
  if (jsonResponse) {
90
- BranchCommandService.writeJson(preview);
92
+ yield this.writeJson(preview);
91
93
  }
92
94
  else {
93
95
  BranchCommandService.printPreviewSummary(targetPackageKey, sourceKey, sourceVersion, preview);
@@ -107,7 +109,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
107
109
  const transport = Object.assign(Object.assign({}, rawBody), { sourceKey: effectiveSourceKey, sourceVersion: effectiveSourceVersion, versionCreate });
108
110
  const result = yield this.branchApi.merge(targetPackageKey, transport);
109
111
  if (options.jsonResponse) {
110
- BranchCommandService.writeJson(result);
112
+ yield this.writeJson(result);
111
113
  }
112
114
  else {
113
115
  logger_1.logger.info(`Merge applied: published ${result.packageKey}@${result.version} from ${effectiveSourceKey}@${effectiveSourceVersion}.`);
@@ -136,10 +138,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
136
138
  }
137
139
  return versionCreate;
138
140
  }
139
- static writeJson(payload) {
140
- const filename = `${(0, uuid_1.v4)()}.json`;
141
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(payload, null, 2), filename);
142
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
141
+ writeJson(payload) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const filename = `${(0, uuid_1.v4)()}.json`;
144
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(payload, null, 2), filename);
145
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
146
+ });
143
147
  }
144
148
  static printBranch(branch) {
145
149
  logger_1.logger.info(`Main Package Key: ${branch.projectKey}`);
@@ -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", "../../core/utils/file-service", "../../core/utils/logger", "./api/metadata-api"], factory);
16
+ define(["require", "exports", "uuid", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "./api/metadata-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -21,17 +21,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  exports.MetadataService = void 0;
22
22
  const uuid_1 = require("uuid");
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
26
  const metadata_api_1 = require("./api/metadata-api");
26
27
  class MetadataService {
27
28
  constructor(context) {
28
29
  this.metadataApi = new metadata_api_1.MetadataApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  exportPackagesMetadata(packageKeys, jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
32
34
  const exportedPackagesMetadata = yield this.metadataApi.exportPackagesMetadata(packageKeys);
33
35
  if (jsonResponse) {
34
- this.exportListOfPackagesMetadata(exportedPackagesMetadata);
36
+ yield this.exportListOfPackagesMetadata(exportedPackagesMetadata);
35
37
  }
36
38
  else {
37
39
  exportedPackagesMetadata.forEach(pkg => {
@@ -41,9 +43,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
43
  });
42
44
  }
43
45
  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);
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const filename = (0, uuid_1.v4)() + ".json";
48
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(packagesMetadata), filename);
49
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
50
+ });
47
51
  }
48
52
  }
49
53
  exports.MetadataService = MetadataService;
@@ -169,7 +169,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
169
169
  packageCommand.command("validate")
170
170
  .description("Validate package node configurations")
171
171
  .requiredOption("--packageKey <packageKey>", "Key of the package to validate")
172
- .option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", ["SCHEMA"])
172
+ .option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS). Omit to run every layer available for the team.")
173
173
  .option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
174
174
  .option("--json", "Return the response as a JSON file")
175
175
  .action(this.validatePackage);
@@ -182,7 +182,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
182
182
  .description("[Deprecated] Use 'config package validate' instead. Validate package node configurations.")
183
183
  .deprecationNotice("'config validate' is deprecated and will be removed in a future release. Use 'config package validate' instead.")
184
184
  .requiredOption("--packageKey <packageKey>", "Key of the package to validate")
185
- .option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS PACKAGE_SETTINGS PIG_SEMANTICS DATA_PIPELINES). Defaults to SCHEMA.", ["SCHEMA"])
185
+ .option("--layers <layers...>", "Validation layers to run. Allowed values: SCHEMA, BUSINESS, PACKAGE_SETTINGS, PIG_SEMANTICS, DATA_PIPELINES (can be combined, e.g. --layers SCHEMA BUSINESS). Omit to run every layer available for the team.")
186
186
  .option("--nodeKeys <nodeKeys...>", "Specific node keys to validate (default: all nodes)")
187
187
  .option("--json", "Return the response as a JSON file")
188
188
  .action(this.validatePackage);
@@ -254,9 +254,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
254
254
  .option("--force", "Force archive even if the node has dependants", false)
255
255
  .action(this.archiveNode);
256
256
  nodesCommand.command("list")
257
- .description("List nodes in a specific package version")
257
+ .description("List nodes in a package. Lists staging nodes by default.")
258
258
  .requiredOption("--packageKey <packageKey>", "Identifier of the package")
259
- .requiredOption("--packageVersion <packageVersion>", "Version of the package")
259
+ .option("--packageVersion <packageVersion>", "Version of the package. If not sent, the staging state of the package will be used.")
260
260
  .option("--limit <limit>", "Limit the number of results returned")
261
261
  .option("--offset <offset>", "Offset for pagination")
262
262
  .option("--withConfiguration", "Include node configuration in the response", false)
@@ -508,8 +508,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
508
508
  });
509
509
  }
510
510
  listNodes(context, command, options) {
511
+ var _a;
511
512
  return __awaiter(this, void 0, void 0, function* () {
512
- yield new node_service_1.NodeService(context).listNodes(options.packageKey, options.packageVersion, options.limit, options.offset, options.withConfiguration, options.json);
513
+ yield new node_service_1.NodeService(context).listNodes(options.packageKey, (_a = options.packageVersion) !== null && _a !== void 0 ? _a : null, options.limit, options.offset, options.withConfiguration, options.json);
513
514
  });
514
515
  }
515
516
  diffNode(context, command, options) {
@@ -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", "./api/node-dependency-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
16
+ define(["require", "exports", "./api/node-dependency-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,11 +21,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  exports.NodeDependencyService = void 0;
22
22
  const node_dependency_api_1 = require("./api/node-dependency-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
26
  const uuid_1 = require("uuid");
26
27
  class NodeDependencyService {
27
28
  constructor(context) {
28
29
  this.nodeDependencyApi = new node_dependency_api_1.NodeDependencyApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  listNodeDependencies(packageKey, nodeKey, version, jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
@@ -38,8 +40,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38
40
  }
39
41
  if (jsonResponse) {
40
42
  const filename = (0, uuid_1.v4)() + ".json";
41
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(dependencies, null, 2), filename);
42
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
43
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(dependencies, null, 2), filename);
44
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
43
45
  }
44
46
  else {
45
47
  if (dependencies.length === 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", "node:fs", "uuid", "../../core/utils/logger", "../../core/utils/file-service", "./api/node-diff-api"], factory);
16
+ define(["require", "exports", "node:fs", "uuid", "../../core/utils/logger", "../../core/utils/file-service", "../../core/utils/cui-file-service", "./api/node-diff-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -23,10 +23,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
23
  const uuid_1 = require("uuid");
24
24
  const logger_1 = require("../../core/utils/logger");
25
25
  const file_service_1 = require("../../core/utils/file-service");
26
+ const cui_file_service_1 = require("../../core/utils/cui-file-service");
26
27
  const node_diff_api_1 = require("./api/node-diff-api");
27
28
  class NodeDiffService {
28
29
  constructor(context) {
29
30
  this.nodeDiffApi = new node_diff_api_1.NodeDiffApi(context);
31
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
30
32
  }
31
33
  diff(packageKey, nodeKey, baseVersion, compareVersion, jsonResponse) {
32
34
  return __awaiter(this, void 0, void 0, function* () {
@@ -37,7 +39,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
37
39
  compareVersion,
38
40
  });
39
41
  if (jsonResponse) {
40
- this.exportDiffAsJson(nodeDiff);
42
+ yield this.exportDiffAsJson(nodeDiff);
41
43
  }
42
44
  else {
43
45
  this.logDiff(nodeDiff);
@@ -53,7 +55,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
53
55
  file: fs.createReadStream(file),
54
56
  });
55
57
  if (jsonResponse) {
56
- this.exportDiffAsJson(nodeDiff);
58
+ yield this.exportDiffAsJson(nodeDiff);
57
59
  }
58
60
  else {
59
61
  this.logDiff(nodeDiff);
@@ -61,9 +63,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
61
63
  });
62
64
  }
63
65
  exportDiffAsJson(nodeDiff) {
64
- const filename = (0, uuid_1.v4)() + ".json";
65
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodeDiff, null, 2), filename);
66
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const filename = (0, uuid_1.v4)() + ".json";
68
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodeDiff, null, 2), filename);
69
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
70
+ });
67
71
  }
68
72
  logDiff(nodeDiff) {
69
73
  logger_1.logger.info(`Package Key: ${nodeDiff.packageKey}`);