@celonis/content-cli 0.4.8 → 0.4.9
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.
|
@@ -56,9 +56,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
56
56
|
yield package_service_1.packageService.batchExportPackages(packageKeys, includeDependencies);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile) {
|
|
59
|
+
batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile, overwrite) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
yield package_service_1.packageService.batchImportPackages(spaceMappings !== null && spaceMappings !== void 0 ? spaceMappings : [], dataModelMappingsFilePath, exportedPackagesFile);
|
|
61
|
+
yield package_service_1.packageService.batchImportPackages(spaceMappings !== null && spaceMappings !== void 0 ? spaceMappings : [], dataModelMappingsFilePath, exportedPackagesFile, overwrite);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
}
|
package/content-cli-import.js
CHANGED
|
@@ -30,10 +30,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
30
30
|
.description("Command to import all given packages")
|
|
31
31
|
.option("-p, --profile <profile>", "Profile which you want to use to list packages")
|
|
32
32
|
.option("--spaceMappings <spaceMappings...>", "List of mappings for importing packages to different target spaces. Mappings should follow format 'packageKey:targetSpaceKey'")
|
|
33
|
+
.option("--overwrite", "Flag to allow overwriting of packages")
|
|
33
34
|
.option("--dataModelMappingsFile <dataModelMappingsFile>", "DataModel variable mappings file path")
|
|
34
35
|
.requiredOption("-f, --file <file>", "Exported packages file (relative path)")
|
|
35
36
|
.action((cmd) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
yield new package_command_1.PackageCommand().batchImportPackages(cmd.spaceMappings, cmd.dataModelMappingsFile, cmd.file);
|
|
37
|
+
yield new package_command_1.PackageCommand().batchImportPackages(cmd.spaceMappings, cmd.dataModelMappingsFile, cmd.file, cmd.overwrite);
|
|
37
38
|
process.exit();
|
|
38
39
|
}));
|
|
39
40
|
return program;
|
|
@@ -6,5 +6,5 @@ export declare class PackageCommand {
|
|
|
6
6
|
pushPackages(profile: string, spaceKey: string): Promise<void>;
|
|
7
7
|
listPackages(jsonResponse: boolean, includeDependencies: boolean, packageKeys: string[]): Promise<void>;
|
|
8
8
|
batchExportPackages(packageKeys: string[], includeDependencies: boolean): Promise<void>;
|
|
9
|
-
batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string): Promise<void>;
|
|
9
|
+
batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean): Promise<void>;
|
|
10
10
|
}
|
|
@@ -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): Promise<void>;
|
|
8
|
+
batchImportPackages(spaceMappings: string[], dataModelMappingsFilePath: string, exportedPackagesFile: string, overwrite: boolean): Promise<void>;
|
|
9
9
|
private checkNodeForCircularDependency;
|
|
10
10
|
private importPackage;
|
|
11
11
|
private importPackageVersion;
|
package/package.json
CHANGED
|
@@ -47,7 +47,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
47
47
|
}
|
|
48
48
|
findAndExportListOfAllPackages(includeDependencies, packageKeys) {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const fieldsToInclude = ["key", "name", "changeDate", "activatedDraftId", "spaceId"];
|
|
50
|
+
const fieldsToInclude = ["key", "name", "changeDate", "activatedDraftId", "workingDraftId", "spaceId"];
|
|
51
51
|
let nodesListToExport = yield package_api_1.packageApi.findAllPackages();
|
|
52
52
|
if (packageKeys.length > 0) {
|
|
53
53
|
nodesListToExport = nodesListToExport.filter(node => {
|
|
@@ -80,7 +80,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
80
80
|
this.exportListOfPackages(nodesListToExport, fieldsToInclude);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile) {
|
|
83
|
+
batchImportPackages(spaceMappings, dataModelMappingsFilePath, exportedPackagesFile, overwrite) {
|
|
84
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
exportedPackagesFile = exportedPackagesFile + (exportedPackagesFile.includes(".zip") ? "" : ".zip");
|
|
86
86
|
const zip = new AdmZip(exportedPackagesFile);
|
|
@@ -88,6 +88,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
88
88
|
yield fs.mkdirSync(importedFilePath);
|
|
89
89
|
yield zip.extractAllTo(importedFilePath);
|
|
90
90
|
const manifestNodes = yield file_service_1.fileService.readManifestFile(importedFilePath);
|
|
91
|
+
if (!overwrite) {
|
|
92
|
+
const allTargetPackages = yield package_api_1.packageApi.findAllPackages();
|
|
93
|
+
const manifestNodeKeys = manifestNodes.map(node => node.packageKey);
|
|
94
|
+
allTargetPackages
|
|
95
|
+
.filter(node => manifestNodeKeys.includes(node.key))
|
|
96
|
+
.forEach(node => {
|
|
97
|
+
if (node.workingDraftId !== node.activatedDraftId) {
|
|
98
|
+
throw new logger_1.FatalError("Failed to import. Cannot overwrite packages.");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
91
102
|
let dmTargetIdsBySourceIds = new Map();
|
|
92
103
|
if (dataModelMappingsFilePath) {
|
|
93
104
|
const dataModelMappings = yield file_service_1.fileService.readFileToJson(dataModelMappingsFilePath);
|