@celonis/content-cli 1.15.0 → 1.16.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.
@@ -24,10 +24,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
24
24
  constructor(context) {
25
25
  this.httpClient = () => context.httpClient;
26
26
  }
27
- listTypes() {
27
+ listTypes(flavor) {
28
28
  return __awaiter(this, void 0, void 0, function* () {
29
29
  return this.httpClient()
30
- .get(AssetRegistryApi.endpointUrl("types"))
30
+ .get(AssetRegistryApi.withQuery(AssetRegistryApi.endpointUrl("types"), { flavor }))
31
31
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)("listing asset registry types", e));
32
32
  });
33
33
  }
@@ -38,10 +38,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38
38
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting asset type '${assetType}'`, e));
39
39
  });
40
40
  }
41
- getSchema(assetType) {
41
+ getSchema(assetType, path) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  return this.httpClient()
44
- .get(AssetRegistryApi.endpointUrl("schemas", encodeURIComponent(assetType)))
44
+ .get(AssetRegistryApi.withQuery(AssetRegistryApi.endpointUrl("schemas", encodeURIComponent(assetType)), { path }))
45
45
  .catch((e) => (0, asset_registry_error_1.handleAssetRegistryApiError)(`getting schema for asset type '${assetType}'`, e));
46
46
  });
47
47
  }
@@ -55,6 +55,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55
55
  static endpointUrl(...segments) {
56
56
  return `${AssetRegistryApi.BASE_URL}/${segments.join("/")}`;
57
57
  }
58
+ static withQuery(url, params) {
59
+ const queryParams = new URLSearchParams();
60
+ Object.entries(params)
61
+ .filter(([, value]) => value !== undefined && value.trim() !== "")
62
+ .forEach(([name, value]) => queryParams.set(name, value));
63
+ const query = queryParams.toString();
64
+ return query ? `${url}?${query}` : url;
65
+ }
58
66
  }
59
67
  exports.AssetRegistryApi = AssetRegistryApi;
60
68
  AssetRegistryApi.BASE_URL = "/pacman/api/core/asset-registry";
@@ -29,9 +29,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
29
29
  this.api = new asset_registry_api_1.AssetRegistryApi(context);
30
30
  this.cuiFileService = new cui_file_service_1.CuiFileService(context);
31
31
  }
32
- listTypes(jsonResponse) {
32
+ listTypes(jsonResponse, flavor) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
- const metadata = yield this.api.listTypes();
34
+ const metadata = yield this.api.listTypes(flavor);
35
35
  const descriptors = Object.values(metadata.types);
36
36
  if (jsonResponse) {
37
37
  const filename = (0, uuid_1.v4)() + ".json";
@@ -62,9 +62,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
62
62
  }
63
63
  });
64
64
  }
65
- getSchema(assetType, jsonResponse) {
65
+ getSchema(assetType, jsonResponse, path) {
66
66
  return __awaiter(this, void 0, void 0, function* () {
67
- const data = yield this.api.getSchema(assetType);
67
+ const data = yield this.api.getSchema(assetType, path);
68
68
  yield this.outputResponse(data, jsonResponse);
69
69
  });
70
70
  }
@@ -25,6 +25,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
25
25
  .description("Manage the asset registry — discover registered asset types and their service descriptors.");
26
26
  assetRegistryCommand.command("list")
27
27
  .description("List all registered asset types")
28
+ .option("--flavor <flavor>", "Lists only the asset types that apply to the given package flavor (e.g., STUDIO)")
28
29
  .option("--json", "Return the response as a JSON file")
29
30
  .action(this.listTypes);
30
31
  assetRegistryCommand.command("get")
@@ -35,6 +36,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
35
36
  assetRegistryCommand.command("schema")
36
37
  .description("Get the JSON schema for an asset type's configuration")
37
38
  .requiredOption("--assetType <assetType>", "The asset type identifier (e.g., BOARD_V2)")
39
+ .option("--path <path>", "Return only this part of the schema, written like a $ref inside it (e.g., '#/$defs/table'); '#' returns the entry point")
38
40
  .option("--json", "Return the response as a JSON file")
39
41
  .action(this.getSchema);
40
42
  assetRegistryCommand.command("examples")
@@ -45,7 +47,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
47
  }
46
48
  listTypes(context, command, options) {
47
49
  return __awaiter(this, void 0, void 0, function* () {
48
- yield new asset_registry_service_1.AssetRegistryService(context).listTypes(!!options.json);
50
+ yield new asset_registry_service_1.AssetRegistryService(context).listTypes(!!options.json, options.flavor);
49
51
  });
50
52
  }
51
53
  getType(context, command, options) {
@@ -55,7 +57,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55
57
  }
56
58
  getSchema(context, command, options) {
57
59
  return __awaiter(this, void 0, void 0, function* () {
58
- yield new asset_registry_service_1.AssetRegistryService(context).getSchema(options.assetType, !!options.json);
60
+ yield new asset_registry_service_1.AssetRegistryService(context).getSchema(options.assetType, !!options.json, options.path);
59
61
  });
60
62
  }
61
63
  getExamples(context, command, options) {
@@ -27,13 +27,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
27
27
  }
28
28
  getCandidateAssignments(type, params) {
29
29
  return __awaiter(this, void 0, void 0, function* () {
30
- if (!variable_assignment_apis_constants_1.variableAssignmentApis[type]) {
30
+ const assignmentApi = variable_assignment_apis_constants_1.variableAssignmentApis[type];
31
+ if (!assignmentApi) {
31
32
  throw new logger_1.FatalError(`Variable type ${type} not supported.`);
32
33
  }
33
- const apiUrl = variable_assignment_apis_constants_1.variableAssignmentApis[type].url + (params.toString().length ? `?${params.toString()}` : "");
34
- return this.httpClient().get(apiUrl).catch(e => {
34
+ const apiUrl = assignmentApi.url + (params.toString().length ? `?${params.toString()}` : "");
35
+ const candidates = yield this.httpClient().get(apiUrl).catch(e => {
35
36
  throw new logger_1.FatalError(`Problem getting variables assignment values for type ${type}: ${e}`);
36
37
  });
38
+ return (Array.isArray(candidates) ? candidates : [])
39
+ .map(candidate => assignmentApi.toAssignment(candidate))
40
+ .filter(assignment => !!assignment.value);
37
41
  });
38
42
  }
39
43
  }
@@ -10,12 +10,38 @@
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.variableAssignmentApis = void 0;
13
+ const connectionName = (connection) => {
14
+ var _a, _b, _c;
15
+ const parts = [(_b = (_a = connection === null || connection === void 0 ? void 0 : connection.authProvider) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = connection === null || connection === void 0 ? void 0 : connection.authProvider) === null || _c === void 0 ? void 0 : _c.name, connection === null || connection === void 0 ? void 0 : connection.username].filter(Boolean);
16
+ return parts.length ? parts.join(" - ") : connection === null || connection === void 0 ? void 0 : connection.id;
17
+ };
13
18
  exports.variableAssignmentApis = {
14
19
  DATA_MODEL: {
15
- url: "/package-manager/api/compute-pools/pools-with-data-models"
20
+ url: "/package-manager/api/compute-pools/pools-with-data-models",
21
+ toAssignment: candidate => {
22
+ var _a, _b, _c, _d;
23
+ return ({
24
+ value: (_a = candidate === null || candidate === void 0 ? void 0 : candidate.dataModel) === null || _a === void 0 ? void 0 : _a.dataModelId,
25
+ name: [(_b = candidate === null || candidate === void 0 ? void 0 : candidate.pool) === null || _b === void 0 ? void 0 : _b.name, (_c = candidate === null || candidate === void 0 ? void 0 : candidate.dataModel) === null || _c === void 0 ? void 0 : _c.name].filter(Boolean).join(" / ") || ((_d = candidate === null || candidate === void 0 ? void 0 : candidate.dataModel) === null || _d === void 0 ? void 0 : _d.dataModelId),
26
+ });
27
+ },
16
28
  },
17
29
  CONNECTION: {
18
- url: "/process-automation-v2/api/connections"
19
- }
30
+ url: "/process-automation-v2/api/connections",
31
+ toAssignment: candidate => ({
32
+ value: candidate === null || candidate === void 0 ? void 0 : candidate.id,
33
+ name: connectionName(candidate),
34
+ }),
35
+ },
36
+ DATA_POOL_ID: {
37
+ url: "/integration/api/pools",
38
+ toAssignment: candidate => {
39
+ var _a;
40
+ return ({
41
+ value: candidate === null || candidate === void 0 ? void 0 : candidate.id,
42
+ name: (_a = candidate === null || candidate === void 0 ? void 0 : candidate.name) !== null && _a !== void 0 ? _a : candidate === null || candidate === void 0 ? void 0 : candidate.id,
43
+ });
44
+ },
45
+ },
20
46
  };
21
47
  });
@@ -4,9 +4,10 @@ export declare class AssetRegistryApi {
4
4
  private static readonly BASE_URL;
5
5
  private readonly httpClient;
6
6
  constructor(context: Context);
7
- listTypes(): Promise<AssetRegistryMetadata>;
7
+ listTypes(flavor?: string): Promise<AssetRegistryMetadata>;
8
8
  getType(assetType: string): Promise<AssetRegistryDescriptor>;
9
- getSchema(assetType: string): Promise<any>;
9
+ getSchema(assetType: string, path?: string): Promise<any>;
10
10
  getExamples(assetType: string): Promise<any>;
11
11
  private static endpointUrl;
12
+ private static withQuery;
12
13
  }
@@ -3,9 +3,9 @@ export declare class AssetRegistryService {
3
3
  private readonly api;
4
4
  private readonly cuiFileService;
5
5
  constructor(context: Context);
6
- listTypes(jsonResponse: boolean): Promise<void>;
6
+ listTypes(jsonResponse: boolean, flavor?: string): Promise<void>;
7
7
  getType(assetType: string, jsonResponse: boolean): Promise<void>;
8
- getSchema(assetType: string, jsonResponse: boolean): Promise<void>;
8
+ getSchema(assetType: string, jsonResponse: boolean, path?: string): Promise<void>;
9
9
  getExamples(assetType: string, jsonResponse: boolean): Promise<void>;
10
10
  private outputResponse;
11
11
  private logDescriptorSummary;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { URLSearchParams } from "url";
3
+ import { VariableAssignment } from "../interfaces/variable-assignment-apis.constants";
3
4
  import { Context } from "../../../core/command/cli-context";
4
5
  export declare class VariableAssignmentCandidatesApi {
5
6
  private httpClient;
6
7
  constructor(context: Context);
7
- getCandidateAssignments(type: string, params: URLSearchParams): Promise<object[]>;
8
+ getCandidateAssignments(type: string, params: URLSearchParams): Promise<VariableAssignment[]>;
8
9
  }
@@ -1,5 +1,10 @@
1
+ export interface VariableAssignment {
2
+ value: string;
3
+ name: string;
4
+ }
1
5
  export interface VariableAssignmentApi {
2
6
  url: string;
7
+ toAssignment: (candidate: any) => VariableAssignment;
3
8
  }
4
9
  export declare const variableAssignmentApis: {
5
10
  [key: string]: VariableAssignmentApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celonis/content-cli",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "CLI Tool to help manage content in Celonis Platform",
5
5
  "main": "content-cli.js",
6
6
  "bin": {