@celonis/content-cli 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/commands/configuration-management/api/metadata-api.js +38 -0
  2. package/commands/configuration-management/api/{diff-api.js → single-package-import-api.js} +5 -10
  3. package/commands/configuration-management/api/staging-package-api.js +39 -0
  4. package/commands/configuration-management/api/variable-api.js +36 -0
  5. package/commands/configuration-management/config-command.service.js +1 -63
  6. package/commands/configuration-management/connection-variable.helper.js +30 -0
  7. package/commands/configuration-management/interfaces/single-package-import.interfaces.js +12 -0
  8. package/commands/configuration-management/metadata.service.js +50 -0
  9. package/commands/configuration-management/module.js +58 -15
  10. package/commands/configuration-management/single-package-import.service.js +111 -0
  11. package/commands/configuration-management/staging-package.service.js +50 -0
  12. package/commands/configuration-management/variable.service.js +6 -7
  13. package/commands/t2tc/api/diff-api.js +40 -0
  14. package/commands/{configuration-management/api/batch-import-export-api.js → t2tc/api/t2tc-package-api.js} +3 -29
  15. package/commands/{configuration-management → t2tc}/diff.service.js +7 -7
  16. package/commands/t2tc/module.js +105 -0
  17. package/commands/{configuration-management → t2tc}/studio.service.js +2 -17
  18. package/commands/t2tc/t2tc-command.service.js +88 -0
  19. package/commands/{configuration-management/batch-import-export.service.js → t2tc/t2tc-package.service.js} +22 -50
  20. package/commands/view/module.js +54 -0
  21. package/commands/view/view-bookmarks-command.service.js +45 -0
  22. package/commands/view/view-bookmarks.manager-factory.js +39 -0
  23. package/commands/view/view-bookmarks.manager.js +60 -0
  24. package/core/utils/file-service.js +12 -0
  25. package/lib/commands/configuration-management/api/metadata-api.d.ts +7 -0
  26. package/lib/commands/configuration-management/api/single-package-import-api.d.ts +8 -0
  27. package/lib/commands/configuration-management/api/staging-package-api.d.ts +7 -0
  28. package/lib/commands/configuration-management/api/variable-api.d.ts +7 -0
  29. package/lib/commands/configuration-management/config-command.service.d.ts +0 -8
  30. package/lib/commands/configuration-management/connection-variable.helper.d.ts +2 -0
  31. package/lib/commands/configuration-management/interfaces/single-package-import.interfaces.d.ts +19 -0
  32. package/lib/commands/configuration-management/metadata.service.d.ts +7 -0
  33. package/lib/commands/configuration-management/module.d.ts +3 -1
  34. package/lib/commands/configuration-management/single-package-import.service.d.ts +12 -0
  35. package/lib/commands/configuration-management/staging-package.service.d.ts +7 -0
  36. package/lib/commands/configuration-management/variable.service.d.ts +1 -2
  37. package/lib/commands/t2tc/api/diff-api.d.ts +9 -0
  38. package/lib/commands/{configuration-management/api/batch-import-export-api.d.ts → t2tc/api/t2tc-package-api.d.ts} +3 -6
  39. package/lib/commands/{configuration-management → t2tc}/diff.service.d.ts +1 -1
  40. package/lib/commands/t2tc/module.d.ts +10 -0
  41. package/lib/commands/{configuration-management → t2tc}/studio.service.d.ts +1 -3
  42. package/lib/commands/t2tc/t2tc-command.service.d.ts +12 -0
  43. package/lib/commands/{configuration-management/batch-import-export.service.d.ts → t2tc/t2tc-package.service.d.ts} +3 -5
  44. package/lib/commands/view/module.d.ts +11 -0
  45. package/lib/commands/view/view-bookmarks-command.service.d.ts +7 -0
  46. package/lib/commands/view/view-bookmarks.manager-factory.d.ts +8 -0
  47. package/lib/commands/view/view-bookmarks.manager.d.ts +20 -0
  48. package/lib/core/utils/file-service.d.ts +1 -0
  49. package/package.json +1 -1
  50. package/lib/commands/configuration-management/api/diff-api.d.ts +0 -9
  51. /package/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.js +0 -0
  52. /package/lib/commands/{configuration-management/interfaces → t2tc}/batch-export-import.constants.d.ts +0 -0
@@ -13,65 +13,55 @@ 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", "stream", "adm-zip", "./interfaces/batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/batch-import-export-api", "./studio.service", "../../core/git-profile/git/git.service", "fs", "../../core/utils/file.constants"], factory);
16
+ define(["require", "exports", "uuid", "form-data", "stream", "adm-zip", "./batch-export-import.constants", "../../core/utils/file-service", "../../core/utils/logger", "../../core/utils/json", "../studio/api/package-api", "./api/t2tc-package-api", "../configuration-management/api/variable-api", "../configuration-management/connection-variable.helper", "./studio.service", "../../core/git-profile/git/git.service", "fs", "../../core/utils/file.constants"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.BatchImportExportService = void 0;
21
+ exports.T2tcPackageService = void 0;
22
22
  const uuid_1 = require("uuid");
23
23
  const FormData = require("form-data");
24
24
  const stream_1 = require("stream");
25
25
  const AdmZip = require("adm-zip");
26
- const batch_export_import_constants_1 = require("./interfaces/batch-export-import.constants");
26
+ const batch_export_import_constants_1 = require("./batch-export-import.constants");
27
27
  const file_service_1 = require("../../core/utils/file-service");
28
28
  const logger_1 = require("../../core/utils/logger");
29
29
  const json_1 = require("../../core/utils/json");
30
30
  const package_api_1 = require("../studio/api/package-api");
31
- const batch_import_export_api_1 = require("./api/batch-import-export-api");
31
+ const t2tc_package_api_1 = require("./api/t2tc-package-api");
32
+ const variable_api_1 = require("../configuration-management/api/variable-api");
33
+ const connection_variable_helper_1 = require("../configuration-management/connection-variable.helper");
32
34
  const studio_service_1 = require("./studio.service");
33
35
  const git_service_1 = require("../../core/git-profile/git/git.service");
34
36
  const fs = require("fs");
35
37
  const file_constants_1 = require("../../core/utils/file.constants");
36
- class BatchImportExportService {
38
+ class T2tcPackageService {
37
39
  constructor(context) {
38
- this.batchImportExportApi = new batch_import_export_api_1.BatchImportExportApi(context);
40
+ this.t2tcPackageApi = new t2tc_package_api_1.T2tcPackageApi(context);
41
+ this.variableApi = new variable_api_1.VariableApi(context);
39
42
  this.studioPackageApi = new package_api_1.PackageApi(context);
40
43
  this.studioService = new studio_service_1.StudioService(context);
41
44
  this.gitService = new git_service_1.GitService(context);
42
45
  }
43
46
  listActivePackages(flavors, includeBranches) {
44
47
  return __awaiter(this, void 0, void 0, function* () {
45
- const activePackages = yield this.batchImportExportApi.findAllActivePackages(flavors, false, includeBranches);
48
+ const activePackages = yield this.t2tcPackageApi.findAllActivePackages(flavors, false, includeBranches);
46
49
  activePackages.forEach(pkg => {
47
50
  logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
48
51
  });
49
52
  });
50
53
  }
51
- listStagingPackages(flavors, includeBranches, jsonResponse) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- const stagingPackages = yield this.batchImportExportApi.findAllStagingPackages(flavors, includeBranches);
54
- if (jsonResponse) {
55
- this.exportListOfPackages(stagingPackages);
56
- }
57
- else {
58
- stagingPackages.forEach(pkg => {
59
- logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
60
- });
61
- }
62
- });
63
- }
64
54
  findAndExportListOfPackages(flavors, packageKeys, keysByVersion, withDependencies, includeBranches) {
65
55
  return __awaiter(this, void 0, void 0, function* () {
66
56
  let packagesToExport;
67
57
  if (keysByVersion.length) {
68
- packagesToExport = yield this.batchImportExportApi.findPackagesByKeysAndVersion(keysByVersion, withDependencies);
58
+ packagesToExport = yield this.t2tcPackageApi.findPackagesByKeysAndVersion(keysByVersion, withDependencies);
69
59
  }
70
60
  else if (packageKeys.length) {
71
- packagesToExport = yield this.batchImportExportApi.findActivePackagesByKeys(packageKeys, withDependencies);
61
+ packagesToExport = yield this.t2tcPackageApi.findActivePackagesByKeys(packageKeys, withDependencies);
72
62
  }
73
63
  else {
74
- packagesToExport = yield this.batchImportExportApi.findAllActivePackages(flavors, withDependencies, includeBranches);
64
+ packagesToExport = yield this.t2tcPackageApi.findAllActivePackages(flavors, withDependencies, includeBranches);
75
65
  }
76
66
  packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, withDependencies);
77
67
  this.exportListOfPackages(packagesToExport);
@@ -79,7 +69,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
79
69
  }
80
70
  listPackagesByKeysWithVersion(keysByVersion, withDependencies) {
81
71
  return __awaiter(this, void 0, void 0, function* () {
82
- const exportedPackages = yield this.batchImportExportApi.findPackagesByKeysAndVersion(keysByVersion, withDependencies);
72
+ const exportedPackages = yield this.t2tcPackageApi.findPackagesByKeysAndVersion(keysByVersion, withDependencies);
83
73
  exportedPackages.forEach(pkg => {
84
74
  logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
85
75
  });
@@ -89,16 +79,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
89
79
  return __awaiter(this, void 0, void 0, function* () {
90
80
  let exportedPackagesData;
91
81
  if (packageKeys) {
92
- exportedPackagesData = yield this.batchImportExportApi.exportPackages(packageKeys, withDependencies);
82
+ exportedPackagesData = yield this.t2tcPackageApi.exportPackages(packageKeys, withDependencies);
93
83
  }
94
84
  else {
95
- exportedPackagesData = yield this.batchImportExportApi.exportPackagesByVersions(packageKeysByVersion, withDependencies);
85
+ exportedPackagesData = yield this.t2tcPackageApi.exportPackagesByVersions(packageKeysByVersion, withDependencies);
96
86
  }
97
87
  const exportedPackagesZip = new AdmZip(exportedPackagesData);
98
88
  const manifest = (0, json_1.parse)(exportedPackagesZip.getEntry(batch_export_import_constants_1.BatchExportImportConstants.MANIFEST_FILE_NAME).getData().toString());
99
89
  const versionsByPackageKey = this.getVersionsByPackageKey(manifest);
100
90
  let exportedVariables = yield this.getVersionedVariablesForPackagesWithKeys(versionsByPackageKey);
101
- exportedVariables = this.studioService.fixConnectionVariables(exportedVariables);
91
+ exportedVariables = (0, connection_variable_helper_1.fixConnectionVariables)(exportedVariables);
102
92
  exportedPackagesZip.addFile(batch_export_import_constants_1.BatchExportImportConstants.VARIABLES_FILE_NAME, Buffer.from((0, json_1.stringify)(exportedVariables), "utf8"), "", file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS);
103
93
  const studioPackageKeys = manifest.filter(packageManifest => packageManifest.flavor === batch_export_import_constants_1.BatchExportImportConstants.STUDIO)
104
94
  .map(packageManifest => packageManifest.packageKey);
@@ -125,19 +115,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
125
115
  }
126
116
  });
127
117
  }
128
- batchExportPackagesMetadata(packageKeys, jsonResponse) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- const exportedPackagesMetadata = yield this.batchImportExportApi.batchExportPackagesMetadata(packageKeys);
131
- if (jsonResponse) {
132
- this.exportListOfPackagesMetadata(exportedPackagesMetadata);
133
- }
134
- else {
135
- exportedPackagesMetadata.forEach(pkg => {
136
- logger_1.logger.info(`${pkg.key} - Has Unpublished Changes: ${pkg.hasUnpublishedChanges}`);
137
- });
138
- }
139
- });
140
- }
141
118
  batchImportPackages(sourcePath, overwrite, gitBranch, performValidation = false) {
142
119
  return __awaiter(this, void 0, void 0, function* () {
143
120
  let sourceToBeImported;
@@ -158,7 +135,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
158
135
  configs = yield this.studioService.mapSpaces(configs, studioManifests);
159
136
  const existingStudioPackages = yield this.studioPackageApi.findAllPackages();
160
137
  const formData = this.buildBodyForImport(configs, sourceToBeImported, variablesManifests);
161
- const postPackageImportData = yield this.batchImportExportApi.importPackages(formData, overwrite, performValidation);
138
+ const postPackageImportData = yield this.t2tcPackageApi.importPackages(formData, overwrite, performValidation);
162
139
  yield this.studioService.processImportedPackages(configs, existingStudioPackages, studioManifests);
163
140
  if (gitBranch) {
164
141
  fs.rmSync(temporaryGitFolder, { recursive: true });
@@ -171,14 +148,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
171
148
  }
172
149
  findAndExportListOfActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches) {
173
150
  return __awaiter(this, void 0, void 0, function* () {
174
- let packagesToExport = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
151
+ let packagesToExport = yield this.t2tcPackageApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
175
152
  packagesToExport = yield this.studioService.getExportPackagesWithStudioData(packagesToExport, false);
176
153
  this.exportListOfPackages(packagesToExport);
177
154
  });
178
155
  }
179
156
  listActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches) {
180
157
  return __awaiter(this, void 0, void 0, function* () {
181
- const packagesByVariableValue = yield this.batchImportExportApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
158
+ const packagesByVariableValue = yield this.t2tcPackageApi.findActivePackagesByVariableValue(flavors, variableValue, variableType, includeBranches);
182
159
  packagesByVariableValue.forEach(pkg => {
183
160
  logger_1.logger.info(`${pkg.name} - Key: "${pkg.key}"`);
184
161
  });
@@ -206,12 +183,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
206
183
  });
207
184
  });
208
185
  });
209
- return this.batchImportExportApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
210
- }
211
- exportListOfPackagesMetadata(packagesMetadata) {
212
- const filename = (0, uuid_1.v4)() + ".json";
213
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(packagesMetadata), filename);
214
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
186
+ return this.variableApi.findVariablesWithValuesByPackageKeysAndVersion(variableExportRequest);
215
187
  }
216
188
  buildBodyForImport(configs, sourcePath, variablesManifests) {
217
189
  const formData = new FormData();
@@ -262,5 +234,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
262
234
  }
263
235
  }
264
236
  }
265
- exports.BatchImportExportService = BatchImportExportService;
237
+ exports.T2tcPackageService = T2tcPackageService;
266
238
  });
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Commands related to the View feature.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ (function (factory) {
14
+ if (typeof module === "object" && typeof module.exports === "object") {
15
+ var v = factory(require, exports);
16
+ if (v !== undefined) module.exports = v;
17
+ }
18
+ else if (typeof define === "function" && define.amd) {
19
+ define(["require", "exports", "../../core/command/module-handler", "./view-bookmarks-command.service"], factory);
20
+ }
21
+ })(function (require, exports) {
22
+ "use strict";
23
+ const module_handler_1 = require("../../core/command/module-handler");
24
+ const view_bookmarks_command_service_1 = require("./view-bookmarks-command.service");
25
+ class Module extends module_handler_1.IModule {
26
+ register(context, configurator) {
27
+ const pullCommand = configurator.command("pull");
28
+ pullCommand
29
+ .command("view-bookmarks")
30
+ .description("Command to pull view bookmarks")
31
+ .option("--type <type>", "Type of view bookmarks to pull: USER (default), SHARED, or ALL")
32
+ .requiredOption("--id <id>", "ID of the view (board) to pull bookmarks from")
33
+ .action(this.pullViewBookmarks);
34
+ const pushCommand = configurator.command("push");
35
+ pushCommand
36
+ .command("view-bookmarks")
37
+ .description("Command to push view bookmarks to a board")
38
+ .requiredOption("--id <id>", "ID of the view (board) to push bookmarks into")
39
+ .requiredOption("-f, --file <file>", "The file to push")
40
+ .action(this.pushViewBookmarks);
41
+ }
42
+ pullViewBookmarks(context, command, options) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ yield new view_bookmarks_command_service_1.ViewBookmarksCommandService(context).pullViewBookmarks(options.id, options.type);
45
+ });
46
+ }
47
+ pushViewBookmarks(context, command, options) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ yield new view_bookmarks_command_service_1.ViewBookmarksCommandService(context).pushViewBookmarks(options.id, options.file);
50
+ });
51
+ }
52
+ }
53
+ return Module;
54
+ });
@@ -0,0 +1,45 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ (function (factory) {
11
+ if (typeof module === "object" && typeof module.exports === "object") {
12
+ var v = factory(require, exports);
13
+ if (v !== undefined) module.exports = v;
14
+ }
15
+ else if (typeof define === "function" && define.amd) {
16
+ define(["require", "exports", "./view-bookmarks.manager-factory", "../../core/utils/logger"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ViewBookmarksCommandService = void 0;
22
+ const view_bookmarks_manager_factory_1 = require("./view-bookmarks.manager-factory");
23
+ const logger_1 = require("../../core/utils/logger");
24
+ const ALLOWED_VIEW_BOOKMARK_TYPES = ["USER", "SHARED", "ALL"];
25
+ class ViewBookmarksCommandService {
26
+ constructor(context) {
27
+ this.viewBookmarksManagerFactory = new view_bookmarks_manager_factory_1.ViewBookmarksManagerFactory(context);
28
+ }
29
+ pullViewBookmarks(boardId, type) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ if (type !== undefined && !ALLOWED_VIEW_BOOKMARK_TYPES.includes(type.toUpperCase())) {
32
+ logger_1.logger.error(new logger_1.FatalError(`Invalid type "${type}". Allowed values are: ${ALLOWED_VIEW_BOOKMARK_TYPES.join(", ")}.`));
33
+ return;
34
+ }
35
+ yield this.viewBookmarksManagerFactory.createViewBookmarksManager(null, boardId, type).pull();
36
+ });
37
+ }
38
+ pushViewBookmarks(boardId, filename) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ yield this.viewBookmarksManagerFactory.createViewBookmarksManager(filename, boardId).push();
41
+ });
42
+ }
43
+ }
44
+ exports.ViewBookmarksCommandService = ViewBookmarksCommandService;
45
+ });
@@ -0,0 +1,39 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "node:fs", "node:path", "./view-bookmarks.manager", "../../core/utils/logger"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ViewBookmarksManagerFactory = void 0;
13
+ const fs = require("node:fs");
14
+ const path = require("node:path");
15
+ const view_bookmarks_manager_1 = require("./view-bookmarks.manager");
16
+ const logger_1 = require("../../core/utils/logger");
17
+ class ViewBookmarksManagerFactory {
18
+ constructor(context) {
19
+ this.context = context;
20
+ }
21
+ createViewBookmarksManager(filename, boardId, type) {
22
+ const viewBookmarksManager = new view_bookmarks_manager_1.ViewBookmarksManager(this.context);
23
+ viewBookmarksManager.boardId = boardId;
24
+ type = (type !== null && type !== void 0 ? type : "USER").toUpperCase();
25
+ viewBookmarksManager.type = type;
26
+ if (filename !== null) {
27
+ viewBookmarksManager.filePath = this.resolveFilePath(filename);
28
+ }
29
+ return viewBookmarksManager;
30
+ }
31
+ resolveFilePath(fileName) {
32
+ if (!fs.existsSync(path.resolve(process.cwd(), fileName))) {
33
+ logger_1.logger.error(new logger_1.FatalError("The provided file does not exist"));
34
+ }
35
+ return path.resolve(process.cwd(), fileName);
36
+ }
37
+ }
38
+ exports.ViewBookmarksManagerFactory = ViewBookmarksManagerFactory;
39
+ });
@@ -0,0 +1,60 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "node:fs", "form-data", "../../core/http/http-shared/base.manager"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ViewBookmarksManager = void 0;
13
+ const fs = require("node:fs");
14
+ const FormData = require("form-data");
15
+ const base_manager_1 = require("../../core/http/http-shared/base.manager");
16
+ class ViewBookmarksManager extends base_manager_1.BaseManager {
17
+ constructor(context) {
18
+ super(context);
19
+ }
20
+ get filePath() {
21
+ return this._filePath;
22
+ }
23
+ set filePath(value) {
24
+ this._filePath = value;
25
+ }
26
+ get boardId() {
27
+ return this._boardId;
28
+ }
29
+ set boardId(value) {
30
+ this._boardId = value;
31
+ }
32
+ get type() {
33
+ return this._type;
34
+ }
35
+ set type(value) {
36
+ this._type = value;
37
+ }
38
+ getConfig() {
39
+ return {
40
+ pushUrl: `${ViewBookmarksManager.BASE_URL}/import?boardId=${encodeURIComponent(this.boardId)}`,
41
+ pullUrl: `${ViewBookmarksManager.BASE_URL}/export?boardId=${encodeURIComponent(this.boardId)}&type=${encodeURIComponent(this.type)}`,
42
+ exportFileName: `${ViewBookmarksManager.VIEW_BOOKMARKS_FILE_PREFIX}${this.boardId}.json`,
43
+ onPushSuccessMessage: () => {
44
+ return "View Bookmarks were pushed successfully.";
45
+ },
46
+ };
47
+ }
48
+ getBody() {
49
+ const formData = new FormData();
50
+ formData.append("file", fs.createReadStream(this.filePath));
51
+ return formData;
52
+ }
53
+ getSerializedFileContent(data) {
54
+ return JSON.stringify(data);
55
+ }
56
+ }
57
+ exports.ViewBookmarksManager = ViewBookmarksManager;
58
+ ViewBookmarksManager.BASE_URL = "/blueprint/api/bookmarks";
59
+ ViewBookmarksManager.VIEW_BOOKMARKS_FILE_PREFIX = "studio_view_bookmarks_";
60
+ });
@@ -95,6 +95,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
95
95
  finalZip.writeZip(zipFilePath, () => fs.chmodSync(zipFilePath, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
96
96
  return zipFilePath;
97
97
  }
98
+ zipDirectoryAsSinglePackage(sourceDir) {
99
+ if (fs.lstatSync(sourceDir).isSymbolicLink()) {
100
+ throw new logger_1.FatalError("Source directory cannot be a symbolic link.");
101
+ }
102
+ const zip = new AdmZip();
103
+ zip.addLocalFolder(sourceDir);
104
+ const tempDir = path.join(os.tmpdir(), "content-cli-imports");
105
+ fs.mkdirSync(tempDir, { recursive: true, mode: file_constants_1.FileConstants.DEFAULT_FOLDER_PERMISSIONS });
106
+ const zipFilePath = path.join(tempDir, `single_package_${(0, uuid_1.v4)()}.zip`);
107
+ zip.writeZip(zipFilePath, () => fs.chmodSync(zipFilePath, file_constants_1.FileConstants.DEFAULT_FILE_PERMISSIONS));
108
+ return zipFilePath;
109
+ }
98
110
  getSerializedFileContent(data) {
99
111
  return data;
100
112
  }
@@ -0,0 +1,7 @@
1
+ import { PackageMetadataExportTransport } from "../interfaces/package-export.interfaces";
2
+ import { Context } from "../../../core/command/cli-context";
3
+ export declare class MetadataApi {
4
+ private readonly httpClient;
5
+ constructor(context: Context);
6
+ exportPackagesMetadata(packageKeys: string[]): Promise<PackageMetadataExportTransport[]>;
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as FormData from "form-data";
2
+ import { Context } from "../../../core/command/cli-context";
3
+ import { SinglePackageImportResult } from "../interfaces/single-package-import.interfaces";
4
+ export declare class SinglePackageImportApi {
5
+ private readonly httpClient;
6
+ constructor(context: Context);
7
+ importPackage(data: FormData, overwrite: boolean): Promise<SinglePackageImportResult>;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { PackageExportTransport } from "../interfaces/package-export.interfaces";
2
+ import { Context } from "../../../core/command/cli-context";
3
+ export declare class StagingPackageApi {
4
+ private readonly httpClient;
5
+ constructor(context: Context);
6
+ findAllStagingPackages(flavors: string[], includeBranches?: boolean): Promise<PackageExportTransport[]>;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { PackageKeyAndVersionPair, VariableManifestTransport } from "../interfaces/package-export.interfaces";
2
+ import { Context } from "../../../core/command/cli-context";
3
+ export declare class VariableApi {
4
+ private readonly httpClient;
5
+ constructor(context: Context);
6
+ findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]>;
7
+ }
@@ -1,14 +1,6 @@
1
1
  import { Context } from "../../core/command/cli-context";
2
2
  export declare class ConfigCommandService {
3
- private batchImportExportService;
4
3
  private variableService;
5
- private diffService;
6
4
  constructor(context: Context);
7
- listPackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[], keysByVersion: string[], variableValue: string, variableType: string, includeBranches: boolean, staging: boolean): Promise<void>;
8
5
  listVariables(jsonResponse: boolean, keysByVersion: string[], keysByVersionFile: string, packageKeys: string[]): Promise<void>;
9
- batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean): Promise<void>;
10
- batchExportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
11
- batchImportPackages(file: string, directory: string, overwrite: boolean, gitBranch: string, performValidation?: boolean): Promise<void>;
12
- diffPackages(file: string, hasChanges: boolean, jsonResponse: boolean): Promise<void>;
13
- private listPackagesByVariableValue;
14
6
  }
@@ -0,0 +1,2 @@
1
+ import { VariableManifestTransport } from "./interfaces/package-export.interfaces";
2
+ export declare function fixConnectionVariables(variables: VariableManifestTransport[]): VariableManifestTransport[];
@@ -0,0 +1,19 @@
1
+ import { NodeTransport } from "./node.interfaces";
2
+ export interface PackageTransport {
3
+ id: string;
4
+ key: string;
5
+ name: string;
6
+ type?: string;
7
+ version?: string;
8
+ flavor?: string;
9
+ schemaVersion?: number;
10
+ createdBy?: string;
11
+ updatedBy?: string;
12
+ creationDate?: string;
13
+ changeDate?: string;
14
+ [key: string]: any;
15
+ }
16
+ export interface SinglePackageImportResult {
17
+ importedPackage: PackageTransport;
18
+ importedNodes: NodeTransport[];
19
+ }
@@ -0,0 +1,7 @@
1
+ import { Context } from "../../core/command/cli-context";
2
+ export declare class MetadataService {
3
+ private metadataApi;
4
+ constructor(context: Context);
5
+ exportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
6
+ private exportListOfPackagesMetadata;
7
+ }
@@ -6,11 +6,13 @@ import { Context } from "../../core/command/cli-context";
6
6
  declare class Module extends IModule {
7
7
  register(context: Context, configurator: Configurator): void;
8
8
  private listPackages;
9
+ private listStagingPackages;
9
10
  private batchExportPackages;
10
- private batchExportPackagesMetadata;
11
+ private exportPackagesMetadata;
11
12
  private getPackageVersion;
12
13
  private createPackageVersion;
13
14
  private batchImportPackages;
15
+ private importSinglePackage;
14
16
  private diffPackages;
15
17
  private validatePackage;
16
18
  private listVariables;
@@ -0,0 +1,12 @@
1
+ import { Context } from "../../core/command/cli-context";
2
+ export declare class SinglePackageImportService {
3
+ private static readonly MAX_UNCOMPRESSED_ZIP_SIZE;
4
+ private readonly singlePackageImportApi;
5
+ constructor(context: Context);
6
+ importPackage(file: string, directory: string, overwrite: boolean, jsonResponse: boolean): Promise<void>;
7
+ private resolveSource;
8
+ private buildBodyForImport;
9
+ private assertUncompressedSizeWithinLimit;
10
+ private getReadableStream;
11
+ private outputResult;
12
+ }
@@ -0,0 +1,7 @@
1
+ import { Context } from "../../core/command/cli-context";
2
+ export declare class StagingPackageService {
3
+ private stagingPackageApi;
4
+ constructor(context: Context);
5
+ listStagingPackages(flavors: string[], includeBranches: boolean, jsonResponse: boolean): Promise<void>;
6
+ private exportListOfPackages;
7
+ }
@@ -1,9 +1,8 @@
1
1
  import { Context } from "../../core/command/cli-context";
2
2
  export declare class VariableService {
3
- private batchImportExportApi;
3
+ private variableApi;
4
4
  private variableAssignmentCandidatesApi;
5
5
  private readonly stagingPackageVariablesApi;
6
- private studioService;
7
6
  constructor(context: Context);
8
7
  listVariables(keysByVersion: string[], keysByVersionFile: string): Promise<void>;
9
8
  listCandidateAssignments(type: string, params: string): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import * as FormData from "form-data";
2
+ import { Context } from "../../../core/command/cli-context";
3
+ import { PackageDiffMetadata, PackageDiffTransport } from "../../configuration-management/interfaces/diff-package.interfaces";
4
+ export declare class DiffApi {
5
+ private readonly httpClient;
6
+ constructor(context: Context);
7
+ diffPackages(baseVersion: string, data: FormData): Promise<PackageDiffTransport[]>;
8
+ hasChanges(baseVersion: string, data: FormData): Promise<PackageDiffMetadata[]>;
9
+ }
@@ -1,18 +1,15 @@
1
1
  /// <reference types="node" />
2
2
  import * as FormData from "form-data";
3
- import { PackageExportTransport, PackageKeyAndVersionPair, PackageMetadataExportTransport, PostPackageImportData, VariableManifestTransport } from "../interfaces/package-export.interfaces";
3
+ import { PackageExportTransport, PostPackageImportData } from "../../configuration-management/interfaces/package-export.interfaces";
4
4
  import { Context } from "../../../core/command/cli-context";
5
- export declare class BatchImportExportApi {
6
- private httpClient;
5
+ export declare class T2tcPackageApi {
6
+ private readonly httpClient;
7
7
  constructor(context: Context);
8
8
  findAllActivePackages(flavors: string[], withDependencies?: boolean, includeBranches?: boolean): Promise<PackageExportTransport[]>;
9
- findAllStagingPackages(flavors: string[], includeBranches?: boolean): Promise<PackageExportTransport[]>;
10
9
  findActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string, includeBranches?: boolean): Promise<PackageExportTransport[]>;
11
10
  findActivePackagesByKeys(packageKeys: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
12
11
  findPackagesByKeysAndVersion(packageKeysWithVersion: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
13
12
  exportPackages(packageKeys: string[], withDependencies: boolean): Promise<Buffer>;
14
13
  exportPackagesByVersions(packageKeysWithVersion: string[], withDependencies: boolean): Promise<Buffer>;
15
- batchExportPackagesMetadata(packageKeys: string[]): Promise<PackageMetadataExportTransport[]>;
16
14
  importPackages(data: FormData, overwrite: boolean, performValidation: boolean): Promise<PostPackageImportData[]>;
17
- findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]>;
18
15
  }
@@ -2,7 +2,7 @@ import { Context } from "../../core/command/cli-context";
2
2
  export declare class DiffService {
3
3
  private diffApi;
4
4
  constructor(context: Context);
5
- diffPackages(file: string, hasChanges: boolean, jsonResponse: boolean): Promise<void>;
5
+ diffPackages(file: string, hasChanges: boolean, baseVersion: string, jsonResponse: boolean): Promise<void>;
6
6
  private hasChanges;
7
7
  private diffPackagesAndReturnDiff;
8
8
  private buildBodyForDiff;
@@ -0,0 +1,10 @@
1
+ import { Configurator, IModule } from "../../core/command/module-handler";
2
+ import { Context } from "../../core/command/cli-context";
3
+ declare class Module extends IModule {
4
+ register(context: Context, configurator: Configurator): void;
5
+ private listPackages;
6
+ private batchExportPackages;
7
+ private batchImportPackages;
8
+ private diffPackages;
9
+ }
10
+ export = Module;
@@ -1,6 +1,6 @@
1
1
  import { IZipEntry } from "adm-zip";
2
2
  import * as AdmZip from "adm-zip";
3
- import { PackageExportTransport, StudioPackageManifest, VariableManifestTransport } from "./interfaces/package-export.interfaces";
3
+ import { PackageExportTransport, StudioPackageManifest, VariableManifestTransport } from "../configuration-management/interfaces/package-export.interfaces";
4
4
  import { ContentNodeTransport } from "../studio/interfaces/package-manager.interfaces";
5
5
  import { Context } from "../../core/command/cli-context";
6
6
  export declare class StudioService {
@@ -13,13 +13,11 @@ export declare class StudioService {
13
13
  private studioVariableService;
14
14
  constructor(context: Context);
15
15
  getExportPackagesWithStudioData(packagesToExport: PackageExportTransport[], withDependencies: boolean): Promise<PackageExportTransport[]>;
16
- fixConnectionVariables(variables: VariableManifestTransport[]): VariableManifestTransport[];
17
16
  getStudioPackageManifests(studioPackageKeys: string[]): Promise<StudioPackageManifest[]>;
18
17
  processPackageForExport(exportedPackage: IZipEntry, exportedVariables: VariableManifestTransport[]): AdmZip;
19
18
  processImportedPackages(configs: AdmZip, existingStudioPackages: ContentNodeTransport[], studioManifests: StudioPackageManifest[]): Promise<void>;
20
19
  private setSpaceIdForStudioPackages;
21
20
  private setDataModelsForStudioPackages;
22
- private fixConnectionVariable;
23
21
  private deleteScenarioAssets;
24
22
  private fixConnectionVariablesForRootNodeFiles;
25
23
  private getPackageKeyAndVersion;
@@ -0,0 +1,12 @@
1
+ import { Context } from "../../core/command/cli-context";
2
+ export declare class T2tcCommandService {
3
+ private t2tcPackageService;
4
+ private diffService;
5
+ private stagingPackageService;
6
+ constructor(context: Context);
7
+ listPackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[], keysByVersion: string[], variableValue: string, variableType: string, includeBranches: boolean, staging: boolean): Promise<void>;
8
+ batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies: boolean, gitBranch: string, unzip: boolean): Promise<void>;
9
+ batchImportPackages(file: string, directory: string, overwrite: boolean, gitBranch: string, performValidation?: boolean): Promise<void>;
10
+ diffPackages(file: string, hasChanges: boolean, baseVersion: string, jsonResponse: boolean): Promise<void>;
11
+ private listPackagesByVariableValue;
12
+ }