Skip to content

Commit

Permalink
Merge branch 'master' into j-halili/EMA-4088_add-action-flows-import-…
Browse files Browse the repository at this point in the history
…export-analyze-functionality
  • Loading branch information
jetmirhalili11 committed Aug 26, 2024
2 parents 54164d6 + 141ad70 commit f07dddc
Show file tree
Hide file tree
Showing 28 changed files with 347 additions and 332 deletions.
21 changes: 20 additions & 1 deletion DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,26 @@ your profiles by running the ***content-cli profile list*** command.
| Note: Please do not use blanks in profile names |
|-------------------------------------------------|

#### API Token
#### Profile Types
You can create profiles of two types: using OAuth (Device Code
or Client Credentials) or using API Tokens (Application Key / API Key):

##### OAuth

OAuth supports with two grant types: Device Code & Client Credentials.

With Device Code, creating the profile will trigger an authorization flow
(using the OAuth 2.0 Device code). You will be prompted to follow an authorization
link where you must authorize the **Content CLI** to be able to access the EMS environment
on your behalf.

With Client Credentials, you need to provide the credentials (Client ID, Client Secret) configured for your OAuth client.
You can create and configure an OAuth clients in the `Admin & Settings` section of your EMS account, under `Applications`.
The OAuth client needs to have the following scopes configured: studio, integration.data-pools, action-engine.projects.
After creating an OAuth client, you should assign it the permissions necessary for the respective commands. More
information on registering OAuth clients can be found [here](https://docs.celonis.com/en/registering-oauth-client.html).

##### API Token

You can choose between two different options when asked for an API token.
The first option is to use an API key, which identifies the user that created
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@celonis/content-cli",
"version": "0.8.5",
"version": "0.10.0",
"description": "CLI Tool to help manage content in Celonis EMS",
"main": "content-cli.js",
"bin": {
Expand All @@ -20,6 +20,7 @@
"axios": "1.6.2",
"commander": "^6.0.0",
"form-data": "4.0.0",
"openid-client": "^5.6.1",
"hpagent": "^1.2.0",
"semver": "^7.3.2",
"valid-url": "^1.0.9",
Expand Down
15 changes: 0 additions & 15 deletions src/commands/objective.command.ts

This file was deleted.

25 changes: 22 additions & 3 deletions src/commands/profile.command.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { QuestionService } from "../services/question.service";
import { Profile } from "../interfaces/profile.interface";
import {Profile, ProfileType} from "../interfaces/profile.interface";
import { ProfileService } from "../services/profile.service";
import { ProfileValidator } from "../validators/profile.validator";
import { logger } from "../util/logger";
import { FatalError, logger } from "../util/logger";

export class ProfileCommand {
private profileService = new ProfileService();
Expand All @@ -11,8 +11,27 @@ export class ProfileCommand {
const profile: Profile = {} as Profile;
profile.name = await QuestionService.ask("Name of the profile: ");
profile.team = await QuestionService.ask("Your team (please provide the full url): ");
profile.apiToken = await QuestionService.ask("Your api token: ");
const type = await QuestionService.ask("Profile type: OAuth Device Code (1), OAuth Client Credentials (2) or Application Key / API Key (3): " );
switch (type) {
case "1":
profile.type = ProfileType.DEVICE_CODE;
break;
case "2":
profile.type = ProfileType.CLIENT_CREDENTIALS;
profile.clientId = await QuestionService.ask("Your client id: ");
profile.clientSecret = await QuestionService.ask("Your client secret: ");
break;
case "3":
profile.type = ProfileType.KEY;
profile.apiToken = await QuestionService.ask("Your api token: ");
break;
default:
logger.error(new FatalError("Invalid type"));
break;
}
profile.authenticationType = await ProfileValidator.validateProfile(profile);
await this.profileService.authorizeProfile(profile);

this.profileService.storeProfile(profile);
if (setAsDefault) {
await this.makeDefaultProfile(profile.name);
Expand Down
9 changes: 0 additions & 9 deletions src/commands/widget-sourcemaps.command.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/content-cli-pull.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AnalysisCommand } from "./commands/analysis.command";
import { SkillCommand } from "./commands/skill.command";
import { ObjectiveCommand } from "./commands/objective.command";
import { DataPoolCommand } from "./commands/data-pool.command";
import { AssetCommand } from "./commands/asset.command";
import { PackageCommand } from "./commands/package.command";
Expand Down Expand Up @@ -55,20 +54,6 @@ class Pull {
return program;
}

public static objective(program: CommanderStatic): CommanderStatic {
program
.command("objective")
.description("Command to pull an objective")
.option("-p, --profile <profile>", "Profile which you want to use to pull the objective")
.requiredOption("--id <id>", "Id of the objective you want to pull")
.action(async cmd => {
await new ObjectiveCommand().pullObjective(cmd.profile, cmd.id);
process.exit();
});

return program;
}

public static dataPool(program: CommanderStatic): CommanderStatic {
program
.command("data-pool")
Expand Down Expand Up @@ -118,7 +103,6 @@ class Pull {
Pull.analysis(commander);
Pull.analysisBookmarks(commander);
Pull.skill(commander);
Pull.objective(commander);
Pull.dataPool(commander);
Pull.asset(commander);
Pull.package(commander);
Expand Down
14 changes: 0 additions & 14 deletions src/content-cli-push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { DataPoolCommand } from "./commands/data-pool.command";
import { AssetCommand } from "./commands/asset.command";
import { PackageCommand } from "./commands/package.command";
import { CTPCommand } from "./commands/ctp.command";
import { WidgetSourcemapsCommand } from "./commands/widget-sourcemaps.command";
import { AnalysisBookmarksCommand } from "./commands/analysis-bookmarks.command";
import { execSync } from "child_process";
import { GracefulError, logger } from "./util/logger";
Expand Down Expand Up @@ -134,18 +133,6 @@ class Push {
return program;
}

public static widgetSourcemaps(program: CommanderStatic): CommanderStatic {
program
.command("widget-sourcemaps")
.description("Command to upload sourcemaps to Datadog RUM")
.action(async () => {
await new WidgetSourcemapsCommand().pushSourceMaps();
process.exit();
});

return program;
}

public static dataPool(program: CommanderStatic): CommanderStatic {
program
.command("data-pool")
Expand Down Expand Up @@ -244,7 +231,6 @@ Push.asset(commander);
Push.assets(commander);
Push.package(commander);
Push.packages(commander);
Push.widgetSourcemaps(commander);

commander.parse(process.argv);

Expand Down
22 changes: 0 additions & 22 deletions src/content/factory/objective-manager.factory.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/content/factory/widget-sourcemaps-manager.factory.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/content/manager/analysis-bookmarks.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from "fs";
import * as FormData from "form-data";

export class AnalysisBookmarksManager extends BaseManager {
private static BASE_URL = "/process-analytics/api/bookmarks/";
private static BASE_URL = "/process-analytics/api/bookmarks";
private static ANALYSIS_BOOKMARKS_FILE_PREFIX = "studio_analysis_bookmarks_";

private _analysisId: string;
Expand Down
46 changes: 0 additions & 46 deletions src/content/manager/objective.manager.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/content/manager/skill.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ManagerConfig } from "../../interfaces/manager-config.interface";
import * as FormData from "form-data";

export class SkillManager extends BaseManager {
private static BASE_URL = "/action-engine/api/projects/";
private static BASE_URL = "/action-engine/api/projects";
private _skillId: string;
private _projectId: string;
private _content: any;
Expand Down
69 changes: 0 additions & 69 deletions src/content/manager/widget-sourcemaps.manager.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/interfaces/batch-export-import-constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export enum BatchExportImportConstants {
STUDIO_FILE_NAME = "studio.yml",
VARIABLES_FILE_NAME = "variables.yml",
MANIFEST_FILE_NAME = "manifest.yml",
STUDIO_FILE_NAME = "studio.json",
VARIABLES_FILE_NAME = "variables.json",
MANIFEST_FILE_NAME = "manifest.json",
STUDIO = "STUDIO",
APP_MODE_VIEWER = "VIEWER",
ZIP_EXTENSION = ".zip",
YAML_EXTENSION = ".yml",
JSON_EXTENSION = ".json",
NODES_FOLDER_NAME = "nodes/",
SCENARIO_NODE = "SCENARIO"
}
Loading

0 comments on commit f07dddc

Please sign in to comment.