@camunda/ccma-api 12.0.0 → 12.1.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.
Files changed (24) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +20 -0
  3. package/dist/index.js.map +2 -2
  4. package/dist/services/console/console.cli.actions.service.d.ts +47 -0
  5. package/dist/services/console/console.cli.actions.service.js +115 -0
  6. package/dist/services/console/console.cli.actions.service.js.map +7 -0
  7. package/dist/services/console/console.cli.actions.service.spec.d.ts +1 -0
  8. package/dist/services/console/console.cli.cluster.service.d.ts +94 -0
  9. package/dist/services/console/console.cli.cluster.service.js +53 -0
  10. package/dist/services/console/console.cli.cluster.service.js.map +7 -0
  11. package/dist/services/console/console.cli.cluster.service.spec.d.ts +1 -0
  12. package/dist/services/console/console.cli.extras.service.d.ts +119 -0
  13. package/dist/services/console/console.cli.extras.service.js +169 -0
  14. package/dist/services/console/console.cli.extras.service.js.map +7 -0
  15. package/dist/services/console/console.cli.extras.service.spec.d.ts +1 -0
  16. package/dist/services/console/console.cli.org.service.d.ts +53 -0
  17. package/dist/services/console/console.cli.org.service.js +60 -0
  18. package/dist/services/console/console.cli.org.service.js.map +7 -0
  19. package/dist/services/console/console.cli.org.service.spec.d.ts +1 -0
  20. package/dist/services/console/console.cli.resources.service.d.ts +136 -0
  21. package/dist/services/console/console.cli.resources.service.js +218 -0
  22. package/dist/services/console/console.cli.resources.service.js.map +7 -0
  23. package/dist/services/console/console.cli.resources.service.spec.d.ts +1 -0
  24. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ import type { RequestBaseParams } from '../../types/general.types.js';
2
+ import type { ConsoleCliClusterParams } from './console.cli.service.js';
3
+ /** The shapes of `packages/shared-route-schemas/src/console/cli-extras.ts`. */
4
+ export interface ConsoleCliSecureConnectivity {
5
+ /**
6
+ * False when the cluster has no secure connectivity. Then the lists are
7
+ * empty.
8
+ */
9
+ active: boolean;
10
+ allowedRegions: string[];
11
+ allowedPrincipals: string[];
12
+ endpoint?: {
13
+ region?: string;
14
+ serviceName?: string;
15
+ type?: string;
16
+ privateDnsName?: string;
17
+ };
18
+ endpointConnectionCount?: number;
19
+ endpointConnections: {
20
+ endpointId: string;
21
+ state: string;
22
+ owner?: string;
23
+ createdAt?: string;
24
+ }[];
25
+ conditions: {
26
+ type: string;
27
+ status: string;
28
+ reason?: string;
29
+ message?: string;
30
+ lastTransitionTime?: string;
31
+ }[];
32
+ }
33
+ export interface ConsoleCliSetSecureConnectivity {
34
+ allowedRegions: string[];
35
+ allowedPrincipals: string[];
36
+ }
37
+ /** A monitoring client. A list never holds a password. */
38
+ export interface ConsoleCliMonitoringClient {
39
+ id: string;
40
+ username: string;
41
+ createdAt?: string;
42
+ lastUsedAt?: string;
43
+ createdBy?: string;
44
+ }
45
+ /** The answer of a create or a rotate. The password is not shown again. */
46
+ export interface ConsoleCliCreatedMonitoringClient extends ConsoleCliMonitoringClient {
47
+ password: string;
48
+ }
49
+ export interface ConsoleCliMonitoring {
50
+ /** False when monitoring is not activated on the cluster. */
51
+ active: boolean;
52
+ metricsEndpoint?: {
53
+ path: string;
54
+ scheme: string;
55
+ target: string;
56
+ };
57
+ conditions: Record<string, unknown>[];
58
+ clients: ConsoleCliMonitoringClient[];
59
+ }
60
+ export interface ConsoleCliValueMetric {
61
+ clusterId?: string;
62
+ startDate: string;
63
+ monthsSinceStart?: number;
64
+ year?: number;
65
+ month?: number;
66
+ day?: number;
67
+ processInstances: number;
68
+ decisionInstances: number;
69
+ taskUsers: number;
70
+ generalUsers?: number;
71
+ deployedModels?: number;
72
+ }
73
+ export interface ConsoleCliOrgParams extends RequestBaseParams {
74
+ params: {
75
+ orgId: string;
76
+ };
77
+ }
78
+ export interface SetConsoleCliSecureConnectivityParams extends ConsoleCliClusterParams {
79
+ body: ConsoleCliSetSecureConnectivity;
80
+ }
81
+ export interface CreateConsoleCliMonitoringClientParams extends ConsoleCliClusterParams {
82
+ body: {
83
+ username: string;
84
+ };
85
+ }
86
+ export interface ConsoleCliMonitoringClientParams extends RequestBaseParams {
87
+ params: {
88
+ orgId: string;
89
+ clusterId: string;
90
+ clientId: string;
91
+ };
92
+ }
93
+ export interface GetConsoleCliDailyValueMetricsParams extends ConsoleCliOrgParams {
94
+ /** The number of days back from now, 1 to 3660. */
95
+ days: number;
96
+ }
97
+ /**
98
+ * The `/cli/v1` routes of console-backend for secure connectivity, external
99
+ * monitoring and value metrics. c4 calls them in place of the internal
100
+ * routes while the flag `console.c4CliApi` is on (#11623). They answer 404
101
+ * while `shared.cliApi` is off.
102
+ */
103
+ export declare class ConsoleCliExtrasService {
104
+ private static call;
105
+ /** For a route that answers with no body (201 or 204). */
106
+ private static send;
107
+ static getSecureConnectivity(params: ConsoleCliClusterParams): Promise<ConsoleCliSecureConnectivity>;
108
+ static activateSecureConnectivity(params: SetConsoleCliSecureConnectivityParams): Promise<void>;
109
+ static setSecureConnectivity(params: SetConsoleCliSecureConnectivityParams): Promise<void>;
110
+ static deactivateSecureConnectivity(params: ConsoleCliClusterParams): Promise<void>;
111
+ static getMonitoring(params: ConsoleCliClusterParams): Promise<ConsoleCliMonitoring>;
112
+ static activateMonitoring(params: ConsoleCliClusterParams): Promise<void>;
113
+ static deactivateMonitoring(params: ConsoleCliClusterParams): Promise<void>;
114
+ static createMonitoringClient(params: CreateConsoleCliMonitoringClientParams): Promise<ConsoleCliCreatedMonitoringClient>;
115
+ static rotateMonitoringClientPassword(params: ConsoleCliMonitoringClientParams): Promise<ConsoleCliCreatedMonitoringClient>;
116
+ static deleteMonitoringClient(params: ConsoleCliMonitoringClientParams): Promise<void>;
117
+ static getValueMetrics(params: ConsoleCliOrgParams): Promise<ConsoleCliValueMetric[]>;
118
+ static getDailyValueMetrics({ days, ...params }: GetConsoleCliDailyValueMetricsParams): Promise<ConsoleCliValueMetric[]>;
119
+ }
@@ -0,0 +1,169 @@
1
+ import { request } from "../../utils/api.js";
2
+ import { HttpError } from "../../utils/errors.js";
3
+ const fill = (template, params) => template.replace(
4
+ /:(\w+)/g,
5
+ (_, key) => encodeURIComponent(params[key] ?? "")
6
+ );
7
+ const context = (params, name, path, type) => ({
8
+ method: {
9
+ name: `ConsoleCliExtrasService.${name}`,
10
+ url: path,
11
+ normalizedUrl: path,
12
+ type
13
+ },
14
+ source: params.config.metrics?.source || "unset",
15
+ target: { name: "console", type: "internal" }
16
+ });
17
+ const CLUSTER = "orgs/:orgId/clusters/:clusterId";
18
+ const SECURE_CONNECTIVITY = `${CLUSTER}/secure-connectivity`;
19
+ const MONITORING = `${CLUSTER}/monitoring`;
20
+ class ConsoleCliExtrasService {
21
+ static async call(params, name, template, type, query = "") {
22
+ const path = `cli/v1/${template}`;
23
+ const serviceContext = context(params, name, path, type);
24
+ const response = await request({
25
+ ...params,
26
+ base: { id: "console" },
27
+ url: `${fill(path, params.params)}${query}`,
28
+ logUrl: path,
29
+ method: type,
30
+ metricsDetails: serviceContext,
31
+ body: params.body,
32
+ responseType: "json"
33
+ });
34
+ if (!response.ok || response.body === void 0) {
35
+ throw new HttpError(
36
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
37
+ response.status,
38
+ response.statusText
39
+ );
40
+ }
41
+ return response.body;
42
+ }
43
+ /** For a route that answers with no body (201 or 204). */
44
+ static async send(params, name, template, type) {
45
+ const path = `cli/v1/${template}`;
46
+ const serviceContext = context(params, name, path, type);
47
+ const response = await request({
48
+ ...params,
49
+ base: { id: "console" },
50
+ url: fill(path, params.params),
51
+ logUrl: path,
52
+ method: type,
53
+ metricsDetails: serviceContext,
54
+ body: params.body,
55
+ responseType: "none"
56
+ });
57
+ if (!response.ok) {
58
+ throw new HttpError(
59
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
60
+ response.status,
61
+ response.statusText
62
+ );
63
+ }
64
+ }
65
+ static getSecureConnectivity(params) {
66
+ return ConsoleCliExtrasService.call(
67
+ params,
68
+ "getSecureConnectivity",
69
+ SECURE_CONNECTIVITY,
70
+ "get"
71
+ );
72
+ }
73
+ static activateSecureConnectivity(params) {
74
+ return ConsoleCliExtrasService.send(
75
+ params,
76
+ "activateSecureConnectivity",
77
+ SECURE_CONNECTIVITY,
78
+ "post"
79
+ );
80
+ }
81
+ static setSecureConnectivity(params) {
82
+ return ConsoleCliExtrasService.send(
83
+ params,
84
+ "setSecureConnectivity",
85
+ SECURE_CONNECTIVITY,
86
+ "put"
87
+ );
88
+ }
89
+ static deactivateSecureConnectivity(params) {
90
+ return ConsoleCliExtrasService.send(
91
+ params,
92
+ "deactivateSecureConnectivity",
93
+ SECURE_CONNECTIVITY,
94
+ "delete"
95
+ );
96
+ }
97
+ static getMonitoring(params) {
98
+ return ConsoleCliExtrasService.call(
99
+ params,
100
+ "getMonitoring",
101
+ MONITORING,
102
+ "get"
103
+ );
104
+ }
105
+ static activateMonitoring(params) {
106
+ return ConsoleCliExtrasService.send(
107
+ params,
108
+ "activateMonitoring",
109
+ MONITORING,
110
+ "post"
111
+ );
112
+ }
113
+ static deactivateMonitoring(params) {
114
+ return ConsoleCliExtrasService.send(
115
+ params,
116
+ "deactivateMonitoring",
117
+ MONITORING,
118
+ "delete"
119
+ );
120
+ }
121
+ static createMonitoringClient(params) {
122
+ return ConsoleCliExtrasService.call(
123
+ params,
124
+ "createMonitoringClient",
125
+ `${MONITORING}/clients`,
126
+ "post"
127
+ );
128
+ }
129
+ static rotateMonitoringClientPassword(params) {
130
+ return ConsoleCliExtrasService.call(
131
+ params,
132
+ "rotateMonitoringClientPassword",
133
+ `${MONITORING}/clients/:clientId/rotate`,
134
+ "post"
135
+ );
136
+ }
137
+ static deleteMonitoringClient(params) {
138
+ return ConsoleCliExtrasService.send(
139
+ params,
140
+ "deleteMonitoringClient",
141
+ `${MONITORING}/clients/:clientId`,
142
+ "delete"
143
+ );
144
+ }
145
+ static getValueMetrics(params) {
146
+ return ConsoleCliExtrasService.call(
147
+ params,
148
+ "getValueMetrics",
149
+ "orgs/:orgId/value-metrics",
150
+ "get"
151
+ );
152
+ }
153
+ static getDailyValueMetrics({
154
+ days,
155
+ ...params
156
+ }) {
157
+ return ConsoleCliExtrasService.call(
158
+ params,
159
+ "getDailyValueMetrics",
160
+ "orgs/:orgId/value-metrics/daily",
161
+ "get",
162
+ `?days=${days}`
163
+ );
164
+ }
165
+ }
166
+ export {
167
+ ConsoleCliExtrasService
168
+ };
169
+ //# sourceMappingURL=console.cli.extras.service.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/services/console/console.cli.extras.service.ts"],
4
+ "sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n RequestBaseMethodType,\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\nimport type { ConsoleCliClusterParams } from './console.cli.service.js'\n\n/** The shapes of `packages/shared-route-schemas/src/console/cli-extras.ts`. */\nexport interface ConsoleCliSecureConnectivity {\n /**\n * False when the cluster has no secure connectivity. Then the lists are\n * empty.\n */\n active: boolean\n allowedRegions: string[]\n allowedPrincipals: string[]\n endpoint?: {\n region?: string\n serviceName?: string\n type?: string\n privateDnsName?: string\n }\n endpointConnectionCount?: number\n endpointConnections: {\n endpointId: string\n state: string\n owner?: string\n createdAt?: string\n }[]\n conditions: {\n type: string\n status: string\n reason?: string\n message?: string\n lastTransitionTime?: string\n }[]\n}\n\nexport interface ConsoleCliSetSecureConnectivity {\n allowedRegions: string[]\n allowedPrincipals: string[]\n}\n\n/** A monitoring client. A list never holds a password. */\nexport interface ConsoleCliMonitoringClient {\n id: string\n username: string\n createdAt?: string\n lastUsedAt?: string\n createdBy?: string\n}\n\n/** The answer of a create or a rotate. The password is not shown again. */\nexport interface ConsoleCliCreatedMonitoringClient\n extends ConsoleCliMonitoringClient {\n password: string\n}\n\nexport interface ConsoleCliMonitoring {\n /** False when monitoring is not activated on the cluster. */\n active: boolean\n metricsEndpoint?: { path: string; scheme: string; target: string }\n conditions: Record<string, unknown>[]\n clients: ConsoleCliMonitoringClient[]\n}\n\nexport interface ConsoleCliValueMetric {\n clusterId?: string\n startDate: string\n monthsSinceStart?: number\n year?: number\n month?: number\n day?: number\n processInstances: number\n decisionInstances: number\n taskUsers: number\n generalUsers?: number\n deployedModels?: number\n}\n\nexport interface ConsoleCliOrgParams extends RequestBaseParams {\n params: { orgId: string }\n}\n\nexport interface SetConsoleCliSecureConnectivityParams\n extends ConsoleCliClusterParams {\n body: ConsoleCliSetSecureConnectivity\n}\n\nexport interface CreateConsoleCliMonitoringClientParams\n extends ConsoleCliClusterParams {\n body: { username: string }\n}\n\nexport interface ConsoleCliMonitoringClientParams extends RequestBaseParams {\n params: { orgId: string; clusterId: string; clientId: string }\n}\n\nexport interface GetConsoleCliDailyValueMetricsParams\n extends ConsoleCliOrgParams {\n /** The number of days back from now, 1 to 3660. */\n days: number\n}\n\ntype Params = RequestBaseParams & {\n params: Record<string, string>\n body?: unknown\n}\n\n/**\n * Fills the `:name` parts of a template with the params. The template goes\n * to the logs and the metrics, so that ids never appear there.\n */\nconst fill = (template: string, params: Record<string, string>) =>\n template.replace(/:(\\w+)/g, (_, key: string) =>\n encodeURIComponent(params[key] ?? ''),\n )\n\nconst context = (\n params: Params,\n name: string,\n path: string,\n type: RequestBaseMethodType,\n): RequestBaseServiceContext => ({\n method: {\n name: `ConsoleCliExtrasService.${name}`,\n url: path,\n normalizedUrl: path,\n type,\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n})\n\nconst CLUSTER = 'orgs/:orgId/clusters/:clusterId'\nconst SECURE_CONNECTIVITY = `${CLUSTER}/secure-connectivity`\nconst MONITORING = `${CLUSTER}/monitoring`\n\n/**\n * The `/cli/v1` routes of console-backend for secure connectivity, external\n * monitoring and value metrics. c4 calls them in place of the internal\n * routes while the flag `console.c4CliApi` is on (#11623). They answer 404\n * while `shared.cliApi` is off.\n */\nexport class ConsoleCliExtrasService {\n private static async call<T>(\n params: Params,\n name: string,\n template: string,\n type: RequestBaseMethodType,\n query = '',\n ): Promise<T> {\n const path = `cli/v1/${template}`\n const serviceContext = context(params, name, path, type)\n\n const response = await request<T>({\n ...params,\n base: { id: 'console' },\n url: `${fill(path, params.params)}${query}`,\n logUrl: path,\n method: type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'json',\n })\n\n if (!response.ok || response.body === undefined) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n /** For a route that answers with no body (201 or 204). */\n private static async send(\n params: Params,\n name: string,\n template: string,\n type: RequestBaseMethodType,\n ): Promise<void> {\n const path = `cli/v1/${template}`\n const serviceContext = context(params, name, path, type)\n\n const response = await request({\n ...params,\n base: { id: 'console' },\n url: fill(path, params.params),\n logUrl: path,\n method: type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'none',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n }\n\n public static getSecureConnectivity(\n params: ConsoleCliClusterParams,\n ): Promise<ConsoleCliSecureConnectivity> {\n return ConsoleCliExtrasService.call(\n params,\n 'getSecureConnectivity',\n SECURE_CONNECTIVITY,\n 'get',\n )\n }\n\n public static activateSecureConnectivity(\n params: SetConsoleCliSecureConnectivityParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'activateSecureConnectivity',\n SECURE_CONNECTIVITY,\n 'post',\n )\n }\n\n public static setSecureConnectivity(\n params: SetConsoleCliSecureConnectivityParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'setSecureConnectivity',\n SECURE_CONNECTIVITY,\n 'put',\n )\n }\n\n public static deactivateSecureConnectivity(\n params: ConsoleCliClusterParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'deactivateSecureConnectivity',\n SECURE_CONNECTIVITY,\n 'delete',\n )\n }\n\n public static getMonitoring(\n params: ConsoleCliClusterParams,\n ): Promise<ConsoleCliMonitoring> {\n return ConsoleCliExtrasService.call(\n params,\n 'getMonitoring',\n MONITORING,\n 'get',\n )\n }\n\n public static activateMonitoring(\n params: ConsoleCliClusterParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'activateMonitoring',\n MONITORING,\n 'post',\n )\n }\n\n public static deactivateMonitoring(\n params: ConsoleCliClusterParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'deactivateMonitoring',\n MONITORING,\n 'delete',\n )\n }\n\n public static createMonitoringClient(\n params: CreateConsoleCliMonitoringClientParams,\n ): Promise<ConsoleCliCreatedMonitoringClient> {\n return ConsoleCliExtrasService.call(\n params,\n 'createMonitoringClient',\n `${MONITORING}/clients`,\n 'post',\n )\n }\n\n public static rotateMonitoringClientPassword(\n params: ConsoleCliMonitoringClientParams,\n ): Promise<ConsoleCliCreatedMonitoringClient> {\n return ConsoleCliExtrasService.call(\n params,\n 'rotateMonitoringClientPassword',\n `${MONITORING}/clients/:clientId/rotate`,\n 'post',\n )\n }\n\n public static deleteMonitoringClient(\n params: ConsoleCliMonitoringClientParams,\n ): Promise<void> {\n return ConsoleCliExtrasService.send(\n params,\n 'deleteMonitoringClient',\n `${MONITORING}/clients/:clientId`,\n 'delete',\n )\n }\n\n public static getValueMetrics(\n params: ConsoleCliOrgParams,\n ): Promise<ConsoleCliValueMetric[]> {\n return ConsoleCliExtrasService.call(\n params,\n 'getValueMetrics',\n 'orgs/:orgId/value-metrics',\n 'get',\n )\n }\n\n public static getDailyValueMetrics({\n days,\n ...params\n }: GetConsoleCliDailyValueMetricsParams): Promise<ConsoleCliValueMetric[]> {\n return ConsoleCliExtrasService.call(\n params,\n 'getDailyValueMetrics',\n 'orgs/:orgId/value-metrics/daily',\n 'get',\n `?days=${days}`,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,OAAc,qBACZ,QACe;AACf,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAc,uBACZ,QAC4C;AAC5C,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,GAAG,UAAU;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAc,+BACZ,QAC4C;AAC5C,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,GAAG,UAAU;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAc,uBACZ,QACe;AACf,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA,GAAG,UAAU;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAc,gBACZ,QACkC;AAClC,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,OAAc,qBAAqB;AAAA,IACjC;AAAA,IACA,GAAG;AAAA,EACL,GAA2E;AACzE,WAAO,wBAAwB;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,IAAI;AAAA,IACf;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,53 @@
1
+ import type { RequestBaseParams } from '../../types/general.types.js';
2
+ /** The shapes of `packages/shared-route-schemas/src/console/cli-org.ts`. */
3
+ export interface ConsoleCliApiClient {
4
+ /** The id in the paths of `/api-clients/:clientId`. */
5
+ id: string;
6
+ /** The client id that the client sends to get a token. */
7
+ clientId: string;
8
+ name: string;
9
+ permissions: string[];
10
+ createdAt?: string;
11
+ lastUsedAt?: string;
12
+ /** The id of the user that created the client. */
13
+ createdBy?: string;
14
+ }
15
+ /** The answer of a create: the only time that the secret is shown. */
16
+ export interface ConsoleCliCreatedApiClient extends ConsoleCliApiClient {
17
+ secret: string;
18
+ }
19
+ export interface ConsoleCliOrgParams extends RequestBaseParams {
20
+ params: {
21
+ orgId: string;
22
+ };
23
+ }
24
+ export interface ConsoleCliApiClientParams extends RequestBaseParams {
25
+ params: {
26
+ orgId: string;
27
+ clientId: string;
28
+ };
29
+ }
30
+ export interface CreateConsoleCliApiClientParams extends ConsoleCliOrgParams {
31
+ body: {
32
+ name: string;
33
+ permissions?: string[];
34
+ };
35
+ }
36
+ export interface UpdateConsoleCliApiClientParams extends ConsoleCliApiClientParams {
37
+ body: {
38
+ name: string;
39
+ };
40
+ }
41
+ /**
42
+ * The org routes of `/cli/v1` (see `ConsoleCliService`): the API clients of
43
+ * the org.
44
+ */
45
+ export declare class ConsoleCliOrgService {
46
+ private static call;
47
+ private static callJson;
48
+ /** The list never holds a secret. */
49
+ static listApiClients(params: ConsoleCliOrgParams): Promise<ConsoleCliApiClient[]>;
50
+ static createApiClient(params: CreateConsoleCliApiClientParams): Promise<ConsoleCliCreatedApiClient>;
51
+ static updateApiClient(params: UpdateConsoleCliApiClientParams): Promise<ConsoleCliApiClient>;
52
+ static deleteApiClient(params: ConsoleCliApiClientParams): Promise<void>;
53
+ }
@@ -0,0 +1,60 @@
1
+ import { request } from "../../utils/api.js";
2
+ import { HttpError } from "../../utils/errors.js";
3
+ class ConsoleCliOrgService {
4
+ static async call(params, name, type) {
5
+ const { orgId, clientId } = params.params;
6
+ const template = `cli/v1/orgs/:orgId/api-clients${clientId === void 0 ? "" : "/:clientId"}`;
7
+ const serviceContext = {
8
+ method: {
9
+ name: `ConsoleCliOrgService.${name}`,
10
+ url: template,
11
+ normalizedUrl: template,
12
+ type
13
+ },
14
+ source: params.config.metrics?.source || "unset",
15
+ target: { name: "console", type: "internal" }
16
+ };
17
+ const response = await request({
18
+ ...params,
19
+ base: { id: "console" },
20
+ url: `cli/v1/orgs/${encodeURIComponent(orgId)}/api-clients${clientId === void 0 ? "" : `/${encodeURIComponent(clientId)}`}`,
21
+ logUrl: template,
22
+ method: type,
23
+ metricsDetails: serviceContext,
24
+ body: params.body,
25
+ responseType: type === "delete" ? "none" : "json"
26
+ });
27
+ if (!response.ok) {
28
+ throw new HttpError(
29
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
30
+ response.status,
31
+ response.statusText
32
+ );
33
+ }
34
+ return response.body;
35
+ }
36
+ static async callJson(...args) {
37
+ const body = await ConsoleCliOrgService.call(...args);
38
+ if (body === void 0) {
39
+ throw new HttpError(`ConsoleCliOrgService.${args[1]}: no body`, 500, "");
40
+ }
41
+ return body;
42
+ }
43
+ /** The list never holds a secret. */
44
+ static listApiClients(params) {
45
+ return ConsoleCliOrgService.callJson(params, "listApiClients", "get");
46
+ }
47
+ static createApiClient(params) {
48
+ return ConsoleCliOrgService.callJson(params, "createApiClient", "post");
49
+ }
50
+ static updateApiClient(params) {
51
+ return ConsoleCliOrgService.callJson(params, "updateApiClient", "patch");
52
+ }
53
+ static async deleteApiClient(params) {
54
+ await ConsoleCliOrgService.call(params, "deleteApiClient", "delete");
55
+ }
56
+ }
57
+ export {
58
+ ConsoleCliOrgService
59
+ };
60
+ //# sourceMappingURL=console.cli.org.service.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/services/console/console.cli.org.service.ts"],
4
+ "sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport type {\n RequestBaseParams,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\n\n/** The shapes of `packages/shared-route-schemas/src/console/cli-org.ts`. */\nexport interface ConsoleCliApiClient {\n /** The id in the paths of `/api-clients/:clientId`. */\n id: string\n /** The client id that the client sends to get a token. */\n clientId: string\n name: string\n permissions: string[]\n createdAt?: string\n lastUsedAt?: string\n /** The id of the user that created the client. */\n createdBy?: string\n}\n\n/** The answer of a create: the only time that the secret is shown. */\nexport interface ConsoleCliCreatedApiClient extends ConsoleCliApiClient {\n secret: string\n}\n\nexport interface ConsoleCliOrgParams extends RequestBaseParams {\n params: { orgId: string }\n}\n\nexport interface ConsoleCliApiClientParams extends RequestBaseParams {\n params: { orgId: string; clientId: string }\n}\n\nexport interface CreateConsoleCliApiClientParams extends ConsoleCliOrgParams {\n body: { name: string; permissions?: string[] }\n}\n\nexport interface UpdateConsoleCliApiClientParams\n extends ConsoleCliApiClientParams {\n body: { name: string }\n}\n\n/**\n * The org routes of `/cli/v1` (see `ConsoleCliService`): the API clients of\n * the org.\n */\nexport class ConsoleCliOrgService {\n private static async call<T>(\n params: RequestBaseParams & {\n params: { orgId: string; clientId?: string }\n body?: unknown\n },\n name: string,\n type: 'get' | 'post' | 'patch' | 'delete',\n ): Promise<T | undefined> {\n const { orgId, clientId } = params.params\n const template = `cli/v1/orgs/:orgId/api-clients${clientId === undefined ? '' : '/:clientId'}`\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `ConsoleCliOrgService.${name}`,\n url: template,\n normalizedUrl: template,\n type,\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<T>({\n ...params,\n base: { id: 'console' },\n url: `cli/v1/orgs/${encodeURIComponent(orgId)}/api-clients${clientId === undefined ? '' : `/${encodeURIComponent(clientId)}`}`,\n logUrl: template,\n method: type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: type === 'delete' ? 'none' : 'json',\n })\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body\n }\n\n private static async callJson<T>(\n ...args: Parameters<typeof ConsoleCliOrgService.call>\n ): Promise<T> {\n const body = await ConsoleCliOrgService.call<T>(...args)\n if (body === undefined) {\n throw new HttpError(`ConsoleCliOrgService.${args[1]}: no body`, 500, '')\n }\n return body\n }\n\n /** The list never holds a secret. */\n public static listApiClients(\n params: ConsoleCliOrgParams,\n ): Promise<ConsoleCliApiClient[]> {\n return ConsoleCliOrgService.callJson(params, 'listApiClients', 'get')\n }\n\n public static createApiClient(\n params: CreateConsoleCliApiClientParams,\n ): Promise<ConsoleCliCreatedApiClient> {\n return ConsoleCliOrgService.callJson(params, 'createApiClient', 'post')\n }\n\n public static updateApiClient(\n params: UpdateConsoleCliApiClientParams,\n ): Promise<ConsoleCliApiClient> {\n return ConsoleCliOrgService.callJson(params, 'updateApiClient', 'patch')\n }\n\n public static async deleteApiClient(\n params: ConsoleCliApiClientParams,\n ): Promise<void> {\n await ConsoleCliOrgService.call(params, 'deleteApiClient', 'delete')\n }\n}\n"],
5
+ "mappings": "AAUA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA0CnB,MAAM,qBAAqB;AAAA,EAChC,aAAqB,KACnB,QAIA,MACA,MACwB;AACxB,UAAM,EAAE,OAAO,SAAS,IAAI,OAAO;AACnC,UAAM,WAAW,iCAAiC,aAAa,SAAY,KAAK,YAAY;AAC5F,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM,wBAAwB,IAAI;AAAA,QAClC,KAAK;AAAA,QACL,eAAe;AAAA,QACf;AAAA,MACF;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,WAAW,MAAM,WAAW;AAAA,IAC9C;AAEA,UAAM,WAAW,MAAM,QAAW;AAAA,MAChC,GAAG;AAAA,MACH,MAAM,EAAE,IAAI,UAAU;AAAA,MACtB,KAAK,eAAe,mBAAmB,KAAK,CAAC,eAAe,aAAa,SAAY,KAAK,IAAI,mBAAmB,QAAQ,CAAC,EAAE;AAAA,MAC5H,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,MAAM,OAAO;AAAA,MACb,cAAc,SAAS,WAAW,SAAS;AAAA,IAC7C,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,aAAqB,YAChB,MACS;AACZ,UAAM,OAAO,MAAM,qBAAqB,KAAQ,GAAG,IAAI;AACvD,QAAI,SAAS,QAAW;AACtB,YAAM,IAAI,UAAU,wBAAwB,KAAK,CAAC,CAAC,aAAa,KAAK,EAAE;AAAA,IACzE;AACA,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,OAAc,eACZ,QACgC;AAChC,WAAO,qBAAqB,SAAS,QAAQ,kBAAkB,KAAK;AAAA,EACtE;AAAA,EAEA,OAAc,gBACZ,QACqC;AACrC,WAAO,qBAAqB,SAAS,QAAQ,mBAAmB,MAAM;AAAA,EACxE;AAAA,EAEA,OAAc,gBACZ,QAC8B;AAC9B,WAAO,qBAAqB,SAAS,QAAQ,mBAAmB,OAAO;AAAA,EACzE;AAAA,EAEA,aAAoB,gBAClB,QACe;AACf,UAAM,qBAAqB,KAAK,QAAQ,mBAAmB,QAAQ;AAAA,EACrE;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,136 @@
1
+ import type { ConsoleCliClusterParams } from './console.cli.service.js';
2
+ /** The shapes of `packages/shared-route-schemas/src/console/cli*.ts`. */
3
+ export interface ConsoleCliSecret {
4
+ name: string;
5
+ /** Set only when the list was read with `withValues`. */
6
+ value?: string;
7
+ }
8
+ export interface ConsoleCliAlert {
9
+ id: string;
10
+ type: string;
11
+ report: 'Email' | 'Webhook';
12
+ webhookUrl?: string;
13
+ email?: string;
14
+ createdAt?: string;
15
+ createdBy?: string;
16
+ updatedAt?: string;
17
+ updatedBy?: string;
18
+ lastTriggeredAt?: string;
19
+ triggerCount?: number;
20
+ /** True if webhook calls are signed. The secret is never shown. */
21
+ hmac?: boolean;
22
+ }
23
+ export interface ConsoleCliCreateAlert {
24
+ type: string;
25
+ report: 'Email' | 'Webhook';
26
+ webhookUrl?: string;
27
+ hmacSecret?: string;
28
+ ignoreHead?: boolean;
29
+ }
30
+ /** A missing field keeps its value. */
31
+ export interface ConsoleCliUpdateAlert {
32
+ type?: string;
33
+ report?: 'Email' | 'Webhook';
34
+ webhookUrl?: string;
35
+ hmacSecret?: string;
36
+ removeHmac?: boolean;
37
+ }
38
+ export interface ConsoleCliClient {
39
+ /** The `clientId`. */
40
+ id: string;
41
+ uuid?: string;
42
+ name: string;
43
+ permissions: string[];
44
+ createdAt?: string;
45
+ createdBy?: string;
46
+ lastUsedAt?: string;
47
+ }
48
+ export interface ConsoleCliCreatedClient extends ConsoleCliClient {
49
+ secret: string;
50
+ connection: {
51
+ clusterId: string;
52
+ zeebeGrpc?: string;
53
+ zeebeRest?: string;
54
+ oauthUrl?: string;
55
+ audience: string;
56
+ };
57
+ }
58
+ export interface ConsoleCliBackup {
59
+ id: string;
60
+ name: string;
61
+ status: string;
62
+ createdAt?: string;
63
+ completedAt?: string;
64
+ generation?: string;
65
+ generationId?: string;
66
+ zeebeStatus?: string;
67
+ operateStatus?: string;
68
+ tasklistStatus?: string;
69
+ optimizeStatus?: string;
70
+ }
71
+ export interface ConsoleCliRestore {
72
+ id: string;
73
+ backupId: string;
74
+ state: string;
75
+ }
76
+ /**
77
+ * The `/cli/v1` routes of console-backend for secrets, alerts, clients and
78
+ * backups. c4 calls them while the flag `console.c4CliApi` is on (#11623).
79
+ */
80
+ export declare class ConsoleCliResourcesService {
81
+ /**
82
+ * `path` is the template with `:name` parts, `values` fills them. Only the
83
+ * template goes to the logs and metrics: it holds no ids.
84
+ */
85
+ private static call;
86
+ /** Values only with `withValues`: that needs the right to change secrets. */
87
+ static listSecrets(params: ConsoleCliClusterParams & {
88
+ withValues?: boolean;
89
+ }): Promise<ConsoleCliSecret[]>;
90
+ /** Creates the secret, or changes it if it exists. */
91
+ static setSecret(params: ConsoleCliClusterParams & {
92
+ name: string;
93
+ value: string;
94
+ }): Promise<void>;
95
+ static deleteSecret(params: ConsoleCliClusterParams & {
96
+ name: string;
97
+ }): Promise<void>;
98
+ static listAlerts(params: ConsoleCliClusterParams): Promise<ConsoleCliAlert[]>;
99
+ static createAlert(params: ConsoleCliClusterParams & {
100
+ body: ConsoleCliCreateAlert;
101
+ }): Promise<ConsoleCliAlert>;
102
+ static updateAlert(params: ConsoleCliClusterParams & {
103
+ alertId: string;
104
+ body: ConsoleCliUpdateAlert;
105
+ }): Promise<ConsoleCliAlert>;
106
+ static deleteAlert(params: ConsoleCliClusterParams & {
107
+ alertId: string;
108
+ }): Promise<void>;
109
+ static listClients(params: ConsoleCliClusterParams): Promise<ConsoleCliClient[]>;
110
+ /** The answer holds the secret. It is the only time that it is shown. */
111
+ static createClient(params: ConsoleCliClusterParams & {
112
+ body: {
113
+ name: string;
114
+ permissions: string[];
115
+ };
116
+ }): Promise<ConsoleCliCreatedClient>;
117
+ static updateClient(params: ConsoleCliClusterParams & {
118
+ clientId: string;
119
+ name: string;
120
+ }): Promise<ConsoleCliClient>;
121
+ /** The answer holds the new secret. It is the only time that it is shown. */
122
+ static rotateClientSecret(params: ConsoleCliClusterParams & {
123
+ clientId: string;
124
+ }): Promise<ConsoleCliCreatedClient>;
125
+ static deleteClient(params: ConsoleCliClusterParams & {
126
+ clientId: string;
127
+ }): Promise<void>;
128
+ static listBackups(params: ConsoleCliClusterParams): Promise<ConsoleCliBackup[]>;
129
+ static createBackup(params: ConsoleCliClusterParams): Promise<ConsoleCliBackup>;
130
+ static deleteBackup(params: ConsoleCliClusterParams & {
131
+ backupId: string;
132
+ }): Promise<void>;
133
+ static restoreBackup(params: ConsoleCliClusterParams & {
134
+ backupId: string;
135
+ }): Promise<ConsoleCliRestore>;
136
+ }