@celonis/content-cli 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
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-bookmarks-manager.factory"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const content_service_1 = require("../services/content.service");
22
+ const analysis_bookmarks_manager_factory_1 = require("../content/factory/analysis-bookmarks-manager.factory");
23
+ class AnalysisBookmarksCommand {
24
+ constructor() {
25
+ this.contentService = new content_service_1.ContentService();
26
+ this.analysisBookmarksManagerFactory = new analysis_bookmarks_manager_factory_1.AnalysisBookmarksManagerFactory();
27
+ }
28
+ pullAnalysisBookmarks(profile, analysisId, type) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ yield this.contentService.pull(profile, this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(null, analysisId, type));
31
+ });
32
+ }
33
+ pushAnalysisBookmarks(profile, analysisId, filename) {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ yield this.contentService.push(profile, this.analysisBookmarksManagerFactory.createAnalysisBookmarksManager(filename, analysisId));
36
+ });
37
+ }
38
+ }
39
+ exports.AnalysisBookmarksCommand = AnalysisBookmarksCommand;
40
+ });
@@ -0,0 +1,35 @@
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/space-manager.factory"], factory);
17
+ }
18
+ })(function (require, exports) {
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const content_service_1 = require("../services/content.service");
22
+ const space_manager_factory_1 = require("../content/factory/space-manager.factory");
23
+ class SpaceCommand {
24
+ constructor() {
25
+ this.contentService = new content_service_1.ContentService();
26
+ this.spaceManagerFactory = new space_manager_factory_1.SpaceManagerFactory();
27
+ }
28
+ listSpaces(profile) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ yield this.contentService.findAll(profile, this.spaceManagerFactory.createManager());
31
+ });
32
+ }
33
+ }
34
+ exports.SpaceCommand = SpaceCommand;
35
+ });
@@ -0,0 +1,37 @@
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-bookmarks.manager"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const logger_1 = require("../../util/logger");
15
+ const analysis_bookmarks_manager_1 = require("../manager/analysis-bookmarks.manager");
16
+ class AnalysisBookmarksManagerFactory {
17
+ createAnalysisBookmarksManager(filename, analysisId, type) {
18
+ const analysisBookmarksManager = new analysis_bookmarks_manager_1.AnalysisBookmarksManager();
19
+ analysisBookmarksManager.analysisId = analysisId;
20
+ if (type === undefined || type === null) {
21
+ type = "user";
22
+ }
23
+ analysisBookmarksManager.type = type;
24
+ if (filename !== null) {
25
+ analysisBookmarksManager.fileName = this.readFile(filename);
26
+ }
27
+ return analysisBookmarksManager;
28
+ }
29
+ readFile(fileName) {
30
+ if (!fs.existsSync(path.resolve(process.cwd(), fileName))) {
31
+ logger_1.logger.error(new logger_1.FatalError("The provided file does not exist"));
32
+ }
33
+ return path.resolve(process.cwd(), fileName);
34
+ }
35
+ }
36
+ exports.AnalysisBookmarksManagerFactory = AnalysisBookmarksManagerFactory;
37
+ });
@@ -0,0 +1,19 @@
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", "../manager/space.manager"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const space_manager_1 = require("../manager/space.manager");
13
+ class SpaceManagerFactory {
14
+ createManager() {
15
+ return new space_manager_1.SpaceManager();
16
+ }
17
+ }
18
+ exports.SpaceManagerFactory = SpaceManagerFactory;
19
+ });
@@ -0,0 +1,60 @@
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", "yaml", "fs"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const base_manager_1 = require("./base.manager");
13
+ const YAML = require("yaml");
14
+ const fs = require("fs");
15
+ YAML.scalarOptions.str.doubleQuoted.jsonEncoding = true;
16
+ class AnalysisBookmarksManager extends base_manager_1.BaseManager {
17
+ get fileName() {
18
+ return this._fileName;
19
+ }
20
+ set fileName(value) {
21
+ this._fileName = value;
22
+ }
23
+ get analysisId() {
24
+ return this._analysisId;
25
+ }
26
+ set analysisId(value) {
27
+ this._analysisId = value;
28
+ }
29
+ get type() {
30
+ return this._type;
31
+ }
32
+ set type(value) {
33
+ this._type = value;
34
+ }
35
+ getConfig() {
36
+ const pullUrl = `${AnalysisBookmarksManager.BASE_URL}/export?analysisId=${this.analysisId}&type=${this.type}`;
37
+ return {
38
+ pushUrl: this.profile.team.replace(/\/?$/, `${AnalysisBookmarksManager.BASE_URL}/import?analysisId=${this.analysisId}`),
39
+ pullUrl: this.profile.team.replace(/\/?$/, pullUrl),
40
+ exportFileName: `${AnalysisBookmarksManager.ANALYSIS_BOOKMARKS_FILE_PREFIX}${this.analysisId}${".json"}`,
41
+ onPushSuccessMessage: () => {
42
+ return "Analysis Bookmarks was pushed successfully.";
43
+ },
44
+ };
45
+ }
46
+ getBody() {
47
+ return {
48
+ formData: {
49
+ file: fs.createReadStream(this.fileName),
50
+ },
51
+ };
52
+ }
53
+ getSerializedFileContent(data) {
54
+ return JSON.stringify(data);
55
+ }
56
+ }
57
+ exports.AnalysisBookmarksManager = AnalysisBookmarksManager;
58
+ AnalysisBookmarksManager.BASE_URL = "/process-analytics/api/bookmarks/";
59
+ AnalysisBookmarksManager.ANALYSIS_BOOKMARKS_FILE_PREFIX = "studio_analysis_bookmarks_";
60
+ });
@@ -0,0 +1,47 @@
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", "../../util/logger"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const base_manager_1 = require("./base.manager");
13
+ const logger_1 = require("../../util/logger");
14
+ class SpaceManager extends base_manager_1.BaseManager {
15
+ get id() {
16
+ return this._id;
17
+ }
18
+ set id(value) {
19
+ this._id = value;
20
+ }
21
+ get name() {
22
+ return this._name;
23
+ }
24
+ set name(value) {
25
+ this._name = value;
26
+ }
27
+ getConfig() {
28
+ return {
29
+ findAllUrl: this.profile.team.replace(/\/?$/, SpaceManager.BASE_URL),
30
+ onFindAll: (data) => this.listSpaces(data),
31
+ };
32
+ }
33
+ listSpaces(nodes) {
34
+ nodes.forEach(node => {
35
+ logger_1.logger.info(`${node.id} - Name: "${node.name}"`);
36
+ });
37
+ }
38
+ getBody() {
39
+ return {};
40
+ }
41
+ getSerializedFileContent(data) {
42
+ return "";
43
+ }
44
+ }
45
+ exports.SpaceManager = SpaceManager;
46
+ SpaceManager.BASE_URL = "/package-manager/api/spaces";
47
+ });
@@ -13,12 +13,13 @@ 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/package.command", "commander"], factory);
16
+ define(["require", "exports", "./commands/package.command", "./commands/space.command", "commander"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  const package_command_1 = require("./commands/package.command");
22
+ const space_command_1 = require("./commands/space.command");
22
23
  const commander = require("commander");
23
24
  class List {
24
25
  static packages(program) {
@@ -32,8 +33,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
33
  }));
33
34
  return program;
34
35
  }
36
+ static spaces(program) {
37
+ program
38
+ .command("spaces")
39
+ .description("Command to list all spaces")
40
+ .option("-p, --profile <profile>", "Profile which you want to use to list spaces")
41
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
42
+ yield new space_command_1.SpaceCommand().listSpaces(cmd.profile);
43
+ process.exit();
44
+ }));
45
+ return program;
46
+ }
35
47
  }
36
48
  List.packages(commander);
49
+ List.spaces(commander);
37
50
  commander.parse(process.argv);
38
51
  if (!process.argv.slice(2).length) {
39
52
  commander.outputHelp();
@@ -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", "./commands/analysis.command", "./commands/skill.command", "./commands/objective.command", "./commands/data-pool.command", "./commands/asset.command", "./commands/package.command", "commander"], factory);
16
+ define(["require", "exports", "./commands/analysis.command", "./commands/skill.command", "./commands/objective.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";
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  const data_pool_command_1 = require("./commands/data-pool.command");
25
25
  const asset_command_1 = require("./commands/asset.command");
26
26
  const package_command_1 = require("./commands/package.command");
27
+ const analysis_bookmarks_command_1 = require("./commands/analysis-bookmarks.command");
27
28
  const commander = require("commander");
28
29
  class Pull {
29
30
  static analysis(program) {
@@ -39,6 +40,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
39
40
  }));
40
41
  return program;
41
42
  }
43
+ static analysisBookmarks(program) {
44
+ program
45
+ .command("bookmarks")
46
+ .description("Command to pull an analysis bookmarks")
47
+ .option("-p, --profile <profile>", "Profile which you want to use to pull the analysis bookmarks")
48
+ .option("--type <type>", "Pull shared/all Analysis Bookmarks, else by default get user bookmarks")
49
+ .requiredOption("--id <id>", "Id of the analysis you want to pull")
50
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
51
+ yield new analysis_bookmarks_command_1.AnalysisBookmarksCommand().pullAnalysisBookmarks(cmd.profile, cmd.id, cmd.type);
52
+ process.exit();
53
+ }));
54
+ return program;
55
+ }
42
56
  static skill(program) {
43
57
  program
44
58
  .command("skill")
@@ -105,6 +119,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
105
119
  }
106
120
  }
107
121
  Pull.analysis(commander);
122
+ Pull.analysisBookmarks(commander);
108
123
  Pull.skill(commander);
109
124
  Pull.objective(commander);
110
125
  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/widget-sourcemaps.command", "child_process", "./util/logger"], 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", "./commands/analysis-bookmarks.command", "child_process", "./util/logger"], factory);
17
17
  }
18
18
  })(function (require, exports) {
19
19
  "use strict";
@@ -29,6 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  const package_command_1 = require("./commands/package.command");
30
30
  const ctp_command_1 = require("./commands/ctp.command");
31
31
  const widget_sourcemaps_command_1 = require("./commands/widget-sourcemaps.command");
32
+ const analysis_bookmarks_command_1 = require("./commands/analysis-bookmarks.command");
32
33
  const child_process_1 = require("child_process");
33
34
  const logger_1 = require("./util/logger");
34
35
  class Push {
@@ -45,6 +46,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
46
  }));
46
47
  return program;
47
48
  }
49
+ static analysisBookmarks(program) {
50
+ program
51
+ .command("bookmarks")
52
+ .description("Command to push an analysis to a workspace")
53
+ .option("-p, --profile <profile>", "Profile which you want to use to push the analysis")
54
+ .requiredOption("--id <id>", "Id of the Analysis to which you want to push the analysis bookmarks")
55
+ .requiredOption("-f, --file <file>", "The file you want to push")
56
+ .action((cmd) => __awaiter(this, void 0, void 0, function* () {
57
+ yield new analysis_bookmarks_command_1.AnalysisBookmarksCommand().pushAnalysisBookmarks(cmd.profile, cmd.id, cmd.file);
58
+ process.exit();
59
+ }));
60
+ return program;
61
+ }
48
62
  static ctp(program) {
49
63
  program
50
64
  .command("ctp")
@@ -190,6 +204,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
190
204
  }
191
205
  }
192
206
  Push.analysis(commander);
207
+ Push.analysisBookmarks(commander);
193
208
  Push.ctp(commander);
194
209
  Push.skill(commander);
195
210
  Push.widget(commander);
@@ -0,0 +1,12 @@
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"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
@@ -0,0 +1,6 @@
1
+ export declare class AnalysisBookmarksCommand {
2
+ private contentService;
3
+ private analysisBookmarksManagerFactory;
4
+ pullAnalysisBookmarks(profile: string, analysisId: string, type: string): Promise<void>;
5
+ pushAnalysisBookmarks(profile: string, analysisId: string, filename: string): Promise<void>;
6
+ }
@@ -0,0 +1,5 @@
1
+ export declare class SpaceCommand {
2
+ private contentService;
3
+ private spaceManagerFactory;
4
+ listSpaces(profile: string): Promise<void>;
5
+ }
@@ -0,0 +1,5 @@
1
+ import { AnalysisBookmarksManager } from "../manager/analysis-bookmarks.manager";
2
+ export declare class AnalysisBookmarksManagerFactory {
3
+ createAnalysisBookmarksManager(filename: string, analysisId: string, type?: string): AnalysisBookmarksManager;
4
+ private readFile;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { SpaceManager } from "../manager/space.manager";
2
+ export declare class SpaceManagerFactory {
3
+ createManager(): SpaceManager;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseManager } from "./base.manager";
2
+ import { ManagerConfig } from "../../interfaces/manager-config.interface";
3
+ export declare class AnalysisBookmarksManager extends BaseManager {
4
+ private static BASE_URL;
5
+ private static ANALYSIS_BOOKMARKS_FILE_PREFIX;
6
+ private _analysisId;
7
+ private _fileName;
8
+ private _type;
9
+ get fileName(): string;
10
+ set fileName(value: string);
11
+ get analysisId(): string;
12
+ set analysisId(value: string);
13
+ get type(): string;
14
+ set type(value: string);
15
+ getConfig(): ManagerConfig;
16
+ getBody(): any;
17
+ protected getSerializedFileContent(data: any): string;
18
+ }
@@ -0,0 +1,15 @@
1
+ import { ManagerConfig } from "../../interfaces/manager-config.interface";
2
+ import { BaseManager } from "./base.manager";
3
+ export declare class SpaceManager extends BaseManager {
4
+ private static BASE_URL;
5
+ private _id;
6
+ private _name;
7
+ get id(): string;
8
+ set id(value: string);
9
+ get name(): string;
10
+ set name(value: string);
11
+ getConfig(): ManagerConfig;
12
+ private listSpaces;
13
+ protected getBody(): object;
14
+ protected getSerializedFileContent(data: any): string;
15
+ }
@@ -0,0 +1,4 @@
1
+ export interface SaveSpace {
2
+ id: string;
3
+ name: string;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "CLI Tool to help manage content in Celonis EMS",
5
5
  "main": "content-cli.js",
6
6
  "bin": {