@camunda/ccma-api 5.20.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.d.ts +8 -6
  2. package/dist/index.js +10 -2
  3. package/dist/index.js.map +2 -2
  4. package/dist/services/accounts/approvals.m2m.service.d.ts +41 -2
  5. package/dist/services/accounts/approvals.m2m.service.js +62 -0
  6. package/dist/services/accounts/approvals.m2m.service.js.map +2 -2
  7. package/dist/services/accounts/orgs.service.d.ts +2 -1
  8. package/dist/services/accounts/orgs.service.js.map +2 -2
  9. package/dist/services/ccma/ccma.openapi.service.d.ts +48 -0
  10. package/dist/services/ccma/ccma.openapi.service.js +88 -0
  11. package/dist/services/ccma/ccma.openapi.service.js.map +7 -0
  12. package/dist/services/ccma/ccma.openapi.service.spec.d.ts +1 -0
  13. package/dist/services/console/console.approvals.m2m.service.d.ts +12 -2
  14. package/dist/services/console/console.approvals.m2m.service.js +18 -0
  15. package/dist/services/console/console.approvals.m2m.service.js.map +2 -2
  16. package/dist/services/control/control.agent-grants.redact.spec.d.ts +1 -0
  17. package/dist/services/control/control.agent-grants.service.d.ts +26 -0
  18. package/dist/services/control/control.agent-grants.service.js +57 -0
  19. package/dist/services/control/control.agent-grants.service.js.map +7 -0
  20. package/dist/services/control/control.agent-grants.service.spec.d.ts +1 -0
  21. package/dist/services/control/control.agent-tokens.service.d.ts +19 -1
  22. package/dist/services/control/control.agent-tokens.service.js +34 -2
  23. package/dist/services/control/control.agent-tokens.service.js.map +2 -2
  24. package/dist/services/control/control.approvals.service.d.ts +74 -11
  25. package/dist/services/control/control.approvals.service.js +84 -11
  26. package/dist/services/control/control.approvals.service.js.map +2 -2
  27. package/dist/services/token-issuer/token-issuer.grant.service.d.ts +26 -0
  28. package/dist/services/token-issuer/token-issuer.grant.service.js +52 -0
  29. package/dist/services/token-issuer/token-issuer.grant.service.js.map +7 -0
  30. package/dist/services/token-issuer/token-issuer.grant.service.spec.d.ts +1 -0
  31. package/dist/types/general.types.d.ts +22 -0
  32. package/dist/utils/api.ccma-openapi-status.spec.d.ts +1 -0
  33. package/dist/utils/api.d.ts +13 -2
  34. package/dist/utils/api.js +55 -5
  35. package/dist/utils/api.js.map +2 -2
  36. package/dist/utils/api.on-failed-response.spec.d.ts +1 -0
  37. package/dist/utils/environments.d.ts +1 -1
  38. package/dist/utils/environments.js +0 -7
  39. package/dist/utils/environments.js.map +2 -2
  40. package/package.json +2 -2
  41. package/dist/services/mixpanel/mixpanel.service.d.ts +0 -16
  42. package/dist/services/mixpanel/mixpanel.service.js +0 -86
  43. package/dist/services/mixpanel/mixpanel.service.js.map +0 -7
@@ -1,4 +1,4 @@
1
- import type { ApprovalEntityType, ApprovalJobDto, ApprovalJobStatus, ApprovalSortField, ApprovalSortOrder, ApprovalStatusCountsDto, ApprovalUseCaseDto, ClusterBulkOperationPayloadDto, ClusterBulkOperationType, ClusterCorpseKind, ClusterPlanModificationConfig, ClusterTtlDeletionPayload, EnterpriseIncludingValueMetrics, GenerationEnvVarsDto, GenerationImageVersionsDto, LicensingModelType, ReleaseTrainPublishPayload, ReleaseTrainRollbackPayload } from '@camunda/ccma-shared-types';
1
+ import type { ApprovalEntityType, ApprovalJobDto, ApprovalJobStatus, ApprovalOverrideGrantDto, ApprovalSortField, ApprovalSortOrder, ApprovalStatusCountsDto, ApprovalUseCaseDto, ClusterBulkOperationPayloadDto, ClusterBulkOperationType, ClusterCorpseKind, ClusterPlanModificationConfig, ClusterTtlDeletionPayload, EnterpriseIncludingValueMetrics, GenerationEnvVarsDto, GenerationImageVersionsDto, LicensingModelType, ReleaseTrainPublishPayload, ReleaseTrainRollbackPayload } from '@camunda/ccma-shared-types';
2
2
  import type { RequestBaseParams } from '../../types/general.types.js';
3
3
  export interface ApprovalPageDto {
4
4
  approvals: ApprovalJobDto[];
@@ -103,6 +103,19 @@ export interface CreateApprovalRequest<TPayload> extends RequestBaseParams {
103
103
  requiredAcks?: number;
104
104
  };
105
105
  }
106
+ /** An override needs a reason, which goes to the audit trail. */
107
+ export interface OverrideApprovalRequest extends RequestBaseParams {
108
+ params: {
109
+ id: string;
110
+ reason: string;
111
+ };
112
+ }
113
+ export interface GrantApprovalOverridePayloadDto {
114
+ /** The Camundi who gets the grant. It can be the person who asks. */
115
+ granteeEmail: string;
116
+ /** At most `APPROVAL_OVERRIDE_MAX_HOURS`, counted from the run. */
117
+ durationHours: number;
118
+ }
106
119
  export interface SendToExpiredTrialPayloadDto {
107
120
  orgId: string;
108
121
  orgName?: string;
@@ -282,6 +295,24 @@ export interface ChangeOrgLimitsPayloadDto {
282
295
  /** The new override. `null` clears it, and the default of the plan applies. */
283
296
  value: string | number | boolean | null;
284
297
  }
298
+ export interface LlmBudgetTopUpPayloadDto {
299
+ orgId: string;
300
+ /** A copy, so a list shows a name that a person knows. Nothing reads it. */
301
+ orgName?: string;
302
+ /**
303
+ * The budget that the person who asked READ. Accounts compares it with the
304
+ * budget when the action runs, and changes nothing when the two differ.
305
+ */
306
+ expectedBudget: number;
307
+ /** The spend that the person who asked read. The approver reads it. */
308
+ spend: number;
309
+ /**
310
+ * True when the person who asked confirmed a top-up with the spend below
311
+ * `LLM_BUDGET_TOP_UP_THRESHOLD`. Without it, such a request fails when it
312
+ * runs.
313
+ */
314
+ belowThreshold: boolean;
315
+ }
285
316
  /** One generation of a change-generation-versions request. */
286
317
  export interface ChangeGenerationVersionsTargetDto {
287
318
  id: string;
@@ -737,6 +768,17 @@ export declare class ControlApprovalsService {
737
768
  approval: ApprovalJobDto;
738
769
  created: boolean;
739
770
  }>;
771
+ /**
772
+ * Opens a llm-budget-top-up request.
773
+ *
774
+ * Opening one needs `accounts:admin:mayChangeOrgLimits`, the same
775
+ * permission that approving needs. A 200 means that a request for the same
776
+ * organization is already open.
777
+ */
778
+ static createLlmBudgetTopUp(params: CreateApprovalRequest<LlmBudgetTopUpPayloadDto>): Promise<{
779
+ approval: ApprovalJobDto;
780
+ created: boolean;
781
+ }>;
740
782
  /**
741
783
  * Opens a delete-sso-connection request.
742
784
  *
@@ -754,7 +796,7 @@ export declare class ControlApprovalsService {
754
796
  * Opening one needs `AccountsPermissions.ENTERPRISE_ORG_CONVERT`, the same
755
797
  * permission that approving needs. A 200 means that a request for the same
756
798
  * organization is already open. The route answers 404 while
757
- * `control.onboardToEnterpriseApproval` is off.
799
+ * `control.camundiApprovalFlow` is off.
758
800
  */
759
801
  static createOnboardToEnterprise(params: CreateApprovalRequest<OnboardToEnterprisePayloadDto>): Promise<{
760
802
  approval: ApprovalJobDto;
@@ -776,7 +818,7 @@ export declare class ControlApprovalsService {
776
818
  *
777
819
  * Opening one needs `AccountsPermissions.READ_ALL`.
778
820
  * A holder of `SALES_PLAN_SWITCH` approves it, and the last approval runs
779
- * it. The route answers 404 while `control.approvalInNegotiation` is off.
821
+ * it.
780
822
  */
781
823
  static createRequestInNegotiation(params: CreateApprovalRequest<RequestInNegotiationPayloadDto>): Promise<{
782
824
  approval: ApprovalJobDto;
@@ -788,7 +830,7 @@ export declare class ControlApprovalsService {
788
830
  * Opening one needs `ConsolePermissions.CHANNELS_AND_GENERATIONS_ADMIN`,
789
831
  * the same permission that approving needs. A 200 means that a request
790
832
  * over the same generations is already open. The route answers 404 while
791
- * `control.changeGenerationVersions` is off.
833
+ * `control.camundiApprovalFlow` is off.
792
834
  */
793
835
  static createChangeGenerationVersions(params: CreateApprovalRequest<ChangeGenerationVersionsPayloadDto>): Promise<{
794
836
  approval: ApprovalJobDto;
@@ -800,7 +842,7 @@ export declare class ControlApprovalsService {
800
842
  * Opening one needs `ConsolePermissions.CHANNELS_AND_GENERATIONS_ADMIN`,
801
843
  * the same permission that approving needs. A 200 means that a request
802
844
  * over the same generation is already open. The route answers 404 while
803
- * `control.editGeneration` is off.
845
+ * `control.camundiApprovalFlow` is off.
804
846
  */
805
847
  static createEditGeneration(params: CreateApprovalRequest<EditGenerationPayloadDto>): Promise<{
806
848
  approval: ApprovalJobDto;
@@ -812,7 +854,7 @@ export declare class ControlApprovalsService {
812
854
  * Opening one needs `ConsolePermissions.CLUSTERS_DELETE_CLUSTER`, the same
813
855
  * permission that approving needs. A 200 means that a request for the same
814
856
  * kind is already open. The route answers 404 while
815
- * `control.deleteClusterCorpses` is off, 409 when console has no corpse
857
+ * `control.camundiApprovalFlow` is off, 409 when console has no corpse
816
858
  * that a request can take, and 412 when console does not answer its
817
859
  * corpses.
818
860
  */
@@ -826,7 +868,7 @@ export declare class ControlApprovalsService {
826
868
  * Opening one needs `ConsolePermissions.CLUSTER_PLAN_TYPE_FORCE_DELETE`,
827
869
  * the same permission that approving needs. A 200 means that a request for
828
870
  * the same plan type is already open. The route answers 404 while
829
- * `control.forceDeleteClusterPlanType` is off or when console does not know
871
+ * `control.camundiApprovalFlow` is off or when console does not know
830
872
  * the plan type, 409 when no cluster uses the type or more than the cap do,
831
873
  * and 412 when console does not answer its clusters.
832
874
  */
@@ -840,7 +882,7 @@ export declare class ControlApprovalsService {
840
882
  * Opening one needs `AccountsPermissions.ENTERPRISE_ORG_CONVERT`, the same
841
883
  * permission that approving needs. A 200 means that a request with the
842
884
  * same organization name is already open. The route answers 404 while
843
- * `control.automatedEnterpriseOnboarding` is off.
885
+ * `control.camundiApprovalFlow` is off.
844
886
  */
845
887
  static createAutomatedEnterpriseOnboarding(params: CreateApprovalRequest<AutomatedEnterpriseOnboardingPayloadDto>): Promise<{
846
888
  approval: ApprovalJobDto;
@@ -852,7 +894,7 @@ export declare class ControlApprovalsService {
852
894
  * Opening one needs `ConsolePermissions.CLUSTERS_CAN_UPDATE_CLUSTERPLANTYPE`,
853
895
  * the same permission that approving needs. A 200 means that a request for
854
896
  * the same cluster is already open. The route answers 404 while
855
- * `control.changeClusterPlanType` is off.
897
+ * `control.camundiApprovalFlow` is off.
856
898
  */
857
899
  static createChangeClusterPlanType(params: CreateApprovalRequest<ChangeClusterPlanTypePayloadDto>): Promise<{
858
900
  approval: ApprovalJobDto;
@@ -958,13 +1000,34 @@ export declare class ControlApprovalsService {
958
1000
  * read `status` and `executionError` of the answer.
959
1001
  */
960
1002
  static execute(params: ApprovalIdRequest): Promise<ApprovalJobDto>;
1003
+ /**
1004
+ * Runs a `pending` request with the approval override grant of the caller,
1005
+ * in place of the approvals that it still needs. control-backend answers
1006
+ * 404 while `control.approvalOverride` is off.
1007
+ */
1008
+ static override(params: OverrideApprovalRequest): Promise<ApprovalJobDto>;
1009
+ /**
1010
+ * Opens a grant-approval-override request. Opening one needs
1011
+ * `accounts:admin:changeRole`, and it needs two approvals. A 200 means
1012
+ * that a request for the same grantee is already open.
1013
+ */
1014
+ static createGrantApprovalOverride(params: CreateApprovalRequest<GrantApprovalOverridePayloadDto>): Promise<{
1015
+ approval: ApprovalJobDto;
1016
+ created: boolean;
1017
+ }>;
1018
+ /**
1019
+ * The approval override grant of the caller that is active now, or
1020
+ * `undefined`. control-backend answers 404 while `control.approvalOverride`
1021
+ * is off.
1022
+ */
1023
+ static getMyOverrideGrant(params: RequestBaseParams): Promise<ApprovalOverrideGrantDto | undefined>;
961
1024
  /** Opens a send-to-expired-trial request. Any signed-in Camundi can. */
962
1025
  static createSendToExpiredTrial(params: CreateApprovalRequest<SendToExpiredTrialPayloadDto>): Promise<ApprovalJobDto>;
963
1026
  /**
964
1027
  * Opens an extend-trial request.
965
1028
  *
966
- * Opening one needs `accounts:admin:extendTrial`, and the reason is
967
- * necessary. The request needs no approval, so the answer already holds the
1029
+ * Opening one needs `accounts:admin:extendTrial`. The opener gives the one
1030
+ * approval, so no reason is necessary and the answer already holds the
968
1031
  * outcome.
969
1032
  */
970
1033
  static createExtendTrial(params: CreateExtendTrialRequest): Promise<ApprovalJobDto>;
@@ -215,6 +215,20 @@ class ControlApprovalsService {
215
215
  "api/approvals/change-org-limits"
216
216
  );
217
217
  }
218
+ /**
219
+ * Opens a llm-budget-top-up request.
220
+ *
221
+ * Opening one needs `accounts:admin:mayChangeOrgLimits`, the same
222
+ * permission that approving needs. A 200 means that a request for the same
223
+ * organization is already open.
224
+ */
225
+ static async createLlmBudgetTopUp(params) {
226
+ return ControlApprovalsService.create(
227
+ params,
228
+ "createLlmBudgetTopUp",
229
+ "api/approvals/llm-budget-top-up"
230
+ );
231
+ }
218
232
  /**
219
233
  * Opens a delete-sso-connection request.
220
234
  *
@@ -235,7 +249,7 @@ class ControlApprovalsService {
235
249
  * Opening one needs `AccountsPermissions.ENTERPRISE_ORG_CONVERT`, the same
236
250
  * permission that approving needs. A 200 means that a request for the same
237
251
  * organization is already open. The route answers 404 while
238
- * `control.onboardToEnterpriseApproval` is off.
252
+ * `control.camundiApprovalFlow` is off.
239
253
  */
240
254
  static async createOnboardToEnterprise(params) {
241
255
  return ControlApprovalsService.create(
@@ -263,7 +277,7 @@ class ControlApprovalsService {
263
277
  *
264
278
  * Opening one needs `AccountsPermissions.READ_ALL`.
265
279
  * A holder of `SALES_PLAN_SWITCH` approves it, and the last approval runs
266
- * it. The route answers 404 while `control.approvalInNegotiation` is off.
280
+ * it.
267
281
  */
268
282
  static async createRequestInNegotiation(params) {
269
283
  return ControlApprovalsService.create(
@@ -278,7 +292,7 @@ class ControlApprovalsService {
278
292
  * Opening one needs `ConsolePermissions.CHANNELS_AND_GENERATIONS_ADMIN`,
279
293
  * the same permission that approving needs. A 200 means that a request
280
294
  * over the same generations is already open. The route answers 404 while
281
- * `control.changeGenerationVersions` is off.
295
+ * `control.camundiApprovalFlow` is off.
282
296
  */
283
297
  static async createChangeGenerationVersions(params) {
284
298
  return ControlApprovalsService.create(
@@ -293,7 +307,7 @@ class ControlApprovalsService {
293
307
  * Opening one needs `ConsolePermissions.CHANNELS_AND_GENERATIONS_ADMIN`,
294
308
  * the same permission that approving needs. A 200 means that a request
295
309
  * over the same generation is already open. The route answers 404 while
296
- * `control.editGeneration` is off.
310
+ * `control.camundiApprovalFlow` is off.
297
311
  */
298
312
  static async createEditGeneration(params) {
299
313
  return ControlApprovalsService.create(
@@ -310,7 +324,7 @@ class ControlApprovalsService {
310
324
  * Opening one needs `ConsolePermissions.CLUSTERS_DELETE_CLUSTER`, the same
311
325
  * permission that approving needs. A 200 means that a request for the same
312
326
  * kind is already open. The route answers 404 while
313
- * `control.deleteClusterCorpses` is off, 409 when console has no corpse
327
+ * `control.camundiApprovalFlow` is off, 409 when console has no corpse
314
328
  * that a request can take, and 412 when console does not answer its
315
329
  * corpses.
316
330
  */
@@ -327,7 +341,7 @@ class ControlApprovalsService {
327
341
  * Opening one needs `ConsolePermissions.CLUSTER_PLAN_TYPE_FORCE_DELETE`,
328
342
  * the same permission that approving needs. A 200 means that a request for
329
343
  * the same plan type is already open. The route answers 404 while
330
- * `control.forceDeleteClusterPlanType` is off or when console does not know
344
+ * `control.camundiApprovalFlow` is off or when console does not know
331
345
  * the plan type, 409 when no cluster uses the type or more than the cap do,
332
346
  * and 412 when console does not answer its clusters.
333
347
  */
@@ -344,7 +358,7 @@ class ControlApprovalsService {
344
358
  * Opening one needs `AccountsPermissions.ENTERPRISE_ORG_CONVERT`, the same
345
359
  * permission that approving needs. A 200 means that a request with the
346
360
  * same organization name is already open. The route answers 404 while
347
- * `control.automatedEnterpriseOnboarding` is off.
361
+ * `control.camundiApprovalFlow` is off.
348
362
  */
349
363
  static async createAutomatedEnterpriseOnboarding(params) {
350
364
  return ControlApprovalsService.create(
@@ -359,7 +373,7 @@ class ControlApprovalsService {
359
373
  * Opening one needs `ConsolePermissions.CLUSTERS_CAN_UPDATE_CLUSTERPLANTYPE`,
360
374
  * the same permission that approving needs. A 200 means that a request for
361
375
  * the same cluster is already open. The route answers 404 while
362
- * `control.changeClusterPlanType` is off.
376
+ * `control.camundiApprovalFlow` is off.
363
377
  */
364
378
  static async createChangeClusterPlanType(params) {
365
379
  return ControlApprovalsService.create(
@@ -526,6 +540,62 @@ class ControlApprovalsService {
526
540
  "post"
527
541
  );
528
542
  }
543
+ /**
544
+ * Runs a `pending` request with the approval override grant of the caller,
545
+ * in place of the approvals that it still needs. control-backend answers
546
+ * 404 while `control.approvalOverride` is off.
547
+ */
548
+ static async override(params) {
549
+ return ControlApprovalsService.readOne(
550
+ params,
551
+ "override",
552
+ `api/approvals/${params.params.id}/override`,
553
+ "api/approvals/:id/override",
554
+ "post",
555
+ { reason: params.params.reason }
556
+ );
557
+ }
558
+ /**
559
+ * Opens a grant-approval-override request. Opening one needs
560
+ * `accounts:admin:changeRole`, and it needs two approvals. A 200 means
561
+ * that a request for the same grantee is already open.
562
+ */
563
+ static async createGrantApprovalOverride(params) {
564
+ return ControlApprovalsService.create(
565
+ params,
566
+ "createGrantApprovalOverride",
567
+ "api/approvals/grant-approval-override"
568
+ );
569
+ }
570
+ /**
571
+ * The approval override grant of the caller that is active now, or
572
+ * `undefined`. control-backend answers 404 while `control.approvalOverride`
573
+ * is off.
574
+ */
575
+ static async getMyOverrideGrant(params) {
576
+ const serviceContext = contextFor(
577
+ "getMyOverrideGrant",
578
+ "api/approvals/override-grants/me",
579
+ "api/approvals/override-grants/me",
580
+ "get",
581
+ params.config.metrics?.source || "unset"
582
+ );
583
+ const response = await request({
584
+ config: params.config,
585
+ base: BASE,
586
+ url: serviceContext.method.url,
587
+ method: "get",
588
+ metricsDetails: serviceContext
589
+ });
590
+ if (!response.ok) {
591
+ throw new HttpError(
592
+ `${serviceContext.method.name}: ${response.status} ${response.statusText}`,
593
+ response.status,
594
+ response.statusText
595
+ );
596
+ }
597
+ return response.body?.grant;
598
+ }
529
599
  /** Opens a send-to-expired-trial request. Any signed-in Camundi can. */
530
600
  static async createSendToExpiredTrial(params) {
531
601
  const { approval } = await ControlApprovalsService.create(
@@ -538,8 +608,8 @@ class ControlApprovalsService {
538
608
  /**
539
609
  * Opens an extend-trial request.
540
610
  *
541
- * Opening one needs `accounts:admin:extendTrial`, and the reason is
542
- * necessary. The request needs no approval, so the answer already holds the
611
+ * Opening one needs `accounts:admin:extendTrial`. The opener gives the one
612
+ * approval, so no reason is necessary and the answer already holds the
543
613
  * outcome.
544
614
  */
545
615
  static async createExtendTrial(params) {
@@ -691,7 +761,10 @@ class ControlApprovalsService {
691
761
  redactBody: options.redactBody,
692
762
  body: {
693
763
  payload: params.params.payload,
694
- reason: params.params.reason,
764
+ // control-backend accepts no reason, but it refuses an empty one
765
+ // (`min(1)`). A dialog sends the text of its textarea, so a blank
766
+ // text must leave the field out.
767
+ reason: params.params.reason?.trim() ? params.params.reason : void 0,
695
768
  requiredAcks: params.params.requiredAcks
696
769
  }
697
770
  });