@celonis/content-cli 1.9.0 → 1.9.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.
@@ -42,6 +42,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  });
43
43
  });
44
44
  }
45
+ getSchema(assetType) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ return this.httpClient()
48
+ .get(`/pacman/api/core/asset-registry/schemas/${encodeURIComponent(assetType)}`)
49
+ .catch((e) => {
50
+ throw new logger_1.FatalError(`Problem getting schema for asset type '${assetType}': ${e}`);
51
+ });
52
+ });
53
+ }
54
+ getExamples(assetType) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ return this.httpClient()
57
+ .get(`/pacman/api/core/asset-registry/examples/${encodeURIComponent(assetType)}`)
58
+ .catch((e) => {
59
+ throw new logger_1.FatalError(`Problem getting examples for asset type '${assetType}': ${e}`);
60
+ });
61
+ });
62
+ }
63
+ getMethodology(assetType) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ return this.httpClient()
66
+ .get(`/pacman/api/core/asset-registry/methodologies/${encodeURIComponent(assetType)}`)
67
+ .catch((e) => {
68
+ throw new logger_1.FatalError(`Problem getting methodology for asset type '${assetType}': ${e}`);
69
+ });
70
+ });
71
+ }
45
72
  }
46
73
  exports.AssetRegistryApi = AssetRegistryApi;
47
74
  });
@@ -60,6 +60,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
60
60
  }
61
61
  });
62
62
  }
63
+ getSchema(assetType, jsonResponse) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const data = yield this.api.getSchema(assetType);
66
+ this.outputResponse(data, jsonResponse);
67
+ });
68
+ }
69
+ getExamples(assetType, jsonResponse) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const data = yield this.api.getExamples(assetType);
72
+ this.outputResponse(data, jsonResponse);
73
+ });
74
+ }
75
+ getMethodology(assetType, jsonResponse) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const data = yield this.api.getMethodology(assetType);
78
+ this.outputResponse(data, jsonResponse);
79
+ });
80
+ }
81
+ outputResponse(data, jsonResponse) {
82
+ if (jsonResponse) {
83
+ const filename = (0, uuid_1.v4)() + ".json";
84
+ file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(data, null, 2), filename);
85
+ logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
86
+ }
87
+ else {
88
+ logger_1.logger.info(typeof data === "string" ? data : JSON.stringify(data, null, 2));
89
+ }
90
+ }
63
91
  logDescriptorSummary(descriptor) {
64
92
  logger_1.logger.info(`${descriptor.assetType} - ${descriptor.displayName} [${descriptor.group}] (basePath: ${descriptor.service.basePath})`);
65
93
  }
@@ -32,6 +32,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  .requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
33
33
  .option("--json", "Return the response as a JSON file")
34
34
  .action(this.getType);
35
+ assetRegistryCommand.command("schema")
36
+ .description("Get the JSON schema for an asset type's configuration")
37
+ .requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
38
+ .option("--json", "Return the response as a JSON file")
39
+ .action(this.getSchema);
40
+ assetRegistryCommand.command("examples")
41
+ .description("Get example configurations for an asset type")
42
+ .requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
43
+ .option("--json", "Return the response as a JSON file")
44
+ .action(this.getExamples);
45
+ assetRegistryCommand.command("methodology")
46
+ .description("Get the methodology / best-practices guide for an asset type")
47
+ .requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
48
+ .option("--json", "Return the response as a JSON file")
49
+ .action(this.getMethodology);
35
50
  }
36
51
  listTypes(context, command, options) {
37
52
  return __awaiter(this, void 0, void 0, function* () {
@@ -43,6 +58,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
58
  yield new asset_registry_service_1.AssetRegistryService(context).getType(options.assetType, !!options.json);
44
59
  });
45
60
  }
61
+ getSchema(context, command, options) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ yield new asset_registry_service_1.AssetRegistryService(context).getSchema(options.assetType, !!options.json);
64
+ });
65
+ }
66
+ getExamples(context, command, options) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ yield new asset_registry_service_1.AssetRegistryService(context).getExamples(options.assetType, !!options.json);
69
+ });
70
+ }
71
+ getMethodology(context, command, options) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ yield new asset_registry_service_1.AssetRegistryService(context).getMethodology(options.assetType, !!options.json);
74
+ });
75
+ }
46
76
  }
47
77
  return Module;
48
78
  });
@@ -5,4 +5,7 @@ export declare class AssetRegistryApi {
5
5
  constructor(context: Context);
6
6
  listTypes(): Promise<AssetRegistryMetadata>;
7
7
  getType(assetType: string): Promise<AssetRegistryDescriptor>;
8
+ getSchema(assetType: string): Promise<any>;
9
+ getExamples(assetType: string): Promise<any>;
10
+ getMethodology(assetType: string): Promise<any>;
8
11
  }
@@ -4,6 +4,10 @@ export declare class AssetRegistryService {
4
4
  constructor(context: Context);
5
5
  listTypes(jsonResponse: boolean): Promise<void>;
6
6
  getType(assetType: string, jsonResponse: boolean): Promise<void>;
7
+ getSchema(assetType: string, jsonResponse: boolean): Promise<void>;
8
+ getExamples(assetType: string, jsonResponse: boolean): Promise<void>;
9
+ getMethodology(assetType: string, jsonResponse: boolean): Promise<void>;
10
+ private outputResponse;
7
11
  private logDescriptorSummary;
8
12
  private logDescriptorDetail;
9
13
  }
@@ -4,5 +4,8 @@ declare class Module extends IModule {
4
4
  register(context: Context, configurator: Configurator): void;
5
5
  private listTypes;
6
6
  private getType;
7
+ private getSchema;
8
+ private getExamples;
9
+ private getMethodology;
7
10
  }
8
11
  export = Module;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {
@@ -1,81 +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", "../../core/utils/logger", "../../core/utils/file-service", "uuid"], factory);
17
- }
18
- })(function (require, exports) {
19
- "use strict";
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.ApiService = void 0;
22
- const logger_1 = require("../../core/utils/logger");
23
- const file_service_1 = require("../../core/utils/file-service");
24
- const uuid_1 = require("uuid");
25
- class ApiService {
26
- constructor(context) {
27
- this.httpClient = () => context.httpClient;
28
- }
29
- request(path, method, body, jsonFile) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- if (!path.startsWith("/")) {
32
- throw new logger_1.FatalError("Path must start with /");
33
- }
34
- const validMethods = ["GET", "POST", "PUT", "DELETE"];
35
- if (!validMethods.includes(method)) {
36
- throw new logger_1.FatalError(`Invalid method '${method}'. Must be one of: ${validMethods.join(", ")}`);
37
- }
38
- logger_1.logger.info(`${method} ${path}`);
39
- let parsedBody;
40
- if (body) {
41
- try {
42
- parsedBody = JSON.parse(body);
43
- }
44
- catch (_a) {
45
- throw new logger_1.FatalError("--body must be valid JSON");
46
- }
47
- }
48
- const data = yield this.execute(method, path, parsedBody);
49
- if (jsonFile) {
50
- const filename = (0, uuid_1.v4)() + ".json";
51
- file_service_1.fileService.writeToFileWithGivenName(JSON.stringify(data, null, 2), filename);
52
- logger_1.logger.info(file_service_1.FileService.fileDownloadedMessage + filename);
53
- }
54
- else {
55
- const output = typeof data === "string" ? data : JSON.stringify(data, null, 2);
56
- logger_1.logger.info(output);
57
- }
58
- });
59
- }
60
- execute(method, path, body) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- try {
63
- switch (method) {
64
- case "GET":
65
- return yield this.httpClient().get(path);
66
- case "POST":
67
- return yield this.httpClient().post(path, body !== null && body !== void 0 ? body : {});
68
- case "PUT":
69
- return yield this.httpClient().put(path, body !== null && body !== void 0 ? body : {});
70
- case "DELETE":
71
- return yield this.httpClient().delete(path);
72
- }
73
- }
74
- catch (e) {
75
- throw new logger_1.FatalError(`${method} ${path} failed: ${e}`);
76
- }
77
- });
78
- }
79
- }
80
- exports.ApiService = ApiService;
81
- });
@@ -1,42 +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", "../../core/command/module-handler", "./api.service"], factory);
17
- }
18
- })(function (require, exports) {
19
- "use strict";
20
- const module_handler_1 = require("../../core/command/module-handler");
21
- const api_service_1 = require("./api.service");
22
- class Module extends module_handler_1.IModule {
23
- register(context, configurator) {
24
- configurator.command("api")
25
- .description("Send raw HTTP requests to Celonis APIs on the configured team (beta — testing only).")
26
- .beta()
27
- .command("request")
28
- .description("Send a request to the given Celonis API path (e.g. /package-manager/api/packages)")
29
- .requiredOption("--path <path>", "API path starting with / (e.g. /package-manager/api/packages)")
30
- .option("--method <method>", "HTTP method: GET, POST, PUT, DELETE", "GET")
31
- .option("--body <body>", "Request body as JSON string (for POST/PUT)")
32
- .option("--json", "Write the response to a JSON file instead of printing it")
33
- .action(this.request);
34
- }
35
- request(context, command, options) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- yield new api_service_1.ApiService(context).request(options.path, options.method.toUpperCase(), options.body, !!options.json);
38
- });
39
- }
40
- }
41
- return Module;
42
- });
@@ -1,7 +0,0 @@
1
- import { Context } from "../../core/command/cli-context";
2
- export declare class ApiService {
3
- private httpClient;
4
- constructor(context: Context);
5
- request(path: string, method: string, body?: string, jsonFile?: boolean): Promise<void>;
6
- private execute;
7
- }
@@ -1,7 +0,0 @@
1
- import { Configurator, IModule } from "../../core/command/module-handler";
2
- import { Context } from "../../core/command/cli-context";
3
- declare class Module extends IModule {
4
- register(context: Context, configurator: Configurator): void;
5
- private request;
6
- }
7
- export = Module;