@celonis/content-cli 0.6.1 → 0.8.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 (33) hide show
  1. package/api/batch-import-export-api.js +51 -0
  2. package/api/package-api.js +5 -3
  3. package/api/variables-api.js +9 -1
  4. package/commands/config.command.js +53 -0
  5. package/commands/package.command.js +4 -4
  6. package/content-cli-config.js +102 -0
  7. package/content-cli-export.js +3 -1
  8. package/content-cli-import.js +2 -1
  9. package/content-cli-list.js +1 -4
  10. package/content-cli-set.js +4 -3
  11. package/content-cli.js +1 -0
  12. package/interfaces/batch-export-import-constants.js +25 -0
  13. package/interfaces/package-export-transport.js +12 -0
  14. package/lib/api/batch-import-export-api.d.ts +13 -0
  15. package/lib/api/package-api.d.ts +2 -2
  16. package/lib/api/variables-api.d.ts +1 -0
  17. package/lib/commands/config.command.d.ts +6 -0
  18. package/lib/commands/package.command.d.ts +2 -2
  19. package/lib/content-cli-config.d.ts +9 -0
  20. package/lib/interfaces/batch-export-import-constants.d.ts +11 -0
  21. package/lib/interfaces/package-export-transport.d.ts +71 -0
  22. package/lib/interfaces/package-manager.interfaces.d.ts +2 -1
  23. package/lib/services/http-client-service.v2.d.ts +3 -1
  24. package/lib/services/package-manager/batch-import-export-service.d.ts +14 -0
  25. package/lib/services/package-manager/package-service.d.ts +3 -3
  26. package/lib/services/package-manager/variable-service.d.ts +6 -0
  27. package/lib/services/studio/studio.service.d.ts +25 -0
  28. package/package.json +1 -1
  29. package/services/http-client-service.v2.js +27 -5
  30. package/services/package-manager/batch-import-export-service.js +151 -0
  31. package/services/package-manager/package-service.js +27 -37
  32. package/services/package-manager/variable-service.js +54 -4
  33. package/services/studio/studio.service.js +220 -0
@@ -0,0 +1,51 @@
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", "../services/http-client-service.v2", "../util/logger"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.batchImportExportApi = void 0;
13
+ const http_client_service_v2_1 = require("../services/http-client-service.v2");
14
+ const logger_1 = require("../util/logger");
15
+ class BatchImportExportApi {
16
+ findAllActivePackages(flavors, withDependencies = false) {
17
+ const queryParams = new URLSearchParams();
18
+ queryParams.set("withDependencies", withDependencies.toString());
19
+ flavors.forEach(flavor => queryParams.append("flavors", flavor));
20
+ return http_client_service_v2_1.httpClientV2.get(`/package-manager/api/core/packages/export/list?${queryParams.toString()}`).catch(e => {
21
+ throw new logger_1.FatalError(`Problem getting active packages: ${e}`);
22
+ });
23
+ }
24
+ findActivePackagesByKeys(packageKeys, withDependencies = false) {
25
+ const queryParams = new URLSearchParams();
26
+ packageKeys.forEach(key => queryParams.append("packageKeys", key));
27
+ queryParams.set("withDependencies", withDependencies.toString());
28
+ return http_client_service_v2_1.httpClientV2.get(`/package-manager/api/core/packages/export/list-by-keys?${queryParams.toString()}`).catch(e => {
29
+ throw new logger_1.FatalError(`Problem getting active packages by keys: ${e}`);
30
+ });
31
+ }
32
+ exportPackages(packageKeys, withDependencies = false) {
33
+ const queryParams = new URLSearchParams();
34
+ packageKeys.forEach(packageKey => queryParams.append("packageKeys", packageKey));
35
+ queryParams.set("withDependencies", withDependencies.toString());
36
+ return http_client_service_v2_1.httpClientV2.getFile(`/package-manager/api/core/packages/export/batch?${queryParams.toString()}`).catch(e => {
37
+ throw new logger_1.FatalError(`Problem exporting packages: ${e}`);
38
+ });
39
+ }
40
+ importPackages(data, overwrite) {
41
+ return http_client_service_v2_1.httpClientV2.postFile("/package-manager/api/core/packages/import/batch", data, { overwrite });
42
+ }
43
+ findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion) {
44
+ return http_client_service_v2_1.httpClientV2.post("/package-manager/api/core/packages/export/batch/variables-with-assignments", packagesByKeyAndVersion).catch(e => {
45
+ throw new logger_1.FatalError(`Problem exporting package variables: ${e}`);
46
+ });
47
+ }
48
+ }
49
+ BatchImportExportApi.INSTANCE = new BatchImportExportApi();
50
+ exports.batchImportExportApi = BatchImportExportApi.INSTANCE;
51
+ });
@@ -29,11 +29,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  });
30
30
  });
31
31
  }
32
- exportPackage(rootPackageKey, version) {
32
+ exportPackage(rootPackageKey, version, excludeActionFlows) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  const queryParams = new URLSearchParams();
35
35
  queryParams.set("newKey", rootPackageKey);
36
36
  queryParams.set("version", version !== null && version !== void 0 ? version : "");
37
+ queryParams.set("excludeActionFlows", excludeActionFlows ? "true" : "false");
37
38
  return yield http_client_service_v2_1.httpClientV2.downloadFile(`/package-manager/api/packages/${rootPackageKey}/export?${queryParams.toString()}`).catch(e => {
38
39
  throw new logger_1.FatalError(`Pacakge ${rootPackageKey}_${version} failed to export.`);
39
40
  });
@@ -78,11 +79,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
78
79
  });
79
80
  });
80
81
  }
81
- importPackage(nodeContent, spaceId, overwrite) {
82
+ importPackage(nodeContent, spaceId, overwrite, excludeActionFlows) {
82
83
  return __awaiter(this, void 0, void 0, function* () {
83
84
  yield http_client_service_v2_1.httpClientV2.postFile("/package-manager/api/packages/import", nodeContent, {
84
85
  spaceId: spaceId,
85
- overwrite: overwrite
86
+ overwrite: overwrite,
87
+ excludeActionFlows: excludeActionFlows
86
88
  }).catch(e => {
87
89
  throw new logger_1.FatalError(`Problem importing package: ${e}`);
88
90
  });
@@ -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", "../services/http-client-service.v2", "../util/logger", "./variable-assignment-apis"], factory);
16
+ define(["require", "exports", "../services/http-client-service.v2", "../util/logger", "./variable-assignment-apis", "url"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -22,6 +22,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  const http_client_service_v2_1 = require("../services/http-client-service.v2");
23
23
  const logger_1 = require("../util/logger");
24
24
  const variable_assignment_apis_1 = require("./variable-assignment-apis");
25
+ const url_1 = require("url");
25
26
  class VariablesApi {
26
27
  assignVariableValues(packageKey, variablesAssignments) {
27
28
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,6 +42,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
42
  });
42
43
  });
43
44
  }
45
+ getRuntimeVariableValues(packageKey, appMode) {
46
+ const queryParams = new url_1.URLSearchParams();
47
+ queryParams.set("appMode", appMode);
48
+ return http_client_service_v2_1.httpClientV2.get(`/package-manager/api/nodes/by-package-key/${packageKey}/variables/runtime-values?${queryParams.toString()}`).catch(e => {
49
+ throw new logger_1.FatalError(`Problem getting runtime variables of package ${packageKey}: ${e}`);
50
+ });
51
+ }
44
52
  }
45
53
  VariablesApi.INSTANCE = new VariablesApi();
46
54
  VariablesApi.ASSIGNMENT_APIS = variable_assignment_apis_1.variableAssignmentApis;
@@ -0,0 +1,53 @@
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", "../services/package-manager/batch-import-export-service", "../services/package-manager/variable-service"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ConfigCommand = void 0;
22
+ const batch_import_export_service_1 = require("../services/package-manager/batch-import-export-service");
23
+ const variable_service_1 = require("../services/package-manager/variable-service");
24
+ class ConfigCommand {
25
+ listActivePackages(jsonResponse, flavors, withDependencies, packageKeys) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ if (jsonResponse) {
28
+ yield batch_import_export_service_1.batchImportExportService.findAndExportListOfActivePackages(flavors !== null && flavors !== void 0 ? flavors : [], packageKeys !== null && packageKeys !== void 0 ? packageKeys : [], withDependencies);
29
+ }
30
+ else {
31
+ yield batch_import_export_service_1.batchImportExportService.listActivePackages(flavors !== null && flavors !== void 0 ? flavors : []);
32
+ }
33
+ });
34
+ }
35
+ listVariables(jsonResponse, keysByVersion, keysByVersionFile) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ if (jsonResponse) {
38
+ yield variable_service_1.variableService.exportVariables(keysByVersion, keysByVersionFile);
39
+ }
40
+ else {
41
+ yield variable_service_1.variableService.listVariables(keysByVersion, keysByVersionFile);
42
+ }
43
+ });
44
+ }
45
+ batchExportPackages(packageKeys, withDependencies = false) {
46
+ return batch_import_export_service_1.batchImportExportService.batchExportPackages(packageKeys, withDependencies);
47
+ }
48
+ batchImportPackages(file, overwrite) {
49
+ return batch_import_export_service_1.batchImportExportService.batchImportPackages(file, overwrite);
50
+ }
51
+ }
52
+ exports.ConfigCommand = ConfigCommand;
53
+ });
@@ -52,14 +52,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
52
52
  }
53
53
  });
54
54
  }
55
- batchExportPackages(packageKeys, includeDependencies) {
55
+ batchExportPackages(packageKeys, includeDependencies, excludeActionFlows) {
56
56
  return __awaiter(this, void 0, void 0, function* () {
57
- yield package_service_1.packageService.batchExportPackages(packageKeys, includeDependencies);
57
+ yield package_service_1.packageService.batchExportPackages(packageKeys, includeDependencies, excludeActionFlows);
58
58
  });
59
59
  }
60
- batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile, overwrite) {
60
+ batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile, overwrite, excludeActionFlows) {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
- yield package_service_1.packageService.batchImportPackages(spaceMappings !== null && spaceMappings !== void 0 ? spaceMappings : [], dataModelMappingsFilePath, exportedPackagesFile, overwrite);
62
+ yield package_service_1.packageService.batchImportPackages(spaceMappings !== null && spaceMappings !== void 0 ? spaceMappings : [], dataModelMappingsFilePath, exportedPackagesFile, overwrite, excludeActionFlows);
63
63
  });
64
64
  }
65
65
  }
@@ -0,0 +1,102 @@
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", "./commands/config.command", "commander", "./util/logger", "./util/context-initializer"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.Config = void 0;
22
+ const config_command_1 = require("./commands/config.command");
23
+ const commander = require("commander");
24
+ const logger_1 = require("./util/logger");
25
+ const context_initializer_1 = require("./util/context-initializer");
26
+ class Config {
27
+ static list(program) {
28
+ program
29
+ .command("list")
30
+ .description("Command to list active packages that can be exported")
31
+ .option("-p, --profile <profile>", "Profile which you want to use to list possible variable assignments")
32
+ .option("--json", "Return response as json type", "")
33
+ .option("--flavors <flavors...>", "Lists only active packages of the given flavors")
34
+ .option("--withDependencies", "Include dependencies", "")
35
+ .option("--packageKeys <packageKeys...>", "Lists only given package keys")
36
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
37
+ yield new config_command_1.ConfigCommand().listActivePackages(cmd.json, cmd.flavors, cmd.withDependencies, cmd.packageKeys);
38
+ process.exit();
39
+ }));
40
+ return program;
41
+ }
42
+ static listVariables(program) {
43
+ program
44
+ .command("variables")
45
+ .description("Commands related to variable configs")
46
+ .command("list")
47
+ .description("Command to list versioned variables of packages")
48
+ .option("-p, --profile <profile>", "Profile which you want to use to list packages")
49
+ .option("--json", "Return response as json type", "")
50
+ .option("--keysByVersion <keysByVersion...>", "Mapping of package keys and versions", "")
51
+ .option("--keysByVersionFile <keysByVersionFile>", "Package keys by version mappings file path.", "")
52
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
53
+ yield new config_command_1.ConfigCommand().listVariables(cmd.json, cmd.keysByVersion, cmd.keysByVersionFile);
54
+ process.exit();
55
+ }));
56
+ return program;
57
+ }
58
+ static export(program) {
59
+ program
60
+ .command("export")
61
+ .description("Command to export package configs")
62
+ .option("-p, --profile <profile>", "Profile which you want to use to export packages")
63
+ .requiredOption("--packageKeys <packageKeys...>", "Keys of packages to export")
64
+ .option("--withDependencies", "Include variables and dependencies", "")
65
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
66
+ yield new config_command_1.ConfigCommand().batchExportPackages(cmd.packageKeys, cmd.withDependencies);
67
+ process.exit();
68
+ }));
69
+ return program;
70
+ }
71
+ static import(program) {
72
+ program
73
+ .command("import")
74
+ .description("Command to import package configs")
75
+ .option("-p, --profile <profile>", "Profile which you want to use to import packages")
76
+ .option("--overwrite", "Flag to allow overwriting of packages")
77
+ .requiredOption("-f, --file <file>", "Exported packages file (relative path)")
78
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
79
+ yield new config_command_1.ConfigCommand().batchImportPackages(cmd.file, cmd.overwrite);
80
+ process.exit();
81
+ }));
82
+ return program;
83
+ }
84
+ }
85
+ exports.Config = Config;
86
+ const loadAllCommands = () => {
87
+ Config.list(commander);
88
+ Config.listVariables(commander);
89
+ Config.export(commander);
90
+ Config.import(commander);
91
+ commander.parse(process.argv);
92
+ };
93
+ context_initializer_1.ContextInitializer.initContext()
94
+ .then(loadAllCommands, loadAllCommands)
95
+ .catch(e => {
96
+ logger_1.logger.error(e);
97
+ });
98
+ if (!process.argv.slice(2).length) {
99
+ commander.outputHelp();
100
+ process.exit(1);
101
+ }
102
+ });
@@ -32,8 +32,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  .option("-p, --profile <profile>", "Profile which you want to use to list packages")
33
33
  .requiredOption("--packageKeys <packageKeys...>", "Exports only given package keys")
34
34
  .option("--includeDependencies", "Include variables and dependencies", "")
35
+ .option("--excludeActionFlows", "Don't export action flows")
35
36
  .action((cmd) => __awaiter(this, void 0, void 0, function* () {
36
- yield new package_command_1.PackageCommand().batchExportPackages(cmd.packageKeys, cmd.includeDependencies);
37
+ var _a;
38
+ yield new package_command_1.PackageCommand().batchExportPackages(cmd.packageKeys, cmd.includeDependencies, (_a = cmd.excludeActionFlows) !== null && _a !== void 0 ? _a : false);
37
39
  process.exit();
38
40
  }));
39
41
  return program;
@@ -32,10 +32,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  .option("-p, --profile <profile>", "Profile which you want to use to list packages")
33
33
  .option("--spaceMappings <spaceMappings...>", "List of mappings for importing packages to different target spaces. Mappings should follow format 'packageKey:targetSpaceKey'")
34
34
  .option("--overwrite", "Flag to allow overwriting of packages")
35
+ .option("--excludeActionFlows", "Skip overwrite of action flows of package")
35
36
  .option("--dataModelMappingsFile <dataModelMappingsFile>", "DataModel variable mappings file path. If missing, variables will be mapped from manifest file.")
36
37
  .requiredOption("-f, --file <file>", "Exported packages file (relative path)")
37
38
  .action((cmd) => __awaiter(this, void 0, void 0, function* () {
38
- yield new package_command_1.PackageCommand().batchImportPackages(cmd.spaceMappings, cmd.dataModelMappingsFile, cmd.file, cmd.overwrite);
39
+ yield new package_command_1.PackageCommand().batchImportPackages(cmd.spaceMappings, cmd.dataModelMappingsFile, cmd.file, cmd.overwrite, cmd.excludeActionFlows);
39
40
  process.exit();
40
41
  }));
41
42
  return program;
@@ -108,9 +108,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
108
108
  }
109
109
  }
110
110
  exports.List = List;
111
- process.on("unhandledRejection", (e, promise) => {
112
- logger_1.logger.error(e.toString());
113
- });
114
111
  const loadAllCommands = () => {
115
112
  List.packages(commander);
116
113
  List.spaces(commander);
@@ -121,7 +118,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
121
118
  commander.parse(process.argv);
122
119
  };
123
120
  context_initializer_1.ContextInitializer.initContext()
124
- .then(loadAllCommands)
121
+ .then(loadAllCommands, loadAllCommands)
125
122
  .catch(e => {
126
123
  logger_1.logger.error(e);
127
124
  });
@@ -39,11 +39,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
39
39
  return program;
40
40
  }
41
41
  }
42
- context_initializer_1.ContextInitializer.initContext()
43
- .then(() => {
42
+ const loadAllCommands = () => {
44
43
  Set.connection(commander);
45
44
  commander.parse(process.argv);
46
- })
45
+ };
46
+ context_initializer_1.ContextInitializer.initContext()
47
+ .then(loadAllCommands, loadAllCommands)
47
48
  .catch(e => {
48
49
  logger_1.logger.error(e);
49
50
  });
package/content-cli.js CHANGED
@@ -28,6 +28,7 @@
28
28
  program.command("list", "Commands to list content.").alias("ls");
29
29
  program.command("get", "Commands to get configuration properties.");
30
30
  program.command("set", "Commands to set configuration properties.");
31
+ program.command("config", "Commands related to config management.");
31
32
  program.version(version_1.VersionUtils.getCurrentCliVersion());
32
33
  program.parse(process.argv);
33
34
  if (!process.argv.slice(2).length) {
@@ -0,0 +1,25 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BatchExportImportConstants = void 0;
13
+ var BatchExportImportConstants;
14
+ (function (BatchExportImportConstants) {
15
+ BatchExportImportConstants["STUDIO_FILE_NAME"] = "studio.yml";
16
+ BatchExportImportConstants["VARIABLES_FILE_NAME"] = "variables.yml";
17
+ BatchExportImportConstants["MANIFEST_FILE_NAME"] = "manifest.yml";
18
+ BatchExportImportConstants["STUDIO"] = "STUDIO";
19
+ BatchExportImportConstants["APP_MODE_VIEWER"] = "VIEWER";
20
+ BatchExportImportConstants["ZIP_EXTENSION"] = ".zip";
21
+ BatchExportImportConstants["YAML_EXTENSION"] = ".yml";
22
+ BatchExportImportConstants["NODES_FOLDER_NAME"] = "nodes/";
23
+ BatchExportImportConstants["SCENARIO_NODE"] = "SCENARIO";
24
+ })(BatchExportImportConstants || (exports.BatchExportImportConstants = BatchExportImportConstants = {}));
25
+ });
@@ -0,0 +1,12 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import { PackageExportTransport, PackageKeyAndVersionPair, PostPackageImportData, VariableManifestTransport } from "../interfaces/package-export-transport";
3
+ import * as FormData from "form-data";
4
+ declare class BatchImportExportApi {
5
+ static readonly INSTANCE: BatchImportExportApi;
6
+ findAllActivePackages(flavors: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
7
+ findActivePackagesByKeys(packageKeys: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
8
+ exportPackages(packageKeys: string[], withDependencies?: boolean): Promise<Buffer>;
9
+ importPackages(data: FormData, overwrite: boolean): Promise<PostPackageImportData[]>;
10
+ findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]>;
11
+ }
12
+ export declare const batchImportExportApi: BatchImportExportApi;
13
+ export {};
@@ -3,13 +3,13 @@ import { ActivatePackageTransport, ContentNodeTransport, PackageHistoryTransport
3
3
  declare class PackageApi {
4
4
  static readonly INSTANCE: PackageApi;
5
5
  findAllPackages(): Promise<ContentNodeTransport[]>;
6
- exportPackage(rootPackageKey: string, version?: string): Promise<Buffer>;
6
+ exportPackage(rootPackageKey: string, version?: string, excludeActionFlows?: boolean): Promise<Buffer>;
7
7
  findAllPackagesWithVariableAssignments(type: PackageManagerVariableType): Promise<PackageWithVariableAssignments[]>;
8
8
  findLatestVersionById(nodeId: string): Promise<PackageHistoryTransport>;
9
9
  findActiveVersionById(nodeId: string): Promise<PackageHistoryTransport>;
10
10
  findActiveVersionByIds(nodeIds: string[]): Promise<PackageHistoryTransport[]>;
11
11
  findNextVersion(nodeId: string): Promise<PackageHistoryTransport>;
12
- importPackage(nodeContent: any, spaceId: string, overwrite: boolean): Promise<any>;
12
+ importPackage(nodeContent: any, spaceId: string, overwrite: boolean, excludeActionFlows?: boolean): Promise<any>;
13
13
  movePackageToSpace(nodeId: string, spaceId: string): Promise<void>;
14
14
  publishPackage(activatePackage: ActivatePackageTransport): Promise<void>;
15
15
  }
@@ -8,6 +8,7 @@ declare class VariablesApi {
8
8
  };
9
9
  assignVariableValues(packageKey: string, variablesAssignments: VariablesAssignments[]): Promise<ContentNodeTransport[]>;
10
10
  getCandidateAssignments(type: string, params: URLSearchParams): Promise<object[]>;
11
+ getRuntimeVariableValues(packageKey: string, appMode: string): Promise<VariablesAssignments[]>;
11
12
  }
12
13
  export declare const variablesApi: VariablesApi;
13
14
  export {};
@@ -0,0 +1,6 @@
1
+ export declare class ConfigCommand {
2
+ listActivePackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[]): Promise<void>;
3
+ listVariables(jsonResponse: boolean, keysByVersion: string[], keysByVersionFile: string): Promise<void>;
4
+ batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
5
+ batchImportPackages(file: string, overwrite: boolean): Promise<void>;
6
+ }
@@ -5,6 +5,6 @@ export declare class PackageCommand {
5
5
  pushPackage(profile: string, spaceKey: string, fileName: string, newKey: string, overwrite: boolean): Promise<void>;
6
6
  pushPackages(profile: string, spaceKey: string): Promise<void>;
7
7
  listPackages(jsonResponse: boolean, includeDependencies: boolean, packageKeys: string[]): Promise<void>;
8
- batchExportPackages(packageKeys: string[], includeDependencies: boolean): Promise<void>;
9
- batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean): Promise<void>;
8
+ batchExportPackages(packageKeys: string[], includeDependencies: boolean, excludeActionFlows?: boolean): Promise<void>;
9
+ batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean, excludeActionFlows?: boolean): Promise<void>;
10
10
  }
@@ -0,0 +1,9 @@
1
+ import commander = require("commander");
2
+ type CommanderStatic = commander.CommanderStatic;
3
+ export declare class Config {
4
+ static list(program: CommanderStatic): CommanderStatic;
5
+ static listVariables(program: CommanderStatic): CommanderStatic;
6
+ static export(program: CommanderStatic): CommanderStatic;
7
+ static import(program: CommanderStatic): CommanderStatic;
8
+ }
9
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare enum BatchExportImportConstants {
2
+ STUDIO_FILE_NAME = "studio.yml",
3
+ VARIABLES_FILE_NAME = "variables.yml",
4
+ MANIFEST_FILE_NAME = "manifest.yml",
5
+ STUDIO = "STUDIO",
6
+ APP_MODE_VIEWER = "VIEWER",
7
+ ZIP_EXTENSION = ".zip",
8
+ YAML_EXTENSION = ".yml",
9
+ NODES_FOLDER_NAME = "nodes/",
10
+ SCENARIO_NODE = "SCENARIO"
11
+ }
@@ -0,0 +1,71 @@
1
+ /// <reference types="node" />
2
+ import { StudioComputeNodeDescriptor, VariableDefinition, VariablesAssignments } from "./package-manager.interfaces";
3
+ import { SpaceTransport } from "./save-space.interface";
4
+ export interface DependencyTransport {
5
+ key: string;
6
+ version: string;
7
+ }
8
+ export interface PackageExportTransport {
9
+ id: string;
10
+ key: string;
11
+ name: string;
12
+ changeDate: string;
13
+ activatedDraftId: string;
14
+ workingDraftId: string;
15
+ flavor: string;
16
+ version: string;
17
+ dependencies: DependencyTransport[];
18
+ spaceId?: string;
19
+ datamodels?: StudioComputeNodeDescriptor[];
20
+ }
21
+ export interface PackageManifestTransport {
22
+ packageKey: string;
23
+ flavor: string;
24
+ activeVersion: string;
25
+ dependenciesByVersion: Map<string, DependencyTransport[]>;
26
+ }
27
+ export interface VariableExportTransport {
28
+ key: string;
29
+ value: any;
30
+ type: string;
31
+ metadata: object;
32
+ }
33
+ export interface VariableManifestTransport {
34
+ packageKey: string;
35
+ version: string;
36
+ variables?: VariableExportTransport[];
37
+ }
38
+ export interface PackageKeyAndVersionPair {
39
+ packageKey: string;
40
+ version: string;
41
+ }
42
+ export interface NodeExportTransport {
43
+ key: string;
44
+ parentNodeKey: string;
45
+ packageNodeKey: string;
46
+ name: string;
47
+ type: string;
48
+ exportSerializationType: string;
49
+ serializedContent: string;
50
+ schemaVersion: number;
51
+ unversionedMetadata: any;
52
+ versionedMetdata: object;
53
+ invalidContent?: boolean;
54
+ serializedDocument: Buffer;
55
+ }
56
+ export interface NodeSerializedContent {
57
+ variables: VariableDefinition[];
58
+ }
59
+ export interface StudioPackageManifest {
60
+ packageKey: string;
61
+ space: Partial<SpaceTransport>;
62
+ runtimeVariableAssignments: VariablesAssignments[];
63
+ }
64
+ export interface PackageVersionImport {
65
+ oldVersion: string;
66
+ newVersion: string;
67
+ }
68
+ export interface PostPackageImportData {
69
+ packageKey: string;
70
+ importedVersions: PackageVersionImport[];
71
+ }
@@ -42,6 +42,7 @@ export interface PackageWithVariableAssignments {
42
42
  key: string;
43
43
  name: string;
44
44
  createdBy: string;
45
+ spaceId: string;
45
46
  variableAssignments: VariablesAssignments[];
46
47
  }
47
48
  export interface VariablesAssignments {
@@ -49,7 +50,7 @@ export interface VariablesAssignments {
49
50
  value: object;
50
51
  type: string;
51
52
  }
52
- export interface VariableDefinitionWithValue {
53
+ export interface VariableDefinition {
53
54
  key: string;
54
55
  type: PackageManagerVariableType;
55
56
  description?: string;
@@ -1,6 +1,8 @@
1
+ import * as FormData from "form-data";
1
2
  declare class HttpClientServiceV2 {
2
3
  get(url: string): Promise<any>;
3
- postFile(url: string, body: any, parameters?: {}): Promise<any>;
4
+ getFile(url: string): Promise<any>;
5
+ postFile(url: string, formData: FormData, parameters?: {}): Promise<any>;
4
6
  post(url: string, body: any): Promise<any>;
5
7
  put(url: string, body: object): Promise<any>;
6
8
  delete(url: string): Promise<any>;
@@ -0,0 +1,14 @@
1
+ declare class BatchImportExportService {
2
+ listActivePackages(flavors: string[]): Promise<void>;
3
+ findAndExportListOfActivePackages(flavors: string[], packageKeys: string[], withDependencies: boolean): Promise<void>;
4
+ batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
5
+ batchImportPackages(file: string, overwrite: boolean): Promise<void>;
6
+ private exportListOfPackages;
7
+ private getVersionsByPackageKey;
8
+ private getVersionedVariablesForPackagesWithKeys;
9
+ private buildBodyForImport;
10
+ private getReadableStream;
11
+ private parseEntryData;
12
+ }
13
+ export declare const batchImportExportService: BatchImportExportService;
14
+ export {};
@@ -5,7 +5,7 @@ declare class PackageService {
5
5
  protected readonly fileDownloadedMessage = "File downloaded successfully. New filename: ";
6
6
  listPackages(): Promise<void>;
7
7
  findAndExportListOfAllPackages(includeDependencies: boolean, packageKeys: string[]): Promise<void>;
8
- batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean): Promise<void>;
8
+ batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean, excludeActionFlows: boolean): Promise<void>;
9
9
  private checkNodeForCircularDependency;
10
10
  private importPackage;
11
11
  private importPackageVersion;
@@ -16,9 +16,9 @@ declare class PackageService {
16
16
  private getTargetSpaceForExportedPackage;
17
17
  private updateDependencyVersions;
18
18
  publishPackage(packageToImport: ManifestNodeTransport): Promise<void>;
19
- batchExportPackages(packageKeys: string[], includeDependencies: boolean): Promise<void>;
19
+ batchExportPackages(packageKeys: string[], includeDependencies: boolean, excludeActionFlows?: boolean): Promise<void>;
20
20
  getNodesWithActiveVersion(nodes: BatchExportNodeTransport[]): Promise<BatchExportNodeTransport[]>;
21
- getPackagesWithDependencies(draftIdByNodeId: Map<string, string>, actionFlowPackageKeys: string[]): Promise<Map<string, PackageDependencyTransport[]>>;
21
+ getPackagesWithDependencies(draftIdByNodeId: Map<string, string>): Promise<Map<string, PackageDependencyTransport[]>>;
22
22
  private getDependencyPackages;
23
23
  private nodeHasBeenResolvedBefore;
24
24
  private exportListOfPackages;
@@ -4,7 +4,13 @@ declare class VariableService {
4
4
  assignVariableValues(packageKey: string, variablesAssignments: VariablesAssignments[]): Promise<void>;
5
5
  listCandidateAssignments(type: string, params: string): Promise<void>;
6
6
  findAndExportCandidateAssignments(type: string, params: string): Promise<void>;
7
+ listVariables(keysByVersion: string[], keysByVersionFile: string): Promise<void>;
8
+ exportVariables(keysByVersion: string[], keysByVersionFile: string): Promise<void>;
7
9
  private parseParams;
10
+ private getVersionedVariablesByKeyVersionPairs;
11
+ private buildKeyVersionPairs;
12
+ private buildKeyAndVersionPairsFromArrayInput;
13
+ private exportToJson;
8
14
  }
9
15
  export declare const variableService: VariableService;
10
16
  export {};