@camunda/ccma-api 7.6.0 → 7.8.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 +4 -2
- package/dist/index.js +2 -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 +33 -0
- package/dist/services/accounts/approvals.m2m.service.js.map +2 -2
- package/dist/services/accounts/hdp.service.d.ts +11 -1
- package/dist/services/accounts/hdp.service.js +14 -1
- package/dist/services/accounts/hdp.service.js.map +2 -2
- package/dist/services/accounts/logs.service.d.ts +8 -1
- package/dist/services/accounts/logs.service.js +34 -0
- package/dist/services/accounts/logs.service.js.map +2 -2
- package/dist/services/control/control.approvals.service.d.ts +35 -0
- package/dist/services/control/control.approvals.service.js +15 -0
- package/dist/services/control/control.approvals.service.js.map +2 -2
- package/dist/services/control/control.fleet-stats.service.d.ts +20 -0
- package/dist/services/control/control.fleet-stats.service.js +43 -0
- package/dist/services/control/control.fleet-stats.service.js.map +7 -0
- package/dist/services/control/control.fleet-stats.service.spec.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/accounts/approvals.m2m.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 ActivityRetentionMonths,\n ApprovalM2mActor,\n ApprovalOrganizationNameResult,\n EnterpriseIncludingValueMetrics,\n LicensingModelType,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseParamsConfig,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\nimport type {\n AutomatedEnterpriseOnboardingRequest,\n AutomatedEnterpriseOnboardingResult,\n} from './orgs.service.js'\n\n/**\n * The routes of `api/admin/approvals` in accounts-backend.\n *\n * control-backend calls these when a four-eyes request holds the approvals\n * that it needs. They are separate from `OrgsService`, because they are a\n * separate surface: each one carries its own m2m permission, and each one\n * takes the actor envelope that names the Camundis. The routes that a browser\n * calls today go away, and this service does not go with them.\n */\n\nexport interface ExtendTrialThroughApprovalRequest extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /** An ISO timestamp, between 14 and 62 days from when the call ARRIVES. */\n newExpireDate: string\n }\n}\n\nexport interface SendToExpiredTrialThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface ChangePlatformRolesThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /** A CHANGE over the roles that the user holds when the call arrives. */\n rolesToAdd: string[]\n rolesToRemove: string[]\n }\n}\n\n/** What accounts answers for a role change: the roles after it. */\nexport interface ChangePlatformRolesThroughApprovalResult {\n userId: string\n roles: string[]\n rolesAdded: string[]\n rolesRemoved: string[]\n}\n\n/** A value of an org limit. `null` clears the override. */\nexport type OrgLimitValue = string | number | boolean | null\n\nexport interface ChangeOrgLimitThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; limitKey: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The override that the person who asked read. Absent for \"not set\".\n * Accounts answers 409 and writes nothing when the override moved since.\n */\n expected?: OrgLimitValue\n value: OrgLimitValue\n }\n}\n\n/**\n * The terms of an enterprise contract that one change writes. A field that\n * is absent stays as it is.\n */\nexport interface EnterpriseContractTerms {\n contractDurationInMonths?: number\n /** The start of the contract, as `YYYY-MM-DD`. */\n startDate?: string\n valueMetrics?: Partial<EnterpriseIncludingValueMetrics>\n}\n\nexport interface ChangeEnterpriseContractThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /** The new values. Accounts writes only the fields that this holds. */\n change: EnterpriseContractTerms\n /**\n * The values that the person who asked read, for the fields of\n * `change`. Absent for \"not set\". Accounts answers 409 and writes\n * nothing when one of them moved since.\n */\n expected: EnterpriseContractTerms\n }\n}\n\nexport interface LlmBudgetTopUpThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The budget that the person who asked read. Accounts answers 409 and\n * changes nothing when the budget moved since.\n */\n expectedBudget: number\n /**\n * True when the person who asked confirmed a top-up below\n * `LLM_BUDGET_TOP_UP_THRESHOLD`. Without it, accounts answers 400 for\n * such a top-up.\n */\n belowThreshold: boolean\n }\n}\n\n/** What accounts answers for a top-up of the budget of a managed LLM key. */\nexport interface LlmBudgetTopUpThroughApprovalResult {\n orgId: string\n previousBudget: number\n newBudget: number\n /** The spend when the top-up ran. */\n spend: number\n}\n\nexport interface DeleteManagedLlmTenantThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The `metadata.llm.created` of the tenant that the person who asked\n * read, in epoch milliseconds. Accounts answers 409 and deletes nothing\n * when the organization has another tenant now.\n */\n expectedTenantCreatedAt: number\n }\n}\n\n/** What accounts answers for a deletion of a managed LLM tenant. */\nexport interface DeleteManagedLlmTenantThroughApprovalResult {\n orgId: string\n /**\n * Always true. When the upstream does not confirm the delete, accounts\n * answers 503 and keeps the metadata. The key or the team can already be\n * gone, and a new request deletes the rest.\n */\n deleted: true\n}\n\nexport interface DeleteSsoConnectionThroughApprovalRequest\n extends RequestBaseParams {\n params: { strategy: 'waad' | 'samlp'; connectionId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The name of the connection that the approvers read. Accounts refuses\n * the deletion when the connection has another name.\n */\n connectionName?: string\n }\n}\n\n/** What accounts answers for a deleted connection. */\nexport interface DeleteSsoConnectionThroughApprovalResult {\n connectionId: string\n connectionName: string\n /** The users who signed in with the connection. Accounts deleted them too. */\n deletedUsers: number\n}\n\n/** One cluster of the organization and the plan type it moves to. */\nexport interface OnboardToEnterpriseClusterMapping {\n clusterId: string\n planTypeId: string\n numberOfAllocatedHwPackages?: number\n keepModification: boolean\n}\n\n/** The contract of the enterprise plan, as the accounts wizard sends it. */\nexport interface OnboardToEnterpriseContract {\n duration: number\n includedValueMetrics: EnterpriseIncludingValueMetrics\n /** `YYYY-MM-DD`. Accounts turns it into a date. */\n enterPriseStartDate: string\n enterpriseDevOnly: boolean\n awsOnly: boolean\n licensingModel: LicensingModelType\n salesForceId?: string\n /** Months of activity history. Accounts sets 60 when this is missing. */\n activityRetentionMonths?: ActivityRetentionMonths\n}\n\nexport interface OnboardToEnterpriseThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n salesPlanId: string\n /** The plan that the person who asked read. Absent for \"no plan\". */\n expectedSalesPlanId?: string\n salesPlanName?: string\n expectedSalesPlanName?: string\n contract: OnboardToEnterpriseContract\n /** One entry for each cluster of the organization. */\n onboardOrgClusterMapping: OnboardToEnterpriseClusterMapping[]\n }\n}\n\nexport interface UpdateReservationsThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The plan the organization must be on. Accounts answers 409 when it is\n * on another one, so the reservations never land on a plan that the\n * approvers did not read.\n */\n expectedSalesPlanId: string\n /** The reservations of the organization, by plan type uuid. */\n clusterPlanTypesToReserved: Record<string, number>\n }\n}\n\nexport interface ChangeSalesPlanThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n salesPlanId: string\n /**\n * The plan that the person who asked read. Absent for \"no plan\". Accounts\n * answers 409 and switches nothing when the plan moved since.\n */\n expectedSalesPlanId?: string\n /**\n * The names of the two plans that the approvers read. Accounts refuses\n * the switch when a plan has another name.\n */\n salesPlanName?: string\n expectedSalesPlanName?: string\n force: boolean\n }\n}\n\n/** The body of `POST api/admin/approvals/organizations/:orgId/in-negotiation`. */\nexport interface RequestInNegotiationThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: Omit<ChangeSalesPlanThroughApprovalRequest['body'], 'force'> & {\n expectedSalesPlanId: string\n }\n}\n\n/** The body of `POST api/admin/approvals/organizations/:orgId/licensing-model`. */\nexport interface ChangeLicensingModelThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n licensingModel: LicensingModelType\n /**\n * The model that the person who asked read. Absent for \"no model set\".\n * Accounts answers 409 and writes nothing when the model moved since.\n */\n expected?: LicensingModelType\n }\n}\n\n/**\n * The body of `POST api/admin/approvals/organizations/enterprise-onboarding`:\n * the fields of `POST external/onboarding`, with the actor envelope.\n */\nexport interface AutomatedEnterpriseOnboardingThroughApprovalRequest\n extends RequestBaseParams {\n body: AutomatedEnterpriseOnboardingRequest & { actor: ApprovalM2mActor }\n}\n\nexport interface DeleteOrganizationThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The name that the approvers read. Accounts refuses the deletion when\n * the organization has another name.\n */\n orgName: string\n }\n}\n\n/** What accounts answers for a deleted organization. */\nexport interface DeleteOrganizationThroughApprovalResult {\n orgId: string\n /** The members that accounts removed before it deleted the organization. */\n removedMembers: number\n}\n\nexport interface CreatePersonalOrganizationThroughApprovalRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n name: string\n }\n}\n\n/** What accounts answers for a new personal organization. */\nexport interface CreatePersonalOrganizationThroughApprovalResult {\n orgId: string\n}\n\nexport interface ChangeClusterPlanLinkThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What accounts answers for a link or an unlink of one organization. */\nexport interface ChangeClusterPlanLinkThroughApprovalResult {\n orgId: string\n clusterPlanId: string\n /** `false` when the list of the organization already was as wanted. */\n changed: boolean\n}\n\nexport interface UnlinkClusterPlanFromMemberOrganizationsRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface UnlinkClusterPlanFromMemberOrganizationsResult {\n /** The organizations whose list held the plan before the call. */\n unlinkedOrgIds: string[]\n}\n\nexport interface ChangeGenerationLinkThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; generationId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What accounts answers for a link or an unlink of one organization. */\nexport interface ChangeGenerationLinkThroughApprovalResult {\n orgId: string\n generationId: string\n /** `false` when the list of the organization already was as wanted. */\n changed: boolean\n}\n\nexport interface UnlinkGenerationFromMemberOrganizationsRequest\n extends RequestBaseParams {\n params: { generationId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface UnlinkGenerationFromMemberOrganizationsResult {\n /** The organizations whose list held the generation before the call. */\n unlinkedOrgIds: string[]\n}\n\nexport interface CheckOrgOwnerRequest extends RequestBaseParams {\n params: { orgId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface DeleteUserThroughApprovalRequest extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The address that the approvers read. When given, accounts refuses the\n * deletion of a user with another address.\n */\n expectedEmail?: string\n /**\n * Accounts answers `deleted: false` for a user that Auth0 does not have,\n * and not 404. A purge sets it.\n */\n skipMissing?: boolean\n /**\n * A purge sets it. The person who asked then needs `GOD_PURGE_USERS` as\n * well as `DELETE_USER`.\n */\n purge?: boolean\n }\n}\n\n/** What accounts answers for a user deletion. */\nexport interface DeleteUserThroughApprovalResult {\n userId: string\n /** `false` when Auth0 had no such user, which only `skipMissing` answers. */\n deleted: boolean\n}\n\n/** A user that a remove-org-member request names. */\nexport interface RemoveOrgMemberNamedUser {\n userId: string\n /** The address that the approvers read. Accounts refuses another one. */\n expectedEmail: string\n}\n\nexport interface RemoveOrgMemberThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; userId: string }\n body: {\n actor: ApprovalM2mActor\n /** The address of the member that the approvers read. */\n expectedEmail: string\n /** A member who becomes an owner before the removal. */\n newOwner?: RemoveOrgMemberNamedUser\n suppressEmail?: boolean\n }\n}\n\n/** What accounts answers for a removal of an org member. */\nexport interface RemoveOrgMemberThroughApprovalResult {\n orgId: string\n userId: string\n wasOwner: boolean\n newOwnerId?: string\n /** `false` when the new owner was an owner already. */\n newOwnerPromoted: boolean\n}\n\nexport interface ChangeUserEmailThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The address that the person who asked read. Accounts answers 409 and\n * changes nothing when the address moved since.\n */\n expectedEmail: string\n newEmail: string\n }\n}\n\nexport interface UpdateUserMetadataThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string; kind: 'app' | 'user' }\n body: {\n actor: ApprovalM2mActor\n /**\n * The metadata that the person who asked read. Absent for \"not set\".\n * Accounts answers 409 and writes nothing when it moved since.\n */\n expected?: Record<string, unknown>\n metadata: Record<string, unknown>\n }\n}\n\nexport class AccountsApprovalsM2MService {\n /**\n * Reads the name that accounts holds for an organization. control-backend\n * calls it when a request opens, so a summary shows this name and not a\n * name that the requester typed.\n */\n public static async readOrganizationName(params: {\n config: RequestBaseParamsConfig\n params: { orgId: string }\n }): Promise<ApprovalOrganizationNameResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.readOrganizationName',\n url: `api/admin/approvals/organizations/${encodeURIComponent(params.params.orgId)}/name`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/name',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<ApprovalOrganizationNameResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\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 public static async extendTrial(\n params: ExtendTrialThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.extendTrial',\n url: `api/admin/approvals/organizations/${params.params.orgId}/extend-trial`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/extend-trial',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 sendToExpiredTrial(\n params: SendToExpiredTrialThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.sendToExpiredTrial',\n url: `api/admin/approvals/organizations/${params.params.orgId}/expire-trial`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/expire-trial',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 changePlatformRoles(\n params: ChangePlatformRolesThroughApprovalRequest,\n ): Promise<ChangePlatformRolesThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changePlatformRoles',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/roles`,\n normalizedUrl: 'api/admin/approvals/users/:userId/roles',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<ChangePlatformRolesThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async changeOrgLimit(\n params: ChangeOrgLimitThroughApprovalRequest,\n ): Promise<void> {\n const { orgId, limitKey } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeOrgLimit',\n url: `api/admin/approvals/organizations/${orgId}/limits/${encodeURIComponent(limitKey)}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/limits/:limitKey',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 topUpLlmBudget(\n params: LlmBudgetTopUpThroughApprovalRequest,\n ): Promise<LlmBudgetTopUpThroughApprovalResult> {\n const { orgId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.topUpLlmBudget',\n url: `api/admin/approvals/organizations/${orgId}/llm-budget/top-up`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/llm-budget/top-up',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<LlmBudgetTopUpThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async deleteManagedLlmTenant(\n params: DeleteManagedLlmTenantThroughApprovalRequest,\n ): Promise<DeleteManagedLlmTenantThroughApprovalResult> {\n const { orgId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteManagedLlmTenant',\n url: `api/admin/approvals/organizations/${orgId}/llm-tenant`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/llm-tenant',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteManagedLlmTenantThroughApprovalResult>(\n {\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n },\n )\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async deleteSsoConnection(\n params: DeleteSsoConnectionThroughApprovalRequest,\n ): Promise<DeleteSsoConnectionThroughApprovalResult> {\n const { strategy, connectionId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteSsoConnection',\n url: `api/admin/approvals/connections/${strategy}/${encodeURIComponent(connectionId)}`,\n normalizedUrl:\n 'api/admin/approvals/connections/:strategy/:connectionId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteSsoConnectionThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Moves an organization to an enterprise plan with its contract and the\n * plan type of each cluster. Accounts answers 409 when the plan moved since\n * `expectedSalesPlanId`, and 400 when a cluster has no mapping.\n */\n public static async onboardToEnterprise(\n params: OnboardToEnterpriseThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.onboardToEnterprise',\n url: `api/admin/approvals/organizations/${params.params.orgId}/enterprise-onboarding`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/enterprise-onboarding',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Changes the term, the start date or the included value metrics of the\n * contract of an enterprise organization. Accounts answers 409 when a value\n * moved since `expected`, and 404 when the organization is not on an\n * enterprise plan.\n */\n public static async changeEnterpriseContract(\n params: ChangeEnterpriseContractThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeEnterpriseContract',\n url: `api/admin/approvals/organizations/${params.params.orgId}/enterprise-contract`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/enterprise-contract',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Sets the reservations of an organization, the second write of the\n * enterprise onboarding. Accounts refuses a count below the clusters on\n * the plan type, and one above the maximum of the sales plan.\n */\n public static async updateReservations(\n params: UpdateReservationsThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.updateReservations',\n url: `api/admin/approvals/organizations/${params.params.orgId}/reservations`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/reservations',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 changeSalesPlan(\n params: ChangeSalesPlanThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeSalesPlan',\n url: `api/admin/approvals/organizations/${params.params.orgId}/sales-plan`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/sales-plan',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Moves a trial organization to an in-negotiation plan, for a Camundi who\n * holds `READ_ALL`.\n */\n public static async requestInNegotiation(\n params: RequestInNegotiationThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.requestInNegotiation',\n url: `api/admin/approvals/organizations/${params.params.orgId}/in-negotiation`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/in-negotiation',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Sets the licensing model of an enterprise organization. Accounts answers\n * 409 when the model moved since `expected`, and 404 when the organization\n * is not on an enterprise plan.\n */\n public static async changeLicensingModel(\n params: ChangeLicensingModelThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeLicensingModel',\n url: `api/admin/approvals/organizations/${params.params.orgId}/licensing-model`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/licensing-model',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Creates a production and a development organization for a new enterprise\n * customer, as `POST external/onboarding` does, and names the Camundi who\n * asked as the person who invited the owner.\n */\n public static async automatedEnterpriseOnboarding(\n params: AutomatedEnterpriseOnboardingThroughApprovalRequest,\n ): Promise<AutomatedEnterpriseOnboardingResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.automatedEnterpriseOnboarding',\n url: 'api/admin/approvals/organizations/enterprise-onboarding',\n normalizedUrl:\n 'api/admin/approvals/organizations/enterprise-onboarding',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<AutomatedEnterpriseOnboardingResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'json',\n // No retry on a 429: accounts answers 429 when the Auth0 lookup of the\n // owner invitation runs out of tries, AFTER it created the two\n // organizations. A second POST would create a second pair.\n retry: { attempts: 1, remaining: 0 },\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 return response.body\n }\n\n public static async deleteOrganization(\n params: DeleteOrganizationThroughApprovalRequest,\n ): Promise<DeleteOrganizationThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteOrganization',\n url: `api/admin/approvals/organizations/${params.params.orgId}`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteOrganizationThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async createPersonalOrganization(\n params: CreatePersonalOrganizationThroughApprovalRequest,\n ): Promise<CreatePersonalOrganizationThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.createPersonalOrganization',\n url: 'api/admin/approvals/organizations/personal',\n normalizedUrl: 'api/admin/approvals/organizations/personal',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response =\n await request<CreatePersonalOrganizationThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Adds a cluster plan to the `clusterPlanWhiteList` of an organization that\n * the requester owns. Safe to run again.\n */\n public static async linkClusterPlan(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeClusterPlanLink(params, 'put')\n }\n\n /**\n * Removes a cluster plan from the `clusterPlanWhiteList` of an organization\n * that the requester owns.\n */\n public static async unlinkClusterPlan(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeClusterPlanLink(params, 'delete')\n }\n\n private static async changeClusterPlanLink(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n type: 'put' | 'delete',\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n const { orgId, clusterPlanId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name:\n type === 'put'\n ? 'AccountsApprovalsM2MService.linkClusterPlan'\n : 'AccountsApprovalsM2MService.unlinkClusterPlan',\n url: `api/admin/approvals/organizations/${orgId}/cluster-plans/${clusterPlanId}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/cluster-plans/:clusterPlanId',\n type,\n body: params.body,\n })\n }\n\n /**\n * Removes a cluster plan from the `clusterPlanWhiteList` of every\n * organization that the requester is a member of.\n */\n public static async unlinkClusterPlanFromMemberOrganizations(\n params: UnlinkClusterPlanFromMemberOrganizationsRequest,\n ): Promise<UnlinkClusterPlanFromMemberOrganizationsResult> {\n const { clusterPlanId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name: 'AccountsApprovalsM2MService.unlinkClusterPlanFromMemberOrganizations',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}/unlink-from-member-organizations`,\n normalizedUrl:\n 'api/admin/approvals/cluster-plans/:clusterPlanId/unlink-from-member-organizations',\n type: 'post',\n body: params.body,\n })\n }\n\n /**\n * Adds a custom generation to the `generationWhiteList` of an organization\n * that the requester owns. Safe to run again.\n */\n public static async linkGeneration(\n params: ChangeGenerationLinkThroughApprovalRequest,\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeGenerationLink(params, 'put')\n }\n\n /**\n * Removes a custom generation from the list of an organization that the\n * requester owns.\n */\n public static async unlinkGeneration(\n params: ChangeGenerationLinkThroughApprovalRequest,\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeGenerationLink(params, 'delete')\n }\n\n private static async changeGenerationLink(\n params: ChangeGenerationLinkThroughApprovalRequest,\n type: 'put' | 'delete',\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n const { orgId, generationId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name:\n type === 'put'\n ? 'AccountsApprovalsM2MService.linkGeneration'\n : 'AccountsApprovalsM2MService.unlinkGeneration',\n url: `api/admin/approvals/organizations/${orgId}/generations/${generationId}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/generations/:generationId',\n type,\n body: params.body,\n })\n }\n\n /**\n * Removes a custom generation from the list of every organization that the\n * requester is a member of.\n */\n public static async unlinkGenerationFromMemberOrganizations(\n params: UnlinkGenerationFromMemberOrganizationsRequest,\n ): Promise<UnlinkGenerationFromMemberOrganizationsResult> {\n const { generationId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name: 'AccountsApprovalsM2MService.unlinkGenerationFromMemberOrganizations',\n url: `api/admin/approvals/generations/${generationId}/unlink-from-member-organizations`,\n normalizedUrl:\n 'api/admin/approvals/generations/:generationId/unlink-from-member-organizations',\n type: 'post',\n body: params.body,\n })\n }\n\n /**\n * Asks whether the requester owns an organization. Accounts answers 204 with\n * no body, and 403 for a requester who is not an owner.\n */\n public static async checkOrgOwner(\n params: CheckOrgOwnerRequest,\n ): Promise<void> {\n const { orgId } = params.params\n await AccountsApprovalsM2MService.callApprovalRoute<void>({\n config: params.config,\n name: 'AccountsApprovalsM2MService.checkOrgOwner',\n url: `api/admin/approvals/organizations/${orgId}/owner-check`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/owner-check',\n type: 'post',\n body: params.body,\n })\n }\n\n /** The shared half of the plan and generation link calls. */\n private static async callApprovalRoute<T>(args: {\n config: RequestBaseParams['config']\n name: string\n url: string\n normalizedUrl: string\n type: 'put' | 'delete' | 'post'\n body: unknown\n }): Promise<T> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: args.name,\n url: args.url,\n normalizedUrl: args.normalizedUrl,\n type: args.type,\n },\n source: args.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<T>({\n config: args.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: args.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 return response.body!\n }\n\n public static async deleteUser(\n params: DeleteUserThroughApprovalRequest,\n ): Promise<DeleteUserThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteUser',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl: 'api/admin/approvals/users/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteUserThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Removes a member from an organization, an owner included. Accounts\n * refuses a removal that leaves the organization with no owner.\n */\n public static async removeOrgMember(\n params: RemoveOrgMemberThroughApprovalRequest,\n ): Promise<RemoveOrgMemberThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.removeOrgMember',\n url: `api/admin/approvals/organizations/${params.params.orgId}/members/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/members/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<RemoveOrgMemberThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\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 return response.body\n }\n\n public static async changeUserEmail(\n params: ChangeUserEmailThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeUserEmail',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/email`,\n normalizedUrl: 'api/admin/approvals/users/:userId/email',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 updateUserMetadata(\n params: UpdateUserMetadataThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.updateUserMetadata',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/metadata/${params.params.kind}`,\n normalizedUrl: 'api/admin/approvals/users/:userId/metadata/:kind',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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"],
|
|
5
|
-
"mappings": "AAkBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAmcnB,MAAM,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,aAAoB,qBAAqB,QAGG;AAC1C,UAAM,iBAA4C;AAAA,MAChD,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,KAAK,qCAAqC,mBAAmB,OAAO,OAAO,KAAK,CAAC;AAAA,QACjF,eAAe;AAAA,QACf,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,OAAO,OAAO,SAAS,UAAU;AAAA,MACzC,QAAQ,EAAE,MAAM,YAAY,MAAM,WAAW;AAAA,IAC/C;AAEA,UAAM,WAAW,MAAM,QAAwC;AAAA,MAC7D,QAAQ,OAAO;AAAA,MACf,MAAM,EAAE,IAAI,WAAW;A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9B,gBAAgB;AAAA,MAChB,MAAM,OAAO;AAAA,MACb,cAAc;AAAA,IAChB,CAAC;AAED,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;",
|
|
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 ActivityRetentionMonths,\n ApprovalM2mActor,\n ApprovalOrganizationNameResult,\n EnterpriseIncludingValueMetrics,\n LicensingModelType,\n} from '@camunda/ccma-shared-types'\nimport type {\n RequestBaseParams,\n RequestBaseParamsConfig,\n RequestBaseServiceContext,\n} from '../../types/general.types.js'\nimport { request } from '../../utils/api.js'\nimport { HttpError } from '../../utils/errors.js'\nimport type {\n AutomatedEnterpriseOnboardingRequest,\n AutomatedEnterpriseOnboardingResult,\n} from './orgs.service.js'\n\n/**\n * The routes of `api/admin/approvals` in accounts-backend.\n *\n * control-backend calls these when a four-eyes request holds the approvals\n * that it needs. They are separate from `OrgsService`, because they are a\n * separate surface: each one carries its own m2m permission, and each one\n * takes the actor envelope that names the Camundis. The routes that a browser\n * calls today go away, and this service does not go with them.\n */\n\nexport interface ExtendTrialThroughApprovalRequest extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /** An ISO timestamp, between 14 and 62 days from when the call ARRIVES. */\n newExpireDate: string\n }\n}\n\nexport interface SendToExpiredTrialThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface ChangePlatformRolesThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /** A CHANGE over the roles that the user holds when the call arrives. */\n rolesToAdd: string[]\n rolesToRemove: string[]\n }\n}\n\n/** What accounts answers for a role change: the roles after it. */\nexport interface ChangePlatformRolesThroughApprovalResult {\n userId: string\n roles: string[]\n rolesAdded: string[]\n rolesRemoved: string[]\n}\n\n/** A value of an org limit. `null` clears the override. */\nexport type OrgLimitValue = string | number | boolean | null\n\nexport interface ChangeOrgLimitThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; limitKey: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The override that the person who asked read. Absent for \"not set\".\n * Accounts answers 409 and writes nothing when the override moved since.\n */\n expected?: OrgLimitValue\n value: OrgLimitValue\n }\n}\n\n/**\n * The terms of an enterprise contract that one change writes. A field that\n * is absent stays as it is.\n */\nexport interface EnterpriseContractTerms {\n contractDurationInMonths?: number\n /** The start of the contract, as `YYYY-MM-DD`. */\n startDate?: string\n valueMetrics?: Partial<EnterpriseIncludingValueMetrics>\n}\n\nexport interface ChangeEnterpriseContractThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /** The new values. Accounts writes only the fields that this holds. */\n change: EnterpriseContractTerms\n /**\n * The values that the person who asked read, for the fields of\n * `change`. Absent for \"not set\". Accounts answers 409 and writes\n * nothing when one of them moved since.\n */\n expected: EnterpriseContractTerms\n }\n}\n\nexport interface LlmBudgetTopUpThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The budget that the person who asked read. Accounts answers 409 and\n * changes nothing when the budget moved since.\n */\n expectedBudget: number\n /**\n * True when the person who asked confirmed a top-up below\n * `LLM_BUDGET_TOP_UP_THRESHOLD`. Without it, accounts answers 400 for\n * such a top-up.\n */\n belowThreshold: boolean\n }\n}\n\n/** What accounts answers for a top-up of the budget of a managed LLM key. */\nexport interface LlmBudgetTopUpThroughApprovalResult {\n orgId: string\n previousBudget: number\n newBudget: number\n /** The spend when the top-up ran. */\n spend: number\n}\n\nexport interface DeleteManagedLlmTenantThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The `metadata.llm.created` of the tenant that the person who asked\n * read, in epoch milliseconds. Accounts answers 409 and deletes nothing\n * when the organization has another tenant now.\n */\n expectedTenantCreatedAt: number\n }\n}\n\n/** What accounts answers for a deletion of a managed LLM tenant. */\nexport interface DeleteManagedLlmTenantThroughApprovalResult {\n orgId: string\n /**\n * Always true. When the upstream does not confirm the delete, accounts\n * answers 503 and keeps the metadata. The key or the team can already be\n * gone, and a new request deletes the rest.\n */\n deleted: true\n}\n\nexport interface DeleteSsoConnectionThroughApprovalRequest\n extends RequestBaseParams {\n params: { strategy: 'waad' | 'samlp'; connectionId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The name of the connection that the approvers read. Accounts refuses\n * the deletion when the connection has another name.\n */\n connectionName?: string\n }\n}\n\n/** What accounts answers for a deleted connection. */\nexport interface DeleteSsoConnectionThroughApprovalResult {\n connectionId: string\n connectionName: string\n /** The users who signed in with the connection. Accounts deleted them too. */\n deletedUsers: number\n}\n\n/** One cluster of the organization and the plan type it moves to. */\nexport interface OnboardToEnterpriseClusterMapping {\n clusterId: string\n planTypeId: string\n numberOfAllocatedHwPackages?: number\n keepModification: boolean\n}\n\n/** The contract of the enterprise plan, as the accounts wizard sends it. */\nexport interface OnboardToEnterpriseContract {\n duration: number\n includedValueMetrics: EnterpriseIncludingValueMetrics\n /** `YYYY-MM-DD`. Accounts turns it into a date. */\n enterPriseStartDate: string\n enterpriseDevOnly: boolean\n awsOnly: boolean\n licensingModel: LicensingModelType\n salesForceId?: string\n /** Months of activity history. Accounts sets 60 when this is missing. */\n activityRetentionMonths?: ActivityRetentionMonths\n}\n\nexport interface OnboardToEnterpriseThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n salesPlanId: string\n /** The plan that the person who asked read. Absent for \"no plan\". */\n expectedSalesPlanId?: string\n salesPlanName?: string\n expectedSalesPlanName?: string\n contract: OnboardToEnterpriseContract\n /** One entry for each cluster of the organization. */\n onboardOrgClusterMapping: OnboardToEnterpriseClusterMapping[]\n }\n}\n\nexport interface UpdateReservationsThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The plan the organization must be on. Accounts answers 409 when it is\n * on another one, so the reservations never land on a plan that the\n * approvers did not read.\n */\n expectedSalesPlanId: string\n /** The reservations of the organization, by plan type uuid. */\n clusterPlanTypesToReserved: Record<string, number>\n }\n}\n\nexport interface ChangeReservationsThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The plan that the person who asked read. Accounts answers 409 when the\n * organization is on another one: the limits of the plan decide what a\n * reservation may be.\n */\n expectedSalesPlanId: string\n /**\n * The reservations that the person who asked read, by plan type uuid.\n * Accounts answers 409 when they changed, and writes nothing.\n */\n expected: Record<string, number>\n /** The new reservations of the organization, by plan type uuid. */\n clusterPlanTypesToReserved: Record<string, number>\n /**\n * Skips the checks of the sales plan, as `PATCH /reserved` does for\n * `admin.modifyClusterPlanTypeReservations`. The person who asked must\n * hold that permission.\n */\n force: boolean\n }\n}\n\nexport interface ChangeSalesPlanThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n salesPlanId: string\n /**\n * The plan that the person who asked read. Absent for \"no plan\". Accounts\n * answers 409 and switches nothing when the plan moved since.\n */\n expectedSalesPlanId?: string\n /**\n * The names of the two plans that the approvers read. Accounts refuses\n * the switch when a plan has another name.\n */\n salesPlanName?: string\n expectedSalesPlanName?: string\n force: boolean\n }\n}\n\n/** The body of `POST api/admin/approvals/organizations/:orgId/in-negotiation`. */\nexport interface RequestInNegotiationThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: Omit<ChangeSalesPlanThroughApprovalRequest['body'], 'force'> & {\n expectedSalesPlanId: string\n }\n}\n\n/** The body of `POST api/admin/approvals/organizations/:orgId/licensing-model`. */\nexport interface ChangeLicensingModelThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n licensingModel: LicensingModelType\n /**\n * The model that the person who asked read. Absent for \"no model set\".\n * Accounts answers 409 and writes nothing when the model moved since.\n */\n expected?: LicensingModelType\n }\n}\n\n/**\n * The body of `POST api/admin/approvals/organizations/enterprise-onboarding`:\n * the fields of `POST external/onboarding`, with the actor envelope.\n */\nexport interface AutomatedEnterpriseOnboardingThroughApprovalRequest\n extends RequestBaseParams {\n body: AutomatedEnterpriseOnboardingRequest & { actor: ApprovalM2mActor }\n}\n\nexport interface DeleteOrganizationThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The name that the approvers read. Accounts refuses the deletion when\n * the organization has another name.\n */\n orgName: string\n }\n}\n\n/** What accounts answers for a deleted organization. */\nexport interface DeleteOrganizationThroughApprovalResult {\n orgId: string\n /** The members that accounts removed before it deleted the organization. */\n removedMembers: number\n}\n\nexport interface CreatePersonalOrganizationThroughApprovalRequest\n extends RequestBaseParams {\n body: {\n actor: ApprovalM2mActor\n name: string\n }\n}\n\n/** What accounts answers for a new personal organization. */\nexport interface CreatePersonalOrganizationThroughApprovalResult {\n orgId: string\n}\n\nexport interface ChangeClusterPlanLinkThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What accounts answers for a link or an unlink of one organization. */\nexport interface ChangeClusterPlanLinkThroughApprovalResult {\n orgId: string\n clusterPlanId: string\n /** `false` when the list of the organization already was as wanted. */\n changed: boolean\n}\n\nexport interface UnlinkClusterPlanFromMemberOrganizationsRequest\n extends RequestBaseParams {\n params: { clusterPlanId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface UnlinkClusterPlanFromMemberOrganizationsResult {\n /** The organizations whose list held the plan before the call. */\n unlinkedOrgIds: string[]\n}\n\nexport interface ChangeGenerationLinkThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; generationId: string }\n body: { actor: ApprovalM2mActor }\n}\n\n/** What accounts answers for a link or an unlink of one organization. */\nexport interface ChangeGenerationLinkThroughApprovalResult {\n orgId: string\n generationId: string\n /** `false` when the list of the organization already was as wanted. */\n changed: boolean\n}\n\nexport interface UnlinkGenerationFromMemberOrganizationsRequest\n extends RequestBaseParams {\n params: { generationId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface UnlinkGenerationFromMemberOrganizationsResult {\n /** The organizations whose list held the generation before the call. */\n unlinkedOrgIds: string[]\n}\n\nexport interface CheckOrgOwnerRequest extends RequestBaseParams {\n params: { orgId: string }\n body: { actor: ApprovalM2mActor }\n}\n\nexport interface DeleteUserThroughApprovalRequest extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The address that the approvers read. When given, accounts refuses the\n * deletion of a user with another address.\n */\n expectedEmail?: string\n /**\n * Accounts answers `deleted: false` for a user that Auth0 does not have,\n * and not 404. A purge sets it.\n */\n skipMissing?: boolean\n /**\n * A purge sets it. The person who asked then needs `GOD_PURGE_USERS` as\n * well as `DELETE_USER`.\n */\n purge?: boolean\n }\n}\n\n/** What accounts answers for a user deletion. */\nexport interface DeleteUserThroughApprovalResult {\n userId: string\n /** `false` when Auth0 had no such user, which only `skipMissing` answers. */\n deleted: boolean\n}\n\n/** A user that a remove-org-member request names. */\nexport interface RemoveOrgMemberNamedUser {\n userId: string\n /** The address that the approvers read. Accounts refuses another one. */\n expectedEmail: string\n}\n\nexport interface RemoveOrgMemberThroughApprovalRequest\n extends RequestBaseParams {\n params: { orgId: string; userId: string }\n body: {\n actor: ApprovalM2mActor\n /** The address of the member that the approvers read. */\n expectedEmail: string\n /** A member who becomes an owner before the removal. */\n newOwner?: RemoveOrgMemberNamedUser\n suppressEmail?: boolean\n }\n}\n\n/** What accounts answers for a removal of an org member. */\nexport interface RemoveOrgMemberThroughApprovalResult {\n orgId: string\n userId: string\n wasOwner: boolean\n newOwnerId?: string\n /** `false` when the new owner was an owner already. */\n newOwnerPromoted: boolean\n}\n\nexport interface ChangeUserEmailThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string }\n body: {\n actor: ApprovalM2mActor\n /**\n * The address that the person who asked read. Accounts answers 409 and\n * changes nothing when the address moved since.\n */\n expectedEmail: string\n newEmail: string\n }\n}\n\nexport interface UpdateUserMetadataThroughApprovalRequest\n extends RequestBaseParams {\n params: { userId: string; kind: 'app' | 'user' }\n body: {\n actor: ApprovalM2mActor\n /**\n * The metadata that the person who asked read. Absent for \"not set\".\n * Accounts answers 409 and writes nothing when it moved since.\n */\n expected?: Record<string, unknown>\n metadata: Record<string, unknown>\n }\n}\n\nexport class AccountsApprovalsM2MService {\n /**\n * Reads the name that accounts holds for an organization. control-backend\n * calls it when a request opens, so a summary shows this name and not a\n * name that the requester typed.\n */\n public static async readOrganizationName(params: {\n config: RequestBaseParamsConfig\n params: { orgId: string }\n }): Promise<ApprovalOrganizationNameResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.readOrganizationName',\n url: `api/admin/approvals/organizations/${encodeURIComponent(params.params.orgId)}/name`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/name',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<ApprovalOrganizationNameResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n responseType: 'json',\n })\n\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 public static async extendTrial(\n params: ExtendTrialThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.extendTrial',\n url: `api/admin/approvals/organizations/${params.params.orgId}/extend-trial`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/extend-trial',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 sendToExpiredTrial(\n params: SendToExpiredTrialThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.sendToExpiredTrial',\n url: `api/admin/approvals/organizations/${params.params.orgId}/expire-trial`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/expire-trial',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 changePlatformRoles(\n params: ChangePlatformRolesThroughApprovalRequest,\n ): Promise<ChangePlatformRolesThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changePlatformRoles',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/roles`,\n normalizedUrl: 'api/admin/approvals/users/:userId/roles',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<ChangePlatformRolesThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async changeOrgLimit(\n params: ChangeOrgLimitThroughApprovalRequest,\n ): Promise<void> {\n const { orgId, limitKey } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeOrgLimit',\n url: `api/admin/approvals/organizations/${orgId}/limits/${encodeURIComponent(limitKey)}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/limits/:limitKey',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 topUpLlmBudget(\n params: LlmBudgetTopUpThroughApprovalRequest,\n ): Promise<LlmBudgetTopUpThroughApprovalResult> {\n const { orgId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.topUpLlmBudget',\n url: `api/admin/approvals/organizations/${orgId}/llm-budget/top-up`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/llm-budget/top-up',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<LlmBudgetTopUpThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async deleteManagedLlmTenant(\n params: DeleteManagedLlmTenantThroughApprovalRequest,\n ): Promise<DeleteManagedLlmTenantThroughApprovalResult> {\n const { orgId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteManagedLlmTenant',\n url: `api/admin/approvals/organizations/${orgId}/llm-tenant`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/llm-tenant',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteManagedLlmTenantThroughApprovalResult>(\n {\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n },\n )\n\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async deleteSsoConnection(\n params: DeleteSsoConnectionThroughApprovalRequest,\n ): Promise<DeleteSsoConnectionThroughApprovalResult> {\n const { strategy, connectionId } = params.params\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteSsoConnection',\n url: `api/admin/approvals/connections/${strategy}/${encodeURIComponent(connectionId)}`,\n normalizedUrl:\n 'api/admin/approvals/connections/:strategy/:connectionId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteSsoConnectionThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Moves an organization to an enterprise plan with its contract and the\n * plan type of each cluster. Accounts answers 409 when the plan moved since\n * `expectedSalesPlanId`, and 400 when a cluster has no mapping.\n */\n public static async onboardToEnterprise(\n params: OnboardToEnterpriseThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.onboardToEnterprise',\n url: `api/admin/approvals/organizations/${params.params.orgId}/enterprise-onboarding`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/enterprise-onboarding',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Changes the term, the start date or the included value metrics of the\n * contract of an enterprise organization. Accounts answers 409 when a value\n * moved since `expected`, and 404 when the organization is not on an\n * enterprise plan.\n */\n public static async changeEnterpriseContract(\n params: ChangeEnterpriseContractThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeEnterpriseContract',\n url: `api/admin/approvals/organizations/${params.params.orgId}/enterprise-contract`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/enterprise-contract',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Sets the reservations of an organization, the second write of the\n * enterprise onboarding. Accounts refuses a count below the clusters on\n * the plan type, and one above the maximum of the sales plan.\n */\n public static async updateReservations(\n params: UpdateReservationsThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.updateReservations',\n url: `api/admin/approvals/organizations/${params.params.orgId}/reservations`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/reservations',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Changes the reservations of an organization, for a change-org-reservations\n * request. Accounts answers 409 when the plan or the reservations moved\n * after the request was opened.\n */\n public static async changeReservations(\n params: ChangeReservationsThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeReservations',\n url: `api/admin/approvals/organizations/${params.params.orgId}/reservations/change`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/reservations/change',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 changeSalesPlan(\n params: ChangeSalesPlanThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeSalesPlan',\n url: `api/admin/approvals/organizations/${params.params.orgId}/sales-plan`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/sales-plan',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Moves a trial organization to an in-negotiation plan, for a Camundi who\n * holds `READ_ALL`.\n */\n public static async requestInNegotiation(\n params: RequestInNegotiationThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.requestInNegotiation',\n url: `api/admin/approvals/organizations/${params.params.orgId}/in-negotiation`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/in-negotiation',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Sets the licensing model of an enterprise organization. Accounts answers\n * 409 when the model moved since `expected`, and 404 when the organization\n * is not on an enterprise plan.\n */\n public static async changeLicensingModel(\n params: ChangeLicensingModelThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeLicensingModel',\n url: `api/admin/approvals/organizations/${params.params.orgId}/licensing-model`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/licensing-model',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 /**\n * Creates a production and a development organization for a new enterprise\n * customer, as `POST external/onboarding` does, and names the Camundi who\n * asked as the person who invited the owner.\n */\n public static async automatedEnterpriseOnboarding(\n params: AutomatedEnterpriseOnboardingThroughApprovalRequest,\n ): Promise<AutomatedEnterpriseOnboardingResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.automatedEnterpriseOnboarding',\n url: 'api/admin/approvals/organizations/enterprise-onboarding',\n normalizedUrl:\n 'api/admin/approvals/organizations/enterprise-onboarding',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<AutomatedEnterpriseOnboardingResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\n responseType: 'json',\n // No retry on a 429: accounts answers 429 when the Auth0 lookup of the\n // owner invitation runs out of tries, AFTER it created the two\n // organizations. A second POST would create a second pair.\n retry: { attempts: 1, remaining: 0 },\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 return response.body\n }\n\n public static async deleteOrganization(\n params: DeleteOrganizationThroughApprovalRequest,\n ): Promise<DeleteOrganizationThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteOrganization',\n url: `api/admin/approvals/organizations/${params.params.orgId}`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteOrganizationThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n public static async createPersonalOrganization(\n params: CreatePersonalOrganizationThroughApprovalRequest,\n ): Promise<CreatePersonalOrganizationThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.createPersonalOrganization',\n url: 'api/admin/approvals/organizations/personal',\n normalizedUrl: 'api/admin/approvals/organizations/personal',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response =\n await request<CreatePersonalOrganizationThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Adds a cluster plan to the `clusterPlanWhiteList` of an organization that\n * the requester owns. Safe to run again.\n */\n public static async linkClusterPlan(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeClusterPlanLink(params, 'put')\n }\n\n /**\n * Removes a cluster plan from the `clusterPlanWhiteList` of an organization\n * that the requester owns.\n */\n public static async unlinkClusterPlan(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeClusterPlanLink(params, 'delete')\n }\n\n private static async changeClusterPlanLink(\n params: ChangeClusterPlanLinkThroughApprovalRequest,\n type: 'put' | 'delete',\n ): Promise<ChangeClusterPlanLinkThroughApprovalResult> {\n const { orgId, clusterPlanId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name:\n type === 'put'\n ? 'AccountsApprovalsM2MService.linkClusterPlan'\n : 'AccountsApprovalsM2MService.unlinkClusterPlan',\n url: `api/admin/approvals/organizations/${orgId}/cluster-plans/${clusterPlanId}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/cluster-plans/:clusterPlanId',\n type,\n body: params.body,\n })\n }\n\n /**\n * Removes a cluster plan from the `clusterPlanWhiteList` of every\n * organization that the requester is a member of.\n */\n public static async unlinkClusterPlanFromMemberOrganizations(\n params: UnlinkClusterPlanFromMemberOrganizationsRequest,\n ): Promise<UnlinkClusterPlanFromMemberOrganizationsResult> {\n const { clusterPlanId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name: 'AccountsApprovalsM2MService.unlinkClusterPlanFromMemberOrganizations',\n url: `api/admin/approvals/cluster-plans/${clusterPlanId}/unlink-from-member-organizations`,\n normalizedUrl:\n 'api/admin/approvals/cluster-plans/:clusterPlanId/unlink-from-member-organizations',\n type: 'post',\n body: params.body,\n })\n }\n\n /**\n * Adds a custom generation to the `generationWhiteList` of an organization\n * that the requester owns. Safe to run again.\n */\n public static async linkGeneration(\n params: ChangeGenerationLinkThroughApprovalRequest,\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeGenerationLink(params, 'put')\n }\n\n /**\n * Removes a custom generation from the list of an organization that the\n * requester owns.\n */\n public static async unlinkGeneration(\n params: ChangeGenerationLinkThroughApprovalRequest,\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n return AccountsApprovalsM2MService.changeGenerationLink(params, 'delete')\n }\n\n private static async changeGenerationLink(\n params: ChangeGenerationLinkThroughApprovalRequest,\n type: 'put' | 'delete',\n ): Promise<ChangeGenerationLinkThroughApprovalResult> {\n const { orgId, generationId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name:\n type === 'put'\n ? 'AccountsApprovalsM2MService.linkGeneration'\n : 'AccountsApprovalsM2MService.unlinkGeneration',\n url: `api/admin/approvals/organizations/${orgId}/generations/${generationId}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/generations/:generationId',\n type,\n body: params.body,\n })\n }\n\n /**\n * Removes a custom generation from the list of every organization that the\n * requester is a member of.\n */\n public static async unlinkGenerationFromMemberOrganizations(\n params: UnlinkGenerationFromMemberOrganizationsRequest,\n ): Promise<UnlinkGenerationFromMemberOrganizationsResult> {\n const { generationId } = params.params\n return AccountsApprovalsM2MService.callApprovalRoute({\n config: params.config,\n name: 'AccountsApprovalsM2MService.unlinkGenerationFromMemberOrganizations',\n url: `api/admin/approvals/generations/${generationId}/unlink-from-member-organizations`,\n normalizedUrl:\n 'api/admin/approvals/generations/:generationId/unlink-from-member-organizations',\n type: 'post',\n body: params.body,\n })\n }\n\n /**\n * Asks whether the requester owns an organization. Accounts answers 204 with\n * no body, and 403 for a requester who is not an owner.\n */\n public static async checkOrgOwner(\n params: CheckOrgOwnerRequest,\n ): Promise<void> {\n const { orgId } = params.params\n await AccountsApprovalsM2MService.callApprovalRoute<void>({\n config: params.config,\n name: 'AccountsApprovalsM2MService.checkOrgOwner',\n url: `api/admin/approvals/organizations/${orgId}/owner-check`,\n normalizedUrl: 'api/admin/approvals/organizations/:orgId/owner-check',\n type: 'post',\n body: params.body,\n })\n }\n\n /** The shared half of the plan and generation link calls. */\n private static async callApprovalRoute<T>(args: {\n config: RequestBaseParams['config']\n name: string\n url: string\n normalizedUrl: string\n type: 'put' | 'delete' | 'post'\n body: unknown\n }): Promise<T> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: args.name,\n url: args.url,\n normalizedUrl: args.normalizedUrl,\n type: args.type,\n },\n source: args.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<T>({\n config: args.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: args.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 return response.body!\n }\n\n public static async deleteUser(\n params: DeleteUserThroughApprovalRequest,\n ): Promise<DeleteUserThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.deleteUser',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl: 'api/admin/approvals/users/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<DeleteUserThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\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 return response.body!\n }\n\n /**\n * Removes a member from an organization, an owner included. Accounts\n * refuses a removal that leaves the organization with no owner.\n */\n public static async removeOrgMember(\n params: RemoveOrgMemberThroughApprovalRequest,\n ): Promise<RemoveOrgMemberThroughApprovalResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.removeOrgMember',\n url: `api/admin/approvals/organizations/${params.params.orgId}/members/${encodeURIComponent(params.params.userId)}`,\n normalizedUrl:\n 'api/admin/approvals/organizations/:orgId/members/:userId',\n type: 'delete',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<RemoveOrgMemberThroughApprovalResult>({\n config: params.config,\n base: { id: 'accounts' },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.body,\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 return response.body\n }\n\n public static async changeUserEmail(\n params: ChangeUserEmailThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.changeUserEmail',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/email`,\n normalizedUrl: 'api/admin/approvals/users/:userId/email',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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 updateUserMetadata(\n params: UpdateUserMetadataThroughApprovalRequest,\n ): Promise<void> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: 'AccountsApprovalsM2MService.updateUserMetadata',\n url: `api/admin/approvals/users/${encodeURIComponent(params.params.userId)}/metadata/${params.params.kind}`,\n normalizedUrl: 'api/admin/approvals/users/:userId/metadata/:kind',\n type: 'put',\n },\n source: params.config.metrics?.source || 'unset',\n target: { name: 'accounts', type: 'internal' },\n }\n\n const response = await request<void>({\n config: params.config,\n base: { id: 'accounts' },\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"],
|
|
5
|
+
"mappings": "AAkBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA8dnB,MAAM,4BAA4B;AAAA;AAAA;AAAA;AA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;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -145,8 +145,18 @@ export declare class HdpService {
|
|
|
145
145
|
* rows of deleted clusters, thus the caller matches `rows` against its own
|
|
146
146
|
* cluster list. A cluster with no row has no cost data. That is not a cost
|
|
147
147
|
* of 0.
|
|
148
|
+
*
|
|
149
|
+
* `days: 1` reads one measure day. `day` (`YYYY-MM-DD`) sets the last day
|
|
150
|
+
* of the window. Without `day`, the window ends at the latest loaded day,
|
|
151
|
+
* and `anchorDay` of the answer gives that day.
|
|
152
|
+
* A `day` after the latest loaded day gives 409: HDP did not load it yet.
|
|
148
153
|
*/
|
|
149
|
-
static getFleetHostingCost(params: RequestBaseParams
|
|
154
|
+
static getFleetHostingCost(params: RequestBaseParams & {
|
|
155
|
+
params?: {
|
|
156
|
+
days?: 1 | 30;
|
|
157
|
+
day?: string;
|
|
158
|
+
};
|
|
159
|
+
}): Promise<Hdp.FleetHostingCost>;
|
|
150
160
|
/**
|
|
151
161
|
* One chart of a Control dashboard: a query on one metric of HDP. Admin
|
|
152
162
|
* only, and only while `control.dashboardCharts` is on (404 otherwise). The
|
|
@@ -314,12 +314,25 @@ class HdpService {
|
|
|
314
314
|
* rows of deleted clusters, thus the caller matches `rows` against its own
|
|
315
315
|
* cluster list. A cluster with no row has no cost data. That is not a cost
|
|
316
316
|
* of 0.
|
|
317
|
+
*
|
|
318
|
+
* `days: 1` reads one measure day. `day` (`YYYY-MM-DD`) sets the last day
|
|
319
|
+
* of the window. Without `day`, the window ends at the latest loaded day,
|
|
320
|
+
* and `anchorDay` of the answer gives that day.
|
|
321
|
+
* A `day` after the latest loaded day gives 409: HDP did not load it yet.
|
|
317
322
|
*/
|
|
318
323
|
static async getFleetHostingCost(params) {
|
|
324
|
+
const queryParams = new URLSearchParams();
|
|
325
|
+
if (params.params?.days !== void 0) {
|
|
326
|
+
queryParams.append("days", String(params.params.days));
|
|
327
|
+
}
|
|
328
|
+
if (params.params?.day !== void 0) {
|
|
329
|
+
queryParams.append("day", params.params.day);
|
|
330
|
+
}
|
|
331
|
+
const queryString = queryParams.size > 0 ? `?${queryParams.toString()}` : "";
|
|
319
332
|
const serviceContext = {
|
|
320
333
|
method: {
|
|
321
334
|
name: `HdpService.getFleetHostingCost`,
|
|
322
|
-
url:
|
|
335
|
+
url: `api/hdp/hosting-cost${queryString}`,
|
|
323
336
|
normalizedUrl: "api/hdp/hosting-cost",
|
|
324
337
|
type: "get"
|
|
325
338
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/services/accounts/hdp.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 ChartResult,\n ChartSpec,\n Hdp,\n HdpBackendChangeEvent,\n HdpDisk,\n HdpPrometheusDataCapacityDataPoint,\n HdpTenantUsageBreakdown,\n HdpTenantUsagePoint,\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 QueryChartRequest extends RequestBaseParams {\n params: {\n spec: ChartSpec\n }\n}\n\nexport interface GetClusterCapacityRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId?: string\n clusterIds?: string[]\n operation: 'per-day' | 'latest' | '24h'\n }\n}\n\n/**\n * `per-day`/`24h` read one cluster and `latest` reads a set \u2014 the identifiers\n * are not interchangeable, so the discriminant carries only the one its\n * operation needs. A flat `{clusterId?, clusterIds?, operation}` shape let a\n * caller send `{operation: '24h', clusterIds: [...]}`, which reached the\n * accounts-backend route with an undefined `clusterId` and returned 200 with\n * `[]` instead of a 400.\n */\nexport type GetClusterDiskUsageParams = {\n /** The disk to read. Without it, the route reads Elasticsearch. */\n disk?: HdpDisk\n} & (\n | { orgId: string; operation: 'per-day' | '24h'; clusterId: string }\n | { orgId: string; operation: 'latest'; clusterIds: string[] }\n)\n\nexport type GetClusterDiskUsageRequest = RequestBaseParams & {\n params: GetClusterDiskUsageParams\n}\n\nexport interface GetTenantUsageRequest extends RequestBaseParams {\n params: {\n orgId: string\n /** Relative window, in days back from today. Ignored when `startDate` is set. */\n days?: number\n /** Inclusive `YYYY-MM-DD` lower bound. */\n startDate?: string\n /** Inclusive `YYYY-MM-DD` upper bound. Defaults to today. */\n endDate?: string\n }\n}\n\nexport interface GetBackendChangeEventsRequest extends RequestBaseParams {\n params: {\n entityId: string\n }\n}\n\nexport interface GetUsageMetricsRequest extends RequestBaseParams {\n params: {\n orgId: string\n queryRange?: string\n queryStartDate?: string\n /** Inclusive upper bound; without it the range is open-ended. */\n queryEndDate?: string\n queryLimit?: number\n }\n}\n\nexport interface GetUsageMetricsResponse {\n valueMetrics: Hdp.ValueMetrics\n}\n\nexport interface GetLlmUsageRequest extends RequestBaseParams {\n params: Record<string, never>\n}\n\nexport interface LlmUsageEntry {\n ts: number\n orgId: string\n orgName: string\n salesPlan: string\n spend: number\n maxBudget: number\n}\n\nexport interface GetActiveOrgsRequest extends RequestBaseParams {\n params: {\n metric: 'ProcessInstances' | 'DecisionInstances' | 'TaskUsers'\n }\n}\n\nexport interface GetActiveOrgsResponse {\n activeOrgs: Hdp.ActiveOrgByUsageMetric[]\n}\n\nexport interface GetClusterActivityRequest extends RequestBaseParams {\n params?: {\n /** The window to read, in days. accounts-backend bounds this value. */\n windowDays?: number\n }\n}\n\nexport interface GetClusterHostingCostRequest extends RequestBaseParams {\n params: {\n clusterId: string\n }\n}\n\nexport interface GetClusterHostingCostResponse {\n /** Absent when the cluster has no rows in the window. */\n hostingCost?: Hdp.ClusterHostingCost\n}\n\nexport class HdpService {\n public static async getClusterCapacity(\n params: GetClusterCapacityRequest,\n ): Promise<HdpPrometheusDataCapacityDataPoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterCapacity`,\n url: `api/hdp/${params.params.orgId}/clusters/capacity`,\n normalizedUrl: `api/hdp/:orgId/clusters/capacity`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpPrometheusDataCapacityDataPoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * Used bytes of one cluster disk (Elasticsearch or Zeebe), as avg/min/max,\n * with the same shape and operations as `getClusterCapacity`. The value is\n * the total over all nodes of the disk. See\n * camunda/Holistic-Data-Platform#1923 for the ingestion side.\n */\n public static async getClusterDiskUsage(\n params: GetClusterDiskUsageRequest,\n ): Promise<HdpPrometheusDataCapacityDataPoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterDiskUsage`,\n url: `api/hdp/${params.params.orgId}/clusters/disk-usage`,\n normalizedUrl: `api/hdp/:orgId/clusters/disk-usage`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpPrometheusDataCapacityDataPoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getTenantUsage(\n params: GetTenantUsageRequest,\n ): Promise<HdpTenantUsagePoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getTenantUsage`,\n url: `api/hdp/${params.params.orgId}/tenants`,\n normalizedUrl: `api/hdp/:orgId/tenants`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpTenantUsagePoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * Tenant usage broken down by cluster, plus the org roll-up of the same rows.\n * Use when a caller needs the per-cluster detail; `getTenantUsage` returns\n * just the org totals, which is all a billing figure needs.\n */\n public static async getTenantUsagePerCluster(\n params: GetTenantUsageRequest,\n ): Promise<HdpTenantUsageBreakdown> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getTenantUsagePerCluster`,\n url: `api/hdp/${params.params.orgId}/tenants/per-cluster`,\n normalizedUrl: `api/hdp/:orgId/tenants/per-cluster`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpTenantUsageBreakdown>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getBackendChangeEvents(\n params: GetBackendChangeEventsRequest,\n ): Promise<HdpBackendChangeEvent[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterCapacity`,\n url: `api/hdp/backend-events/${params.params.entityId}`,\n normalizedUrl: `api/hdp/backend-events/:entityId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpBackendChangeEvent[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getUsageMetrics(\n params: GetUsageMetricsRequest,\n ): Promise<GetUsageMetricsResponse> {\n const queryParams = new URLSearchParams()\n if (params.params.queryRange) {\n queryParams.append('range', params.params.queryRange)\n }\n if (params.params.queryStartDate) {\n queryParams.append('startDate', params.params.queryStartDate)\n }\n if (params.params.queryEndDate) {\n queryParams.append('endDate', params.params.queryEndDate)\n }\n if (params.params.queryLimit) {\n queryParams.append('limit', params.params.queryLimit.toString())\n }\n const queryString = queryParams.size > 0 ? `?${queryParams.toString()}` : ''\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getUsageMetrics`,\n url: `api/usage-metrics/${params.params.orgId}${queryString}`,\n normalizedUrl: `api/hdp/usage-metrics/:orgId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetUsageMetricsResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * The work of every cluster that HDP holds inside the window, for the whole\n * fleet (`GET /api/usage-metrics/cluster-activity`).\n *\n * Only accounts-backend can query HDP, thus console-backend reads the rows\n * from here. Call this with a service token: the response covers the whole\n * fleet, and the caller caches it for every user.\n */\n public static async getClusterActivity(\n params: GetClusterActivityRequest,\n ): Promise<Hdp.ClusterActivity> {\n const windowDays = params.params?.windowDays\n const queryString =\n windowDays === undefined ? '' : `?windowDays=${windowDays}`\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterActivity`,\n url: `api/usage-metrics/cluster-activity${queryString}`,\n normalizedUrl: `api/hdp/usage-metrics/cluster-activity`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<Hdp.ClusterActivity>({\n ...params,\n base: {\n id: 'accounts',\n },\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 /**\n * One cluster's trailing 30-day hosting cost\n * (`GET /api/hdp/hosting-cost/:clusterId`).\n *\n * Only accounts-backend can query HDP, thus console-backend and\n * control-frontend both read it from here. The response's `hostingCost` is\n * absent when the cluster has no rows in the window, so the caller can show\n * \"no data\" rather than a false $0.\n */\n public static async getClusterHostingCost(\n params: GetClusterHostingCostRequest,\n ): Promise<GetClusterHostingCostResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterHostingCost`,\n url: `api/hdp/hosting-cost/${encodeURIComponent(params.params.clusterId)}`,\n normalizedUrl: `api/hdp/hosting-cost/:clusterId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetClusterHostingCostResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * The trailing 30-day hosting cost of every cluster HDP holds, for\n * the whole fleet (`GET /api/hdp/hosting-cost`).\n *\n * accounts-backend answers only a caller with `admin.readAll`, and caches\n * the answer for one hour, thus a page can call this on load. HDP keeps the\n * rows of deleted clusters, thus the caller matches `rows` against its own\n * cluster list. A cluster with no row has no cost data. That is not a cost\n * of 0.\n */\n public static async getFleetHostingCost(\n params: RequestBaseParams,\n ): Promise<Hdp.FleetHostingCost> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getFleetHostingCost`,\n url: 'api/hdp/hosting-cost',\n normalizedUrl: 'api/hdp/hosting-cost',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<Hdp.FleetHostingCost>({\n ...params,\n base: {\n id: 'accounts',\n },\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 /**\n * One chart of a Control dashboard: a query on one metric of HDP. Admin\n * only, and only while `control.dashboardCharts` is on (404 otherwise). The\n * backend checks the spec against `CHART_METRICS` and answers 400 for a spec\n * it refuses, 422 when the query reads too many bytes, and 429 when the user\n * runs too many queries. The message of the thrown {@link HttpError} is the\n * reason that the backend gives.\n */\n public static async queryChart(\n params: QueryChartRequest,\n ): Promise<ChartResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.queryChart`,\n url: 'api/hdp/charts/query',\n normalizedUrl: 'api/hdp/charts/query',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<ChartResult>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params.spec,\n // No retry on a 429: a retry after the backoff starts a BigQuery job\n // that nobody asked for. The chart shows the limit at once.\n retry: { attempts: 1, remaining: 0 },\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 public static async getActiveOrgs(\n params: GetActiveOrgsRequest,\n ): Promise<GetActiveOrgsResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getActiveOrgs`,\n url: `api/usage-metrics/active/${params.params.metric}`,\n normalizedUrl: `api/hdp/usage-metrics/active/:metric`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetActiveOrgsResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getLlmUsage(\n params: GetLlmUsageRequest,\n ): Promise<LlmUsageEntry[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getLlmUsage`,\n url: `api/hdp/llm-usage`,\n normalizedUrl: `api/hdp/llm-usage`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<LlmUsageEntry[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n}\n"],
|
|
5
|
-
"mappings": "AAoBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA+GnB,MAAM,WAAW;AAAA,EACtB,aAAoB,mBAClB,QAC+C;AAC/C,UAAM,i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AM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
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 ChartResult,\n ChartSpec,\n Hdp,\n HdpBackendChangeEvent,\n HdpDisk,\n HdpPrometheusDataCapacityDataPoint,\n HdpTenantUsageBreakdown,\n HdpTenantUsagePoint,\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 QueryChartRequest extends RequestBaseParams {\n params: {\n spec: ChartSpec\n }\n}\n\nexport interface GetClusterCapacityRequest extends RequestBaseParams {\n params: {\n orgId: string\n clusterId?: string\n clusterIds?: string[]\n operation: 'per-day' | 'latest' | '24h'\n }\n}\n\n/**\n * `per-day`/`24h` read one cluster and `latest` reads a set \u2014 the identifiers\n * are not interchangeable, so the discriminant carries only the one its\n * operation needs. A flat `{clusterId?, clusterIds?, operation}` shape let a\n * caller send `{operation: '24h', clusterIds: [...]}`, which reached the\n * accounts-backend route with an undefined `clusterId` and returned 200 with\n * `[]` instead of a 400.\n */\nexport type GetClusterDiskUsageParams = {\n /** The disk to read. Without it, the route reads Elasticsearch. */\n disk?: HdpDisk\n} & (\n | { orgId: string; operation: 'per-day' | '24h'; clusterId: string }\n | { orgId: string; operation: 'latest'; clusterIds: string[] }\n)\n\nexport type GetClusterDiskUsageRequest = RequestBaseParams & {\n params: GetClusterDiskUsageParams\n}\n\nexport interface GetTenantUsageRequest extends RequestBaseParams {\n params: {\n orgId: string\n /** Relative window, in days back from today. Ignored when `startDate` is set. */\n days?: number\n /** Inclusive `YYYY-MM-DD` lower bound. */\n startDate?: string\n /** Inclusive `YYYY-MM-DD` upper bound. Defaults to today. */\n endDate?: string\n }\n}\n\nexport interface GetBackendChangeEventsRequest extends RequestBaseParams {\n params: {\n entityId: string\n }\n}\n\nexport interface GetUsageMetricsRequest extends RequestBaseParams {\n params: {\n orgId: string\n queryRange?: string\n queryStartDate?: string\n /** Inclusive upper bound; without it the range is open-ended. */\n queryEndDate?: string\n queryLimit?: number\n }\n}\n\nexport interface GetUsageMetricsResponse {\n valueMetrics: Hdp.ValueMetrics\n}\n\nexport interface GetLlmUsageRequest extends RequestBaseParams {\n params: Record<string, never>\n}\n\nexport interface LlmUsageEntry {\n ts: number\n orgId: string\n orgName: string\n salesPlan: string\n spend: number\n maxBudget: number\n}\n\nexport interface GetActiveOrgsRequest extends RequestBaseParams {\n params: {\n metric: 'ProcessInstances' | 'DecisionInstances' | 'TaskUsers'\n }\n}\n\nexport interface GetActiveOrgsResponse {\n activeOrgs: Hdp.ActiveOrgByUsageMetric[]\n}\n\nexport interface GetClusterActivityRequest extends RequestBaseParams {\n params?: {\n /** The window to read, in days. accounts-backend bounds this value. */\n windowDays?: number\n }\n}\n\nexport interface GetClusterHostingCostRequest extends RequestBaseParams {\n params: {\n clusterId: string\n }\n}\n\nexport interface GetClusterHostingCostResponse {\n /** Absent when the cluster has no rows in the window. */\n hostingCost?: Hdp.ClusterHostingCost\n}\n\nexport class HdpService {\n public static async getClusterCapacity(\n params: GetClusterCapacityRequest,\n ): Promise<HdpPrometheusDataCapacityDataPoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterCapacity`,\n url: `api/hdp/${params.params.orgId}/clusters/capacity`,\n normalizedUrl: `api/hdp/:orgId/clusters/capacity`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpPrometheusDataCapacityDataPoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * Used bytes of one cluster disk (Elasticsearch or Zeebe), as avg/min/max,\n * with the same shape and operations as `getClusterCapacity`. The value is\n * the total over all nodes of the disk. See\n * camunda/Holistic-Data-Platform#1923 for the ingestion side.\n */\n public static async getClusterDiskUsage(\n params: GetClusterDiskUsageRequest,\n ): Promise<HdpPrometheusDataCapacityDataPoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterDiskUsage`,\n url: `api/hdp/${params.params.orgId}/clusters/disk-usage`,\n normalizedUrl: `api/hdp/:orgId/clusters/disk-usage`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpPrometheusDataCapacityDataPoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getTenantUsage(\n params: GetTenantUsageRequest,\n ): Promise<HdpTenantUsagePoint[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getTenantUsage`,\n url: `api/hdp/${params.params.orgId}/tenants`,\n normalizedUrl: `api/hdp/:orgId/tenants`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpTenantUsagePoint[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * Tenant usage broken down by cluster, plus the org roll-up of the same rows.\n * Use when a caller needs the per-cluster detail; `getTenantUsage` returns\n * just the org totals, which is all a billing figure needs.\n */\n public static async getTenantUsagePerCluster(\n params: GetTenantUsageRequest,\n ): Promise<HdpTenantUsageBreakdown> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getTenantUsagePerCluster`,\n url: `api/hdp/${params.params.orgId}/tenants/per-cluster`,\n normalizedUrl: `api/hdp/:orgId/tenants/per-cluster`,\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpTenantUsageBreakdown>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getBackendChangeEvents(\n params: GetBackendChangeEventsRequest,\n ): Promise<HdpBackendChangeEvent[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterCapacity`,\n url: `api/hdp/backend-events/${params.params.entityId}`,\n normalizedUrl: `api/hdp/backend-events/:entityId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<HdpBackendChangeEvent[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getUsageMetrics(\n params: GetUsageMetricsRequest,\n ): Promise<GetUsageMetricsResponse> {\n const queryParams = new URLSearchParams()\n if (params.params.queryRange) {\n queryParams.append('range', params.params.queryRange)\n }\n if (params.params.queryStartDate) {\n queryParams.append('startDate', params.params.queryStartDate)\n }\n if (params.params.queryEndDate) {\n queryParams.append('endDate', params.params.queryEndDate)\n }\n if (params.params.queryLimit) {\n queryParams.append('limit', params.params.queryLimit.toString())\n }\n const queryString = queryParams.size > 0 ? `?${queryParams.toString()}` : ''\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getUsageMetrics`,\n url: `api/usage-metrics/${params.params.orgId}${queryString}`,\n normalizedUrl: `api/hdp/usage-metrics/:orgId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetUsageMetricsResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * The work of every cluster that HDP holds inside the window, for the whole\n * fleet (`GET /api/usage-metrics/cluster-activity`).\n *\n * Only accounts-backend can query HDP, thus console-backend reads the rows\n * from here. Call this with a service token: the response covers the whole\n * fleet, and the caller caches it for every user.\n */\n public static async getClusterActivity(\n params: GetClusterActivityRequest,\n ): Promise<Hdp.ClusterActivity> {\n const windowDays = params.params?.windowDays\n const queryString =\n windowDays === undefined ? '' : `?windowDays=${windowDays}`\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterActivity`,\n url: `api/usage-metrics/cluster-activity${queryString}`,\n normalizedUrl: `api/hdp/usage-metrics/cluster-activity`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<Hdp.ClusterActivity>({\n ...params,\n base: {\n id: 'accounts',\n },\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 /**\n * One cluster's trailing 30-day hosting cost\n * (`GET /api/hdp/hosting-cost/:clusterId`).\n *\n * Only accounts-backend can query HDP, thus console-backend and\n * control-frontend both read it from here. The response's `hostingCost` is\n * absent when the cluster has no rows in the window, so the caller can show\n * \"no data\" rather than a false $0.\n */\n public static async getClusterHostingCost(\n params: GetClusterHostingCostRequest,\n ): Promise<GetClusterHostingCostResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getClusterHostingCost`,\n url: `api/hdp/hosting-cost/${encodeURIComponent(params.params.clusterId)}`,\n normalizedUrl: `api/hdp/hosting-cost/:clusterId`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetClusterHostingCostResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n /**\n * The trailing 30-day hosting cost of every cluster HDP holds, for\n * the whole fleet (`GET /api/hdp/hosting-cost`).\n *\n * accounts-backend answers only a caller with `admin.readAll`, and caches\n * the answer for one hour, thus a page can call this on load. HDP keeps the\n * rows of deleted clusters, thus the caller matches `rows` against its own\n * cluster list. A cluster with no row has no cost data. That is not a cost\n * of 0.\n *\n * `days: 1` reads one measure day. `day` (`YYYY-MM-DD`) sets the last day\n * of the window. Without `day`, the window ends at the latest loaded day,\n * and `anchorDay` of the answer gives that day.\n * A `day` after the latest loaded day gives 409: HDP did not load it yet.\n */\n public static async getFleetHostingCost(\n params: RequestBaseParams & { params?: { days?: 1 | 30; day?: string } },\n ): Promise<Hdp.FleetHostingCost> {\n const queryParams = new URLSearchParams()\n if (params.params?.days !== undefined) {\n queryParams.append('days', String(params.params.days))\n }\n if (params.params?.day !== undefined) {\n queryParams.append('day', params.params.day)\n }\n const queryString = queryParams.size > 0 ? `?${queryParams.toString()}` : ''\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getFleetHostingCost`,\n url: `api/hdp/hosting-cost${queryString}`,\n normalizedUrl: 'api/hdp/hosting-cost',\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<Hdp.FleetHostingCost>({\n ...params,\n base: {\n id: 'accounts',\n },\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 /**\n * One chart of a Control dashboard: a query on one metric of HDP. Admin\n * only, and only while `control.dashboardCharts` is on (404 otherwise). The\n * backend checks the spec against `CHART_METRICS` and answers 400 for a spec\n * it refuses, 422 when the query reads too many bytes, and 429 when the user\n * runs too many queries. The message of the thrown {@link HttpError} is the\n * reason that the backend gives.\n */\n public static async queryChart(\n params: QueryChartRequest,\n ): Promise<ChartResult> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.queryChart`,\n url: 'api/hdp/charts/query',\n normalizedUrl: 'api/hdp/charts/query',\n type: 'post',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<ChartResult>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n body: params.params.spec,\n // No retry on a 429: a retry after the backoff starts a BigQuery job\n // that nobody asked for. The chart shows the limit at once.\n retry: { attempts: 1, remaining: 0 },\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 public static async getActiveOrgs(\n params: GetActiveOrgsRequest,\n ): Promise<GetActiveOrgsResponse> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getActiveOrgs`,\n url: `api/usage-metrics/active/${params.params.metric}`,\n normalizedUrl: `api/hdp/usage-metrics/active/:metric`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<GetActiveOrgsResponse>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n\n public static async getLlmUsage(\n params: GetLlmUsageRequest,\n ): Promise<LlmUsageEntry[]> {\n const serviceContext: RequestBaseServiceContext = {\n method: {\n name: `HdpService.getLlmUsage`,\n url: `api/hdp/llm-usage`,\n normalizedUrl: `api/hdp/llm-usage`,\n type: 'get',\n },\n source: params.config.metrics?.source || 'unset',\n target: {\n name: 'accounts',\n type: 'internal',\n },\n }\n const response = await request<LlmUsageEntry[]>({\n ...params,\n base: {\n id: 'accounts',\n },\n url: serviceContext.method.url,\n method: serviceContext.method.type,\n metricsDetails: serviceContext,\n })\n if (!response.ok) {\n throw new HttpError(\n `${serviceContext.method.name}: ${response.status} ${response.statusText}`,\n response.status,\n response.statusText,\n )\n }\n return response.body!\n }\n}\n"],
|
|
5
|
+
"mappings": "AAoBA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AA+GnB,MAAM,WAAW;AAAA,EACtB,aAAoB,mBAClB,QAC+C;AAC/C,UAAM,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MACN;AAAA,MACA,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,IAClB,CAAC;AACD,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,aAAoB,YAClB,QAC0B;AAC1B,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;AAAA,QACN,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AACA,UAAM,WAAW,MAAM,QAAyB;AAAA,MAC9C,GAAG;AAAA,MACH,MAAM;AAAA,QACJ,IAAI;AAAA,MACN;AAAA,MACA,KAAK,eAAe,OAAO;AAAA,MAC3B,QAAQ,eAAe,OAAO;AAAA,MAC9B,gBAAgB;AAAA,IAClB,CAAC;AACD,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI;AAAA,QACR,GAAG,eAAe,OAAO,IAAI,KAAK,SAAS,MAAM,IAAI,SAAS,UAAU;AAAA,QACxE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,SAAS;AAAA,EAClB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { M2mTokenCountsDto } from '@camunda/ccma-shared-types';
|
|
1
|
+
import type { ActiveUsersDto, M2mTokenCountsDto } from '@camunda/ccma-shared-types';
|
|
2
2
|
import type { RequestBaseParams } from '../../types/general.types.js';
|
|
3
3
|
export interface GetM2mTokenCountsRequest extends RequestBaseParams {
|
|
4
4
|
params: {
|
|
@@ -17,4 +17,11 @@ export declare class AccountsLogsService {
|
|
|
17
17
|
* stopped before the end of the range. See `M2mTokenCountsDto`.
|
|
18
18
|
*/
|
|
19
19
|
static getM2mTokenCounts(params: GetM2mTokenCountsRequest): Promise<M2mTokenCountsDto>;
|
|
20
|
+
/**
|
|
21
|
+
* The active user count of the Auth0 tenant: the users that logged in
|
|
22
|
+
* during the last 30 days. accounts-backend answers 502 when Auth0 refuses
|
|
23
|
+
* it: its Management API client has no `read:stats` scope, or its token is
|
|
24
|
+
* bad or expired.
|
|
25
|
+
*/
|
|
26
|
+
static getActiveUsers(params: RequestBaseParams): Promise<ActiveUsersDto>;
|
|
20
27
|
}
|
|
@@ -34,6 +34,40 @@ class AccountsLogsService {
|
|
|
34
34
|
}
|
|
35
35
|
return response.body ?? { clusters: [], counted: 0, total: 0, truncated: false };
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The active user count of the Auth0 tenant: the users that logged in
|
|
39
|
+
* during the last 30 days. accounts-backend answers 502 when Auth0 refuses
|
|
40
|
+
* it: its Management API client has no `read:stats` scope, or its token is
|
|
41
|
+
* bad or expired.
|
|
42
|
+
*/
|
|
43
|
+
static async getActiveUsers(params) {
|
|
44
|
+
const serviceContext = {
|
|
45
|
+
method: {
|
|
46
|
+
name: "AccountsLogsService.getActiveUsers",
|
|
47
|
+
url: "api/logs/active-users",
|
|
48
|
+
normalizedUrl: "api/logs/active-users",
|
|
49
|
+
type: "get"
|
|
50
|
+
},
|
|
51
|
+
source: params.config.metrics?.source || "unset",
|
|
52
|
+
target: { name: "accounts", type: "internal" }
|
|
53
|
+
};
|
|
54
|
+
const response = await request({
|
|
55
|
+
config: params.config,
|
|
56
|
+
base: { id: "accounts" },
|
|
57
|
+
url: serviceContext.method.url,
|
|
58
|
+
method: serviceContext.method.type,
|
|
59
|
+
metricsDetails: serviceContext,
|
|
60
|
+
responseType: "json"
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok || !response.body) {
|
|
63
|
+
throw new HttpError(
|
|
64
|
+
`${serviceContext.method.name}: ${response.status} ${response.statusText}`,
|
|
65
|
+
response.status,
|
|
66
|
+
response.statusText
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return response.body;
|
|
70
|
+
}
|
|
37
71
|
}
|
|
38
72
|
export {
|
|
39
73
|
AccountsLogsService
|