@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", "./api/node-api", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
16
+ define(["require", "exports", "./api/node-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.NodeService = void 0;
22
22
  const node_api_1 = require("./api/node-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 NodeService {
27
28
  constructor(context) {
28
29
  this.nodeApi = new node_api_1.NodeApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  findNode(packageKey, nodeKey, withConfiguration, packageVersion, jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
@@ -34,8 +36,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
36
  : yield this.nodeApi.findStagingNodeByKey(packageKey, nodeKey, withConfiguration);
35
37
  if (jsonResponse) {
36
38
  const filename = (0, uuid_1.v4)() + ".json";
37
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
38
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
39
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
40
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
39
41
  }
40
42
  else {
41
43
  this.printNode(node);
@@ -44,11 +46,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
44
46
  }
45
47
  listNodes(packageKey, packageVersion, limit, offset, withConfiguration, jsonResponse) {
46
48
  return __awaiter(this, void 0, void 0, function* () {
47
- const nodes = yield this.nodeApi.findVersionedNodesByPackage(packageKey, packageVersion, withConfiguration, limit, offset);
49
+ const nodes = packageVersion
50
+ ? yield this.nodeApi.findVersionedNodesByPackage(packageKey, packageVersion, withConfiguration, limit, offset)
51
+ : yield this.nodeApi.findStagingNodesByPackage(packageKey, withConfiguration, limit, offset);
48
52
  if (jsonResponse) {
49
53
  const filename = (0, uuid_1.v4)() + ".json";
50
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes, null, 2), filename);
51
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
54
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodes, null, 2), filename);
55
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
52
56
  }
53
57
  else {
54
58
  nodes.forEach(node => {
@@ -67,8 +71,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67
71
  }
68
72
  if (jsonResponse) {
69
73
  const filename = (0, uuid_1.v4)() + ".json";
70
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
71
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
74
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
75
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
72
76
  }
73
77
  else {
74
78
  this.printNode(node);
@@ -85,8 +89,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
85
89
  }
86
90
  if (jsonResponse) {
87
91
  const filename = (0, uuid_1.v4)() + ".json";
88
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
89
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
92
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(node, null, 2), filename);
93
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
90
94
  }
91
95
  else {
92
96
  this.printNode(node);
@@ -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", "./api/package-validation-api", "../../core/utils/logger", "../../core/utils/file-service"], factory);
16
+ define(["require", "exports", "uuid", "./api/package-validation-api", "../../core/utils/logger", "../../core/utils/cui-file-service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -22,22 +22,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  const uuid_1 = require("uuid");
23
23
  const package_validation_api_1 = require("./api/package-validation-api");
24
24
  const logger_1 = require("../../core/utils/logger");
25
- const file_service_1 = require("../../core/utils/file-service");
25
+ const cui_file_service_1 = require("../../core/utils/cui-file-service");
26
26
  class PackageValidationService {
27
27
  constructor(context) {
28
28
  this.packageValidationApi = new package_validation_api_1.PackageValidationApi(context);
29
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
30
  }
30
31
  validatePackage(packageKey, layers, nodeKeys, jsonOutput) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
- const request = { layers };
33
+ const request = {};
34
+ // Omitted rather than defaulted here: the API reads an absent "layers" as every layer available for
35
+ // the team, and rejects an empty list.
36
+ if (layers && layers.length > 0) {
37
+ request.layers = layers;
38
+ }
33
39
  if (nodeKeys && nodeKeys.length > 0) {
34
40
  request.nodeKeys = nodeKeys;
35
41
  }
36
42
  const response = yield this.packageValidationApi.validatePackage(packageKey, request);
37
43
  if (jsonOutput) {
38
44
  const reportFileName = "config_validate_report_" + (0, uuid_1.v4)() + ".json";
39
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(response), reportFileName);
40
- logger_1.logger.info("Validation report file: " + reportFileName);
45
+ const writtenFileName = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(response), reportFileName);
46
+ logger_1.logger.info("Validation report file: " + writtenFileName);
41
47
  }
42
48
  else {
43
49
  this.printValidationResult(response);
@@ -13,27 +13,29 @@ 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", "../../core/utils/file-service", "../../core/utils/logger", "uuid", "./api/package-version-api"], factory);
16
+ define(["require", "exports", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "uuid", "./api/package-version-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.PackageVersionService = void 0;
22
22
  const file_service_1 = require("../../core/utils/file-service");
23
+ const cui_file_service_1 = require("../../core/utils/cui-file-service");
23
24
  const logger_1 = require("../../core/utils/logger");
24
25
  const uuid_1 = require("uuid");
25
26
  const package_version_api_1 = require("./api/package-version-api");
26
27
  class PackageVersionService {
27
28
  constructor(context) {
28
29
  this.packageVersionApi = new package_version_api_1.PackageVersionApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  findPackageVersion(packageKey, version, jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
32
34
  const packageVersionTransport = yield this.packageVersionApi.findOne(packageKey, version);
33
35
  if (jsonResponse) {
34
36
  const filename = (0, uuid_1.v4)() + ".json";
35
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packageVersionTransport, null, 2), filename);
36
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
37
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(packageVersionTransport, null, 2), filename);
38
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
37
39
  }
38
40
  else {
39
41
  this.printPackageVersionTransport(packageVersionTransport);
@@ -56,8 +58,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56
58
  const created = yield this.packageVersionApi.createVersion(packageKey, request);
57
59
  if (jsonResponse) {
58
60
  const filename = (0, uuid_1.v4)() + ".json";
59
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(created, null, 2), filename);
60
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
61
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(created, null, 2), filename);
62
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
61
63
  }
62
64
  else {
63
65
  this.printPackageVersionCreatedTransport(created);
@@ -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", "../../core/utils/file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-export-api", "node:path"], factory);
16
+ define(["require", "exports", "node:fs", "../../core/utils/file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-export-api", "../../core/utils/cui-file-service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -24,11 +24,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  const logger_1 = require("../../core/utils/logger");
25
25
  const git_service_1 = require("../../core/git-profile/git/git.service");
26
26
  const single_package_export_api_1 = require("./api/single-package-export-api");
27
- const node_path_1 = require("node:path");
27
+ const cui_file_service_1 = require("../../core/utils/cui-file-service");
28
28
  class SinglePackageExportService {
29
29
  constructor(context) {
30
30
  this.singlePackageExportApi = new single_package_export_api_1.SinglePackageExportApi(context);
31
31
  this.gitService = new git_service_1.GitService(context);
32
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
32
33
  }
33
34
  exportPackage(packageKey, zip, gitBranch) {
34
35
  return __awaiter(this, void 0, void 0, function* () {
@@ -38,13 +39,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38
39
  return;
39
40
  }
40
41
  if (zip) {
41
- const fileName = `${packageKey}.zip`;
42
- file_service_1.fileService.writeBufferToFileWithGivenName(packageData, (0, node_path_1.resolve)(process.cwd(), fileName));
42
+ const fileName = yield this.cuiFileService.writeZipToFileWithGivenName(packageData, `${packageKey}.zip`);
43
43
  logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + fileName);
44
44
  return;
45
45
  }
46
- file_service_1.fileService.extractZipBufferToDirectory(packageData, packageKey);
47
- logger_1.logger.info(`Successful export. Exported directory: ${packageKey}`);
46
+ const directoryName = yield this.cuiFileService.writeDirectoryWithGivenName(targetDir => file_service_1.fileService.extractZipBufferToDirectory(packageData, targetDir), packageKey);
47
+ logger_1.logger.info(`Successful export. Exported directory: ${directoryName}`);
48
48
  });
49
49
  }
50
50
  exportToGitBranch(packageData, gitBranch) {
@@ -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", "form-data", "node:stream", "adm-zip", "node:fs", "../../core/utils/file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-import-api"], factory);
16
+ define(["require", "exports", "uuid", "form-data", "node:stream", "adm-zip", "node:fs", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "../../core/git-profile/git/git.service", "./api/single-package-import-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  const AdmZip = require("adm-zip");
26
26
  const fs = require("node:fs");
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 git_service_1 = require("../../core/git-profile/git/git.service");
30
31
  const single_package_import_api_1 = require("./api/single-package-import-api");
@@ -32,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
33
  constructor(context) {
33
34
  this.singlePackageImportApi = new single_package_import_api_1.SinglePackageImportApi(context);
34
35
  this.gitService = new git_service_1.GitService(context);
36
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
35
37
  }
36
38
  importPackage(file, directory, overwrite, jsonResponse, gitBranch) {
37
39
  return __awaiter(this, void 0, void 0, function* () {
@@ -55,7 +57,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55
57
  const packageZip = new AdmZip(resolvedSource.zipPath);
56
58
  const formData = SinglePackageImportService.buildBodyForImport(packageZip, resolvedSource.zipPath);
57
59
  const result = yield this.singlePackageImportApi.importPackage(formData, overwrite);
58
- this.outputResult(result, jsonResponse);
60
+ yield this.outputResult(result, jsonResponse);
59
61
  }
60
62
  finally {
61
63
  if (resolvedSource.isTemporary) {
@@ -107,22 +109,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
107
109
  }
108
110
  outputResult(result, jsonResponse) {
109
111
  var _a;
110
- if (jsonResponse) {
111
- const filename = (0, uuid_1.v4)() + ".json";
112
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(result, null, 2), filename);
113
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
114
- return;
115
- }
116
- const importedPackage = result.importedPackage;
117
- const importedNodes = (_a = result.importedNodes) !== null && _a !== void 0 ? _a : [];
118
- logger_1.logger.info(`Successfully imported package: ${importedPackage.key}`);
119
- logger_1.logger.info(`Name: ${importedPackage.name}`);
120
- if (importedPackage.flavor) {
121
- logger_1.logger.info(`Flavor: ${importedPackage.flavor}`);
122
- }
123
- logger_1.logger.info(`Imported ${importedNodes.length} node(s).`);
124
- importedNodes.forEach(node => {
125
- logger_1.logger.info(` - ${node.key} (${node.type})`);
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ if (jsonResponse) {
114
+ const filename = (0, uuid_1.v4)() + ".json";
115
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(result, null, 2), filename);
116
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
117
+ return;
118
+ }
119
+ const importedPackage = result.importedPackage;
120
+ const importedNodes = (_a = result.importedNodes) !== null && _a !== void 0 ? _a : [];
121
+ logger_1.logger.info(`Successfully imported package: ${importedPackage.key}`);
122
+ logger_1.logger.info(`Name: ${importedPackage.name}`);
123
+ if (importedPackage.flavor) {
124
+ logger_1.logger.info(`Flavor: ${importedPackage.flavor}`);
125
+ }
126
+ logger_1.logger.info(`Imported ${importedNodes.length} node(s).`);
127
+ importedNodes.forEach(node => {
128
+ logger_1.logger.info(` - ${node.key} (${node.type})`);
129
+ });
126
130
  });
127
131
  }
128
132
  }
@@ -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/staging-package-api"], factory);
16
+ define(["require", "exports", "uuid", "../../core/utils/file-service", "../../core/utils/cui-file-service", "../../core/utils/logger", "./api/staging-package-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.StagingPackageService = 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 staging_package_api_1 = require("./api/staging-package-api");
26
27
  class StagingPackageService {
27
28
  constructor(context) {
28
29
  this.stagingPackageApi = new staging_package_api_1.StagingPackageApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  listStagingPackages(flavors, includeBranches, jsonResponse) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
32
34
  const stagingPackages = yield this.stagingPackageApi.findAllStagingPackages(flavors, includeBranches);
33
35
  if (jsonResponse) {
34
- this.exportListOfPackages(stagingPackages);
36
+ yield this.exportListOfPackages(stagingPackages);
35
37
  }
36
38
  else {
37
39
  stagingPackages.forEach(pkg => {
@@ -41,9 +43,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
43
  });
42
44
  }
43
45
  exportListOfPackages(packages) {
44
- const filename = (0, uuid_1.v4)() + ".json";
45
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packages), 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(packages), filename);
49
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
50
+ });
47
51
  }
48
52
  }
49
53
  exports.StagingPackageService = StagingPackageService;
@@ -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/logger", "./connection-variable.helper", "../../core/utils/file-service", "./api/variable-api", "url", "./api/variable-assignment-candidates-api", "./api/staging-package-variables-api"], factory);
16
+ define(["require", "exports", "uuid", "../../core/utils/logger", "./connection-variable.helper", "../../core/utils/file-service", "../../core/utils/cui-file-service", "./api/variable-api", "url", "./api/variable-assignment-candidates-api", "./api/staging-package-variables-api"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -23,6 +23,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
23
23
  const logger_1 = require("../../core/utils/logger");
24
24
  const connection_variable_helper_1 = require("./connection-variable.helper");
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 variable_api_1 = require("./api/variable-api");
27
28
  const url_1 = require("url");
28
29
  const variable_assignment_candidates_api_1 = require("./api/variable-assignment-candidates-api");
@@ -32,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
33
  this.variableApi = new variable_api_1.VariableApi(context);
33
34
  this.variableAssignmentCandidatesApi = new variable_assignment_candidates_api_1.VariableAssignmentCandidatesApi(context);
34
35
  this.stagingPackageVariablesApi = new staging_package_variables_api_1.StagingPackageVariablesApi(context);
36
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
35
37
  }
36
38
  listVariables(keysByVersion, keysByVersionFile) {
37
39
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,13 +56,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54
56
  return __awaiter(this, void 0, void 0, function* () {
55
57
  const parsedParams = this.parseParams(params);
56
58
  const assignments = yield this.variableAssignmentCandidatesApi.getCandidateAssignments(type, parsedParams);
57
- this.exportToJson(assignments);
59
+ yield this.exportToJson(assignments);
58
60
  });
59
61
  }
60
62
  exportVariables(keysByVersion, keysByVersionFile) {
61
63
  return __awaiter(this, void 0, void 0, function* () {
62
64
  const variableManifests = yield this.getVersionedVariablesByKeyVersionPairs(keysByVersion, keysByVersionFile);
63
- this.exportToJson(variableManifests);
65
+ yield this.exportToJson(variableManifests);
64
66
  });
65
67
  }
66
68
  listStagingVariables(packageKeys) {
@@ -74,7 +76,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
74
76
  exportStagingVariables(packageKeys) {
75
77
  return __awaiter(this, void 0, void 0, function* () {
76
78
  const byPackage = yield this.fetchStagingVariablesByPackageKeys(packageKeys);
77
- this.exportToJson(byPackage);
79
+ yield this.exportToJson(byPackage);
78
80
  });
79
81
  }
80
82
  fetchStagingVariablesByPackageKeys(packageKeys) {
@@ -112,9 +114,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
112
114
  });
113
115
  }
114
116
  exportToJson(data) {
115
- const filename = (0, uuid_1.v4)() + ".json";
116
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(data), filename);
117
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ const filename = (0, uuid_1.v4)() + ".json";
119
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(data), filename);
120
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
121
+ });
118
122
  }
119
123
  parseParams(params) {
120
124
  const queryParams = new url_1.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", "uuid", "../../../core/utils/file-service", "../../../core/utils/logger", "./data-pool-api"], factory);
16
+ define(["require", "exports", "uuid", "../../../core/utils/file-service", "../../../core/utils/cui-file-service", "../../../core/utils/logger", "./data-pool-api"], 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.DataPoolService = 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 data_pool_api_1 = require("./data-pool-api");
26
27
  class DataPoolService {
27
28
  constructor(context) {
28
29
  this.dataPoolApi = new data_pool_api_1.DataPoolApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
29
31
  }
30
32
  batchImportDataPools(requestFilePath, outputToJsonFile) {
31
33
  return __awaiter(this, void 0, void 0, function* () {
@@ -34,8 +36,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
36
  const importReportString = JSON.stringify(importReport, null, 4);
35
37
  if (outputToJsonFile) {
36
38
  const reportFileName = "batch_import_report_" + (0, uuid_1.v4)() + ".json";
37
- file_service_1.fileService.writeToFileWithGivenName(importReportString, reportFileName);
38
- logger_1.logger.info("Batch import report file: " + reportFileName);
39
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(importReportString, reportFileName);
40
+ logger_1.logger.info("Batch import report file: " + writtenFilename);
39
41
  }
40
42
  else {
41
43
  logger_1.logger.info("Batch import report: \n" + importReportString);
@@ -48,8 +50,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
48
50
  const exportedDataPoolString = JSON.stringify(exportedDataPool, null, 4);
49
51
  if (outputToJsonFile) {
50
52
  const reportFileName = (0, uuid_1.v4)() + "_data_pool_" + poolId + ".json";
51
- file_service_1.fileService.writeToFileWithGivenName(exportedDataPoolString, reportFileName);
52
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + reportFileName);
53
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(exportedDataPoolString, reportFileName);
54
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
53
55
  }
54
56
  else {
55
57
  logger_1.logger.info("Exported Data Pool: \n" + exportedDataPoolString);
@@ -67,7 +69,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67
69
  findAndExportAllPools() {
68
70
  return __awaiter(this, void 0, void 0, function* () {
69
71
  const dataPools = yield this.findAllPools();
70
- this.exportListOfPools(dataPools);
72
+ yield this.exportListOfPools(dataPools);
71
73
  });
72
74
  }
73
75
  findAllPools() {
@@ -83,9 +85,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
83
85
  });
84
86
  }
85
87
  exportListOfPools(nodes) {
86
- const filename = (0, uuid_1.v4)() + ".json";
87
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes), filename);
88
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const filename = (0, uuid_1.v4)() + ".json";
90
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodes), filename);
91
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
92
+ });
89
93
  }
90
94
  }
91
95
  exports.DataPoolService = DataPoolService;
@@ -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", "./deployment-api", "./deployment.interfaces", "../../core/utils/file-service", "../../core/utils/logger", "uuid"], factory);
16
+ define(["require", "exports", "./deployment-api", "./deployment.interfaces", "../../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";
@@ -22,11 +22,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  const deployment_api_1 = require("./deployment-api");
23
23
  const deployment_interfaces_1 = require("./deployment.interfaces");
24
24
  const file_service_1 = require("../../core/utils/file-service");
25
+ const cui_file_service_1 = require("../../core/utils/cui-file-service");
25
26
  const logger_1 = require("../../core/utils/logger");
26
27
  const uuid_1 = require("uuid");
27
28
  class DeploymentService {
28
29
  constructor(context) {
29
30
  this.deploymentApi = new deployment_api_1.DeploymentApi(context);
31
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
30
32
  }
31
33
  createDeployment(packageKey, packageVersion, deployableType, targetId, jsonResponse) {
32
34
  return __awaiter(this, void 0, void 0, function* () {
@@ -39,8 +41,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
39
41
  const deployment = yield this.deploymentApi.createDeployment(request);
40
42
  if (jsonResponse) {
41
43
  const filename = (0, uuid_1.v4)() + ".json";
42
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(deployment), filename);
43
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
44
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(deployment), filename);
45
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
44
46
  }
45
47
  else {
46
48
  logger_1.logger.info(`Deployment created with ID: ${deployment.id}, Status: ${deployment.status}`);
@@ -59,8 +61,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59
61
  const deployments = yield this.deploymentApi.getDeployments(filter, limit, offset);
60
62
  if (jsonResponse) {
61
63
  const filename = (0, uuid_1.v4)() + ".json";
62
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(deployments), filename);
63
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
64
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(deployments), filename);
65
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
64
66
  }
65
67
  else {
66
68
  deployments.forEach(deployment => {
@@ -74,8 +76,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
74
76
  const deployment = yield this.deploymentApi.getActiveDeploymentForTarget(targetId);
75
77
  if (jsonResponse) {
76
78
  const filename = (0, uuid_1.v4)() + ".json";
77
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(deployment), filename);
78
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
79
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(deployment), filename);
80
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
79
81
  }
80
82
  else {
81
83
  logger_1.logger.info(`ID: ${deployment.id}, Package: ${deployment.packageKey}, Version: ${deployment.packageVersion}, Status: ${deployment.status}, Deployed at: ${new Date(deployment.deployedAt).toISOString()}`);
@@ -87,8 +89,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
87
89
  const deployments = yield this.deploymentApi.getActiveDeploymentsForPackage(packageKey, targetIds, limit, offset);
88
90
  if (jsonResponse) {
89
91
  const filename = (0, uuid_1.v4)() + ".json";
90
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(deployments), filename);
91
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
92
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(deployments), filename);
93
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
92
94
  }
93
95
  else {
94
96
  deployments.forEach(deployment => {
@@ -102,8 +104,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
102
104
  const targets = yield this.deploymentApi.getTargets(deployableType, packageKey);
103
105
  if (jsonResponse) {
104
106
  const filename = (0, uuid_1.v4)() + ".json";
105
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(targets), filename);
106
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
107
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(targets), filename);
108
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
107
109
  }
108
110
  else {
109
111
  targets.forEach(target => {
@@ -117,8 +119,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
117
119
  const deployables = yield this.deploymentApi.getDeployables(flavor);
118
120
  if (jsonResponse) {
119
121
  const filename = (0, uuid_1.v4)() + ".json";
120
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(deployables), filename);
121
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
122
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(deployables), filename);
123
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
122
124
  }
123
125
  else {
124
126
  deployables.forEach(deployable => {
@@ -1,3 +1,12 @@
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
+ };
1
10
  (function (factory) {
2
11
  if (typeof module === "object" && typeof module.exports === "object") {
3
12
  var v = factory(require, exports);
@@ -30,16 +39,18 @@
30
39
  };
31
40
  }
32
41
  listSpaces(nodes) {
33
- if (this.jsonResponse) {
34
- const filename = (0, uuid_1.v4)() + ".json";
35
- this.writeToFileWithGivenName(JSON.stringify(nodes, ["id", "name"]), filename);
36
- logger_1.logger.info(this.fileDownloadedMessage + filename);
37
- }
38
- else {
39
- nodes.forEach(node => {
40
- logger_1.logger.info(`${node.id} - Name: "${node.name}"`);
41
- });
42
- }
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ if (this.jsonResponse) {
44
+ const filename = (0, uuid_1.v4)() + ".json";
45
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodes, ["id", "name"]), filename);
46
+ logger_1.logger.info(this.fileDownloadedMessage + writtenFilename);
47
+ }
48
+ else {
49
+ nodes.forEach(node => {
50
+ logger_1.logger.info(`${node.id} - Name: "${node.name}"`);
51
+ });
52
+ }
53
+ });
43
54
  }
44
55
  getBody() {
45
56
  return {};