@celonis/content-cli 0.11.1 → 0.12.0

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.
@@ -13,12 +13,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
16
- define(["require", "exports", "./commands/analysis.command", "./commands/skill.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/analysis-bookmarks.command", "commander"], factory);
16
+ define(["require", "exports", "./commands/skill.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/analysis-bookmarks.command", "commander"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- const analysis_command_1 = require("./commands/analysis.command");
22
21
  const skill_command_1 = require("./commands/skill.command");
23
22
  const data_pool_command_1 = require("./commands/data-pool.command");
24
23
  const asset_command_1 = require("./commands/asset.command");
@@ -26,19 +25,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
26
25
  const analysis_bookmarks_command_1 = require("./commands/analysis-bookmarks.command");
27
26
  const commander = require("commander");
28
27
  class Pull {
29
- static analysis(program) {
30
- program
31
- .command("analysis")
32
- .description("Command to pull an analysis")
33
- .option("-p, --profile <profile>", "Profile which you want to use to pull the analysis")
34
- .requiredOption("--id <id>", "Id of the analysis you want to pull")
35
- .option("--asset", "Pull workflow as an asset")
36
- .action((cmd) => __awaiter(this, void 0, void 0, function* () {
37
- yield new analysis_command_1.AnalysisCommand().pullAnalysis(cmd.profile, cmd.id, !!cmd.asset);
38
- process.exit();
39
- }));
40
- return program;
41
- }
42
28
  static analysisBookmarks(program) {
43
29
  program
44
30
  .command("bookmarks")
@@ -105,7 +91,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
105
91
  return program;
106
92
  }
107
93
  }
108
- Pull.analysis(commander);
109
94
  Pull.analysisBookmarks(commander);
110
95
  Pull.skill(commander);
111
96
  Pull.dataPool(commander);
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  if (v !== undefined) module.exports = v;
14
14
  }
15
15
  else if (typeof define === "function" && define.amd) {
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/analysis-bookmarks.command", "child_process", "./util/logger"], factory);
16
+ define(["require", "exports", "commander", "fs", "path", "./commands/skill.command", "./commands/widget.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "./commands/ctp.command", "./commands/analysis-bookmarks.command", "child_process", "./util/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -21,7 +21,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  const commander = require("commander");
22
22
  const fs = require("fs");
23
23
  const path = require("path");
24
- const analysis_command_1 = require("./commands/analysis.command");
25
24
  const skill_command_1 = require("./commands/skill.command");
26
25
  const widget_command_1 = require("./commands/widget.command");
27
26
  const data_pool_command_1 = require("./commands/data-pool.command");
@@ -32,19 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
31
  const child_process_1 = require("child_process");
33
32
  const logger_1 = require("./util/logger");
34
33
  class Push {
35
- static analysis(program) {
36
- program
37
- .command("analysis")
38
- .description("Command to push an analysis to a workspace")
39
- .option("-p, --profile <profile>", "Profile which you want to use to push the analysis")
40
- .requiredOption("--workspaceId <workspaceId>", "Id of the workspace to which you want to push the analysis")
41
- .requiredOption("-f, --file <file>", "The file you want to push")
42
- .action((cmd) => __awaiter(this, void 0, void 0, function* () {
43
- yield new analysis_command_1.AnalysisCommand().pushAnalysis(cmd.profile, cmd.workspaceId, cmd.file);
44
- process.exit();
45
- }));
46
- return program;
47
- }
48
34
  static analysisBookmarks(program) {
49
35
  program
50
36
  .command("bookmarks")
@@ -192,7 +178,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
192
178
  return program;
193
179
  }
194
180
  }
195
- Push.analysis(commander);
196
181
  Push.analysisBookmarks(commander);
197
182
  Push.ctp(commander);
198
183
  Push.skill(commander);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -1,41 +0,0 @@
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", "../services/content.service", "../content/factory/analysis-manager.factory"], factory);
17
- }
18
- })(function (require, exports) {
19
- "use strict";
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.AnalysisCommand = void 0;
22
- const content_service_1 = require("../services/content.service");
23
- const analysis_manager_factory_1 = require("../content/factory/analysis-manager.factory");
24
- class AnalysisCommand {
25
- constructor() {
26
- this.contentService = new content_service_1.ContentService();
27
- this.analysisManagerFactory = new analysis_manager_factory_1.AnalysisManagerFactory();
28
- }
29
- pullAnalysis(profile, id, packageManager) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- yield this.contentService.pull(profile, this.analysisManagerFactory.createManager(id, null, null, packageManager));
32
- });
33
- }
34
- pushAnalysis(profile, workspaceId, filename) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- yield this.contentService.push(profile, this.analysisManagerFactory.createManager(null, workspaceId, filename));
37
- });
38
- }
39
- }
40
- exports.AnalysisCommand = AnalysisCommand;
41
- });
@@ -1,36 +0,0 @@
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", "fs", "path", "../../util/logger", "../manager/analysis.manager"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AnalysisManagerFactory = void 0;
13
- const fs = require("fs");
14
- const path = require("path");
15
- const logger_1 = require("../../util/logger");
16
- const analysis_manager_1 = require("../manager/analysis.manager");
17
- class AnalysisManagerFactory {
18
- createManager(id, processId, filename, packageManager) {
19
- const analysisManager = new analysis_manager_1.AnalysisManager();
20
- analysisManager.id = id;
21
- analysisManager.processId = processId;
22
- if (filename !== null) {
23
- analysisManager.fileName = this.resolvePackageFilePath(filename);
24
- }
25
- analysisManager.packageManager = packageManager;
26
- return analysisManager;
27
- }
28
- resolvePackageFilePath(fileName) {
29
- if (!fs.existsSync(path.resolve(process.cwd(), fileName))) {
30
- logger_1.logger.error(new logger_1.FatalError("The provided file does not exist"));
31
- }
32
- return path.resolve(process.cwd(), fileName);
33
- }
34
- }
35
- exports.AnalysisManagerFactory = AnalysisManagerFactory;
36
- });
@@ -1,72 +0,0 @@
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", "./base.manager", "./asset.manager", "fs", "../../util/yaml", "form-data"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AnalysisManager = void 0;
13
- const base_manager_1 = require("./base.manager");
14
- const asset_manager_1 = require("./asset.manager");
15
- const fs = require("fs");
16
- const yaml_1 = require("../../util/yaml");
17
- const FormData = require("form-data");
18
- class AnalysisManager extends base_manager_1.BaseManager {
19
- get fileName() {
20
- return this._fileName;
21
- }
22
- set fileName(value) {
23
- this._fileName = value;
24
- }
25
- get id() {
26
- return this._id;
27
- }
28
- set id(value) {
29
- this._id = value;
30
- }
31
- get processId() {
32
- return this._processId;
33
- }
34
- set processId(value) {
35
- this._processId = value;
36
- }
37
- get packageManager() {
38
- return this._packageManager;
39
- }
40
- set packageManager(value) {
41
- this._packageManager = value;
42
- }
43
- getConfig() {
44
- const pullUrl = this.packageManager
45
- ? `${AnalysisManager.BASE_URL}${this.id}/package/export`
46
- : `${AnalysisManager.PULL_URL}${this.id}`;
47
- return {
48
- pushUrl: this.profile.team.replace(/\/?$/, `${AnalysisManager.BASE_URL}/import?processId=${this.processId}`),
49
- pullUrl: this.profile.team.replace(/\/?$/, pullUrl),
50
- exportFileName: `${this.packageManager ? asset_manager_1.AssetManager.ASSET_FILE_PREFIX : AnalysisManager.ANALYSIS_FILE_PREFIX}${this.id}${this.packageManager ? ".yaml" : ".json"}`,
51
- onPushSuccessMessage: (data) => {
52
- return "Analysis was pushed successfully. New ID: " + data.id;
53
- },
54
- };
55
- }
56
- getBody() {
57
- const formData = new FormData();
58
- formData.append("file", fs.createReadStream(this.fileName));
59
- return formData;
60
- }
61
- getSerializedFileContent(data) {
62
- if (this.packageManager) {
63
- return (0, yaml_1.stringify)(data);
64
- }
65
- return JSON.stringify(data);
66
- }
67
- }
68
- exports.AnalysisManager = AnalysisManager;
69
- AnalysisManager.BASE_URL = "/process-mining/api/analysis/";
70
- AnalysisManager.PULL_URL = `${AnalysisManager.BASE_URL}/export?id=`;
71
- AnalysisManager.ANALYSIS_FILE_PREFIX = "analysis_";
72
- });
@@ -1,6 +0,0 @@
1
- export declare class AnalysisCommand {
2
- private contentService;
3
- private analysisManagerFactory;
4
- pullAnalysis(profile: string, id: string, packageManager: boolean): Promise<void>;
5
- pushAnalysis(profile: string, workspaceId: string, filename: string): Promise<void>;
6
- }
@@ -1,5 +0,0 @@
1
- import { AnalysisManager } from "../manager/analysis.manager";
2
- export declare class AnalysisManagerFactory {
3
- createManager(id: string, processId: string, filename: string, packageManager?: boolean): AnalysisManager;
4
- private resolvePackageFilePath;
5
- }
@@ -1,22 +0,0 @@
1
- import { BaseManager } from "./base.manager";
2
- import { ManagerConfig } from "../../interfaces/manager-config.interface";
3
- export declare class AnalysisManager extends BaseManager {
4
- private static BASE_URL;
5
- private static PULL_URL;
6
- private static ANALYSIS_FILE_PREFIX;
7
- private _id;
8
- private _processId;
9
- private _fileName;
10
- private _packageManager;
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);
19
- getConfig(): ManagerConfig;
20
- getBody(): any;
21
- protected getSerializedFileContent(data: any): string;
22
- }