@celonis/content-cli 0.4.9 → 0.4.11

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.
@@ -5,7 +5,7 @@ declare class SpaceService {
5
5
  private allSpaces;
6
6
  getParentSpaces(nodes: BatchExportNodeTransport[]): Promise<BatchExportNodeTransport[]>;
7
7
  createSpace(spaceName: string, spaceIcon: string): Promise<SpaceTransport>;
8
- getAllSpaces(): Promise<SpaceTransport[]>;
8
+ refreshAndGetAllSpaces(): Promise<SpaceTransport[]>;
9
9
  }
10
10
  export declare const spaceService: SpaceService;
11
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -91,13 +91,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
91
91
  if (!overwrite) {
92
92
  const allTargetPackages = yield package_api_1.packageApi.findAllPackages();
93
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
- });
94
+ const packagesWithDraftChanges = allTargetPackages
95
+ .filter(node => manifestNodeKeys.includes(node.key) && node.workingDraftId !== node.activatedDraftId)
96
+ .map(node => node.key)
97
+ .join(", ");
98
+ if (!!packagesWithDraftChanges) {
99
+ throw new logger_1.FatalError(`Failed to import. Cannot overwrite packages with key(s) ${packagesWithDraftChanges}`);
100
+ }
101
101
  }
102
102
  let dmTargetIdsBySourceIds = new Map();
103
103
  if (dataModelMappingsFilePath) {
@@ -237,7 +237,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
237
237
  getTargetSpaceForExportedPackage(packageToImport, spaceMappings) {
238
238
  return __awaiter(this, void 0, void 0, function* () {
239
239
  let targetSpace;
240
- const allSpaces = yield space_service_1.spaceService.getAllSpaces();
240
+ const allSpaces = yield space_service_1.spaceService.refreshAndGetAllSpaces();
241
241
  if (spaceMappings.has(packageToImport.packageKey)) {
242
242
  const customSpaceId = spaceMappings.get(packageToImport.packageKey);
243
243
  const customSpace = allSpaces.find(space => space.id === customSpaceId);
@@ -43,16 +43,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  name: spaceName,
44
44
  iconReference: spaceIcon
45
45
  });
46
+ yield this.refreshAndGetAllSpaces();
46
47
  this.allSpaces.push(newSpace);
47
48
  return newSpace;
48
49
  });
49
50
  }
50
- getAllSpaces() {
51
+ refreshAndGetAllSpaces() {
51
52
  return __awaiter(this, void 0, void 0, function* () {
52
53
  if (this.allSpaces.length) {
53
54
  return this.allSpaces;
54
55
  }
55
- return yield space_api_1.spaceApi.findAllSpaces();
56
+ this.allSpaces = yield space_api_1.spaceApi.findAllSpaces();
57
+ return this.allSpaces;
56
58
  });
57
59
  }
58
60
  }