@celonis/content-cli 1.0.6 → 1.0.7

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.
@@ -67,6 +67,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67
67
  });
68
68
  });
69
69
  }
70
+ exportPackagesByVersions(packageKeysWithVersion, withDependencies = false) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const queryParams = new URLSearchParams();
73
+ packageKeysWithVersion.forEach(packageKeyByVersion => queryParams.append("packageKeysWithVersion", packageKeyByVersion));
74
+ queryParams.set("withDependencies", withDependencies.toString());
75
+ return this.httpClient().getFile(`/package-manager/api/core/packages/versions/export/batch?${queryParams.toString()}`).catch(e => {
76
+ throw new logger_1.FatalError(`Problem exporting packages by versions: ${e}`);
77
+ });
78
+ });
79
+ }
70
80
  batchExportPackagesMetadata(packageKeys) {
71
81
  return __awaiter(this, void 0, void 0, function* () {
72
82
  const queryParams = new URLSearchParams();
@@ -57,9 +57,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57
57
  this.exportListOfPackages(packagesToExport);
58
58
  });
59
59
  }
60
- batchExportPackages(packageKeys, withDependencies = false) {
60
+ batchExportPackages(packageKeys, packageKeysByVersion, withDependencies = false) {
61
61
  return __awaiter(this, void 0, void 0, function* () {
62
- const exportedPackagesData = yield this.batchImportExportApi.exportPackages(packageKeys, withDependencies);
62
+ let exportedPackagesData;
63
+ if (packageKeys) {
64
+ exportedPackagesData = yield this.batchImportExportApi.exportPackages(packageKeys, withDependencies);
65
+ }
66
+ else {
67
+ exportedPackagesData = yield this.batchImportExportApi.exportPackagesByVersions(packageKeysByVersion, withDependencies);
68
+ }
63
69
  const exportedPackagesZip = new AdmZip(exportedPackagesData);
64
70
  const manifest = (0, json_1.parse)(exportedPackagesZip.getEntry(batch_export_import_constants_1.BatchExportImportConstants.MANIFEST_FILE_NAME).getData().toString());
65
71
  const versionsByPackageKey = this.getVersionsByPackageKey(manifest);
@@ -52,8 +52,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
52
52
  }
53
53
  });
54
54
  }
55
- batchExportPackages(packageKeys, withDependencies = false) {
56
- return this.batchImportExportService.batchExportPackages(packageKeys, withDependencies);
55
+ batchExportPackages(packageKeys, packageKeysByVersion, withDependencies = false) {
56
+ return this.batchImportExportService.batchExportPackages(packageKeys, packageKeysByVersion, withDependencies);
57
57
  }
58
58
  batchExportPackagesMetadata(packageKeys, jsonResponse) {
59
59
  return this.batchImportExportService.batchExportPackagesMetadata(packageKeys, jsonResponse);
@@ -37,7 +37,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
37
37
  .action(this.listActivePackages);
38
38
  configCommand.command("export")
39
39
  .description("Command to export package configs")
40
- .requiredOption("--packageKeys <packageKeys...>", "Keys of packages to export")
40
+ .option("--packageKeys <packageKeys...>", "Keys of packages to export. Exports the latest deployed version only")
41
+ .option("--keysByVersion <keysByVersion...>", "Keys of packages to export by version")
41
42
  .option("--withDependencies", "Include variables and dependencies", "")
42
43
  .action(this.batchExportPackages);
43
44
  const metadataCommand = configCommand.command("metadata")
@@ -82,7 +83,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
82
83
  }
83
84
  batchExportPackages(context, command, options) {
84
85
  return __awaiter(this, void 0, void 0, function* () {
85
- yield new config_command_service_1.ConfigCommandService(context).batchExportPackages(options.packageKeys, options.withDependencies);
86
+ if ((options.packageKeys && options.keysByVersion) || (!options.packageKeys && !options.keysByVersion)) {
87
+ throw new Error("Please provide either --packageKeys or --keysByVersion, but not both.");
88
+ }
89
+ yield new config_command_service_1.ConfigCommandService(context).batchExportPackages(options.packageKeys, options.keysByVersion, options.withDependencies);
86
90
  });
87
91
  }
88
92
  batchExportPackagesMetadata(context, command, options) {
@@ -9,6 +9,7 @@ export declare class BatchImportExportApi {
9
9
  findActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string): Promise<PackageExportTransport[]>;
10
10
  findActivePackagesByKeys(packageKeys: string[], withDependencies?: boolean): Promise<PackageExportTransport[]>;
11
11
  exportPackages(packageKeys: string[], withDependencies?: boolean): Promise<Buffer>;
12
+ exportPackagesByVersions(packageKeysWithVersion: string[], withDependencies?: boolean): Promise<Buffer>;
12
13
  batchExportPackagesMetadata(packageKeys: string[]): Promise<PackageMetadataExportTransport[]>;
13
14
  importPackages(data: FormData, overwrite: boolean): Promise<PostPackageImportData[]>;
14
15
  findVariablesWithValuesByPackageKeysAndVersion(packagesByKeyAndVersion: PackageKeyAndVersionPair[]): Promise<VariableManifestTransport[]>;
@@ -6,7 +6,7 @@ export declare class BatchImportExportService {
6
6
  constructor(context: Context);
7
7
  listActivePackages(flavors: string[]): Promise<void>;
8
8
  findAndExportListOfActivePackages(flavors: string[], packageKeys: string[], withDependencies: boolean): Promise<void>;
9
- batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
9
+ batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies?: boolean): Promise<void>;
10
10
  batchExportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
11
11
  batchImportPackages(file: string, overwrite: boolean): Promise<void>;
12
12
  findAndExportListOfActivePackagesByVariableValue(flavors: string[], variableValue: string, variableType: string): Promise<void>;
@@ -6,7 +6,7 @@ export declare class ConfigCommandService {
6
6
  constructor(context: Context);
7
7
  listActivePackages(jsonResponse: boolean, flavors: string[], withDependencies: boolean, packageKeys: string[], variableValue: string, variableType: string): Promise<void>;
8
8
  listVariables(jsonResponse: boolean, keysByVersion: string[], keysByVersionFile: string): Promise<void>;
9
- batchExportPackages(packageKeys: string[], withDependencies?: boolean): Promise<void>;
9
+ batchExportPackages(packageKeys: string[], packageKeysByVersion: string[], withDependencies?: boolean): Promise<void>;
10
10
  batchExportPackagesMetadata(packageKeys: string[], jsonResponse: boolean): Promise<void>;
11
11
  batchImportPackages(file: string, overwrite: boolean): Promise<void>;
12
12
  diffPackages(file: string, hasChanges: boolean, jsonResponse: boolean): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {