@celonis/content-cli 0.1.0 → 0.2.1

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 (60) hide show
  1. package/README.md +68 -18
  2. package/commands/analysis.command.js +2 -1
  3. package/commands/asset.command.js +2 -1
  4. package/commands/ctp.command.js +4 -3
  5. package/commands/data-pool.command.js +2 -1
  6. package/commands/objective.command.js +2 -1
  7. package/commands/package.command.js +6 -5
  8. package/commands/profile.command.js +3 -2
  9. package/commands/skill.command.js +2 -1
  10. package/commands/widget-sourcemaps.command.js +33 -0
  11. package/commands/widget.command.js +2 -1
  12. package/content/factory/ctp-manager.factory.js +4 -3
  13. package/content/factory/package-manager.factory.js +20 -13
  14. package/content/factory/widget-manager.factory.js +2 -16
  15. package/content/factory/widget-sourcemaps-manager.factory.js +34 -0
  16. package/content/manager/analysis.manager.js +1 -1
  17. package/content/manager/asset.manager.js +1 -1
  18. package/content/manager/base.manager.js +2 -1
  19. package/content/manager/ctp.analysis.manager.js +2 -1
  20. package/content/manager/ctp.datamodel.manager.js +1 -1
  21. package/content/manager/ctp.manager.js +6 -0
  22. package/content/manager/data-pool.manager.js +1 -1
  23. package/content/manager/objective.manager.js +1 -1
  24. package/content/manager/package.manager.js +8 -10
  25. package/content/manager/skill.manager.js +1 -1
  26. package/content/manager/widget-sourcemaps.manager.js +69 -0
  27. package/content/manager/widget.manager.js +1 -1
  28. package/content-cli-list.js +2 -1
  29. package/content-cli-profile.js +2 -1
  30. package/content-cli-pull.js +4 -2
  31. package/content-cli-push.js +22 -4
  32. package/content-cli-update.js +2 -1
  33. package/content-cli.js +0 -0
  34. package/interfaces/profile.interface.js +5 -0
  35. package/lib/commands/ctp.command.d.ts +1 -1
  36. package/lib/commands/package.command.d.ts +1 -1
  37. package/lib/commands/widget-sourcemaps.command.d.ts +4 -0
  38. package/lib/content/factory/ctp-manager.factory.d.ts +1 -1
  39. package/lib/content/factory/package-manager.factory.d.ts +4 -2
  40. package/lib/content/factory/widget-manager.factory.d.ts +15 -2
  41. package/lib/content/factory/widget-sourcemaps-manager.factory.d.ts +5 -0
  42. package/lib/content/manager/analysis.manager.d.ts +8 -4
  43. package/lib/content/manager/asset.manager.d.ts +7 -4
  44. package/lib/content/manager/base.manager.d.ts +2 -1
  45. package/lib/content/manager/ctp.manager.d.ts +7 -2
  46. package/lib/content/manager/data-pool.manager.d.ts +4 -2
  47. package/lib/content/manager/objective.manager.d.ts +4 -2
  48. package/lib/content/manager/package.manager.d.ts +15 -6
  49. package/lib/content/manager/skill.manager.d.ts +6 -3
  50. package/lib/content/manager/widget-sourcemaps.manager.d.ts +12 -0
  51. package/lib/content/manager/widget.manager.d.ts +6 -3
  52. package/lib/interfaces/profile.interface.d.ts +5 -0
  53. package/lib/services/http-client.service.d.ts +1 -1
  54. package/lib/validators/profile.validator.d.ts +1 -1
  55. package/package.json +6 -4
  56. package/services/content.service.js +2 -1
  57. package/services/http-client.service.js +10 -7
  58. package/services/profile.service.js +12 -6
  59. package/services/question.service.js +3 -2
  60. package/validators/profile.validator.js +17 -7
package/README.md CHANGED
@@ -1,53 +1,100 @@
1
1
  # Content CLI
2
2
 
3
- Content CLI is a tool to help manage content in Celonis EMS. It provides various commands to help extract content like analyses, packages, assets and others from your Celonis EMS team to your local machine, which you can then push to other teams. This process can be easily achieved by creating profiles for your different teams and execute commands in a profile's context.
3
+ Content CLI is a tool to help manage content in Celonis EMS. It provides various commands to help extract
4
+ content like analyses, packages, assets and others from your Celonis EMS team to your local machine, which
5
+ you can then push to other teams. This process can be easily achieved by creating profiles for your different
6
+ teams and execute commands in a profile's context.
4
7
 
5
8
  ## Table of Contents
6
9
 
7
- 1. [About the Project](#about-the-project)
8
- 2. [Getting Started](#getting-started)
9
- 3. [Release Process](#release-process)
10
- 4. [Contributing](#contributing)
11
- 5. [License](#license)
10
+ 1. [Getting Started](#getting-started)
11
+ 2. [About the Project](#about-the-project)
12
+ 3. [Building the Project](#building-the-project)
13
+ 4. [Release Process](#release-process)
14
+ 5. [Contributing](#contributing)
15
+ 6. [License](#license)
16
+
17
+ ## Getting Started
18
+
19
+ To get started with using Content CLI, you will need to have `node` installed in your local machine. Please download
20
+ the LTS version that is recommended for most users from the `node` web page [here](https://nodejs.org/en/). After
21
+ installing `node` you can run the following command in the terminal (cmd for Windows users) to install Content CLI.
22
+ Note that the same command is used for updating Content CLI too.
23
+
24
+ ```
25
+ npm install -g @celonis/content-cli
26
+ ```
27
+
28
+ You can verify that the installation was successful by running the following command in the terminal, which prints
29
+ the installed version of Content CLI:
30
+
31
+ ```
32
+ content-cli -V
33
+ ```
34
+
35
+ To get started with using Content CLI, you can follow some examples to manage content that are available
36
+ as part of our pycelonis examples library [here](https://github.com/celonis/pycelonis-examples/tree/main/00_manage_celonis/00_ibc_to_ibc_movers).
12
37
 
13
38
  ## About the Project
14
39
 
15
40
  Content CLI has three core functionalities:
16
41
 
17
- **Profile:** The CLI connects to the EMS environments through profiles. For each of the commands you can specify which profile you want to use. This makes it powerful in the sense that you can pull something from let's say team1.cluser1 and push it directly to team2.cluster2 easily. You can create a profile using the following command:
42
+ **Profile:** The CLI connects to the EMS environments through profiles. For each of the commands you can specify
43
+ which profile you want to use. This makes it powerful in the sense that you can pull something from let's say
44
+ team1.cluser1 and push it directly to team2.cluster2 easily. You can create a profile using the following command:
18
45
 
19
46
  ```
20
47
  content-cli profile create
21
48
  ```
22
49
 
23
- **Pull:** This feature allows you to download content from the EMS to your local machine. Let's take Studio package as an example. These can be exported in the EMS as ZIP files that contain all package assets. By using the following command using the package key and profile you have created, you will pull the ZIP file.
50
+ **Pull:** This feature allows you to download content from the EMS to your local machine. Let's take Studio package
51
+ as an example. These can be exported in the EMS as ZIP files that contain all package assets. By using the following
52
+ command using the package key and profile you have created, you will pull the ZIP file.
24
53
 
25
54
  ```
26
- content-cli pull package -p team1.cluster1 --key my-package
55
+ content-cli pull package -p <profile-name> --key <package-key>
56
+ ```
57
+ Example, if you want to pull a package with key "interesting-package" from your profile "my-dev-profile", the command will look like this:
58
+ ```
59
+ content-cli pull package -p interesting-package --key my-dev-profile
27
60
  ```
28
61
 
29
- **Push:** This feature allows you to push a content file to a team in the EMS. To continue the last example, you can use the following command to push he previously pulled package in another team.
62
+ **Push:** This feature allows you to push a content file to a team in the EMS. To continue the last example,
63
+ you can use the following command to push he previously pulled package in another team.
30
64
 
31
65
  ```
32
- content-cli push package -p team2.cluster2 --file package_my-package.zip
66
+ content-cli push package -p <profile-name> --spaceKey <space-key> -f <file-to-push.zip>
67
+
68
+ ```
69
+ Example, if you want to push a package from zipped file "interesting-package.zip" to you team of profile "my-dev-profile" with the space "my-cool-space", the command will look like this:
70
+ ```
71
+ content-cli push package -p interesting-package --spaceKey my-cool-space -f interesting-package.zip
33
72
  ```
34
73
 
35
- A more comprehensive list of Content CLI capabilities can be found on the following [documentation](https://github.com/celonis/content-cli/blob/master/DOCUMENTATION.md).
74
+ A more comprehensive list of Content CLI capabilities can be found on the following
75
+ [documentation](https://github.com/celonis/content-cli/blob/master/DOCUMENTATION.md).
36
76
 
37
- You can still explore the full capabilities of Content CLI and the list of options for the different commands by using the `-h` option in your command.
77
+ You can still explore the full capabilities of Content CLI and the list of options for the different commands
78
+ by using the `-h` option in your command.
38
79
 
39
80
  ```
40
81
  content-cli -h
41
82
  content-cli pull package -h
42
83
  ```
43
84
 
44
- ## Getting Started
85
+ ## Building the Project
45
86
 
46
- This tool is tightly connected with the Celonis EMS and all capabilities require to have access to a Celonis EMS Team. After cloning the project, the next step is to install the project dependencies. We use `yarn` as our package manager, so running `yarn install` on the project root folder should install all the necessary dependencies. After installing the project dependencies, you can run `yarn build` to build the project artifact. To use the built artifact, you can run `node content-cli.js` in the generated `dist` folder.
87
+ This tool is tightly connected with the Celonis EMS and all capabilities require to have access to a Celonis EMS Team.
88
+ After cloning the project, the next step is to install the project dependencies. We use `yarn` as our package manager,
89
+ so running `yarn install` on the project root folder should install all the necessary dependencies. After installing
90
+ the project dependencies, you can run `yarn build` to build the project artifact. To use the built artifact, you can
91
+ run `node content-cli.js` in the generated `dist` folder.
47
92
 
48
93
  ## Release Process
49
94
 
50
- We manage releases using Github Actions with the `Build and Publish Workflow`. This action runs after merging to the master branch, which builds the project and publishes the package to the Github registry. You can install a published version of the Content CLI using the following command:
95
+ We manage releases using Github Actions with the `Build and Publish Workflow`. This action runs after merging to
96
+ the master branch, which builds the project and publishes the package to the Github registry. You can install
97
+ a published version of the Content CLI using the following command:
51
98
 
52
99
  ```
53
100
  npm i -g @celonis/content-cli
@@ -55,10 +102,13 @@ npm i -g @celonis/content-cli
55
102
 
56
103
  ## Contributing
57
104
 
58
- We encourage public contributions! Please review [CONTRIBUTING.md](https://github.com/celonis/content-cli/blob/master/CONTRIBUTING.md) for details on our code of conduct and development process.
105
+ We encourage public contributions! Please review
106
+ [CONTRIBUTING.md](https://github.com/celonis/content-cli/blob/master/CONTRIBUTING.md) for details on our
107
+ code of conduct and development process.
59
108
 
60
109
  ## License
61
110
 
62
111
  Copyright (c) 2021 Celonis SE
63
112
 
64
- This project is licensed under the MIT License - see [LICENSE](https://github.com/celonis/content-cli/blob/master/LICENSE) file for details.
113
+ This project is licensed under the MIT License -
114
+ see [LICENSE](https://github.com/celonis/content-cli/blob/master/LICENSE) file for details.
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -25,10 +26,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
26
  this.contentService = new content_service_1.ContentService();
26
27
  this.ctpManagerFactory = new ctp_manager_factory_1.CTPManagerFactory();
27
28
  }
28
- pushCTPFile(profile, filename, password, pushAnalysis, pushDataModels, existingPoolId, globalPoolName) {
29
+ pushCTPFile(profile, filename, password, pushAnalysis, pushDataModels, existingPoolId, globalPoolName, spaceKey) {
29
30
  return __awaiter(this, void 0, void 0, function* () {
30
31
  if (pushAnalysis) {
31
- yield this.contentService.push(profile, this.ctpManagerFactory.createCtpAnalysisManager(filename, password));
32
+ yield this.contentService.push(profile, this.ctpManagerFactory.createCtpAnalysisManager(filename, password, spaceKey));
32
33
  }
33
34
  if (pushDataModels) {
34
35
  this.validateParamsForDataModelPush(existingPoolId, globalPoolName);
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -24,19 +25,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
25
  this.contentService = new content_service_1.ContentService();
25
26
  this.packageManagerFactory = new package_manager_factory_1.PackageManagerFactory();
26
27
  }
27
- pullPackage(profile, key, store, newKey) {
28
+ pullPackage(profile, key, store, newKey, draft) {
28
29
  return __awaiter(this, void 0, void 0, function* () {
29
- yield this.contentService.pullFile(profile, this.packageManagerFactory.createManager(key, null, null, store, newKey));
30
+ yield this.contentService.pullFile(profile, this.packageManagerFactory.createPullManager(key, store, newKey, draft));
30
31
  });
31
32
  }
32
33
  pushPackage(profile, spaceKey, fileName, newKey, overwrite) {
33
34
  return __awaiter(this, void 0, void 0, function* () {
34
- yield this.contentService.push(profile, this.packageManagerFactory.createManager(null, spaceKey, fileName, false, newKey, overwrite));
35
+ yield this.contentService.push(profile, this.packageManagerFactory.createPushManager(spaceKey, fileName, newKey, overwrite));
35
36
  });
36
37
  }
37
38
  pushPackages(profile, spaceKey) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
- yield this.contentService.batchPush(profile, this.packageManagerFactory.createManagers(spaceKey));
40
+ yield this.contentService.batchPush(profile, this.packageManagerFactory.createPushManagers(spaceKey));
40
41
  });
41
42
  }
42
43
  listPackages(profile) {
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -31,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
32
  profile.name = yield question_service_1.QuestionService.ask("Name of the profile: ");
32
33
  profile.team = yield question_service_1.QuestionService.ask("Your team (please provide the full url): ");
33
34
  profile.apiToken = yield question_service_1.QuestionService.ask("Your api token: ");
34
- yield profile_validator_1.ProfileValidator.validateProfile(profile);
35
+ profile.authenticationType = yield profile_validator_1.ProfileValidator.validateProfile(profile);
35
36
  this.profileService.storeProfile(profile);
36
37
  if (setAsDefault) {
37
38
  yield this.makeDefaultProfile(profile.name);
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -0,0 +1,33 @@
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", "../content/factory/widget-sourcemaps-manager.factory"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const widget_sourcemaps_manager_factory_1 = require("../content/factory/widget-sourcemaps-manager.factory");
22
+ class WidgetSourcemapsCommand {
23
+ constructor() {
24
+ this.widgetSourcemapsFactory = new widget_sourcemaps_manager_factory_1.WidgetSourcemapsManagerFactory();
25
+ }
26
+ pushSourceMaps() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ yield this.widgetSourcemapsFactory.createManager().push();
29
+ });
30
+ }
31
+ }
32
+ exports.WidgetSourcemapsCommand = WidgetSourcemapsCommand;
33
+ });
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -15,16 +15,17 @@
15
15
  const ctp_analysis_manager_1 = require("../manager/ctp.analysis.manager");
16
16
  const ctp_datamodel_manager_1 = require("../manager/ctp.datamodel.manager");
17
17
  class CTPManagerFactory {
18
- createCtpAnalysisManager(filename, password) {
18
+ createCtpAnalysisManager(filename, password, spaceKey) {
19
19
  const ctpManager = new ctp_analysis_manager_1.CtpAnalysisManager();
20
- return this.initManager(ctpManager, filename, password);
20
+ return this.initManager(ctpManager, filename, password, spaceKey);
21
21
  }
22
22
  createCtpDataModelManager(filename, password, existingPoolId, globalPoolName) {
23
23
  const ctpManager = new ctp_datamodel_manager_1.CtpDataModelManager(existingPoolId, globalPoolName);
24
24
  return this.initManager(ctpManager, filename, password);
25
25
  }
26
- initManager(ctpManager, filename, password) {
26
+ initManager(ctpManager, filename, password, spaceKey) {
27
27
  ctpManager.password = password;
28
+ ctpManager.spaceKey = spaceKey;
28
29
  if (filename !== null) {
29
30
  ctpManager.content = this.readFile(filename);
30
31
  }
@@ -14,19 +14,13 @@
14
14
  const logger_1 = require("../../util/logger");
15
15
  const package_manager_1 = require("../manager/package.manager");
16
16
  class PackageManagerFactory {
17
- createManager(key, spaceKey, fileName, store, newKey, overwrite) {
18
- const packageManager = new package_manager_1.PackageManager();
19
- if (fileName) {
20
- packageManager.fileName = this.resolvePackageFilePath(fileName);
21
- }
22
- packageManager.key = key;
23
- packageManager.spaceKey = spaceKey;
24
- packageManager.store = store;
25
- packageManager.newKey = newKey;
26
- packageManager.overwrite = overwrite;
27
- return packageManager;
17
+ createPullManager(key, store, newKey, draft) {
18
+ return this.createManager(key, null, null, store, newKey, false, draft);
19
+ }
20
+ createPushManager(spaceKey, fileName, newKey, overwrite) {
21
+ return this.createManager(null, spaceKey, fileName, false, newKey, overwrite, false);
28
22
  }
29
- createManagers(spaceKey) {
23
+ createPushManagers(spaceKey) {
30
24
  const filePaths = fs.readdirSync(process.cwd());
31
25
  return filePaths
32
26
  .filter(filePath => {
@@ -37,9 +31,22 @@
37
31
  return file.isFile();
38
32
  })
39
33
  .map(filePath => {
40
- return this.createManager(null, spaceKey, filePath);
34
+ return this.createPushManager(spaceKey, filePath);
41
35
  });
42
36
  }
37
+ createManager(key, spaceKey, fileName, store, newKey, overwrite, draft) {
38
+ const packageManager = new package_manager_1.PackageManager();
39
+ if (fileName) {
40
+ packageManager.fileName = this.resolvePackageFilePath(fileName);
41
+ }
42
+ packageManager.key = key;
43
+ packageManager.spaceKey = spaceKey;
44
+ packageManager.store = store;
45
+ packageManager.newKey = newKey;
46
+ packageManager.overwrite = overwrite;
47
+ packageManager.draft = draft;
48
+ return packageManager;
49
+ }
43
50
  isPackageFilePath(filePath) {
44
51
  return (filePath.startsWith(package_manager_1.PackageManager.PACKAGE_FILE_PREFIX) &&
45
52
  filePath.endsWith(package_manager_1.PackageManager.PACKAGE_FILE_EXTENSION));
@@ -31,20 +31,9 @@
31
31
  this.validateManifest(manifest);
32
32
  const zip = new AdmZip();
33
33
  const zipFileName = path.resolve(process.cwd(), "output.zip");
34
- if (fs.existsSync(path.resolve(process.cwd(), "assets"))) {
35
- zip.addLocalFolder(path.resolve(process.cwd(), "assets"), "assets");
36
- }
37
- if (fs.existsSync(path.resolve(process.cwd(), "manifest.yaml"))) {
38
- zip.addLocalFile(path.resolve(process.cwd(), "manifest.yaml"));
39
- }
40
- else {
41
- zip.addLocalFile(path.resolve(process.cwd(), "manifest.yml"));
42
- }
43
- zip.addLocalFile(path.resolve(process.cwd(), manifest.bundle));
34
+ zip.addLocalFolder(path.resolve(process.cwd()));
44
35
  zip.writeZip(zipFileName);
45
- const stream = fs.createReadStream(path.resolve(process.cwd(), "output.zip"));
46
- fs.unlinkSync(zipFileName);
47
- return stream;
36
+ return fs.createReadStream(path.resolve(process.cwd(), "output.zip"));
48
37
  }
49
38
  fetchManifest() {
50
39
  if (fs.existsSync(path.resolve(process.cwd(), "manifest.yaml"))) {
@@ -65,9 +54,6 @@
65
54
  if (!manifest.key) {
66
55
  logger_1.logger.error(new logger_1.FatalError("Missing 'key' attribute."));
67
56
  }
68
- if (!manifest.key) {
69
- logger_1.logger.error(new logger_1.FatalError("Missing 'key' attribute."));
70
- }
71
57
  if (!fs.existsSync(manifest.bundle)) {
72
58
  logger_1.logger.error(new logger_1.FatalError("Missing bundle."));
73
59
  }
@@ -0,0 +1,34 @@
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", "path", "../../util/logger", "../manager/widget-sourcemaps.manager", "./widget-manager.factory"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const path = require("path");
13
+ const logger_1 = require("../../util/logger");
14
+ const widget_sourcemaps_manager_1 = require("../manager/widget-sourcemaps.manager");
15
+ const widget_manager_factory_1 = require("./widget-manager.factory");
16
+ class WidgetSourcemapsManagerFactory {
17
+ constructor() {
18
+ this.widgetManagerFactory = new widget_manager_factory_1.WidgetManagerFactory();
19
+ }
20
+ createManager() {
21
+ const widgetSourcemapsManager = new widget_sourcemaps_manager_1.WidgetSourcemapsManager();
22
+ const manifest = this.widgetManagerFactory.fetchManifest();
23
+ if (!manifest) {
24
+ logger_1.logger.error(new logger_1.FatalError("Missing manifest file."));
25
+ }
26
+ this.widgetManagerFactory.validateManifest(manifest);
27
+ widgetSourcemapsManager.distPath = path.resolve(process.cwd());
28
+ widgetSourcemapsManager.service = manifest.key;
29
+ widgetSourcemapsManager.releaseVersion = manifest.version;
30
+ return widgetSourcemapsManager;
31
+ }
32
+ }
33
+ exports.WidgetSourcemapsManagerFactory = WidgetSourcemapsManagerFactory;
34
+ });
@@ -66,8 +66,8 @@
66
66
  return JSON.stringify(data);
67
67
  }
68
68
  }
69
+ exports.AnalysisManager = AnalysisManager;
69
70
  AnalysisManager.BASE_URL = "/process-mining/api/analysis/";
70
71
  AnalysisManager.PULL_URL = `${AnalysisManager.BASE_URL}/export?id=`;
71
72
  AnalysisManager.ANALYSIS_FILE_PREFIX = "analysis_";
72
- exports.AnalysisManager = AnalysisManager;
73
73
  });
@@ -60,9 +60,9 @@
60
60
  return YAML.stringify(data);
61
61
  }
62
62
  }
63
+ exports.AssetManager = AssetManager;
63
64
  AssetManager.ASSET_FILE_PREFIX = "asset_";
64
65
  AssetManager.BASE_URL = "/package-manager/api/nodes";
65
66
  AssetManager.PUSH_URL = `${AssetManager.BASE_URL}/asset/import`;
66
67
  AssetManager.PULL_URL = `${AssetManager.BASE_URL}/asset/export`;
67
- exports.AssetManager = AssetManager;
68
68
  });
@@ -1,8 +1,9 @@
1
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); }); }
2
3
  return new (P || (P = Promise))(function (resolve, reject) {
3
4
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4
5
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
5
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7
8
  });
8
9
  };
@@ -19,10 +19,11 @@
19
19
  formData: {
20
20
  file: this.content,
21
21
  password: this.password,
22
+ spaceId: this.spaceKey,
22
23
  },
23
24
  };
24
25
  }
25
26
  }
26
- CtpAnalysisManager.BASE_URL = "/process-analytics/import/ctp";
27
27
  exports.CtpAnalysisManager = CtpAnalysisManager;
28
+ CtpAnalysisManager.BASE_URL = "/process-analytics/import/ctp";
28
29
  });
@@ -32,6 +32,6 @@
32
32
  };
33
33
  }
34
34
  }
35
- CtpDataModelManager.BASE_URL = "/cpm-ems-migrator/migration/api/ctp";
36
35
  exports.CtpDataModelManager = CtpDataModelManager;
36
+ CtpDataModelManager.BASE_URL = "/cpm-ems-migrator/migration/api/ctp";
37
37
  });
@@ -23,6 +23,12 @@
23
23
  set password(value) {
24
24
  this._password = value;
25
25
  }
26
+ get spaceKey() {
27
+ return this._spaceKey;
28
+ }
29
+ set spaceKey(value) {
30
+ this._spaceKey = value;
31
+ }
26
32
  getConfig() {
27
33
  const baseUrl = this.getUrl();
28
34
  return {
@@ -56,10 +56,10 @@
56
56
  return JSON.stringify(data);
57
57
  }
58
58
  }
59
+ exports.DataPoolManager = DataPoolManager;
59
60
  DataPoolManager.DATA_POOL_FILE_NAME_PREFIX = "data-pool_";
60
61
  DataPoolManager.API_URL = "/integration/api";
61
62
  DataPoolManager.DATA_POOL_PUSH_URL = DataPoolManager.API_URL + "/pool-import";
62
63
  DataPoolManager.DATA_POOL_ACTIONS_URL = DataPoolManager.API_URL + "/pools/{id}";
63
64
  DataPoolManager.DATA_POOL_PULL_URL = DataPoolManager.DATA_POOL_ACTIONS_URL + "/export";
64
- exports.DataPoolManager = DataPoolManager;
65
65
  });
@@ -45,6 +45,6 @@
45
45
  return JSON.stringify(data);
46
46
  }
47
47
  }
48
- ObjectiveManager.BASE_URL = "/transformation-center/api";
49
48
  exports.ObjectiveManager = ObjectiveManager;
49
+ ObjectiveManager.BASE_URL = "/transformation-center/api";
50
50
  });
@@ -49,10 +49,16 @@
49
49
  set overwrite(value) {
50
50
  this._overwrite = value;
51
51
  }
52
+ get draft() {
53
+ return this._draft;
54
+ }
55
+ set draft(value) {
56
+ this._draft = value;
57
+ }
52
58
  getConfig() {
53
59
  return {
54
60
  pushUrl: this.profile.team.replace(/\/?$/, this.buildPushUrl()),
55
- pullUrl: this.profile.team.replace(/\/?$/, `${PackageManager.BASE_URL}/${this.key}/${PackageManager.EXPORT_ENDPOINT_PATH}?store=${this.store}${this.newKey ? `&newKey=${this.newKey}` : ""}`),
61
+ pullUrl: this.profile.team.replace(/\/?$/, `${PackageManager.BASE_URL}/${this.key}/${PackageManager.EXPORT_ENDPOINT_PATH}?store=${this.store}&draft=${this.draft}${this.newKey ? `&newKey=${this.newKey}` : ""}`),
56
62
  findAllUrl: this.profile.team.replace(/\/?$/, PackageManager.BASE_URL),
57
63
  exportFileName: PackageManager.PACKAGE_FILE_PREFIX +
58
64
  (this.newKey ? this.newKey : this.key) +
@@ -82,16 +88,8 @@
82
88
  });
83
89
  }
84
90
  validateOptions() {
85
- let hasErrors;
86
- if (!this.spaceKey) {
87
- logger_1.logger.error("You cannot push a package without specifying the space. Please try again.");
88
- hasErrors = true;
89
- }
90
91
  if (this.newKey && this.overwrite) {
91
92
  logger_1.logger.error("You cannot overwrite a package and set a new key at the same time. Please use only one of the options.");
92
- hasErrors = true;
93
- }
94
- if (hasErrors) {
95
93
  process.exit();
96
94
  }
97
95
  }
@@ -106,10 +104,10 @@
106
104
  return pushUrlWithParams;
107
105
  }
108
106
  }
107
+ exports.PackageManager = PackageManager;
109
108
  PackageManager.PACKAGE_FILE_PREFIX = "package_";
110
109
  PackageManager.PACKAGE_FILE_EXTENSION = ".zip";
111
110
  PackageManager.BASE_URL = "/package-manager/api/packages";
112
111
  PackageManager.IMPORT_ENDPOINT_PATH = "import";
113
112
  PackageManager.EXPORT_ENDPOINT_PATH = "export";
114
- exports.PackageManager = PackageManager;
115
113
  });
@@ -50,6 +50,6 @@
50
50
  return JSON.stringify(data);
51
51
  }
52
52
  }
53
- SkillManager.BASE_URL = "/action-engine/api/projects/";
54
53
  exports.SkillManager = SkillManager;
54
+ SkillManager.BASE_URL = "/action-engine/api/projects/";
55
55
  });