@camunda/ccma-api 5.4.1 → 5.5.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.
- package/dist/index.d.ts +6 -4
- package/dist/index.js +2 -0
- package/dist/index.js.map +2 -2
- package/dist/services/accounts/approvals.m2m.service.d.ts +16 -0
- package/dist/services/accounts/approvals.m2m.service.js +38 -0
- package/dist/services/accounts/approvals.m2m.service.js.map +2 -2
- package/dist/services/accounts/approvals.m2m.service.spec.d.ts +1 -0
- package/dist/services/accounts/logs.service.d.ts +20 -0
- package/dist/services/accounts/logs.service.js +41 -0
- package/dist/services/accounts/logs.service.js.map +7 -0
- package/dist/services/accounts/logs.service.spec.d.ts +1 -0
- package/dist/services/console/console.admin.service.d.ts +28 -4
- package/dist/services/console/console.admin.service.js +45 -1
- package/dist/services/console/console.admin.service.js.map +2 -2
- package/dist/services/console/console.approvals.m2m.service.d.ts +50 -1
- package/dist/services/console/console.approvals.m2m.service.js +72 -0
- package/dist/services/console/console.approvals.m2m.service.js.map +2 -2
- package/dist/services/console/generation.service.d.ts +7 -8
- package/dist/services/console/generation.service.js.map +2 -2
- package/dist/services/control/control.approvals.service.d.ts +85 -1
- package/dist/services/control/control.approvals.service.js +30 -0
- package/dist/services/control/control.approvals.service.js.map +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { request } from "../../utils/api.js";
|
|
2
|
+
import { HttpError } from "../../utils/errors.js";
|
|
3
|
+
class AccountsLogsService {
|
|
4
|
+
/**
|
|
5
|
+
* The machine-to-machine tokens that were taken for each cluster in the
|
|
6
|
+
* range, one row for each cluster, and whether the read of the Auth0 log
|
|
7
|
+
* stopped before the end of the range. See `M2mTokenCountsDto`.
|
|
8
|
+
*/
|
|
9
|
+
static async getM2mTokenCounts(params) {
|
|
10
|
+
const serviceContext = {
|
|
11
|
+
method: {
|
|
12
|
+
name: "AccountsLogsService.getM2mTokenCounts",
|
|
13
|
+
url: `api/logs/clients/tokens/count?rangeInHours=${encodeURIComponent(params.params.rangeInHours)}`,
|
|
14
|
+
normalizedUrl: "api/logs/clients/tokens/count",
|
|
15
|
+
type: "get"
|
|
16
|
+
},
|
|
17
|
+
source: params.config.metrics?.source || "unset",
|
|
18
|
+
target: { name: "accounts", type: "internal" }
|
|
19
|
+
};
|
|
20
|
+
const response = await request({
|
|
21
|
+
config: params.config,
|
|
22
|
+
base: { id: "accounts" },
|
|
23
|
+
url: serviceContext.method.url,
|
|
24
|
+
method: serviceContext.method.type,
|
|
25
|
+
metricsDetails: serviceContext,
|
|
26
|
+
responseType: "json"
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
throw new HttpError(
|
|
30
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
31
|
+
response.status,
|
|
32
|
+
response.statusText
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return response.body ?? { clusters: [], counted: 0, total: 0, truncated: false };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
AccountsLogsService
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=logs.service.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/services/accounts/logs.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 { M2mTokenCountsDto } from '@camunda/ccma-shared-types'\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\nexport interface GetM2mTokenCountsRequest extends RequestBaseParams {\n params: {\n /** How far back the Auth0 log is read, in hours. The accounts tool read 24. */\n rangeInHours: number\n }\n}\n\n/**\n * The log reads of accounts-backend (`api/logs`). They answer to\n * `admin.readAll` only.\n */\nexport class AccountsLogsService {\n /**\n * The machine-to-machine tokens that were taken for each cluster in the\n * range, one row for each cluster, and whether the read of the Auth0 log\n * stopped before the end of the range. See `M2mTokenCountsDto`.\n */\n public static async getM2mTokenCounts(\n params: GetM2mTokenCountsRequest,\n ): Promise<M2mTokenCountsDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsLogsService.getM2mTokenCounts',\n url: `api/logs/clients/tokens/count?rangeInHours=${encodeURIComponent(params.params.rangeInHours)}`,\n normalizedUrl: 'api/logs/clients/tokens/count',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n const response = await request<M2mTokenCountsDto>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\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 (\n response.body ?? { clusters: [], counted: 0, total: 0, truncated: false }\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAanB,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,aAAoB,kBAClB,QAC4B;AAC5B,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK,8CAA8C,mBAAmB,OAAO,OAAO,YAAY,CAAC;AAAA,QACjG,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,YAAY,MAAM,WAAW;AAAA,IAC/C;AACA,UAAM,WAAW,MAAM,QAA2B;AAAA,MAChD,QAAQ,OAAO;AAAA,MACf,MAAM,EAAE,IAAI,WAAW;AAAA,MACvB,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,MAChB,cAAc;AAAA,IAChB,CAAC;AACD,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,WACE,SAAS,QAAQ,EAAE,UAAU,CAAC,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,MAAM;AAAA,EAE5E;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -331,6 +331,18 @@ export interface AdminClusterNonSpotNodesRequest extends RequestBaseParams {
|
|
|
331
331
|
nonSpotNodesEnabled: boolean;
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
+
/** What `GET api/admin/clusters/modifications` answers. */
|
|
335
|
+
export interface ModificationsAnswer {
|
|
336
|
+
clusters: ConsoleClusterDto[];
|
|
337
|
+
modifications: ClusterModificationDto[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* How many cluster ids one GET of the modifications carries in its query.
|
|
341
|
+
*
|
|
342
|
+
* 50 uuids are about 1.9 KB of request line, well under the 8 KB that the
|
|
343
|
+
* ingress and node accept. The bound is on the request, not on the answer.
|
|
344
|
+
*/
|
|
345
|
+
export declare const CLUSTER_UUIDS_PER_READ = 50;
|
|
334
346
|
export declare class ConsoleAdminService {
|
|
335
347
|
static updateClusterToNewPlanType(params: UpdateClusterToNewPlanTypeRequest): Promise<void>;
|
|
336
348
|
static updateClusterMetricsStartDate(params: UpdateClusterMetricsStartDateRequest): Promise<void>;
|
|
@@ -418,14 +430,26 @@ export declare class ConsoleAdminService {
|
|
|
418
430
|
static wakeCluster(params: {
|
|
419
431
|
clusterId: string;
|
|
420
432
|
} & RequestBaseParams): Promise<void | undefined>;
|
|
433
|
+
/**
|
|
434
|
+
* Every cluster modification, with the clusters they belong to.
|
|
435
|
+
*
|
|
436
|
+
* `clusterUuids` bounds the answer to those clusters. Console reads the
|
|
437
|
+
* whole table without it, and one cluster for each row of the answer, so a
|
|
438
|
+
* reader that asks about a few clusters names them. The ids go in the
|
|
439
|
+
* query of a GET, so they travel in groups of `CLUSTER_UUIDS_PER_READ`:
|
|
440
|
+
* the request line must not grow with the selection, or a large one
|
|
441
|
+
* answers 414. The groups are read one after the other and merged, with
|
|
442
|
+
* each cluster one time, so the caller sees one answer of the usual shape.
|
|
443
|
+
* An empty list reads nothing and answers nothing.
|
|
444
|
+
*/
|
|
421
445
|
static getAllModifications(params: RequestBaseParams & {
|
|
446
|
+
clusterUuids?: readonly string[];
|
|
422
447
|
headers?: {
|
|
423
448
|
'x-camunda-email'?: string;
|
|
424
449
|
};
|
|
425
|
-
}): Promise<
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
} | undefined>;
|
|
450
|
+
}): Promise<ModificationsAnswer | undefined>;
|
|
451
|
+
/** One GET of the modifications, for every cluster or for the ids given. */
|
|
452
|
+
private static readModifications;
|
|
429
453
|
static createModification(params: RequestBaseParams & {
|
|
430
454
|
clusterUuid: string;
|
|
431
455
|
headers?: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { request } from "../../utils/api.js";
|
|
2
2
|
import { HttpError } from "../../utils/errors.js";
|
|
3
|
+
const CLUSTER_UUIDS_PER_READ = 50;
|
|
3
4
|
class ConsoleAdminService {
|
|
4
5
|
static async updateClusterToNewPlanType(params) {
|
|
5
6
|
const serviceContext = {
|
|
@@ -1048,11 +1049,53 @@ class ConsoleAdminService {
|
|
|
1048
1049
|
}
|
|
1049
1050
|
return response.body;
|
|
1050
1051
|
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Every cluster modification, with the clusters they belong to.
|
|
1054
|
+
*
|
|
1055
|
+
* `clusterUuids` bounds the answer to those clusters. Console reads the
|
|
1056
|
+
* whole table without it, and one cluster for each row of the answer, so a
|
|
1057
|
+
* reader that asks about a few clusters names them. The ids go in the
|
|
1058
|
+
* query of a GET, so they travel in groups of `CLUSTER_UUIDS_PER_READ`:
|
|
1059
|
+
* the request line must not grow with the selection, or a large one
|
|
1060
|
+
* answers 414. The groups are read one after the other and merged, with
|
|
1061
|
+
* each cluster one time, so the caller sees one answer of the usual shape.
|
|
1062
|
+
* An empty list reads nothing and answers nothing.
|
|
1063
|
+
*/
|
|
1051
1064
|
static async getAllModifications(params) {
|
|
1065
|
+
const { clusterUuids, ...rest } = params;
|
|
1066
|
+
if (clusterUuids === void 0) {
|
|
1067
|
+
return ConsoleAdminService.readModifications(rest);
|
|
1068
|
+
}
|
|
1069
|
+
if (clusterUuids.length === 0) {
|
|
1070
|
+
return { clusters: [], modifications: [] };
|
|
1071
|
+
}
|
|
1072
|
+
const merged = { clusters: [], modifications: [] };
|
|
1073
|
+
const seenClusters = /* @__PURE__ */ new Set();
|
|
1074
|
+
for (let start = 0; start < clusterUuids.length; start += CLUSTER_UUIDS_PER_READ) {
|
|
1075
|
+
const page = await ConsoleAdminService.readModifications(
|
|
1076
|
+
rest,
|
|
1077
|
+
clusterUuids.slice(start, start + CLUSTER_UUIDS_PER_READ)
|
|
1078
|
+
);
|
|
1079
|
+
if (!page) {
|
|
1080
|
+
continue;
|
|
1081
|
+
}
|
|
1082
|
+
merged.modifications.push(...page.modifications);
|
|
1083
|
+
for (const cluster of page.clusters) {
|
|
1084
|
+
if (!seenClusters.has(cluster.uuid)) {
|
|
1085
|
+
seenClusters.add(cluster.uuid);
|
|
1086
|
+
merged.clusters.push(cluster);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return merged;
|
|
1091
|
+
}
|
|
1092
|
+
/** One GET of the modifications, for every cluster or for the ids given. */
|
|
1093
|
+
static async readModifications(params, clusterUuids) {
|
|
1094
|
+
const query = clusterUuids && clusterUuids.length > 0 ? `?clusterUuids=${clusterUuids.map(encodeURIComponent).join(",")}` : "";
|
|
1052
1095
|
const serviceContext = {
|
|
1053
1096
|
method: {
|
|
1054
1097
|
name: `ConsoleAdminService.getAllModifications`,
|
|
1055
|
-
url: `api/admin/clusters/modifications`,
|
|
1098
|
+
url: `api/admin/clusters/modifications${query}`,
|
|
1056
1099
|
normalizedUrl: `api/clusters/modifications`,
|
|
1057
1100
|
type: "get"
|
|
1058
1101
|
},
|
|
@@ -2153,6 +2196,7 @@ class ConsoleAdminService {
|
|
|
2153
2196
|
}
|
|
2154
2197
|
}
|
|
2155
2198
|
export {
|
|
2199
|
+
CLUSTER_UUIDS_PER_READ,
|
|
2156
2200
|
ConsoleAdminService
|
|
2157
2201
|
};
|
|
2158
2202
|
//# sourceMappingURL=console.admin.service.js.map
|