@celonis/content-cli 1.13.1 → 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 (88) hide show
  1. package/README.md +17 -5
  2. package/commands/action-flows/action-flow/action-flow.service.js +9 -9
  3. package/commands/action-flows/module.js +2 -1
  4. package/commands/asset-registry/asset-registry-api.js +1 -30
  5. package/commands/asset-registry/asset-registry.service.js +20 -67
  6. package/commands/asset-registry/module.js +0 -26
  7. package/commands/bookmarks/bookmarks-api.js +49 -0
  8. package/commands/bookmarks/bookmarks-command.service.js +48 -0
  9. package/{core/utils/path.js → commands/bookmarks/bookmarks.interfaces.js} +0 -5
  10. package/commands/bookmarks/module.js +49 -0
  11. package/commands/configuration-management/api/node-api.js +17 -0
  12. package/commands/configuration-management/branch/api/branch.api.js +88 -0
  13. package/commands/configuration-management/branch/branch-export-import.command.service.js +283 -0
  14. package/commands/configuration-management/branch/branch.command.service.js +182 -0
  15. package/commands/configuration-management/branch/interfaces/branch.interfaces.js +41 -0
  16. package/commands/configuration-management/metadata.service.js +9 -5
  17. package/commands/configuration-management/module.js +170 -6
  18. package/commands/configuration-management/node-dependency.service.js +5 -3
  19. package/commands/configuration-management/node-diff.service.js +10 -6
  20. package/commands/configuration-management/node.service.js +14 -10
  21. package/commands/configuration-management/package-validation.service.js +11 -5
  22. package/commands/configuration-management/package-version.service.js +7 -5
  23. package/commands/configuration-management/single-package-export.service.js +6 -6
  24. package/commands/configuration-management/single-package-import.service.js +28 -24
  25. package/commands/configuration-management/staging-package.service.js +9 -5
  26. package/commands/configuration-management/variable.service.js +11 -7
  27. package/commands/data-pipeline/connection/connection.commands.js +4 -2
  28. package/commands/data-pipeline/data-pool/data-pool-service.js +13 -9
  29. package/commands/data-pipeline/data-pool/data-pool.commands.js +2 -1
  30. package/commands/deployment/deployment.service.js +15 -13
  31. package/commands/deployment/module.js +4 -7
  32. package/commands/studio/manager/space.manager.js +21 -10
  33. package/commands/studio/service/asset-service.js +5 -4
  34. package/commands/studio/service/package.service.js +9 -5
  35. package/commands/t2tc/diff.service.js +15 -9
  36. package/commands/t2tc/t2tc-package.service.js +25 -23
  37. package/content-cli.js +4 -0
  38. package/core/command/module-handler.js +8 -1
  39. package/core/feature-flag/feature-disabled-error.js +52 -0
  40. package/core/http/http-client.js +18 -0
  41. package/core/http/http-shared/base.manager.js +35 -59
  42. package/core/utils/branches.js +10 -0
  43. package/core/utils/cui-api.js +52 -0
  44. package/core/utils/cui-file-service.js +106 -0
  45. package/core/utils/file-service.js +7 -13
  46. package/lib/commands/action-flows/action-flow/action-flow.service.d.ts +1 -0
  47. package/lib/commands/asset-registry/asset-registry-api.d.ts +2 -6
  48. package/lib/commands/asset-registry/asset-registry.interfaces.d.ts +0 -17
  49. package/lib/commands/asset-registry/asset-registry.service.d.ts +3 -6
  50. package/lib/commands/asset-registry/module.d.ts +0 -2
  51. package/lib/commands/bookmarks/bookmarks-api.d.ts +8 -0
  52. package/lib/commands/bookmarks/bookmarks-command.service.d.ts +8 -0
  53. package/lib/commands/bookmarks/bookmarks.interfaces.d.ts +34 -0
  54. package/lib/commands/bookmarks/module.d.ts +8 -0
  55. package/lib/commands/configuration-management/api/node-api.d.ts +1 -0
  56. package/lib/commands/configuration-management/branch/api/branch.api.d.ts +12 -0
  57. package/lib/commands/configuration-management/branch/branch-export-import.command.service.d.ts +37 -0
  58. package/lib/commands/configuration-management/branch/branch.command.service.d.ts +19 -0
  59. package/lib/commands/configuration-management/branch/interfaces/branch.interfaces.d.ts +139 -0
  60. package/lib/commands/configuration-management/interfaces/package-validation.interfaces.d.ts +1 -1
  61. package/lib/commands/configuration-management/metadata.service.d.ts +1 -0
  62. package/lib/commands/configuration-management/module.d.ts +8 -0
  63. package/lib/commands/configuration-management/node-dependency.service.d.ts +1 -0
  64. package/lib/commands/configuration-management/node-diff.service.d.ts +1 -0
  65. package/lib/commands/configuration-management/node.service.d.ts +2 -1
  66. package/lib/commands/configuration-management/package-validation.service.d.ts +1 -0
  67. package/lib/commands/configuration-management/package-version.service.d.ts +1 -0
  68. package/lib/commands/configuration-management/single-package-export.service.d.ts +1 -0
  69. package/lib/commands/configuration-management/single-package-import.service.d.ts +6 -3
  70. package/lib/commands/configuration-management/staging-package.service.d.ts +1 -0
  71. package/lib/commands/configuration-management/variable.service.d.ts +1 -0
  72. package/lib/commands/data-pipeline/data-pool/data-pool-service.d.ts +1 -0
  73. package/lib/commands/deployment/deployment.service.d.ts +1 -0
  74. package/lib/commands/studio/service/asset-service.d.ts +1 -0
  75. package/lib/commands/studio/service/package.service.d.ts +1 -0
  76. package/lib/commands/t2tc/diff.service.d.ts +1 -0
  77. package/lib/commands/t2tc/t2tc-package.service.d.ts +1 -0
  78. package/lib/core/command/module-handler.d.ts +4 -4
  79. package/lib/core/feature-flag/feature-disabled-error.d.ts +16 -0
  80. package/lib/core/http/http-client.d.ts +4 -0
  81. package/lib/core/http/http-shared/base.manager.d.ts +7 -5
  82. package/lib/core/http/http-shared/manager-config.interface.d.ts +1 -1
  83. package/lib/core/utils/branches.d.ts +3 -0
  84. package/lib/core/utils/cui-api.d.ts +26 -0
  85. package/lib/core/utils/cui-file-service.d.ts +19 -0
  86. package/lib/core/utils/file-service.d.ts +0 -1
  87. package/package.json +3 -3
  88. package/lib/core/utils/path.d.ts +0 -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", "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* () {
@@ -53,9 +55,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
53
55
  }
54
56
  try {
55
57
  const packageZip = new AdmZip(resolvedSource.zipPath);
56
- const formData = this.buildBodyForImport(packageZip, resolvedSource.zipPath);
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) {
@@ -85,19 +87,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
85
87
  }
86
88
  return { zipPath: file_service_1.fileService.zipDirectoryAsSinglePackage(directory), isTemporary: true };
87
89
  }
88
- buildBodyForImport(packageZip, sourcePath) {
89
- this.assertUncompressedSizeWithinLimit(packageZip, sourcePath);
90
+ static buildBodyForImport(packageZip, sourcePath) {
91
+ SinglePackageImportService.assertUncompressedSizeWithinLimit(packageZip, sourcePath);
90
92
  const formData = new FormData();
91
- formData.append("packageFile", this.getReadableStream(packageZip), { filename: "package.zip" });
93
+ formData.append("packageFile", SinglePackageImportService.getReadableStream(packageZip), { filename: "package.zip" });
92
94
  return formData;
93
95
  }
94
- assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
96
+ static assertUncompressedSizeWithinLimit(packageZip, sourcePath) {
95
97
  const totalUncompressedBytes = packageZip.getEntries().reduce((sum, entry) => sum + entry.header.size, 0);
96
98
  if (totalUncompressedBytes > SinglePackageImportService.MAX_UNCOMPRESSED_ZIP_SIZE) {
97
99
  throw new Error(`Failed to handle zip file "${sourcePath}": uncompressed size ${(totalUncompressedBytes / (Math.pow(1024, 3))).toFixed(2)} GB exceeds the 4 GB limit.`);
98
100
  }
99
101
  }
100
- getReadableStream(packageZip) {
102
+ static getReadableStream(packageZip) {
101
103
  return new node_stream_1.Readable({
102
104
  read() {
103
105
  this.push(packageZip.toBuffer());
@@ -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();
@@ -30,13 +30,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
30
30
  .description("Command to list all connections in a Data Pool")
31
31
  .requiredOption("--dataPoolId <dataPoolId>", "ID of the data pool")
32
32
  .action(this.listConnections);
33
- const getCommand = configurator.command("get");
33
+ const getCommand = configurator.command("get")
34
+ .description("get data pool connection");
34
35
  getCommand.command("connection")
35
36
  .description("Programmatically read properties of your connections")
36
37
  .requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
37
38
  .requiredOption("--connectionId <connectionId>", "Id of the connection you want to update")
38
39
  .action(this.getCommandProperties);
39
- const setCommand = configurator.command("set");
40
+ const setCommand = configurator.command("set")
41
+ .description("set data pool connection");
40
42
  setCommand.command("connection")
41
43
  .description("Programmatically update properties of your connections")
42
44
  .requiredOption("--dataPoolId <dataPoolId>", "Id of the data pool you want to update")
@@ -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;
@@ -52,7 +52,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
52
52
  pushCommand.command("data-pools")
53
53
  .description("Command to push data pools")
54
54
  .action(this.pushDataPools);
55
- const updateCommand = configurator.command("update");
55
+ const updateCommand = configurator.command("update")
56
+ .description("Update data pool");
56
57
  updateCommand.command("data-pool")
57
58
  .description("Command to update a data pool using a data pool configuration file")
58
59
  .requiredOption("--id <id>", "Id of the data pool you want to update")
@@ -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 => {
@@ -21,9 +21,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  const deployment_service_1 = require("./deployment.service");
22
22
  class Module extends module_handler_1.IModule {
23
23
  register(context, configurator) {
24
- const deploymentCommand = configurator.command("deployment").beta();
24
+ const deploymentCommand = configurator.command("deployment")
25
+ .description("Create deployments, list their history, check active deployments, and retrieve deployables and targets");
25
26
  deploymentCommand.command("create")
26
- .beta()
27
27
  .description("Create a new deployment")
28
28
  .requiredOption("--packageKey <packageKey>", "Identifier of the package to deploy")
29
29
  .requiredOption("--packageVersion <packageVersion>", "Version of the package to deploy")
@@ -31,9 +31,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  .requiredOption("--targetId <targetId>", "Identifier of the target to deploy to")
32
32
  .option("--json", "Return the response as a JSON file")
33
33
  .action(this.createDeployment);
34
- const listCommand = deploymentCommand.command("list").beta();
34
+ const listCommand = deploymentCommand.command("list")
35
+ .description("List deployment history, active deployments, deployables or targets");
35
36
  listCommand.command("history")
36
- .beta()
37
37
  .description("List deployment history")
38
38
  .option("--packageKey <packageKey>", "Filter deployment history by package key")
39
39
  .option("--targetId <targetId>", "Filter deployment history by target ID")
@@ -45,7 +45,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
45
  .option("--json", "Return the response as a JSON file")
46
46
  .action(this.listDeploymentHistory);
47
47
  listCommand.command("active")
48
- .beta()
49
48
  .description("Get the active deployment(s) for a given target or package.\n" +
50
49
  "You can use the command to list the active deployment(s) for a specific target or for a specific package.\n" +
51
50
  "The targetIds filter is available only for getting the active deployments for a given package. \n" +
@@ -58,13 +57,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
58
57
  .option("--json", "Return the response as a JSON file")
59
58
  .action(this.listActiveDeployments);
60
59
  listCommand.command("deployables")
61
- .beta()
62
60
  .description("List all deployables")
63
61
  .option("--flavor <flavor>", "Filter deployables by flavor")
64
62
  .option("--json", "Return the response as a JSON file")
65
63
  .action(this.listDeployables);
66
64
  listCommand.command("targets")
67
- .beta()
68
65
  .description("List all targets for a given deployable type and package key")
69
66
  .requiredOption("--deployableType <deployableType>", "The type of the deployable")
70
67
  .requiredOption("--packageKey <packageKey>", "Identifier of the package to list targets for")
@@ -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 {};
@@ -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/asset-api", "../../../core/utils/logger", "../../../core/utils/file-service"], factory);
16
+ define(["require", "exports", "uuid", "../api/asset-api", "../../../core/utils/logger", "../../../core/utils/cui-file-service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -22,11 +22,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  const uuid_1 = require("uuid");
23
23
  const asset_api_1 = require("../api/asset-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 AssetService {
27
27
  constructor(context) {
28
28
  this.fileDownloadedMessage = "File downloaded successfully. New filename: ";
29
29
  this.assetApi = new asset_api_1.AssetApi(context);
30
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
30
31
  }
31
32
  listAssets(assetType) {
32
33
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,8 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
42
  const fieldsToInclude = ["key", "name", "assetType", "rootNodeKey", "activatedDraftId"];
42
43
  const nodes = yield this.assetApi.findAllAssets(assetType);
43
44
  const filename = (0, uuid_1.v4)() + ".json";
44
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
45
- logger_1.logger.info(this.fileDownloadedMessage + filename);
45
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
46
+ logger_1.logger.info(this.fileDownloadedMessage + writtenFilename);
46
47
  });
47
48
  }
48
49
  }
@@ -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-api", "../../../core/utils/logger", "../interfaces/package-manager.interfaces", "../../../core/utils/file-service", "../api/package-dependencies-api", "./data-model.service", "./studio-variable.service"], factory);
16
+ define(["require", "exports", "uuid", "../api/package-api", "../../../core/utils/logger", "../interfaces/package-manager.interfaces", "../../../core/utils/file-service", "../../../core/utils/cui-file-service", "../api/package-dependencies-api", "./data-model.service", "./studio-variable.service"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  const logger_1 = require("../../../core/utils/logger");
25
25
  const package_manager_interfaces_1 = require("../interfaces/package-manager.interfaces");
26
26
  const file_service_1 = require("../../../core/utils/file-service");
27
+ const cui_file_service_1 = require("../../../core/utils/cui-file-service");
27
28
  const package_dependencies_api_1 = require("../api/package-dependencies-api");
28
29
  const data_model_service_1 = require("./data-model.service");
29
30
  const studio_variable_service_1 = require("./studio-variable.service");
@@ -34,6 +35,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
34
35
  this.packageDependenciesApi = new package_dependencies_api_1.PackageDependenciesApi(context);
35
36
  this.dataModelService = new data_model_service_1.DataModelService(context);
36
37
  this.variableService = new studio_variable_service_1.StudioVariableService(context);
38
+ this.cuiFileService = new cui_file_service_1.CuiFileService(context);
37
39
  }
38
40
  listPackages() {
39
41
  return __awaiter(this, void 0, void 0, function* () {
@@ -70,7 +72,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
70
72
  return nodeToExport;
71
73
  });
72
74
  }
73
- this.exportListOfPackages(nodesListToExport, fieldsToInclude);
75
+ yield this.exportListOfPackages(nodesListToExport, fieldsToInclude);
74
76
  });
75
77
  }
76
78
  getNodesWithActiveVersion(nodes) {
@@ -88,9 +90,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
88
90
  });
89
91
  }
90
92
  exportListOfPackages(nodes, fieldsToInclude) {
91
- const filename = (0, uuid_1.v4)() + ".json";
92
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
93
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const filename = (0, uuid_1.v4)() + ".json";
95
+ const writtenFilename = yield this.cuiFileService.writeToFileWithGivenName(JSON.stringify(nodes, fieldsToInclude), filename);
96
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + writtenFilename);
97
+ });
94
98
  }
95
99
  }
96
100
  exports.PackageService = PackageService;