@camunda/ccma-api 2.1.0 → 2.2.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 +12 -3
- package/dist/index.js +10 -0
- package/dist/index.js.map +2 -2
- package/dist/services/accounts/approvals.m2m.service.d.ts +33 -0
- package/dist/services/accounts/approvals.m2m.service.js +64 -0
- package/dist/services/accounts/approvals.m2m.service.js.map +7 -0
- package/dist/services/accounts/hdp.service.d.ts +28 -0
- package/dist/services/accounts/hdp.service.js +40 -0
- package/dist/services/accounts/hdp.service.js.map +2 -2
- package/dist/services/accounts/orgs.service.d.ts +6 -2
- package/dist/services/accounts/orgs.service.js +6 -2
- package/dist/services/accounts/orgs.service.js.map +2 -2
- package/dist/services/console/console.approvals.m2m.service.d.ts +47 -0
- package/dist/services/console/console.approvals.m2m.service.js +105 -0
- package/dist/services/console/console.approvals.m2m.service.js.map +7 -0
- package/dist/services/console/console.channel.service.d.ts +4 -2
- package/dist/services/console/console.channel.service.js.map +2 -2
- package/dist/services/console/console.cluster.service.d.ts +15 -0
- package/dist/services/console/console.cluster.service.js +40 -0
- package/dist/services/console/console.cluster.service.js.map +2 -2
- package/dist/services/console/console.cluster.v2.service.d.ts +11 -3
- package/dist/services/console/console.cluster.v2.service.js +37 -2
- package/dist/services/console/console.cluster.v2.service.js.map +2 -2
- package/dist/services/control/control.annotations.service.d.ts +149 -0
- package/dist/services/control/control.annotations.service.js +193 -0
- package/dist/services/control/control.annotations.service.js.map +7 -0
- package/dist/services/control/control.approvals.service.d.ts +130 -6
- package/dist/services/control/control.approvals.service.js +118 -13
- package/dist/services/control/control.approvals.service.js.map +2 -2
- package/dist/services/control/control.feature-flags.service.d.ts +13 -0
- package/dist/services/control/control.feature-flags.service.js +52 -0
- package/dist/services/control/control.feature-flags.service.js.map +7 -0
- package/dist/services/control/control.platform.service.d.ts +24 -0
- package/dist/services/control/control.platform.service.js +36 -0
- package/dist/services/control/control.platform.service.js.map +7 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/console/console.channel.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 { GenerationDto } 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 ConsoleChannelDto {\n uuid: string\n name: string\n description: string\n isDefault: boolean\n defaultGeneration: GenerationDto\n allowedGenerations: GenerationDto[]\n createdBy: string\n createdByName?: string\n created: Date\n updatedBy: string\n updated: Date\n}\n\nexport interface GetConsoleChannelsParams extends RequestBaseParams {}\n\nexport interface CreateConsoleChannelParams extends RequestBaseParams {\n body: {\n name: string\n description: string\n isDefault: boolean\n defaultGenerationId
|
|
5
|
-
"mappings": "AAWA,SAAS,eAAe;AACxB,SAAS,iBAAiB;
|
|
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 { GenerationDto } 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 ConsoleChannelDto {\n uuid: string\n name: string\n description: string\n isDefault: boolean\n defaultGeneration: GenerationDto\n allowedGenerations: GenerationDto[]\n createdBy: string\n createdByName?: string\n created: Date\n updatedBy: string\n updated: Date\n}\n\nexport interface GetConsoleChannelsParams extends RequestBaseParams {}\n\nexport interface CreateConsoleChannelParams extends RequestBaseParams {\n body: {\n name: string\n description: string\n isDefault: boolean\n /** Required: the route answers 400 when the write carries no default. */\n defaultGenerationId: string\n allowedGenerationIds: string[]\n }\n}\n\nexport interface UpdateConsoleChannelParams extends RequestBaseParams {\n params: {\n channelUuid: string\n }\n body: {\n name: string\n description: string\n isDefault: boolean\n /** Required, like on create: a write with no default is refused. */\n defaultGenerationId: string\n allowedGenerationIds: string[]\n }\n}\n\nexport interface DeleteConsoleChannelParams extends RequestBaseParams {\n params: {\n channelUuid: string\n }\n}\n\nexport class ChannelService {\n public static async getAll(\n params: GetConsoleChannelsParams,\n ): Promise<ConsoleChannelDto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ChannelService.getAll',\n url: 'api/channels',\n normalizedUrl: 'api/channels',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleChannelDto[]>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n return response.body ?? []\n }\n\n public static async create(\n params: CreateConsoleChannelParams,\n ): Promise<ConsoleChannelDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ChannelService.create',\n url: 'api/channels',\n normalizedUrl: 'api/channels',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleChannelDto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: '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\n if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async update(\n params: UpdateConsoleChannelParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ChannelService.update',\n url: `api/channels/${params.params.channelUuid}`,\n normalizedUrl: 'api/channels/:channelUuid',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.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 async delete(\n params: DeleteConsoleChannelParams,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ChannelService.delete',\n url: `api/channels/${params.params.channelUuid}`,\n normalizedUrl: 'api/channels/:channelUuid',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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"],
|
|
5
|
+
"mappings": "AAWA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAiDnB,MAAM,eAAe;AAAA,EAC1B,aAAoB,OAClB,QAC8B;AAC9B,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK;AAAA,QACL,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,WAAW,MAAM,WAAW;AAAA,IAC9C;AAEA,UAAM,WAAW,MAAM,QAA6B;AAAA,MAClD,GAAG;AAAA,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S;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -165,6 +165,11 @@ export interface MoveClusterOwnerRequest extends RequestBaseParams {
|
|
|
165
165
|
ownerId: string;
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
+
export interface GetAdminClusterRequest extends RequestBaseParams {
|
|
169
|
+
params: {
|
|
170
|
+
clusterId: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
168
173
|
export interface FailoverConsoleClusterRequest extends RequestBaseParams {
|
|
169
174
|
params: {
|
|
170
175
|
orgId: string;
|
|
@@ -215,6 +220,16 @@ export declare class ConsoleClusterService {
|
|
|
215
220
|
static updateCluster(params: UpdateClusterRequest): Promise<void>;
|
|
216
221
|
static updateExternalIdpSecret(params: UpdateExternalIdpSecretRequest): Promise<void>;
|
|
217
222
|
static deleteExternalIdp(params: DeleteExternalIdpRequest): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Reads one cluster by its id alone, on the admin route.
|
|
225
|
+
*
|
|
226
|
+
* The org-scoped `getCluster` needs the owning organization, which is the very
|
|
227
|
+
* thing a caller that only holds a cluster id does not know. This admin route
|
|
228
|
+
* (`api/admin/clusters/:clusterId`) resolves the cluster without it, so a
|
|
229
|
+
* caller can read `ownerId` — the current owning organization. It needs
|
|
230
|
+
* `clusters.canReadAllClusterInfo` on the backend.
|
|
231
|
+
*/
|
|
232
|
+
static getAdminCluster(params: GetAdminClusterRequest): Promise<ConsoleClusterDto>;
|
|
218
233
|
static moveClusterOwner(params: MoveClusterOwnerRequest): Promise<MoveClusterOwnerResult | undefined>;
|
|
219
234
|
static failoverCluster(params: FailoverConsoleClusterRequest): Promise<FailoverConsoleClusterResult>;
|
|
220
235
|
static deleteCluster(params: DeleteConsoleClusterRequest): Promise<void>;
|
|
@@ -338,6 +338,46 @@ class ConsoleClusterService {
|
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Reads one cluster by its id alone, on the admin route.
|
|
343
|
+
*
|
|
344
|
+
* The org-scoped `getCluster` needs the owning organization, which is the very
|
|
345
|
+
* thing a caller that only holds a cluster id does not know. This admin route
|
|
346
|
+
* (`api/admin/clusters/:clusterId`) resolves the cluster without it, so a
|
|
347
|
+
* caller can read `ownerId` — the current owning organization. It needs
|
|
348
|
+
* `clusters.canReadAllClusterInfo` on the backend.
|
|
349
|
+
*/
|
|
350
|
+
static async getAdminCluster(params) {
|
|
351
|
+
const serviceContext = {
|
|
352
|
+
method: {
|
|
353
|
+
name: "ConsoleClusterService.getAdminCluster",
|
|
354
|
+
url: `api/admin/clusters/${params.params.clusterId}`,
|
|
355
|
+
normalizedUrl: "api/admin/clusters/:clusterId",
|
|
356
|
+
type: "get"
|
|
357
|
+
},
|
|
358
|
+
source: params.config.metrics?.source || "unset",
|
|
359
|
+
target: { name: "console", type: "internal" }
|
|
360
|
+
};
|
|
361
|
+
const response = await request({
|
|
362
|
+
...params,
|
|
363
|
+
base: { id: "console" },
|
|
364
|
+
url: serviceContext.method.url,
|
|
365
|
+
method: serviceContext.method.type,
|
|
366
|
+
metricsDetails: serviceContext,
|
|
367
|
+
responseType: "json"
|
|
368
|
+
});
|
|
369
|
+
if (!response.ok) {
|
|
370
|
+
throw new HttpError(
|
|
371
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
372
|
+
response.status,
|
|
373
|
+
response.statusText
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
if (!response.body) {
|
|
377
|
+
throw new Error(`${serviceContext.method.name}: Empty response body`);
|
|
378
|
+
}
|
|
379
|
+
return response.body;
|
|
380
|
+
}
|
|
341
381
|
static async moveClusterOwner(params) {
|
|
342
382
|
const serviceContext = {
|
|
343
383
|
method: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/console/console.cluster.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 ClusterLabels,\n ConsoleClusterDto,\n ExternalIdpConfig,\n MoveClusterOwnerResult,\n OptimizeFilteringConfig,\n SecretsFilterMode,\n} 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 GetConsoleClustersRequest extends RequestBaseParams {\n params: {\n orgId: string\n }\n}\n\nexport interface CreateConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n }\n body: {\n name: string\n planTypeId: string\n channelId: string\n generationId: string\n k8sContextId: string\n autoUpdate?: boolean\n stageLabel?: string\n backupRegionId?: string\n encryption?: string\n numberOfAllocatedHwPackages?: number\n tasklistV2Enabled?: boolean\n identityBackendChecksEnabled?: boolean\n description?: string\n }\n}\n\nexport interface CreateConsoleClusterResponse {\n clusterId: string\n}\n\n/**\n * The body of a duplicate is the body of a create: the fields that the customer\n * selects again for the new cluster. Every other setting of the source cluster\n * comes from console-backend.\n */\nexport interface DuplicateConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: CreateConsoleClusterRequest['body'] & {\n /**\n * Deletes the source cluster once the new cluster exists. An org that holds\n * one reservation can duplicate a cluster only this way. It needs the\n * permission to delete a cluster.\n */\n replaceSource?: boolean\n }\n}\n\n/** The result of one carry-over step of a duplicate. */\nexport type ConsoleClusterCarryOverResult = 'ok' | 'skipped' | { error: string }\n\nexport interface DuplicateConsoleClusterResponse {\n clusterId: string\n /**\n * False when `replaceSource` was asked for and the source cluster is still\n * there: either a carry-over step failed, which stops the delete, or the\n * delete itself failed. The new cluster exists either way, thus the caller\n * must tell the customer to delete the source cluster by hand.\n */\n sourceDeleted?: boolean\n /**\n * A step that failed does not fail the duplicate: the new cluster exists\n * either way. Thus the caller must show the steps that did not complete.\n */\n carryOver: {\n clusterClients: ConsoleClusterCarryOverResult\n connectorSecrets: ConsoleClusterCarryOverResult\n alerts: ConsoleClusterCarryOverResult\n byom: ConsoleClusterCarryOverResult\n byoidp: ConsoleClusterCarryOverResult\n backupSchedule: ConsoleClusterCarryOverResult\n }\n}\n\nexport interface WakeConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface SuspendConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface ProxyOrchestrationClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n region: string\n app: 'tasklist' | 'optimize' | 'operate' | 'zeebe' | 'identity'\n route?: string\n headers: {\n [key: string]: string\n }\n }\n body?: unknown\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n}\n\nexport interface UpdateClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n name?: string\n description?: string\n labels?: ClusterLabels\n primaryEncryptionKeyId?: string\n secondaryEncryptionKeyId?: string\n numberOfAllocatedHwPackages?: number\n mcpEnabled?: boolean\n playMode?: boolean\n swagger?: boolean\n tasklistV2Enabled?: boolean\n optimizeEnabled?: boolean\n autoUpdate?: boolean\n enforceGroups?: boolean\n rba?: boolean\n identityBackendChecksEnabled?: boolean\n multiTenancyEnabled?: boolean\n sessionMaxInactiveIntervalMinutes?: number\n sessionHeartbeatEnabled?: boolean\n // BYOIDP Phase 1 (#3190). Secret is sent via updateExternalIdpSecret, not here.\n externalIdpEnabled?: boolean\n externalIdpConfig?: ExternalIdpConfig\n businessIdUniquenessEnabled?: boolean\n appIntegrationsEnabled?: boolean\n secretsFilterMode?: SecretsFilterMode\n auditLogEnabled?: boolean | null\n auditLogUserCategories?: string[] | null\n auditLogClientCategories?: string[] | null\n /** null deactivates filtering; otherwise the full config replaces what's stored. */\n optimizeFiltering?: OptimizeFilteringConfig | null\n }\n}\n\n// BYOIDP Phase 1 (#3190): write the OIDC client secret. Separate from updateCluster \u2014\n// the value never travels through the cluster PATCH/DB/CR path.\nexport interface UpdateExternalIdpSecretRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n name: string\n clientSecret: string\n }\n}\n\n// BYOIDP (#9864): remove the whole external-IdP setup \u2014 config, CR entry, and\n// delivered secret. Distinct from the enable/disable toggle, which keeps the config.\nexport interface DeleteExternalIdpRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface GetConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface MoveClusterOwnerRequest extends RequestBaseParams {\n params: {\n clusterId: string\n }\n body: {\n ownerId: string\n }\n}\n\nexport interface FailoverConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n /** Backups to clone into the failover cluster (one or more). */\n backupIds: string[]\n /** The single backup to restore from immediately; must be one of `backupIds`. */\n restoreBackupId: string\n }\n}\n\nexport interface FailoverConsoleClusterResult {\n newClusterId: string\n results: {\n backupClone: 'ok' | { error: string }\n restore: 'ok' | { error: string }\n }\n}\n\nexport interface DeleteConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport class ConsoleClusterService {\n public static async getClusters(\n params: GetConsoleClustersRequest,\n ): Promise<ConsoleClusterDto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.getClusters',\n url: `api/orgs/${params.params.orgId}/clusters`,\n normalizedUrl: 'api/orgs/:orgId/clusters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleClusterDto[]>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n return response.body ?? []\n }\n\n public static async createCluster(\n params: CreateConsoleClusterRequest,\n ): Promise<CreateConsoleClusterResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.createCluster',\n url: `api/orgs/${params.params.orgId}/clusters`,\n normalizedUrl: 'api/orgs/:orgId/clusters',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CreateConsoleClusterResponse>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async duplicateCluster(\n params: DuplicateConsoleClusterRequest,\n ): Promise<DuplicateConsoleClusterResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.duplicateCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/duplicate`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/duplicate',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<DuplicateConsoleClusterResponse>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async getCluster(\n params: GetConsoleClusterRequest,\n ): Promise<ConsoleClusterDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.getCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleClusterDto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async suspendCluster(\n params: SuspendConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.suspendCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/suspend`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/suspend',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 async wakeCluster(\n params: WakeConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.wakeCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/wake`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/wake',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 /**\n * Proxy request to orchestration cluster application\n * @param params - Request parameters including clusterId, region, app, and optional route\n * @returns Response from the orchestration cluster\n */\n public static async proxyOrchestrationCluster<TResponse = unknown>(\n params: ProxyOrchestrationClusterRequest,\n ): Promise<TResponse> {\n const method = params.method || 'GET'\n const route = params.params.route || ''\n\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `ConsoleClusterService.proxyOrchestrationCluster`,\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/oc`,\n normalizedUrl: `api/orgs/:orgId/clusters/:clusterId/oc`,\n type: method.toLowerCase() as\n | 'get'\n | 'post'\n | 'put'\n | 'patch'\n | 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n // Construct request body with _cluster metadata and body payload\n const requestBody = {\n _cluster: {\n region: params.params.region,\n app: params.params.app,\n route,\n },\n body: params.body,\n }\n\n const response = await request<TResponse>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: requestBody,\n headers: params.params.headers,\n responseType: 'json',\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 if (response.body === undefined) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n /**\n * Update cluster properties\n * @param params - Request parameters including orgId, clusterId, and properties to update\n * @returns void\n */\n public static async updateCluster(\n params: UpdateClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.updateCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: params.body,\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 // BYOIDP Phase 1 (#3190). Call BEFORE updateCluster enables the provider so the CR\n // never references a not-yet-written Secret (fail-closed ordering, design \u00A73).\n public static async updateExternalIdpSecret(\n params: UpdateExternalIdpSecretRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.updateExternalIdpSecret',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/external-idp/secret`,\n normalizedUrl:\n 'api/orgs/:orgId/clusters/:clusterId/external-idp/secret',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: params.body,\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 // BYOIDP (#9864). Clears the config, the CR entry, and the delivered secret in\n // one call. The backend owns the order \u2014 see the route in ClusterRouter.ts.\n public static async deleteExternalIdp(\n params: DeleteExternalIdpRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.deleteExternalIdp',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/external-idp`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/external-idp',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 async moveClusterOwner(\n params: MoveClusterOwnerRequest,\n ): Promise<MoveClusterOwnerResult | undefined> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.moveClusterOwner',\n url: `api/admin/clusters/${params.params.clusterId}/owner`,\n normalizedUrl: 'api/admin/clusters/:clusterId/owner',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<MoveClusterOwnerResult>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 // The current backend answers 200 with `ownerUnchanged: true` for the\n // no-op case (the owner does not change). An older backend, still live\n // during a rollout, answers 204 with no body for that same case.\n // `request()` still parses an empty body as `{}` for a 'json' response\n // type, so the 204 case needs its own check.\n if (response.status === 204) {\n return undefined\n }\n\n return response.body\n }\n\n public static async failoverCluster(\n params: FailoverConsoleClusterRequest,\n ): Promise<FailoverConsoleClusterResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.failoverCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/failover`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/failover',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<FailoverConsoleClusterResult>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: '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\n return response.body!\n }\n\n public static async deleteCluster(\n params: DeleteConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.deleteCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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"],
|
|
5
|
-
"mappings": "AAkBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;
|
|
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 ClusterLabels,\n ConsoleClusterDto,\n ExternalIdpConfig,\n MoveClusterOwnerResult,\n OptimizeFilteringConfig,\n SecretsFilterMode,\n} 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 GetConsoleClustersRequest extends RequestBaseParams {\n params: {\n orgId: string\n }\n}\n\nexport interface CreateConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n }\n body: {\n name: string\n planTypeId: string\n channelId: string\n generationId: string\n k8sContextId: string\n autoUpdate?: boolean\n stageLabel?: string\n backupRegionId?: string\n encryption?: string\n numberOfAllocatedHwPackages?: number\n tasklistV2Enabled?: boolean\n identityBackendChecksEnabled?: boolean\n description?: string\n }\n}\n\nexport interface CreateConsoleClusterResponse {\n clusterId: string\n}\n\n/**\n * The body of a duplicate is the body of a create: the fields that the customer\n * selects again for the new cluster. Every other setting of the source cluster\n * comes from console-backend.\n */\nexport interface DuplicateConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: CreateConsoleClusterRequest['body'] & {\n /**\n * Deletes the source cluster once the new cluster exists. An org that holds\n * one reservation can duplicate a cluster only this way. It needs the\n * permission to delete a cluster.\n */\n replaceSource?: boolean\n }\n}\n\n/** The result of one carry-over step of a duplicate. */\nexport type ConsoleClusterCarryOverResult = 'ok' | 'skipped' | { error: string }\n\nexport interface DuplicateConsoleClusterResponse {\n clusterId: string\n /**\n * False when `replaceSource` was asked for and the source cluster is still\n * there: either a carry-over step failed, which stops the delete, or the\n * delete itself failed. The new cluster exists either way, thus the caller\n * must tell the customer to delete the source cluster by hand.\n */\n sourceDeleted?: boolean\n /**\n * A step that failed does not fail the duplicate: the new cluster exists\n * either way. Thus the caller must show the steps that did not complete.\n */\n carryOver: {\n clusterClients: ConsoleClusterCarryOverResult\n connectorSecrets: ConsoleClusterCarryOverResult\n alerts: ConsoleClusterCarryOverResult\n byom: ConsoleClusterCarryOverResult\n byoidp: ConsoleClusterCarryOverResult\n backupSchedule: ConsoleClusterCarryOverResult\n }\n}\n\nexport interface WakeConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface SuspendConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface ProxyOrchestrationClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n region: string\n app: 'tasklist' | 'optimize' | 'operate' | 'zeebe' | 'identity'\n route?: string\n headers: {\n [key: string]: string\n }\n }\n body?: unknown\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n}\n\nexport interface UpdateClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n name?: string\n description?: string\n labels?: ClusterLabels\n primaryEncryptionKeyId?: string\n secondaryEncryptionKeyId?: string\n numberOfAllocatedHwPackages?: number\n mcpEnabled?: boolean\n playMode?: boolean\n swagger?: boolean\n tasklistV2Enabled?: boolean\n optimizeEnabled?: boolean\n autoUpdate?: boolean\n enforceGroups?: boolean\n rba?: boolean\n identityBackendChecksEnabled?: boolean\n multiTenancyEnabled?: boolean\n sessionMaxInactiveIntervalMinutes?: number\n sessionHeartbeatEnabled?: boolean\n // BYOIDP Phase 1 (#3190). Secret is sent via updateExternalIdpSecret, not here.\n externalIdpEnabled?: boolean\n externalIdpConfig?: ExternalIdpConfig\n businessIdUniquenessEnabled?: boolean\n appIntegrationsEnabled?: boolean\n secretsFilterMode?: SecretsFilterMode\n auditLogEnabled?: boolean | null\n auditLogUserCategories?: string[] | null\n auditLogClientCategories?: string[] | null\n /** null deactivates filtering; otherwise the full config replaces what's stored. */\n optimizeFiltering?: OptimizeFilteringConfig | null\n }\n}\n\n// BYOIDP Phase 1 (#3190): write the OIDC client secret. Separate from updateCluster \u2014\n// the value never travels through the cluster PATCH/DB/CR path.\nexport interface UpdateExternalIdpSecretRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n name: string\n clientSecret: string\n }\n}\n\n// BYOIDP (#9864): remove the whole external-IdP setup \u2014 config, CR entry, and\n// delivered secret. Distinct from the enable/disable toggle, which keeps the config.\nexport interface DeleteExternalIdpRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface GetConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport interface MoveClusterOwnerRequest extends RequestBaseParams {\n params: {\n clusterId: string\n }\n body: {\n ownerId: string\n }\n}\n\nexport interface GetAdminClusterRequest extends RequestBaseParams {\n params: {\n clusterId: string\n }\n}\n\nexport interface FailoverConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n body: {\n /** Backups to clone into the failover cluster (one or more). */\n backupIds: string[]\n /** The single backup to restore from immediately; must be one of `backupIds`. */\n restoreBackupId: string\n }\n}\n\nexport interface FailoverConsoleClusterResult {\n newClusterId: string\n results: {\n backupClone: 'ok' | { error: string }\n restore: 'ok' | { error: string }\n }\n}\n\nexport interface DeleteConsoleClusterRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId: string\n }\n}\n\nexport class ConsoleClusterService {\n public static async getClusters(\n params: GetConsoleClustersRequest,\n ): Promise<ConsoleClusterDto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.getClusters',\n url: `api/orgs/${params.params.orgId}/clusters`,\n normalizedUrl: 'api/orgs/:orgId/clusters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleClusterDto[]>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n return response.body ?? []\n }\n\n public static async createCluster(\n params: CreateConsoleClusterRequest,\n ): Promise<CreateConsoleClusterResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.createCluster',\n url: `api/orgs/${params.params.orgId}/clusters`,\n normalizedUrl: 'api/orgs/:orgId/clusters',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CreateConsoleClusterResponse>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async duplicateCluster(\n params: DuplicateConsoleClusterRequest,\n ): Promise<DuplicateConsoleClusterResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.duplicateCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/duplicate`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/duplicate',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<DuplicateConsoleClusterResponse>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async getCluster(\n params: GetConsoleClusterRequest,\n ): Promise<ConsoleClusterDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.getCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleClusterDto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async suspendCluster(\n params: SuspendConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.suspendCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/suspend`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/suspend',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 async wakeCluster(\n params: WakeConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.wakeCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/wake`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/wake',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 /**\n * Proxy request to orchestration cluster application\n * @param params - Request parameters including clusterId, region, app, and optional route\n * @returns Response from the orchestration cluster\n */\n public static async proxyOrchestrationCluster<TResponse = unknown>(\n params: ProxyOrchestrationClusterRequest,\n ): Promise<TResponse> {\n const method = params.method || 'GET'\n const route = params.params.route || ''\n\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `ConsoleClusterService.proxyOrchestrationCluster`,\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/oc`,\n normalizedUrl: `api/orgs/:orgId/clusters/:clusterId/oc`,\n type: method.toLowerCase() as\n | 'get'\n | 'post'\n | 'put'\n | 'patch'\n | 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n // Construct request body with _cluster metadata and body payload\n const requestBody = {\n _cluster: {\n region: params.params.region,\n app: params.params.app,\n route,\n },\n body: params.body,\n }\n\n const response = await request<TResponse>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: requestBody,\n headers: params.params.headers,\n responseType: 'json',\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 if (response.body === undefined) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n /**\n * Update cluster properties\n * @param params - Request parameters including orgId, clusterId, and properties to update\n * @returns void\n */\n public static async updateCluster(\n params: UpdateClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.updateCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'patch',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: params.body,\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 // BYOIDP Phase 1 (#3190). Call BEFORE updateCluster enables the provider so the CR\n // never references a not-yet-written Secret (fail-closed ordering, design \u00A73).\n public static async updateExternalIdpSecret(\n params: UpdateExternalIdpSecretRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.updateExternalIdpSecret',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/external-idp/secret`,\n normalizedUrl:\n 'api/orgs/:orgId/clusters/:clusterId/external-idp/secret',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n body: params.body,\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 // BYOIDP (#9864). Clears the config, the CR entry, and the delivered secret in\n // one call. The backend owns the order \u2014 see the route in ClusterRouter.ts.\n public static async deleteExternalIdp(\n params: DeleteExternalIdpRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.deleteExternalIdp',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/external-idp`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/external-idp',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'console',\n type: 'internal',\n },\n }\n\n const response = await request<void>({\n config: params.config,\n base: {\n id: 'console',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 /**\n * Reads one cluster by its id alone, on the admin route.\n *\n * The org-scoped `getCluster` needs the owning organization, which is the very\n * thing a caller that only holds a cluster id does not know. This admin route\n * (`api/admin/clusters/:clusterId`) resolves the cluster without it, so a\n * caller can read `ownerId` \u2014 the current owning organization. It needs\n * `clusters.canReadAllClusterInfo` on the backend.\n */\n public static async getAdminCluster(\n params: GetAdminClusterRequest,\n ): Promise<ConsoleClusterDto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.getAdminCluster',\n url: `api/admin/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/admin/clusters/:clusterId',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ConsoleClusterDto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n if (!response.body) {\n throw new Error(`${serviceContext.method.name}: Empty response body`)\n }\n\n return response.body\n }\n\n public static async moveClusterOwner(\n params: MoveClusterOwnerRequest,\n ): Promise<MoveClusterOwnerResult | undefined> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.moveClusterOwner',\n url: `api/admin/clusters/${params.params.clusterId}/owner`,\n normalizedUrl: 'api/admin/clusters/:clusterId/owner',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<MoveClusterOwnerResult>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n body: params.body,\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 // The current backend answers 200 with `ownerUnchanged: true` for the\n // no-op case (the owner does not change). An older backend, still live\n // during a rollout, answers 204 with no body for that same case.\n // `request()` still parses an empty body as `{}` for a 'json' response\n // type, so the 204 case needs its own check.\n if (response.status === 204) {\n return undefined\n }\n\n return response.body\n }\n\n public static async failoverCluster(\n params: FailoverConsoleClusterRequest,\n ): Promise<FailoverConsoleClusterResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.failoverCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}/failover`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId/failover',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<FailoverConsoleClusterResult>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: '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\n return response.body!\n }\n\n public static async deleteCluster(\n params: DeleteConsoleClusterRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterService.deleteCluster',\n url: `api/orgs/${params.params.orgId}/clusters/${params.params.clusterId}`,\n normalizedUrl: 'api/orgs/:orgId/clusters/:clusterId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<void>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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"],
|
|
5
|
+
"mappings": "AAkBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA0NnB,MAAM,sBAA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ivityV2Response, ClusterByClientV2Dto, ClusterDetailV2Dto, ClusterFacetsV2Dto, ClusterListItemV2Dto, ClusterParametersV2Dto, CursorPage, ListClustersV2Params } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ClusterActivityV2Response, ClusterByClientV2Dto, ClusterDetailV2Dto, ClusterFacetsV2Dto, ClusterListItemV2Dto, ClusterLiveStateV2Dto, ClusterParametersV2Dto, CursorPage, ListClustersV2Params } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
export interface ListClustersV2Request extends RequestBaseParams {
|
|
4
4
|
params?: ListClustersV2Params;
|
|
@@ -41,11 +41,19 @@ export declare class ConsoleClusterV2Service {
|
|
|
41
41
|
*/
|
|
42
42
|
static exportCsv(params: ListClustersV2Request): Promise<string>;
|
|
43
43
|
static getParameters(params: GetClusterParametersV2Request): Promise<ClusterParametersV2Dto>;
|
|
44
|
+
/**
|
|
45
|
+
* The fleet from the watcher memory of console-backend
|
|
46
|
+
* (`GET /v2/clusters/live-state`). The route reads no database, thus a
|
|
47
|
+
* client can poll it every second. The route sends `Cache-Control:
|
|
48
|
+
* no-cache` and an ETag, thus the browser revalidates and gets a 304 when
|
|
49
|
+
* the fleet did not change.
|
|
50
|
+
*/
|
|
51
|
+
static getClusterLiveState(params: RequestBaseParams): Promise<ClusterLiveStateV2Dto>;
|
|
44
52
|
/**
|
|
45
53
|
* Fleet activity map with tile counts (`GET /v2/clusters/activity`). One
|
|
46
54
|
* global read. The source is HDP, an external system, and the backend holds
|
|
47
|
-
* the assembled response in Redis for one hour
|
|
48
|
-
*
|
|
55
|
+
* the assembled response in Redis for one hour, thus a page can call this on
|
|
56
|
+
* load.
|
|
49
57
|
*/
|
|
50
58
|
static getClusterActivity(params: RequestBaseParams): Promise<ClusterActivityV2Response>;
|
|
51
59
|
}
|
|
@@ -240,11 +240,46 @@ class ConsoleClusterV2Service {
|
|
|
240
240
|
}
|
|
241
241
|
return response.body;
|
|
242
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* The fleet from the watcher memory of console-backend
|
|
245
|
+
* (`GET /v2/clusters/live-state`). The route reads no database, thus a
|
|
246
|
+
* client can poll it every second. The route sends `Cache-Control:
|
|
247
|
+
* no-cache` and an ETag, thus the browser revalidates and gets a 304 when
|
|
248
|
+
* the fleet did not change.
|
|
249
|
+
*/
|
|
250
|
+
static async getClusterLiveState(params) {
|
|
251
|
+
const serviceContext = {
|
|
252
|
+
method: {
|
|
253
|
+
name: "ConsoleClusterV2Service.getClusterLiveState",
|
|
254
|
+
url: "v2/clusters/live-state",
|
|
255
|
+
normalizedUrl: "v2/clusters/live-state",
|
|
256
|
+
type: "get"
|
|
257
|
+
},
|
|
258
|
+
source: params.config.metrics?.source || "unset",
|
|
259
|
+
target: { name: "console", type: "internal" }
|
|
260
|
+
};
|
|
261
|
+
const response = await request({
|
|
262
|
+
...params,
|
|
263
|
+
base: { id: "console" },
|
|
264
|
+
url: serviceContext.method.url,
|
|
265
|
+
method: serviceContext.method.type,
|
|
266
|
+
metricsDetails: serviceContext,
|
|
267
|
+
responseType: "json"
|
|
268
|
+
});
|
|
269
|
+
if (!response.ok || !response.body) {
|
|
270
|
+
throw new HttpError(
|
|
271
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
272
|
+
response.status,
|
|
273
|
+
response.statusText
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
return response.body;
|
|
277
|
+
}
|
|
243
278
|
/**
|
|
244
279
|
* Fleet activity map with tile counts (`GET /v2/clusters/activity`). One
|
|
245
280
|
* global read. The source is HDP, an external system, and the backend holds
|
|
246
|
-
* the assembled response in Redis for one hour
|
|
247
|
-
*
|
|
281
|
+
* the assembled response in Redis for one hour, thus a page can call this on
|
|
282
|
+
* load.
|
|
248
283
|
*/
|
|
249
284
|
static async getClusterActivity(params) {
|
|
250
285
|
const serviceContext = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/console/console.cluster.v2.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 ClusterActivityV2Response,\n ClusterByClientV2Dto,\n ClusterDetailV2Dto,\n ClusterFacetsV2Dto,\n ClusterListItemV2Dto,\n ClusterParametersV2Dto,\n CursorPage,\n ListClustersV2Params,\n} 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'\nimport { toQueryString } from '../../utils/query.js'\n\nexport interface ListClustersV2Request extends RequestBaseParams {\n params?: ListClustersV2Params\n}\n\n/**\n * `orgIds` and `ids` can each be thousands of uuids (prefilter-clusters-by-orgs,\n * fleet query); a comma-list that long overflows the GET request line (~HTTP\n * 431/414). So `listClusters` and `exportCsv` are POSTs: each large list rides\n * in the JSON body, only when present, while every other (small) filter stays\n * in the query string, keeping the backend's existing query parsing.\n */\nfunction splitBodyLists(params: ListClustersV2Params | undefined): {\n query: string\n body: { orgIds?: string[]; ids?: string[] } | undefined\n} {\n const orgIds = params?.filter?.orgIds\n const ids = params?.filter?.ids\n const hasOrgIds = !!orgIds && orgIds.length > 0\n const hasIds = !!ids && ids.length > 0\n if (!hasOrgIds && !hasIds) {\n return { query: toQueryString(params), body: undefined }\n }\n const {\n orgIds: _omitOrgIds,\n ids: _omitIds,\n ...restFilter\n } = params?.filter ?? {}\n const body: { orgIds?: string[]; ids?: string[] } = {}\n if (hasOrgIds) {\n body.orgIds = orgIds\n }\n if (hasIds) {\n body.ids = ids\n }\n return {\n query: toQueryString({ ...params, filter: restFilter }),\n body,\n }\n}\n\nexport interface ListOrgClustersV2Request extends RequestBaseParams {\n params: { orgId: string } & ListClustersV2Params\n}\n\nexport interface GetClusterV2Request extends RequestBaseParams {\n params: { clusterId: string }\n}\n\nexport type GetClusterParametersV2Request = RequestBaseParams\n\n/**\n * Console-backend `/v2` read endpoints for the Control frontend.\n * Reads only \u2014 mutations stay on the existing v1 services (spec Q6).\n */\nexport class ConsoleClusterV2Service {\n public static async listClusters(\n params: ListClustersV2Request,\n ): Promise<CursorPage<ClusterListItemV2Dto>> {\n const { query, body } = splitBodyLists(params.params)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.listClusters',\n url: `v2/clusters${query}`,\n normalizedUrl: 'v2/clusters',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CursorPage<ClusterListItemV2Dto>>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n public static async listOrgClusters(\n params: ListOrgClustersV2Request,\n ): Promise<CursorPage<ClusterListItemV2Dto>> {\n const { orgId, ...rest } = params.params\n const query = toQueryString(rest)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.listOrgClusters',\n url: `v2/orgs/${encodeURIComponent(orgId)}/clusters${query}`,\n normalizedUrl: 'v2/orgs/:orgId/clusters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CursorPage<ClusterListItemV2Dto>>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n public static async getCluster(\n params: GetClusterV2Request,\n ): Promise<ClusterDetailV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getCluster',\n url: `v2/clusters/${encodeURIComponent(params.params.clusterId)}`,\n normalizedUrl: 'v2/clusters/:clusterId',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterDetailV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /** Aggregated distribution counts for the list page (GET /v2/clusters/facets). */\n public static async getFacets(\n params: RequestBaseParams,\n ): Promise<ClusterFacetsV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getFacets',\n url: 'v2/clusters/facets',\n normalizedUrl: 'v2/clusters/facets',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterFacetsV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * Resolve Zeebe client-id fragments (min 6 chars) to cluster + owning org\n * (GET /v2/clusters/by-client). Backs the cross-backend org search.\n */\n public static async findByClient(\n params: { params: { q: string } } & RequestBaseParams,\n ): Promise<ClusterByClientV2Dto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.findByClient',\n url: `v2/clusters/by-client?q=${encodeURIComponent(params.params.q)}`,\n normalizedUrl: 'v2/clusters/by-client',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterByClientV2Dto[]>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n return response.body ?? []\n }\n\n /**\n * Filtered cluster CSV export (POST /v2/clusters/export). Same filter params\n * as `listClusters` (`orgIds` and `ids` in the body, the rest in the query\n * string); the backend walks the cursor server-side and returns the whole\n * CSV as text.\n */\n public static async exportCsv(\n params: ListClustersV2Request,\n ): Promise<string> {\n const { query, body } = splitBodyLists(params.params)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.exportCsv',\n url: `v2/clusters/export${query}`,\n normalizedUrl: 'v2/clusters/export',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<string>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n responseType: 'text',\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\n return response.body\n }\n\n public static async getParameters(\n params: GetClusterParametersV2Request,\n ): Promise<ClusterParametersV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getParameters',\n url: 'v2/clusters/parameters',\n normalizedUrl: 'v2/clusters/parameters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterParametersV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * Fleet activity map with tile counts (`GET /v2/clusters/activity`). One\n * global read. The source is HDP, an external system, and the backend holds\n * the assembled response in Redis for one hour. Call this on a user action,\n * not on page load.\n */\n public static async getClusterActivity(\n params: RequestBaseParams,\n ): Promise<ClusterActivityV2Response> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getClusterActivity',\n url: 'v2/clusters/activity',\n normalizedUrl: 'v2/clusters/activity',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterActivityV2Response>({\n ...params,\n base: { id: 'console' },\n responseType: 'json',\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok || !response.body) {\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"],
|
|
5
|
-
"mappings": "
|
|
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 ClusterActivityV2Response,\n ClusterByClientV2Dto,\n ClusterDetailV2Dto,\n ClusterFacetsV2Dto,\n ClusterListItemV2Dto,\n ClusterLiveStateV2Dto,\n ClusterParametersV2Dto,\n CursorPage,\n ListClustersV2Params,\n} 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'\nimport { toQueryString } from '../../utils/query.js'\n\nexport interface ListClustersV2Request extends RequestBaseParams {\n params?: ListClustersV2Params\n}\n\n/**\n * `orgIds` and `ids` can each be thousands of uuids (prefilter-clusters-by-orgs,\n * fleet query); a comma-list that long overflows the GET request line (~HTTP\n * 431/414). So `listClusters` and `exportCsv` are POSTs: each large list rides\n * in the JSON body, only when present, while every other (small) filter stays\n * in the query string, keeping the backend's existing query parsing.\n */\nfunction splitBodyLists(params: ListClustersV2Params | undefined): {\n query: string\n body: { orgIds?: string[]; ids?: string[] } | undefined\n} {\n const orgIds = params?.filter?.orgIds\n const ids = params?.filter?.ids\n const hasOrgIds = !!orgIds && orgIds.length > 0\n const hasIds = !!ids && ids.length > 0\n if (!hasOrgIds && !hasIds) {\n return { query: toQueryString(params), body: undefined }\n }\n const {\n orgIds: _omitOrgIds,\n ids: _omitIds,\n ...restFilter\n } = params?.filter ?? {}\n const body: { orgIds?: string[]; ids?: string[] } = {}\n if (hasOrgIds) {\n body.orgIds = orgIds\n }\n if (hasIds) {\n body.ids = ids\n }\n return {\n query: toQueryString({ ...params, filter: restFilter }),\n body,\n }\n}\n\nexport interface ListOrgClustersV2Request extends RequestBaseParams {\n params: { orgId: string } & ListClustersV2Params\n}\n\nexport interface GetClusterV2Request extends RequestBaseParams {\n params: { clusterId: string }\n}\n\nexport type GetClusterParametersV2Request = RequestBaseParams\n\n/**\n * Console-backend `/v2` read endpoints for the Control frontend.\n * Reads only \u2014 mutations stay on the existing v1 services (spec Q6).\n */\nexport class ConsoleClusterV2Service {\n public static async listClusters(\n params: ListClustersV2Request,\n ): Promise<CursorPage<ClusterListItemV2Dto>> {\n const { query, body } = splitBodyLists(params.params)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.listClusters',\n url: `v2/clusters${query}`,\n normalizedUrl: 'v2/clusters',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CursorPage<ClusterListItemV2Dto>>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n public static async listOrgClusters(\n params: ListOrgClustersV2Request,\n ): Promise<CursorPage<ClusterListItemV2Dto>> {\n const { orgId, ...rest } = params.params\n const query = toQueryString(rest)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.listOrgClusters',\n url: `v2/orgs/${encodeURIComponent(orgId)}/clusters${query}`,\n normalizedUrl: 'v2/orgs/:orgId/clusters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<CursorPage<ClusterListItemV2Dto>>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n public static async getCluster(\n params: GetClusterV2Request,\n ): Promise<ClusterDetailV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getCluster',\n url: `v2/clusters/${encodeURIComponent(params.params.clusterId)}`,\n normalizedUrl: 'v2/clusters/:clusterId',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterDetailV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /** Aggregated distribution counts for the list page (GET /v2/clusters/facets). */\n public static async getFacets(\n params: RequestBaseParams,\n ): Promise<ClusterFacetsV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getFacets',\n url: 'v2/clusters/facets',\n normalizedUrl: 'v2/clusters/facets',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterFacetsV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * Resolve Zeebe client-id fragments (min 6 chars) to cluster + owning org\n * (GET /v2/clusters/by-client). Backs the cross-backend org search.\n */\n public static async findByClient(\n params: { params: { q: string } } & RequestBaseParams,\n ): Promise<ClusterByClientV2Dto[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.findByClient',\n url: `v2/clusters/by-client?q=${encodeURIComponent(params.params.q)}`,\n normalizedUrl: 'v2/clusters/by-client',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterByClientV2Dto[]>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: '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\n return response.body ?? []\n }\n\n /**\n * Filtered cluster CSV export (POST /v2/clusters/export). Same filter params\n * as `listClusters` (`orgIds` and `ids` in the body, the rest in the query\n * string); the backend walks the cursor server-side and returns the whole\n * CSV as text.\n */\n public static async exportCsv(\n params: ListClustersV2Request,\n ): Promise<string> {\n const { query, body } = splitBodyLists(params.params)\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.exportCsv',\n url: `v2/clusters/export${query}`,\n normalizedUrl: 'v2/clusters/export',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<string>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body,\n responseType: 'text',\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\n return response.body\n }\n\n public static async getParameters(\n params: GetClusterParametersV2Request,\n ): Promise<ClusterParametersV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getParameters',\n url: 'v2/clusters/parameters',\n normalizedUrl: 'v2/clusters/parameters',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterParametersV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * The fleet from the watcher memory of console-backend\n * (`GET /v2/clusters/live-state`). The route reads no database, thus a\n * client can poll it every second. The route sends `Cache-Control:\n * no-cache` and an ETag, thus the browser revalidates and gets a 304 when\n * the fleet did not change.\n */\n public static async getClusterLiveState(\n params: RequestBaseParams,\n ): Promise<ClusterLiveStateV2Dto> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getClusterLiveState',\n url: 'v2/clusters/live-state',\n normalizedUrl: 'v2/clusters/live-state',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterLiveStateV2Dto>({\n ...params,\n base: { id: 'console' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\n if (!response.ok || !response.body) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n\n return response.body\n }\n\n /**\n * Fleet activity map with tile counts (`GET /v2/clusters/activity`). One\n * global read. The source is HDP, an external system, and the backend holds\n * the assembled response in Redis for one hour, thus a page can call this on\n * load.\n */\n public static async getClusterActivity(\n params: RequestBaseParams,\n ): Promise<ClusterActivityV2Response> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'ConsoleClusterV2Service.getClusterActivity',\n url: 'v2/clusters/activity',\n normalizedUrl: 'v2/clusters/activity',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'console', type: 'internal' },\n }\n\n const response = await request<ClusterActivityV2Response>({\n ...params,\n base: { id: 'console' },\n responseType: 'json',\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok || !response.body) {\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"],
|
|
5
|
+
"mappings": "AAqBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAa9B,SAAS,eAAe,QAGtB;AACA,QAAM,SAAS,QAAQ,QAAQ;AAC/B,QAAM,MAAM,QAAQ,QAAQ;AAC5B,QAAM,YAAY,CAAC,CAAC,UAAU,OAAO,SAAS;AAC9C,QAAM,SAAS,CAAC,CAAC,OAAO,IAAI,SAAS;AACrC,MAAI,CAAC,aAAa,CAAC,QAAQ;AACzB,WAAO,EAAE,OAAO,cAAc,MAAM,GAAG,MAAM,OAAU;AAAA,EACzD;AACA,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,GA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AA,MACX;AAAA,IACF;AAEA,WAAO,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAoB,mBAClB,QACoC;AACpC,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK;AAAA,QACL,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,WAAW,MAAM,WAAW;AAAA,IAC9C;AAEA,UAAM,WAAW,MAAM,QAAmC;AAAA,MACxD,GAAG;AAAA,MACH,MAAM,EAAE,IAAI,UAAU;AAAA,MACtB,cAAc;AAAA,MACd,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,IAClB,CAAC;AACD,QAAI,CAAC,SAAS,MAAM,CAAC,SAAS,MAAM;AAClC,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;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { AnnotationDto, AnnotationEntityKind, AnnotationKind, AnnotationLookupDto, AnnotationTagDto, EntityAnnotationsDto } from '@camunda/ccma-shared-types';
|
|
2
|
+
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
|
+
/** What names the entity. Every write and the entity read carry it. */
|
|
4
|
+
export interface AnnotationTargetDto {
|
|
5
|
+
entityKind: AnnotationEntityKind;
|
|
6
|
+
entityId: string;
|
|
7
|
+
/**
|
|
8
|
+
* What the entity is called now. The backend stores it as a COPY, so a
|
|
9
|
+
* search result still reads after the entity is deleted. Send it when the
|
|
10
|
+
* caller knows the name.
|
|
11
|
+
*/
|
|
12
|
+
entityLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GetEntityAnnotationsRequest extends RequestBaseParams {
|
|
15
|
+
params: {
|
|
16
|
+
entityKind: AnnotationEntityKind;
|
|
17
|
+
entityId: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface LookupAnnotationsRequest extends RequestBaseParams {
|
|
21
|
+
params: {
|
|
22
|
+
entityKind: AnnotationEntityKind;
|
|
23
|
+
entityIds: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface AddAnnotationNoteRequest extends RequestBaseParams {
|
|
27
|
+
params: AnnotationTargetDto & {
|
|
28
|
+
body: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface EditAnnotationNoteRequest extends RequestBaseParams {
|
|
32
|
+
params: {
|
|
33
|
+
id: string;
|
|
34
|
+
body: string;
|
|
35
|
+
/**
|
|
36
|
+
* The `version` of the note that the caller read.
|
|
37
|
+
*
|
|
38
|
+
* The backend writes only while the row still carries it, and answers 409
|
|
39
|
+
* when it does not. Send what came with the note you are editing, never a
|
|
40
|
+
* number of your own: it is what stops a stale tab from replacing an edit
|
|
41
|
+
* that landed after it was opened.
|
|
42
|
+
*/
|
|
43
|
+
version: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface AnnotationIdRequest extends RequestBaseParams {
|
|
47
|
+
params: {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface AddAnnotationTagRequest extends RequestBaseParams {
|
|
52
|
+
params: AnnotationTargetDto & {
|
|
53
|
+
tag: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface ListAnnotationTagsRequest extends RequestBaseParams {
|
|
57
|
+
params?: {
|
|
58
|
+
q?: string;
|
|
59
|
+
limit?: number;
|
|
60
|
+
offset?: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface SearchAnnotationsRequest extends RequestBaseParams {
|
|
64
|
+
params?: {
|
|
65
|
+
kind?: AnnotationKind;
|
|
66
|
+
entityKind?: AnnotationEntityKind;
|
|
67
|
+
tag?: string;
|
|
68
|
+
q?: string;
|
|
69
|
+
limit?: number;
|
|
70
|
+
offset?: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** One page of a read, and whether the table holds more of it. */
|
|
74
|
+
export interface AnnotationPageInfoDto {
|
|
75
|
+
limit: number;
|
|
76
|
+
offset: number;
|
|
77
|
+
/** True when the next page holds more. Never read the length instead. */
|
|
78
|
+
hasMore: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface AnnotationPageDto {
|
|
81
|
+
annotations: AnnotationDto[];
|
|
82
|
+
page: AnnotationPageInfoDto;
|
|
83
|
+
}
|
|
84
|
+
export interface AnnotationTagPageDto {
|
|
85
|
+
tags: AnnotationTagDto[];
|
|
86
|
+
page: AnnotationPageInfoDto;
|
|
87
|
+
}
|
|
88
|
+
export declare class ControlAnnotationsService {
|
|
89
|
+
/**
|
|
90
|
+
* Every live note and tag of one entity.
|
|
91
|
+
*
|
|
92
|
+
* An entity that carries nothing answers with two empty lists, and never
|
|
93
|
+
* 404. The call also answers for an entity that the fleet no longer holds,
|
|
94
|
+
* which is what keeps a link out of a search result working.
|
|
95
|
+
*/
|
|
96
|
+
static forEntity(params: GetEntityAnnotationsRequest): Promise<EntityAnnotationsDto>;
|
|
97
|
+
/**
|
|
98
|
+
* The tags, the note count and the newest note of many entities.
|
|
99
|
+
*
|
|
100
|
+
* A POST, because thousands of ids do not fit a request line. The answer
|
|
101
|
+
* holds only the entities that carry something.
|
|
102
|
+
*/
|
|
103
|
+
static lookup(params: LookupAnnotationsRequest): Promise<AnnotationLookupDto>;
|
|
104
|
+
/** Writes a note on an entity. Any signed-in Camundi can. */
|
|
105
|
+
static addNote(params: AddAnnotationNoteRequest): Promise<AnnotationDto>;
|
|
106
|
+
/** Changes the text of a note. Only the person who wrote it can. */
|
|
107
|
+
static editNote(params: EditAnnotationNoteRequest): Promise<AnnotationDto>;
|
|
108
|
+
/**
|
|
109
|
+
* Takes a note or a tag off an entity.
|
|
110
|
+
*
|
|
111
|
+
* The row stays: the removal is a soft delete, so who wrote it and who took
|
|
112
|
+
* it off both stay readable. A note can only be removed by its author; a tag
|
|
113
|
+
* can be removed by anybody.
|
|
114
|
+
*/
|
|
115
|
+
static remove(params: AnnotationIdRequest): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Attaches a tag to an entity, and adds it to the dictionary when it is new.
|
|
118
|
+
*
|
|
119
|
+
* The name is normalized by the backend, so `Partner` and `partner` reach
|
|
120
|
+
* one tag. A second attach of one tag on one entity answers 409.
|
|
121
|
+
*/
|
|
122
|
+
static addTag(params: AddAnnotationTagRequest): Promise<AnnotationDto>;
|
|
123
|
+
/**
|
|
124
|
+
* The tag dictionary, with the live entities of each tag counted, most used
|
|
125
|
+
* first.
|
|
126
|
+
*
|
|
127
|
+
* The autocomplete of the tag field reads this. It is what stops one idea
|
|
128
|
+
* from becoming three spellings.
|
|
129
|
+
*
|
|
130
|
+
* It answers one PAGE, because the dictionary only grows. Read `page.hasMore`
|
|
131
|
+
* to learn whether another follows.
|
|
132
|
+
*/
|
|
133
|
+
static listTags(params: ListAnnotationTagsRequest): Promise<AnnotationTagPageDto>;
|
|
134
|
+
/**
|
|
135
|
+
* One page of the annotations that match, newest first.
|
|
136
|
+
*
|
|
137
|
+
* The answer holds annotations of entities that no longer exist, which is
|
|
138
|
+
* the point: the note about a deleted cluster is often the only record of
|
|
139
|
+
* why it was there.
|
|
140
|
+
*/
|
|
141
|
+
static search(params: SearchAnnotationsRequest): Promise<AnnotationPageDto>;
|
|
142
|
+
/**
|
|
143
|
+
* The shared half of every call above.
|
|
144
|
+
*
|
|
145
|
+
* Seven routes differ only in the verb, the path and the body. One private
|
|
146
|
+
* helper keeps the metrics context and the status check in one place.
|
|
147
|
+
*/
|
|
148
|
+
private static send;
|
|
149
|
+
}
|