@camunda/ccma-api 5.3.0 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { AlertSubscriptionDto, BackupDto, BackupScheduleDto, ByomClientDto, ByomStatus, ClusterBulkOperationAck, ClusterBulkOperationDto, ClusterBulkOperationPostContent, ClusterModificationConfigDto, ClusterModificationDto, ClusterPlanTypeDto, ClusterTtlDto, ClusterUsageMetricsData, ConsoleClusterDto, UniqueTaskUser, UpdateClusterTtlBody, ValueMetrics } from '@camunda/ccma-shared-types';
1
+ import type { AlertSubscriptionDto, BackupDto, BackupScheduleDto, ByomClientDto, ByomStatus, ClusterBulkOperationAck, ClusterBulkOperationDto, ClusterBulkOperationPostContent, ClusterModificationConfigDto, ClusterModificationDto, ClusterPlanTypeDto, ClusterTtlDto, ClusterUsageMetadataDto, ClusterUsageMetricsData, ConsoleClusterDto, UniqueTaskUser, UpdateClusterTtlBody, ValueMetrics } from '@camunda/ccma-shared-types';
2
2
  import type { RequestBaseParams } from '../../types/general.types.js';
3
3
  import type { OpenIncident } from '../incident-io/incident-io.service.js';
4
4
  import type { ConsoleClusterClientDto } from './console.cluster-clients.service.js';
@@ -219,6 +219,18 @@ export interface GetValueMetricsUsageDataRequest extends RequestBaseParams {
219
219
  };
220
220
  };
221
221
  }
222
+ export interface GetValueMetricsUsageDataPerDayRequest extends RequestBaseParams {
223
+ params: {
224
+ orgId: string;
225
+ /** How many days back from now the read covers. */
226
+ days: number;
227
+ };
228
+ }
229
+ export interface GetValueMetricsMetadataRequest extends RequestBaseParams {
230
+ params: {
231
+ orgId: string;
232
+ };
233
+ }
222
234
  export interface GetValueMetricsRequest extends RequestBaseParams {
223
235
  params: {
224
236
  orgId: string;
@@ -373,6 +385,22 @@ export declare class ConsoleAdminService {
373
385
  static getClusterPlanType(params: GetClusterPlanTypeRequest): Promise<ClusterPlanTypeDto>;
374
386
  static getAllClusterPlanTypes(params: GetAllClusterPlanTypesRequest): Promise<ClusterPlanTypeDto[]>;
375
387
  static getValueMetricsUsageData(params: GetValueMetricsUsageDataRequest): Promise<ClusterUsageMetricsData[]>;
388
+ /**
389
+ * The value metrics that console counted itself, one row for each cluster
390
+ * and day of the last `days` days
391
+ * (`GET api/orgs/:orgId/clusters/usage/value-metrics/:days`).
392
+ *
393
+ * This is the source that HDP replaced for a 2025 organization. The
394
+ * comparison of the two sources reads it on purpose, so it never reads HDP
395
+ * under this name: a comparison of a series with itself shows nothing.
396
+ */
397
+ static getValueMetricsUsageDataPerDay(params: GetValueMetricsUsageDataPerDayRequest): Promise<ClusterUsageMetricsData[]>;
398
+ /**
399
+ * The usage metadata of an organization: the unique task users and the
400
+ * deployed models for each billing period
401
+ * (`GET api/orgs/:orgId/clusters/usage/value-metrics-metadata`).
402
+ */
403
+ static getValueMetricsMetadata(params: GetValueMetricsMetadataRequest): Promise<ClusterUsageMetadataDto[]>;
376
404
  static getValueMetrics(params: GetValueMetricsRequest): Promise<ValueMetrics | undefined>;
377
405
  static getValueMetricsForAll(params: GetValueMetricsForAllRequest): Promise<ValueMetrics[]>;
378
406
  static getTaskUsers(params: GetTaskUsersRequest): Promise<UniqueTaskUser[]>;
@@ -645,6 +645,84 @@ class ConsoleAdminService {
645
645
  }
646
646
  return response.body;
647
647
  }
648
+ /**
649
+ * The value metrics that console counted itself, one row for each cluster
650
+ * and day of the last `days` days
651
+ * (`GET api/orgs/:orgId/clusters/usage/value-metrics/:days`).
652
+ *
653
+ * This is the source that HDP replaced for a 2025 organization. The
654
+ * comparison of the two sources reads it on purpose, so it never reads HDP
655
+ * under this name: a comparison of a series with itself shows nothing.
656
+ */
657
+ static async getValueMetricsUsageDataPerDay(params) {
658
+ const serviceContext = {
659
+ method: {
660
+ name: `ConsoleAdminService.getValueMetricsUsageDataPerDay`,
661
+ url: `api/orgs/${params.params.orgId}/clusters/usage/value-metrics/${params.params.days}`,
662
+ normalizedUrl: `api/orgs/:orgId/clusters/usage/value-metrics/:days`,
663
+ type: "get"
664
+ },
665
+ source: params.config.metrics?.source || "unset",
666
+ target: {
667
+ name: "console",
668
+ type: "internal"
669
+ }
670
+ };
671
+ const response = await request({
672
+ config: params.config,
673
+ base: {
674
+ id: "console"
675
+ },
676
+ url: serviceContext.method.url,
677
+ method: serviceContext.method.type,
678
+ metricsDetails: serviceContext
679
+ });
680
+ if (!response.ok) {
681
+ throw new HttpError(
682
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
683
+ response.status,
684
+ response.statusText
685
+ );
686
+ }
687
+ return response.body ?? [];
688
+ }
689
+ /**
690
+ * The usage metadata of an organization: the unique task users and the
691
+ * deployed models for each billing period
692
+ * (`GET api/orgs/:orgId/clusters/usage/value-metrics-metadata`).
693
+ */
694
+ static async getValueMetricsMetadata(params) {
695
+ const serviceContext = {
696
+ method: {
697
+ name: `ConsoleAdminService.getValueMetricsMetadata`,
698
+ url: `api/orgs/${params.params.orgId}/clusters/usage/value-metrics-metadata`,
699
+ normalizedUrl: `api/orgs/:orgId/clusters/usage/value-metrics-metadata`,
700
+ type: "get"
701
+ },
702
+ source: params.config.metrics?.source || "unset",
703
+ target: {
704
+ name: "console",
705
+ type: "internal"
706
+ }
707
+ };
708
+ const response = await request({
709
+ config: params.config,
710
+ base: {
711
+ id: "console"
712
+ },
713
+ url: serviceContext.method.url,
714
+ method: serviceContext.method.type,
715
+ metricsDetails: serviceContext
716
+ });
717
+ if (!response.ok) {
718
+ throw new HttpError(
719
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
720
+ response.status,
721
+ response.statusText
722
+ );
723
+ }
724
+ return response.body?.metadata ?? [];
725
+ }
648
726
  static async getValueMetrics(params) {
649
727
  const serviceContext = {
650
728
  method: {