@celonis/content-cli 0.1.3 → 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 (49) 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 +2 -1
  5. package/commands/data-pool.command.js +2 -1
  6. package/commands/objective.command.js +2 -1
  7. package/commands/package.command.js +2 -1
  8. package/commands/profile.command.js +2 -1
  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/widget-manager.factory.js +2 -16
  13. package/content/factory/widget-sourcemaps-manager.factory.js +34 -0
  14. package/content/manager/analysis.manager.js +1 -1
  15. package/content/manager/asset.manager.js +1 -1
  16. package/content/manager/base.manager.js +2 -1
  17. package/content/manager/ctp.analysis.manager.js +1 -1
  18. package/content/manager/ctp.datamodel.manager.js +1 -1
  19. package/content/manager/data-pool.manager.js +1 -1
  20. package/content/manager/objective.manager.js +1 -1
  21. package/content/manager/package.manager.js +1 -1
  22. package/content/manager/skill.manager.js +1 -1
  23. package/content/manager/widget-sourcemaps.manager.js +69 -0
  24. package/content/manager/widget.manager.js +1 -1
  25. package/content-cli-list.js +2 -1
  26. package/content-cli-profile.js +2 -1
  27. package/content-cli-pull.js +2 -1
  28. package/content-cli-push.js +20 -3
  29. package/content-cli-update.js +2 -1
  30. package/content-cli.js +0 -0
  31. package/lib/commands/widget-sourcemaps.command.d.ts +4 -0
  32. package/lib/content/factory/widget-manager.factory.d.ts +15 -2
  33. package/lib/content/factory/widget-sourcemaps-manager.factory.d.ts +5 -0
  34. package/lib/content/manager/analysis.manager.d.ts +8 -4
  35. package/lib/content/manager/asset.manager.d.ts +7 -4
  36. package/lib/content/manager/base.manager.d.ts +2 -1
  37. package/lib/content/manager/ctp.manager.d.ts +6 -3
  38. package/lib/content/manager/data-pool.manager.d.ts +4 -2
  39. package/lib/content/manager/objective.manager.d.ts +4 -2
  40. package/lib/content/manager/package.manager.d.ts +14 -7
  41. package/lib/content/manager/skill.manager.d.ts +6 -3
  42. package/lib/content/manager/widget-sourcemaps.manager.d.ts +12 -0
  43. package/lib/content/manager/widget.manager.d.ts +6 -3
  44. package/package.json +5 -3
  45. package/services/content.service.js +2 -1
  46. package/services/http-client.service.js +2 -1
  47. package/services/profile.service.js +2 -1
  48. package/services/question.service.js +3 -2
  49. package/validators/profile.validator.js +2 -1
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 --spaceKey my-space -f 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
  };
@@ -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
  };
@@ -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
  };
@@ -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
  };
@@ -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
  };
@@ -24,6 +24,6 @@
24
24
  };
25
25
  }
26
26
  }
27
- CtpAnalysisManager.BASE_URL = "/process-analytics/import/ctp";
28
27
  exports.CtpAnalysisManager = CtpAnalysisManager;
28
+ CtpAnalysisManager.BASE_URL = "/process-analytics/import/ctp";
29
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
  });
@@ -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
  });
@@ -104,10 +104,10 @@
104
104
  return pushUrlWithParams;
105
105
  }
106
106
  }
107
+ exports.PackageManager = PackageManager;
107
108
  PackageManager.PACKAGE_FILE_PREFIX = "package_";
108
109
  PackageManager.PACKAGE_FILE_EXTENSION = ".zip";
109
110
  PackageManager.BASE_URL = "/package-manager/api/packages";
110
111
  PackageManager.IMPORT_ENDPOINT_PATH = "import";
111
112
  PackageManager.EXPORT_ENDPOINT_PATH = "export";
112
- exports.PackageManager = PackageManager;
113
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
  });
@@ -0,0 +1,69 @@
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", "child_process", "../../util/logger", "./base.manager"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const child_process_1 = require("child_process");
22
+ const logger_1 = require("../../util/logger");
23
+ const base_manager_1 = require("./base.manager");
24
+ class WidgetSourcemapsManager extends base_manager_1.BaseManager {
25
+ push() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ return this.pushWidgetSourcemaps(`assets/widgets/${this.service}`, `assets/widgets/${this.service}`);
28
+ });
29
+ }
30
+ pushWidgetSourcemaps(sourcemapsPath, distPathPostfix) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return new Promise((resolve, reject) => {
33
+ if (!process.env.DATADOG_SITE) {
34
+ logger_1.logger.error(new logger_1.GracefulError("Missing DATADOG_SITE"));
35
+ }
36
+ else if (!process.env.DATADOG_API_KEY) {
37
+ logger_1.logger.error(new logger_1.GracefulError("Missing DATADOG_API_KEY"));
38
+ }
39
+ const datadogCiPath = require.resolve("@datadog/datadog-ci/dist/cli.js");
40
+ const commandLines = [
41
+ `node ${datadogCiPath} sourcemaps upload ${this.distPath}/${distPathPostfix}`,
42
+ `--service=${this.service}`,
43
+ `--release-version=${this.releaseVersion}`,
44
+ `--minified-path-prefix=/package-manager/${sourcemapsPath}`,
45
+ ];
46
+ child_process_1.exec(commandLines.join(" "), (error, stdout) => {
47
+ if (error) {
48
+ logger_1.logger.error(new logger_1.GracefulError(error.message));
49
+ }
50
+ else {
51
+ logger_1.logger.info(new logger_1.GracefulError(stdout));
52
+ }
53
+ return resolve(error || stdout);
54
+ });
55
+ });
56
+ });
57
+ }
58
+ getConfig() {
59
+ return {};
60
+ }
61
+ getBody() {
62
+ return {};
63
+ }
64
+ getSerializedFileContent(data) {
65
+ return "";
66
+ }
67
+ }
68
+ exports.WidgetSourcemapsManager = WidgetSourcemapsManager;
69
+ });
@@ -59,9 +59,9 @@
59
59
  return data;
60
60
  }
61
61
  }
62
+ exports.WidgetManager = WidgetManager;
62
63
  WidgetManager.PACKAGE_MANAGER_BASE_URL = "/package-manager";
63
64
  WidgetManager.WIDGET_API = "/api/widgets/upload";
64
65
  WidgetManager.WIDGET_TENANT_INDEPENDENT_API = "/api/widgets/upload-tenant-independently";
65
66
  WidgetManager.WIDGET_USER_SPECIFIC_API = "/api/widgets/upload-user";
66
- exports.WidgetManager = WidgetManager;
67
67
  });
@@ -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
  };
@@ -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
  };
@@ -12,11 +13,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12
13
  if (v !== undefined) module.exports = v;
13
14
  }
14
15
  else if (typeof define === "function" && define.amd) {
15
- define(["require", "exports", "./commands/analysis.command", "./commands/skill.command", "./commands/widget.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/ctp.command", "commander"], factory);
16
+ define(["require", "exports", "commander", "fs", "path", "./commands/analysis.command", "./commands/skill.command", "./commands/widget.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/ctp.command", "./commands/widget-sourcemaps.command"], factory);
16
17
  }
17
18
  })(function (require, exports) {
18
19
  "use strict";
19
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ const commander = require("commander");
22
+ const fs = require("fs");
23
+ const path = require("path");
20
24
  const analysis_command_1 = require("./commands/analysis.command");
21
25
  const skill_command_1 = require("./commands/skill.command");
22
26
  const widget_command_1 = require("./commands/widget.command");
@@ -24,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
28
  const asset_command_1 = require("./commands/asset.command");
25
29
  const package_command_1 = require("./commands/package.command");
26
30
  const ctp_command_1 = require("./commands/ctp.command");
27
- const commander = require("commander");
31
+ const widget_sourcemaps_command_1 = require("./commands/widget-sourcemaps.command");
28
32
  class Push {
29
33
  static analysis(program) {
30
34
  program
@@ -80,6 +84,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
80
84
  .option("--packageManager", "Upload widget to package manager (deprecated)") // Deprecated
81
85
  .action((cmd) => __awaiter(this, void 0, void 0, function* () {
82
86
  yield new widget_command_1.WidgetCommand().pushWidget(cmd.profile, !!cmd.tenantIndependent, !!cmd.userSpecific);
87
+ const zipFileName = path.resolve(process.cwd(), "output.zip");
88
+ fs.unlinkSync(zipFileName);
89
+ process.exit();
90
+ }));
91
+ return program;
92
+ }
93
+ static widgetSourcemaps(program) {
94
+ program
95
+ .command("widget-sourcemaps")
96
+ .description("Command to upload sourcemaps to Datadog RUM")
97
+ .action(() => __awaiter(this, void 0, void 0, function* () {
98
+ yield new widget_sourcemaps_command_1.WidgetSourcemapsCommand().pushSourceMaps();
83
99
  process.exit();
84
100
  }));
85
101
  return program;
@@ -170,6 +186,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
170
186
  Push.assets(commander);
171
187
  Push.package(commander);
172
188
  Push.packages(commander);
189
+ Push.widgetSourcemaps(commander);
173
190
  commander.parse(process.argv);
174
191
  if (!process.argv.slice(2).length) {
175
192
  commander.outputHelp();
@@ -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
  };
package/content-cli.js CHANGED
File without changes
@@ -0,0 +1,4 @@
1
+ export declare class WidgetSourcemapsCommand {
2
+ private widgetSourcemapsFactory;
3
+ pushSourceMaps(): Promise<void>;
4
+ }
@@ -1,7 +1,20 @@
1
1
  import { WidgetManager } from "../manager/widget.manager";
2
+ interface Manifest {
3
+ key: string;
4
+ name: string;
5
+ bundle: string;
6
+ version: string;
7
+ externalResource: string;
8
+ widgets: ManifestWidget[];
9
+ }
10
+ interface ManifestWidget {
11
+ widgetId: string;
12
+ name: string;
13
+ }
2
14
  export declare class WidgetManagerFactory {
3
15
  createManager(tenantIndependent?: boolean, userSpecific?: boolean): WidgetManager;
4
16
  private readContent;
5
- private fetchManifest;
6
- private validateManifest;
17
+ fetchManifest(): Manifest;
18
+ validateManifest(manifest: Manifest): void;
7
19
  }
20
+ export {};
@@ -0,0 +1,5 @@
1
+ import { WidgetSourcemapsManager } from "../manager/widget-sourcemaps.manager";
2
+ export declare class WidgetSourcemapsManagerFactory {
3
+ private widgetManagerFactory;
4
+ createManager(): WidgetSourcemapsManager;
5
+ }
@@ -8,10 +8,14 @@ export declare class AnalysisManager extends BaseManager {
8
8
  private _processId;
9
9
  private _fileName;
10
10
  private _packageManager;
11
- fileName: string;
12
- id: string;
13
- processId: string;
14
- packageManager: boolean;
11
+ get fileName(): string;
12
+ set fileName(value: string);
13
+ get id(): string;
14
+ set id(value: string);
15
+ get processId(): string;
16
+ set processId(value: string);
17
+ get packageManager(): boolean;
18
+ set packageManager(value: boolean);
15
19
  getConfig(): ManagerConfig;
16
20
  getBody(): any;
17
21
  protected getSerializedFileContent(data: any): string;
@@ -8,10 +8,13 @@ export declare class AssetManager extends BaseManager {
8
8
  private _key;
9
9
  private _content;
10
10
  private _packageKey;
11
- key: string;
12
- content: string;
13
- packageKey: string;
14
- private readonly onlyKey;
11
+ get key(): string;
12
+ set key(value: string);
13
+ get content(): string;
14
+ set content(value: string);
15
+ get packageKey(): string;
16
+ set packageKey(value: string);
17
+ private get onlyKey();
15
18
  getConfig(): ManagerConfig;
16
19
  getBody(): any;
17
20
  private toNodeTransport;
@@ -2,7 +2,8 @@ import { Profile } from "../../interfaces/profile.interface";
2
2
  import { ManagerConfig } from "../../interfaces/manager-config.interface";
3
3
  export declare abstract class BaseManager {
4
4
  private httpClientService;
5
- profile: Profile;
5
+ get profile(): Profile;
6
+ set profile(value: Profile);
6
7
  private _profile;
7
8
  pull(): Promise<any>;
8
9
  pullFile(): Promise<any>;
@@ -4,9 +4,12 @@ export declare abstract class CtpManager extends BaseManager {
4
4
  protected _content: any;
5
5
  protected _password: string;
6
6
  protected _spaceKey?: string;
7
- content: any;
8
- password: string;
9
- spaceKey: string;
7
+ get content(): any;
8
+ set content(value: any);
9
+ get password(): string;
10
+ set password(value: string);
11
+ get spaceKey(): string;
12
+ set spaceKey(value: string);
10
13
  getConfig(): ManagerConfig;
11
14
  protected getSerializedFileContent(data: any): string;
12
15
  protected abstract getUrl(): string;
@@ -8,8 +8,10 @@ export declare class DataPoolManager extends BaseManager {
8
8
  private static DATA_POOL_PULL_URL;
9
9
  private _id;
10
10
  private _content;
11
- content: string;
12
- id: string;
11
+ get content(): string;
12
+ set content(value: string);
13
+ get id(): string;
14
+ set id(value: string);
13
15
  getConfig(): ManagerConfig;
14
16
  getBody(): any;
15
17
  protected getSerializedFileContent(data: any): string;
@@ -4,8 +4,10 @@ export declare class ObjectiveManager extends BaseManager {
4
4
  private static BASE_URL;
5
5
  private _id;
6
6
  private _content;
7
- content: string;
8
- id: string;
7
+ get content(): string;
8
+ set content(value: string);
9
+ get id(): string;
10
+ set id(value: string);
9
11
  getConfig(): ManagerConfig;
10
12
  getBody(): any;
11
13
  protected getSerializedFileContent(data: any): string;
@@ -13,13 +13,20 @@ export declare class PackageManager extends BaseManager {
13
13
  private _newKey;
14
14
  private _overwrite;
15
15
  private _draft;
16
- key: string;
17
- spaceKey: string;
18
- fileName: string;
19
- store: boolean;
20
- newKey: string;
21
- overwrite: boolean;
22
- draft: boolean;
16
+ get key(): string;
17
+ set key(value: string);
18
+ get spaceKey(): string;
19
+ set spaceKey(value: string);
20
+ get fileName(): string;
21
+ set fileName(value: string);
22
+ get store(): boolean;
23
+ set store(value: boolean);
24
+ get newKey(): string;
25
+ set newKey(value: string);
26
+ get overwrite(): boolean;
27
+ set overwrite(value: boolean);
28
+ get draft(): boolean;
29
+ set draft(value: boolean);
23
30
  getConfig(): ManagerConfig;
24
31
  getBody(): any;
25
32
  protected getSerializedFileContent(data: any): string;
@@ -5,9 +5,12 @@ export declare class SkillManager extends BaseManager {
5
5
  private _skillId;
6
6
  private _projectId;
7
7
  private _content;
8
- content: any;
9
- skillId: string;
10
- projectId: string;
8
+ get content(): any;
9
+ set content(value: any);
10
+ get skillId(): string;
11
+ set skillId(value: string);
12
+ get projectId(): string;
13
+ set projectId(value: string);
11
14
  getConfig(): ManagerConfig;
12
15
  getBody(): any;
13
16
  protected getSerializedFileContent(data: any): string;
@@ -0,0 +1,12 @@
1
+ import { ManagerConfig } from "../../interfaces/manager-config.interface";
2
+ import { BaseManager } from "./base.manager";
3
+ export declare class WidgetSourcemapsManager extends BaseManager {
4
+ service: string;
5
+ releaseVersion: string;
6
+ distPath: string;
7
+ push(): Promise<any>;
8
+ private pushWidgetSourcemaps;
9
+ protected getConfig(): ManagerConfig;
10
+ protected getBody(): object;
11
+ protected getSerializedFileContent(data: any): string;
12
+ }
@@ -8,9 +8,12 @@ export declare class WidgetManager extends BaseManager {
8
8
  private _content;
9
9
  private _tenantIndependent;
10
10
  private _userSpecific;
11
- content: any;
12
- tenantIndependent: any;
13
- userSpecific: any;
11
+ get content(): any;
12
+ set content(value: any);
13
+ get tenantIndependent(): any;
14
+ set tenantIndependent(value: any);
15
+ get userSpecific(): any;
16
+ set userSpecific(value: any);
14
17
  getConfig(): ManagerConfig;
15
18
  getBody(): any;
16
19
  protected getSerializedFileContent(data: any): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -14,6 +14,7 @@
14
14
  "lint": "tslint -p ."
15
15
  },
16
16
  "dependencies": {
17
+ "@datadog/datadog-ci": "^0.17.12",
17
18
  "adm-zip": "^0.4.14",
18
19
  "commander": "^6.0.0",
19
20
  "request": "^2.88.0",
@@ -24,7 +25,8 @@
24
25
  "yaml": "^1.7.2"
25
26
  },
26
27
  "devDependencies": {
27
- "@types/node": "~8.9.4",
28
+ "@types/adm-zip": "^0.4.34",
29
+ "@types/node": "^16.11.19",
28
30
  "@types/request": "~2.48.1",
29
31
  "husky": "^4.0.3",
30
32
  "lint-staged": "^9.5.0",
@@ -32,7 +34,7 @@
32
34
  "tslint": "^5.20.1",
33
35
  "tslint-config-prettier": "^1.18.0",
34
36
  "tslint-consistent-codestyle": "^1.16.0",
35
- "typescript": "3.1.6"
37
+ "typescript": "~3.8.0"
36
38
  },
37
39
  "husky": {
38
40
  "hooks": {
@@ -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
  };
@@ -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
  };
@@ -27,10 +28,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
27
28
  });
28
29
  }
29
30
  }
31
+ exports.QuestionService = QuestionService;
30
32
  QuestionService.readLine = readline.createInterface({
31
33
  input: process.stdin,
32
34
  output: process.stdout,
33
35
  terminal: true,
34
36
  });
35
- exports.QuestionService = QuestionService;
36
37
  });
@@ -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
  };